Nuttx Upgrade:Adds sem_setprotocol

This commit is contained in:
David Sidrane
2016-12-12 03:22:22 -10:00
committed by Lorenz Meier
parent 8610eced57
commit c9f10107c0
11 changed files with 80 additions and 14 deletions
+12
View File
@@ -274,6 +274,10 @@ create_work_item(void)
/* If we got one then lock the item*/
if (item) {
px4_sem_init(&item->wait_sem, 1, 0); /* Caller will wait on this... initially locked */
/* item->wait_sem use case is a signal */
px4_sem_setprotocol(&item->wait_sem, SEM_PRIO_NONE);
}
/* return the item pointer, or NULL if all failed */
@@ -922,6 +926,10 @@ task_main(int argc, char *argv[])
px4_sem_init(&g_work_queued_sema, 1, 0);
/* g_work_queued_sema use case is a signal */
px4_sem_setprotocol(&g_work_queued_sema, SEM_PRIO_NONE);
if (!on_disk) {
/* In memory */
@@ -1135,6 +1143,10 @@ start(void)
px4_sem_init(&g_init_sema, 1, 0);
/* g_init_sema use case is a signal */
px4_sem_setprotocol(&g_init_sema, SEM_PRIO_NONE);
/* start the worker thread with low priority for disk IO */
if ((task = px4_task_spawn_cmd("dataman", SCHED_DEFAULT, SCHED_PRIORITY_DEFAULT - 10, 1200, task_main, NULL)) <= 0) {
warn("task start failed");
+6
View File
@@ -723,6 +723,12 @@ void Logger::run()
memset(&timer_call, 0, sizeof(hrt_call));
px4_sem_t timer_semaphore;
px4_sem_init(&timer_semaphore, 0, 0);
/* timer_semaphore use case is a signal */
px4_sem_setprotocol(&timer_semaphore, SEM_PRIO_NONE);
hrt_call_every(&timer_call, _log_interval, _log_interval, timer_callback, &timer_semaphore);
// check for new subscription data
@@ -222,6 +222,8 @@ private: // data members
Semaphore()
{
sem_init(&_Sem, 0, 0);
/* _Sem use case is a signal */
px4_sem_setprotocol(&_Sem, SEM_PRIO_NONE);
}
~Semaphore()
{
+2
View File
@@ -107,6 +107,8 @@ Syslink::Syslink() :
_bstate(BAT_DISCHARGING)
{
px4_sem_init(&memory_sem, 0, 0);
/* memory_sem use case is a signal */
px4_sem_setprotocol(&memory_sem, SEM_PRIO_NONE);
}
+2
View File
@@ -110,6 +110,8 @@ UavcanNode::UavcanNode(uavcan::ICanDriver &can_driver, uavcan::ISystemClock &sys
if (res < 0) {
std::abort();
}
/* _server_command_sem use case is a signal */
px4_sem_setprotocol(&_server_command_sem, SEM_PRIO_NONE);
if (_perfcnt_node_spin_elapsed == nullptr) {
errx(1, "uavcan: couldn't allocate _perfcnt_node_spin_elapsed");
@@ -345,19 +345,23 @@ class VirtualCanDriver : public uavcan::ICanDriver,
{
class Event
{
FAR sem_t sem;
FAR px4_sem_t sem;
public:
int init()
{
return sem_init(&sem, 0, 0);
int rv = px4_sem_init(&sem, 0, 0);
if (rv == 0) {
px4_sem_setprotocol(&sem, SEM_PRIO_NONE);
}
return rv;
}
int deinit()
{
return sem_destroy(&sem);
return px4_sem_destroy(&sem);
}
@@ -388,7 +392,7 @@ class VirtualCanDriver : public uavcan::ICanDriver,
abstime.tv_nsec -= NsPerSec;
}
(void)sem_timedwait(&sem, &abstime);
(void)px4_sem_timedwait(&sem, &abstime);
}
}
}
@@ -396,7 +400,7 @@ class VirtualCanDriver : public uavcan::ICanDriver,
void signal()
{
int count;
int rv = sem_getvalue(&sem, &count);
int rv = px4_sem_getvalue(&sem, &count);
if (rv > 0 && count <= 0) {
px4_sem_post(&sem);