SAM7 driver interrupts

dslegend wrote on Monday, September 08, 2008:

I am using the following:

Current freeRTOS (5.0.3)
GCC 4.2.1
Followed the Rowling/GCC AT91SAM7X demo

I currently create all interrupt code in ARM - naked and wrap the calls with portSAVE_CONTEXT and portRESTORE_CONTEXT.  The SAM7 has an AIC and my dilema I only wish to disable/mask certain parts of an interrupt.  The example being is that I have a uartISR and a spiISR.  When I am dealing with something critical with the UART, I would only like to to mask the UART ISR, not the FIQ and nIQ which in turn disables all interrupts.  When I need to disable IRQ’s, I am under the impression that I must only use ENTER_CRITICAL and EXIT_CRITICAL in my code and not try and mask individual interrupt flags (my code breaks if I try this).  Am I doing this incorrectly or is that how the demo was created.  Does anyone have any idea or can point out other forum postings that deal with this?



davedoors wrote on Tuesday, September 09, 2008:

One of the problems with the ARM7 is that each has a different interrupt controller so there is no single generic solution (the Cortex ports don’t have this problem).

Take a look at . You can basically copy this scheme by selecting which interrupts to disable and enable. If your ISR never calls an API function then you need never disable its interrupt as far as I know.

One easy thing you can do is change portENTER_CRITICAL() and portEXIT_CRITICAL() so they disable IRQ only and leave FIQ enabled. This is very common.

dslegend wrote on Tuesday, September 09, 2008:

If none of my ISRs have to interact with the RTOS, do I even need make them naked?  My ISRs basically handle peripheral functions (UART, SPI).  I try to disable interrupts so I can modify/check pointers and then re-enable.

david_farrell wrote on Tuesday, September 09, 2008:

Most of what your describing is handled entirely by interrupt priorities or the masking of the AIC.  Also note that the RTOS is a lower priority than your ISRs, the only thing you should have to save is the registers used, interrupt type, I don’t know about naked.  Search this forum there are recent threads about the kernel priority.  In the recent threads I think Richard comments about empty and fill pointers, done right you may not need to disable interrupts at all to modify them.