xref: /freebsd/sys/contrib/ncsw/inc/Peripherals/fm_mac_ext.h (revision 86c9d9918f1db7cdd968b60f8902466887bcd9e9)
1 /* Copyright (c) 2008-2011 Freescale Semiconductor, Inc.
2  * All rights reserved.
3  *
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.
14  *
15  *
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
19  * later version.
20  *
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.
31  */
32 
33 /**************************************************************************//**
34  @File          fm_mac_ext.h
35 
36  @Description   FM MAC ...
37 *//***************************************************************************/
38 #ifndef __FM_MAC_EXT_H
39 #define __FM_MAC_EXT_H
40 
41 #include "std_ext.h"
42 #include "enet_ext.h"
43 
44 
45 /**************************************************************************//**
46 
47  @Group         FM_grp Frame Manager API
48 
49  @Description   FM API functions, definitions and enums
50 
51  @{
52 *//***************************************************************************/
53 
54 /**************************************************************************//**
55  @Group         FM_mac_grp FM MAC
56 
57  @Description   FM MAC API functions, definitions and enums
58 
59  @{
60 *//***************************************************************************/
61 
62 
63 /**************************************************************************//**
64  @Description   FM MAC Exceptions
65 *//***************************************************************************/
66 typedef enum e_FmMacExceptions {
67     e_FM_MAC_EX_10G_MDIO_SCAN_EVENTMDIO = 0
68    ,e_FM_MAC_EX_10G_MDIO_CMD_CMPL
69    ,e_FM_MAC_EX_10G_REM_FAULT
70    ,e_FM_MAC_EX_10G_LOC_FAULT
71    ,e_FM_MAC_EX_10G_1TX_ECC_ER
72    ,e_FM_MAC_EX_10G_TX_FIFO_UNFL
73    ,e_FM_MAC_EX_10G_TX_FIFO_OVFL
74    ,e_FM_MAC_EX_10G_TX_ER
75    ,e_FM_MAC_EX_10G_RX_FIFO_OVFL
76    ,e_FM_MAC_EX_10G_RX_ECC_ER
77    ,e_FM_MAC_EX_10G_RX_JAB_FRM
78    ,e_FM_MAC_EX_10G_RX_OVRSZ_FRM
79    ,e_FM_MAC_EX_10G_RX_RUNT_FRM
80    ,e_FM_MAC_EX_10G_RX_FRAG_FRM
81    ,e_FM_MAC_EX_10G_RX_LEN_ER
82    ,e_FM_MAC_EX_10G_RX_CRC_ER
83    ,e_FM_MAC_EX_10G_RX_ALIGN_ER
84    ,e_FM_MAC_EX_1G_BAB_RX
85    ,e_FM_MAC_EX_1G_RX_CTL
86    ,e_FM_MAC_EX_1G_GRATEFUL_TX_STP_COMPLET
87    ,e_FM_MAC_EX_1G_BAB_TX
88    ,e_FM_MAC_EX_1G_TX_CTL
89    ,e_FM_MAC_EX_1G_TX_ERR
90    ,e_FM_MAC_EX_1G_LATE_COL
91    ,e_FM_MAC_EX_1G_COL_RET_LMT
92    ,e_FM_MAC_EX_1G_TX_FIFO_UNDRN
93    ,e_FM_MAC_EX_1G_MAG_PCKT
94    ,e_FM_MAC_EX_1G_MII_MNG_RD_COMPLET
95    ,e_FM_MAC_EX_1G_MII_MNG_WR_COMPLET
96    ,e_FM_MAC_EX_1G_GRATEFUL_RX_STP_COMPLET
97    ,e_FM_MAC_EX_1G_TX_DATA_ERR
98    ,e_FM_MAC_EX_1G_RX_DATA_ERR
99    ,e_FM_MAC_EX_1G_1588_TS_RX_ERR
100    ,e_FM_MAC_EX_1G_RX_MIB_CNT_OVFL
101 } e_FmMacExceptions;
102 
103 /**************************************************************************//**
104  @Description   TM MAC statistics level
105 *//***************************************************************************/
106 typedef enum e_FmMacStatisticsLevel {
107     e_FM_MAC_NONE_STATISTICS = 0,       /**< No statistics */
108     e_FM_MAC_PARTIAL_STATISTICS,        /**< Only error counters are available. Optimized for performance */
109     e_FM_MAC_FULL_STATISTICS            /**< All counters available. Not optimized for performance */
110 } e_FmMacStatisticsLevel;
111 
112 
113 /**************************************************************************//**
114  @Function      t_FmMacExceptionCallback
115 
116  @Description   Fm Mac Exception Callback from FM MAC to the user
117 
118  @Param[in]     h_App             - Handle to the upper layer handler
119 
120  @Param[in]     exceptions        - The exception that occurred
121 
122 
123  @Return        void.
124 *//***************************************************************************/
125 typedef void (t_FmMacExceptionCallback)(t_Handle h_App, e_FmMacExceptions exceptions);
126 
127 
128 /**************************************************************************//**
129  @Description   TM MAC statistics rfc3635
130 *//***************************************************************************/
131 typedef struct t_FmMacStatistics {
132 /* RMON */
133     uint64_t  eStatPkts64;             /**< r-10G tr-DT 64 byte frame counter */
134     uint64_t  eStatPkts65to127;        /**< r-10G 65 to 127 byte frame counter */
135     uint64_t  eStatPkts128to255;       /**< r-10G 128 to 255 byte frame counter */
136     uint64_t  eStatPkts256to511;       /**< r-10G 256 to 511 byte frame counter */
137     uint64_t  eStatPkts512to1023;      /**< r-10G 512 to 1023 byte frame counter */
138     uint64_t  eStatPkts1024to1518;     /**< r-10G 1024 to 1518 byte frame counter */
139     uint64_t  eStatPkts1519to1522;     /**< r-10G 1519 to 1522 byte good frame count */
140 /* */
141     uint64_t  eStatFragments;          /**< Total number of packets that were less than 64 octets long with a wrong CRC.*/
142     uint64_t  eStatJabbers;            /**< Total number of packets longer than valid maximum length octets */
143     uint64_t  eStatsDropEvents;        /**< number of dropped packets due to internal errors of the MAC Client. */
144     uint64_t  eStatCRCAlignErrors;     /**< Incremented when frames of correct length but with CRC error are received.*/
145     uint64_t  eStatUndersizePkts;      /**< Total number of packets that were less than 64 octets long with a good CRC.*/
146     uint64_t  eStatOversizePkts;       /**< T,B.D*/
147 /* Pause */
148     uint64_t  teStatPause;             /**< Pause MAC Control received */
149     uint64_t  reStatPause;             /**< Pause MAC Control sent */
150 
151 /* MIB II */
152     uint64_t  ifInOctets;              /**< Total number of byte received. */
153     uint64_t  ifInPkts;                /**< Total number of packets received.*/
154     uint64_t  ifInMcastPkts;           /**< Total number of multicast frame received*/
155     uint64_t  ifInBcastPkts;           /**< Total number of broadcast frame received */
156     uint64_t  ifInDiscards;            /**< Frames received, but discarded due to problems within the MAC RX. */
157     uint64_t  ifInErrors;              /**< Number of frames received with error:
158                                                - FIFO Overflow Error
159                                                - CRC Error
160                                                - Frame Too Long Error
161                                                - Alignment Error
162                                                - The dedicated Error Code (0xfe, not a code error) was received */
163     uint64_t  ifOutOctets;             /**< Total number of byte sent. */
164     uint64_t  ifOutPkts;               /**< Total number of packets sent .*/
165     uint64_t  ifOutMcastPkts;          /**< Total number of multicast frame sent */
166     uint64_t  ifOutBcastPkts;          /**< Total number of multicast frame sent */
167     uint64_t  ifOutDiscards;           /**< Frames received, but discarded due to problems within the MAC TX N/A!.*/
168     uint64_t  ifOutErrors;             /**< Number of frames transmitted with error:
169                                                - FIFO Overflow Error
170                                                - FIFO Underflow Error
171                                                - Other */
172 } t_FmMacStatistics;
173 
174 
175 /**************************************************************************//**
176  @Group         FM_mac_init_grp Initialization Unit
177 
178  @Description   FM MAC Initialization Unit
179 
180  @{
181 *//***************************************************************************/
182 
183 /**************************************************************************//**
184  @Description   FM MAC config input
185 *//***************************************************************************/
186 typedef struct t_FmMacParams {
187     uintptr_t                   baseAddr;           /**< Base of memory mapped FM MAC registers */
188     t_EnetAddr                  addr;               /**< MAC address of device; First octet is sent first */
189     uint8_t                     macId;              /**< MAC ID <dTSEC 0-3> <10G 0>         */
190     e_EnetMode                  enetMode;           /**< Ethernet operation mode (MAC-PHY interface and speed) */
191     t_Handle                    h_Fm;               /**< A handle to the FM object this port related to */
192     int                         mdioIrq;            /**< MDIO exceptions interrupt source - not valid for all
193                                                          MACs; MUST be set to 'NO_IRQ' for MACs that don't have
194                                                          mdio-irq, or for polling */
195     t_FmMacExceptionCallback    *f_Event;           /**< MDIO Events Callback Routine         */
196     t_FmMacExceptionCallback    *f_Exception;       /**< Exception Callback Routine         */
197     t_Handle                    h_App;              /**< A handle to an application layer object; This handle will
198                                                          be passed by the driver upon calling the above callbacks */
199 } t_FmMacParams;
200 
201 
202 /**************************************************************************//**
203  @Function      FM_MAC_Config
204 
205  @Description   Creates descriptor for the FM MAC module.
206 
207                 The routine returns a handle (descriptor) to the FM MAC object.
208                 This descriptor must be passed as first parameter to all other
209                 FM MAC function calls.
210 
211                 No actual initialization or configuration of FM MAC hardware is
212                 done by this routine.
213 
214  @Param[in]     p_FmMacParam   - Pointer to data structure of parameters
215 
216  @Retval        Handle to FM MAC object, or NULL for Failure.
217 *//***************************************************************************/
218 t_Handle FM_MAC_Config (t_FmMacParams *p_FmMacParam);
219 
220 /**************************************************************************//**
221  @Function      FM_MAC_Init
222 
223  @Description   Initializes the FM MAC module
224 
225  @Param[in]     h_FmMac - FM module descriptor
226 
227  @Return        E_OK on success; Error code otherwise.
228 *//***************************************************************************/
229 t_Error  FM_MAC_Init (t_Handle h_FmMac);
230 
231 /**************************************************************************//**
232  @Function      FM_Free
233 
234  @Description   Frees all resources that were assigned to FM MAC module.
235 
236                 Calling this routine invalidates the descriptor.
237 
238  @Param[in]     h_FmMac - FM module descriptor
239 
240  @Return        E_OK on success; Error code otherwise.
241 *//***************************************************************************/
242 t_Error  FM_MAC_Free (t_Handle h_FmMac);
243 
244 
245 /**************************************************************************//**
246  @Group         FM_mac_advanced_init_grp    Advanced Configuration Unit
247 
248  @Description   Configuration functions used to change default values.
249 
250  @{
251 *//***************************************************************************/
252 
253 /**************************************************************************//**
254  @Function      FM_MAC_ConfigResetOnInit
255 
256  @Description   Tell the driver whether to reset the FM MAC before initialization or
257                 not. It changes the default configuration [FALSE].
258 
259  @Param[in]     h_FmMac    A handle to a FM MAC Module.
260  @Param[in]     enable     When TRUE, FM will be reset before any initialization.
261 
262  @Return        E_OK on success; Error code otherwise.
263 
264  @Cautions      Allowed only following FM_MAC_Config() and before FM_MAC_Init().
265 *//***************************************************************************/
266 t_Error FM_MAC_ConfigResetOnInit (t_Handle h_FmMac, bool enable);
267 
268 /**************************************************************************//**
269  @Function      FM_MAC_ConfigLoopback
270 
271  @Description   Enable/Disable internal loopback mode
272 
273  @Param[in]     h_FmMac    A handle to a FM MAC Module.
274  @Param[in]     enable     TRUE to enable or FALSE to disable.
275 
276  @Return        E_OK on success; Error code otherwise.
277 
278  @Cautions      Allowed only following FM_MAC_Config() and before FM_MAC_Init().
279 *//***************************************************************************/
280 t_Error FM_MAC_ConfigLoopback (t_Handle h_FmMac, bool enable);
281 
282 /**************************************************************************//**
283  @Function      FM_MAC_ConfigMaxFrameLength
284 
285  @Description   Setup maximum Frame Length
286 
287  @Param[in]     h_FmMac    A handle to a FM MAC Module.
288  @Param[in]     newVal     MAX Frame length
289 
290  @Return        E_OK on success; Error code otherwise.
291 
292  @Cautions      Allowed only following FM_MAC_Config() and before FM_MAC_Init().
293 *//***************************************************************************/
294 t_Error FM_MAC_ConfigMaxFrameLength (t_Handle h_FmMac, uint16_t newVal);
295 
296 /**************************************************************************//**
297  @Function      FM_MAC_ConfigWan
298 
299  @Description   ENABLE WAN mode in 10G MAC
300 
301  @Param[in]     h_FmMac    A handle to a FM MAC Module.
302  @Param[in]     enable     TRUE to enable or FALSE to disable.
303 
304  @Return        E_OK on success; Error code otherwise.
305 
306  @Cautions      Allowed only following FM_MAC_Config() and before FM_MAC_Init().
307 *//***************************************************************************/
308 t_Error FM_MAC_ConfigWan (t_Handle h_FmMac, bool enable);
309 
310 /**************************************************************************//**
311  @Function      FM_MAC_ConfigPadAndCrc
312 
313  @Description   Config PAD and CRC mode
314 
315  @Param[in]     h_FmMac    A handle to a FM MAC Module.
316  @Param[in]     enable     TRUE to enable or FALSE to disable.
317 
318  @Return        E_OK on success; Error code otherwise.
319 
320  @Cautions      Allowed only following FM_MAC_Config() and before FM_MAC_Init().
321 *//***************************************************************************/
322 t_Error FM_MAC_ConfigPadAndCrc (t_Handle h_FmMac, bool enable);
323 
324 /**************************************************************************//**
325  @Function      FM_MAC_ConfigHalfDuplex
326 
327  @Description   Config Half Duplex Mode
328 
329  @Param[in]     h_FmMac    A handle to a FM MAC Module.
330  @Param[in]     enable     TRUE to enable or FALSE to disable.
331 
332  @Return        E_OK on success; Error code otherwise.
333 
334  @Cautions      Allowed only following FM_MAC_Config() and before FM_MAC_Init().
335 *//***************************************************************************/
336 t_Error FM_MAC_ConfigHalfDuplex (t_Handle h_FmMac, bool enable);
337 
338 /**************************************************************************//**
339  @Function      FM_MAC_ConfigLengthCheck
340 
341  @Description   Configure thef frame length checking.
342 
343  @Param[in]     h_FmMac    A handle to a FM MAC Module.
344  @Param[in]     enable     TRUE to enable or FALSE to disable.
345 
346  @Return        E_OK on success; Error code otherwise.
347 
348  @Cautions      Allowed only following FM_MAC_Config() and before FM_MAC_Init().
349 *//***************************************************************************/
350 t_Error FM_MAC_ConfigLengthCheck (t_Handle h_FmMac, bool enable);
351 
352 /**************************************************************************//**
353  @Function      FM_MAC_ConfigException
354 
355  @Description   Change Exception selection from default
356 
357  @Param[in]     h_FmMac         A handle to a FM MAC Module.
358  @Param[in]     ex              Type of the desired exceptions
359  @Param[in]     enable          TRUE to enable the specified exception, FALSE to disable it.
360 
361 
362  @Return        E_OK on success; Error code otherwise.
363 
364  @Cautions      Allowed only following FM_MAC_Config() and before FM_MAC_Init().
365 *//***************************************************************************/
366 t_Error FM_MAC_ConfigException(t_Handle h_FmMac, e_FmMacExceptions ex, bool enable);
367 
368 #ifdef FM_TX_ECC_FRMS_ERRATA_10GMAC_A004
369 t_Error FM_MAC_ConfigSkipFman11Workaround (t_Handle h_FmMac);
370 #endif /* FM_TX_ECC_FRMS_ERRATA_10GMAC_A004 */
371 /** @} */ /* end of FM_mac_advanced_init_grp group */
372 /** @} */ /* end of FM_mac_init_grp group */
373 
374 
375 /**************************************************************************//**
376  @Group         FM_mac_runtime_control_grp Runtime Control Unit
377 
378  @Description   FM MAC Runtime control unit API functions, definitions and enums.
379 
380  @{
381 *//***************************************************************************/
382 
383 /**************************************************************************//**
384  @Function      FM_MAC_Enable
385 
386  @Description   Enable the MAC
387 
388  @Param[in]     h_FmMac    A handle to a FM MAC Module.
389  @Param[in]     mode       Mode of operation (RX, TX, Both)
390 
391  @Return        E_OK on success; Error code otherwise.
392 
393  @Cautions      Allowed only following FM_MAC_Init().
394 *//***************************************************************************/
395 t_Error FM_MAC_Enable  (t_Handle h_FmMac,  e_CommMode mode);
396 
397 /**************************************************************************//**
398  @Function      FM_MAC_Disable
399 
400  @Description   DISABLE the MAC
401 
402  @Param[in]     h_FmMac    A handle to a FM MAC Module.
403  @Param[in]     mode       Define what part to Disable (RX,  TX or BOTH)
404 
405  @Return        E_OK on success; Error code otherwise.
406 
407  @Cautions      Allowed only following FM_MAC_Init().
408 *//***************************************************************************/
409 t_Error FM_MAC_Disable (t_Handle h_FmMac, e_CommMode mode);
410 
411 /**************************************************************************//**
412  @Function      FM_MAC_Enable1588TimeStamp
413 
414  @Description   Enables the TSU operation.
415 
416  @Param[in]     h_Fm   - Handle to the PTP as returned from the FM_MAC_PtpConfig.
417 
418  @Return        E_OK on success; Error code otherwise.
419 
420  @Cautions      Allowed only following FM_MAC_Init().
421 *//***************************************************************************/
422 t_Error FM_MAC_Enable1588TimeStamp(t_Handle h_Fm);
423 
424 /**************************************************************************//**
425  @Function      FM_MAC_Disable1588TimeStamp
426 
427  @Description   Disables the TSU operation.
428 
429  @Param[in]     h_Fm   - Handle to the PTP as returned from the FM_MAC_PtpConfig.
430 
431  @Return        E_OK on success; Error code otherwise.
432 
433  @Cautions      Allowed only following FM_MAC_Init().
434 *//***************************************************************************/
435 t_Error FM_MAC_Disable1588TimeStamp(t_Handle h_Fm);
436 
437 /**************************************************************************//**
438  @Function      FM_MAC_SetTxAutoPauseFrames
439 
440  @Description   Enable/Disable transmition of Pause-Frames.
441 
442  @Param[in]     h_FmMac     A handle to a FM MAC Module.
443  @Param[in]     pauseTime   Pause quanta value used with transmitted pause frames.
444                             Each quanta represents a 512 bit-times; Note that '0'
445                             as an input here will be used as disabling the
446                             transmission of the pause-frames.
447 
448  @Return        E_OK on success; Error code otherwise.
449 
450  @Cautions      Allowed only following FM_MAC_Init().
451 *//***************************************************************************/
452 t_Error FM_MAC_SetTxAutoPauseFrames (t_Handle h_FmMac, uint16_t pauseTime);
453 
454 /**************************************************************************//**
455  @Function      FM_MAC_SetRxIgnorePauseFrames
456 
457  @Description   Enable/Disable ignoring of Pause-Frames.
458 
459  @Param[in]     h_FmMac     A handle to a FM MAC Module.
460  @Param[in]     en          boolean indicates whether to ignore the incoming pause
461                             frames or not.
462 
463  @Return        E_OK on success; Error code otherwise.
464 
465  @Cautions      Allowed only following FM_MAC_Init().
466 *//***************************************************************************/
467 t_Error FM_MAC_SetRxIgnorePauseFrames (t_Handle h_FmMac, bool en);
468 
469 /**************************************************************************//**
470  @Function      FM_MAC_ResetCounters
471 
472  @Description   reset all statistics counters
473 
474  @Param[in]     h_FmMac     A handle to a FM MAC Module.
475 
476  @Return        E_OK on success; Error code otherwise.
477 
478  @Cautions      Allowed only following FM_MAC_Init().
479 *//***************************************************************************/
480 t_Error FM_MAC_ResetCounters (t_Handle h_FmMac);
481 
482 /**************************************************************************//**
483  @Function      FM_MAC_SetException
484 
485  @Description   Enable/Disable a specific Exception
486 
487  @Param[in]     h_FmMac         A handle to a FM MAC Module.
488  @Param[in]     ex              Type of the desired exceptions
489  @Param[in]     enable          TRUE to enable the specified exception, FALSE to disable it.
490 
491 
492  @Return        E_OK on success; Error code otherwise.
493 
494  @Cautions      Allowed only following FM_MAC_Init().
495 *//***************************************************************************/
496 t_Error FM_MAC_SetException(t_Handle h_FmMac, e_FmMacExceptions ex, bool enable);
497 
498 /**************************************************************************//**
499  @Function      FM_MAC_SetStatistics
500 
501  @Description   Define Statistics level.
502                                 Where applicable, the routine also enables the MIB counters
503                                 overflow interrupt in order to keep counters accurate
504                                 and account for overflows.
505 
506  @Param[in]     h_FmMac         A handle to a FM MAC Module.
507  @Param[in]     statisticsLevel Full statistics level provides all standard counters but may
508                                 reduce performance. Partial statistics provides only special
509                                 event counters (errors etc.). If selected, regular counters (such as
510                                 byte/packet) will be invalid and will return -1.
511 
512  @Return        E_OK on success; Error code otherwise.
513 
514  @Cautions      Allowed only following FM_MAC_Init().
515 *//***************************************************************************/
516 t_Error FM_MAC_SetStatistics (t_Handle h_FmMac, e_FmMacStatisticsLevel statisticsLevel);
517 
518 /**************************************************************************//**
519  @Function      FM_MAC_GetStatistics
520 
521  @Description   get all statistics counters
522 
523  @Param[in]     h_FmMac         A handle to a FM MAC Module.
524  @Param[in]     p_Statistics    Staructure with statistics
525 
526  @Return        E_OK on success; Error code otherwise.
527 
528  @Cautions      Allowed only following FM_Init().
529 *//***************************************************************************/
530 t_Error FM_MAC_GetStatistics (t_Handle h_FmMac, t_FmMacStatistics *p_Statistics);
531 
532 /**************************************************************************//**
533  @Function      FM_MAC_ModifyMacAddr
534 
535  @Description   Replace the main MAC Address
536 
537  @Param[in]     h_FmMac     -   A handle to a FM Module.
538  @Param[in]     p_EnetAddr  -   Ethernet Mac address
539 
540  @Return        E_OK on success; Error code otherwise.
541 
542  @Cautions      Allowed only after FM_MAC_Init().
543 *//***************************************************************************/
544 t_Error FM_MAC_ModifyMacAddr (t_Handle h_FmMac, t_EnetAddr *p_EnetAddr);
545 
546 /**************************************************************************//**
547  @Function      FM_MAC_AddHashMacAddr
548 
549  @Description   Add an Address to the hash table. This is for filter purpose only.
550 
551  @Param[in]     h_FmMac     -   A handle to a FM Module.
552  @Param[in]     p_EnetAddr  -   Ethernet Mac address
553 
554  @Return        E_OK on success; Error code otherwise.
555 
556  @Cautions      Allowed only following FM_MAC_Init(). It is a filter only address.
557  @Cautions      Some address need to be filterd out in upper FM blocks.
558 *//***************************************************************************/
559 t_Error FM_MAC_AddHashMacAddr (t_Handle h_FmMac, t_EnetAddr *p_EnetAddr);
560 
561 /**************************************************************************//**
562  @Function      FM_MAC_RemoveHashMacAddr
563 
564  @Description   Delete an Address to the hash table. This is for filter purpose only.
565 
566  @Param[in]     h_FmMac     -   A handle to a FM Module.
567  @Param[in]     p_EnetAddr  -   Ethernet Mac address
568 
569  @Return        E_OK on success; Error code otherwise.
570 
571  @Cautions      Allowed only following FM_MAC_Init().
572 *//***************************************************************************/
573 t_Error FM_MAC_RemoveHashMacAddr (t_Handle h_FmMac, t_EnetAddr *p_EnetAddr);
574 
575 /**************************************************************************//**
576  @Function      FM_MAC_AddExactMatchMacAddr
577 
578  @Description   Add a unicast or multicast mac address for exact-match filtering
579                 (8 on dTSEC, 2 for 10G-MAC)
580 
581  @Param[in]     h_FmMac     -   A handle to a FM Module.
582  @Param[in]     p_EnetAddr  -   MAC Address to ADD
583 
584  @Return        E_OK on success; Error code otherwise.
585 
586  @Cautions      Allowed only after FM_MAC_Init().
587 *//***************************************************************************/
588 t_Error FM_MAC_AddExactMatchMacAddr (t_Handle h_FmMac, t_EnetAddr *p_EnetAddr);
589 
590 /**************************************************************************//**
591  @Function      FM_MAC_RemovelExactMatchMacAddr
592 
593  @Description   Remove a uni cast or multi cast mac address.
594 
595  @Param[in]     h_FmMac     -   A handle to a FM Module.
596  @Param[in]     p_EnetAddr  -   MAC Address to remove
597 
598  @Return        E_OK on success; Error code otherwise..
599 
600  @Cautions      Allowed only after FM_MAC_Init().
601 *//***************************************************************************/
602 t_Error FM_MAC_RemovelExactMatchMacAddr (t_Handle h_FmMac, t_EnetAddr *p_EnetAddr);
603 
604 /**************************************************************************//**
605  @Function      FM_MAC_SetPromiscuous
606 
607  @Description   Enable/Disable MAC Promiscuous mode for ALL mac addresses.
608 
609  @Param[in]     h_FmMac    - A handle to a FM MAC Module.
610  @Param[in]     enable     - TRUE to enable or FALSE to disable.
611 
612  @Return        E_OK on success; Error code otherwise.
613 
614  @Cautions      Allowed only after FM_MAC_Init().
615 *//***************************************************************************/
616 t_Error FM_MAC_SetPromiscuous (t_Handle h_FmMac, bool enable);
617 
618 /**************************************************************************//**
619  @Function      FM_MAC_AdjustLink
620 
621  @Description   Adjusts the Ethernet link with new speed/duplex setup.
622 
623  @Param[in]     h_FmMac     - A handle to a FM Module.
624  @Param[in]     speed       - Ethernet speed.
625  @Param[in]     fullDuplex  - TRUE for Full-Duplex mode;
626                               FALSE for Half-Duplex mode.
627 
628  @Return        E_OK on success; Error code otherwise.
629 *//***************************************************************************/
630 t_Error FM_MAC_AdjustLink(t_Handle h_FmMac, e_EnetSpeed speed, bool fullDuplex);
631 
632 /**************************************************************************//**
633  @Function      FM_MAC_GetId
634 
635  @Description   Return the MAC ID
636 
637  @Param[in]     h_FmMac     -   A handle to a FM Module.
638  @Param[out]    p_MacId     -   MAC ID of device
639 
640  @Return        E_OK on success; Error code otherwise.
641 
642  @Cautions      Allowed only after FM_MAC_Init().
643 *//***************************************************************************/
644 t_Error FM_MAC_GetId (t_Handle h_FmMac, uint32_t *p_MacId);
645 
646 /**************************************************************************//**
647  @Function      FM_MAC_GetVesrion
648 
649  @Description   Return Mac HW chip version
650 
651  @Param[in]     h_FmMac      -   A handle to a FM Module.
652  @Param[out]    p_MacVresion -   Mac version as defined by the chip
653 
654  @Return        E_OK on success; Error code otherwise.
655 
656  @Cautions      Allowed only after FM_MAC_Init().
657 *//***************************************************************************/
658 t_Error FM_MAC_GetVesrion (t_Handle h_FmMac, uint32_t *p_MacVresion);
659 
660 /**************************************************************************//**
661  @Function      FM_MAC_MII_WritePhyReg
662 
663  @Description   Write data into Phy Register
664 
665  @Param[in]     h_FmMac     -   A handle to a FM Module.
666  @Param[in]     phyAddr     -   Phy Address on the MII bus
667  @Param[in]     reg         -   Register Number.
668  @Param[in]     data        -   Data to write.
669 
670  @Return        E_OK on success; Error code otherwise.
671 
672  @Cautions      Allowed only after FM_MAC_Init().
673 *//***************************************************************************/
674 t_Error FM_MAC_MII_WritePhyReg (t_Handle h_FmMac, uint8_t phyAddr, uint8_t reg, uint16_t data);
675 
676 /**************************************************************************//**
677  @Function      FM_MAC_MII_ReadPhyReg
678 
679  @Description   Read data from Phy Register
680 
681  @Param[in]     h_FmMac     -   A handle to a FM Module.
682  @Param[in]     phyAddr     -   Phy Address on the MII bus
683  @Param[in]     reg         -   Register Number.
684  @Param[out]    p_Data      -   Data from PHY.
685 
686  @Return        E_OK on success; Error code otherwise.
687 
688  @Cautions      Allowed only after FM_MAC_Init().
689 *//***************************************************************************/
690 t_Error FM_MAC_MII_ReadPhyReg(t_Handle h_FmMac,  uint8_t phyAddr, uint8_t reg, uint16_t *p_Data);
691 
692 #if (defined(DEBUG_ERRORS) && (DEBUG_ERRORS > 0))
693 /**************************************************************************//**
694  @Function      FM_MAC_DumpRegs
695 
696  @Description   Dump internal registers
697 
698  @Param[in]     h_FmMac     -   A handle to a FM Module.
699 
700  @Return        E_OK on success; Error code otherwise.
701 
702  @Cautions      Allowed only after FM_MAC_Init().
703 *//***************************************************************************/
704 t_Error FM_MAC_DumpRegs(t_Handle h_FmMac);
705 #endif /* (defined(DEBUG_ERRORS) && ... */
706 
707 /** @} */ /* end of FM_mac_runtime_control_grp group */
708 /** @} */ /* end of FM_mac_grp group */
709 /** @} */ /* end of FM_grp group */
710 
711 
712 
713 #endif /* __FM_MAC_EXT_H */
714