mirror of
https://github.com/espressif/esp-nimble.git
synced 2026-09-30 20:47:22 +00:00
Sync porting files
This commit is contained in:
committed by
Abhinav Kudnar
parent
14c98cc095
commit
4012844c28
@@ -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
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user