Guard RCC registers access with critical section (#854)
* Core: critical section macros. FuriHal: guard rcc registers access with critical section, fix condition race. * FuriHal: update documentation. Co-authored-by: SG <who.just.the.doctor@gmail.com>
This commit is contained in:
10
core/furi/common_defines.h
Executable file → Normal file
10
core/furi/common_defines.h
Executable file → Normal file
@@ -70,4 +70,14 @@
|
||||
#define REVERSE_BYTES_U32(x) \
|
||||
((((x)&0x000000FF) << 24) | (((x)&0x0000FF00) << 8) | (((x)&0x00FF0000) >> 8) | \
|
||||
(((x)&0xFF000000) >> 24))
|
||||
#endif
|
||||
|
||||
#ifndef FURI_CRITICAL_ENTER
|
||||
#define FURI_CRITICAL_ENTER() \
|
||||
uint32_t primask_bit = __get_PRIMASK(); \
|
||||
__disable_irq()
|
||||
#endif
|
||||
|
||||
#ifndef FURI_CRITICAL_EXIT
|
||||
#define FURI_CRITICAL_EXIT() __set_PRIMASK(primask_bit)
|
||||
#endif
|
Reference in New Issue
Block a user