Texas Instruments TMS320 User Manual page 118

Dsp/bios v5.40
Hide thumbs Also See for TMS320:
Table of Contents

Advertisement

Hardware Interrupts
Example 4-1. Interrupt Behavior for C28x During Real-Time Mode
4-14
MAIN_LOOP:
; Do some stuff
SETC INTM, DBGM
/ Uninterruptible, unhaltable region of code
MOV ACC, @Semaphore
SUB ACC, #1
;Let's do "*Semaphore--;" really inefficiently!
MOV @Semaphore, ACC
CLRC INTM, DBGM
; Do some more stuff
B MAIN_LOOP
; By default, INTM and DBGM are set in an ISR so you can't halt
or interrupt
RT_ISR:
; Do some stuff
MOV ACC, @Semaphore
ADD ACC, #1
;Let's do "*Semaphore--;" really inefficiently!
MOV @Semaphore, ACC
; Do some more stuff
IRET
Note:
The code above is safe if the debugger issues a halt; you cannot halt in the
italicized regions above, so the PC will always be at the B MAIN_LOOP
instruction. If the user sets a watchpoint to occur when the address
Semaphore is accessed, the CPU will not be able to halt until after CLRC
INTM, DBGM is executed. The same result will occur if the user sets a
hardware breakpoint on RT_ISR. If the user sets a software breakpoint in
the italicized regions above, the CPU will halt, but the debugger will report
this as an error and indicate that this is an improper operation. In this case,
an atomic C28x instruction, such as DEC or INC, should have been used.

Advertisement

Table of Contents
loading

Table of Contents