From 06e3e0b2072967ed5d1121d745ae80013aa011f5 Mon Sep 17 00:00:00 2001 From: Mariano Alvira Date: Mon, 8 Mar 2010 14:49:31 -0500 Subject: [PATCH] add maca_init() changed tests to use it. --- lib/include/maca.h | 1 + lib/maca.c | 20 ++++++++++++++++---- tests/per.c | 33 +++++++++------------------------ tests/rftest-rx.c | 25 +++++++------------------ tests/rftest-tx.c | 39 ++++++++++++++++++--------------------- 5 files changed, 51 insertions(+), 67 deletions(-) diff --git a/lib/include/maca.h b/lib/include/maca.h index 0bdd8fc8c..c2c5c26c8 100644 --- a/lib/include/maca.h +++ b/lib/include/maca.h @@ -106,6 +106,7 @@ #define MACA_KEY0 ((volatile uint32_t *) (MACA_BASE+0x164)) #define MACA_OPTIONS ((volatile uint32_t *) (MACA_BASE+0x180)) +void maca_init(void); void reset_maca(void); void init_phy(void); void flyback_init(void); diff --git a/lib/maca.c b/lib/maca.c index 844839dbe..f295f56c7 100644 --- a/lib/maca.c +++ b/lib/maca.c @@ -42,8 +42,23 @@ static volatile uint8_t last_post = NO_POST; #define safe_irq_disable(x) volatile uint32_t saved_irq; saved_irq = *INTENABLE; disable_irq(x) #define irq_restore() *INTENABLE = saved_irq -#define print_packets(x) Print_Packets(x) +void maca_init(void) { + reset_maca(); + radio_init(); + flyback_init(); + init_phy(); + free_all_packets(); + + /* initial radio command */ + /* nop, promiscuous, no cca */ + *MACA_CONTROL = (1 << PRM) | (NO_CCA << MODE); + + enable_irq(MACA); + maca_isr(); + +} +#define print_packets(x) Print_Packets(x) void Print_Packets(char *s) { volatile packet_t *p; int i = 0; @@ -232,11 +247,8 @@ void free_all_packets(void) { free_head = 0; for(i=0; i