Nuttx Upgrade:Adds sem_setprotocol

This commit is contained in:
David Sidrane
2016-12-21 08:34:21 +01:00
committed by Lorenz Meier
parent 8610eced57
commit c9f10107c0
11 changed files with 80 additions and 14 deletions
+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);