fix: harden ch390 rx protocol handling

This commit is contained in:
2026-04-29 04:36:17 +08:00
parent 60d2af0a27
commit a6040e7d68
4 changed files with 32 additions and 20 deletions
+5
View File
@@ -150,6 +150,8 @@ enum ch390_phy_mode
#define CH390_BCASTCR 0x53
#define CH390_INTCKCR 0x54
#define CH390_MPTRCR 0x55
#define MPTRCR_RST_TX (1<<1)
#define MPTRCR_RST_RX (1<<0)
#define CH390_MLEDCR 0x57
#define CH390_MRCMDX 0x70
#define CH390_MRCMDX1 0x71
@@ -302,6 +304,8 @@ enum ch390_phy_mode
#define CH390_RLENCR 0x52
#define CH390_BCASTCR 0x53
#define CH390_MPTRCR 0x55
#define MPTRCR_RST_TX (1<<1)
#define MPTRCR_RST_RX (1<<0)
#define CH390_MRCMDX 0xF0
#define CH390_MRCMDX1 0xF1
#define CH390_MRCMD 0xF2
@@ -356,6 +360,7 @@ enum ch390_phy_mode
#define CH390_PKT_NONE 0x00 /* No packet received */
#define CH390_PKT_RDY 0x01 /* Packet ready to receive */
#define CH390_PKT_ERR 0xFE /* Un-stable states */
#define CH390_PKT_CRC_LEN 4u /* Ethernet FCS stored in RX SRAM */
#define CH390_PKT_MAX 1536 /* Received packet max size */
#define CH390_PKT_MIN 64