initial packet error rate test skeleton
This commit is contained in:
parent
46e25b463f
commit
0678e778b1
|
@ -32,7 +32,7 @@ CPPFLAGS := $(DBGFLAGS) $(OPTFLAGS) $(RELFLAGS) \
|
|||
-fno-builtin -ffreestanding -isystem \
|
||||
$(gccincdir) -pipe $(PLATFORM_CPPFLAGS)
|
||||
|
||||
CFLAGS := $(CPPFLAGS) -Wall -Wstrict-prototypes -Wcast-align -Wextra -Werror
|
||||
CFLAGS := $(CPPFLAGS) -Wall -Wstrict-prototypes -Wcast-align -Wextra #-Werror
|
||||
|
||||
AFLAGS_DEBUG := -Wa,-gstabs
|
||||
AFLAGS := $(AFLAGS_DEBUG) -D__ASSEMBLY__ $(CPPFLAGS)
|
||||
|
|
|
@ -14,7 +14,9 @@ TARGETS := blink-red blink-green blink-blue blink-white blink-allio \
|
|||
|
||||
# these targets are built with space reserved for variables needed by ROM services
|
||||
# this space is initialized with a rom call to rom_data_init
|
||||
TARGETS_WITH_ROM_VARS := nvm-read nvm-write romimg flasher rftest-rx rftest-tx
|
||||
TARGETS_WITH_ROM_VARS := nvm-read nvm-write romimg flasher \
|
||||
rftest-rx rftest-tx \
|
||||
per
|
||||
|
||||
include $(MC1322X)/Makefile.include
|
||||
|
||||
|
|
82
tests/per.c
Normal file
82
tests/per.c
Normal file
|
@ -0,0 +1,82 @@
|
|||
#include <mc1322x.h>
|
||||
#include <board.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "tests.h"
|
||||
#include "config.h"
|
||||
|
||||
/* This program communicates with itself and determines the packet */
|
||||
/* error rate (PER) under a variety of powers and packet sizes */
|
||||
/* Each test the packets are sent and received as fast as possible */
|
||||
|
||||
/* The program first scans on channel 11 and attempts to open a test */
|
||||
/* session with a node. After opening a session, the nodes begin the */
|
||||
/* test sequence */
|
||||
|
||||
#define DEBUG_MACA 1
|
||||
|
||||
typedef struct {
|
||||
int type;
|
||||
} packet_t;
|
||||
|
||||
enum STATES {
|
||||
SCANNING,
|
||||
MAX_STATE
|
||||
};
|
||||
|
||||
enum PACKET_TYPE {
|
||||
PACKET_PERTEST,
|
||||
MAX_PACKET_TYPE
|
||||
};
|
||||
|
||||
int get_packet(packet_t *p) { return 0; }
|
||||
void print_packet(packet_t p) { return; }
|
||||
|
||||
void main(void) {
|
||||
uint32_t state;
|
||||
packet_t p;
|
||||
|
||||
uart_init(INC,MOD);
|
||||
|
||||
print_welcome("Packet error test");
|
||||
|
||||
/* standard radio initialization */
|
||||
reset_maca();
|
||||
radio_init();
|
||||
vreg_init();
|
||||
flyback_init();
|
||||
init_phy();
|
||||
|
||||
/* trim the reference osc. to 24MHz */
|
||||
pack_XTAL_CNTL(CTUNE_4PF, CTUNE, FTUNE, IBIAS);
|
||||
|
||||
set_power(0x0f); /* 0dbm */
|
||||
set_channel(0); /* channel 11 */
|
||||
|
||||
/* initial radio command */
|
||||
/* nop, promiscuous, no cca */
|
||||
*MACA_CONTROL = (1 << PRM) | (NO_CCA << MODE);
|
||||
|
||||
state = SCANNING;
|
||||
while(1) {
|
||||
|
||||
switch(state) {
|
||||
case SCANNING:
|
||||
if(get_packet(&p)) {
|
||||
print_packet(p);
|
||||
/* if we have a packet */
|
||||
/* check if it's a pertest beacon */
|
||||
if(p.type == PACKET_PERTEST) {
|
||||
/* try to start a session */
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in a new issue