mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-16 00:33:35 +08:00
Nuttx Upgrade:Adds sem_setprotocol
This commit is contained in:
committed by
Lorenz Meier
parent
8610eced57
commit
c9f10107c0
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user