EasyManua.ls Logo

Texas Instruments TMS320

Texas Instruments TMS320
288 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Hardware Interrupts
4-18
DSP/BIOS has some code segments that need to be protected from
interrupts; these code sections are called critical sections. If these segments
are interrupted, and interrupt calls some DSP/BIOS API, it is bound to corrupt
the program results. Therefore, it is important to surround the code with SET
INTM, DBGM and CLRC INTM, DBGM.
Figure 4-2 shows two code examples of regions protected from all interrupts.
Example 4-2. Code Regions That are Uninterruptible
(a) Assembly Code
(b) C Code
Using HWI_restore instead of HWI_enable allows the pair of calls to be
nested. If the calls are nested, the outermost call to HWI_disable turns
interrupts off, and the innermost call to HWI_disable does nothing. Interrupts
are not reenabled until the outermost call to HWI_restore. Be careful when
using HWI_enable because this call enables interrupts even if they were
already disabled when HWI_disable was called.
Note:
DSP/BIOS kernel calls that can cause task rescheduling (for example,
SEM_post and TSK_sleep) should be avoided within a block surrounded by
HWI_disable and HWI_enable since the interrupts can be disabled for an
indeterminate amount of time if a task switch occurs.
.include hwi.h55
...
HWI_disable A ; disable all interrupts, save the old intm
value in reg A
’do some critical operation’
HWI_restore A0
.include hwi.h
Uns oldmask;
oldmask = HWI_disable();
’do some critical operation; ’
’do not call TSK_sleep(), SEM_post, etc.’
HWI_restore(oldmask);

Table of Contents

Other manuals for Texas Instruments TMS320

Related product manuals