Fixed bug causing Nordic drivers to use a different critical section API from Mbed. This caused conflicts when Nordic's critical section API would globally reenable interrupts while Mbed still expected to be in a critical section.

pull/10881/head
George Beckstein 2019-06-20 14:54:10 -04:00
parent bf78dc4441
commit f548f558da
2 changed files with 15 additions and 2 deletions

View File

@ -4,6 +4,8 @@ components/libraries
# Modifications # Modifications
* Modified util/app_util_platform.c to retarget critical section enter/exit calls to Mbed's HAL API so they both share the same nested critical regions counter. This only applies in builds without `SOFTDEVICE_PRESENT` defined.
Only essential folders have been copied over. Only essential folders have been copied over.
Removed: Removed:

View File

@ -39,6 +39,8 @@
*/ */
#include "app_util_platform.h" #include "app_util_platform.h"
#include "mbed_critical.h"
#ifdef SOFTDEVICE_PRESENT #ifdef SOFTDEVICE_PRESENT
/* Global nvic state instance, required by nrf_nvic.h */ /* Global nvic state instance, required by nrf_nvic.h */
nrf_nvic_state_t nrf_nvic_state; nrf_nvic_state_t nrf_nvic_state;
@ -71,8 +73,13 @@ void app_util_critical_region_enter(uint8_t *p_nested)
/* return value can be safely ignored */ /* return value can be safely ignored */
(void) sd_nvic_critical_region_enter(p_nested); (void) sd_nvic_critical_region_enter(p_nested);
#else #else
app_util_disable_irq(); /** Mbed modification
* Retarget nRF SDK to use Mbed critical section API
*/
//app_util_disable_irq();
core_util_critical_section_enter();
#endif #endif
} }
void app_util_critical_region_exit(uint8_t nested) void app_util_critical_region_exit(uint8_t nested)
@ -85,7 +92,11 @@ void app_util_critical_region_exit(uint8_t nested)
/* return value can be safely ignored */ /* return value can be safely ignored */
(void) sd_nvic_critical_region_exit(nested); (void) sd_nvic_critical_region_exit(nested);
#else #else
app_util_enable_irq(); /** Mbed modification
* Retarget nRF SDK to use Mbed critical section API
*/
//app_util_enable_irq();
core_util_critical_section_exit();
#endif #endif
} }