From 970d5b368d9d651a451435b9882720124566fcb9 Mon Sep 17 00:00:00 2001 From: Jean-François Milants Date: Sun, 11 Sep 2022 20:11:21 +0200 Subject: Fix submodule for date library --- .../mynewt-nimble/porting/nimble/include/logcfg/logcfg.h | 2 +- .../mynewt-nimble/porting/nimble/include/modlog/modlog.h | 3 ++- .../porting/npl/freertos/include/nimble/nimble_npl_os.h | 14 ++++++++++++-- .../porting/npl/freertos/src/npl_os_freertos.c | 2 ++ 4 files changed, 17 insertions(+), 4 deletions(-) (limited to 'src/libs/mynewt-nimble/porting') diff --git a/src/libs/mynewt-nimble/porting/nimble/include/logcfg/logcfg.h b/src/libs/mynewt-nimble/porting/nimble/include/logcfg/logcfg.h index 837cdeac..556635ca 100644 --- a/src/libs/mynewt-nimble/porting/nimble/include/logcfg/logcfg.h +++ b/src/libs/mynewt-nimble/porting/nimble/include/logcfg/logcfg.h @@ -8,7 +8,7 @@ #include "modlog/modlog.h" #include "log_common/log_common.h" -#define BLE_HS_LOG_DEBUG(...) IGNORE(__VA_ARGS__) +#define BLE_HS_LOG_DEBUG(...) MODLOG_DEBUG(4, __VA_ARGS__) #define BLE_HS_LOG_INFO(...) MODLOG_INFO(4, __VA_ARGS__) #define BLE_HS_LOG_WARN(...) MODLOG_WARN(4, __VA_ARGS__) #define BLE_HS_LOG_ERROR(...) MODLOG_ERROR(4, __VA_ARGS__) diff --git a/src/libs/mynewt-nimble/porting/nimble/include/modlog/modlog.h b/src/libs/mynewt-nimble/porting/nimble/include/modlog/modlog.h index 03904610..5b0ef45c 100644 --- a/src/libs/mynewt-nimble/porting/nimble/include/modlog/modlog.h +++ b/src/libs/mynewt-nimble/porting/nimble/include/modlog/modlog.h @@ -20,7 +20,8 @@ #ifndef H_MODLOG_ #define H_MODLOG_ -#include +#include "SEGGER_RTT.h" +#define printf(...) SEGGER_RTT_printf(0, __VA_ARGS__) #include "log_common/log_common.h" #include "log/log.h" diff --git a/src/libs/mynewt-nimble/porting/npl/freertos/include/nimble/nimble_npl_os.h b/src/libs/mynewt-nimble/porting/npl/freertos/include/nimble/nimble_npl_os.h index 545be0f4..3a3de40d 100644 --- a/src/libs/mynewt-nimble/porting/npl/freertos/include/nimble/nimble_npl_os.h +++ b/src/libs/mynewt-nimble/porting/npl/freertos/include/nimble/nimble_npl_os.h @@ -37,6 +37,8 @@ extern "C" { #define BLE_NPL_TIME_FOREVER portMAX_DELAY +extern volatile int ble_npl_in_critical; + /* This should be compatible with TickType_t */ typedef uint32_t ble_npl_time_t; typedef int32_t ble_npl_stime_t; @@ -282,14 +284,22 @@ static inline uint32_t ble_npl_hw_enter_critical(void) { //vPortEnterCritical(); - return npl_freertos_hw_enter_critical(); + ++ble_npl_in_critical; + return npl_freertos_hw_enter_critical(); } static inline void ble_npl_hw_exit_critical(uint32_t ctx) { - npl_freertos_hw_exit_critical(ctx); + --ble_npl_in_critical; + npl_freertos_hw_exit_critical(ctx); +} +static inline bool +ble_npl_hw_is_in_critical(void) +{ + // Do the same as RIOT and keep track of the critical state manually + return (ble_npl_in_critical > 0); } #ifdef __cplusplus diff --git a/src/libs/mynewt-nimble/porting/npl/freertos/src/npl_os_freertos.c b/src/libs/mynewt-nimble/porting/npl/freertos/src/npl_os_freertos.c index 875521ab..667a751c 100644 --- a/src/libs/mynewt-nimble/porting/npl/freertos/src/npl_os_freertos.c +++ b/src/libs/mynewt-nimble/porting/npl/freertos/src/npl_os_freertos.c @@ -22,6 +22,8 @@ #include #include "nimble/nimble_npl.h" +volatile int ble_npl_in_critical = 0; + static inline bool in_isr(void) { -- cgit v1.2.3