AP_Bootloader: support CAN multicast server

allows for fw update of network peripheral devices
This commit is contained in:
Andrew Tridgell
2024-09-17 10:02:29 +10:00
parent f065548866
commit ef4fce80fb
5 changed files with 48 additions and 5 deletions
+7
View File
@@ -8,6 +8,7 @@
#include <AP_Networking/AP_Networking.h>
#include <AP_Networking/AP_Networking_ChibiOS.h>
#include <AP_Networking/AP_Networking_CAN.h>
#include <lwip/ip_addr.h>
#include <lwip/tcpip.h>
@@ -29,6 +30,7 @@
#include <stdio.h>
#include <stdarg.h>
#include <AP_HAL_ChibiOS/hwdef/common/flash.h>
#include <AP_HAL_ChibiOS/CANIface.h>
#ifndef AP_NETWORKING_BOOTLOADER_DEFAULT_MAC_ADDR
#define AP_NETWORKING_BOOTLOADER_DEFAULT_MAC_ADDR "C2:AF:51:03:CF:46"
@@ -59,6 +61,8 @@
#define MIN(a,b) ((a)<(b)?(a):(b))
static AP_Networking_CAN mcast_server;
void BL_Network::link_up_cb(void *p)
{
auto *driver = (BL_Network *)p;
@@ -67,6 +71,9 @@ void BL_Network::link_up_cb(void *p)
#endif
char ipstr[IP4_STR_LEN];
can_printf("IP %s", SocketAPM::inet_addr_to_str(ntohl(driver->thisif->ip_addr.addr), ipstr, sizeof(ipstr)));
// start mcast CAN server
mcast_server.start((1U<<HAL_NUM_CAN_IFACES)-1);
}
void BL_Network::link_down_cb(void *p)