Revert "STM32 NuttX driver: Edge-triggered poll(), sort of fixes #35"

This reverts commit 22787651e6.
This commit is contained in:
Pavel Kirienko
2015-06-01 16:36:02 +03:00
parent 7518172f6e
commit 5442c0ac04
3 changed files with 33 additions and 14 deletions
@@ -194,7 +194,8 @@ class CanDriver : public uavcan::ICanDriver, uavcan::Noncopyable
public:
template <unsigned RxQueueCapacity>
CanDriver(CanRxItem (&rx_queue_storage)[UAVCAN_STM32_NUM_IFACES][RxQueueCapacity])
: if0_(bxcan::Can[0], update_event_, 0, rx_queue_storage[0], RxQueueCapacity)
: update_event_(*this)
, if0_(bxcan::Can[0], update_event_, 0, rx_queue_storage[0], RxQueueCapacity)
#if UAVCAN_STM32_NUM_IFACES > 1
, if1_(bxcan::Can[1], update_event_, 1, rx_queue_storage[1], RxQueueCapacity)
#endif
@@ -34,9 +34,11 @@ class BusEvent
chibios_rt::CounterSemaphore sem_;
public:
BusEvent()
BusEvent(CanDriver& can_driver)
: sem_(0)
{ }
{
(void)can_driver;
}
bool wait(uavcan::MonotonicDuration duration);
@@ -56,15 +58,13 @@ public:
#elif UAVCAN_STM32_NUTTX
/**
* All bus events are reported as POLLIN.
*/
class BusEvent : uavcan::Noncopyable
{
static const unsigned MaxPollWaiters = 8;
::file_operations file_ops_;
::pollfd* pollset_[MaxPollWaiters];
CanDriver& can_driver_;
bool signal_;
static int openTrampoline(::file* filp);
@@ -75,13 +75,15 @@ class BusEvent : uavcan::Noncopyable
int close(::file* filp);
int poll(::file* filp, ::pollfd* fds, bool setup);
unsigned makePollMask() const;
int addPollWaiter(::pollfd* fds);
int removePollWaiter(::pollfd* fds);
public:
static const char* const DevName;
BusEvent();
BusEvent(CanDriver& can_driver);
~BusEvent();
bool wait(uavcan::MonotonicDuration duration);