yxlnqs / Diviner-full-emu-

DMA Firmware
8 stars 6 forks source link

About MAC address simulation. #1

Open TTLH20220429 opened 3 months ago

TTLH20220429 commented 3 months ago

If I need to modify the MAC address, which register address can I modify in the bar_controller file? Thank you for sharing

TTLH20220429 commented 3 months ago
    MAC0            = 0x00,     /* Ethernet hardware address. */
    MAC4            = 0x04,
    MAR0            = 0x08,     /* Multicast filter. */
    CounterAddrLow      = 0x10,
    CounterAddrHigh     = 0x14,
    CustomLED       = 0x18,
    TxDescStartAddrLow  = 0x20,
    TxDescStartAddrHigh = 0x24,
    TxHDescStartAddrLow = 0x28,
    TxHDescStartAddrHigh    = 0x2c,
    FLASH           = 0x30,
    INT_CFG0_8125   = 0x34,
    ERSR            = 0x36,
    ChipCmd         = 0x37,
    TxPoll          = 0x38,
    IntrMask        = 0x3C,
    IntrStatus      = 0x3E,
    TxConfig        = 0x40,
    RxConfig        = 0x44,
    TCTR            = 0x48,
    Cfg9346         = 0x50,
    Config0         = 0x51,
    Config1         = 0x52,
    Config2         = 0x53,
    Config3         = 0x54,
    Config4         = 0x55,
    Config5         = 0x56,
    TDFNR           = 0x57,
    TimeInt0        = 0x58,
    TimeInt1        = 0x5C,
    PHYAR           = 0x60,
    CSIDR           = 0x64,
    CSIAR           = 0x68,
    PHYstatus       = 0x6C,
    MACDBG          = 0x6D,
    GPIO            = 0x6E,
    PMCH            = 0x6F,
    ERIDR           = 0x70,
    ERIAR           = 0x74,
    INT_CFG1_8125   = 0x7A,
    EPHY_RXER_NUM   = 0x7C,
    EPHYAR          = 0x80,
    TimeInt2        = 0x8C,
    OCPDR           = 0xB0,
    MACOCP          = 0xB0,
    OCPAR           = 0xB4,
    SecMAC0         = 0xB4,
    SecMAC4         = 0xB8,
    PHYOCP          = 0xB8,
    DBG_reg         = 0xD1,
    TwiCmdReg       = 0xD2,
    MCUCmd_reg      = 0xD3,
    RxMaxSize       = 0xDA,
    EFUSEAR         = 0xDC,
    CPlusCmd        = 0xE0,
    IntrMitigate    = 0xE2,
    RxDescAddrLow   = 0xE4,
    RxDescAddrHigh  = 0xE8,
    MTPS            = 0xEC,
    FuncEvent       = 0xF0,
    PPSW            = 0xF2,
    FuncEventMask   = 0xF4,
    TimeInt3        = 0xF4,
    FuncPresetState = 0xF8,
    CMAC_IBCR0      = 0xF8,
    CMAC_IBCR2      = 0xF9,
    CMAC_IBIMR0     = 0xFA,
    CMAC_IBISR0     = 0xFB,
    FuncForceEvent  = 0xFC

I found the meaning of these fields from the driver source code.

yxlnqs commented 3 months ago

To modify the MAC address in the bar_controller file, you can change the values at the following register addresses:

MAC0 = 0x00 (This register contains the first 4 bytes of the MAC address) MAC4 = 0x04 (This register contains the last 2 bytes of the MAC address) You will need to write the new MAC address to these registers accordingly.

For example, if your new MAC address is 01:23:45:67:89:AB, you would write 01 23 45 67 to MAC0 and 89 AB to MAC4.

Let me know if you need any more details or assistance!

TTLH20220429 commented 3 months ago

Thank you for your answer. Additionally, I couldn't find the actual meaning of these offset addresses, h0538 h0548 h0558 h083C h0848 h0858 Can I find the annotations for these registers in the driver source code?

shih6 commented 2 months ago
            16'h0000 : begin

                            rd_rsp_data[31:0]   <= 32'h01234567;  // mac prefix 
                        end
            16'h0004 : begin
                            rd_rsp_data[31:0]=32'h0000AB89
                                end

its not working