diff --git a/mongoose.c b/mongoose.c index fcf0a1b9..cac7208f 100644 --- a/mongoose.c +++ b/mongoose.c @@ -4031,11 +4031,6 @@ void mg_mgr_free(struct mg_mgr *mgr) { mg_tls_ctx_free(mgr); } - -#if MG_ENABLE_TCPIP && MG_ENABLE_TCPIP_DRIVER_INIT -void mg_tcpip_auto_init(struct mg_mgr *); -#endif - void mg_mgr_init(struct mg_mgr *mgr) { memset(mgr, 0, sizeof(*mgr)); #if MG_ENABLE_EPOLL @@ -4971,15 +4966,7 @@ static void mg_tcpip_poll(struct mg_tcpip_if *ifp, uint64_t now) { #if MG_ENABLE_TCPIP_PRINT_DEBUG_STATS if (expired_1000ms) { -<<<<<<< HEAD const char *names[] = {"down", "up", "req", "ip", "ready"}; -======= - const char *names[] = {"down", "up", "req", "ready"}; -<<<<<<< HEAD -<<<<<<< HEAD ->>>>>>> 60cce282 (Add driver init to mg_mgr_init()) -======= ->>>>>>> f74ae90c (update version) MG_INFO(("Status: %s, IP: %M, rx:%u, tx:%u, dr:%u, er:%u", names[ifp->state], mg_print_ip4, &ifp->ip, ifp->nrecv, ifp->nsent, ifp->ndrop, ifp->nerr)); @@ -5274,24 +5261,6 @@ bool mg_send(struct mg_connection *c, const void *buf, size_t len) { } return res; } - -#if MG_ENABLE_TCPIP_DRIVER_INIT && defined(MG_TCPIP_DRIVER_DATA) -void mg_tcpip_auto_init(struct mg_mgr *mgr); -void mg_tcpip_auto_init(struct mg_mgr *mgr) { - MG_TCPIP_DRIVER_DATA // static ... driver_data - struct mg_tcpip_if i = { - // let the compiler solve the macros at run time - .mac = MG_MAC_ADDRESS, .ip = MG_TCPIP_IP, - .mask = MG_TCPIP_MASK, .gw = MG_TCPIP_GW, - .driver = MG_TCPIP_DRIVER_CODE, .driver_data = &driver_data, - }; - static struct mg_tcpip_if mif; - - mif = i; // copy the initialized structure to a static to be exported - mg_tcpip_init(mgr, &mif); - MG_INFO(("Driver: " MG_TCPIP_DRIVER_NAME ", MAC: %M", mg_print_mac, mif.mac)); -} -#endif #endif // MG_ENABLE_TCPIP #ifdef MG_ENABLE_LINES diff --git a/mongoose.h b/mongoose.h index d10e7572..bc8fd0ce 100644 --- a/mongoose.h +++ b/mongoose.h @@ -1115,8 +1115,6 @@ bool mg_path_is_sane(const struct mg_str path); #define MG_IPV4(a, b, c, d) mg_htonl(MG_U32(a, b, c, d)) -#define MG_IPV4(a, b, c, d) mg_htonl(MG_U32(a, b, c, d)) - // For printing IPv4 addresses: printf("%d.%d.%d.%d\n", MG_IPADDR_PARTS(&ip)) #define MG_U8P(ADDR) ((uint8_t *) (ADDR)) #define MG_IPADDR_PARTS(ADDR) \ @@ -2875,15 +2873,6 @@ struct mg_profitem { #include "Driver_ETH_MAC.h" // keep this include #include "Driver_ETH_PHY.h" // keep this include -#ifndef MG_MAC_ADDRESS -#define MG_MAC_ADDRESS MG_MAC_ADDRESS_RANDOM -#endif - -#define MG_TCPIP_DRIVER_DATA int driver_data; - -#define MG_TCPIP_DRIVER_CODE &mg_tcpip_driver_cmsis -#define MG_TCPIP_DRIVER_NAME "cmsis" - #endif @@ -2942,10 +2931,10 @@ struct mg_phy { // PHY configuration settings, bitmask enum { - MG_PHY_LEDS_ACTIVE_HIGH = - (1 << 0), // Set if PHY LEDs are connected to ground - MG_PHY_CLOCKS_MAC = - (1 << 1) // Set when PHY clocks MAC. Otherwise, MAC clocks PHY + // Set if PHY LEDs are connected to ground + MG_PHY_LEDS_ACTIVE_HIGH = (1 << 0), + // Set when PHY clocks MAC. Otherwise, MAC clocks PHY + MG_PHY_CLOCKS_MAC = (1 << 1), }; enum { MG_PHY_SPEED_10M, MG_PHY_SPEED_100M, MG_PHY_SPEED_1000M }; @@ -3055,17 +3044,10 @@ struct mg_tcpip_driver_stm32h_data { uint8_t phy_conf; // PHY config }; -<<<<<<< HEAD -<<<<<<< HEAD #ifndef MG_TCPIP_PHY_CONF #define MG_TCPIP_PHY_CONF MG_PHY_CLOCKS_MAC #endif -======= -<<<<<<< HEAD ->>>>>>> 60cce282 (Add driver init to mg_mgr_init()) -======= ->>>>>>> f74ae90c (update version) #ifndef MG_TCPIP_PHY_ADDR #define MG_TCPIP_PHY_ADDR 0 #endif @@ -3114,8 +3096,6 @@ struct mg_tcpip_driver_tm4c_data { #define MG_DRIVER_MDC_CR 1 #endif -<<<<<<< HEAD -<<<<<<< HEAD #define MG_TCPIP_DRIVER_INIT(mgr) \ do { \ static struct mg_tcpip_driver_tm4c_data driver_data_; \ @@ -3131,22 +3111,6 @@ struct mg_tcpip_driver_tm4c_data { MG_INFO(("Driver: tm4c, MAC: %M", mg_print_mac, mif_.mac)); \ } while (0) -======= -<<<<<<< HEAD -======= -#define MG_TCPIP_DRIVER_DATA \ - static struct mg_tcpip_driver_tm4c_data driver_data = { \ - .mdc_cr = MG_DRIVER_MDC_CR, \ - }; - -#define MG_TCPIP_DRIVER_CODE &mg_tcpip_driver_tm4c -#define MG_TCPIP_DRIVER_NAME "tm4c" - - ->>>>>>> a0834330 (Add driver init to mg_mgr_init()) ->>>>>>> 60cce282 (Add driver init to mg_mgr_init()) -======= ->>>>>>> f74ae90c (update version) #endif diff --git a/src/drivers/cmsis.h b/src/drivers/cmsis.h index a264fc46..f8b4dadd 100644 --- a/src/drivers/cmsis.h +++ b/src/drivers/cmsis.h @@ -5,13 +5,4 @@ #include "Driver_ETH_MAC.h" // keep this include #include "Driver_ETH_PHY.h" // keep this include -#ifndef MG_MAC_ADDRESS -#define MG_MAC_ADDRESS MG_MAC_ADDRESS_RANDOM -#endif - -#define MG_TCPIP_DRIVER_DATA int driver_data; - -#define MG_TCPIP_DRIVER_CODE &mg_tcpip_driver_cmsis -#define MG_TCPIP_DRIVER_NAME "cmsis" - #endif diff --git a/src/net.c b/src/net.c index f6e63d0e..2bc12c41 100644 --- a/src/net.c +++ b/src/net.c @@ -249,11 +249,6 @@ void mg_mgr_free(struct mg_mgr *mgr) { mg_tls_ctx_free(mgr); } - -#if MG_ENABLE_TCPIP && MG_ENABLE_TCPIP_DRIVER_INIT -void mg_tcpip_auto_init(struct mg_mgr *); -#endif - void mg_mgr_init(struct mg_mgr *mgr) { memset(mgr, 0, sizeof(*mgr)); #if MG_ENABLE_EPOLL diff --git a/src/net_builtin.c b/src/net_builtin.c index b11077b3..6576bde5 100644 --- a/src/net_builtin.c +++ b/src/net_builtin.c @@ -1197,22 +1197,4 @@ bool mg_send(struct mg_connection *c, const void *buf, size_t len) { } return res; } - -#if MG_ENABLE_TCPIP_DRIVER_INIT && defined(MG_TCPIP_DRIVER_DATA) -void mg_tcpip_auto_init(struct mg_mgr *mgr); -void mg_tcpip_auto_init(struct mg_mgr *mgr) { - MG_TCPIP_DRIVER_DATA // static ... driver_data - struct mg_tcpip_if i = { - // let the compiler solve the macros at run time - .mac = MG_MAC_ADDRESS, .ip = MG_TCPIP_IP, - .mask = MG_TCPIP_MASK, .gw = MG_TCPIP_GW, - .driver = MG_TCPIP_DRIVER_CODE, .driver_data = &driver_data, - }; - static struct mg_tcpip_if mif; - - mif = i; // copy the initialized structure to a static to be exported - mg_tcpip_init(mgr, &mif); - MG_INFO(("Driver: " MG_TCPIP_DRIVER_NAME ", MAC: %M", mg_print_mac, mif.mac)); -} -#endif #endif // MG_ENABLE_TCPIP diff --git a/src/util.h b/src/util.h index cd8a206f..7ae6f1a7 100644 --- a/src/util.h +++ b/src/util.h @@ -29,8 +29,6 @@ bool mg_path_is_sane(const struct mg_str path); #define MG_IPV4(a, b, c, d) mg_htonl(MG_U32(a, b, c, d)) -#define MG_IPV4(a, b, c, d) mg_htonl(MG_U32(a, b, c, d)) - // For printing IPv4 addresses: printf("%d.%d.%d.%d\n", MG_IPADDR_PARTS(&ip)) #define MG_U8P(ADDR) ((uint8_t *) (ADDR)) #define MG_IPADDR_PARTS(ADDR) \