# SAM7 driver interrupts

**URL:** <https://forums.freertos.org/t/sam7-driver-interrupts/2452>\
**Category:** Kernel\
**Created:** [September 8, 2008, 10:21pm UTC](https://forums.freertos.org/t/sam7-driver-interrupts/2452 "2008-09-08T22:21:06Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [September 8, 2008, 10:21pm UTC](https://forums.freertos.org/t/sam7-driver-interrupts/2452/1 "2008-09-08T22:21:06Z")

</div>

**[dslegend](https://sourceforge.net/u/dslegend/)** wrote on [Monday, September 08, 2008](https://sourceforge.net/p/freertos/discussion/382005/thread/693de6c5/#1340):

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.&nbsp; The SAM7 has an AIC and my dilema I only wish to disable/mask certain parts of an interrupt.&nbsp; The example being is that I have a uartISR and a spiISR.&nbsp; 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.&nbsp; 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).&nbsp; Am I doing this incorrectly or is that how the demo was created.&nbsp; Does anyone have any idea or can point out other forum postings that deal with this?

Thanks,

Dustin

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [September 9, 2008, 8:32am UTC](https://forums.freertos.org/t/sam7-driver-interrupts/2452/2 "2008-09-09T08:32:51Z")

</div>

**[davedoors](https://sourceforge.net/u/davedoors/)** wrote on [Tuesday, September 09, 2008](https://sourceforge.net/p/freertos/discussion/382005/thread/693de6c5/#1340/f48f):

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 [http://www.freertos.org/a00110.html#kernel\_priority](http://www.freertos.org/a00110.html#kernel_priority) . 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.

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [September 9, 2008, 1:56pm UTC](https://forums.freertos.org/t/sam7-driver-interrupts/2452/3 "2008-09-09T13:56:45Z")

</div>

**[dslegend](https://sourceforge.net/u/dslegend/)** wrote on [Tuesday, September 09, 2008](https://sourceforge.net/p/freertos/discussion/382005/thread/693de6c5/#1340/d6ee):

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

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [September 9, 2008, 4:47pm UTC](https://forums.freertos.org/t/sam7-driver-interrupts/2452/4 "2008-09-09T16:47:34Z")

</div>

**[david\_farrell](https://sourceforge.net/u/david_farrell/)** wrote on [Tuesday, September 09, 2008](https://sourceforge.net/p/freertos/discussion/382005/thread/693de6c5/#1340/d6ee/cb7a):

Most of what your describing is handled entirely by interrupt priorities or the masking of the AIC.&nbsp; 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.&nbsp; Search this forum there are recent threads about the kernel priority.&nbsp; 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.
