diff options
-rw-r--r-- | openpicc/application/iso14443_layer2a.c | 3 | ||||
-rw-r--r-- | openpicc/application/pio_irq.c | 21 | ||||
-rw-r--r-- | openpicc/application/pio_irq.h | 3 | ||||
-rw-r--r-- | openpicc/application/pll.c | 3 |
4 files changed, 19 insertions, 11 deletions
diff --git a/openpicc/application/iso14443_layer2a.c b/openpicc/application/iso14443_layer2a.c index 3c55967..17cbca8 100644 --- a/openpicc/application/iso14443_layer2a.c +++ b/openpicc/application/iso14443_layer2a.c @@ -219,12 +219,13 @@ static void iso14443_ssc_callback(ssc_callback_reason reason, void *data) } -static void iso14443_rx_FRAME_cb(u_int32_t pio) +static portBASE_TYPE iso14443_rx_FRAME_cb(u_int32_t pio, portBASE_TYPE xTaskWoken) { (void)pio; if(PRINT_DEBUG) usb_print_string_f("°", 0); // DEBUG OUTPUT if(AT91F_PIO_IsInputSet(AT91C_BASE_PIOA, OPENPICC_PIO_FRAME)) ssc_frame_started(); + return xTaskWoken; } int iso14443_layer2a_init(u_int8_t enable_fast_receive) diff --git a/openpicc/application/pio_irq.c b/openpicc/application/pio_irq.c index 3a753d4..81ce3de 100644 --- a/openpicc/application/pio_irq.c +++ b/openpicc/application/pio_irq.c @@ -18,6 +18,8 @@ * */ +#include "FreeRTOS.h" + #include <errno.h> #include <sys/types.h> #include <lib_AT91SAM7.h> @@ -73,7 +75,7 @@ volatile u_int32_t pio_irq_isr_value; /* low-level handler, used by Cstartup_app.S PIOA fast forcing and * by regular interrupt handler below */ -void __ramfunc __pio_irq_demux(u_int32_t pio) +portBASE_TYPE __ramfunc __pio_irq_demux(u_int32_t pio, portBASE_TYPE xTaskWoken) { u_int8_t send_usb = 0; int i; @@ -83,33 +85,36 @@ void __ramfunc __pio_irq_demux(u_int32_t pio) for (i = 0; i < NR_PIO; i++) { if (pio & (1 << i) && pirqs.handlers[i]) - pirqs.handlers[i](i); + xTaskWoken = pirqs.handlers[i](i, xTaskWoken); if (pirqs.usbmask & (1 << i)) send_usb = 1; } AT91F_AIC_AcknowledgeIt(); //AT91F_AIC_ClearIt(AT91C_ID_PIOA); + return xTaskWoken; } /* regular interrupt handler, in case fast forcing for PIOA disabled */ static void pio_irq_demux(void) __attribute__ ((naked)); static void pio_irq_demux(void) { - portSAVE_CONTEXT(); + portENTER_SWITCHING_ISR(); + portBASE_TYPE xTaskWoken = pdFALSE; u_int32_t pio = AT91F_PIO_GetInterruptStatus(AT91C_BASE_PIOA); - __pio_irq_demux(pio); - portRESTORE_CONTEXT(); + xTaskWoken = __pio_irq_demux(pio, xTaskWoken); + portEXIT_SWITCHING_ISR(xTaskWoken); } /* nearly regular interrupt handler, in case fast forcing for PIOA is enabled and the secondary irq hack used */ static void pio_irq_demux_secondary(void) __attribute__ ((naked)); static void pio_irq_demux_secondary(void) { - portSAVE_CONTEXT(); - __pio_irq_demux(pio_irq_isr_value); + portENTER_SWITCHING_ISR(); + portBASE_TYPE xTaskWoken = pdFALSE; + xTaskWoken = __pio_irq_demux(pio_irq_isr_value, xTaskWoken); AT91F_AIC_ClearIt(PIO_SECONDARY_IRQ); - portRESTORE_CONTEXT(); + portEXIT_SWITCHING_ISR(xTaskWoken); } void pio_irq_enable(u_int32_t pio) diff --git a/openpicc/application/pio_irq.h b/openpicc/application/pio_irq.h index 98a4b63..d5d8490 100644 --- a/openpicc/application/pio_irq.h +++ b/openpicc/application/pio_irq.h @@ -2,9 +2,10 @@ #define _PIO_IRQ_H #include "openpicc.h" +#include "FreeRTOS.h" #define NR_PIO 32 -typedef void irq_handler_t(u_int32_t pio); +typedef portBASE_TYPE irq_handler_t(u_int32_t pio, portBASE_TYPE xTaskWoken); extern void pio_irq_enable(u_int32_t pio); extern void pio_irq_disable(u_int32_t pio); diff --git a/openpicc/application/pll.c b/openpicc/application/pll.c index aca95b1..400bbc9 100644 --- a/openpicc/application/pll.c +++ b/openpicc/application/pll.c @@ -44,13 +44,14 @@ int pll_is_locked(void) return AT91F_PIO_IsInputSet(AT91C_BASE_PIOA, OPENPICC->PLL_LOCK); } -static void pll_lock_change_cb(u_int32_t pio) +static portBASE_TYPE pll_lock_change_cb(u_int32_t pio, portBASE_TYPE xTaskWoken) { (void)pio; DEBUGPCRF("PLL LOCK: %d", pll_is_locked()); #if 0 vLedSetRed(pll_is_locked()); #endif + return xTaskWoken; } void pll_init(void) |