From 1cc946b53a34fbb4bd7fcfaf91d26e34eb714621 Mon Sep 17 00:00:00 2001 From: Mariano Alvira Date: Mon, 13 Apr 2009 15:54:10 -0400 Subject: [PATCH] rftest-rx is done for now. it prints out each received packet with a timestamp and toggles the green led. --- include/maca.h | 3 + src/maca.c | 2 +- tests/rftest-rx.c | 197 ++++++++++++++++++++++++++++++---------------- 3 files changed, 133 insertions(+), 69 deletions(-) diff --git a/include/maca.h b/include/maca.h index 597f28039..ba263de5c 100644 --- a/include/maca.h +++ b/include/maca.h @@ -397,6 +397,9 @@ typedef union maca_maskirq_reg_tag uint32_t Reg; } maca_maskirq_reg_t; +#define _is_action_complete_interrupt(x) (0 != (maca_irq_acpl & x)) +#define _is_filter_failed_interrupt(x) (0 != (maca_irq_flt & x)) + #define SMAC_MACA_CNTL_INIT_STATE ( control_prm | control_nofc | control_mode_non_slotted ) #define MACA_WRITE(reg, src) (reg = src) diff --git a/src/maca.c b/src/maca.c index 723017c15..cf711c973 100644 --- a/src/maca.c +++ b/src/maca.c @@ -24,7 +24,7 @@ void init_phy(void) maca_framesync = 0x000000A7; maca_clk = 0x00000008; // maca_maskirq = 0; //(maca_irq_cm | maca_irq_acpl | maca_irq_rst | maca_irq_di | maca_irq_crc | maca_irq_flt ); - maca_maskirq = maca_irq_rst; + maca_maskirq = (maca_irq_rst | maca_irq_acpl | maca_irq_cm | maca_irq_flt); maca_slotoffset = 0x00350000; } diff --git a/tests/rftest-rx.c b/tests/rftest-rx.c index 18d428f6c..34721391b 100644 --- a/tests/rftest-rx.c +++ b/tests/rftest-rx.c @@ -9,6 +9,9 @@ #define UART1_CTS 0x80005014 #define UART1_BR 0x80005018 +#define GPIO_PAD_DIR0 0x80000000 +#define GPIO_DATA0 0x80000008 + #include "maca.h" #include "embedded_types.h" @@ -72,14 +75,32 @@ void dump_regs(uint32_t base, uint32_t len) { puts(NL); } +volatile uint8_t led; + +#define led_on() do { led = 1; reg(GPIO_DATA0) = 0x00000200; } while(0); +#define led_off() do { led = 0; reg(GPIO_DATA0) = 0x00000000; } while(0); + +void toggle_led(void) { + if(0 == led) { + led_on(); + led = 1; + + } else { + led_off(); + } +} + __attribute__ ((section ("startup"))) void main(void) { uint8_t c; volatile uint32_t i; uint32_t tmp; - volatile uint32_t *data; + volatile uint8_t *data; uint16_t status; + *(volatile uint32_t *)GPIO_PAD_DIR0 = 0x00000200; + led_on(); + /* Restore UART regs. to default */ /* in case there is still bootloader state leftover */ @@ -110,45 +131,122 @@ void main(void) { for(i=0; i