update to 7.16

This commit is contained in:
Sergio R. Caprile 2024-11-20 14:29:39 -03:00
parent fa86c9d23b
commit fbee9e4bb6
6 changed files with 4 additions and 105 deletions

View File

@ -4031,11 +4031,6 @@ void mg_mgr_free(struct mg_mgr *mgr) {
mg_tls_ctx_free(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) { void mg_mgr_init(struct mg_mgr *mgr) {
memset(mgr, 0, sizeof(*mgr)); memset(mgr, 0, sizeof(*mgr));
#if MG_ENABLE_EPOLL #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 MG_ENABLE_TCPIP_PRINT_DEBUG_STATS
if (expired_1000ms) { if (expired_1000ms) {
<<<<<<< HEAD
const char *names[] = {"down", "up", "req", "ip", "ready"}; 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", 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, names[ifp->state], mg_print_ip4, &ifp->ip, ifp->nrecv, ifp->nsent,
ifp->ndrop, ifp->nerr)); ifp->ndrop, ifp->nerr));
@ -5274,24 +5261,6 @@ bool mg_send(struct mg_connection *c, const void *buf, size_t len) {
} }
return res; 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 #endif // MG_ENABLE_TCPIP
#ifdef MG_ENABLE_LINES #ifdef MG_ENABLE_LINES

View File

@ -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))
#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)) // For printing IPv4 addresses: printf("%d.%d.%d.%d\n", MG_IPADDR_PARTS(&ip))
#define MG_U8P(ADDR) ((uint8_t *) (ADDR)) #define MG_U8P(ADDR) ((uint8_t *) (ADDR))
#define MG_IPADDR_PARTS(ADDR) \ #define MG_IPADDR_PARTS(ADDR) \
@ -2875,15 +2873,6 @@ struct mg_profitem {
#include "Driver_ETH_MAC.h" // keep this include #include "Driver_ETH_MAC.h" // keep this include
#include "Driver_ETH_PHY.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 #endif
@ -2942,10 +2931,10 @@ struct mg_phy {
// PHY configuration settings, bitmask // PHY configuration settings, bitmask
enum { enum {
MG_PHY_LEDS_ACTIVE_HIGH = // Set if PHY LEDs are connected to ground
(1 << 0), // Set if PHY LEDs are connected to ground MG_PHY_LEDS_ACTIVE_HIGH = (1 << 0),
MG_PHY_CLOCKS_MAC = // Set when PHY clocks MAC. Otherwise, MAC clocks PHY
(1 << 1) // 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 }; 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 uint8_t phy_conf; // PHY config
}; };
<<<<<<< HEAD
<<<<<<< HEAD
#ifndef MG_TCPIP_PHY_CONF #ifndef MG_TCPIP_PHY_CONF
#define MG_TCPIP_PHY_CONF MG_PHY_CLOCKS_MAC #define MG_TCPIP_PHY_CONF MG_PHY_CLOCKS_MAC
#endif #endif
=======
<<<<<<< HEAD
>>>>>>> 60cce282 (Add driver init to mg_mgr_init())
=======
>>>>>>> f74ae90c (update version)
#ifndef MG_TCPIP_PHY_ADDR #ifndef MG_TCPIP_PHY_ADDR
#define MG_TCPIP_PHY_ADDR 0 #define MG_TCPIP_PHY_ADDR 0
#endif #endif
@ -3114,8 +3096,6 @@ struct mg_tcpip_driver_tm4c_data {
#define MG_DRIVER_MDC_CR 1 #define MG_DRIVER_MDC_CR 1
#endif #endif
<<<<<<< HEAD
<<<<<<< HEAD
#define MG_TCPIP_DRIVER_INIT(mgr) \ #define MG_TCPIP_DRIVER_INIT(mgr) \
do { \ do { \
static struct mg_tcpip_driver_tm4c_data driver_data_; \ 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)); \ MG_INFO(("Driver: tm4c, MAC: %M", mg_print_mac, mif_.mac)); \
} while (0) } 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 #endif

View File

@ -5,13 +5,4 @@
#include "Driver_ETH_MAC.h" // keep this include #include "Driver_ETH_MAC.h" // keep this include
#include "Driver_ETH_PHY.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 #endif

View File

@ -249,11 +249,6 @@ void mg_mgr_free(struct mg_mgr *mgr) {
mg_tls_ctx_free(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) { void mg_mgr_init(struct mg_mgr *mgr) {
memset(mgr, 0, sizeof(*mgr)); memset(mgr, 0, sizeof(*mgr));
#if MG_ENABLE_EPOLL #if MG_ENABLE_EPOLL

View File

@ -1197,22 +1197,4 @@ bool mg_send(struct mg_connection *c, const void *buf, size_t len) {
} }
return res; 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 #endif // MG_ENABLE_TCPIP

View File

@ -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))
#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)) // For printing IPv4 addresses: printf("%d.%d.%d.%d\n", MG_IPADDR_PARTS(&ip))
#define MG_U8P(ADDR) ((uint8_t *) (ADDR)) #define MG_U8P(ADDR) ((uint8_t *) (ADDR))
#define MG_IPADDR_PARTS(ADDR) \ #define MG_IPADDR_PARTS(ADDR) \