forked from Archive/PX4-Autopilot
Merge pull request #2751 from PX4/master_uavcan_servers_single_iface
UAVCAN: using only primary interface for firmware update and node ID allocation
This commit is contained in:
commit
5fad70b0df
|
@ -194,7 +194,7 @@ int UavcanNode::start_fw_server()
|
|||
|
||||
if (_servers == nullptr) {
|
||||
|
||||
rv = UavcanServers::start(2, _node);
|
||||
rv = UavcanServers::start(_node);
|
||||
|
||||
if (rv >= 0) {
|
||||
/*
|
||||
|
|
|
@ -76,7 +76,7 @@
|
|||
UavcanServers *UavcanServers::_instance;
|
||||
UavcanServers::UavcanServers(uavcan::INode &main_node) :
|
||||
_subnode_thread(-1),
|
||||
_vdriver(UAVCAN_STM32_NUM_IFACES, uavcan_stm32::SystemClock::instance()),
|
||||
_vdriver(NumIfaces, uavcan_stm32::SystemClock::instance()),
|
||||
_subnode(_vdriver, uavcan_stm32::SystemClock::instance()),
|
||||
_main_node(main_node),
|
||||
_tracer(),
|
||||
|
@ -101,7 +101,7 @@ UavcanServers::~UavcanServers()
|
|||
_main_node.getDispatcher().removeRxFrameListener();
|
||||
}
|
||||
|
||||
int UavcanServers::stop(void)
|
||||
int UavcanServers::stop()
|
||||
{
|
||||
UavcanServers *server = instance();
|
||||
|
||||
|
@ -123,7 +123,7 @@ int UavcanServers::stop(void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int UavcanServers::start(unsigned num_ifaces, uavcan::INode &main_node)
|
||||
int UavcanServers::start(uavcan::INode &main_node)
|
||||
{
|
||||
if (_instance != nullptr) {
|
||||
warnx("Already started");
|
||||
|
@ -140,7 +140,7 @@ int UavcanServers::start(unsigned num_ifaces, uavcan::INode &main_node)
|
|||
return -2;
|
||||
}
|
||||
|
||||
int rv = _instance->init(num_ifaces);
|
||||
int rv = _instance->init();
|
||||
|
||||
if (rv < 0) {
|
||||
warnx("Node init failed: %d", rv);
|
||||
|
@ -174,7 +174,7 @@ int UavcanServers::start(unsigned num_ifaces, uavcan::INode &main_node)
|
|||
return rv;
|
||||
}
|
||||
|
||||
int UavcanServers::init(unsigned num_ifaces)
|
||||
int UavcanServers::init()
|
||||
{
|
||||
errno = 0;
|
||||
|
||||
|
@ -268,6 +268,7 @@ int UavcanServers::init(unsigned num_ifaces)
|
|||
|
||||
return OK;
|
||||
}
|
||||
|
||||
__attribute__((optimize("-O0")))
|
||||
pthread_addr_t UavcanServers::run(pthread_addr_t)
|
||||
{
|
||||
|
|
|
@ -72,9 +72,11 @@
|
|||
*/
|
||||
class UavcanServers
|
||||
{
|
||||
static constexpr unsigned NumIfaces = 1; // UAVCAN_STM32_NUM_IFACES
|
||||
|
||||
static constexpr unsigned MemPoolSize = 64 * uavcan::MemPoolBlockSize;
|
||||
|
||||
static constexpr unsigned MaxCanFramsPerTransfer = 63;
|
||||
static constexpr unsigned MaxCanFramesPerTransfer = 63;
|
||||
|
||||
/**
|
||||
* This number is based on the worst case max number of frames per interface. With
|
||||
|
@ -84,7 +86,7 @@ class UavcanServers
|
|||
* 1 instead of UAVCAN_STM32_NUM_IFACES into the constructor of the virtual CAN driver.
|
||||
*/
|
||||
static constexpr unsigned QueuePoolSize =
|
||||
(UAVCAN_STM32_NUM_IFACES * uavcan::MemPoolBlockSize *MaxCanFramsPerTransfer);
|
||||
(NumIfaces * uavcan::MemPoolBlockSize * MaxCanFramesPerTransfer);
|
||||
|
||||
static constexpr unsigned StackSize = 3500;
|
||||
static constexpr unsigned Priority = 120;
|
||||
|
@ -96,8 +98,8 @@ public:
|
|||
|
||||
virtual ~UavcanServers();
|
||||
|
||||
static int start(unsigned num_ifaces, uavcan::INode &main_node);
|
||||
static int stop(void);
|
||||
static int start(uavcan::INode &main_node);
|
||||
static int stop();
|
||||
|
||||
SubNode &get_node() { return _subnode; }
|
||||
|
||||
|
@ -116,8 +118,7 @@ private:
|
|||
pthread_t _subnode_thread;
|
||||
pthread_mutex_t _subnode_mutex;
|
||||
|
||||
int init(unsigned num_ifaces);
|
||||
void deinit(void);
|
||||
int init();
|
||||
|
||||
pthread_addr_t run(pthread_addr_t);
|
||||
|
||||
|
|
Loading…
Reference in New Issue