Update the rest of the drivers

This commit is contained in:
robert committed 2026-11-23 17:24:23 +02:00
1 parent 93f2939655
commit 5e7edde7e5
19 files changed
+404 -100

No files matched your search

+28
View File
@@ -12,3 +12,31 @@ struct mg_tcpip_driver_atcmd_data {
bool link; // internal use: done with AT processing
bool unstuffing; // internal use: unstuffing state
};
#if MG_ENABLE_TCPIP && defined(MG_ENABLE_DRIVER_ATCMD) && MG_ENABLE_DRIVER_ATCMD
extern struct mg_tcpip_driver mg_tcpip_driver_atcmd;
// Modem callbacks and AT script, defined by the application.
// See tutorials/arduino/sim800-mqtt for modem configuration.
extern struct mg_tcpip_driver_atcmd_data mg_atcmd;
#define MG_TCPIP_DRIVER_ATCMD_INIT(mgr) \
do { \
static struct mg_tcpip_if mif_; \
mif_.ip = MG_TCPIP_IP; \
mif_.mask = MG_TCPIP_MASK; \
mif_.gw = MG_TCPIP_GW; \
mif_.driver = &mg_tcpip_driver_atcmd; \
mif_.driver_data = &mg_atcmd; \
mif_.l2type = MG_TCPIP_L2_PPP; \
MG_SET_MAC_ADDRESS(mif_.mac); \
mg_tcpip_init((mgr), &mif_); \
MG_INFO(("Driver: atcmd, MAC: %M", mg_print_mac, mif_.mac)); \
} while (0)
#ifndef MG_TCPIP_DRIVER_INIT
#define MG_TCPIP_DRIVER_INIT(x) MG_TCPIP_DRIVER_ATCMD_INIT(x)
#endif
#endif
+18
View File
@@ -5,4 +5,22 @@
#include "Driver_ETH_MAC.h" // keep this include
#include "Driver_ETH_PHY.h" // keep this include
extern struct mg_tcpip_driver mg_tcpip_driver_cmsis;
#define MG_TCPIP_DRIVER_CMSIS_INIT(mgr) \
do { \
static struct mg_tcpip_if mif_; \
mif_.ip = MG_TCPIP_IP; \
mif_.mask = MG_TCPIP_MASK; \
mif_.gw = MG_TCPIP_GW; \
mif_.driver = &mg_tcpip_driver_cmsis; \
MG_SET_MAC_ADDRESS(mif_.mac); \
mg_tcpip_init((mgr), &mif_); \
MG_INFO(("Driver: cmsis, MAC: %M", mg_print_mac, mif_.mac)); \
} while (0)
#ifndef MG_TCPIP_DRIVER_INIT
#define MG_TCPIP_DRIVER_INIT(x) MG_TCPIP_DRIVER_CMSIS_INIT(x)
#endif
#endif
+8 -2
View File
@@ -20,7 +20,9 @@ struct mg_tcpip_driver_cyw_data {
bool hs; // use chip "high-speed" mode; otherwise SPI CPOL0 CPHA0 (DS 4.2.3 Table 6)
};
#define MG_TCPIP_DRIVER_INIT(mgr) \
extern struct mg_tcpip_driver mg_tcpip_driver_cyw;
#define MG_TCPIP_DRIVER_CYW_INIT(mgr) \
do { \
static struct mg_tcpip_driver_cyw_data driver_data_; \
static struct mg_tcpip_if mif_; \
@@ -32,8 +34,12 @@ struct mg_tcpip_driver_cyw_data {
mif_.driver_data = &driver_data_; \
mif_.recv_queue.size = 8192; \
mif_.mac[0] = 2; /* MAC read from OTP at driver init */ \
mg_tcpip_init(mgr, &mif_); \
mg_tcpip_init((mgr), &mif_); \
MG_INFO(("Driver: cyw, MAC: %M", mg_print_mac, mif_.mac)); \
} while (0)
#ifndef MG_TCPIP_DRIVER_INIT
#define MG_TCPIP_DRIVER_INIT(x) MG_TCPIP_DRIVER_CYW_INIT(x)
#endif
#endif
+8 -2
View File
@@ -30,7 +30,9 @@ struct mg_tcpip_driver_imxrt_data {
#define MG_DRIVER_MDC_CR 24
#endif
#define MG_TCPIP_DRIVER_INIT(mgr) \
extern struct mg_tcpip_driver mg_tcpip_driver_imxrt;
#define MG_TCPIP_DRIVER_IMXRT_INIT(mgr) \
do { \
static struct mg_tcpip_driver_imxrt_data driver_data_; \
static struct mg_tcpip_if mif_; \
@@ -42,8 +44,12 @@ struct mg_tcpip_driver_imxrt_data {
mif_.driver = &mg_tcpip_driver_imxrt; \
mif_.driver_data = &driver_data_; \
MG_SET_MAC_ADDRESS(mif_.mac); \
mg_tcpip_init(mgr, &mif_); \
mg_tcpip_init((mgr), &mif_); \
MG_INFO(("Driver: imxrt, MAC: %M", mg_print_mac, mif_.mac)); \
} while (0)
#ifndef MG_TCPIP_DRIVER_INIT
#define MG_TCPIP_DRIVER_INIT(x) MG_TCPIP_DRIVER_IMXRT_INIT(x)
#endif
#endif
+6 -3
View File
@@ -26,10 +26,9 @@ struct mg_tcpip_driver_netc_data {
#define MG_TCPIP_NETC_LINK 0
#endif
struct mg_tcpip_driver;
extern struct mg_tcpip_driver mg_tcpip_driver_netc;
#define MG_TCPIP_DRIVER_INIT(mgr) \
#define MG_TCPIP_DRIVER_NETC_INIT(mgr) \
do { \
static struct mg_tcpip_driver_netc_data driver_data_; \
static struct mg_tcpip_if mif_; \
@@ -42,8 +41,12 @@ extern struct mg_tcpip_driver mg_tcpip_driver_netc;
mif_.driver = &mg_tcpip_driver_netc; \
mif_.driver_data = &driver_data_; \
MG_SET_MAC_ADDRESS(mif_.mac); \
mg_tcpip_init(mgr, &mif_); \
mg_tcpip_init((mgr), &mif_); \
MG_INFO(("Driver: netc, MAC: %M", mg_print_mac, mif_.mac)); \
} while (0)
#ifndef MG_TCPIP_DRIVER_INIT
#define MG_TCPIP_DRIVER_INIT(x) MG_TCPIP_DRIVER_NETC_INIT(x)
#endif
#endif
+8 -2
View File
@@ -9,7 +9,9 @@ struct mg_tcpip_driver_nxp_wifi_data {
};
#define MG_TCPIP_DRIVER_INIT(mgr) \
extern struct mg_tcpip_driver mg_tcpip_driver_nxp_wifi;
#define MG_TCPIP_DRIVER_NXP_WIFI_INIT(mgr) \
do { \
static struct mg_tcpip_driver_nxp_wifi_data driver_data_; \
static struct mg_tcpip_if mif_; \
@@ -21,8 +23,12 @@ struct mg_tcpip_driver_nxp_wifi_data {
mif_.driver_data = &driver_data_; \
mif_.recv_queue.size = 8192; \
mif_.mac[0] = 2; /* MAC read from OTP at driver init */ \
mg_tcpip_init(mgr, &mif_); \
mg_tcpip_init((mgr), &mif_); \
MG_INFO(("Driver: nxp wifi, MAC: %M", mg_print_mac, mif_.mac)); \
} while (0)
#ifndef MG_TCPIP_DRIVER_INIT
#define MG_TCPIP_DRIVER_INIT(x) MG_TCPIP_DRIVER_NXP_WIFI_INIT(x)
#endif
#endif
+8 -2
View File
@@ -11,7 +11,9 @@ struct mg_tcpip_driver_pico_w_data {
struct mg_wifi_data wifi;
};
#define MG_TCPIP_DRIVER_INIT(mgr) \
extern struct mg_tcpip_driver mg_tcpip_driver_pico_w;
#define MG_TCPIP_DRIVER_PICO_W_INIT(mgr) \
do { \
static struct mg_tcpip_driver_pico_w_data driver_data_; \
static struct mg_tcpip_if mif_; \
@@ -23,8 +25,12 @@ struct mg_tcpip_driver_pico_w_data {
mif_.driver_data = &driver_data_; \
mif_.recv_queue.size = 8192; \
mif_.mac[0] = 2; /* MAC read from OTP at driver init */ \
mg_tcpip_init(mgr, &mif_); \
mg_tcpip_init((mgr), &mif_); \
MG_INFO(("Driver: pico-w, MAC: %M", mg_print_mac, mif_.mac)); \
} while (0)
#ifndef MG_TCPIP_DRIVER_INIT
#define MG_TCPIP_DRIVER_INIT(x) MG_TCPIP_DRIVER_PICO_W_INIT(x)
#endif
#endif
+8 -2
View File
@@ -23,7 +23,9 @@ struct mg_tcpip_driver_ra_data {
#define MG_TCPIP_PHY_ADDR 0
#endif
#define MG_TCPIP_DRIVER_INIT(mgr) \
extern struct mg_tcpip_driver mg_tcpip_driver_ra;
#define MG_TCPIP_DRIVER_RA_INIT(mgr) \
do { \
static struct mg_tcpip_driver_ra_data driver_data_; \
static struct mg_tcpip_if mif_; \
@@ -36,8 +38,12 @@ struct mg_tcpip_driver_ra_data {
mif_.driver = &mg_tcpip_driver_ra; \
mif_.driver_data = &driver_data_; \
MG_SET_MAC_ADDRESS(mif_.mac); \
mg_tcpip_init(mgr, &mif_); \
mg_tcpip_init((mgr), &mif_); \
MG_INFO(("Driver: ra, MAC: %M", mg_print_mac, mif_.mac)); \
} while (0)
#ifndef MG_TCPIP_DRIVER_INIT
#define MG_TCPIP_DRIVER_INIT(x) MG_TCPIP_DRIVER_RA_INIT(x)
#endif
#endif
+7 -3
View File
@@ -27,8 +27,9 @@ struct mg_tcpip_driver_rw612_data {
#define MG_DRIVER_MDC_HOLDTIME 3
#endif
#ifndef MG_TCPIP_DRIVER_INIT
#define MG_TCPIP_DRIVER_INIT(mgr) \
extern struct mg_tcpip_driver mg_tcpip_driver_rw612;
#define MG_TCPIP_DRIVER_RW612_INIT(mgr) \
do { \
static struct mg_tcpip_driver_rw612_data driver_data_; \
static struct mg_tcpip_if mif_; \
@@ -40,9 +41,12 @@ struct mg_tcpip_driver_rw612_data {
mif_.driver = &mg_tcpip_driver_rw612; \
mif_.driver_data = &driver_data_; \
MG_SET_MAC_ADDRESS(mif_.mac); \
mg_tcpip_init(mgr, &mif_); \
mg_tcpip_init((mgr), &mif_); \
MG_INFO(("Driver: rw612, MAC: %M", mg_print_mac, mif_.mac)); \
} while (0)
#ifndef MG_TCPIP_DRIVER_INIT
#define MG_TCPIP_DRIVER_INIT(x) MG_TCPIP_DRIVER_RW612_INIT(x)
#endif
#endif
+8 -2
View File
@@ -16,7 +16,9 @@ struct mg_tcpip_driver_same54_data {
uint8_t phy_addr;
};
#define MG_TCPIP_DRIVER_INIT(mgr) \
extern struct mg_tcpip_driver mg_tcpip_driver_same54;
#define MG_TCPIP_DRIVER_SAME54_INIT(mgr) \
do { \
static struct mg_tcpip_driver_same54_data driver_data_; \
static struct mg_tcpip_if mif_; \
@@ -28,8 +30,12 @@ struct mg_tcpip_driver_same54_data {
mif_.driver = &mg_tcpip_driver_same54; \
mif_.driver_data = &driver_data_; \
MG_SET_MAC_ADDRESS(mif_.mac); \
mg_tcpip_init(mgr, &mif_); \
mg_tcpip_init((mgr), &mif_); \
MG_INFO(("Driver: same54, MAC: %M", mg_print_mac, mif_.mac)); \
} while (0)
#ifndef MG_TCPIP_DRIVER_INIT
#define MG_TCPIP_DRIVER_INIT(x) MG_TCPIP_DRIVER_SAME54_INIT(x)
#endif
#endif
+8 -2
View File
@@ -10,7 +10,9 @@ struct mg_tcpip_driver_st67w6_data {
struct mg_queue send_queue; // decouple tx calls from module polls
};
#define MG_TCPIP_DRIVER_INIT(mgr) \
extern struct mg_tcpip_driver mg_tcpip_driver_st67w6;
#define MG_TCPIP_DRIVER_ST67W6_INIT(mgr) \
do { \
static struct mg_tcpip_driver_st67w6_data driver_data_; \
static struct mg_tcpip_if mif_; \
@@ -22,8 +24,12 @@ struct mg_tcpip_driver_st67w6_data {
mif_.driver_data = &driver_data_; \
mif_.recv_queue.size = 8192; \
mif_.mac[0] = 2; /* MAC read from OTP at driver init */ \
mg_tcpip_init(mgr, &mif_); \
mg_tcpip_init((mgr), &mif_); \
MG_INFO(("Driver: st67w6, MAC: %M", mg_print_mac, mif_.mac)); \
} while (0)
#ifndef MG_TCPIP_DRIVER_INIT
#define MG_TCPIP_DRIVER_INIT(x) MG_TCPIP_DRIVER_ST67W6_INIT(x)
#endif
#endif
+8 -2
View File
@@ -72,7 +72,9 @@ struct mg_tcpip_driver_stm32h_data {
#define MG_IPV6_INIT(mif)
#endif
#define MG_TCPIP_DRIVER_INIT(mgr) \
extern struct mg_tcpip_driver mg_tcpip_driver_stm32h;
#define MG_TCPIP_DRIVER_STM32H_INIT(mgr) \
do { \
static struct mg_tcpip_driver_stm32h_data driver_data_; \
static struct mg_tcpip_if mif_; \
@@ -86,10 +88,14 @@ struct mg_tcpip_driver_stm32h_data {
mif_.driver_data = &driver_data_; \
MG_SET_MAC_ADDRESS(mif_.mac); \
MG_IPV6_INIT(mif_); \
mg_tcpip_init(mgr, &mif_); \
mg_tcpip_init((mgr), &mif_); \
MG_ENABLE_ETH_IRQ(); \
MG_INFO(("Driver: stm32h, MAC: %M", mg_print_mac, mif_.mac)); \
} while (0)
#ifndef MG_TCPIP_DRIVER_INIT
#define MG_TCPIP_DRIVER_INIT(x) MG_TCPIP_DRIVER_STM32H_INIT(x)
#endif
#endif
#endif
+8 -2
View File
@@ -19,7 +19,9 @@ struct mg_tcpip_driver_tm4c_data {
#define MG_DRIVER_MDC_CR 1
#endif
#define MG_TCPIP_DRIVER_INIT(mgr) \
extern struct mg_tcpip_driver mg_tcpip_driver_tm4c;
#define MG_TCPIP_DRIVER_TM4C_INIT(mgr) \
do { \
static struct mg_tcpip_driver_tm4c_data driver_data_; \
static struct mg_tcpip_if mif_; \
@@ -30,8 +32,12 @@ struct mg_tcpip_driver_tm4c_data {
mif_.driver = &mg_tcpip_driver_tm4c; \
mif_.driver_data = &driver_data_; \
MG_SET_MAC_ADDRESS(mif_.mac); \
mg_tcpip_init(mgr, &mif_); \
mg_tcpip_init((mgr), &mif_); \
MG_INFO(("Driver: tm4c, MAC: %M", mg_print_mac, mif_.mac)); \
} while (0)
#ifndef MG_TCPIP_DRIVER_INIT
#define MG_TCPIP_DRIVER_INIT(x) MG_TCPIP_DRIVER_TM4C_INIT(x)
#endif
#endif
+9 -2
View File
@@ -14,7 +14,9 @@ struct mg_tcpip_driver_tms570_data {
#define MG_DRIVER_MDC_CR 1
#endif
#define MG_TCPIP_DRIVER_INIT(mgr) \
extern struct mg_tcpip_driver mg_tcpip_driver_tms570;
#define MG_TCPIP_DRIVER_TMS570_INIT(mgr) \
do { \
static struct mg_tcpip_driver_tms570_data driver_data_; \
static struct mg_tcpip_if mif_; \
@@ -26,8 +28,13 @@ struct mg_tcpip_driver_tms570_data {
mif_.driver = &mg_tcpip_driver_tms570; \
mif_.driver_data = &driver_data_; \
MG_SET_MAC_ADDRESS(mif_.mac); \
mg_tcpip_init(mgr, &mif_); \
mg_tcpip_init((mgr), &mif_); \
MG_INFO(("Driver: tms570, MAC: %M", mg_print_mac, mif_.mac));\
} while (0)
#ifndef MG_TCPIP_DRIVER_INIT
#define MG_TCPIP_DRIVER_INIT(x) MG_TCPIP_DRIVER_TMS570_INIT(x)
#endif
#endif
+27
View File
@@ -0,0 +1,27 @@
#pragma once
#if MG_ENABLE_TCPIP && defined(MG_ENABLE_DRIVER_W5100) && \
MG_ENABLE_DRIVER_W5100
extern struct mg_tcpip_driver mg_tcpip_driver_w5100;
// Initialises W5100 on mgr. The application defines
// struct mg_tcpip_spi mg_spi
#define MG_TCPIP_DRIVER_W5100_INIT(mgr) \
do { \
static struct mg_tcpip_if mif_; \
mif_.ip = MG_TCPIP_IP; \
mif_.mask = MG_TCPIP_MASK; \
mif_.gw = MG_TCPIP_GW; \
mif_.driver = &mg_tcpip_driver_w5100; \
mif_.driver_data = &mg_spi; \
MG_SET_MAC_ADDRESS(mif_.mac); \
mg_tcpip_init((mgr), &mif_); \
MG_INFO(("Driver: w5100, MAC: %M", mg_print_mac, mif_.mac)); \
} while (0)
#ifndef MG_TCPIP_DRIVER_INIT
#define MG_TCPIP_DRIVER_INIT(x) MG_TCPIP_DRIVER_W5100_INIT(x)
#endif
#endif
+8 -2
View File
@@ -28,7 +28,9 @@ struct mg_tcpip_driver_xmc_data {
#define MG_DRIVER_MDC_CR 4
#endif
#define MG_TCPIP_DRIVER_INIT(mgr) \
extern struct mg_tcpip_driver mg_tcpip_driver_xmc;
#define MG_TCPIP_DRIVER_XMC_INIT(mgr) \
do { \
static struct mg_tcpip_driver_xmc_data driver_data_; \
static struct mg_tcpip_if mif_; \
@@ -40,8 +42,12 @@ struct mg_tcpip_driver_xmc_data {
mif_.driver = &mg_tcpip_driver_xmc; \
mif_.driver_data = &driver_data_; \
MG_SET_MAC_ADDRESS(mif_.mac); \
mg_tcpip_init(mgr, &mif_); \
mg_tcpip_init((mgr), &mif_); \
MG_INFO(("Driver: xmc, MAC: %M", mg_print_mac, mif_.mac)); \
} while (0)
#ifndef MG_TCPIP_DRIVER_INIT
#define MG_TCPIP_DRIVER_INIT(x) MG_TCPIP_DRIVER_XMC_INIT(x)
#endif
#endif
+8 -2
View File
@@ -15,7 +15,9 @@ struct mg_tcpip_driver_xmc7_data {
#define MG_DRIVER_MDC_CR 3
#endif
#define MG_TCPIP_DRIVER_INIT(mgr) \
extern struct mg_tcpip_driver mg_tcpip_driver_xmc7;
#define MG_TCPIP_DRIVER_XMC7_INIT(mgr) \
do { \
static struct mg_tcpip_driver_xmc7_data driver_data_; \
static struct mg_tcpip_if mif_; \
@@ -27,9 +29,13 @@ struct mg_tcpip_driver_xmc7_data {
mif_.driver = &mg_tcpip_driver_xmc7; \
mif_.driver_data = &driver_data_; \
MG_SET_MAC_ADDRESS(mif_.mac); \
mg_tcpip_init(mgr, &mif_); \
mg_tcpip_init((mgr), &mif_); \
MG_INFO(("Driver: xmc7, MAC: %M", mg_print_mac, mif_.mac)); \
} while (0)
#ifndef MG_TCPIP_DRIVER_INIT
#define MG_TCPIP_DRIVER_INIT(x) MG_TCPIP_DRIVER_XMC7_INIT(x)
#endif
#endif