Skip to content

Commit 1aa76b7

Browse files
committed
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.
1 parent 58c12f1 commit 1aa76b7

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

hal/common/mbed_critical.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
#include "cmsis.h"
2121
#include "mbed_assert.h"
22+
#include "toolchain.h"
2223

2324
#define EXCLUSIVE_ACCESS (!defined (__CORTEX_M0) && !defined (__CORTEX_M0PLUS))
2425

@@ -34,7 +35,7 @@ bool core_util_are_interrupts_enabled(void)
3435
#endif
3536
}
3637

37-
void core_util_critical_section_enter(void)
38+
MBED_WEAK void core_util_critical_section_enter(void)
3839
{
3940
bool interrupts_disabled = !core_util_are_interrupts_enabled();
4041
__disable_irq();
@@ -59,7 +60,7 @@ void core_util_critical_section_enter(void)
5960
interrupt_enable_counter++;
6061
}
6162

62-
void core_util_critical_section_exit(void)
63+
MBED_WEAK void core_util_critical_section_exit(void)
6364
{
6465
/* If critical_section_enter has not previously been called, do nothing */
6566
if (interrupt_enable_counter) {

0 commit comments

Comments
 (0)