mirror of
https://github.com/espressif/esp-nimble.git
synced 2026-10-14 09:47:22 +00:00
porting: Remove BLE_NPL_WAIT_FOREVER from NPL API
There is already BLE_NPL_TIME_FOREVER which should be used instead. Also due to int promotion using BLE_NPL_WAIT_FOREVER was causing subtle issues on 64bit asrchitectures when used.
This commit is contained in:
@@ -79,12 +79,12 @@ int main(int argc, char *argv[])
|
|||||||
ble_store_ram_init();
|
ble_store_ram_init();
|
||||||
|
|
||||||
ble_npl_task_init(&s_task_hci, "hci_sock", ble_hci_sock_task,
|
ble_npl_task_init(&s_task_hci, "hci_sock", ble_hci_sock_task,
|
||||||
NULL, TASK_DEFAULT_PRIORITY, BLE_NPL_WAIT_FOREVER,
|
NULL, TASK_DEFAULT_PRIORITY, BLE_NPL_TIME_FOREVER,
|
||||||
TASK_DEFAULT_STACK, TASK_DEFAULT_STACK_SIZE);
|
TASK_DEFAULT_STACK, TASK_DEFAULT_STACK_SIZE);
|
||||||
|
|
||||||
/* Create task which handles default event queue for host stack. */
|
/* Create task which handles default event queue for host stack. */
|
||||||
ble_npl_task_init(&s_task_host, "ble_host", ble_host_task,
|
ble_npl_task_init(&s_task_host, "ble_host", ble_host_task,
|
||||||
NULL, TASK_DEFAULT_PRIORITY, BLE_NPL_WAIT_FOREVER,
|
NULL, TASK_DEFAULT_PRIORITY, BLE_NPL_TIME_FOREVER,
|
||||||
TASK_DEFAULT_STACK, TASK_DEFAULT_STACK_SIZE);
|
TASK_DEFAULT_STACK, TASK_DEFAULT_STACK_SIZE);
|
||||||
|
|
||||||
pthread_exit(&ret);
|
pthread_exit(&ret);
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ void *ble_mesh_adv_task(void *param)
|
|||||||
void mesh_initialized(void)
|
void mesh_initialized(void)
|
||||||
{
|
{
|
||||||
ble_npl_task_init(&s_task_mesh_adv, "ble_mesh_adv", ble_mesh_adv_task,
|
ble_npl_task_init(&s_task_mesh_adv, "ble_mesh_adv", ble_mesh_adv_task,
|
||||||
NULL, TASK_DEFAULT_PRIORITY, BLE_NPL_WAIT_FOREVER,
|
NULL, TASK_DEFAULT_PRIORITY, BLE_NPL_TIME_FOREVER,
|
||||||
TASK_DEFAULT_STACK, TASK_DEFAULT_STACK_SIZE);
|
TASK_DEFAULT_STACK, TASK_DEFAULT_STACK_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -82,12 +82,12 @@ int main(void)
|
|||||||
ble_store_ram_init();
|
ble_store_ram_init();
|
||||||
|
|
||||||
ble_npl_task_init(&s_task_hci, "hci_sock", ble_hci_sock_task,
|
ble_npl_task_init(&s_task_hci, "hci_sock", ble_hci_sock_task,
|
||||||
NULL, TASK_DEFAULT_PRIORITY, BLE_NPL_WAIT_FOREVER,
|
NULL, TASK_DEFAULT_PRIORITY, BLE_NPL_TIME_FOREVER,
|
||||||
TASK_DEFAULT_STACK, TASK_DEFAULT_STACK_SIZE);
|
TASK_DEFAULT_STACK, TASK_DEFAULT_STACK_SIZE);
|
||||||
|
|
||||||
/* Create task which handles default event queue for host stack. */
|
/* Create task which handles default event queue for host stack. */
|
||||||
ble_npl_task_init(&s_task_host, "ble_host", ble_host_task,
|
ble_npl_task_init(&s_task_host, "ble_host", ble_host_task,
|
||||||
NULL, TASK_DEFAULT_PRIORITY, BLE_NPL_WAIT_FOREVER,
|
NULL, TASK_DEFAULT_PRIORITY, BLE_NPL_TIME_FOREVER,
|
||||||
TASK_DEFAULT_STACK, TASK_DEFAULT_STACK_SIZE);
|
TASK_DEFAULT_STACK, TASK_DEFAULT_STACK_SIZE);
|
||||||
|
|
||||||
pthread_exit(&ret);
|
pthread_exit(&ret);
|
||||||
|
|||||||
@@ -26,8 +26,6 @@
|
|||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include <semaphore.h>
|
#include <semaphore.h>
|
||||||
|
|
||||||
#define BLE_NPL_WAIT_FOREVER (-1)
|
|
||||||
|
|
||||||
/* The highest and lowest task priorities */
|
/* The highest and lowest task priorities */
|
||||||
#define OS_TASK_PRI_HIGHEST (sched_get_priority_max(SCHED_RR))
|
#define OS_TASK_PRI_HIGHEST (sched_get_priority_max(SCHED_RR))
|
||||||
#define OS_TASK_PRI_LOWEST (sched_get_priority_min(SCHED_RR))
|
#define OS_TASK_PRI_LOWEST (sched_get_priority_min(SCHED_RR))
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ ble_npl_mutex_pend(struct ble_npl_mutex *mu, uint32_t timeout)
|
|||||||
return BLE_NPL_INVALID_PARAM;
|
return BLE_NPL_INVALID_PARAM;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (timeout == BLE_NPL_WAIT_FOREVER) {
|
if (timeout == BLE_NPL_TIME_FOREVER) {
|
||||||
err = pthread_mutex_lock(&mu->lock);
|
err = pthread_mutex_lock(&mu->lock);
|
||||||
} else {
|
} else {
|
||||||
err = clock_gettime(CLOCK_REALTIME, &mu->wait);
|
err = clock_gettime(CLOCK_REALTIME, &mu->wait);
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ ble_npl_sem_pend(struct ble_npl_sem *sem, uint32_t timeout)
|
|||||||
return BLE_NPL_INVALID_PARAM;
|
return BLE_NPL_INVALID_PARAM;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (timeout == BLE_NPL_WAIT_FOREVER) {
|
if (timeout == BLE_NPL_TIME_FOREVER) {
|
||||||
err = sem_wait(&sem->lock);
|
err = sem_wait(&sem->lock);
|
||||||
} else {
|
} else {
|
||||||
err = clock_gettime(CLOCK_REALTIME, &wait);
|
err = clock_gettime(CLOCK_REALTIME, &wait);
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ int test_get_no_wait(void)
|
|||||||
int test_get(void)
|
int test_get(void)
|
||||||
{
|
{
|
||||||
struct ble_npl_event *ev = ble_npl_eventq_get(&s_eventq,
|
struct ble_npl_event *ev = ble_npl_eventq_get(&s_eventq,
|
||||||
BLE_NPL_WAIT_FOREVER);
|
BLE_NPL_TIME_FOREVER);
|
||||||
|
|
||||||
VerifyOrQuit(ev == &s_event,
|
VerifyOrQuit(ev == &s_event,
|
||||||
"callout: wrong event passed");
|
"callout: wrong event passed");
|
||||||
|
|||||||
@@ -126,10 +126,10 @@ init_app_tasks(void)
|
|||||||
* Initialize tasks 1 and 2 with the OS.
|
* Initialize tasks 1 and 2 with the OS.
|
||||||
*/
|
*/
|
||||||
ble_npl_task_init(&task1, "task1", task1_handler, NULL, TASK1_PRIO,
|
ble_npl_task_init(&task1, "task1", task1_handler, NULL, TASK1_PRIO,
|
||||||
BLE_NPL_WAIT_FOREVER, task1_stack, TASK1_STACK_SIZE);
|
BLE_NPL_TIME_FOREVER, task1_stack, TASK1_STACK_SIZE);
|
||||||
|
|
||||||
ble_npl_task_init(&task2, "task2", task2_handler, NULL, TASK2_PRIO,
|
ble_npl_task_init(&task2, "task2", task2_handler, NULL, TASK2_PRIO,
|
||||||
BLE_NPL_WAIT_FOREVER, task2_stack, TASK2_STACK_SIZE);
|
BLE_NPL_TIME_FOREVER, task2_stack, TASK2_STACK_SIZE);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user