EMAC_DRV


Functions

const char * emac_get_version (void)
 Retrieves the version string.
EMAC_DRV_ERR_E emac_open (Uint32 port_num, EMAC_OPEN_CONFIG_INFO_T *p_config)
EMAC_DRV_ERR_E emac_close (Uint32 port_num)
EMAC_DRV_ERR_E emac_config (Uint32 port_num, EMAC_CONFIG_INFO_T *p_config)
EMAC_DRV_ERR_E emac_send (Uint32 port_num, EMAC_PKT_DESC_T *p_desc)
EMAC_DRV_ERR_E emac_poll (Uint32 port_num, EMAC_LINK_INFO_T *p_info)
EMAC_DRV_ERR_E emac_get_stats (Uint32 port_num, EMAC_STATISTICS_T *p_stats)
EMAC_DRV_ERR_E emac_int_service (Uint32 port_num, Bool rx_flag)

Detailed Description


Function Documentation

EMAC_DRV_ERR_E emac_close ( Uint32  port_num  ) 

============================================================================
emac_close()

Description
Closes an opend EMAC port.

The driver closes the opened port and disables the RX/TX interrupts. The driver needs to close all the TX/RX channels allocated for this port

The calling application must supply a valid port number

The function returns zero on success, or an error code on failure.

Arguments

 *      port_num         EMAC port number.
 *  

Return Value
Return code of EMAC_DRV_ERR_E type

============================================================================

EMAC_DRV_ERR_E emac_config ( Uint32  port_num,
EMAC_CONFIG_INFO_T p_config 
)

============================================================================
emac_config()

Description
Configures an opend EMAC port.

The driver configures the opened port, e.g. RX filter, etc.

For RX multicast configuration, this API is called to install a list of multicast addresses for use in multicast address filtering. The new multicast list will replace the old multicast configuration. Thus a set with a list size of zero will remove all multicast addresses from the device.

Note that the multicast list configuration is stateless in that the list of multicast addresses used to build the configuration is not retained. Thus it is impossible to examine a list of currently installed addresses.

The calling application must supply a valid port number

The function returns zero on success, or an error code on failure.

Arguments

 *      port_num         EMAC port number.
 *      p_config         pointer to configuration
 *  

Return Value
Return code of EMAC_DRV_ERR_E type

============================================================================

EMAC_DRV_ERR_E emac_get_stats ( Uint32  port_num,
EMAC_STATISTICS_T p_stats 
)

============================================================================
emac_get_stats()

Description
Retrieve the statistics on an opened EMAC port.

The calling application must supply a valid port number and the driver will return the stats to the application when called successfully .

The function returns zero on success, or an error code on failure.

Arguments

 *      port_num         EMAC port number.
 *      p_stats          Pointer to the returned stats info
 *  

Return Value
Return code of EMAC_DRV_ERR_E type

============================================================================

EMAC_DRV_ERR_E emac_int_service ( Uint32  port_num,
Bool  rx_flag 
)

============================================================================
emac_int_service()

Description
Services RX or TX interrupt for an opened EMAC port.

The calling application must supply a valid port number and RX/TX flag. The driver will service the interrupt and call back to application layer when there is a packet received.

The function returns zero on success, or an error code on failure.

Arguments

 *      port_num         EMAC port number.
 *      rx_flag          TURE: RX interrupt; FALSE: TX interrupt
 *  

Return Value
Return code of EMAC_DRV_ERR_E type

============================================================================

EMAC_DRV_ERR_E emac_open ( Uint32  port_num,
EMAC_OPEN_CONFIG_INFO_T p_config 
)

============================================================================
emac_open()

Description
Opens and configures an EMAC port.

The calling application must supply a valid port number and open configuration data. After the port is opened successfully, the application will need to set the RX filter configuration.

When a core is MASTER_CORE, the driver will do the common configurations of the port only when the port is first opened. The driver will do the channel specific configurations for all the cores.

In the open configuration, the alloc_pkt call back function will allow the application to get a packet descriptor with allocated packet buffer, the rx_pkt call back function will allow the application to enqueue received packet to the application RX queue for post processing. The free_pkt call back function will allow the application to free the packet buffer when a packet is sent successfully .

The driver passes the channels assigned to the port to the application layer when the port is opened successfully.

The function returns zero on success, or an error code on failure.

Arguments

 *      port_num         EMAC port number.
 *      p_config         Pointer to EMAC configuration data
 *  

Return Value
Return code of EMAC_DRV_ERR_E type

============================================================================

EMAC_DRV_ERR_E emac_poll ( Uint32  port_num,
EMAC_LINK_INFO_T p_info 
)

============================================================================
emac_poll()

Description
Polls the ink status infomation on an opened EMAC port.

The calling application must supply a valid port number and the driver will return the link info to the application when called successfully .

The function returns zero on success, or an error code on failure.

Arguments

 *      port_num         EMAC port number.
 *      p_info           Pointer to the returned link status info
 *  

Return Value
Return code of EMAC_DRV_ERR_E type

============================================================================

EMAC_DRV_ERR_E emac_send ( Uint32  port_num,
EMAC_PKT_DESC_T p_desc 
)

============================================================================
emac_send()

Description
Sends a packet on an opened EMAC port.

The calling application must supply a valid port number. The free_pkt call back function will allow the application to free the packet buffer when a packet is sent successfully .

The function returns zero on success, or an error code on failure.

Arguments

 *      port_num         EMAC port number.
 *      p_desc           Pointer to a TX packet descriptor
 *  

Return Value
Return code of EMAC_DRV_ERR_E type

============================================================================


Copyright 2012, Texas Instruments Incorporated