AVR build fixes

This commit is contained in:
cpq 2023-07-20 14:36:10 +01:00
parent 09ce6ae1c5
commit 0a761c09e3
37 changed files with 58 additions and 83 deletions

View File

@ -78,13 +78,6 @@ test/packed_fs.c: Makefile src/ssi.h test/fuzz.c test/data/a.txt
$(CC) $(CFLAGS) test/pack.c -o pack
$(RUN) ./pack Makefile src/ssi.h test/fuzz.c test/data/a.txt test/data/range.txt > $@
DIR ?= test/data
OUT ?= packed_fs.c
mkfs:
$(CC) $(CFLAGS) test/pack.c -o pack
$(RUN) ./pack -s $(DIR) `find $(DIR) -type f` > $(OUT)
# find $(DIR) -type f | sed -e s,^$(DIR),,g -e s,^/,,g
# Check that all external (exported) symbols have "mg_" prefix
mg_prefix: mongoose.c mongoose.h
$(CC) mongoose.c $(CFLAGS) -c -o /tmp/x.o && nm /tmp/x.o | grep ' T ' | grep -v 'mg_' ; test $$? = 1
@ -165,17 +158,26 @@ arduino: ENV = -v $(CWD)/arduino:/root
arduino:
curl -sL http://downloads.arduino.cc/arduino-1.8.19-linux64.tar.xz | unxz | tar -xf -
mv arduino-* $@
arduino-xiao-board:
$(DOCKER) mdashnet/cc2 ./arduino/arduino --pref "boardsmanager.additional.urls=https://files.seeedstudio.com/arduino/package_seeeduino_boards_index.json" --save-prefs
$(DOCKER) mdashnet/cc2 ./arduino/arduino --pref "compiler.warning_level=all" --save-prefs
$(DOCKER) mdashnet/cc2 ./arduino/arduino --install-boards Seeeduino:samd
arduino-xiao: ENV = -v $(CWD)/arduino:/root
arduino-xiao: arduino
arduino-xiao: arduino arduino-xiao-board
rm -rf tmp; mkdir tmp
cp examples/arduino/w5500/w5500.ino tmp/tmp.ino
cp mongoose.c mongoose.h examples/arduino/w5500/mongoose_custom.h tmp/
$(DOCKER) mdashnet/cc2 ./arduino/arduino --verbose --verify --board Seeeduino:samd:seeed_XIAO_m0 tmp/tmp.ino
arduino-nano: ENV = -v $(CWD)/arduino:/root
arduino-nano: arduino
rm -rf tmp; mkdir tmp
cp examples/arduino/w5500/w5500.ino tmp/tmp.ino
cp mongoose.c mongoose.h examples/arduino/w5500/mongoose_custom.h tmp/
$(DOCKER) mdashnet/cc2 ./arduino/arduino --verbose --verify --board arduino:avr:nano tmp/tmp.ino
mingw++: Makefile mongoose.h $(SRCS)
$(DOCKER) mdashnet/mingw x86_64-w64-mingw32-g++ $(SRCS) -W -Wall -Werror -I. $(DEFS) -lwsock32 -o $@.exe

View File

@ -11,4 +11,5 @@
#define MG_ENABLE_SOCKET 0
#define MG_ENABLE_TCPIP 1
#define mkdir(a, b) (-1)
#define MG_IO_SIZE 128
//#define MG_ENABLE_LOG 0

View File

@ -8,20 +8,16 @@
#endif
#define MG_ENABLE_PACKED_FS 1
#define MG_ENABLE_CUSTOM_MILLIS 1
#define MG_ENABLE_MBEDTLS 0
#define MG_ARCH MG_STMPACK_ARCH
#define MG_STMPACK_NET 0
#define MG_ENABLE_CUSTOM_RANDOM 1
// Translate to Mongoose macros
#if MG_CMSISPACK_NET == 0
#define MG_ENABLE_TCPIP 1
#define MG_ENABLE_DRIVER_STM32 1
#elif MG_CMSISPACK_NET == 1
#define MG_ENABLE_LWIP 1
#elif MG_CMSISPACK_NET == 2

View File

@ -8,20 +8,16 @@
#endif
#define MG_ENABLE_PACKED_FS 1
#define MG_ENABLE_CUSTOM_MILLIS 0
#define MG_ENABLE_MBEDTLS 0
#define MG_ARCH MG_ARCH_FREERTOS
#define MG_STMPACK_NET 1
#define MG_ENABLE_CUSTOM_RANDOM 1
// Translate to Mongoose macros
#if MG_STMPACK_NET == 0
#define MG_ENABLE_TCPIP 1
#define MG_ENABLE_DRIVER_STM32 1
#elif MG_STMPACK_NET == 1
#define MG_ENABLE_LWIP 1
#elif MG_STMPACK_NET == 2

View File

@ -8,20 +8,16 @@
#endif
#define MG_ENABLE_PACKED_FS 1
#define MG_ENABLE_CUSTOM_MILLIS 0
#define MG_ENABLE_MBEDTLS 0
#define MG_ARCH MG_ARCH_CMSIS_RTOS2
#define MG_STMPACK_NET 0
#define MG_ENABLE_CUSTOM_RANDOM 1
// Translate to Mongoose macros
#if MG_STMPACK_NET == 0
#define MG_ENABLE_TCPIP 1
#define MG_ENABLE_DRIVER_STM32 1
#elif MG_STMPACK_NET == 1
#define MG_ENABLE_LWIP 1
#elif MG_STMPACK_NET == 2

View File

@ -15,7 +15,7 @@ CFLAGS += -IFreeRTOS-Kernel/include
CFLAGS += -IFreeRTOS-Kernel/portable/GCC/ARM_CM4F -Wno-conversion
SOURCES += mongoose.c net.c packed_fs.c
CFLAGS += $(CFLAGS_EXTRA) # Mongoose options are defined in mongoose_custom.h
CFLAGS += -DMG_ENABLE_DRIVER_STM32=1 $(CFLAGS_EXTRA) # Mongoose options are defined in mongoose_custom.h
# Example specific build options. See README.md
CFLAGS += -DHTTP_URL=\"http://0.0.0.0/\"

View File

@ -3,6 +3,7 @@
// See https://mongoose.ws/documentation/#build-options
#define MG_ARCH MG_ARCH_FREERTOS
#define MG_ENABLE_TCPIP 1
#define MG_ENABLE_DRIVER_STM32 1
#define MG_IO_SIZE 256
#define MG_ENABLE_CUSTOM_RANDOM 1
#define MG_ENABLE_PACKED_FS 1

View File

@ -11,7 +11,7 @@ SOURCES += cmsis_f4/Source/Templates/gcc/startup_stm32f429xx.s # ST startup file
# Mongoose-specific source code files and build options. See https://mongoose.ws/documentation/#build-options
SOURCES += mongoose.c net.c packed_fs.c
CFLAGS += -DMG_ENABLE_TCPIP=1 -DMG_ARCH=MG_ARCH_NEWLIB -DMG_ENABLE_CUSTOM_MILLIS=1
CFLAGS += -DMG_ENABLE_CUSTOM_RANDOM=1 -DMG_ENABLE_PACKED_FS=1 $(CFLAGS_EXTRA)
CFLAGS += -DMG_ENABLE_CUSTOM_RANDOM=1 -DMG_ENABLE_PACKED_FS=1 -DMG_ENABLE_DRIVER_STM32=1 $(CFLAGS_EXTRA)
# Example specific build options. See README.md
CFLAGS += -DHTTP_URL=\"http://0.0.0.0/\"

View File

@ -25,7 +25,7 @@ CFLAGS += -Wno-conversion -Wno-sign-conversion
# Mongoose-specific. See https://mongoose.ws/documentation/#build-options
SOURCES += mongoose.c
CFLAGS += -DMG_ENABLE_TCPIP=1 -DMG_ARCH=MG_ARCH_NEWLIB -DMG_ENABLE_CUSTOM_MILLIS=1
CFLAGS += -DMG_ENABLE_CUSTOM_RANDOM=1 -DMG_IO_SIZE=512 $(CFLAGS_EXTRA)
CFLAGS += -DMG_ENABLE_CUSTOM_RANDOM=1 -DMG_IO_SIZE=512 -DMG_ENABLE_DRIVER_STM32=1 $(CFLAGS_EXTRA)
ifeq ($(OS),Windows_NT)
RM = cmd /C del /Q /F /S

View File

@ -8,20 +8,16 @@
#endif
#define MG_ENABLE_PACKED_FS 1
#define MG_ENABLE_CUSTOM_MILLIS 1
#define MG_ENABLE_MBEDTLS 0
#define MG_ARCH MG_STMPACK_ARCH
#define MG_STMPACK_NET 0
#define MG_ENABLE_CUSTOM_RANDOM 1
// Translate to Mongoose macros
#if MG_CMSISPACK_NET == 0
#define MG_ENABLE_TCPIP 1
#define MG_ENABLE_DRIVER_STM32 1
#elif MG_CMSISPACK_NET == 1
#define MG_ENABLE_LWIP 1
#elif MG_CMSISPACK_NET == 2

View File

@ -8,20 +8,16 @@
#endif
#define MG_ENABLE_PACKED_FS 1
#define MG_ENABLE_CUSTOM_MILLIS 0
#define MG_ENABLE_MBEDTLS 0
#define MG_ARCH MG_ARCH_FREERTOS
#define MG_STMPACK_NET 1
#define MG_ENABLE_CUSTOM_RANDOM 1
// Translate to Mongoose macros
#if MG_STMPACK_NET == 0
#define MG_ENABLE_TCPIP 1
#define MG_ENABLE_DRIVER_STM32 1
#elif MG_STMPACK_NET == 1
#define MG_ENABLE_LWIP 1
#elif MG_STMPACK_NET == 2

View File

@ -8,20 +8,16 @@
#endif
#define MG_ENABLE_PACKED_FS 1
#define MG_ENABLE_CUSTOM_MILLIS 0
#define MG_ENABLE_MBEDTLS 0
#define MG_ARCH MG_ARCH_CMSIS_RTOS2
#define MG_STMPACK_NET 0
#define MG_ENABLE_CUSTOM_RANDOM 1
// Translate to Mongoose macros
#if MG_STMPACK_NET == 0
#define MG_ENABLE_TCPIP 1
#define MG_ENABLE_DRIVER_STM32 1
#elif MG_STMPACK_NET == 1
#define MG_ENABLE_LWIP 1
#elif MG_STMPACK_NET == 2

View File

@ -29,7 +29,7 @@ CFLAGS += -DSTM32F7xx -Wno-unused-parameter
CFLAGS += -DSTM32F746xx -Wno-sign-compare -Wno-undef -Wno-shadow -Wno-array-bounds -Wno-error
SOURCES += mongoose.c net.c packed_fs.c
CFLAGS += $(CFLAGS_EXTRA) # Mongoose options are defined in mongoose_custom.h
CFLAGS += -DMG_ENABLE_DRIVER_STM32=1 $(CFLAGS_EXTRA) # Mongoose options are defined in mongoose_custom.h
# Example specific build options. See README.md
CFLAGS += -DHTTP_URL=\"http://0.0.0.0/\"

View File

@ -3,6 +3,7 @@
// See https://mongoose.ws/documentation/#build-options
#define MG_ARCH MG_ARCH_FREERTOS
#define MG_ENABLE_FREERTOS_TCP 1
#define MG_ENABLE_DRIVER_STM32 1
#define MG_ENABLE_CUSTOM_RANDOM 1
#define MG_ENABLE_PACKED_FS 1

View File

@ -15,7 +15,7 @@ CFLAGS += -IFreeRTOS-Kernel/include
CFLAGS += -IFreeRTOS-Kernel/portable/GCC/ARM_CM7/r0p1 -Wno-conversion
SOURCES += mongoose.c net.c packed_fs.c
CFLAGS += $(CFLAGS_EXTRA) # Mongoose options are defined in mongoose_custom.h
CFLAGS += -DMG_ENABLE_DRIVER_STM32=1 $(CFLAGS_EXTRA) # Mongoose options are defined in mongoose_custom.h
# Example specific build options. See README.md
CFLAGS += -DHTTP_URL=\"http://0.0.0.0/\"

View File

@ -3,6 +3,7 @@
// See https://mongoose.ws/documentation/#build-options
#define MG_ARCH MG_ARCH_FREERTOS
#define MG_ENABLE_TCPIP 1
#define MG_ENABLE_DRIVER_STM32 1
#define MG_IO_SIZE 256
#define MG_ENABLE_CUSTOM_RANDOM 1
#define MG_ENABLE_PACKED_FS 1

View File

@ -65,6 +65,7 @@
#endif
#if MG_CMSISPACK_NET == 0
#define MG_ENABLE_TCPIP 1
#define MG_ENABLE_DRIVER_STM32 1
#elif MG_CMSISPACK_NET == 1
#define MG_ENABLE_LWIP 1
#elif MG_CMSISPACK_NET == 2

View File

@ -65,6 +65,7 @@
#endif
#if MG_CMSISPACK_NET == 0
#define MG_ENABLE_TCPIP 1
#define MG_ENABLE_DRIVER_STM32 1
#elif MG_CMSISPACK_NET == 1
#define MG_ENABLE_LWIP 1
#elif MG_CMSISPACK_NET == 2

View File

@ -65,6 +65,7 @@
#endif
#if MG_CMSISPACK_NET == 0
#define MG_ENABLE_TCPIP 1
#define MG_ENABLE_DRIVER_STM32 1
#elif MG_CMSISPACK_NET == 1
#define MG_ENABLE_LWIP 1
#elif MG_CMSISPACK_NET == 2

View File

@ -65,6 +65,7 @@
#endif
#if MG_CMSISPACK_NET == 0
#define MG_ENABLE_TCPIP 1
#define MG_ENABLE_DRIVER_STM32 1
#elif MG_CMSISPACK_NET == 1
#define MG_ENABLE_LWIP 1
#elif MG_CMSISPACK_NET == 2

View File

@ -65,6 +65,7 @@
#endif
#if MG_CMSISPACK_NET == 0
#define MG_ENABLE_TCPIP 1
#define MG_ENABLE_DRIVER_STM32 1
#elif MG_CMSISPACK_NET == 1
#define MG_ENABLE_LWIP 1
#elif MG_CMSISPACK_NET == 2

View File

@ -65,6 +65,7 @@
#endif
#if MG_CMSISPACK_NET == 0
#define MG_ENABLE_TCPIP 1
#define MG_ENABLE_DRIVER_STM32 1
#elif MG_CMSISPACK_NET == 1
#define MG_ENABLE_LWIP 1
#elif MG_CMSISPACK_NET == 2

View File

@ -65,6 +65,7 @@
#endif
#if MG_CMSISPACK_NET == 0
#define MG_ENABLE_TCPIP 1
#define MG_ENABLE_DRIVER_STM32 1
#elif MG_CMSISPACK_NET == 1
#define MG_ENABLE_LWIP 1
#elif MG_CMSISPACK_NET == 2

View File

@ -65,6 +65,7 @@
#endif
#if MG_CMSISPACK_NET == 0
#define MG_ENABLE_TCPIP 1
#define MG_ENABLE_DRIVER_STM32 1
#elif MG_CMSISPACK_NET == 1
#define MG_ENABLE_LWIP 1
#elif MG_CMSISPACK_NET == 2

View File

@ -65,6 +65,7 @@
#endif
#if MG_CMSISPACK_NET == 0
#define MG_ENABLE_TCPIP 1
#define MG_ENABLE_DRIVER_STM32 1
#elif MG_CMSISPACK_NET == 1
#define MG_ENABLE_LWIP 1
#elif MG_CMSISPACK_NET == 2

View File

@ -65,6 +65,7 @@
#endif
#if MG_CMSISPACK_NET == 0
#define MG_ENABLE_TCPIP 1
#define MG_ENABLE_DRIVER_STM32 1
#elif MG_CMSISPACK_NET == 1
#define MG_ENABLE_LWIP 1
#elif MG_CMSISPACK_NET == 2

View File

@ -65,6 +65,7 @@
#endif
#if MG_CMSISPACK_NET == 0
#define MG_ENABLE_TCPIP 1
#define MG_ENABLE_DRIVER_STM32 1
#elif MG_CMSISPACK_NET == 1
#define MG_ENABLE_LWIP 1
#elif MG_CMSISPACK_NET == 2

View File

@ -11,7 +11,7 @@ SOURCES += cmsis_f7/Source/Templates/gcc/startup_stm32f746xx.s # ST startup file
# Mongoose-specific. See https://mongoose.ws/documentation/#build-options
SOURCES += mongoose.c net.c packed_fs.c
CFLAGS += -DMG_ENABLE_TCPIP=1 -DMG_ARCH=MG_ARCH_NEWLIB -DMG_ENABLE_CUSTOM_MILLIS=1
CFLAGS += -DMG_ENABLE_CUSTOM_RANDOM=1 -DMG_ENABLE_PACKED_FS=1 $(CFLAGS_EXTRA)
CFLAGS += -DMG_ENABLE_CUSTOM_RANDOM=1 -DMG_ENABLE_PACKED_FS=1 -DMG_ENABLE_DRIVER_STM32=1 $(CFLAGS_EXTRA)
# Example specific build options. See README.md
CFLAGS += -DHTTP_URL=\"http://0.0.0.0/\" -DHTTPS_URL=\"https://0.0.0.0/\"

View File

@ -25,7 +25,7 @@ CFLAGS += -Wno-conversion -Wno-sign-conversion
# Mongoose-specific. See https://mongoose.ws/documentation/#build-options
SOURCES += mongoose.c
CFLAGS += -DMG_ENABLE_TCPIP=1 -DMG_ARCH=MG_ARCH_NEWLIB -DMG_ENABLE_CUSTOM_MILLIS=1
CFLAGS += -DMG_ENABLE_CUSTOM_RANDOM=1 -DMG_IO_SIZE=512 $(CFLAGS_EXTRA)
CFLAGS += -DMG_ENABLE_CUSTOM_RANDOM=1 -DMG_IO_SIZE=512 -DMG_ENABLE_DRIVER_STM32=1 $(CFLAGS_EXTRA)
ifeq ($(OS),Windows_NT)
RM = cmd /C del /Q /F /S

View File

@ -8,20 +8,16 @@
#endif
#define MG_ENABLE_PACKED_FS 1
#define MG_ENABLE_CUSTOM_MILLIS 1
#define MG_ENABLE_MBEDTLS 0
#define MG_ARCH MG_STMPACK_ARCH
#define MG_STMPACK_NET 0
#define MG_ENABLE_CUSTOM_RANDOM 1
// Translate to Mongoose macros
#if MG_CMSISPACK_NET == 0
#define MG_ENABLE_TCPIP 1
#define MG_ENABLE_DRIVER_STM32H 1
#elif MG_CMSISPACK_NET == 1
#define MG_ENABLE_LWIP 1
#elif MG_CMSISPACK_NET == 2

View File

@ -8,20 +8,16 @@
#endif
#define MG_ENABLE_PACKED_FS 1
#define MG_ENABLE_CUSTOM_MILLIS 0
#define MG_ENABLE_MBEDTLS 0
#define MG_ARCH MG_ARCH_CMSIS_RTOS2
#define MG_STMPACK_NET 0
#define MG_ENABLE_CUSTOM_RANDOM 1
// Translate to Mongoose macros
#if MG_STMPACK_NET == 0
#define MG_ENABLE_TCPIP 1
#define MG_ENABLE_DRIVER_STM32H 1
#elif MG_STMPACK_NET == 1
#define MG_ENABLE_LWIP 1
#elif MG_STMPACK_NET == 2

View File

@ -6702,7 +6702,7 @@ struct mg_tcpip_driver mg_tcpip_driver_imxrt1020 = {
#endif
#if MG_ENABLE_TCPIP && MG_ENABLE_DRIVER_STM32
#if MG_ENABLE_TCPIP && defined(MG_ENABLE_DRIVER_STM32) && MG_ENABLE_DRIVER_STM32
struct stm32_eth {
volatile uint32_t MACCR, MACFFR, MACHTHR, MACHTLR, MACMIIAR, MACMIIDR, MACFCR,
MACVLANTR, RESERVED0[2], MACRWUFFR, MACPMTCSR, RESERVED1, MACDBGR, MACSR,
@ -8144,8 +8144,9 @@ static void read_conn(struct mg_connection *c, struct pkt *pkt) {
uint32_t rem_ip;
memcpy(&rem_ip, c->rem.ip, sizeof(uint32_t));
MG_DEBUG(("SEQ != ACK: %x %x %x", seq, s->ack, ack));
tx_tcp((struct mg_tcpip_if *) c->mgr->priv, s->mac, rem_ip, TH_ACK, c->loc.port,
c->rem.port, mg_htonl(s->seq), mg_htonl(s->ack), "", 0);
tx_tcp((struct mg_tcpip_if *) c->mgr->priv, s->mac, rem_ip, TH_ACK,
c->loc.port, c->rem.port, mg_htonl(s->seq), mg_htonl(s->ack), "",
0);
}
} else if (io->size - io->len < pkt->pay.len &&
!mg_iobuf_resize(io, io->len + pkt->pay.len)) {
@ -8371,7 +8372,7 @@ static void mg_tcpip_poll(struct mg_tcpip_if *ifp, uint64_t uptime_ms) {
if (ifp->now >= ifp->lease_expire) {
ifp->state = MG_TCPIP_STATE_UP, ifp->ip = 0; // expired, release IP
onstatechange(ifp);
} else if (ifp->now + 30 * 60 * 1000 > ifp->lease_expire &&
} else if (ifp->now + 30UL * 60UL * 1000UL > ifp->lease_expire &&
((ifp->now / 1000) % 60) == 0) {
// hack: 30 min before deadline, try to rebind (4.3.6) every min
tx_dhcp_request_re(ifp, (uint8_t *) broadcast, ifp->ip, 0xffffffff);

View File

@ -755,7 +755,7 @@ struct timeval {
#endif
#ifndef MG_MAX_RECV_SIZE
#define MG_MAX_RECV_SIZE (3 * 1024 * 1024) // Maximum recv IO buffer size
#define MG_MAX_RECV_SIZE (3UL * 1024UL * 1024UL) // Maximum recv IO buffer size
#endif
#ifndef MG_DATA_SIZE
@ -1630,7 +1630,7 @@ void mg_rpc_list(struct mg_rpc_req *r);
struct mg_tcpip_if; // MIP network interface
struct mg_tcpip_if; // Mongoose TCP/IP network interface
struct mg_tcpip_driver {
bool (*init)(struct mg_tcpip_if *); // Init driver
@ -1646,8 +1646,8 @@ struct mg_tcpip_if {
struct mg_str tx; // Output (TX) buffer
bool enable_dhcp_client; // Enable DCHP client
bool enable_dhcp_server; // Enable DCHP server
bool enable_crc32_check; // Do a CRC check on rx frames and strip it
bool enable_mac_check; // Do a MAC check on rx frames
bool enable_crc32_check; // Do a CRC check on RX frames and strip it
bool enable_mac_check; // Do a MAC check on RX frames
struct mg_tcpip_driver *driver; // Low level driver
void *driver_data; // Driver-specific data
struct mg_mgr *mgr; // Mongoose event manager
@ -1687,12 +1687,6 @@ struct mg_tcpip_spi {
void (*end)(void *); // SPI end: slave select high
uint8_t (*txn)(void *, uint8_t); // SPI transaction: write 1 byte, read reply
};
#if !defined(MG_ENABLE_DRIVER_STM32H) && !defined(MG_ENABLE_DRIVER_TM4C)
#define MG_ENABLE_DRIVER_STM32 1
#else
#define MG_ENABLE_DRIVER_STM32 0
#endif
#endif

View File

@ -90,7 +90,7 @@
#endif
#ifndef MG_MAX_RECV_SIZE
#define MG_MAX_RECV_SIZE (3 * 1024 * 1024) // Maximum recv IO buffer size
#define MG_MAX_RECV_SIZE (3UL * 1024UL * 1024UL) // Maximum recv IO buffer size
#endif
#ifndef MG_DATA_SIZE

View File

@ -1,6 +1,6 @@
#include "tcpip.h"
#if MG_ENABLE_TCPIP && MG_ENABLE_DRIVER_STM32
#if MG_ENABLE_TCPIP && defined(MG_ENABLE_DRIVER_STM32) && MG_ENABLE_DRIVER_STM32
struct stm32_eth {
volatile uint32_t MACCR, MACFFR, MACHTHR, MACHTLR, MACMIIAR, MACMIIDR, MACFCR,
MACVLANTR, RESERVED0[2], MACRWUFFR, MACPMTCSR, RESERVED1, MACDBGR, MACSR,

View File

@ -582,8 +582,9 @@ static void read_conn(struct mg_connection *c, struct pkt *pkt) {
uint32_t rem_ip;
memcpy(&rem_ip, c->rem.ip, sizeof(uint32_t));
MG_DEBUG(("SEQ != ACK: %x %x %x", seq, s->ack, ack));
tx_tcp((struct mg_tcpip_if *) c->mgr->priv, s->mac, rem_ip, TH_ACK, c->loc.port,
c->rem.port, mg_htonl(s->seq), mg_htonl(s->ack), "", 0);
tx_tcp((struct mg_tcpip_if *) c->mgr->priv, s->mac, rem_ip, TH_ACK,
c->loc.port, c->rem.port, mg_htonl(s->seq), mg_htonl(s->ack), "",
0);
}
} else if (io->size - io->len < pkt->pay.len &&
!mg_iobuf_resize(io, io->len + pkt->pay.len)) {
@ -809,7 +810,7 @@ static void mg_tcpip_poll(struct mg_tcpip_if *ifp, uint64_t uptime_ms) {
if (ifp->now >= ifp->lease_expire) {
ifp->state = MG_TCPIP_STATE_UP, ifp->ip = 0; // expired, release IP
onstatechange(ifp);
} else if (ifp->now + 30 * 60 * 1000 > ifp->lease_expire &&
} else if (ifp->now + 30UL * 60UL * 1000UL > ifp->lease_expire &&
((ifp->now / 1000) % 60) == 0) {
// hack: 30 min before deadline, try to rebind (4.3.6) every min
tx_dhcp_request_re(ifp, (uint8_t *) broadcast, ifp->ip, 0xffffffff);

View File

@ -5,7 +5,7 @@
#include "net.h"
#include "queue.h"
struct mg_tcpip_if; // MIP network interface
struct mg_tcpip_if; // Mongoose TCP/IP network interface
struct mg_tcpip_driver {
bool (*init)(struct mg_tcpip_if *); // Init driver
@ -21,8 +21,8 @@ struct mg_tcpip_if {
struct mg_str tx; // Output (TX) buffer
bool enable_dhcp_client; // Enable DCHP client
bool enable_dhcp_server; // Enable DCHP server
bool enable_crc32_check; // Do a CRC check on rx frames and strip it
bool enable_mac_check; // Do a MAC check on rx frames
bool enable_crc32_check; // Do a CRC check on RX frames and strip it
bool enable_mac_check; // Do a MAC check on RX frames
struct mg_tcpip_driver *driver; // Low level driver
void *driver_data; // Driver-specific data
struct mg_mgr *mgr; // Mongoose event manager
@ -62,10 +62,4 @@ struct mg_tcpip_spi {
void (*end)(void *); // SPI end: slave select high
uint8_t (*txn)(void *, uint8_t); // SPI transaction: write 1 byte, read reply
};
#if !defined(MG_ENABLE_DRIVER_STM32H) && !defined(MG_ENABLE_DRIVER_TM4C)
#define MG_ENABLE_DRIVER_STM32 1
#else
#define MG_ENABLE_DRIVER_STM32 0
#endif
#endif