mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +08:00
::uavcan::CanIOManeger::MaxIfaces --> ::uavcan::MaxCanIfaces
This commit is contained in:
parent
53027b1365
commit
9d797e5ac5
@ -18,6 +18,8 @@
|
||||
namespace uavcan
|
||||
{
|
||||
|
||||
enum { MaxCanIfaces = 3 };
|
||||
|
||||
struct CanRxFrame : public CanFrame
|
||||
{
|
||||
MonotonicTime ts_mono;
|
||||
@ -116,14 +118,10 @@ public:
|
||||
|
||||
class CanIOManager : Noncopyable
|
||||
{
|
||||
public:
|
||||
enum { MaxIfaces = 3 };
|
||||
|
||||
private:
|
||||
ICanDriver& driver_;
|
||||
ISystemClock& sysclock_;
|
||||
|
||||
CanTxQueue tx_queues_[MaxIfaces];
|
||||
CanTxQueue tx_queues_[MaxCanIfaces];
|
||||
|
||||
// Noncopyable
|
||||
CanIOManager(CanIOManager&);
|
||||
@ -138,9 +136,9 @@ public:
|
||||
: driver_(driver)
|
||||
, sysclock_(sysclock)
|
||||
{
|
||||
assert(driver.getNumIfaces() <= MaxIfaces);
|
||||
assert(driver.getNumIfaces() <= MaxCanIfaces);
|
||||
// We can't initialize member array with non-default constructors in C++03
|
||||
for (int i = 0; i < MaxIfaces; i++)
|
||||
for (int i = 0; i < MaxCanIfaces; i++)
|
||||
{
|
||||
tx_queues_[i].~CanTxQueue();
|
||||
new (tx_queues_ + i) CanTxQueue(&allocator, &sysclock);
|
||||
|
||||
@ -196,7 +196,7 @@ bool CanTxQueue::topPriorityHigherOrEqual(const CanFrame& rhs_frame) const
|
||||
*/
|
||||
int CanIOManager::sendToIface(int iface_index, const CanFrame& frame, MonotonicTime tx_deadline, CanIOFlags flags)
|
||||
{
|
||||
assert(iface_index >= 0 && iface_index < MaxIfaces);
|
||||
assert(iface_index >= 0 && iface_index < MaxCanIfaces);
|
||||
ICanIface* const iface = driver_.getIface(iface_index);
|
||||
if (iface == NULL)
|
||||
{
|
||||
@ -214,7 +214,7 @@ int CanIOManager::sendToIface(int iface_index, const CanFrame& frame, MonotonicT
|
||||
|
||||
int CanIOManager::sendFromTxQueue(int iface_index)
|
||||
{
|
||||
assert(iface_index >= 0 && iface_index < MaxIfaces);
|
||||
assert(iface_index >= 0 && iface_index < MaxCanIfaces);
|
||||
CanTxQueue::Entry* entry = tx_queues_[iface_index].peek();
|
||||
if (entry == NULL)
|
||||
return 0;
|
||||
@ -238,14 +238,14 @@ int CanIOManager::makePendingTxMask() const
|
||||
int CanIOManager::getNumIfaces() const
|
||||
{
|
||||
const int num = driver_.getNumIfaces();
|
||||
assert(num > 0 && num <= MaxIfaces);
|
||||
return std::min(std::max(num, 0), (int)MaxIfaces);
|
||||
assert(num > 0 && num <= MaxCanIfaces);
|
||||
return std::min(std::max(num, 0), (int)MaxCanIfaces);
|
||||
}
|
||||
|
||||
uint64_t CanIOManager::getNumErrors(int iface_index) const
|
||||
{
|
||||
ICanIface* const iface = driver_.getIface(iface_index);
|
||||
if (iface == NULL || iface_index >= MaxIfaces || iface_index < 0)
|
||||
if (iface == NULL || iface_index >= MaxCanIfaces || iface_index < 0)
|
||||
{
|
||||
assert(0);
|
||||
return std::numeric_limits<uint64_t>::max();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user