From dc75722228b0c63666103613d742b769d5523531 Mon Sep 17 00:00:00 2001 From: henryk Date: Thu, 6 Dec 2007 19:38:50 +0000 Subject: Fix stupid buffer leakage code in standard mode git-svn-id: https://svn.openpcd.org:2342/trunk@376 6dc7ffe9-61d6-0310-9af1-9938baff3ed1 --- openpicc/application/iso14443_layer3a.c | 1 + openpicc/application/ssc_picc.c | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'openpicc') diff --git a/openpicc/application/iso14443_layer3a.c b/openpicc/application/iso14443_layer3a.c index 1433b33..381097f 100644 --- a/openpicc/application/iso14443_layer3a.c +++ b/openpicc/application/iso14443_layer3a.c @@ -244,6 +244,7 @@ void iso14443_layer3a_state_machine (void *pvParameters) if(need_receive) { if(xQueueReceive(ssc_rx_queue, &buffer, portTICK_RATE_MS) && buffer != NULL) { vLedSetGreen(0); + vLedBlinkGreen(); portENTER_CRITICAL(); buffer->state = PROCESSING; portEXIT_CRITICAL(); diff --git a/openpicc/application/ssc_picc.c b/openpicc/application/ssc_picc.c index 55f8978..9f0630f 100644 --- a/openpicc/application/ssc_picc.c +++ b/openpicc/application/ssc_picc.c @@ -193,6 +193,7 @@ static ssc_dma_rx_buffer_t* __ramfunc __ssc_rx_unload(int secondary) } else { AT91F_PDC_SetRx(rx_pdc, 0, 0); } + if(buffer->state == PENDING) buffer->state = FREE; ssc_state.buffer[secondary] = NULL; return buffer; @@ -414,7 +415,7 @@ static void __ramfunc ssc_irq(void) ssc_state.buffer[0] = ssc_state.buffer[1]; ssc_state.buffer[1] = NULL; if(ssc_state.mode == SSC_MODE_EDGE_ONE_SHOT || ssc_state.mode == SSC_MODE_14443A_SHORT - || ssc_state.mode == SSC_MODE_14443A_SHORT) { + || ssc_state.mode == SSC_MODE_14443A_STANDARD) { // Stop sampling here ssc_rx_stop(); } else { @@ -428,13 +429,13 @@ static void __ramfunc ssc_irq(void) //gaportEXIT_CRITICAL(); task_woken = xQueueSendFromISR(ssc_rx_queue, &ssc_state.buffer[0], task_woken); } - if (__ssc_rx_load(0) == -1) + if(ssc_sr & AT91C_SSC_RXENA) if (__ssc_rx_load(0) == -1) AT91F_SSC_DisableIt(ssc, AT91C_SSC_ENDRX | AT91C_SSC_RXBUFF | AT91C_SSC_OVRUN); } - if (__ssc_rx_load(1) == -1) + if(ssc_sr & AT91C_SSC_RXENA) if (__ssc_rx_load(1) == -1) AT91F_SSC_DisableIt(ssc, AT91C_SSC_ENDRX | AT91C_SSC_RXBUFF | AT91C_SSC_OVRUN); -- cgit v1.2.3