mirror of
https://github.com/cesanta/mongoose.git
synced 2025-07-25 22:56:16 +08:00
struct mip_ipcfg -> struct mip_cfg
This commit is contained in:
parent
8a61969c8f
commit
c131b8daf1
@ -70,7 +70,7 @@ int main(void) {
|
|||||||
// Initialise Mongoose network stack
|
// Initialise Mongoose network stack
|
||||||
// Specify MAC address, and use 0 for IP, mask, GW - i.e. use DHCP
|
// Specify MAC address, and use 0 for IP, mask, GW - i.e. use DHCP
|
||||||
// For static configuration, specify IP/mask/GW in network byte order
|
// For static configuration, specify IP/mask/GW in network byte order
|
||||||
struct mip_ipcfg c = {.mac = {0, 0, 1, 2, 3, 4}, .ip = 0, .mask = 0, .gw = 0};
|
struct mip_cfg c = {.mac = {0, 0, 1, 2, 3, 4}, .ip = 0, .mask = 0, .gw = 0};
|
||||||
mip_init(&mgr, &c, &mip_driver_stm32, NULL);
|
mip_init(&mgr, &c, &mip_driver_stm32, NULL);
|
||||||
MG_INFO(("Init done, starting main loop"));
|
MG_INFO(("Init done, starting main loop"));
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ int main(void) {
|
|||||||
// Initialise Mongoose network stack
|
// Initialise Mongoose network stack
|
||||||
// Specify MAC address, and use 0 for IP, mask, GW - i.e. use DHCP
|
// Specify MAC address, and use 0 for IP, mask, GW - i.e. use DHCP
|
||||||
// For static configuration, specify IP/mask/GW in network byte order
|
// For static configuration, specify IP/mask/GW in network byte order
|
||||||
struct mip_ipcfg c = {.mac = {0, 0, 1, 2, 3, 4}, .ip = 0, .mask = 0, .gw = 0};
|
struct mip_cfg c = {.mac = {0, 0, 1, 2, 3, 4}, .ip = 0, .mask = 0, .gw = 0};
|
||||||
mip_init(&mgr, &c, &mip_driver_stm32, NULL);
|
mip_init(&mgr, &c, &mip_driver_stm32, NULL);
|
||||||
MG_INFO(("Init done, starting main loop"));
|
MG_INFO(("Init done, starting main loop"));
|
||||||
|
|
||||||
|
@ -711,7 +711,7 @@ static void on_rx(void *buf, size_t len, void *userdata) {
|
|||||||
if (!q_write(&ifp->queue, buf, len)) MG_ERROR(("dropped %d", (int) len));
|
if (!q_write(&ifp->queue, buf, len)) MG_ERROR(("dropped %d", (int) len));
|
||||||
}
|
}
|
||||||
|
|
||||||
void mip_init(struct mg_mgr *mgr, struct mip_ipcfg *ipcfg,
|
void mip_init(struct mg_mgr *mgr, struct mip_cfg *ipcfg,
|
||||||
struct mip_driver *driver, void *driver_data) {
|
struct mip_driver *driver, void *driver_data) {
|
||||||
size_t maxpktsize = 1500, qlen = driver->setrx ? 1024 * 16 : 0;
|
size_t maxpktsize = 1500, qlen = driver->setrx ? 1024 * 16 : 0;
|
||||||
struct mip_if *ifp =
|
struct mip_if *ifp =
|
||||||
|
@ -12,12 +12,12 @@ struct mip_driver {
|
|||||||
void (*setrx)(void (*fn)(void *buf, size_t len, void *rxdata), void *rxdata);
|
void (*setrx)(void (*fn)(void *buf, size_t len, void *rxdata), void *rxdata);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct mip_ipcfg {
|
struct mip_cfg {
|
||||||
uint8_t mac[6]; // MAC address. Must not be 0
|
uint8_t mac[6]; // MAC address. Must not be 0
|
||||||
uint32_t ip, mask, gw; // IP, netmask, GW. If IP is 0, DHCP is used
|
uint32_t ip, mask, gw; // IP, netmask, GW. If IP is 0, DHCP is used
|
||||||
};
|
};
|
||||||
|
|
||||||
void mip_init(struct mg_mgr *, struct mip_ipcfg *, struct mip_driver *, void *);
|
void mip_init(struct mg_mgr *, struct mip_cfg *, struct mip_driver *, void *);
|
||||||
|
|
||||||
extern struct mip_driver mip_driver_stm32;
|
extern struct mip_driver mip_driver_stm32;
|
||||||
extern struct mip_driver mip_driver_enc28j60;
|
extern struct mip_driver mip_driver_enc28j60;
|
||||||
|
@ -6820,7 +6820,7 @@ static void on_rx(void *buf, size_t len, void *userdata) {
|
|||||||
if (!q_write(&ifp->queue, buf, len)) MG_ERROR(("dropped %d", (int) len));
|
if (!q_write(&ifp->queue, buf, len)) MG_ERROR(("dropped %d", (int) len));
|
||||||
}
|
}
|
||||||
|
|
||||||
void mip_init(struct mg_mgr *mgr, struct mip_ipcfg *ipcfg,
|
void mip_init(struct mg_mgr *mgr, struct mip_cfg *ipcfg,
|
||||||
struct mip_driver *driver, void *driver_data) {
|
struct mip_driver *driver, void *driver_data) {
|
||||||
size_t maxpktsize = 1500, qlen = driver->setrx ? 1024 * 16 : 0;
|
size_t maxpktsize = 1500, qlen = driver->setrx ? 1024 * 16 : 0;
|
||||||
struct mip_if *ifp =
|
struct mip_if *ifp =
|
||||||
|
@ -1431,12 +1431,12 @@ struct mip_driver {
|
|||||||
void (*setrx)(void (*fn)(void *buf, size_t len, void *rxdata), void *rxdata);
|
void (*setrx)(void (*fn)(void *buf, size_t len, void *rxdata), void *rxdata);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct mip_ipcfg {
|
struct mip_cfg {
|
||||||
uint8_t mac[6]; // MAC address. Must not be 0
|
uint8_t mac[6]; // MAC address. Must not be 0
|
||||||
uint32_t ip, mask, gw; // IP, netmask, GW. If IP is 0, DHCP is used
|
uint32_t ip, mask, gw; // IP, netmask, GW. If IP is 0, DHCP is used
|
||||||
};
|
};
|
||||||
|
|
||||||
void mip_init(struct mg_mgr *, struct mip_ipcfg *, struct mip_driver *, void *);
|
void mip_init(struct mg_mgr *, struct mip_cfg *, struct mip_driver *, void *);
|
||||||
|
|
||||||
extern struct mip_driver mip_driver_stm32;
|
extern struct mip_driver mip_driver_stm32;
|
||||||
extern struct mip_driver mip_driver_enc28j60;
|
extern struct mip_driver mip_driver_enc28j60;
|
||||||
|
Loading…
Reference in New Issue
Block a user