/* USER CODE BEGIN Header */ /** ****************************************************************************** * @file adv_buff_alloc.c * @author AMS - RF Application team * @brief Module providing buffer allocation for advertising data. ****************************************************************************** * @attention * * Copyright (c) 2024 STMicroelectronics. * All rights reserved. * * This software is licensed under terms that can be found in the LICENSE file * in the root directory of this software component. * If no LICENSE file comes with this software, it is provided AS-IS. * ****************************************************************************** */ /* USER CODE END Header */ #include #include #include "ble.h" #include "pawr_buff_alloc.h" #if (CFG_BLE_CONTROLLER_PERIODIC_ADV_WR_ENABLED == 1) static uint8_t pawr_subevent_buf[CFG_BLE_PAWR_SUBEVENT_DATA_COUNT_MAX][MAX_PAWR_SUBEVENT_DATA_SIZE]; static uint8_t pawr_resp_buff[MAX_PAWR_RESPONSE_SUBEVENT_COUNT][MAX_PAWR_SUBEVENT_DATA_SIZE]; #if CFG_BLE_PAWR_SUBEVENT_DATA_COUNT_MAX < 33 /* Variable used to keep which buffer is used and which one is not in use by the link layer. Up to 32 buffers can be handled. */ static uint32_t used_subevent_buff_msk; #elif CFG_BLE_PAWR_SUBEVENT_DATA_COUNT_MAX < 65 static uint64_t used_subevent_buff_msk; #else #error "This implementation does not allow to handle more than 64 buffers for subevents." #endif #if MAX_PAWR_RESPONSE_SUBEVENT_COUNT < 9 /* Variable used to keep which buffer is used and which one is not in use by the link layer. Up to 32 buffers can be handled. */ static uint8_t used_resp_buff_msk; #else #error "This implementation does not allow to handle more than 8 buffers for pawr responses." #endif #define BUFFER_IN_USE(mask, i) (mask & (1<