I am familiar with the 218x where imask is pushed into the status stack upon interrupt. From what I read, the 219x/2199x does not. It somehow prohibits interrupts from being serviced when in another ISR (assuming nesting mode is not enabled). What is the exact mechanism that prohibits the interrupts from being serviced? Is the pre-interrupt imask value still in the register? Can I simply modify imask when in an ISR? If not, how do I safely modify imask in an ISR? thanks, Dan Ash |
|
changing 219x/2199x imask in ISR - non-nesting mode
Started by ●March 5, 2004
Reply by ●March 11, 20042004-03-11
Dan, You can change the IMASK register on the 219x while in a ISR when using non-nested interrupts. For example, you might have a message transceiver ISR (SPORT, SPI, UART, etc) that masks it's interrupt when a message has been received to prevent further interrupts. If using nested interrupts, you'd have more then just a hardware context switch and would need to save all the registers to the stack. If your worried about some ISR changing the status of something in nested ISR code... turn off the interrupts for the section of code that your concerned with. Using a critical section is also a good idea when you have shared resources (ie registers or memory locations) amongst ISRs and regular sequenced code. Otherwise, GET/SET problems occur where say one interrupt GETS the value from a register and prior to writting back out to that register another interrupt occurs which GETS and SETS the register. Even in an non-nested approach you'd probably want to run a critical section around IMASK to prevent get GET/SET side effects. Also, if you have multiple interrupts for one ISR vector you'll need to use the Interrupt Source Registers (INTRDx) to determine the interrupts that have occured for a particular priority. Regards, Tim Dahlin Can the group owner change the default reply to the group instead of the individual who wrote the message being replied to? |