2 * Copyright 2008-2012 Freescale Semiconductor Inc.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met:
6 * * Redistributions of source code must retain the above copyright
7 * notice, this list of conditions and the following disclaimer.
8 * * Redistributions in binary form must reproduce the above copyright
9 * notice, this list of conditions and the following disclaimer in the
10 * documentation and/or other materials provided with the distribution.
11 * * Neither the name of Freescale Semiconductor nor the
12 * names of its contributors may be used to endorse or promote products
13 * derived from this software without specific prior written permission.
16 * ALTERNATIVELY, this software may be distributed under the terms of the
17 * GNU General Public License ("GPL") as published by the Free Software
18 * Foundation, either version 2 of that License or (at your option) any
21 * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
22 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
23 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24 * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
25 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
28 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 /**************************************************************************//**
37 @Description FM MAC ...
38 *//***************************************************************************/
39 #ifndef __FM_MAC_EXT_H
40 #define __FM_MAC_EXT_H
46 /**************************************************************************//**
48 @Group FM_grp Frame Manager API
50 @Description FM API functions, definitions and enums
53 *//***************************************************************************/
55 /**************************************************************************//**
56 @Group FM_mac_grp FM MAC
58 @Description FM MAC API functions, definitions and enums
61 *//***************************************************************************/
63 #define FM_MAC_NO_PFC 0xff
66 /**************************************************************************//**
67 @Description FM MAC Exceptions
68 *//***************************************************************************/
69 typedef enum e_FmMacExceptions {
70 e_FM_MAC_EX_10G_MDIO_SCAN_EVENTMDIO = 0 /**< 10GEC MDIO scan event interrupt */
71 ,e_FM_MAC_EX_10G_MDIO_CMD_CMPL /**< 10GEC MDIO command completion interrupt */
72 ,e_FM_MAC_EX_10G_REM_FAULT /**< 10GEC, mEMAC Remote fault interrupt */
73 ,e_FM_MAC_EX_10G_LOC_FAULT /**< 10GEC, mEMAC Local fault interrupt */
74 ,e_FM_MAC_EX_10G_1TX_ECC_ER /**< 10GEC, mEMAC Transmit frame ECC error interrupt */
75 ,e_FM_MAC_EX_10G_TX_FIFO_UNFL /**< 10GEC, mEMAC Transmit FIFO underflow interrupt */
76 ,e_FM_MAC_EX_10G_TX_FIFO_OVFL /**< 10GEC, mEMAC Transmit FIFO overflow interrupt */
77 ,e_FM_MAC_EX_10G_TX_ER /**< 10GEC Transmit frame error interrupt */
78 ,e_FM_MAC_EX_10G_RX_FIFO_OVFL /**< 10GEC, mEMAC Receive FIFO overflow interrupt */
79 ,e_FM_MAC_EX_10G_RX_ECC_ER /**< 10GEC, mEMAC Receive frame ECC error interrupt */
80 ,e_FM_MAC_EX_10G_RX_JAB_FRM /**< 10GEC Receive jabber frame interrupt */
81 ,e_FM_MAC_EX_10G_RX_OVRSZ_FRM /**< 10GEC Receive oversized frame interrupt */
82 ,e_FM_MAC_EX_10G_RX_RUNT_FRM /**< 10GEC Receive runt frame interrupt */
83 ,e_FM_MAC_EX_10G_RX_FRAG_FRM /**< 10GEC Receive fragment frame interrupt */
84 ,e_FM_MAC_EX_10G_RX_LEN_ER /**< 10GEC Receive payload length error interrupt */
85 ,e_FM_MAC_EX_10G_RX_CRC_ER /**< 10GEC Receive CRC error interrupt */
86 ,e_FM_MAC_EX_10G_RX_ALIGN_ER /**< 10GEC Receive alignment error interrupt */
87 ,e_FM_MAC_EX_1G_BAB_RX /**< dTSEC Babbling receive error */
88 ,e_FM_MAC_EX_1G_RX_CTL /**< dTSEC Receive control (pause frame) interrupt */
89 ,e_FM_MAC_EX_1G_GRATEFUL_TX_STP_COMPLET /**< dTSEC Graceful transmit stop complete */
90 ,e_FM_MAC_EX_1G_BAB_TX /**< dTSEC Babbling transmit error */
91 ,e_FM_MAC_EX_1G_TX_CTL /**< dTSEC Transmit control (pause frame) interrupt */
92 ,e_FM_MAC_EX_1G_TX_ERR /**< dTSEC Transmit error */
93 ,e_FM_MAC_EX_1G_LATE_COL /**< dTSEC Late collision */
94 ,e_FM_MAC_EX_1G_COL_RET_LMT /**< dTSEC Collision retry limit */
95 ,e_FM_MAC_EX_1G_TX_FIFO_UNDRN /**< dTSEC Transmit FIFO underrun */
96 ,e_FM_MAC_EX_1G_MAG_PCKT /**< dTSEC Magic Packet detection */
97 ,e_FM_MAC_EX_1G_MII_MNG_RD_COMPLET /**< dTSEC MII management read completion */
98 ,e_FM_MAC_EX_1G_MII_MNG_WR_COMPLET /**< dTSEC MII management write completion */
99 ,e_FM_MAC_EX_1G_GRATEFUL_RX_STP_COMPLET /**< dTSEC Graceful receive stop complete */
100 ,e_FM_MAC_EX_1G_TX_DATA_ERR /**< dTSEC Internal data error on transmit */
101 ,e_FM_MAC_EX_1G_RX_DATA_ERR /**< dTSEC Internal data error on receive */
102 ,e_FM_MAC_EX_1G_1588_TS_RX_ERR /**< dTSEC Time-Stamp Receive Error */
103 ,e_FM_MAC_EX_1G_RX_MIB_CNT_OVFL /**< dTSEC MIB counter overflow */
104 ,e_FM_MAC_EX_TS_FIFO_ECC_ERR /**< mEMAC Time-stamp FIFO ECC error interrupt;
105 not supported on T4240/B4860 rev1 chips */
106 ,e_FM_MAC_EX_MAGIC_PACKET_INDICATION = e_FM_MAC_EX_1G_MAG_PCKT
107 /**< mEMAC Magic Packet Indication Interrupt */
110 /**************************************************************************//**
111 @Description TM MAC statistics level
112 *//***************************************************************************/
113 typedef enum e_FmMacStatisticsLevel {
114 e_FM_MAC_NONE_STATISTICS = 0, /**< No statistics */
115 e_FM_MAC_PARTIAL_STATISTICS, /**< Only error counters are available; Optimized for performance */
116 e_FM_MAC_FULL_STATISTICS /**< All counters available; Not optimized for performance */
117 } e_FmMacStatisticsLevel;
120 #if (DPAA_VERSION >= 11)
121 /**************************************************************************//**
122 @Description Priority Flow Control Parameters
123 *//***************************************************************************/
124 typedef struct t_FmMacPfcParams {
125 bool pfcEnable; /**< Enable/Disable PFC */
127 uint16_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*/
129 uint16_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*/
133 #endif /* (DPAA_VERSION >= 11) */
135 /**************************************************************************//**
136 @Function t_FmMacExceptionCallback
138 @Description Fm Mac Exception Callback from FM MAC to the user
140 @Param[in] h_App - Handle to the upper layer handler
142 @Param[in] exceptions - The exception that occurred
145 *//***************************************************************************/
146 typedef void (t_FmMacExceptionCallback)(t_Handle h_App, e_FmMacExceptions exceptions);
149 /**************************************************************************//**
150 @Description TM MAC statistics rfc3635
151 *//***************************************************************************/
152 typedef struct t_FmMacStatistics {
154 uint64_t eStatPkts64; /**< r-10G tr-DT 64 byte frame counter */
155 uint64_t eStatPkts65to127; /**< r-10G 65 to 127 byte frame counter */
156 uint64_t eStatPkts128to255; /**< r-10G 128 to 255 byte frame counter */
157 uint64_t eStatPkts256to511; /**< r-10G 256 to 511 byte frame counter */
158 uint64_t eStatPkts512to1023; /**< r-10G 512 to 1023 byte frame counter */
159 uint64_t eStatPkts1024to1518; /**< r-10G 1024 to 1518 byte frame counter */
160 uint64_t eStatPkts1519to1522; /**< r-10G 1519 to 1522 byte good frame count */
162 uint64_t eStatFragments; /**< Total number of packets that were less than 64 octets long with a wrong CRC.*/
163 uint64_t eStatJabbers; /**< Total number of packets longer than valid maximum length octets */
164 uint64_t eStatsDropEvents; /**< number of dropped packets due to internal errors of the MAC Client (during receive). */
165 uint64_t eStatCRCAlignErrors; /**< Incremented when frames of correct length but with CRC error are received.*/
166 uint64_t eStatUndersizePkts; /**< Incremented for frames under 64 bytes with a valid FCS and otherwise well formed;
167 This count does not include range length errors */
168 uint64_t eStatOversizePkts; /**< Incremented for frames which exceed 1518 (non VLAN) or 1522 (VLAN) and contains
169 a valid FCS and otherwise well formed */
171 uint64_t teStatPause; /**< Pause MAC Control received */
172 uint64_t reStatPause; /**< Pause MAC Control sent */
174 uint64_t ifInOctets; /**< Total number of byte received. */
175 uint64_t ifInPkts; /**< Total number of packets received.*/
176 uint64_t ifInUcastPkts; /**< Total number of unicast frame received;
177 NOTE: this counter is not supported on dTSEC MAC */
178 uint64_t ifInMcastPkts; /**< Total number of multicast frame received*/
179 uint64_t ifInBcastPkts; /**< Total number of broadcast frame received */
180 uint64_t ifInDiscards; /**< Frames received, but discarded due to problems within the MAC RX. */
181 uint64_t ifInErrors; /**< Number of frames received with error:
182 - FIFO Overflow Error
184 - Frame Too Long Error
186 - The dedicated Error Code (0xfe, not a code error) was received */
187 uint64_t ifOutOctets; /**< Total number of byte sent. */
188 uint64_t ifOutPkts; /**< Total number of packets sent .*/
189 uint64_t ifOutUcastPkts; /**< Total number of unicast frame sent;
190 NOTE: this counter is not supported on dTSEC MAC */
191 uint64_t ifOutMcastPkts; /**< Total number of multicast frame sent */
192 uint64_t ifOutBcastPkts; /**< Total number of multicast frame sent */
193 uint64_t ifOutDiscards; /**< Frames received, but discarded due to problems within the MAC TX N/A!.*/
194 uint64_t ifOutErrors; /**< Number of frames transmitted with error:
195 - FIFO Overflow Error
196 - FIFO Underflow Error
201 /**************************************************************************//**
202 @Group FM_mac_init_grp FM MAC Initialization Unit
204 @Description FM MAC Initialization Unit
207 *//***************************************************************************/
209 /**************************************************************************//**
210 @Description FM MAC config input
211 *//***************************************************************************/
212 typedef struct t_FmMacParams {
213 uintptr_t baseAddr; /**< Base of memory mapped FM MAC registers */
214 t_EnetAddr addr; /**< MAC address of device; First octet is sent first */
215 uint8_t macId; /**< MAC ID;
216 numbering of dTSEC and 1G-mEMAC:
217 0 - FM_MAX_NUM_OF_1G_MACS;
218 numbering of 10G-MAC (TGEC) and 10G-mEMAC:
219 0 - FM_MAX_NUM_OF_10G_MACS */
220 e_EnetMode enetMode; /**< Ethernet operation mode (MAC-PHY interface and speed);
221 Note that the speed should indicate the maximum rate that
222 this MAC should support rather than the actual speed;
223 i.e. user should use the FM_MAC_AdjustLink() routine to
224 provide accurate speed;
225 In case of mEMAC RGMII mode, the MAC is configured to RGMII
226 automatic mode, where actual speed/duplex mode information
227 is provided by PHY automatically in-band; FM_MAC_AdjustLink()
228 function should be used to switch to manual RGMII speed/duplex mode
229 configuration if RGMII PHY doesn't support in-band status signaling;
230 In addition, in mEMAC, in case where user is using the higher MACs
231 (i.e. the MACs that should support 10G), user should pass here
232 speed=10000 even if the interface is not allowing that (e.g. SGMII). */
233 t_Handle h_Fm; /**< A handle to the FM object this port related to */
234 int mdioIrq; /**< MDIO exceptions interrupt source - not valid for all
235 MACs; MUST be set to 'NO_IRQ' for MACs that don't have
236 mdio-irq, or for polling */
237 t_FmMacExceptionCallback *f_Event; /**< MDIO Events Callback Routine */
238 t_FmMacExceptionCallback *f_Exception; /**< Exception Callback Routine */
239 t_Handle h_App; /**< A handle to an application layer object; This handle will
240 be passed by the driver upon calling the above callbacks */
244 /**************************************************************************//**
245 @Function FM_MAC_Config
247 @Description Creates descriptor for the FM MAC module.
249 The routine returns a handle (descriptor) to the FM MAC object.
250 This descriptor must be passed as first parameter to all other
251 FM MAC function calls.
253 No actual initialization or configuration of FM MAC hardware is
254 done by this routine.
256 @Param[in] p_FmMacParam - Pointer to data structure of parameters
258 @Retval Handle to FM MAC object, or NULL for Failure.
259 *//***************************************************************************/
260 t_Handle FM_MAC_Config(t_FmMacParams *p_FmMacParam);
262 /**************************************************************************//**
263 @Function FM_MAC_Init
265 @Description Initializes the FM MAC module
267 @Param[in] h_FmMac - FM module descriptor
269 @Return E_OK on success; Error code otherwise.
270 *//***************************************************************************/
271 t_Error FM_MAC_Init(t_Handle h_FmMac);
273 /**************************************************************************//**
276 @Description Frees all resources that were assigned to FM MAC module.
278 Calling this routine invalidates the descriptor.
280 @Param[in] h_FmMac - FM module descriptor
282 @Return E_OK on success; Error code otherwise.
283 *//***************************************************************************/
284 t_Error FM_MAC_Free(t_Handle h_FmMac);
287 /**************************************************************************//**
288 @Group FM_mac_advanced_init_grp FM MAC Advanced Configuration Unit
290 @Description Configuration functions used to change default values.
293 *//***************************************************************************/
295 /**************************************************************************//**
296 @Function FM_MAC_ConfigResetOnInit
298 @Description Tell the driver whether to reset the FM MAC before initialization or
299 not. It changes the default configuration [DEFAULT_resetOnInit].
301 @Param[in] h_FmMac A handle to a FM MAC Module.
302 @Param[in] enable When TRUE, FM will be reset before any initialization.
304 @Return E_OK on success; Error code otherwise.
306 @Cautions Allowed only following FM_MAC_Config() and before FM_MAC_Init().
307 *//***************************************************************************/
308 t_Error FM_MAC_ConfigResetOnInit(t_Handle h_FmMac, bool enable);
310 /**************************************************************************//**
311 @Function FM_MAC_ConfigLoopback
313 @Description Enable/Disable internal loopback mode
315 @Param[in] h_FmMac A handle to a FM MAC Module.
316 @Param[in] enable TRUE to enable or FALSE to disable.
318 @Return E_OK on success; Error code otherwise.
320 @Cautions Allowed only following FM_MAC_Config() and before FM_MAC_Init().
321 *//***************************************************************************/
322 t_Error FM_MAC_ConfigLoopback(t_Handle h_FmMac, bool enable);
324 /**************************************************************************//**
325 @Function FM_MAC_ConfigMaxFrameLength
327 @Description Setup maximum Rx Frame Length (in 1G MAC, effects also Tx)
329 @Param[in] h_FmMac A handle to a FM MAC Module.
330 @Param[in] newVal MAX Frame length
332 @Return E_OK on success; Error code otherwise.
334 @Cautions Allowed only following FM_MAC_Config() and before FM_MAC_Init().
335 *//***************************************************************************/
336 t_Error FM_MAC_ConfigMaxFrameLength(t_Handle h_FmMac, uint16_t newVal);
338 /**************************************************************************//**
339 @Function FM_MAC_ConfigWan
341 @Description ENABLE WAN mode in 10G-MAC
343 @Param[in] h_FmMac A handle to a FM MAC Module.
344 @Param[in] enable TRUE to enable or FALSE to disable.
346 @Return E_OK on success; Error code otherwise.
348 @Cautions Allowed only following FM_MAC_Config() and before FM_MAC_Init().
349 *//***************************************************************************/
350 t_Error FM_MAC_ConfigWan(t_Handle h_FmMac, bool enable);
352 /**************************************************************************//**
353 @Function FM_MAC_ConfigPadAndCrc
355 @Description Config PAD and CRC mode
357 @Param[in] h_FmMac A handle to a FM MAC Module.
358 @Param[in] enable TRUE to enable or FALSE to disable.
360 @Return E_OK on success; Error code otherwise.
362 @Cautions Allowed only following FM_MAC_Config() and before FM_MAC_Init().
363 Not supported on 10G-MAC (i.e. CRC & PAD are added automatically
364 by HW); on mEMAC, this routine supports only PAD (i.e. CRC is
365 added automatically by HW).
366 *//***************************************************************************/
367 t_Error FM_MAC_ConfigPadAndCrc(t_Handle h_FmMac, bool enable);
369 /**************************************************************************//**
370 @Function FM_MAC_ConfigHalfDuplex
372 @Description Config Half Duplex Mode
374 @Param[in] h_FmMac A handle to a FM MAC Module.
375 @Param[in] enable TRUE to enable or FALSE to disable.
377 @Return E_OK on success; Error code otherwise.
379 @Cautions Allowed only following FM_MAC_Config() and before FM_MAC_Init().
380 *//***************************************************************************/
381 t_Error FM_MAC_ConfigHalfDuplex(t_Handle h_FmMac, bool enable);
383 /**************************************************************************//**
384 @Function FM_MAC_ConfigTbiPhyAddr
386 @Description Configures the address of internal TBI PHY.
388 @Param[in] h_FmMac A handle to a FM MAC Module.
389 @Param[in] newVal TBI PHY address (1-31).
391 @Return E_OK on success; Error code otherwise.
393 @Cautions Allowed only following FM_MAC_Config() and before FM_MAC_Init().
394 *//***************************************************************************/
395 t_Error FM_MAC_ConfigTbiPhyAddr(t_Handle h_FmMac, uint8_t newVal);
397 /**************************************************************************//**
398 @Function FM_MAC_ConfigLengthCheck
400 @Description Configure the frame length checking.
402 @Param[in] h_FmMac A handle to a FM MAC Module.
403 @Param[in] enable TRUE to enable or FALSE to disable.
405 @Return E_OK on success; Error code otherwise.
407 @Cautions Allowed only following FM_MAC_Config() and before FM_MAC_Init().
408 *//***************************************************************************/
409 t_Error FM_MAC_ConfigLengthCheck(t_Handle h_FmMac, bool enable);
411 /**************************************************************************//**
412 @Function FM_MAC_ConfigException
414 @Description Change Exception selection from default
416 @Param[in] h_FmMac A handle to a FM MAC Module.
417 @Param[in] ex Type of the desired exceptions
418 @Param[in] enable TRUE to enable the specified exception, FALSE to disable it.
420 @Return E_OK on success; Error code otherwise.
422 @Cautions Allowed only following FM_MAC_Config() and before FM_MAC_Init().
423 *//***************************************************************************/
424 t_Error FM_MAC_ConfigException(t_Handle h_FmMac, e_FmMacExceptions ex, bool enable);
426 #ifdef FM_TX_ECC_FRMS_ERRATA_10GMAC_A004
427 t_Error FM_MAC_ConfigSkipFman11Workaround (t_Handle h_FmMac);
428 #endif /* FM_TX_ECC_FRMS_ERRATA_10GMAC_A004 */
429 /** @} */ /* end of FM_mac_advanced_init_grp group */
430 /** @} */ /* end of FM_mac_init_grp group */
433 /**************************************************************************//**
434 @Group FM_mac_runtime_control_grp FM MAC Runtime Control Unit
436 @Description FM MAC Runtime control unit API functions, definitions and enums.
439 *//***************************************************************************/
441 /**************************************************************************//**
442 @Function FM_MAC_Enable
444 @Description Enable the MAC
446 @Param[in] h_FmMac A handle to a FM MAC Module.
447 @Param[in] mode Mode of operation (RX, TX, Both)
449 @Return E_OK on success; Error code otherwise.
451 @Cautions Allowed only following FM_MAC_Init().
452 *//***************************************************************************/
453 t_Error FM_MAC_Enable(t_Handle h_FmMac, e_CommMode mode);
455 /**************************************************************************//**
456 @Function FM_MAC_Disable
458 @Description DISABLE the MAC
460 @Param[in] h_FmMac A handle to a FM MAC Module.
461 @Param[in] mode Define what part to Disable (RX, TX or BOTH)
463 @Return E_OK on success; Error code otherwise.
465 @Cautions Allowed only following FM_MAC_Init().
466 *//***************************************************************************/
467 t_Error FM_MAC_Disable(t_Handle h_FmMac, e_CommMode mode);
469 /**************************************************************************//**
470 @Function FM_MAC_Resume
472 @Description Re-init the MAC after suspend
474 @Param[in] h_FmMac A handle to a FM MAC Module.
476 @Return E_OK on success; Error code otherwise.
478 @Cautions Allowed only following FM_MAC_Init().
479 *//***************************************************************************/
480 t_Error FM_MAC_Resume(t_Handle h_FmMac);
482 /**************************************************************************//**
483 @Function FM_MAC_Enable1588TimeStamp
485 @Description Enables the TSU operation.
487 @Param[in] h_Fm - Handle to the PTP as returned from the FM_MAC_PtpConfig.
489 @Return E_OK on success; Error code otherwise.
491 @Cautions Allowed only following FM_MAC_Init().
492 *//***************************************************************************/
493 t_Error FM_MAC_Enable1588TimeStamp(t_Handle h_Fm);
495 /**************************************************************************//**
496 @Function FM_MAC_Disable1588TimeStamp
498 @Description Disables the TSU operation.
500 @Param[in] h_Fm - Handle to the PTP as returned from the FM_MAC_PtpConfig.
502 @Return E_OK on success; Error code otherwise.
504 @Cautions Allowed only following FM_MAC_Init().
505 *//***************************************************************************/
506 t_Error FM_MAC_Disable1588TimeStamp(t_Handle h_Fm);
508 /**************************************************************************//**
509 @Function FM_MAC_SetTxAutoPauseFrames
511 @Description Enable/Disable transmission of Pause-Frames.
512 The routine changes the default configuration [DEFAULT_TX_PAUSE_TIME].
514 @Param[in] h_FmMac - A handle to a FM MAC Module.
515 @Param[in] pauseTime - Pause quanta value used with transmitted pause frames.
516 Each quanta represents a 512 bit-times; Note that '0'
517 as an input here will be used as disabling the
518 transmission of the pause-frames.
520 @Return E_OK on success; Error code otherwise.
522 @Cautions Allowed only following FM_MAC_Init().
523 *//***************************************************************************/
524 t_Error FM_MAC_SetTxAutoPauseFrames(t_Handle h_FmMac,
527 /**************************************************************************//**
528 @Function FM_MAC_SetTxPauseFrames
530 @Description Enable/Disable transmission of Pause-Frames.
531 The routine changes the default configuration:
532 pause-time - [DEFAULT_TX_PAUSE_TIME]
535 @Param[in] h_FmMac - A handle to a FM MAC Module.
536 @Param[in] priority - the PFC class of service; use 'FM_MAC_NO_PFC'
537 to indicate legacy pause support (i.e. no PFC).
538 @Param[in] pauseTime - Pause quanta value used with transmitted pause frames.
539 Each quanta represents a 512 bit-times;
540 Note that '0' as an input here will be used as disabling the
541 transmission of the pause-frames.
542 @Param[in] threshTime - Pause Threshold equanta value used by the MAC to retransmit pause frame.
543 if the situation causing a pause frame to be sent didn't finish when the timer
544 reached the threshold quanta, the MAC will retransmit the pause frame.
545 Each quanta represents a 512 bit-times.
547 @Return E_OK on success; Error code otherwise.
549 @Cautions Allowed only following FM_MAC_Init().
550 In order for PFC to work properly the user must configure
551 TNUM-aging in the tx-port it is recommended that pre-fetch and
552 rate limit in the tx port should be disabled;
553 PFC is supported only on new mEMAC; i.e. in MACs that don't have
554 PFC support (10G-MAC and dTSEC), user should use 'FM_MAC_NO_PFC'
555 in the 'priority' field.
556 *//***************************************************************************/
557 t_Error FM_MAC_SetTxPauseFrames(t_Handle h_FmMac,
560 uint16_t threshTime);
562 /**************************************************************************//**
563 @Function FM_MAC_SetRxIgnorePauseFrames
565 @Description Enable/Disable ignoring of Pause-Frames.
567 @Param[in] h_FmMac - A handle to a FM MAC Module.
568 @Param[in] en - boolean indicates whether to ignore the incoming pause
571 @Return E_OK on success; Error code otherwise.
573 @Cautions Allowed only following FM_MAC_Init().
574 *//***************************************************************************/
575 t_Error FM_MAC_SetRxIgnorePauseFrames(t_Handle h_FmMac, bool en);
577 /**************************************************************************//**
578 @Function FM_MAC_SetWakeOnLan
580 @Description Enable/Disable Wake On Lan support
582 @Param[in] h_FmMac - A handle to a FM MAC Module.
583 @Param[in] en - boolean indicates whether to enable Wake On Lan
586 @Return E_OK on success; Error code otherwise.
588 @Cautions Allowed only following FM_MAC_Init().
589 *//***************************************************************************/
590 t_Error FM_MAC_SetWakeOnLan(t_Handle h_FmMac, bool en);
592 /**************************************************************************//**
593 @Function FM_MAC_ResetCounters
595 @Description reset all statistics counters
597 @Param[in] h_FmMac - A handle to a FM MAC Module.
599 @Return E_OK on success; Error code otherwise.
601 @Cautions Allowed only following FM_MAC_Init().
602 *//***************************************************************************/
603 t_Error FM_MAC_ResetCounters(t_Handle h_FmMac);
605 /**************************************************************************//**
606 @Function FM_MAC_SetException
608 @Description Enable/Disable a specific Exception
610 @Param[in] h_FmMac - A handle to a FM MAC Module.
611 @Param[in] ex - Type of the desired exceptions
612 @Param[in] enable - TRUE to enable the specified exception, FALSE to disable it.
615 @Return E_OK on success; Error code otherwise.
617 @Cautions Allowed only following FM_MAC_Init().
618 *//***************************************************************************/
619 t_Error FM_MAC_SetException(t_Handle h_FmMac, e_FmMacExceptions ex, bool enable);
621 /**************************************************************************//**
622 @Function FM_MAC_SetStatistics
624 @Description Define Statistics level.
625 Where applicable, the routine also enables the MIB counters
626 overflow interrupt in order to keep counters accurate
627 and account for overflows.
628 This routine is relevant only for dTSEC.
630 @Param[in] h_FmMac - A handle to a FM MAC Module.
631 @Param[in] statisticsLevel - Full statistics level provides all standard counters but may
632 reduce performance. Partial statistics provides only special
633 event counters (errors etc.). If selected, regular counters (such as
634 byte/packet) will be invalid and will return -1.
636 @Return E_OK on success; Error code otherwise.
638 @Cautions Allowed only following FM_MAC_Init().
639 *//***************************************************************************/
640 t_Error FM_MAC_SetStatistics(t_Handle h_FmMac, e_FmMacStatisticsLevel statisticsLevel);
642 /**************************************************************************//**
643 @Function FM_MAC_GetStatistics
645 @Description get all statistics counters
647 @Param[in] h_FmMac - A handle to a FM MAC Module.
648 @Param[in] p_Statistics - Structure with statistics
650 @Return E_OK on success; Error code otherwise.
652 @Cautions Allowed only following FM_Init().
653 *//***************************************************************************/
654 t_Error FM_MAC_GetStatistics(t_Handle h_FmMac, t_FmMacStatistics *p_Statistics);
656 /**************************************************************************//**
657 @Function FM_MAC_ModifyMacAddr
659 @Description Replace the main MAC Address
661 @Param[in] h_FmMac - A handle to a FM Module.
662 @Param[in] p_EnetAddr - Ethernet Mac address
664 @Return E_OK on success; Error code otherwise.
666 @Cautions Allowed only after FM_MAC_Init().
667 *//***************************************************************************/
668 t_Error FM_MAC_ModifyMacAddr(t_Handle h_FmMac, t_EnetAddr *p_EnetAddr);
670 /**************************************************************************//**
671 @Function FM_MAC_AddHashMacAddr
673 @Description Add an Address to the hash table. This is for filter purpose only.
675 @Param[in] h_FmMac - A handle to a FM Module.
676 @Param[in] p_EnetAddr - Ethernet Mac address
678 @Return E_OK on success; Error code otherwise.
680 @Cautions Allowed only following FM_MAC_Init(). It is a filter only address.
681 @Cautions Some address need to be filterd out in upper FM blocks.
682 *//***************************************************************************/
683 t_Error FM_MAC_AddHashMacAddr(t_Handle h_FmMac, t_EnetAddr *p_EnetAddr);
685 /**************************************************************************//**
686 @Function FM_MAC_RemoveHashMacAddr
688 @Description Delete an Address to the hash table. This is for filter purpose only.
690 @Param[in] h_FmMac - A handle to a FM Module.
691 @Param[in] p_EnetAddr - Ethernet Mac address
693 @Return E_OK on success; Error code otherwise.
695 @Cautions Allowed only following FM_MAC_Init().
696 *//***************************************************************************/
697 t_Error FM_MAC_RemoveHashMacAddr(t_Handle h_FmMac, t_EnetAddr *p_EnetAddr);
699 /**************************************************************************//**
700 @Function FM_MAC_AddExactMatchMacAddr
702 @Description Add a unicast or multicast mac address for exact-match filtering
703 (8 on dTSEC, 2 for 10G-MAC)
705 @Param[in] h_FmMac - A handle to a FM Module.
706 @Param[in] p_EnetAddr - MAC Address to ADD
708 @Return E_OK on success; Error code otherwise.
710 @Cautions Allowed only after FM_MAC_Init().
711 *//***************************************************************************/
712 t_Error FM_MAC_AddExactMatchMacAddr(t_Handle h_FmMac, t_EnetAddr *p_EnetAddr);
714 /**************************************************************************//**
715 @Function FM_MAC_RemovelExactMatchMacAddr
717 @Description Remove a uni cast or multi cast mac address.
719 @Param[in] h_FmMac - A handle to a FM Module.
720 @Param[in] p_EnetAddr - MAC Address to remove
722 @Return E_OK on success; Error code otherwise..
724 @Cautions Allowed only after FM_MAC_Init().
725 *//***************************************************************************/
726 t_Error FM_MAC_RemovelExactMatchMacAddr(t_Handle h_FmMac, t_EnetAddr *p_EnetAddr);
728 /**************************************************************************//**
729 @Function FM_MAC_SetPromiscuous
731 @Description Enable/Disable MAC Promiscuous mode for ALL mac addresses.
733 @Param[in] h_FmMac - A handle to a FM MAC Module.
734 @Param[in] enable - TRUE to enable or FALSE to disable.
736 @Return E_OK on success; Error code otherwise.
738 @Cautions Allowed only after FM_MAC_Init().
739 *//***************************************************************************/
740 t_Error FM_MAC_SetPromiscuous(t_Handle h_FmMac, bool enable);
742 /**************************************************************************//**
743 @Function FM_MAC_AdjustLink
745 @Description Adjusts the Ethernet link with new speed/duplex setup.
746 This routine is relevant for dTSEC and mEMAC.
747 In case of mEMAC, this routine is also used for manual
748 re-configuration of RGMII speed and duplex mode for
749 RGMII PHYs not supporting in-band status information
752 @Param[in] h_FmMac - A handle to a FM Module.
753 @Param[in] speed - Ethernet speed.
754 @Param[in] fullDuplex - TRUE for full-duplex mode;
755 FALSE for half-duplex mode.
757 @Return E_OK on success; Error code otherwise.
758 *//***************************************************************************/
759 t_Error FM_MAC_AdjustLink(t_Handle h_FmMac, e_EnetSpeed speed, bool fullDuplex);
761 /**************************************************************************//**
762 @Function FM_MAC_RestartAutoneg
764 @Description Restarts the auto-negotiation process.
765 When auto-negotiation process is invoked under traffic the
766 auto-negotiation process between the internal SGMII PHY and the
767 external PHY does not always complete successfully. Calling this
768 function will restart the auto-negotiation process that will end
769 successfully. It is recommended to call this function after issuing
770 auto-negotiation restart command to the Eth Phy.
771 This routine is relevant only for dTSEC.
773 @Param[in] h_FmMac - A handle to a FM Module.
775 @Return E_OK on success; Error code otherwise.
776 *//***************************************************************************/
777 t_Error FM_MAC_RestartAutoneg(t_Handle h_FmMac);
779 /**************************************************************************//**
780 @Function FM_MAC_GetId
782 @Description Return the MAC ID
784 @Param[in] h_FmMac - A handle to a FM Module.
785 @Param[out] p_MacId - MAC ID of device
787 @Return E_OK on success; Error code otherwise.
789 @Cautions Allowed only after FM_MAC_Init().
790 *//***************************************************************************/
791 t_Error FM_MAC_GetId(t_Handle h_FmMac, uint32_t *p_MacId);
793 /**************************************************************************//**
794 @Function FM_MAC_GetVesrion
796 @Description Return Mac HW chip version
798 @Param[in] h_FmMac - A handle to a FM Module.
799 @Param[out] p_MacVresion - Mac version as defined by the chip
801 @Return E_OK on success; Error code otherwise.
803 @Cautions Allowed only after FM_MAC_Init().
804 *//***************************************************************************/
805 t_Error FM_MAC_GetVesrion(t_Handle h_FmMac, uint32_t *p_MacVresion);
807 /**************************************************************************//**
808 @Function FM_MAC_MII_WritePhyReg
810 @Description Write data into Phy Register
812 @Param[in] h_FmMac - A handle to a FM Module.
813 @Param[in] phyAddr - Phy Address on the MII bus
814 @Param[in] reg - Register Number.
815 @Param[in] data - Data to write.
817 @Return E_OK on success; Error code otherwise.
819 @Cautions Allowed only after FM_MAC_Init().
820 *//***************************************************************************/
821 t_Error FM_MAC_MII_WritePhyReg(t_Handle h_FmMac, uint8_t phyAddr, uint8_t reg, uint16_t data);
823 /**************************************************************************//**
824 @Function FM_MAC_MII_ReadPhyReg
826 @Description Read data from Phy Register
828 @Param[in] h_FmMac - A handle to a FM Module.
829 @Param[in] phyAddr - Phy Address on the MII bus
830 @Param[in] reg - Register Number.
831 @Param[out] p_Data - Data from PHY.
833 @Return E_OK on success; Error code otherwise.
835 @Cautions Allowed only after FM_MAC_Init().
836 *//***************************************************************************/
837 t_Error FM_MAC_MII_ReadPhyReg(t_Handle h_FmMac, uint8_t phyAddr, uint8_t reg, uint16_t *p_Data);
839 #if (defined(DEBUG_ERRORS) && (DEBUG_ERRORS > 0))
840 /**************************************************************************//**
841 @Function FM_MAC_DumpRegs
843 @Description Dump internal registers
845 @Param[in] h_FmMac - A handle to a FM Module.
847 @Return E_OK on success; Error code otherwise.
849 @Cautions Allowed only after FM_MAC_Init().
850 *//***************************************************************************/
851 t_Error FM_MAC_DumpRegs(t_Handle h_FmMac);
852 #endif /* (defined(DEBUG_ERRORS) && ... */
854 /** @} */ /* end of FM_mac_runtime_control_grp group */
855 /** @} */ /* end of FM_mac_grp group */
856 /** @} */ /* end of FM_grp group */
859 #endif /* __FM_MAC_EXT_H */