diff options
author | henryk <henryk@6dc7ffe9-61d6-0310-9af1-9938baff3ed1> | 2008-03-05 05:52:53 +0000 |
---|---|---|
committer | henryk <henryk@6dc7ffe9-61d6-0310-9af1-9938baff3ed1> | 2008-03-05 05:52:53 +0000 |
commit | b5be7c184f7d07b49a04098cd41d980f90f7e699 (patch) | |
tree | 19c6ce79b44768d7336e533faf3b089389d13912 /openpicc/application/pio_irq.c | |
parent | 6304718e371e590b09e176c05df21fc5fb631cec (diff) |
convert pio irq isr to a switching isr
git-svn-id: https://svn.openpcd.org:2342/trunk@444 6dc7ffe9-61d6-0310-9af1-9938baff3ed1
Diffstat (limited to 'openpicc/application/pio_irq.c')
-rw-r--r-- | openpicc/application/pio_irq.c | 21 |
1 files changed, 13 insertions, 8 deletions
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) |