📄 csl_emac.h
字号:
Uint32 TxMCastFrames; /* Good Multicast Frames Sent */
Uint32 TxPauseFrames; /* PauseTx Frames Sent */
Uint32 TxDeferred; /* Frames Where Transmission was Deferred */
Uint32 TxCollision; /* Total Frames Sent With Collision */
Uint32 TxSingleColl; /* Frames Sent with Exactly One Collision */
Uint32 TxMultiColl; /* Frames Sent with Multiple Colisions */
Uint32 TxExcessiveColl; /* Tx Frames Lost Due to Excessive Collisions */
Uint32 TxLateColl; /* Tx Frames Lost Due to a Late Collision */
Uint32 TxUnderrun; /* Tx Frames Lost with Transmit Underrun Error */
Uint32 TxCarrierSLoss; /* Tx Frames Lost Due to Carrier Sense Loss */
Uint32 TxOctets; /* Total Transmitted Bytes in Good Frames */
Uint32 Frame64; /* Total Tx&Rx with Octet Size of 64 */
Uint32 Frame65t127; /* Total Tx&Rx with Octet Size of 65 to 127 */
Uint32 Frame128t255; /* Total Tx&Rx with Octet Size of 128 to 255 */
Uint32 Frame256t511; /* Total Tx&Rx with Octet Size of 256 to 511 */
Uint32 Frame512t1023; /* Total Tx&Rx with Octet Size of 512 to 1023 */
Uint32 Frame1024tUp; /* Total Tx&Rx with Octet Size of >=1024 */
Uint32 NetOctets; /* Sum of all Octets Tx or Rx on the Network */
Uint32 RxSOFOverruns; /* Total Rx Start of Frame Overruns */
Uint32 RxMOFOverruns; /* Total Rx Middle of Frame Overruns */
Uint32 RxDMAOverruns; /* Total Rx DMA Overruns */
} EMAC_Statistics;
/*-----------------------------------------------------------------------*\
* Packet Filtering
*
* Packet Filtering Settings (cumulative)
\*-----------------------------------------------------------------------*/
#define EMAC_RXFILTER_NOTHING 0
#define EMAC_RXFILTER_DIRECT 1
#define EMAC_RXFILTER_BROADCAST 2
#define EMAC_RXFILTER_MULTICAST 3
#define EMAC_RXFILTER_ALLMULTICAST 4
#define EMAC_RXFILTER_ALL 5
/*-----------------------------------------------------------------------*\
* STANDARD ERROR CODES
\*-----------------------------------------------------------------------*/
#define EMAC_ERROR_ALREADY 1 /* Operation has already been started */
#define EMAC_ERROR_NOTREADY 2 /* Device is not open or not ready */
#define EMAC_ERROR_DEVICE 3 /* Device hardware error */
#define EMAC_ERROR_INVALID 4 /* Function or calling parameter is invalid */
#define EMAC_ERROR_BADPACKET 5 /* Supplied packet was invalid */
#define EMAC_ERROR_MACFATAL 6 /* Fatal Error in MAC - EMAC_close() required */
/*-----------------------------------------------------------------------*\
* STANDARD API FUNCTIONS
*
* IMPORTANT NOTE
* --------------
* The application is charged with verifying that only one of the
* following API calls may only be executing at a given time across
* all threads and all interrupt functions.
*
\*-----------------------------------------------------------------------*/
/*-----------------------------------------------------------------------*\
* EMAC_enumerate()
*
* Enumerates the EMAC peripherals installed in the system and returns an
* integer count. The EMAC devices are enumerated in a consistent
* fashion so that each device can be later referenced by its physical
* index value ranging from "1" to "n" where "n" is the count returned
* by this function.
\*-----------------------------------------------------------------------*/
CSLAPI uint EMAC_enumerate( void );
/*-----------------------------------------------------------------------*\
* EMAC_open()
*
* Opens the EMAC peripheral at the given physical index and initializes
* it to an embryonic state.
*
* The calling application must supply a operating configuration that
* includes a callback function table. Data from this config structure is
* copied into the device's internal instance structure so the structure
* may be discarded after EMAC_open() returns. In order to change an item
* in the configuration, the the EMAC device must be closed and then
* re-opened with the new configuration.
*
* The application layer may pass in an hApplication callback handle,
* that will be supplied by the EMAC device when making calls to the
* application callback functions.
*
* An EMAC device handle is written to phEMAC. This handle must be saved
* by the caller and then passed to other EMAC device functions.
*
* The default receive filter prevents normal packets from being received
* until the receive filter is specified by calling EMAC_receiveFilter().
*
* A device reset is achieved by calling EMAC_close() followed by EMAC_open().
*
* The function returns zero on success, or an error code on failure.
*
* Possible error codes include:
* EMAC_ERROR_ALREADY - The device is already open
* EMAC_ERROR_INVALID - A calling parameter is invalid
*
\*-----------------------------------------------------------------------*/
CSLAPI uint EMAC_open( int physicalIndex, Handle hApplication,
EMAC_Config *pEMACConfig, Handle *phEMAC );
/*-----------------------------------------------------------------------*\
* EMAC_close()
*
* Closed the EMAC peripheral indicated by the supplied instance handle.
* When called, the EMAC device will shutdown both send and receive
* operations, and free all pending transmit and receive packets.
*
* The function returns zero on success, or an error code on failure.
*
* Possible error code include:
* EMAC_ERROR_INVALID - A calling parameter is invalid
*
\*-----------------------------------------------------------------------*/
CSLAPI uint EMAC_close( Handle hEMAC );
/*-----------------------------------------------------------------------*\
* EMAC_getStatus()
*
* Called to get the current status of the device. The device status
* is copied into the supplied data structure.
*
* The function returns zero on success, or an error code on failure.
*
* Possible error code include:
* EMAC_ERROR_INVALID - A calling parameter is invalid
*
\*-----------------------------------------------------------------------*/
CSLAPI uint EMAC_getStatus( Handle hEMAC, EMAC_Status *pStatus );
/*-----------------------------------------------------------------------*\
* EMAC_setReceiveFilter()
*
* Called to set the packet filter for received packets. The filtering
* level is inclusive, so BROADCAST would include both BROADCAST and
* DIRECTED (UNICAST) packets.
*
* Available filtering modes include the following:
* EMAC_RXFILTER_NOTHING - Receive nothing
* EMAC_RXFILTER_DIRECT - Receive only Unicast to local MAC addr
* EMAC_RXFILTER_BROADCAST - Receive direct and Broadcast
* EMAC_RXFILTER_MULTICAST - Receive above plus multicast in mcast list
* EMAC_RXFILTER_ALLMULTICAST - Receive above plus all multicast
* EMAC_RXFILTER_ALL - Receive all packets
*
* Note that if error frames and control frames are desired, reception of
* these must be specified in the device configuration.
*
* The function returns zero on success, or an error code on failure.
*
* Possible error code include:
* EMAC_ERROR_INVALID - A calling parameter is invalid
*
\*-----------------------------------------------------------------------*/
CSLAPI uint EMAC_setReceiveFilter( Handle hEMAC, uint ReceiveFilter );
/*-----------------------------------------------------------------------*\
* EMAC_getReceiveFilter()
*
* Called to get the current packet filter setting for received packets.
* The filter values are the same as those used in EMAC_setReceiveFilter().
*
* The current filter value is writter to the pointer supplied in
* pReceiveFilter.
*
* The function returns zero on success, or an error code on failure.
*
* Possible error code include:
* EMAC_ERROR_INVALID - A calling parameter is invalid
*
\*-----------------------------------------------------------------------*/
CSLAPI uint EMAC_getReceiveFilter( Handle hEMAC, uint *pReceiveFilter );
/*-----------------------------------------------------------------------*\
* EMAC_getStatistics()
*
* Called to get the current device statistics. The statistics structure
* contains a collection of event counts for various packet sent and
* receive properties. Reading the statistics also clears the current
* statistic counters, so the values read represent a delta from the last
* call.
*
* The statistics information is copied into the structure pointed to
* by the pStatistics argument.
*
* The function returns zero on success, or an error code on failure.
*
* Possible error code include:
* EMAC_ERROR_INVALID - A calling parameter is invalid
*
\*-----------------------------------------------------------------------*/
CSLAPI uint EMAC_getStatistics( Handle hEMAC, EMAC_Statistics *pStatistics );
/*-----------------------------------------------------------------------*\
* EMAC_setMulticast()
*
* This function is called to install a list of multicast addresses for
* use in multicast address filtering. Each time this function is called,
* any current multicast configuration is discarded in favor of the new
* list. 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 addresses to install are pointed to by pMCastList. The length of
* this list in bytes is 6 times the value of AddrCnt. When AddrCnt is
* zero, the pMCastList parameter can be NULL.
*
* The function returns zero on success, or an error code on failure.
* The multicast list settings are not altered in the event of a failure
* code.
*
* Possible error code include:
* EMAC_ERROR_INVALID - A calling parameter is invalid
*
\*-----------------------------------------------------------------------*/
CSLAPI uint EMAC_setMulticast( Handle hEMAC, uint AddrCnt, Uint8 *pMCastList );
/*-----------------------------------------------------------------------*\
* EMAC_sendPacket()
*
* Sends a Ethernet data packet out the EMAC device. On a non-error return,
* the EMAC device takes ownership of the packet. The packet is returned
* to the application's free pool once it has been transmitted.
*
* The function returns zero on success, or an error code on failure.
* When an error code is returned, the EMAC device has not taken ownership
* of the packet.
*
* Possible error codes include:
* EMAC_ERROR_INVALID - A calling parameter is invalid
* EMAC_ERROR_BADPACKET - The packet structure is invalid
*
\*-----------------------------------------------------------------------*/
CSLAPI uint EMAC_sendPacket( Handle hEMAC, EMAC_Pkt *pPacket );
/*-----------------------------------------------------------------------*\
* EMAC_serviceCheck()
*
* This function should be called every time there is an EMAC device
* interrupt. It maintains the status the EMAC.
*
* Note that the application has the responsibility for mapping the
* physical device index to the correct EMAC_serviceCheck() function. If
* more than one EMAC device is on the same interrupt, the function must be
* called for each device.
*
* Possible error codes include:
* EMAC_ERROR_INVALID - A calling parameter is invalid
* EMAC_ERROR_MACFATAL - Fatal error in the MAC - Call EMAC_close()
*
\*-----------------------------------------------------------------------*/
CSLAPI uint EMAC_serviceCheck( Handle hEMAC );
/*-----------------------------------------------------------------------*\
* EMAC_timerTick()
*
* This function should be called for each device in the system on a
* periodic basis of 100mS (10 times a second). It is used to check the
* status of the EMAC and MDIO device, and to potentially recover from
* low Rx buffer conditions.
*
* Strict timing is not required, but the application should make a
* reasonable attempt to adhere to the 100mS mark. A missed call should
* not be "made up" by making mulitple sequential calls.
*
* A "polling" driver (one that calls EMAC_serviceCheck() in a tight loop),
* must also adhere to the 100mS timing on this function.
*
* Possible error codes include:
* EMAC_ERROR_INVALID - A calling parameter is invalid
*
\*-----------------------------------------------------------------------*/
CSLAPI uint EMAC_timerTick( Handle hEMAC );
#endif /* EMAC_SUPPORT */
#endif /* _CSL_EMAC_H_ */
/******************************************************************************\
* End of emi.h
\******************************************************************************/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -