From 8dc345999942b1f213f54c2ce4f2878abdabac4a Mon Sep 17 00:00:00 2001 From: henryk Date: Wed, 14 Nov 2007 05:28:05 +0000 Subject: Rewrite irq handlers according to the new information in http://www.freertos.org/portsam7xlwIP.html: /* Call the handler function. This must be a separate function unless you can guarantee that handling the interrupt will never use any stack space. */ git-svn-id: https://svn.openpcd.org:2342/trunk@327 6dc7ffe9-61d6-0310-9af1-9938baff3ed1 --- openpicc/application/pio_irq.c | 10 +++++++--- openpicc/application/ssc_picc.c | 11 ++++++++--- openpicc/application/tc_fdt.c | 11 ++++++++--- 3 files changed, 23 insertions(+), 9 deletions(-) diff --git a/openpicc/application/pio_irq.c b/openpicc/application/pio_irq.c index d21d1db..5a82a85 100644 --- a/openpicc/application/pio_irq.c +++ b/openpicc/application/pio_irq.c @@ -85,11 +85,15 @@ void __ramfunc __pio_irq_demux(u_int32_t pio) } /* regular interrupt handler, in case fast forcing for PIOA disabled */ -static void pio_irq_demux(void) +static void pio_irq_demux_inner(void) { - portSAVE_CONTEXT(); u_int32_t pio = AT91F_PIO_GetInterruptStatus(AT91C_BASE_PIOA); __pio_irq_demux(pio); +} +static void pio_irq_demux_outer(void) __attribute__ ((naked)); +static void pio_irq_demux_outer(void) { + portSAVE_CONTEXT(); + pio_irq_demux_inner(); portRESTORE_CONTEXT(); } @@ -145,6 +149,6 @@ void pio_irq_init(void) AT91F_PIOA_CfgPMC(); AT91F_AIC_ConfigureIt(AT91C_ID_PIOA, OPENPICC_IRQ_PRIO_PIO, - AT91C_AIC_SRCTYPE_INT_HIGH_LEVEL, &pio_irq_demux); + AT91C_AIC_SRCTYPE_INT_HIGH_LEVEL, &pio_irq_demux_outer); AT91F_AIC_EnableIt(AT91C_ID_PIOA); } diff --git a/openpicc/application/ssc_picc.c b/openpicc/application/ssc_picc.c index 4d21644..9818296 100644 --- a/openpicc/application/ssc_picc.c +++ b/openpicc/application/ssc_picc.c @@ -313,9 +313,8 @@ static int8_t ssc_rx_refill(void) #define ISO14443A_FDT_SHORT_1 1236 #define ISO14443A_FDT_SHORT_0 1172 -static void __ramfunc ssc_irq(void) +static void __ramfunc ssc_irq_inner(void) { - portSAVE_CONTEXT(); u_int32_t ssc_sr = ssc->SSC_SR; // int i, *tmp, emptyframe = 0; DEBUGP("ssc_sr=0x%08x, mode=%u: ", ssc_sr, ssc_state.mode); @@ -453,6 +452,12 @@ static void __ramfunc ssc_irq(void) #endif DEBUGPCR("I"); AT91F_AIC_ClearIt(AT91C_ID_SSC); +} + +static void __ramfunc ssc_irq_outer(void) __attribute__ ((naked)); +static void __ramfunc ssc_irq_outer(void) { + portSAVE_CONTEXT(); + ssc_irq_inner(); portRESTORE_CONTEXT(); } @@ -546,7 +551,7 @@ void ssc_rx_init(void) AT91F_AIC_ConfigureIt(AT91C_ID_SSC, OPENPICC_IRQ_PRIO_SSC, - AT91C_AIC_SRCTYPE_INT_HIGH_LEVEL, (THandler)&ssc_irq); + AT91C_AIC_SRCTYPE_INT_HIGH_LEVEL, (THandler)&ssc_irq_outer); /* don't divide clock inside SSC, we do that in tc_cdiv */ ssc->SSC_CMR = 0; diff --git a/openpicc/application/tc_fdt.c b/openpicc/application/tc_fdt.c index 0193863..179ea98 100644 --- a/openpicc/application/tc_fdt.c +++ b/openpicc/application/tc_fdt.c @@ -55,9 +55,8 @@ void tc_frame_end_set(u_int16_t count) tcfdt->TC_RB = count; } -static void tc_fdt_irq(void) +static void tc_fdt_irq_inner(void) { - portSAVE_CONTEXT(); vLedSetGreen(1); u_int32_t sr = tcfdt->TC_SR; DEBUGP("tc_fdt_irq: TC2_SR=0x%08x TC2_CV=0x%08x ", @@ -84,6 +83,12 @@ static void tc_fdt_irq(void) DEBUGPCR(""); AT91F_AIC_AcknowledgeIt(); vLedSetGreen(0); +} + +static void tc_fdt_irq_outer(void) __attribute__ ((naked)); +static void tc_fdt_irq_outer(void) { + portSAVE_CONTEXT(); + tc_fdt_irq_inner(); portRESTORE_CONTEXT(); } @@ -125,7 +130,7 @@ void tc_fdt_init(void) AT91F_AIC_ConfigureIt(AT91C_ID_TC2, OPENPCD_IRQ_PRIO_TC_FDT, - AT91C_AIC_SRCTYPE_INT_HIGH_LEVEL, &tc_fdt_irq); + AT91C_AIC_SRCTYPE_INT_HIGH_LEVEL, &tc_fdt_irq_outer); AT91F_AIC_EnableIt(AT91C_ID_TC2); tcfdt->TC_IER = AT91C_TC_CPAS | AT91C_TC_CPBS | AT91C_TC_CPCS | -- cgit v1.2.3