Skip to main content

MSS_MAC_cfg_struct_def_init

Function MSS_MAC_cfg_struct_def_init 

Source
pub unsafe extern "C" fn MSS_MAC_cfg_struct_def_init(
    cfg: *mut mss_mac_cfg_t,
)
Expand description

//** The MSS_MAC_cfg_struct_def_init() function initializes a mss_mac_cfg_t configuration data structure to default values. The default configuration uses the NULL_PHY interface connected to a PHY at address 0x00 which is set to auto-negotiate at all available speeds up to 1000Mbps. This default configuration can then be used as parameter to MSS_MAC_init(). Typically, the default configuration would be modified to suit the application before being passed to MSS_MAC_init().

@param cfg This parameter is a pointer to an mss_mac_cfg_t data structure that will be used as parameter to function MSS_MAC_init().

@return This function does not return a value.

Example: The example below demonstrates the use of the MSS_MAC_cfg_struct_def_init() function. It retrieves the default MAC configuration and modifies it to connect through a VSC8757 SGMII Ethernet PHY at MII management interface address 0x01. This example also demonstrates how to assign the device’s MAC address and force a 100Mbps full duplex link. @code mss_mac_cfg_t mac_config;

MSS_MAC_cfg_struct_def_init(&mac_config);

mac_config.interface_type = TBI; config.phy_type = MSS_MAC_DEV_PHY_VSC8575; config.phy_get_link_status = MSS_MAC_VSC8575_phy_get_link_status; config.phy_init = MSS_MAC_VSC8575_phy_init; config.phy_set_link_speed = MSS_MAC_VSC8575_phy_set_link_speed; config.phy_extended_read = NULL_ti_read_extended_regs; config.phy_extended_write = NULL_ti_write_extended_regs; mac_config.phy_addr = 0x01; mac_config.speed_duplex_select = MSS_MAC_ANEG_100M_FD; mac_config.mac_addr[0] = 0xC0u; mac_config.mac_addr[1] = 0xB1u; mac_config.mac_addr[2] = 0x3Cu; mac_config.mac_addr[3] = 0x88u; mac_config.mac_addr[4] = 0x88u; mac_config.mac_addr[5] = 0x88u;

MSS_MAC_init(&g_mac0, &mac_config); @endcode