Path: blob/main/sys/contrib/ncsw/inc/Peripherals/fm_mac_ext.h
48375 views
/*1* Copyright 2008-2012 Freescale Semiconductor Inc.2*3* Redistribution and use in source and binary forms, with or without4* modification, are permitted provided that the following conditions are met:5* * Redistributions of source code must retain the above copyright6* notice, this list of conditions and the following disclaimer.7* * Redistributions in binary form must reproduce the above copyright8* notice, this list of conditions and the following disclaimer in the9* documentation and/or other materials provided with the distribution.10* * Neither the name of Freescale Semiconductor nor the11* names of its contributors may be used to endorse or promote products12* derived from this software without specific prior written permission.13*14*15* ALTERNATIVELY, this software may be distributed under the terms of the16* GNU General Public License ("GPL") as published by the Free Software17* Foundation, either version 2 of that License or (at your option) any18* later version.19*20* THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY21* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED22* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE23* DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY24* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES25* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;26* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND27* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT28* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS29* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.30*/313233/**************************************************************************//**34@File fm_mac_ext.h3536@Description FM MAC ...37*//***************************************************************************/38#ifndef __FM_MAC_EXT_H39#define __FM_MAC_EXT_H4041#include "std_ext.h"42#include "enet_ext.h"434445/**************************************************************************//**4647@Group FM_grp Frame Manager API4849@Description FM API functions, definitions and enums5051@{52*//***************************************************************************/5354/**************************************************************************//**55@Group FM_mac_grp FM MAC5657@Description FM MAC API functions, definitions and enums5859@{60*//***************************************************************************/6162#define FM_MAC_NO_PFC 0xff636465/**************************************************************************//**66@Description FM MAC Exceptions67*//***************************************************************************/68typedef enum e_FmMacExceptions {69e_FM_MAC_EX_10G_MDIO_SCAN_EVENTMDIO = 0 /**< 10GEC MDIO scan event interrupt */70,e_FM_MAC_EX_10G_MDIO_CMD_CMPL /**< 10GEC MDIO command completion interrupt */71,e_FM_MAC_EX_10G_REM_FAULT /**< 10GEC, mEMAC Remote fault interrupt */72,e_FM_MAC_EX_10G_LOC_FAULT /**< 10GEC, mEMAC Local fault interrupt */73,e_FM_MAC_EX_10G_1TX_ECC_ER /**< 10GEC, mEMAC Transmit frame ECC error interrupt */74,e_FM_MAC_EX_10G_TX_FIFO_UNFL /**< 10GEC, mEMAC Transmit FIFO underflow interrupt */75,e_FM_MAC_EX_10G_TX_FIFO_OVFL /**< 10GEC, mEMAC Transmit FIFO overflow interrupt */76,e_FM_MAC_EX_10G_TX_ER /**< 10GEC Transmit frame error interrupt */77,e_FM_MAC_EX_10G_RX_FIFO_OVFL /**< 10GEC, mEMAC Receive FIFO overflow interrupt */78,e_FM_MAC_EX_10G_RX_ECC_ER /**< 10GEC, mEMAC Receive frame ECC error interrupt */79,e_FM_MAC_EX_10G_RX_JAB_FRM /**< 10GEC Receive jabber frame interrupt */80,e_FM_MAC_EX_10G_RX_OVRSZ_FRM /**< 10GEC Receive oversized frame interrupt */81,e_FM_MAC_EX_10G_RX_RUNT_FRM /**< 10GEC Receive runt frame interrupt */82,e_FM_MAC_EX_10G_RX_FRAG_FRM /**< 10GEC Receive fragment frame interrupt */83,e_FM_MAC_EX_10G_RX_LEN_ER /**< 10GEC Receive payload length error interrupt */84,e_FM_MAC_EX_10G_RX_CRC_ER /**< 10GEC Receive CRC error interrupt */85,e_FM_MAC_EX_10G_RX_ALIGN_ER /**< 10GEC Receive alignment error interrupt */86,e_FM_MAC_EX_1G_BAB_RX /**< dTSEC Babbling receive error */87,e_FM_MAC_EX_1G_RX_CTL /**< dTSEC Receive control (pause frame) interrupt */88,e_FM_MAC_EX_1G_GRATEFUL_TX_STP_COMPLET /**< dTSEC Graceful transmit stop complete */89,e_FM_MAC_EX_1G_BAB_TX /**< dTSEC Babbling transmit error */90,e_FM_MAC_EX_1G_TX_CTL /**< dTSEC Transmit control (pause frame) interrupt */91,e_FM_MAC_EX_1G_TX_ERR /**< dTSEC Transmit error */92,e_FM_MAC_EX_1G_LATE_COL /**< dTSEC Late collision */93,e_FM_MAC_EX_1G_COL_RET_LMT /**< dTSEC Collision retry limit */94,e_FM_MAC_EX_1G_TX_FIFO_UNDRN /**< dTSEC Transmit FIFO underrun */95,e_FM_MAC_EX_1G_MAG_PCKT /**< dTSEC Magic Packet detection */96,e_FM_MAC_EX_1G_MII_MNG_RD_COMPLET /**< dTSEC MII management read completion */97,e_FM_MAC_EX_1G_MII_MNG_WR_COMPLET /**< dTSEC MII management write completion */98,e_FM_MAC_EX_1G_GRATEFUL_RX_STP_COMPLET /**< dTSEC Graceful receive stop complete */99,e_FM_MAC_EX_1G_TX_DATA_ERR /**< dTSEC Internal data error on transmit */100,e_FM_MAC_EX_1G_RX_DATA_ERR /**< dTSEC Internal data error on receive */101,e_FM_MAC_EX_1G_1588_TS_RX_ERR /**< dTSEC Time-Stamp Receive Error */102,e_FM_MAC_EX_1G_RX_MIB_CNT_OVFL /**< dTSEC MIB counter overflow */103,e_FM_MAC_EX_TS_FIFO_ECC_ERR /**< mEMAC Time-stamp FIFO ECC error interrupt;104not supported on T4240/B4860 rev1 chips */105,e_FM_MAC_EX_MAGIC_PACKET_INDICATION = e_FM_MAC_EX_1G_MAG_PCKT106/**< mEMAC Magic Packet Indication Interrupt */107} e_FmMacExceptions;108109/**************************************************************************//**110@Description TM MAC statistics level111*//***************************************************************************/112typedef enum e_FmMacStatisticsLevel {113e_FM_MAC_NONE_STATISTICS = 0, /**< No statistics */114e_FM_MAC_PARTIAL_STATISTICS, /**< Only error counters are available; Optimized for performance */115e_FM_MAC_FULL_STATISTICS /**< All counters available; Not optimized for performance */116} e_FmMacStatisticsLevel;117118119#if (DPAA_VERSION >= 11)120/**************************************************************************//**121@Description Priority Flow Control Parameters122*//***************************************************************************/123typedef struct t_FmMacPfcParams {124bool pfcEnable; /**< Enable/Disable PFC */125126uint16_t pauseQuanta[FM_MAX_NUM_OF_PFC_PRIORITIES]; /**< Pause Quanta per priority to be sent in a pause frame. Each quanta represents a 512 bit-times*/127128uint16_t pauseThresholdQuanta[FM_MAX_NUM_OF_PFC_PRIORITIES];/**< Pause threshold per priority, when timer passes this threshold time a PFC frames is sent again if the port is still congested or BM pool in depletion*/129130131} t_FmMacPfcParams;132#endif /* (DPAA_VERSION >= 11) */133134/**************************************************************************//**135@Function t_FmMacExceptionCallback136137@Description Fm Mac Exception Callback from FM MAC to the user138139@Param[in] h_App - Handle to the upper layer handler140141@Param[in] exceptions - The exception that occurred142143@Return void.144*//***************************************************************************/145typedef void (t_FmMacExceptionCallback)(t_Handle h_App, e_FmMacExceptions exceptions);146147148/**************************************************************************//**149@Description TM MAC statistics rfc3635150*//***************************************************************************/151typedef struct t_FmMacStatistics {152/* RMON */153uint64_t eStatPkts64; /**< r-10G tr-DT 64 byte frame counter */154uint64_t eStatPkts65to127; /**< r-10G 65 to 127 byte frame counter */155uint64_t eStatPkts128to255; /**< r-10G 128 to 255 byte frame counter */156uint64_t eStatPkts256to511; /**< r-10G 256 to 511 byte frame counter */157uint64_t eStatPkts512to1023; /**< r-10G 512 to 1023 byte frame counter */158uint64_t eStatPkts1024to1518; /**< r-10G 1024 to 1518 byte frame counter */159uint64_t eStatPkts1519to1522; /**< r-10G 1519 to 1522 byte good frame count */160/* */161uint64_t eStatFragments; /**< Total number of packets that were less than 64 octets long with a wrong CRC.*/162uint64_t eStatJabbers; /**< Total number of packets longer than valid maximum length octets */163uint64_t eStatsDropEvents; /**< number of dropped packets due to internal errors of the MAC Client (during receive). */164uint64_t eStatCRCAlignErrors; /**< Incremented when frames of correct length but with CRC error are received.*/165uint64_t eStatUndersizePkts; /**< Incremented for frames under 64 bytes with a valid FCS and otherwise well formed;166This count does not include range length errors */167uint64_t eStatOversizePkts; /**< Incremented for frames which exceed 1518 (non VLAN) or 1522 (VLAN) and contains168a valid FCS and otherwise well formed */169/* Pause */170uint64_t teStatPause; /**< Pause MAC Control received */171uint64_t reStatPause; /**< Pause MAC Control sent */172/* MIB II */173uint64_t ifInOctets; /**< Total number of byte received. */174uint64_t ifInPkts; /**< Total number of packets received.*/175uint64_t ifInUcastPkts; /**< Total number of unicast frame received;176NOTE: this counter is not supported on dTSEC MAC */177uint64_t ifInMcastPkts; /**< Total number of multicast frame received*/178uint64_t ifInBcastPkts; /**< Total number of broadcast frame received */179uint64_t ifInDiscards; /**< Frames received, but discarded due to problems within the MAC RX. */180uint64_t ifInErrors; /**< Number of frames received with error:181- FIFO Overflow Error182- CRC Error183- Frame Too Long Error184- Alignment Error185- The dedicated Error Code (0xfe, not a code error) was received */186uint64_t ifOutOctets; /**< Total number of byte sent. */187uint64_t ifOutPkts; /**< Total number of packets sent .*/188uint64_t ifOutUcastPkts; /**< Total number of unicast frame sent;189NOTE: this counter is not supported on dTSEC MAC */190uint64_t ifOutMcastPkts; /**< Total number of multicast frame sent */191uint64_t ifOutBcastPkts; /**< Total number of multicast frame sent */192uint64_t ifOutDiscards; /**< Frames received, but discarded due to problems within the MAC TX N/A!.*/193uint64_t ifOutErrors; /**< Number of frames transmitted with error:194- FIFO Overflow Error195- FIFO Underflow Error196- Other */197} t_FmMacStatistics;198199200/**************************************************************************//**201@Group FM_mac_init_grp FM MAC Initialization Unit202203@Description FM MAC Initialization Unit204205@{206*//***************************************************************************/207208/**************************************************************************//**209@Description FM MAC config input210*//***************************************************************************/211typedef struct t_FmMacParams {212uintptr_t baseAddr; /**< Base of memory mapped FM MAC registers */213t_EnetAddr addr; /**< MAC address of device; First octet is sent first */214uint8_t macId; /**< MAC ID;215numbering of dTSEC and 1G-mEMAC:2160 - FM_MAX_NUM_OF_1G_MACS;217numbering of 10G-MAC (TGEC) and 10G-mEMAC:2180 - FM_MAX_NUM_OF_10G_MACS */219e_EnetMode enetMode; /**< Ethernet operation mode (MAC-PHY interface and speed);220Note that the speed should indicate the maximum rate that221this MAC should support rather than the actual speed;222i.e. user should use the FM_MAC_AdjustLink() routine to223provide accurate speed;224In case of mEMAC RGMII mode, the MAC is configured to RGMII225automatic mode, where actual speed/duplex mode information226is provided by PHY automatically in-band; FM_MAC_AdjustLink()227function should be used to switch to manual RGMII speed/duplex mode228configuration if RGMII PHY doesn't support in-band status signaling;229In addition, in mEMAC, in case where user is using the higher MACs230(i.e. the MACs that should support 10G), user should pass here231speed=10000 even if the interface is not allowing that (e.g. SGMII). */232t_Handle h_Fm; /**< A handle to the FM object this port related to */233int mdioIrq; /**< MDIO exceptions interrupt source - not valid for all234MACs; MUST be set to 'NO_IRQ' for MACs that don't have235mdio-irq, or for polling */236t_FmMacExceptionCallback *f_Event; /**< MDIO Events Callback Routine */237t_FmMacExceptionCallback *f_Exception; /**< Exception Callback Routine */238t_Handle h_App; /**< A handle to an application layer object; This handle will239be passed by the driver upon calling the above callbacks */240} t_FmMacParams;241242243/**************************************************************************//**244@Function FM_MAC_Config245246@Description Creates descriptor for the FM MAC module.247248The routine returns a handle (descriptor) to the FM MAC object.249This descriptor must be passed as first parameter to all other250FM MAC function calls.251252No actual initialization or configuration of FM MAC hardware is253done by this routine.254255@Param[in] p_FmMacParam - Pointer to data structure of parameters256257@Retval Handle to FM MAC object, or NULL for Failure.258*//***************************************************************************/259t_Handle FM_MAC_Config(t_FmMacParams *p_FmMacParam);260261/**************************************************************************//**262@Function FM_MAC_Init263264@Description Initializes the FM MAC module265266@Param[in] h_FmMac - FM module descriptor267268@Return E_OK on success; Error code otherwise.269*//***************************************************************************/270t_Error FM_MAC_Init(t_Handle h_FmMac);271272/**************************************************************************//**273@Function FM_Free274275@Description Frees all resources that were assigned to FM MAC module.276277Calling this routine invalidates the descriptor.278279@Param[in] h_FmMac - FM module descriptor280281@Return E_OK on success; Error code otherwise.282*//***************************************************************************/283t_Error FM_MAC_Free(t_Handle h_FmMac);284285286/**************************************************************************//**287@Group FM_mac_advanced_init_grp FM MAC Advanced Configuration Unit288289@Description Configuration functions used to change default values.290291@{292*//***************************************************************************/293294/**************************************************************************//**295@Function FM_MAC_ConfigResetOnInit296297@Description Tell the driver whether to reset the FM MAC before initialization or298not. It changes the default configuration [DEFAULT_resetOnInit].299300@Param[in] h_FmMac A handle to a FM MAC Module.301@Param[in] enable When TRUE, FM will be reset before any initialization.302303@Return E_OK on success; Error code otherwise.304305@Cautions Allowed only following FM_MAC_Config() and before FM_MAC_Init().306*//***************************************************************************/307t_Error FM_MAC_ConfigResetOnInit(t_Handle h_FmMac, bool enable);308309/**************************************************************************//**310@Function FM_MAC_ConfigLoopback311312@Description Enable/Disable internal loopback mode313314@Param[in] h_FmMac A handle to a FM MAC Module.315@Param[in] enable TRUE to enable or FALSE to disable.316317@Return E_OK on success; Error code otherwise.318319@Cautions Allowed only following FM_MAC_Config() and before FM_MAC_Init().320*//***************************************************************************/321t_Error FM_MAC_ConfigLoopback(t_Handle h_FmMac, bool enable);322323/**************************************************************************//**324@Function FM_MAC_ConfigMaxFrameLength325326@Description Setup maximum Rx Frame Length (in 1G MAC, effects also Tx)327328@Param[in] h_FmMac A handle to a FM MAC Module.329@Param[in] newVal MAX Frame length330331@Return E_OK on success; Error code otherwise.332333@Cautions Allowed only following FM_MAC_Config() and before FM_MAC_Init().334*//***************************************************************************/335t_Error FM_MAC_ConfigMaxFrameLength(t_Handle h_FmMac, uint16_t newVal);336337/**************************************************************************//**338@Function FM_MAC_ConfigWan339340@Description ENABLE WAN mode in 10G-MAC341342@Param[in] h_FmMac A handle to a FM MAC Module.343@Param[in] enable TRUE to enable or FALSE to disable.344345@Return E_OK on success; Error code otherwise.346347@Cautions Allowed only following FM_MAC_Config() and before FM_MAC_Init().348*//***************************************************************************/349t_Error FM_MAC_ConfigWan(t_Handle h_FmMac, bool enable);350351/**************************************************************************//**352@Function FM_MAC_ConfigPadAndCrc353354@Description Config PAD and CRC mode355356@Param[in] h_FmMac A handle to a FM MAC Module.357@Param[in] enable TRUE to enable or FALSE to disable.358359@Return E_OK on success; Error code otherwise.360361@Cautions Allowed only following FM_MAC_Config() and before FM_MAC_Init().362Not supported on 10G-MAC (i.e. CRC & PAD are added automatically363by HW); on mEMAC, this routine supports only PAD (i.e. CRC is364added automatically by HW).365*//***************************************************************************/366t_Error FM_MAC_ConfigPadAndCrc(t_Handle h_FmMac, bool enable);367368/**************************************************************************//**369@Function FM_MAC_ConfigHalfDuplex370371@Description Config Half Duplex Mode372373@Param[in] h_FmMac A handle to a FM MAC Module.374@Param[in] enable TRUE to enable or FALSE to disable.375376@Return E_OK on success; Error code otherwise.377378@Cautions Allowed only following FM_MAC_Config() and before FM_MAC_Init().379*//***************************************************************************/380t_Error FM_MAC_ConfigHalfDuplex(t_Handle h_FmMac, bool enable);381382/**************************************************************************//**383@Function FM_MAC_ConfigTbiPhyAddr384385@Description Configures the address of internal TBI PHY.386387@Param[in] h_FmMac A handle to a FM MAC Module.388@Param[in] newVal TBI PHY address (1-31).389390@Return E_OK on success; Error code otherwise.391392@Cautions Allowed only following FM_MAC_Config() and before FM_MAC_Init().393*//***************************************************************************/394t_Error FM_MAC_ConfigTbiPhyAddr(t_Handle h_FmMac, uint8_t newVal);395396/**************************************************************************//**397@Function FM_MAC_ConfigLengthCheck398399@Description Configure the frame length checking.400401@Param[in] h_FmMac A handle to a FM MAC Module.402@Param[in] enable TRUE to enable or FALSE to disable.403404@Return E_OK on success; Error code otherwise.405406@Cautions Allowed only following FM_MAC_Config() and before FM_MAC_Init().407*//***************************************************************************/408t_Error FM_MAC_ConfigLengthCheck(t_Handle h_FmMac, bool enable);409410/**************************************************************************//**411@Function FM_MAC_ConfigException412413@Description Change Exception selection from default414415@Param[in] h_FmMac A handle to a FM MAC Module.416@Param[in] ex Type of the desired exceptions417@Param[in] enable TRUE to enable the specified exception, FALSE to disable it.418419@Return E_OK on success; Error code otherwise.420421@Cautions Allowed only following FM_MAC_Config() and before FM_MAC_Init().422*//***************************************************************************/423t_Error FM_MAC_ConfigException(t_Handle h_FmMac, e_FmMacExceptions ex, bool enable);424425#ifdef FM_TX_ECC_FRMS_ERRATA_10GMAC_A004426t_Error FM_MAC_ConfigSkipFman11Workaround (t_Handle h_FmMac);427#endif /* FM_TX_ECC_FRMS_ERRATA_10GMAC_A004 */428/** @} */ /* end of FM_mac_advanced_init_grp group */429/** @} */ /* end of FM_mac_init_grp group */430431432/**************************************************************************//**433@Group FM_mac_runtime_control_grp FM MAC Runtime Control Unit434435@Description FM MAC Runtime control unit API functions, definitions and enums.436437@{438*//***************************************************************************/439440/**************************************************************************//**441@Function FM_MAC_Enable442443@Description Enable the MAC444445@Param[in] h_FmMac A handle to a FM MAC Module.446@Param[in] mode Mode of operation (RX, TX, Both)447448@Return E_OK on success; Error code otherwise.449450@Cautions Allowed only following FM_MAC_Init().451*//***************************************************************************/452t_Error FM_MAC_Enable(t_Handle h_FmMac, e_CommMode mode);453454/**************************************************************************//**455@Function FM_MAC_Disable456457@Description DISABLE the MAC458459@Param[in] h_FmMac A handle to a FM MAC Module.460@Param[in] mode Define what part to Disable (RX, TX or BOTH)461462@Return E_OK on success; Error code otherwise.463464@Cautions Allowed only following FM_MAC_Init().465*//***************************************************************************/466t_Error FM_MAC_Disable(t_Handle h_FmMac, e_CommMode mode);467468/**************************************************************************//**469@Function FM_MAC_Resume470471@Description Re-init the MAC after suspend472473@Param[in] h_FmMac A handle to a FM MAC Module.474475@Return E_OK on success; Error code otherwise.476477@Cautions Allowed only following FM_MAC_Init().478*//***************************************************************************/479t_Error FM_MAC_Resume(t_Handle h_FmMac);480481/**************************************************************************//**482@Function FM_MAC_Enable1588TimeStamp483484@Description Enables the TSU operation.485486@Param[in] h_Fm - Handle to the PTP as returned from the FM_MAC_PtpConfig.487488@Return E_OK on success; Error code otherwise.489490@Cautions Allowed only following FM_MAC_Init().491*//***************************************************************************/492t_Error FM_MAC_Enable1588TimeStamp(t_Handle h_Fm);493494/**************************************************************************//**495@Function FM_MAC_Disable1588TimeStamp496497@Description Disables the TSU operation.498499@Param[in] h_Fm - Handle to the PTP as returned from the FM_MAC_PtpConfig.500501@Return E_OK on success; Error code otherwise.502503@Cautions Allowed only following FM_MAC_Init().504*//***************************************************************************/505t_Error FM_MAC_Disable1588TimeStamp(t_Handle h_Fm);506507/**************************************************************************//**508@Function FM_MAC_SetTxAutoPauseFrames509510@Description Enable/Disable transmission of Pause-Frames.511The routine changes the default configuration [DEFAULT_TX_PAUSE_TIME].512513@Param[in] h_FmMac - A handle to a FM MAC Module.514@Param[in] pauseTime - Pause quanta value used with transmitted pause frames.515Each quanta represents a 512 bit-times; Note that '0'516as an input here will be used as disabling the517transmission of the pause-frames.518519@Return E_OK on success; Error code otherwise.520521@Cautions Allowed only following FM_MAC_Init().522*//***************************************************************************/523t_Error FM_MAC_SetTxAutoPauseFrames(t_Handle h_FmMac,524uint16_t pauseTime);525526/**************************************************************************//**527@Function FM_MAC_SetTxPauseFrames528529@Description Enable/Disable transmission of Pause-Frames.530The routine changes the default configuration:531pause-time - [DEFAULT_TX_PAUSE_TIME]532threshold-time - [0]533534@Param[in] h_FmMac - A handle to a FM MAC Module.535@Param[in] priority - the PFC class of service; use 'FM_MAC_NO_PFC'536to indicate legacy pause support (i.e. no PFC).537@Param[in] pauseTime - Pause quanta value used with transmitted pause frames.538Each quanta represents a 512 bit-times;539Note that '0' as an input here will be used as disabling the540transmission of the pause-frames.541@Param[in] threshTime - Pause Threshold equanta value used by the MAC to retransmit pause frame.542if the situation causing a pause frame to be sent didn't finish when the timer543reached the threshold quanta, the MAC will retransmit the pause frame.544Each quanta represents a 512 bit-times.545546@Return E_OK on success; Error code otherwise.547548@Cautions Allowed only following FM_MAC_Init().549In order for PFC to work properly the user must configure550TNUM-aging in the tx-port it is recommended that pre-fetch and551rate limit in the tx port should be disabled;552PFC is supported only on new mEMAC; i.e. in MACs that don't have553PFC support (10G-MAC and dTSEC), user should use 'FM_MAC_NO_PFC'554in the 'priority' field.555*//***************************************************************************/556t_Error FM_MAC_SetTxPauseFrames(t_Handle h_FmMac,557uint8_t priority,558uint16_t pauseTime,559uint16_t threshTime);560561/**************************************************************************//**562@Function FM_MAC_SetRxIgnorePauseFrames563564@Description Enable/Disable ignoring of Pause-Frames.565566@Param[in] h_FmMac - A handle to a FM MAC Module.567@Param[in] en - boolean indicates whether to ignore the incoming pause568frames or not.569570@Return E_OK on success; Error code otherwise.571572@Cautions Allowed only following FM_MAC_Init().573*//***************************************************************************/574t_Error FM_MAC_SetRxIgnorePauseFrames(t_Handle h_FmMac, bool en);575576/**************************************************************************//**577@Function FM_MAC_SetWakeOnLan578579@Description Enable/Disable Wake On Lan support580581@Param[in] h_FmMac - A handle to a FM MAC Module.582@Param[in] en - boolean indicates whether to enable Wake On Lan583support or not.584585@Return E_OK on success; Error code otherwise.586587@Cautions Allowed only following FM_MAC_Init().588*//***************************************************************************/589t_Error FM_MAC_SetWakeOnLan(t_Handle h_FmMac, bool en);590591/**************************************************************************//**592@Function FM_MAC_ResetCounters593594@Description reset all statistics counters595596@Param[in] h_FmMac - A handle to a FM MAC Module.597598@Return E_OK on success; Error code otherwise.599600@Cautions Allowed only following FM_MAC_Init().601*//***************************************************************************/602t_Error FM_MAC_ResetCounters(t_Handle h_FmMac);603604/**************************************************************************//**605@Function FM_MAC_SetException606607@Description Enable/Disable a specific Exception608609@Param[in] h_FmMac - A handle to a FM MAC Module.610@Param[in] ex - Type of the desired exceptions611@Param[in] enable - TRUE to enable the specified exception, FALSE to disable it.612613614@Return E_OK on success; Error code otherwise.615616@Cautions Allowed only following FM_MAC_Init().617*//***************************************************************************/618t_Error FM_MAC_SetException(t_Handle h_FmMac, e_FmMacExceptions ex, bool enable);619620/**************************************************************************//**621@Function FM_MAC_SetStatistics622623@Description Define Statistics level.624Where applicable, the routine also enables the MIB counters625overflow interrupt in order to keep counters accurate626and account for overflows.627This routine is relevant only for dTSEC.628629@Param[in] h_FmMac - A handle to a FM MAC Module.630@Param[in] statisticsLevel - Full statistics level provides all standard counters but may631reduce performance. Partial statistics provides only special632event counters (errors etc.). If selected, regular counters (such as633byte/packet) will be invalid and will return -1.634635@Return E_OK on success; Error code otherwise.636637@Cautions Allowed only following FM_MAC_Init().638*//***************************************************************************/639t_Error FM_MAC_SetStatistics(t_Handle h_FmMac, e_FmMacStatisticsLevel statisticsLevel);640641/**************************************************************************//**642@Function FM_MAC_GetStatistics643644@Description get all statistics counters645646@Param[in] h_FmMac - A handle to a FM MAC Module.647@Param[in] p_Statistics - Structure with statistics648649@Return E_OK on success; Error code otherwise.650651@Cautions Allowed only following FM_Init().652*//***************************************************************************/653t_Error FM_MAC_GetStatistics(t_Handle h_FmMac, t_FmMacStatistics *p_Statistics);654655/**************************************************************************//**656@Function FM_MAC_ModifyMacAddr657658@Description Replace the main MAC Address659660@Param[in] h_FmMac - A handle to a FM Module.661@Param[in] p_EnetAddr - Ethernet Mac address662663@Return E_OK on success; Error code otherwise.664665@Cautions Allowed only after FM_MAC_Init().666*//***************************************************************************/667t_Error FM_MAC_ModifyMacAddr(t_Handle h_FmMac, t_EnetAddr *p_EnetAddr);668669/**************************************************************************//**670@Function FM_MAC_AddHashMacAddr671672@Description Add an Address to the hash table. This is for filter purpose only.673674@Param[in] h_FmMac - A handle to a FM Module.675@Param[in] p_EnetAddr - Ethernet Mac address676677@Return E_OK on success; Error code otherwise.678679@Cautions Allowed only following FM_MAC_Init(). It is a filter only address.680@Cautions Some address need to be filterd out in upper FM blocks.681*//***************************************************************************/682t_Error FM_MAC_AddHashMacAddr(t_Handle h_FmMac, t_EnetAddr *p_EnetAddr);683684/**************************************************************************//**685@Function FM_MAC_RemoveHashMacAddr686687@Description Delete an Address to the hash table. This is for filter purpose only.688689@Param[in] h_FmMac - A handle to a FM Module.690@Param[in] p_EnetAddr - Ethernet Mac address691692@Return E_OK on success; Error code otherwise.693694@Cautions Allowed only following FM_MAC_Init().695*//***************************************************************************/696t_Error FM_MAC_RemoveHashMacAddr(t_Handle h_FmMac, t_EnetAddr *p_EnetAddr);697698/**************************************************************************//**699@Function FM_MAC_AddExactMatchMacAddr700701@Description Add a unicast or multicast mac address for exact-match filtering702(8 on dTSEC, 2 for 10G-MAC)703704@Param[in] h_FmMac - A handle to a FM Module.705@Param[in] p_EnetAddr - MAC Address to ADD706707@Return E_OK on success; Error code otherwise.708709@Cautions Allowed only after FM_MAC_Init().710*//***************************************************************************/711t_Error FM_MAC_AddExactMatchMacAddr(t_Handle h_FmMac, t_EnetAddr *p_EnetAddr);712713/**************************************************************************//**714@Function FM_MAC_RemovelExactMatchMacAddr715716@Description Remove a uni cast or multi cast mac address.717718@Param[in] h_FmMac - A handle to a FM Module.719@Param[in] p_EnetAddr - MAC Address to remove720721@Return E_OK on success; Error code otherwise..722723@Cautions Allowed only after FM_MAC_Init().724*//***************************************************************************/725t_Error FM_MAC_RemovelExactMatchMacAddr(t_Handle h_FmMac, t_EnetAddr *p_EnetAddr);726727/**************************************************************************//**728@Function FM_MAC_SetPromiscuous729730@Description Enable/Disable MAC Promiscuous mode for ALL mac addresses.731732@Param[in] h_FmMac - A handle to a FM MAC Module.733@Param[in] enable - TRUE to enable or FALSE to disable.734735@Return E_OK on success; Error code otherwise.736737@Cautions Allowed only after FM_MAC_Init().738*//***************************************************************************/739t_Error FM_MAC_SetPromiscuous(t_Handle h_FmMac, bool enable);740741/**************************************************************************//**742@Function FM_MAC_AdjustLink743744@Description Adjusts the Ethernet link with new speed/duplex setup.745This routine is relevant for dTSEC and mEMAC.746In case of mEMAC, this routine is also used for manual747re-configuration of RGMII speed and duplex mode for748RGMII PHYs not supporting in-band status information749to MAC.750751@Param[in] h_FmMac - A handle to a FM Module.752@Param[in] speed - Ethernet speed.753@Param[in] fullDuplex - TRUE for full-duplex mode;754FALSE for half-duplex mode.755756@Return E_OK on success; Error code otherwise.757*//***************************************************************************/758t_Error FM_MAC_AdjustLink(t_Handle h_FmMac, e_EnetSpeed speed, bool fullDuplex);759760/**************************************************************************//**761@Function FM_MAC_RestartAutoneg762763@Description Restarts the auto-negotiation process.764When auto-negotiation process is invoked under traffic the765auto-negotiation process between the internal SGMII PHY and the766external PHY does not always complete successfully. Calling this767function will restart the auto-negotiation process that will end768successfully. It is recommended to call this function after issuing769auto-negotiation restart command to the Eth Phy.770This routine is relevant only for dTSEC.771772@Param[in] h_FmMac - A handle to a FM Module.773774@Return E_OK on success; Error code otherwise.775*//***************************************************************************/776t_Error FM_MAC_RestartAutoneg(t_Handle h_FmMac);777778/**************************************************************************//**779@Function FM_MAC_GetId780781@Description Return the MAC ID782783@Param[in] h_FmMac - A handle to a FM Module.784@Param[out] p_MacId - MAC ID of device785786@Return E_OK on success; Error code otherwise.787788@Cautions Allowed only after FM_MAC_Init().789*//***************************************************************************/790t_Error FM_MAC_GetId(t_Handle h_FmMac, uint32_t *p_MacId);791792/**************************************************************************//**793@Function FM_MAC_GetVesrion794795@Description Return Mac HW chip version796797@Param[in] h_FmMac - A handle to a FM Module.798@Param[out] p_MacVresion - Mac version as defined by the chip799800@Return E_OK on success; Error code otherwise.801802@Cautions Allowed only after FM_MAC_Init().803*//***************************************************************************/804t_Error FM_MAC_GetVesrion(t_Handle h_FmMac, uint32_t *p_MacVresion);805806/**************************************************************************//**807@Function FM_MAC_MII_WritePhyReg808809@Description Write data into Phy Register810811@Param[in] h_FmMac - A handle to a FM Module.812@Param[in] phyAddr - Phy Address on the MII bus813@Param[in] reg - Register Number.814@Param[in] data - Data to write.815816@Return E_OK on success; Error code otherwise.817818@Cautions Allowed only after FM_MAC_Init().819*//***************************************************************************/820t_Error FM_MAC_MII_WritePhyReg(t_Handle h_FmMac, uint8_t phyAddr, uint8_t reg, uint16_t data);821822/**************************************************************************//**823@Function FM_MAC_MII_ReadPhyReg824825@Description Read data from Phy Register826827@Param[in] h_FmMac - A handle to a FM Module.828@Param[in] phyAddr - Phy Address on the MII bus829@Param[in] reg - Register Number.830@Param[out] p_Data - Data from PHY.831832@Return E_OK on success; Error code otherwise.833834@Cautions Allowed only after FM_MAC_Init().835*//***************************************************************************/836t_Error FM_MAC_MII_ReadPhyReg(t_Handle h_FmMac, uint8_t phyAddr, uint8_t reg, uint16_t *p_Data);837838#if (defined(DEBUG_ERRORS) && (DEBUG_ERRORS > 0))839/**************************************************************************//**840@Function FM_MAC_DumpRegs841842@Description Dump internal registers843844@Param[in] h_FmMac - A handle to a FM Module.845846@Return E_OK on success; Error code otherwise.847848@Cautions Allowed only after FM_MAC_Init().849*//***************************************************************************/850t_Error FM_MAC_DumpRegs(t_Handle h_FmMac);851#endif /* (defined(DEBUG_ERRORS) && ... */852853/** @} */ /* end of FM_mac_runtime_control_grp group */854/** @} */ /* end of FM_mac_grp group */855/** @} */ /* end of FM_grp group */856857858#endif /* __FM_MAC_EXT_H */859860861