Rename mg_tcpip_spi to mg_spi and move it to flash.h

This commit is contained in:
cpq committed 2026-12-03 09:39:00 +00:00
1 parent 1d8c55c892
commit e7bfbf99fa
23 files changed
+104 -106

No files matched your search

+17 -18
View File
@@ -4637,7 +4637,21 @@ void mg_mdash_free(struct mg_mgr *);
#if (MG_OTA != MG_OTA_NONE && MG_OTA != MG_OTA_CUSTOM) || MG_ENABLE_LFS
// SPI bus abstraction for SPI-attached chips, e.g. W5500.
// Network drivers get it via the driver_data field
struct mg_spi {
void *spi; // Opaque SPI bus handle passed to all callbacks
void (*begin)(void *); // Assert chip-select, start of transaction
void (*end)(void *); // Deassert chip-select, end of transaction
void (*txn)(void *, uint8_t *write, uint8_t *read, size_t); // Full duplex
};
// SPI bus for SPI-attached network chips, defined by the application.
// Used by the drivers' INIT macros, e.g. MG_TCPIP_DRIVER_W5500_INIT
extern struct mg_spi mg_spi;
struct mg_flash {
void *start; // Address at which flash starts
@@ -4655,8 +4669,6 @@ bool mg_ota_flash_begin(size_t new_firmware_size, struct mg_flash *flash);
bool mg_ota_flash_write(const void *buf, size_t len, struct mg_flash *flash);
bool mg_ota_flash_end(struct mg_flash *flash);
#endif
@@ -4926,19 +4938,6 @@ extern const uint8_t mcast_addr[6]; // Multicast MAC address programmed by driv
// SPI bus abstraction for SPI-attached network chips (e.g. W5500).
// Populate and assign to the driver's driver_data field.
struct mg_tcpip_spi {
void *spi; // Opaque SPI bus handle passed to all callbacks
void (*begin)(void *); // Assert chip-select (start of transaction)
void (*end)(void *); // Deassert chip-select (end of transaction)
void (*txn)(void *, uint8_t *write, uint8_t *read, size_t); // Full-duplex transfer: write and read len bytes simultaneously
};
// SPI bus for SPI-attached network chips, defined by the application.
// Used by the drivers' INIT macros, e.g. MG_TCPIP_DRIVER_W5500_INIT
extern struct mg_tcpip_spi mg_spi;
// Alignment attributes for DMA-capable Ethernet descriptor buffers.
// Use these on driver RX/TX descriptor arrays where the hardware requires
@@ -6436,7 +6435,7 @@ extern struct mg_tcpip_driver mg_tcpip_driver_usb_rp;
extern struct mg_tcpip_driver mg_tcpip_driver_w5100;
// Initialises W5100 on mgr. The application defines
// struct mg_tcpip_spi mg_spi
// struct mg_spi mg_spi
#define MG_TCPIP_DRIVER_W5100_INIT(mgr) \
do { \
static struct mg_tcpip_if mif_; \
@@ -6463,7 +6462,7 @@ extern struct mg_tcpip_driver mg_tcpip_driver_w5100;
extern struct mg_tcpip_driver mg_tcpip_driver_w5500;
// Initialises W5500 on mgr. The application defines
// struct mg_tcpip_spi mg_spi. Example: tutorials/rp/w5500-evb-pico
// struct mg_spi mg_spi. Example: tutorials/rp/w5500-evb-pico
#define MG_TCPIP_DRIVER_W5500_INIT(mgr) \
do { \
static struct mg_tcpip_if mif_; \