ISR에서 잠들면 대략 난감한거다.
/* spru403r.pdf 2-175 page
Note: RTS Functions Callable from TSK Threads Only
Many runtime support (RTS) functions use lock and unlock functions to
prevent reentrancy. However, DSP/BIOS SWI and HWI threads cannot
call LCK_pend and LCK_post. As a result, RTS functions that call
LCK_pend or LCK_post must not be called in the context of a SWI or
HWI thread. For a list or RTS functions that should not be called from
a SWI or an HWI function, see “LCK_pend” on page 2-210
# fprintf, printf, vfprintf, sprintf, vprintf, vsprintf
# minit, malloc, realloc, free, calloc, memalign, memmap
# clock, strftime, rand, srand, getenv, exit, atexit
# tabinit, add_device, remove_device, open, read, write, lseek, close, unlink, rename
# HOSTopen, HOSTclose, HOSTread, HOSTwrite, HOSTlseek, HOSTunlink, HOSTrename, HOSTtime, HOSTclock.
Q: Why users are not allowed to call MEM functions (MEM_alloc, MEM_stat etc) from an HWI or SWI?
A: Memory management functions (MEM_alloc(), MEM_stat(), MEM_free()) are blocking calls. This is because the functions require the caller to acquire a lock to the memory before proceeding. In case the MEM functions fail to get a lock to the memory, there is a context switch. A call to a SWI or HWI routine should be non-blocking in nature and hence TI recommends that customer should not call MEM functions inside a SWI or HWI. In case the user makes blocking calls (MEM calls) inside a SWI or HWI, the behavior is not guaranteed. Making any blocking calls from a HWI or SWI can affect the real time response of the system.
Cause: Invoking BIOS APIs from the wrong context
Description: The BIOS API Guide has an appendix called "Function Callability Table". The table lists all BIOS APIs and specifies from what thread context it is legal to call them. Calling an API from the wrong context can cause stability issues.
If you choose NOT to use the dispatcher then you are not allowed to call certain BIOS APIs from the ISR (i.e. cannot call SWI_post, SEM_pend, etc.).
- SEM_pend should not be called from a HWI or SWI except with a timeout of 0.
- LCK_* functions should not be called from a HWI/SWI
[분류: 하드웨어 ]