stm32/modnwwiznet5k: Add support for W5500 Ethernet chip.
Which Wiznet chip to use is a compile-time option: MICROPY_PY_WIZNET5K should be set to either 5200 or 5500 to support either one of these Ethernet chips. The driver is called network.WIZNET5K in both cases. Note that this commit introduces a breaking-change at the build level because previously the valid values for MICROPY_PY_WIZNET5K were 0 and 1 but now they are 0, 5200 and 5500.
This commit is contained in:
parent
c0ea91bc89
commit
e36821a766
@ -286,13 +286,13 @@ SRC_USBDEV = $(addprefix $(USBDEV_DIR)/,\
|
||||
class/src/usbd_msc_data.c \
|
||||
)
|
||||
|
||||
ifeq ($(MICROPY_PY_WIZNET5K),1)
|
||||
ifneq ($(MICROPY_PY_WIZNET5K),0)
|
||||
WIZNET5K_DIR=drivers/wiznet5k
|
||||
INC += -I$(TOP)/$(WIZNET5K_DIR)
|
||||
CFLAGS_MOD += -DMICROPY_PY_WIZNET5K=1
|
||||
CFLAGS_MOD += -DMICROPY_PY_WIZNET5K=$(MICROPY_PY_WIZNET5K) -D_WIZCHIP_=$(MICROPY_PY_WIZNET5K)
|
||||
SRC_MOD += modnwwiznet5k.c
|
||||
SRC_MOD += $(addprefix $(WIZNET5K_DIR)/,\
|
||||
ethernet/w5200/w5200.c \
|
||||
ethernet/w$(MICROPY_PY_WIZNET5K)/w$(MICROPY_PY_WIZNET5K).c \
|
||||
ethernet/wizchip_conf.c \
|
||||
ethernet/socket.c \
|
||||
internet/dns/dns.c \
|
||||
|
@ -398,7 +398,12 @@ STATIC mp_obj_t wiznet5k_regs(mp_obj_t self_in) {
|
||||
if (i % 16 == 0) {
|
||||
printf("\n %04x:", i);
|
||||
}
|
||||
printf(" %02x", WIZCHIP_READ(i));
|
||||
#if MICROPY_PY_WIZNET5K == 5200
|
||||
uint32_t reg = i;
|
||||
#else
|
||||
uint32_t reg = _W5500_IO_BASE_ | i << 8;
|
||||
#endif
|
||||
printf(" %02x", WIZCHIP_READ(reg));
|
||||
}
|
||||
for (int sn = 0; sn < 4; ++sn) {
|
||||
printf("\nWiz SREG[%d]:", sn);
|
||||
@ -406,7 +411,12 @@ STATIC mp_obj_t wiznet5k_regs(mp_obj_t self_in) {
|
||||
if (i % 16 == 0) {
|
||||
printf("\n %04x:", i);
|
||||
}
|
||||
printf(" %02x", WIZCHIP_READ(WIZCHIP_SREG_ADDR(sn, i)));
|
||||
#if MICROPY_PY_WIZNET5K == 5200
|
||||
uint32_t reg = WIZCHIP_SREG_ADDR(sn, i);
|
||||
#else
|
||||
uint32_t reg = _W5500_IO_BASE_ | i << 8 | WIZCHIP_SREG_BLOCK(sn) << 3;
|
||||
#endif
|
||||
printf(" %02x", WIZCHIP_READ(reg));
|
||||
}
|
||||
}
|
||||
printf("\n");
|
||||
|
@ -1,6 +1,9 @@
|
||||
# Enable/disable extra modules
|
||||
|
||||
# wiznet5k module for ethernet support
|
||||
# wiznet5k module for ethernet support; valid values are:
|
||||
# 0 : no Wiznet support
|
||||
# 5200 : support for W5200 module
|
||||
# 5500 : support for W5500 module
|
||||
MICROPY_PY_WIZNET5K ?= 0
|
||||
|
||||
# cc3k module for wifi support
|
||||
|
Loading…
Reference in New Issue
Block a user