@@ -386,6 +386,10 @@ static inline int mg_mkdir(const char *path, mode_t mode) {
386386#define MG_PATH_MAX FILENAME_MAX
387387#endif
388388
389+ #ifndef MG_ENABLE_POSIX_FS
390+ #define MG_ENABLE_POSIX_FS 1
391+ #endif
392+
389393#endif
390394
391395
@@ -499,6 +503,10 @@ typedef int socklen_t;
499503#define SIGPIPE 0
500504#endif
501505
506+ #ifndef MG_ENABLE_POSIX_FS
507+ #define MG_ENABLE_POSIX_FS 1
508+ #endif
509+
502510#endif
503511
504512
@@ -782,12 +790,8 @@ struct timeval {
782790#endif
783791
784792#ifndef MG_ENABLE_POSIX_FS
785- #if defined(FOPEN_MAX)
786- #define MG_ENABLE_POSIX_FS 1
787- #else
788793#define MG_ENABLE_POSIX_FS 0
789794#endif
790- #endif
791795
792796#ifndef MG_INVALID_SOCKET
793797#define MG_INVALID_SOCKET (-1 )
@@ -3070,14 +3074,22 @@ struct mg_tcpip_driver_tm4c_data {
30703074#endif
30713075
30723076
3073- #if MG_ENABLE_TCPIP && defined(MG_ENABLE_DRIVER_W5500) && MG_ENABLE_DRIVER_W5500
3074-
3075- #endif
3076-
3077-
3078- #if MG_ENABLE_TCPIP && defined(MG_ENABLE_DRIVER_XMC7) && MG_ENABLE_DRIVER_XMC7
3077+ #if MG_ENABLE_TCPIP && defined(MG_ENABLE_DRIVER_XMC) && MG_ENABLE_DRIVER_XMC
30793078
3080- struct mg_tcpip_driver_xmc7_data {
3079+ struct mg_tcpip_driver_xmc_data {
3080+ // 13.2.8.1 Station Management Functions
3081+ // MDC clock divider (). MDC clock is derived from ETH MAC clock
3082+ // It must not exceed 2.5MHz
3083+ // ETH Clock range DIVIDER mdc_cr VALUE
3084+ // --------------------------------------------
3085+ // -1 <-- tell driver to guess the value
3086+ // 60-100 MHz ETH Clock/42 0
3087+ // 100-150 MHz ETH Clock/62 1
3088+ // 20-35 MHz ETH Clock/16 2
3089+ // 35-60 MHz ETH Clock/26 3
3090+ // 150-250 MHz ETH Clock/102 4
3091+ // 250-300 MHz ETH Clock/124 5
3092+ // 110, 111 Reserved
30813093 int mdc_cr; // Valid values: -1, 0, 1, 2, 3, 4, 5
30823094 uint8_t phy_addr;
30833095};
@@ -3087,45 +3099,31 @@ struct mg_tcpip_driver_xmc7_data {
30873099#endif
30883100
30893101#ifndef MG_DRIVER_MDC_CR
3090- #define MG_DRIVER_MDC_CR 3
3102+ #define MG_DRIVER_MDC_CR 4
30913103#endif
30923104
30933105#define MG_TCPIP_DRIVER_INIT (mgr ) \
30943106 do { \
3095- static struct mg_tcpip_driver_xmc7_data driver_data_; \
3107+ static struct mg_tcpip_driver_xmc_data driver_data_; \
30963108 static struct mg_tcpip_if mif_; \
30973109 driver_data_.mdc_cr = MG_DRIVER_MDC_CR; \
30983110 driver_data_.phy_addr = MG_TCPIP_PHY_ADDR; \
30993111 mif_.ip = MG_TCPIP_IP; \
31003112 mif_.mask = MG_TCPIP_MASK; \
31013113 mif_.gw = MG_TCPIP_GW; \
3102- mif_.driver = &mg_tcpip_driver_xmc7 ; \
3114+ mif_.driver = &mg_tcpip_driver_xmc ; \
31033115 mif_.driver_data = &driver_data_; \
31043116 MG_SET_MAC_ADDRESS (mif_.mac ); \
31053117 mg_tcpip_init (mgr, &mif_); \
3106- MG_INFO ((" Driver: xmc7 , MAC: %M" , mg_print_mac, mif_.mac )); \
3118+ MG_INFO ((" Driver: xmc , MAC: %M" , mg_print_mac, mif_.mac )); \
31073119 } while (0 )
31083120
31093121#endif
31103122
31113123
3124+ #if MG_ENABLE_TCPIP && defined(MG_ENABLE_DRIVER_XMC7) && MG_ENABLE_DRIVER_XMC7
31123125
3113- #if MG_ENABLE_TCPIP && defined(MG_ENABLE_DRIVER_XMC) && MG_ENABLE_DRIVER_XMC
3114-
3115- struct mg_tcpip_driver_xmc_data {
3116- // 13.2.8.1 Station Management Functions
3117- // MDC clock divider (). MDC clock is derived from ETH MAC clock
3118- // It must not exceed 2.5MHz
3119- // ETH Clock range DIVIDER mdc_cr VALUE
3120- // --------------------------------------------
3121- // -1 <-- tell driver to guess the value
3122- // 60-100 MHz ETH Clock/42 0
3123- // 100-150 MHz ETH Clock/62 1
3124- // 20-35 MHz ETH Clock/16 2
3125- // 35-60 MHz ETH Clock/26 3
3126- // 150-250 MHz ETH Clock/102 4
3127- // 250-300 MHz ETH Clock/124 5
3128- // 110, 111 Reserved
3126+ struct mg_tcpip_driver_xmc7_data {
31293127 int mdc_cr; // Valid values: -1, 0, 1, 2, 3, 4, 5
31303128 uint8_t phy_addr;
31313129};
@@ -3135,27 +3133,28 @@ struct mg_tcpip_driver_xmc_data {
31353133#endif
31363134
31373135#ifndef MG_DRIVER_MDC_CR
3138- #define MG_DRIVER_MDC_CR 4
3136+ #define MG_DRIVER_MDC_CR 3
31393137#endif
31403138
31413139#define MG_TCPIP_DRIVER_INIT (mgr ) \
31423140 do { \
3143- static struct mg_tcpip_driver_xmc_data driver_data_; \
3141+ static struct mg_tcpip_driver_xmc7_data driver_data_; \
31443142 static struct mg_tcpip_if mif_; \
31453143 driver_data_.mdc_cr = MG_DRIVER_MDC_CR; \
31463144 driver_data_.phy_addr = MG_TCPIP_PHY_ADDR; \
31473145 mif_.ip = MG_TCPIP_IP; \
31483146 mif_.mask = MG_TCPIP_MASK; \
31493147 mif_.gw = MG_TCPIP_GW; \
3150- mif_.driver = &mg_tcpip_driver_xmc ; \
3148+ mif_.driver = &mg_tcpip_driver_xmc7 ; \
31513149 mif_.driver_data = &driver_data_; \
31523150 MG_SET_MAC_ADDRESS (mif_.mac ); \
31533151 mg_tcpip_init (mgr, &mif_); \
3154- MG_INFO ((" Driver: xmc , MAC: %M" , mg_print_mac, mif_.mac )); \
3152+ MG_INFO ((" Driver: xmc7 , MAC: %M" , mg_print_mac, mif_.mac )); \
31553153 } while (0 )
31563154
31573155#endif
31583156
3157+
31593158#ifdef __cplusplus
31603159}
31613160#endif
0 commit comments