HAL - Tag implementation of critical section enter/exit as weak so it can be overriden.

This change allows a port to provide its own implementation of:
* core_util_critical_section_enter
* core_util_critical_section_exit

Some system like the NRF series require specific behavior for the critical
section and now can override it properly.
pull/2849/head
Vincent Coubard 2016-09-27 16:54:33 +01:00
parent 58c12f19b2
commit 1aa76b7724
1 changed files with 3 additions and 2 deletions

View File

@ -19,6 +19,7 @@
#include "cmsis.h" #include "cmsis.h"
#include "mbed_assert.h" #include "mbed_assert.h"
#include "toolchain.h"
#define EXCLUSIVE_ACCESS (!defined (__CORTEX_M0) && !defined (__CORTEX_M0PLUS)) #define EXCLUSIVE_ACCESS (!defined (__CORTEX_M0) && !defined (__CORTEX_M0PLUS))
@ -34,7 +35,7 @@ bool core_util_are_interrupts_enabled(void)
#endif #endif
} }
void core_util_critical_section_enter(void) MBED_WEAK void core_util_critical_section_enter(void)
{ {
bool interrupts_disabled = !core_util_are_interrupts_enabled(); bool interrupts_disabled = !core_util_are_interrupts_enabled();
__disable_irq(); __disable_irq();
@ -59,7 +60,7 @@ void core_util_critical_section_enter(void)
interrupt_enable_counter++; interrupt_enable_counter++;
} }
void core_util_critical_section_exit(void) MBED_WEAK void core_util_critical_section_exit(void)
{ {
/* If critical_section_enter has not previously been called, do nothing */ /* If critical_section_enter has not previously been called, do nothing */
if (interrupt_enable_counter) { if (interrupt_enable_counter) {