From a07c07fa630496a5dbf11aa1b8e0c4258fa78edf Mon Sep 17 00:00:00 2001 From: Steven Cartmell Date: Wed, 25 Oct 2017 19:32:07 +0100 Subject: [PATCH] Update HAL API header information --- hal/critical_section_api.h | 14 ++++++++++---- platform/mbed_critical.c | 4 ++-- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/hal/critical_section_api.h b/hal/critical_section_api.h index 5e99ba36f1..3ca51cfd2a 100644 --- a/hal/critical_section_api.h +++ b/hal/critical_section_api.h @@ -33,8 +33,11 @@ extern "C" { * This function is called directly by core_util_critical_section_enter on * first entrance to a critical section. * - * The default behavior of this function is to save the current state of - * interrupts before disabling them. + * There is a default implementation of this function which will save the + * current state of interrupts before disabling them. This implementation can + * be found in mbed_critical_section_api.c. This behaviour is can be overridden + * on a per platform basis by providing a different implementation within the + * correct targets directory. * * The function is only called once per critical section by * core_util_critical_section_enter. When implementing this function for a @@ -49,8 +52,11 @@ void hal_critical_section_enter(void); * This function is called directly by core_util_critical_section_exit on the * final exit from a critical section. * - * The default behavior of this function is to restore the state of interrupts - * as they were prior to entering this critical section. + * There is a default implementation of this function, it will restore the + * state of the interrupts as they were prior to entering this critical + * section, this implementation can be found in mbed_critical_section_api.c. + * This behavior is overridable by providing a different function + * implementation within the correct targets directory. * * This function is only called once per critical section. When implemented * for a specific platform it must restore any state that was saved upon diff --git a/platform/mbed_critical.c b/platform/mbed_critical.c index 87e71ca996..39f2adcebf 100644 --- a/platform/mbed_critical.c +++ b/platform/mbed_critical.c @@ -61,10 +61,10 @@ void core_util_critical_section_enter(void) // FIXME #ifdef FEATURE_UVISOR #warning "core_util_critical_section_enter needs fixing to work from unprivileged code" -#endif /* FEATURE_UVISOR */ - +#else // If the reentrancy counter overflows something has gone badly wrong. MBED_ASSERT(critical_section_reentrancy_counter < UINT32_MAX); +#endif /* FEATURE_UVISOR */ if (critical_section_reentrancy_counter == 0) { hal_critical_section_enter();