10.5.2 SECDED Features for TSEMAC Buffers
The 4 KB TX buffer and 8 KB RX buffer are protected with the SECDED feature. Use the EDAC configurator to enable the SECDED feature independently for TX and RX buffers. The following figure shows how to enable or disable the SECDED feature for the EMAC TX and RX buffers. Interrupts for single bit error, dual bit error, or both single bit and dual bit errors can be enabled.
To clear these interrupts and to take necessary actions in case of dual bit error, register the interrupt handler in the application code.
Microchip provides TSEMAC firmware drivers to use with the application development. Download the SmartFusion 2 TSEMAC firmware drivers from the Firmware Catalog. The TSEMAC firmware drivers provides APIs-to-TSEMAC services. See the SmartFusion 2 TSEMAC Driver User Guide for the list of APIs and their descriptions.
The TSEMAC driver package includes sample projects to show the usage of TSEMAC. The sample projects are available for three different tool chains: IAR Embedded Work, Keil MDK, and SoftConsole. The following figure shows a sample project that gets generated by right-clicking the system services driver and selecting Generate sample project.
Microchip provides the device drivers for the TSEMAC controller for SmartFusion 2 device and recommends using these drivers for the application development.
The following table lists the APIs available in TSEMAC firmware drivers for initialization and configuration.
API | Description |
---|---|
MSS_MAC_cfg_struct_def_init | 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 MII interface connected to a PHY at address 0x00 which is set to auto-negotiate all the available speeds up to 1000 Mbps. 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() . |
MSS_MAC_init | The MSS_MAC_init() function initializes the Ethernet MAC hardware and driver internal data structures. The MSS_MAC_init() function takes a pointer to a configuration data structure of type mss_mac_cfg_t as parameter. This configuration data structure contains all the information required to configure the Ethernet MAC. The MSS_MAC_init() function initializes the descriptor rings and their pointers to initial values. The MSS_MAC_init() function enables DMA Rx packet received and Tx packet sent interrupts.The configuration passed to the |
The following table lists the APIs available in TSEMAC firmware drivers for Ethernet PHY management.
API | Description |
---|---|
MSS_MAC_read_phy_reg | The MSS_MAC_read_phy_reg() function reads the Ethernet PHY register specified as parameter. It uses the MII management interface to communicate with the Ethernet PHY. This function is used part of the Ethernet PHY drivers provided alongside the Ethernet MAC driver. You only need to use this function if writing your own Ethernet PHY driver. |
MSS_MAC_write_phy_reg | The MSS_MAC_write_phy_reg() function writes a 16-bit value to the specified Ethernet PHY register. It uses the MII management interface to communicate with the Ethernet PHY. This function is used part of the Ethernet PHY drivers provided alongside the Ethernet MAC driver. You only need to use this function if writing your own Ethernet PHY driver. |
The following table lists the APIs available in TSEMAC firmware drivers for transmit and receive operations.
API | Description |
---|---|
MSS_MAC_send_pkt | The MSS_MAC_send_pkt() function initiates the transmission of a packet. It places the buffer containing the packet to send into one of the Ethernet MAC’s transmit descriptors. This function is non-blocking. It will return immediately without waiting for the packet to be sent. The Ethernet MAC driver indicates that the packet is sent by calling the transmit completion handler registered by a call to MSS_MAC_set_tx_callback() . |
MSS_MAC_receive_pkt | The MSS_MAC_receive_pkt() function assigns a buffer to one of the Ethernet MAC’s receive descriptors. The receive buffer specified as parameter will be used to receive one single packet. The receive buffer will be handed back to the application via a call to the receive callback function assigned through a call to MSS_MAC_set_rx_callback() . The MSS_MAC_receive_pkt() function needs to be called again pointing to the same buffer if more packets are received into this same buffer after the packet has been processed by the application.The The |
MSS_MAC_set_tx_callback | The MSS_MAC_set_tx_callback() function registers the function called by the Ethernet MAC driver when a packet has been sent. |
MSS_MAC_set_rx_callback | The MSS_MAC_set_rx_callback() function registers the function called by the Ethernet MAC driver when a packet is received. |
The following table lists the APIs available in TSEMAC firmware drivers for reading status and statistics.
API | Description |
---|---|
MSS_MAC_read_stat | The MSS_MAC_read_stat() function reads the transmit and receive statistics of the Ethernet MAC. This function can be used to read one of 17 receiver statistics, 20 transmitter statistics, and 7 frame type statistics as defined in the mss_mac_stat_t enumeration. |
MSS_MAC_clear_statistics | The MSS_MAC_clear_statistics() function clears all the statistics counter registers. |
MSS_MAC_get_link_status | The MSS_MAC_get_link_status() function retrieves the status of the link from the Ethernet PHY. It returns the current state of the Ethernet link. The speed and duplex mode of the link is also returned via the two pointers passed as parameter if the link is up.This function also adjusts the Ethernet MAC’s internal configuration if some of the link characteristics have changed since the previous call to this function. |
For more information on the API detailed description and parameters to the APIs, see MSS Ethernet MAC Driver User's Guide.