Protecting Critical Code Regions
Protecting Critical Code Regions
In embedded systems, it is often necessary to protect a critical region of
code while it is being executed. This is often necessary while one logical
programming sequence is updating or modifying a piece of data. In these
cases, another logical programming sequence, such as interrupt processing
in one system (or different thread in an RTOS-based system) is prevented
from interfering while the critical data is being updated.
To that end, the interrupt manager provides two functions that can be
used to bracket a critical region of code:
and
adi_int_ExitCriticalRegion()
adi_int_EnterCriticalRegion()
section of code, and then calls the
function at the end of the critical section. These functions must be used in
pairs.
The actual implementation of these functions varies from operating envi-
ronment to operating environment. For example, in a standalone system
(systems without any RTOS), what actually happens in these functions
may be different than the version of these functions for an RTOS-based
system. The principle and usage, however, are the same, regardless of
implementation. In this way, application code always operates the same
way, and does not change, regardless of the operating environment.
2-12
adi_int_EnterCriticalRegion()
. The application calls the
function at the beginning of the critical
adi_int_ExitCriticalRegion()
VisualDSP++ 5.0 Device Drivers and System
Services Manual for Blackfin Processors
Need help?
Do you have a question about the VisualDSP++ 5.0 and is the answer not in the manual?
Questions and answers