From 667b238148fb8b877fda411a134fc0b9cb443620 Mon Sep 17 00:00:00 2001 From: Mariano Alvira Date: Sun, 7 Mar 2010 16:49:57 -0500 Subject: [PATCH] rftest-tx and refine post_tx for fast transmission --- lib/maca.c | 14 ++-- tests/rftest-tx.c | 160 ++++++++++------------------------------------ 2 files changed, 40 insertions(+), 134 deletions(-) diff --git a/lib/maca.c b/lib/maca.c index 341d12b97..93e216c2f 100644 --- a/lib/maca.c +++ b/lib/maca.c @@ -177,24 +177,24 @@ void post_tx(void) { /* disable soft timeout clock */ /* disable start clock */ *MACA_TMRDIS = (1 << maca_tmren_sft) | ( 1 << maca_tmren_strt ) ; - /* set complete clock to long value */ + + /* this doesn't work right */ + /* lock up seems to happen when switching from receive to transmitt */ + /* set complete clock to long value */ /* acts like a watchdog incase the MACA locks up */ - *MACA_CPLCLK = *MACA_CLK + (CLK_PER_BYTE * dma_tx->length+6) + (CLK_PER_BYTE * 0); +// *MACA_CPLCLK = *MACA_CLK + (CLK_PER_BYTE * dma_tx->length+6) + (CLK_PER_BYTE * 0); /* enable complete clock */ - *MACA_TMREN = (1 << maca_tmren_cpl); - /* do the transmit */ - for(i=0; i<1000; i++) { continue; } +// *MACA_TMREN = (1 << maca_tmren_cpl); + enable_irq(MACA); /* *MACA_CONTROL = ( (1 << maca_ctrl_prm) | ( 4 << PRECOUNT) | (maca_ctrl_mode_no_cca << maca_ctrl_mode) | (1 << maca_ctrl_asap) | (maca_ctrl_seq_tx)); */ -// for(i=0; i<1000; i++) { continue; } *MACA_CONTROL = ( (1 << maca_ctrl_prm) | (maca_ctrl_mode_no_cca << maca_ctrl_mode) | (1 << maca_ctrl_asap) | (maca_ctrl_seq_tx)); - for(i=0; i<1000; i++) { continue; } } void tx_packet(volatile packet_t *p) { diff --git a/tests/rftest-tx.c b/tests/rftest-tx.c index c6d3484a9..fb5b3dbe1 100644 --- a/tests/rftest-tx.c +++ b/tests/rftest-tx.c @@ -5,57 +5,40 @@ #include "tests.h" #include "config.h" -#define DELAY 100000 -#define DATA 0x00401000 -#define DEBUG_MACA 1 +#define LED LED_RED -uint32_t ackBox[10]; +#define PAYLOAD_LEN 16 +#define DELAY 400000 -#define command_xcvr_rx() \ - do { \ - maca_txlen = (uint32_t)1<<16; \ - maca_dmatx = (uint32_t)&ackBox; \ - maca_dmarx = DATA; \ - maca_tmren = (maca_cpl_clk | maca_soft_clk); \ - maca_control = (control_prm | control_asap | control_seq_rx); \ - }while(0) - -#define PAYLOAD_LEN 16 /* not including the extra 4 bytes for len+fcs+somethingelse */ -/* maca dmatx needs extra 4 bytes for checksum */ -/* needs + 4 bytes for len(1 byte) + fcs(2 bytes) + somethingelse */ -#define command_xcvr_tx() \ - do { \ - maca_txlen = (uint32_t)(PAYLOAD_LEN+4); \ - maca_dmatx = (uint32_t)DATA; \ - maca_dmarx = (uint32_t)&ackBox; \ - maca_control = (control_prm | control_mode_no_cca | \ - control_asap | control_seq_tx); \ - }while(0) - - -volatile uint8_t *data; -uint8_t count=0; -void fill_data(void) { - uint8_t i; +void fill_packet(volatile packet_t *p) { + static volatile uint8_t count=0; + volatile uint8_t i; + p->length = PAYLOAD_LEN; for(i=0; idata[i] = count++; } } void main(void) { volatile uint32_t i; - uint16_t status; + volatile packet_t *p; + + *GPIO_DATA0 = 0x00000000; + *GPIO_PAD_DIR0 = ( 1 << LED ); + /* read from the data register instead of the pad */ + /* this is needed because the led clamps the voltage low */ + *GPIO_DATA_SEL0 = ( 1 << LED ); - *GPIO_PAD_DIR0 = LED; - led_on(); - uart_init(INC,MOD); + print_welcome("rftest-tx"); + reset_maca(); radio_init(); vreg_init(); flyback_init(); init_phy(); + free_all_packets(); /* trim the reference osc. to 24MHz */ pack_XTAL_CNTL(CTUNE_4PF, CTUNE, FTUNE, IBIAS); @@ -63,102 +46,25 @@ void main(void) { set_power(0x0f); /* 0dbm */ set_channel(0); /* channel 11 */ - *MACA_CONTROL = (1 << PRM) | (NO_CCA << MODE); - for(i=0; i