From f06c7a7ffa7ca7bcd0c86238e9f94a9f4cf8333f Mon Sep 17 00:00:00 2001 From: henryk Date: Fri, 21 Dec 2007 00:24:39 +0000 Subject: Use finer grained #ifdef's for the new board's features git-svn-id: https://svn.openpcd.org:2342/trunk@400 6dc7ffe9-61d6-0310-9af1-9938baff3ed1 --- openpicc/application/ssc_picc.c | 6 ++++++ openpicc/application/tc_cdiv.c | 8 ++++---- openpicc/application/tc_cdiv_sync.c | 2 +- openpicc/config/board.h | 4 ++++ 4 files changed, 15 insertions(+), 5 deletions(-) (limited to 'openpicc') diff --git a/openpicc/application/ssc_picc.c b/openpicc/application/ssc_picc.c index ab3f2e9..d92c7bc 100644 --- a/openpicc/application/ssc_picc.c +++ b/openpicc/application/ssc_picc.c @@ -441,6 +441,9 @@ void ssc_tx_start(ssc_dma_tx_buffer_t *buf) AT91F_SSC_EnableTx(AT91C_BASE_SSC); #else ssc_tx_pending = 1; +#ifdef OPENPICC_USE_SSC_DATA_GATING + ssc_set_data_gate(0); +#endif pio_irq_enable(OPENPICC_SSC_TF); if(AT91F_PIO_IsInputSet(AT91C_BASE_PIOA, OPENPICC_SSC_TF)) { /* TF was probably already high when we enabled the PIO change interrupt for it. */ @@ -590,6 +593,9 @@ static void __ramfunc ssc_irq(void) DEBUGP("TXSYN "); if(ssc_sr & AT91C_SSC_ENDTX) { +#ifdef OPENPICC_USE_SSC_DATA_GATING + ssc_set_data_gate(1); +#endif //usb_print_string_f("ENDTX ", 0); if(ssc_tx_buffer.state == PENDING) { ssc_tx_buffer.state = FREE; diff --git a/openpicc/application/tc_cdiv.c b/openpicc/application/tc_cdiv.c index eb8484c..226abbe 100644 --- a/openpicc/application/tc_cdiv.c +++ b/openpicc/application/tc_cdiv.c @@ -45,7 +45,7 @@ void __ramfunc tc_cdiv_set_divider(u_int16_t div) * zero modulo the new RC.*/ /*tc_cdiv_phase_add(tcb->TCB_TC0.TC_RC-(tcb->TCB_TC0.TC_CV%tcb->TCB_TC0.TC_RC));*/ if(tcb->TCB_TC0.TC_CV > div -#ifdef OPENPICC_MODIFIED_BOARD +#ifdef OPENPICC_USE_CLOCK_GATING /* Don't spin if FRAME_BURST is clear, the clock is stopped in this case */ && !(!AT91F_PIO_IsInputSet(AT91C_BASE_PIOA, OPENPICC_PIO_FRAME_BURST)) #endif @@ -81,7 +81,7 @@ void tc_cdiv_init(void) OPENPICC_PIO_CARRIER_DIV_OUT | OPENPICC_PIO_CDIV_HELP_OUT | OPENPICC_PIO_CDIV_HELP_IN -#ifdef OPENPICC_MODIFIED_BOARD +#ifdef OPENPICC_USE_CLOCK_GATING | OPENPICC_PIO_FRAME_BURST #endif ); @@ -95,7 +95,7 @@ void tc_cdiv_init(void) /* Connect TCLK1 to XC1, TCLK2 to XC2 */ tcb->TCB_BMR &= ~(AT91C_TCB_TC1XC1S | AT91C_TCB_TC2XC2S); tcb->TCB_BMR |= (AT91C_TCB_TC1XC1S_TCLK1 | AT91C_TCB_TC2XC2S_TCLK2); -#ifdef OPENPICC_MODIFIED_BOARD +#ifdef OPENPICC_USE_CLOCK_GATING /* Connect TCLK0 to XC0 */ tcb->TCB_BMR &= ~(AT91C_TCB_TC0XC0S); tcb->TCB_BMR |= (AT91C_TCB_TC0XC0S_TCLK0); @@ -112,7 +112,7 @@ void tc_cdiv_init(void) AT91C_TC_BEEVT_SET | AT91C_TC_BCPB_CLEAR | AT91C_TC_EEVT_XC2 | AT91C_TC_ETRGEDG_RISING | AT91C_TC_BSWTRG_CLEAR | AT91C_TC_ASWTRG_CLEAR -#ifdef OPENPICC_MODIFIED_BOARD +#ifdef OPENPICC_USE_CLOCK_GATING | AT91C_TC_BURST_XC0 #endif ; diff --git a/openpicc/application/tc_cdiv_sync.c b/openpicc/application/tc_cdiv_sync.c index c6d3f47..dbaf3f7 100644 --- a/openpicc/application/tc_cdiv_sync.c +++ b/openpicc/application/tc_cdiv_sync.c @@ -46,7 +46,7 @@ void tc_cdiv_sync_reset(void) for (i = 0; i < 0xff; i++) ; AT91F_PIO_SetOutput(AT91C_BASE_PIOA, OPENPICC_PIO_SSC_DATA_CONTROL); -#ifdef OPENPICC_MODIFIED_BOARD +#ifdef OPENPICC_USE_CLOCK_GATING /* reset tc_cdiv counter, the cleared frame signal stopped the tc_cdiv clock */ tc_cdiv_reset(); #endif diff --git a/openpicc/config/board.h b/openpicc/config/board.h index e332b17..0cfc9a5 100644 --- a/openpicc/config/board.h +++ b/openpicc/config/board.h @@ -55,6 +55,10 @@ /* Modified board, routing PLL_LOCK to PA5 and a copy of FRAME to PA4, enabling the use of the T/C BURST feature. */ #define OPENPICC_MODIFIED_BOARD +#ifdef OPENPICC_MODIFIED_BOARD +#define OPENPICC_USE_SSC_DATA_GATING +#define OPENPICC_USE_CLOCK_GATING +#endif /*-----------------*/ /* Pins */ -- cgit v1.2.3