osd-contiki/tests/rftest-rx.c

45 lines
756 B
C
Raw Normal View History

2010-02-26 23:44:39 +01:00
#include <mc1322x.h>
#include <board.h>
2010-03-03 19:39:14 +01:00
#include <stdio.h>
2010-02-26 23:44:39 +01:00
#include "tests.h"
#include "config.h"
2009-04-02 20:54:02 +02:00
2010-03-07 03:47:22 +01:00
#define DEBUG_MACA 1
void main(void) {
2010-03-07 03:47:22 +01:00
volatile packet_t *p;
2009-04-02 20:54:02 +02:00
2010-02-26 23:44:39 +01:00
uart_init(INC,MOD);
2010-03-07 03:47:22 +01:00
print_welcome("rftest-rx");
reset_maca();
radio_init();
2009-04-11 23:17:37 +02:00
flyback_init();
vreg_init();
init_phy();
2010-03-07 03:47:22 +01:00
free_all_packets();
2010-03-01 19:01:51 +01:00
/* trim the reference osc. to 24MHz */
pack_XTAL_CNTL(CTUNE_4PF, CTUNE, FTUNE, IBIAS);
set_power(0x0f); /* 0dbm */
set_channel(0); /* channel 11 */
2010-03-07 03:47:22 +01:00
enable_irq(MACA);
2009-04-02 20:54:02 +02:00
2010-03-07 03:47:22 +01:00
/* initial radio command */
/* nop, promiscuous, no cca */
*MACA_CONTROL = (1 << PRM) | (NO_CCA << MODE);
2009-04-02 20:54:02 +02:00
while(1) {
2010-03-07 03:47:22 +01:00
if((p = rx_packet())) {
/* print and free the packet */
printf("rftest-rx --- ");
print_packet(p);
free_packet(p);
}
2010-03-07 03:47:22 +01:00
}
}