Sync porting files

This commit is contained in:
Roshan Bangar
2024-02-20 11:18:11 +05:30
committed by Abhinav Kudnar
parent 14c98cc095
commit 4012844c28
7 changed files with 45 additions and 19 deletions
-3
View File
@@ -1144,7 +1144,6 @@ struct ble_hci_le_subrate_req_cp {
uint16_t conn_handle;
uint16_t subrate_min;
uint16_t subrate_max;
uint16_t max_latency;
uint16_t cont_num;
uint16_t supervision_tmo;
} __attribute__((packed));
@@ -1266,8 +1265,6 @@ struct ble_hci_vs_set_antenna_cp {
/*
* Advertising filter policy
*
* Determines how an advertiser filters scan and connection requests.
*
* NONE: no filtering (default value). No whitelist used.
* SCAN: process all connection requests but only scans from white list.
* CONN: process all scan request but only connection requests from white list
+1 -1
View File
@@ -121,7 +121,7 @@ uint16_t ble_npl_sem_get_count(struct ble_npl_sem *sem);
* Callouts
*/
void ble_npl_callout_init(struct ble_npl_callout *co, struct ble_npl_eventq *evq,
int ble_npl_callout_init(struct ble_npl_callout *co, struct ble_npl_eventq *evq,
ble_npl_event_fn *ev_cb, void *ev_arg);
ble_npl_error_t ble_npl_callout_reset(struct ble_npl_callout *co,
+1 -1
View File
@@ -27,7 +27,7 @@
#define NIMBLE_HS_STACK_SIZE CONFIG_BT_NIMBLE_HOST_TASK_STACK_SIZE
#if (CONFIG_IDF_TARGET_ESP32H2 || CONFIG_IDF_TARGET_ESP32C2)
#if SOC_ESP_NIMBLE_CONTROLLER
#define NIMBLE_LL_STACK_SIZE CONFIG_BT_LE_CONTROLLER_TASK_STACK_SIZE
#endif
+4
View File
@@ -147,6 +147,10 @@ os_msys_buf_alloc(void)
#if OS_MSYS_2_BLOCK_COUNT > 0
os_msys_init_2_data = (os_membuf_t *)nimble_platform_mem_calloc(1, (sizeof(os_membuf_t) * SYSINIT_MSYS_2_MEMPOOL_SIZE));
if (!os_msys_init_2_data) {
#if OS_MSYS_1_BLOCK_COUNT > 0
nimble_platform_mem_free(os_msys_init_1_data);
os_msys_init_1_data = NULL;
#endif
return ESP_FAIL;
}
#endif
@@ -113,7 +113,7 @@ struct npl_funcs_t {
ble_npl_error_t (*p_ble_npl_sem_pend)(struct ble_npl_sem *, ble_npl_time_t);
ble_npl_error_t (*p_ble_npl_sem_release)(struct ble_npl_sem *);
uint16_t (*p_ble_npl_sem_get_count)(struct ble_npl_sem *);
void (*p_ble_npl_callout_init)(struct ble_npl_callout *, struct ble_npl_eventq *, ble_npl_event_fn *, void *);
int (*p_ble_npl_callout_init)(struct ble_npl_callout *, struct ble_npl_eventq *, ble_npl_event_fn *, void *);
ble_npl_error_t (*p_ble_npl_callout_reset)(struct ble_npl_callout *, ble_npl_time_t);
void (*p_ble_npl_callout_stop)(struct ble_npl_callout *);
void (*p_ble_npl_callout_deinit)(struct ble_npl_callout *);
@@ -270,7 +270,7 @@ IRAM_ATTR ble_npl_sem_get_count(struct ble_npl_sem *sem)
return npl_funcs->p_ble_npl_sem_get_count(sem);
}
static inline void
static inline int
IRAM_ATTR ble_npl_callout_init(struct ble_npl_callout *co, struct ble_npl_eventq *evq,
ble_npl_event_fn *ev_cb, void *ev_arg)
{
@@ -83,7 +83,7 @@ ble_npl_error_t npl_freertos_sem_pend(struct ble_npl_sem *sem,
ble_npl_error_t npl_freertos_sem_release(struct ble_npl_sem *sem);
void npl_freertos_callout_init(struct ble_npl_callout *co,
int npl_freertos_callout_init(struct ble_npl_callout *co,
struct ble_npl_eventq *evq,
ble_npl_event_fn *ev_cb, void *ev_arg);
+36 -11
View File
@@ -683,7 +683,7 @@ IRAM_ATTR os_callout_timer_cb(TimerHandle_t timer)
}
#endif
void
int
IRAM_ATTR npl_freertos_callout_init(struct ble_npl_callout *co, struct ble_npl_eventq *evq,
ble_npl_event_fn *ev_cb, void *ev_arg)
{
@@ -707,13 +707,25 @@ IRAM_ATTR npl_freertos_callout_init(struct ble_npl_callout *co, struct ble_npl_e
.name = "nimble_timer"
};
ESP_ERROR_CHECK(esp_timer_create(&create_args, &callout->handle));
if (esp_timer_create(&create_args, &callout->handle) != ESP_OK) {
ble_npl_event_deinit(&callout->ev);
os_memblock_put(&ble_freertos_co_pool,callout);
co->co = NULL;
return -1;
}
#else
callout->handle = xTimerCreate("co", 1, pdFALSE, callout, os_callout_timer_cb);
if (!callout->handle) {
ble_npl_event_deinit(&callout->ev);
os_memblock_put(&ble_freertos_co_pool,callout);
co->co = NULL;
return -1;
}
#endif
BLE_LL_ASSERT(callout->handle);
} else {
callout = (struct ble_npl_callout_freertos *)co->co;
BLE_LL_ASSERT(callout);
@@ -725,7 +737,9 @@ IRAM_ATTR npl_freertos_callout_init(struct ble_npl_callout *co, struct ble_npl_e
if(!co->co) {
co->co = malloc(sizeof(struct ble_npl_callout_freertos));
callout = (struct ble_npl_callout_freertos *)co->co;
BLE_LL_ASSERT(callout);
if (!callout) {
return -1;
}
memset(callout, 0, sizeof(*callout));
ble_npl_event_init(&callout->ev, ev_cb, ev_arg);
@@ -739,12 +753,22 @@ IRAM_ATTR npl_freertos_callout_init(struct ble_npl_callout *co, struct ble_npl_e
.name = "nimble_timer"
};
ESP_ERROR_CHECK(esp_timer_create(&create_args, &callout->handle));
if (esp_timer_create(&create_args, &callout->handle) != ESP_OK) {
ble_npl_event_deinit(&callout->ev);
free((void *)callout);
co->co = NULL;
return -1;
}
#else
callout->handle = xTimerCreate("co", 1, pdFALSE, callout, os_callout_timer_cb);
#endif
BLE_LL_ASSERT(callout->handle);
if (!callout->handle) {
ble_npl_event_deinit(&callout->ev);
free((void *)callout);
co->co = NULL;
return -1;
}
#endif
}
else {
callout = (struct ble_npl_callout_freertos *)co->co;
@@ -753,7 +777,7 @@ IRAM_ATTR npl_freertos_callout_init(struct ble_npl_callout *co, struct ble_npl_e
ble_npl_event_init(&callout->ev, ev_cb, ev_arg);
}
#endif
return 0;
}
void
@@ -766,8 +790,10 @@ IRAM_ATTR npl_freertos_callout_deinit(struct ble_npl_callout *co)
return;
}
BLE_LL_ASSERT(callout->handle);
if (!callout->handle) {
return;
}
ble_npl_event_deinit(&callout->ev);
#if CONFIG_BT_NIMBLE_USE_ESP_TIMER
if(esp_timer_stop(callout->handle))
ESP_LOGD(TAG, "Timer not stopped");
@@ -778,7 +804,6 @@ IRAM_ATTR npl_freertos_callout_deinit(struct ble_npl_callout *co)
#else
xTimerDelete(callout->handle, portMAX_DELAY);
ble_npl_event_deinit(&callout->ev);
#if OS_MEM_ALLOC
os_memblock_put(&ble_freertos_co_pool,callout);