diff --git a/epicardium/ble/ble.c b/epicardium/ble/ble.c index 59b25ef07b761dd4570076cc6994d84b52310ff8..b5afbbac2317e14ed5bc5239f45ba24810d6cea3 100644 --- a/epicardium/ble/ble.c +++ b/epicardium/ble/ble.c @@ -64,6 +64,7 @@ static bool log_enabled = false; static int log_lastflushtick = 0; /*! \brief Stack initialization for app. */ +extern void LlStackInit(void); extern void StackInit(void); extern void bleuart_init(void); extern void bleFileTransfer_init(void); @@ -431,12 +432,15 @@ void vBleTask(void *pvParameters) NVIC_EnableIRQ(RSV11_IRQn); WsfInit(); + taskENTER_CRITICAL(); /* Critical section to prevent a loop in iq_capture2 / meas_freq in * /home/maxim/Documents/src/BLE/mcbusw/Hardware/Micro/ME14/Firmware/trunk/NDALibraries/BTLE/phy/dbb/prot/ble/pan2g5/afe/max32665/board_config.c:275 - * if BHI160 and -Ddebug_prints=true is enabled*/ - StackInit(); + * if BHI160 and -Ddebug_prints=true is enabled. See #115. */ + LlStackInit(); taskEXIT_CRITICAL(); + + StackInit(); BbBleDrvSetTxPower(0); setAddress(); diff --git a/epicardium/ble/stack.c b/epicardium/ble/stack.c index 3d24b0c5957b2df1195cbf22638c0db90560ac82..35a9d41189d55ab6d5956c30d09680fe71b2fb3b 100644 --- a/epicardium/ble/stack.c +++ b/epicardium/ble/stack.c @@ -105,16 +105,13 @@ const BbRtCfg_t _bb_cfg = { /*************************************************************************************************/ /*! - * \brief Initialize stack. + * \brief Initialize link layer part of the stack. * * \return None. */ /*************************************************************************************************/ -void StackInit(void) +void LlStackInit() { - wsfHandlerId_t handlerId; - -/* card10: We do not use the SDMA HCI at the moment. The block below is not compiled. */ #ifndef ENABLE_SDMA uint32_t memUsed; @@ -137,6 +134,18 @@ void StackInit(void) (unsigned int)LL_MEMORY_FOOTPRINT); } #endif +} + +/*************************************************************************************************/ +/*! + * \brief Initialize stack. + * + * \return None. + */ +/*************************************************************************************************/ +void StackInit(void) +{ + wsfHandlerId_t handlerId; SecInit(); SecRandInit();