diff --git a/rtl837x_regs.h b/rtl837x_regs.h index 3e172fe..29cdd1c 100644 --- a/rtl837x_regs.h +++ b/rtl837x_regs.h @@ -63,6 +63,8 @@ /* * NIC Related registers */ +#define RTL837X_REG_RX_CTRL 0x785c +#define RTL837X_REG_TX_CTRL 0x7860 #define RTL837X_REG_RX_AVAIL 0x7874 #define RTL837X_REG_RX_RINGPTR 0x787c #define RTL837X_REG_RX_DONE 0x784c diff --git a/rtlplayground.c b/rtlplayground.c index cf81eff..be7dd0f 100644 --- a/rtlplayground.c +++ b/rtlplayground.c @@ -1124,22 +1124,21 @@ void nic_setup(void) // R7844-000007fe REG_SET(0x7844, 0x7fe); - // r785c:0401201e R785c-0401201e r785c:0401201e R785c-0400201e - // 0x785c: Set bits 24-31 to 0x4, clear bits 16/17: - reg_read_m(0x785c); + // Configure NIC RX to receive various types of packets + // RTL837X_REG_RX_CTRL: Set bits 24-31 to 0x4, clear bits 16/17 + reg_read_m(RTL837X_REG_RX_CTRL); sfr_mask_data(3, 0xff, 0x04); sfr_mask_data(2, 0x03, 0); - reg_write_m(0x785c); + reg_write_m(RTL837X_REG_RX_CTRL); - // Set bit 0 of 0x7860: - // r7860:00000000 R7860-00000001 - reg_bit_set(0x7860, 0); + // Enable NIC TX (set bit 0) + reg_bit_set(RTL837X_REG_TX_CTRL, 0); - // r785c:0400201e R785c-0400201f - reg_bit_set(0x785c, 0); + // Enable NIC RX (set bit 0) + reg_bit_set(RTL837X_REG_RX_CTRL, 0); - // r785c:0400201f R785c-0400201b - reg_bit_clear(0x785c, 2); + // Drop packets with invalid CRC + reg_bit_clear(RTL837X_REG_RX_CTRL, 2); // R603c-00000200 REG_SET(0x603c, 0x200);