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:
Szymon Janc
2019-09-10 21:26:25 +02:00
parent 03f4b3f903
commit a069ebb3f3
7 changed files with 10 additions and 12 deletions
+2 -2
View File
@@ -79,12 +79,12 @@ int main(int argc, char *argv[])
ble_store_ram_init();
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);
/* Create task which handles default event queue for host stack. */
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);
pthread_exit(&ret);
+3 -3
View File
@@ -63,7 +63,7 @@ void *ble_mesh_adv_task(void *param)
void mesh_initialized(void)
{
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);
}
@@ -82,12 +82,12 @@ int main(void)
ble_store_ram_init();
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);
/* Create task which handles default event queue for host stack. */
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);
pthread_exit(&ret);
@@ -26,8 +26,6 @@
#include <pthread.h>
#include <semaphore.h>
#define BLE_NPL_WAIT_FOREVER (-1)
/* The highest and lowest task priorities */
#define OS_TASK_PRI_HIGHEST (sched_get_priority_max(SCHED_RR))
#define OS_TASK_PRI_LOWEST (sched_get_priority_min(SCHED_RR))
+1 -1
View File
@@ -60,7 +60,7 @@ ble_npl_mutex_pend(struct ble_npl_mutex *mu, uint32_t timeout)
return BLE_NPL_INVALID_PARAM;
}
if (timeout == BLE_NPL_WAIT_FOREVER) {
if (timeout == BLE_NPL_TIME_FOREVER) {
err = pthread_mutex_lock(&mu->lock);
} else {
err = clock_gettime(CLOCK_REALTIME, &mu->wait);
+1 -1
View File
@@ -60,7 +60,7 @@ ble_npl_sem_pend(struct ble_npl_sem *sem, uint32_t timeout)
return BLE_NPL_INVALID_PARAM;
}
if (timeout == BLE_NPL_WAIT_FOREVER) {
if (timeout == BLE_NPL_TIME_FOREVER) {
err = sem_wait(&sem->lock);
} else {
err = clock_gettime(CLOCK_REALTIME, &wait);
+1 -1
View File
@@ -94,7 +94,7 @@ int test_get_no_wait(void)
int test_get(void)
{
struct ble_npl_event *ev = ble_npl_eventq_get(&s_eventq,
BLE_NPL_WAIT_FOREVER);
BLE_NPL_TIME_FOREVER);
VerifyOrQuit(ev == &s_event,
"callout: wrong event passed");
+2 -2
View File
@@ -126,10 +126,10 @@ init_app_tasks(void)
* Initialize tasks 1 and 2 with the OS.
*/
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_WAIT_FOREVER, task2_stack, TASK2_STACK_SIZE);
BLE_NPL_TIME_FOREVER, task2_stack, TASK2_STACK_SIZE);
return 0;
}