From 6a5d3cdf2c832e90f3ac159b9e111efefdfd0618 Mon Sep 17 00:00:00 2001 From: HL Yi Date: Sat, 17 Oct 2026 16:42:39 -0500 Subject: [PATCH] change constant to macros and move RXIE enable to boot.c for portability. --- boot.c | 1 + cmd_parser.c | 2 +- rtl837x_common.h | 2 +- rtl837x_port.c | 2 +- rtl837x_stp.h | 2 +- rtlplayground.c | 1 - 6 files changed, 5 insertions(+), 5 deletions(-) diff --git a/boot.c b/boot.c index 9e271660..81a37fab 100644 --- a/boot.c +++ b/boot.c @@ -296,6 +296,7 @@ void nic_setup(void) __banked // Sequence number of TX packets tx_seq = 0; + REG_SET(RTL837X_NIC_INT_MSK, NIC_INT_RXIE); } diff --git a/cmd_parser.c b/cmd_parser.c index f0516aa4..afc7831a 100644 --- a/cmd_parser.c +++ b/cmd_parser.c @@ -745,7 +745,7 @@ void parse_isolate(void) if (cmd_compare(2, "off")) { for (uint8_t i = machine.min_port; i <= machine.max_port; i++) members |= ((uint16_t)1) << i; - members |= 0x200; // CPU-port + members |= PMASK_CPU; // CPU-port port_isolate(port_configured, members); return; } diff --git a/rtl837x_common.h b/rtl837x_common.h index a9747a18..b0589ca5 100644 --- a/rtl837x_common.h +++ b/rtl837x_common.h @@ -23,7 +23,7 @@ // Define Port-masks for 9-port devices and 6-port devices #define PMASK_9 0x1ff #define PMASK_6 0x1f8 -#define PMASK_CPU 0x200 +#define PMASK_CPU ((uint16_t)(1 << CPU_PORT)) // Defines a port mask for dropping all packets on Lookup-miss #define LOOKUP_MISS_DROP_6 0x00015540 diff --git a/rtl837x_port.c b/rtl837x_port.c index f82fc713..d4a5b9f5 100644 --- a/rtl837x_port.c +++ b/rtl837x_port.c @@ -57,7 +57,7 @@ void port_mirror_del(void) __banked bool port_ingress_filter(__xdata uint8_t port, __xdata vlan_ingress_mode_t type) __banked { - if (port > 9 || type >= VLAN_INVALID) { + if (port > CPU_PORT || type >= VLAN_INVALID) { print_string("Invalid port or ingress filter type\n"); return false; } diff --git a/rtl837x_stp.h b/rtl837x_stp.h index b547f5d8..95bac8af 100644 --- a/rtl837x_stp.h +++ b/rtl837x_stp.h @@ -46,7 +46,7 @@ extern __xdata uint8_t stp_pflags[STP_ENTITIES]; extern __xdata uint32_t stp_pcost[STP_ENTITIES]; /* path cost; 0 = auto (20000) */ extern __xdata uint8_t stp_pprio[STP_ENTITIES]; extern __xdata uint8_t stp_pp2p[STP_ENTITIES]; -extern __xdata uint8_t stp_ent_of[10]; /* the STP entity a port answers to: itself, or its lag */ +extern __xdata uint8_t stp_ent_of[STP_PORTS]; /* the STP entity a port answers to: itself, or its lag */ extern __xdata uint16_t stp_lag_mask[STP_LAG_COUNT]; /* member ports of each lag; 0 = not part of STP */ /* Last-heard designated info per port (from received BPDUs); consult diff --git a/rtlplayground.c b/rtlplayground.c index a69778ee..06c02ae3 100644 --- a/rtlplayground.c +++ b/rtlplayground.c @@ -1805,7 +1805,6 @@ void main(void) lacpEnabled = 0; lacp_init(); nic_setup(); - REG_SET(RTL837X_NIC_INT_MSK, NIC_INT_RXIE); trap_init(); vlan_setup(); port_l2_setup();