📄 csl_emi.h
字号:
Uint32 RxOctets; /* Total Received Bytes in Good Frames */
Uint32 TxGoodFrames; /* Good Frames Sent */
Uint32 TxBCastFrames; /* Good Broadcast Frames Sent */
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 */
} EMI_Statistics;
/*-----------------------------------------------------------------------*\
* Packet Filtering
*
* Packet Filtering Settings (cumulative)
\*-----------------------------------------------------------------------*/
#define EMI_RXFILTER_NOTHING 0
#define EMI_RXFILTER_DIRECT 1
#define EMI_RXFILTER_BROADCAST 2
#define EMI_RXFILTER_MULTICAST 3
#define EMI_RXFILTER_ALLMULTICAST 4
#define EMI_RXFILTER_ALL 5
/*-----------------------------------------------------------------------*\
* STANDARD ERROR CODES
\*-----------------------------------------------------------------------*/
#define EMI_ERROR_ALREADY 1 /* Operation has already been started */
#define EMI_ERROR_NOTREADY 2 /* Device is not open or not ready */
#define EMI_ERROR_DEVICE 3 /* Device hardware error */
#define EMI_ERROR_INVALID 4 /* Function or calling parameter is invalid */
#define EMI_ERROR_BADPACKET 5 /* Supplied packet was invalid */
#define EMI_ERROR_MACFATAL 6 /* Fatal Error in MAC - EMI_close() required */
/*-----------------------------------------------------------------------*\
* STANDARD API FUNCTIONS
*
* 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.
*
\*-----------------------------------------------------------------------*/
/*-----------------------------------------------------------------------*\
* EMI_enumerate()
*
* Enumerates the EMI peripherals installed in the system and returns an
* integer count. The EMI 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.
\*-----------------------------------------------------------------------*/
uint EMI_enumerate( void );
/*-----------------------------------------------------------------------*\
* EMI_open()
*
* Opens the EMI 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 EMI_open() returns. In order to change an item
* in the configuration, the the EMI 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 EMI device when making calls to the
* application callback functions.
*
* An EMI device handle is written to phEMI. This handle must be saved
* by the caller and then passed to other EMI device functions.
*
* The default receive filter prevents normal packets from being received
* until the receive filter is specified by calling EMI_receiveFilter().
*
* A device reset is achieved by calling EMI_close() followed by EMI_open().
*
* The function returns zero on success, or an error code on failure.
*
* Possible error codes include:
* EMI_ERROR_ALREADY - The device is already open
* EMI_ERROR_INVALID - A calling parameter is invalid
*
\*-----------------------------------------------------------------------*/
uint EMI_open( int physicalIndex, Handle hApplication,
EMI_Config *pEMIConfig, Handle *phEMI );
/*-----------------------------------------------------------------------*\
* EMI_close()
*
* Closed the EMI peripheral indicated by the supplied instance handle.
* When called, the EMI 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:
* EMI_ERROR_INVALID - A calling parameter is invalid
*
\*-----------------------------------------------------------------------*/
uint EMI_close( Handle hEMI );
/*-----------------------------------------------------------------------*\
* EMI_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:
* EMI_ERROR_INVALID - A calling parameter is invalid
*
\*-----------------------------------------------------------------------*/
uint EMI_getStatus( Handle hEMI, EMI_Status *pStatus );
/*-----------------------------------------------------------------------*\
* EMI_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:
* EMI_RXFILTER_NOTHING - Receive nothing
* EMI_RXFILTER_DIRECT - Receive only Unicast to local MAC addr
* EMI_RXFILTER_BROADCAST - Receive direct and Broadcast
* EMI_RXFILTER_MULTICAST - Receive above plus multicast in mcast list
* EMI_RXFILTER_ALLMULTICAST - Receive above plus all multicast
* EMI_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:
* EMI_ERROR_INVALID - A calling parameter is invalid
*
\*-----------------------------------------------------------------------*/
uint EMI_setReceiveFilter( Handle hEMI, uint ReceiveFilter );
/*-----------------------------------------------------------------------*\
* EMI_getReceiveFilter()
*
* Called to get the current packet filter setting for received packets.
* The filter values are the same as those used in EMI_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:
* EMI_ERROR_INVALID - A calling parameter is invalid
*
\*-----------------------------------------------------------------------*/
uint EMI_getReceiveFilter( Handle hEMI, uint *pReceiveFilter );
/*-----------------------------------------------------------------------*\
* EMI_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:
* EMI_ERROR_INVALID - A calling parameter is invalid
*
\*-----------------------------------------------------------------------*/
uint EMI_getStatistics( Handle hEMI, EMI_Statistics *pStatistics );
/*-----------------------------------------------------------------------*\
* EMI_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:
* EMI_ERROR_INVALID - A calling parameter is invalid
*
\*-----------------------------------------------------------------------*/
uint EMI_setMulticast( Handle hEMI, uint AddrCnt, Uint8 *pMCastList );
/*-----------------------------------------------------------------------*\
* EMI_sendPacket()
*
* Sends a Ethernet data packet out the EMI device. On a non-error return,
* the EMI 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 EMI device has not taken ownership
* of the packet.
*
* Possible error codes include:
* EMI_ERROR_INVALID - A calling parameter is invalid
* EMI_ERROR_BADPACKET - The packet structure is invalid
*
\*-----------------------------------------------------------------------*/
uint EMI_sendPacket( Handle hEMI, EMI_Pkt *pEmiPacket );
/*-----------------------------------------------------------------------*\
* EMI_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 EMI_serviceCheck() function. If
* more than one EMI device is on the same interrupt, the function must be
* called for each device.
*
* Possible error codes include:
* EMI_ERROR_INVALID - A calling parameter is invalid
* EMI_ERROR_MACFATAL - Fatal error in the MAC - Call EMI_close()
*
\*-----------------------------------------------------------------------*/
uint EMI_serviceCheck( Handle hEMI );
/*-----------------------------------------------------------------------*\
* EMI_timerTick()
*
* This function should be called for each device in the system on a
* periodic basis of 500mS. 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 500mS mark. A missed call should
* not be "made up" by making mulitple sequential calls.
*
* A POLLING DRIVER MUST ALSO ADHERE TO 500mS TIMING
*
* Possible error codes include:
* EMI_ERROR_INVALID - A calling parameter is invalid
*
\*-----------------------------------------------------------------------*/
uint EMI_timerTick( Handle hEMI );
#endif /* EMAC_SUPPORT */
#endif /* _CSL_EMI_H_ */
/******************************************************************************\
* End of emi.h
\******************************************************************************/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -