1296177Sjhibbits/* Copyright (c) 2008-2011 Freescale Semiconductor, Inc.
2296177Sjhibbits * All rights reserved.
3296177Sjhibbits *
4296177Sjhibbits * Redistribution and use in source and binary forms, with or without
5296177Sjhibbits * modification, are permitted provided that the following conditions are met:
6296177Sjhibbits *     * Redistributions of source code must retain the above copyright
7296177Sjhibbits *       notice, this list of conditions and the following disclaimer.
8296177Sjhibbits *     * Redistributions in binary form must reproduce the above copyright
9296177Sjhibbits *       notice, this list of conditions and the following disclaimer in the
10296177Sjhibbits *       documentation and/or other materials provided with the distribution.
11296177Sjhibbits *     * Neither the name of Freescale Semiconductor nor the
12296177Sjhibbits *       names of its contributors may be used to endorse or promote products
13296177Sjhibbits *       derived from this software without specific prior written permission.
14296177Sjhibbits *
15296177Sjhibbits *
16296177Sjhibbits * ALTERNATIVELY, this software may be distributed under the terms of the
17296177Sjhibbits * GNU General Public License ("GPL") as published by the Free Software
18296177Sjhibbits * Foundation, either version 2 of that License or (at your option) any
19296177Sjhibbits * later version.
20296177Sjhibbits *
21296177Sjhibbits * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
22296177Sjhibbits * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
23296177Sjhibbits * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24296177Sjhibbits * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
25296177Sjhibbits * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26296177Sjhibbits * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27296177Sjhibbits * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
28296177Sjhibbits * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29296177Sjhibbits * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30296177Sjhibbits * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31296177Sjhibbits */
32296177Sjhibbits
33296177Sjhibbits/**************************************************************************//**
34296177Sjhibbits @File          fm_mac_ext.h
35296177Sjhibbits
36296177Sjhibbits @Description   FM MAC ...
37296177Sjhibbits*//***************************************************************************/
38296177Sjhibbits#ifndef __FM_MAC_EXT_H
39296177Sjhibbits#define __FM_MAC_EXT_H
40296177Sjhibbits
41296177Sjhibbits#include "std_ext.h"
42296177Sjhibbits#include "enet_ext.h"
43296177Sjhibbits
44296177Sjhibbits
45296177Sjhibbits/**************************************************************************//**
46296177Sjhibbits
47296177Sjhibbits @Group         FM_grp Frame Manager API
48296177Sjhibbits
49296177Sjhibbits @Description   FM API functions, definitions and enums
50296177Sjhibbits
51296177Sjhibbits @{
52296177Sjhibbits*//***************************************************************************/
53296177Sjhibbits
54296177Sjhibbits/**************************************************************************//**
55296177Sjhibbits @Group         FM_mac_grp FM MAC
56296177Sjhibbits
57296177Sjhibbits @Description   FM MAC API functions, definitions and enums
58296177Sjhibbits
59296177Sjhibbits @{
60296177Sjhibbits*//***************************************************************************/
61296177Sjhibbits
62296177Sjhibbits
63296177Sjhibbits/**************************************************************************//**
64296177Sjhibbits @Description   FM MAC Exceptions
65296177Sjhibbits*//***************************************************************************/
66296177Sjhibbitstypedef enum e_FmMacExceptions {
67296177Sjhibbits    e_FM_MAC_EX_10G_MDIO_SCAN_EVENTMDIO = 0
68296177Sjhibbits   ,e_FM_MAC_EX_10G_MDIO_CMD_CMPL
69296177Sjhibbits   ,e_FM_MAC_EX_10G_REM_FAULT
70296177Sjhibbits   ,e_FM_MAC_EX_10G_LOC_FAULT
71296177Sjhibbits   ,e_FM_MAC_EX_10G_1TX_ECC_ER
72296177Sjhibbits   ,e_FM_MAC_EX_10G_TX_FIFO_UNFL
73296177Sjhibbits   ,e_FM_MAC_EX_10G_TX_FIFO_OVFL
74296177Sjhibbits   ,e_FM_MAC_EX_10G_TX_ER
75296177Sjhibbits   ,e_FM_MAC_EX_10G_RX_FIFO_OVFL
76296177Sjhibbits   ,e_FM_MAC_EX_10G_RX_ECC_ER
77296177Sjhibbits   ,e_FM_MAC_EX_10G_RX_JAB_FRM
78296177Sjhibbits   ,e_FM_MAC_EX_10G_RX_OVRSZ_FRM
79296177Sjhibbits   ,e_FM_MAC_EX_10G_RX_RUNT_FRM
80296177Sjhibbits   ,e_FM_MAC_EX_10G_RX_FRAG_FRM
81296177Sjhibbits   ,e_FM_MAC_EX_10G_RX_LEN_ER
82296177Sjhibbits   ,e_FM_MAC_EX_10G_RX_CRC_ER
83296177Sjhibbits   ,e_FM_MAC_EX_10G_RX_ALIGN_ER
84296177Sjhibbits   ,e_FM_MAC_EX_1G_BAB_RX
85296177Sjhibbits   ,e_FM_MAC_EX_1G_RX_CTL
86296177Sjhibbits   ,e_FM_MAC_EX_1G_GRATEFUL_TX_STP_COMPLET
87296177Sjhibbits   ,e_FM_MAC_EX_1G_BAB_TX
88296177Sjhibbits   ,e_FM_MAC_EX_1G_TX_CTL
89296177Sjhibbits   ,e_FM_MAC_EX_1G_TX_ERR
90296177Sjhibbits   ,e_FM_MAC_EX_1G_LATE_COL
91296177Sjhibbits   ,e_FM_MAC_EX_1G_COL_RET_LMT
92296177Sjhibbits   ,e_FM_MAC_EX_1G_TX_FIFO_UNDRN
93296177Sjhibbits   ,e_FM_MAC_EX_1G_MAG_PCKT
94296177Sjhibbits   ,e_FM_MAC_EX_1G_MII_MNG_RD_COMPLET
95296177Sjhibbits   ,e_FM_MAC_EX_1G_MII_MNG_WR_COMPLET
96296177Sjhibbits   ,e_FM_MAC_EX_1G_GRATEFUL_RX_STP_COMPLET
97296177Sjhibbits   ,e_FM_MAC_EX_1G_TX_DATA_ERR
98296177Sjhibbits   ,e_FM_MAC_EX_1G_RX_DATA_ERR
99296177Sjhibbits   ,e_FM_MAC_EX_1G_1588_TS_RX_ERR
100296177Sjhibbits   ,e_FM_MAC_EX_1G_RX_MIB_CNT_OVFL
101296177Sjhibbits} e_FmMacExceptions;
102296177Sjhibbits
103296177Sjhibbits/**************************************************************************//**
104296177Sjhibbits @Description   TM MAC statistics level
105296177Sjhibbits*//***************************************************************************/
106296177Sjhibbitstypedef enum e_FmMacStatisticsLevel {
107296177Sjhibbits    e_FM_MAC_NONE_STATISTICS = 0,       /**< No statistics */
108296177Sjhibbits    e_FM_MAC_PARTIAL_STATISTICS,        /**< Only error counters are available. Optimized for performance */
109296177Sjhibbits    e_FM_MAC_FULL_STATISTICS            /**< All counters available. Not optimized for performance */
110296177Sjhibbits} e_FmMacStatisticsLevel;
111296177Sjhibbits
112296177Sjhibbits
113296177Sjhibbits/**************************************************************************//**
114296177Sjhibbits @Function      t_FmMacExceptionCallback
115296177Sjhibbits
116296177Sjhibbits @Description   Fm Mac Exception Callback from FM MAC to the user
117296177Sjhibbits
118296177Sjhibbits @Param[in]     h_App             - Handle to the upper layer handler
119296177Sjhibbits
120296177Sjhibbits @Param[in]     exceptions        - The exception that occurred
121296177Sjhibbits
122296177Sjhibbits
123296177Sjhibbits @Return        void.
124296177Sjhibbits*//***************************************************************************/
125296177Sjhibbitstypedef void (t_FmMacExceptionCallback)(t_Handle h_App, e_FmMacExceptions exceptions);
126296177Sjhibbits
127296177Sjhibbits
128296177Sjhibbits/**************************************************************************//**
129296177Sjhibbits @Description   TM MAC statistics rfc3635
130296177Sjhibbits*//***************************************************************************/
131296177Sjhibbitstypedef struct t_FmMacStatistics {
132296177Sjhibbits/* RMON */
133296177Sjhibbits    uint64_t  eStatPkts64;             /**< r-10G tr-DT 64 byte frame counter */
134296177Sjhibbits    uint64_t  eStatPkts65to127;        /**< r-10G 65 to 127 byte frame counter */
135296177Sjhibbits    uint64_t  eStatPkts128to255;       /**< r-10G 128 to 255 byte frame counter */
136296177Sjhibbits    uint64_t  eStatPkts256to511;       /**< r-10G 256 to 511 byte frame counter */
137296177Sjhibbits    uint64_t  eStatPkts512to1023;      /**< r-10G 512 to 1023 byte frame counter */
138296177Sjhibbits    uint64_t  eStatPkts1024to1518;     /**< r-10G 1024 to 1518 byte frame counter */
139296177Sjhibbits    uint64_t  eStatPkts1519to1522;     /**< r-10G 1519 to 1522 byte good frame count */
140296177Sjhibbits/* */
141296177Sjhibbits    uint64_t  eStatFragments;          /**< Total number of packets that were less than 64 octets long with a wrong CRC.*/
142296177Sjhibbits    uint64_t  eStatJabbers;            /**< Total number of packets longer than valid maximum length octets */
143296177Sjhibbits    uint64_t  eStatsDropEvents;        /**< number of dropped packets due to internal errors of the MAC Client. */
144296177Sjhibbits    uint64_t  eStatCRCAlignErrors;     /**< Incremented when frames of correct length but with CRC error are received.*/
145296177Sjhibbits    uint64_t  eStatUndersizePkts;      /**< Total number of packets that were less than 64 octets long with a good CRC.*/
146296177Sjhibbits    uint64_t  eStatOversizePkts;       /**< T,B.D*/
147296177Sjhibbits/* Pause */
148296177Sjhibbits    uint64_t  teStatPause;             /**< Pause MAC Control received */
149296177Sjhibbits    uint64_t  reStatPause;             /**< Pause MAC Control sent */
150296177Sjhibbits
151296177Sjhibbits/* MIB II */
152296177Sjhibbits    uint64_t  ifInOctets;              /**< Total number of byte received. */
153296177Sjhibbits    uint64_t  ifInPkts;                /**< Total number of packets received.*/
154296177Sjhibbits    uint64_t  ifInMcastPkts;           /**< Total number of multicast frame received*/
155296177Sjhibbits    uint64_t  ifInBcastPkts;           /**< Total number of broadcast frame received */
156296177Sjhibbits    uint64_t  ifInDiscards;            /**< Frames received, but discarded due to problems within the MAC RX. */
157296177Sjhibbits    uint64_t  ifInErrors;              /**< Number of frames received with error:
158296177Sjhibbits                                               - FIFO Overflow Error
159296177Sjhibbits                                               - CRC Error
160296177Sjhibbits                                               - Frame Too Long Error
161296177Sjhibbits                                               - Alignment Error
162296177Sjhibbits                                               - The dedicated Error Code (0xfe, not a code error) was received */
163296177Sjhibbits    uint64_t  ifOutOctets;             /**< Total number of byte sent. */
164296177Sjhibbits    uint64_t  ifOutPkts;               /**< Total number of packets sent .*/
165296177Sjhibbits    uint64_t  ifOutMcastPkts;          /**< Total number of multicast frame sent */
166296177Sjhibbits    uint64_t  ifOutBcastPkts;          /**< Total number of multicast frame sent */
167296177Sjhibbits    uint64_t  ifOutDiscards;           /**< Frames received, but discarded due to problems within the MAC TX N/A!.*/
168296177Sjhibbits    uint64_t  ifOutErrors;             /**< Number of frames transmitted with error:
169296177Sjhibbits                                               - FIFO Overflow Error
170296177Sjhibbits                                               - FIFO Underflow Error
171296177Sjhibbits                                               - Other */
172296177Sjhibbits} t_FmMacStatistics;
173296177Sjhibbits
174296177Sjhibbits
175296177Sjhibbits/**************************************************************************//**
176296177Sjhibbits @Group         FM_mac_init_grp Initialization Unit
177296177Sjhibbits
178296177Sjhibbits @Description   FM MAC Initialization Unit
179296177Sjhibbits
180296177Sjhibbits @{
181296177Sjhibbits*//***************************************************************************/
182296177Sjhibbits
183296177Sjhibbits/**************************************************************************//**
184296177Sjhibbits @Description   FM MAC config input
185296177Sjhibbits*//***************************************************************************/
186296177Sjhibbitstypedef struct t_FmMacParams {
187296177Sjhibbits    uintptr_t                   baseAddr;           /**< Base of memory mapped FM MAC registers */
188296177Sjhibbits    t_EnetAddr                  addr;               /**< MAC address of device; First octet is sent first */
189296177Sjhibbits    uint8_t                     macId;              /**< MAC ID <dTSEC 0-3> <10G 0>         */
190296177Sjhibbits    e_EnetMode                  enetMode;           /**< Ethernet operation mode (MAC-PHY interface and speed) */
191296177Sjhibbits    t_Handle                    h_Fm;               /**< A handle to the FM object this port related to */
192296177Sjhibbits    int                         mdioIrq;            /**< MDIO exceptions interrupt source - not valid for all
193296177Sjhibbits                                                         MACs; MUST be set to 'NO_IRQ' for MACs that don't have
194296177Sjhibbits                                                         mdio-irq, or for polling */
195296177Sjhibbits    t_FmMacExceptionCallback    *f_Event;           /**< MDIO Events Callback Routine         */
196296177Sjhibbits    t_FmMacExceptionCallback    *f_Exception;       /**< Exception Callback Routine         */
197296177Sjhibbits    t_Handle                    h_App;              /**< A handle to an application layer object; This handle will
198296177Sjhibbits                                                         be passed by the driver upon calling the above callbacks */
199296177Sjhibbits} t_FmMacParams;
200296177Sjhibbits
201296177Sjhibbits
202296177Sjhibbits/**************************************************************************//**
203296177Sjhibbits @Function      FM_MAC_Config
204296177Sjhibbits
205296177Sjhibbits @Description   Creates descriptor for the FM MAC module.
206296177Sjhibbits
207296177Sjhibbits                The routine returns a handle (descriptor) to the FM MAC object.
208296177Sjhibbits                This descriptor must be passed as first parameter to all other
209296177Sjhibbits                FM MAC function calls.
210296177Sjhibbits
211296177Sjhibbits                No actual initialization or configuration of FM MAC hardware is
212296177Sjhibbits                done by this routine.
213296177Sjhibbits
214296177Sjhibbits @Param[in]     p_FmMacParam   - Pointer to data structure of parameters
215296177Sjhibbits
216296177Sjhibbits @Retval        Handle to FM MAC object, or NULL for Failure.
217296177Sjhibbits*//***************************************************************************/
218296177Sjhibbitst_Handle FM_MAC_Config (t_FmMacParams *p_FmMacParam);
219296177Sjhibbits
220296177Sjhibbits/**************************************************************************//**
221296177Sjhibbits @Function      FM_MAC_Init
222296177Sjhibbits
223296177Sjhibbits @Description   Initializes the FM MAC module
224296177Sjhibbits
225296177Sjhibbits @Param[in]     h_FmMac - FM module descriptor
226296177Sjhibbits
227296177Sjhibbits @Return        E_OK on success; Error code otherwise.
228296177Sjhibbits*//***************************************************************************/
229296177Sjhibbitst_Error  FM_MAC_Init (t_Handle h_FmMac);
230296177Sjhibbits
231296177Sjhibbits/**************************************************************************//**
232296177Sjhibbits @Function      FM_Free
233296177Sjhibbits
234296177Sjhibbits @Description   Frees all resources that were assigned to FM MAC module.
235296177Sjhibbits
236296177Sjhibbits                Calling this routine invalidates the descriptor.
237296177Sjhibbits
238296177Sjhibbits @Param[in]     h_FmMac - FM module descriptor
239296177Sjhibbits
240296177Sjhibbits @Return        E_OK on success; Error code otherwise.
241296177Sjhibbits*//***************************************************************************/
242296177Sjhibbitst_Error  FM_MAC_Free (t_Handle h_FmMac);
243296177Sjhibbits
244296177Sjhibbits
245296177Sjhibbits/**************************************************************************//**
246296177Sjhibbits @Group         FM_mac_advanced_init_grp    Advanced Configuration Unit
247296177Sjhibbits
248296177Sjhibbits @Description   Configuration functions used to change default values.
249296177Sjhibbits
250296177Sjhibbits @{
251296177Sjhibbits*//***************************************************************************/
252296177Sjhibbits
253296177Sjhibbits/**************************************************************************//**
254296177Sjhibbits @Function      FM_MAC_ConfigResetOnInit
255296177Sjhibbits
256296177Sjhibbits @Description   Tell the driver whether to reset the FM MAC before initialization or
257296177Sjhibbits                not. It changes the default configuration [FALSE].
258296177Sjhibbits
259296177Sjhibbits @Param[in]     h_FmMac    A handle to a FM MAC Module.
260296177Sjhibbits @Param[in]     enable     When TRUE, FM will be reset before any initialization.
261296177Sjhibbits
262296177Sjhibbits @Return        E_OK on success; Error code otherwise.
263296177Sjhibbits
264296177Sjhibbits @Cautions      Allowed only following FM_MAC_Config() and before FM_MAC_Init().
265296177Sjhibbits*//***************************************************************************/
266296177Sjhibbitst_Error FM_MAC_ConfigResetOnInit (t_Handle h_FmMac, bool enable);
267296177Sjhibbits
268296177Sjhibbits/**************************************************************************//**
269296177Sjhibbits @Function      FM_MAC_ConfigLoopback
270296177Sjhibbits
271296177Sjhibbits @Description   Enable/Disable internal loopback mode
272296177Sjhibbits
273296177Sjhibbits @Param[in]     h_FmMac    A handle to a FM MAC Module.
274296177Sjhibbits @Param[in]     enable     TRUE to enable or FALSE to disable.
275296177Sjhibbits
276296177Sjhibbits @Return        E_OK on success; Error code otherwise.
277296177Sjhibbits
278296177Sjhibbits @Cautions      Allowed only following FM_MAC_Config() and before FM_MAC_Init().
279296177Sjhibbits*//***************************************************************************/
280296177Sjhibbitst_Error FM_MAC_ConfigLoopback (t_Handle h_FmMac, bool enable);
281296177Sjhibbits
282296177Sjhibbits/**************************************************************************//**
283296177Sjhibbits @Function      FM_MAC_ConfigMaxFrameLength
284296177Sjhibbits
285296177Sjhibbits @Description   Setup maximum Frame Length
286296177Sjhibbits
287296177Sjhibbits @Param[in]     h_FmMac    A handle to a FM MAC Module.
288296177Sjhibbits @Param[in]     newVal     MAX Frame length
289296177Sjhibbits
290296177Sjhibbits @Return        E_OK on success; Error code otherwise.
291296177Sjhibbits
292296177Sjhibbits @Cautions      Allowed only following FM_MAC_Config() and before FM_MAC_Init().
293296177Sjhibbits*//***************************************************************************/
294296177Sjhibbitst_Error FM_MAC_ConfigMaxFrameLength (t_Handle h_FmMac, uint16_t newVal);
295296177Sjhibbits
296296177Sjhibbits/**************************************************************************//**
297296177Sjhibbits @Function      FM_MAC_ConfigWan
298296177Sjhibbits
299296177Sjhibbits @Description   ENABLE WAN mode in 10G MAC
300296177Sjhibbits
301296177Sjhibbits @Param[in]     h_FmMac    A handle to a FM MAC Module.
302296177Sjhibbits @Param[in]     enable     TRUE to enable or FALSE to disable.
303296177Sjhibbits
304296177Sjhibbits @Return        E_OK on success; Error code otherwise.
305296177Sjhibbits
306296177Sjhibbits @Cautions      Allowed only following FM_MAC_Config() and before FM_MAC_Init().
307296177Sjhibbits*//***************************************************************************/
308296177Sjhibbitst_Error FM_MAC_ConfigWan (t_Handle h_FmMac, bool enable);
309296177Sjhibbits
310296177Sjhibbits/**************************************************************************//**
311296177Sjhibbits @Function      FM_MAC_ConfigPadAndCrc
312296177Sjhibbits
313296177Sjhibbits @Description   Config PAD and CRC mode
314296177Sjhibbits
315296177Sjhibbits @Param[in]     h_FmMac    A handle to a FM MAC Module.
316296177Sjhibbits @Param[in]     enable     TRUE to enable or FALSE to disable.
317296177Sjhibbits
318296177Sjhibbits @Return        E_OK on success; Error code otherwise.
319296177Sjhibbits
320296177Sjhibbits @Cautions      Allowed only following FM_MAC_Config() and before FM_MAC_Init().
321296177Sjhibbits*//***************************************************************************/
322296177Sjhibbitst_Error FM_MAC_ConfigPadAndCrc (t_Handle h_FmMac, bool enable);
323296177Sjhibbits
324296177Sjhibbits/**************************************************************************//**
325296177Sjhibbits @Function      FM_MAC_ConfigHalfDuplex
326296177Sjhibbits
327296177Sjhibbits @Description   Config Half Duplex Mode
328296177Sjhibbits
329296177Sjhibbits @Param[in]     h_FmMac    A handle to a FM MAC Module.
330296177Sjhibbits @Param[in]     enable     TRUE to enable or FALSE to disable.
331296177Sjhibbits
332296177Sjhibbits @Return        E_OK on success; Error code otherwise.
333296177Sjhibbits
334296177Sjhibbits @Cautions      Allowed only following FM_MAC_Config() and before FM_MAC_Init().
335296177Sjhibbits*//***************************************************************************/
336296177Sjhibbitst_Error FM_MAC_ConfigHalfDuplex (t_Handle h_FmMac, bool enable);
337296177Sjhibbits
338296177Sjhibbits/**************************************************************************//**
339296177Sjhibbits @Function      FM_MAC_ConfigLengthCheck
340296177Sjhibbits
341296177Sjhibbits @Description   Configure thef frame length checking.
342296177Sjhibbits
343296177Sjhibbits @Param[in]     h_FmMac    A handle to a FM MAC Module.
344296177Sjhibbits @Param[in]     enable     TRUE to enable or FALSE to disable.
345296177Sjhibbits
346296177Sjhibbits @Return        E_OK on success; Error code otherwise.
347296177Sjhibbits
348296177Sjhibbits @Cautions      Allowed only following FM_MAC_Config() and before FM_MAC_Init().
349296177Sjhibbits*//***************************************************************************/
350296177Sjhibbitst_Error FM_MAC_ConfigLengthCheck (t_Handle h_FmMac, bool enable);
351296177Sjhibbits
352296177Sjhibbits/**************************************************************************//**
353296177Sjhibbits @Function      FM_MAC_ConfigException
354296177Sjhibbits
355296177Sjhibbits @Description   Change Exception selection from default
356296177Sjhibbits
357296177Sjhibbits @Param[in]     h_FmMac         A handle to a FM MAC Module.
358296177Sjhibbits @Param[in]     ex              Type of the desired exceptions
359296177Sjhibbits @Param[in]     enable          TRUE to enable the specified exception, FALSE to disable it.
360296177Sjhibbits
361296177Sjhibbits
362296177Sjhibbits @Return        E_OK on success; Error code otherwise.
363296177Sjhibbits
364296177Sjhibbits @Cautions      Allowed only following FM_MAC_Config() and before FM_MAC_Init().
365296177Sjhibbits*//***************************************************************************/
366296177Sjhibbitst_Error FM_MAC_ConfigException(t_Handle h_FmMac, e_FmMacExceptions ex, bool enable);
367296177Sjhibbits
368296177Sjhibbits#ifdef FM_TX_ECC_FRMS_ERRATA_10GMAC_A004
369296177Sjhibbitst_Error FM_MAC_ConfigSkipFman11Workaround (t_Handle h_FmMac);
370296177Sjhibbits#endif /* FM_TX_ECC_FRMS_ERRATA_10GMAC_A004 */
371296177Sjhibbits/** @} */ /* end of FM_mac_advanced_init_grp group */
372296177Sjhibbits/** @} */ /* end of FM_mac_init_grp group */
373296177Sjhibbits
374296177Sjhibbits
375296177Sjhibbits/**************************************************************************//**
376296177Sjhibbits @Group         FM_mac_runtime_control_grp Runtime Control Unit
377296177Sjhibbits
378296177Sjhibbits @Description   FM MAC Runtime control unit API functions, definitions and enums.
379296177Sjhibbits
380296177Sjhibbits @{
381296177Sjhibbits*//***************************************************************************/
382296177Sjhibbits
383296177Sjhibbits/**************************************************************************//**
384296177Sjhibbits @Function      FM_MAC_Enable
385296177Sjhibbits
386296177Sjhibbits @Description   Enable the MAC
387296177Sjhibbits
388296177Sjhibbits @Param[in]     h_FmMac    A handle to a FM MAC Module.
389296177Sjhibbits @Param[in]     mode       Mode of operation (RX, TX, Both)
390296177Sjhibbits
391296177Sjhibbits @Return        E_OK on success; Error code otherwise.
392296177Sjhibbits
393296177Sjhibbits @Cautions      Allowed only following FM_MAC_Init().
394296177Sjhibbits*//***************************************************************************/
395296177Sjhibbitst_Error FM_MAC_Enable  (t_Handle h_FmMac,  e_CommMode mode);
396296177Sjhibbits
397296177Sjhibbits/**************************************************************************//**
398296177Sjhibbits @Function      FM_MAC_Disable
399296177Sjhibbits
400296177Sjhibbits @Description   DISABLE the MAC
401296177Sjhibbits
402296177Sjhibbits @Param[in]     h_FmMac    A handle to a FM MAC Module.
403296177Sjhibbits @Param[in]     mode       Define what part to Disable (RX,  TX or BOTH)
404296177Sjhibbits
405296177Sjhibbits @Return        E_OK on success; Error code otherwise.
406296177Sjhibbits
407296177Sjhibbits @Cautions      Allowed only following FM_MAC_Init().
408296177Sjhibbits*//***************************************************************************/
409296177Sjhibbitst_Error FM_MAC_Disable (t_Handle h_FmMac, e_CommMode mode);
410296177Sjhibbits
411296177Sjhibbits/**************************************************************************//**
412296177Sjhibbits @Function      FM_MAC_Enable1588TimeStamp
413296177Sjhibbits
414296177Sjhibbits @Description   Enables the TSU operation.
415296177Sjhibbits
416296177Sjhibbits @Param[in]     h_Fm   - Handle to the PTP as returned from the FM_MAC_PtpConfig.
417296177Sjhibbits
418296177Sjhibbits @Return        E_OK on success; Error code otherwise.
419296177Sjhibbits
420296177Sjhibbits @Cautions      Allowed only following FM_MAC_Init().
421296177Sjhibbits*//***************************************************************************/
422296177Sjhibbitst_Error FM_MAC_Enable1588TimeStamp(t_Handle h_Fm);
423296177Sjhibbits
424296177Sjhibbits/**************************************************************************//**
425296177Sjhibbits @Function      FM_MAC_Disable1588TimeStamp
426296177Sjhibbits
427296177Sjhibbits @Description   Disables the TSU operation.
428296177Sjhibbits
429296177Sjhibbits @Param[in]     h_Fm   - Handle to the PTP as returned from the FM_MAC_PtpConfig.
430296177Sjhibbits
431296177Sjhibbits @Return        E_OK on success; Error code otherwise.
432296177Sjhibbits
433296177Sjhibbits @Cautions      Allowed only following FM_MAC_Init().
434296177Sjhibbits*//***************************************************************************/
435296177Sjhibbitst_Error FM_MAC_Disable1588TimeStamp(t_Handle h_Fm);
436296177Sjhibbits
437296177Sjhibbits/**************************************************************************//**
438296177Sjhibbits @Function      FM_MAC_SetTxAutoPauseFrames
439296177Sjhibbits
440296177Sjhibbits @Description   Enable/Disable transmition of Pause-Frames.
441296177Sjhibbits
442296177Sjhibbits @Param[in]     h_FmMac     A handle to a FM MAC Module.
443296177Sjhibbits @Param[in]     pauseTime   Pause quanta value used with transmitted pause frames.
444296177Sjhibbits                            Each quanta represents a 512 bit-times; Note that '0'
445296177Sjhibbits                            as an input here will be used as disabling the
446296177Sjhibbits                            transmission of the pause-frames.
447296177Sjhibbits
448296177Sjhibbits @Return        E_OK on success; Error code otherwise.
449296177Sjhibbits
450296177Sjhibbits @Cautions      Allowed only following FM_MAC_Init().
451296177Sjhibbits*//***************************************************************************/
452296177Sjhibbitst_Error FM_MAC_SetTxAutoPauseFrames (t_Handle h_FmMac, uint16_t pauseTime);
453296177Sjhibbits
454296177Sjhibbits/**************************************************************************//**
455296177Sjhibbits @Function      FM_MAC_SetRxIgnorePauseFrames
456296177Sjhibbits
457296177Sjhibbits @Description   Enable/Disable ignoring of Pause-Frames.
458296177Sjhibbits
459296177Sjhibbits @Param[in]     h_FmMac     A handle to a FM MAC Module.
460296177Sjhibbits @Param[in]     en          boolean indicates whether to ignore the incoming pause
461296177Sjhibbits                            frames or not.
462296177Sjhibbits
463296177Sjhibbits @Return        E_OK on success; Error code otherwise.
464296177Sjhibbits
465296177Sjhibbits @Cautions      Allowed only following FM_MAC_Init().
466296177Sjhibbits*//***************************************************************************/
467296177Sjhibbitst_Error FM_MAC_SetRxIgnorePauseFrames (t_Handle h_FmMac, bool en);
468296177Sjhibbits
469296177Sjhibbits/**************************************************************************//**
470296177Sjhibbits @Function      FM_MAC_ResetCounters
471296177Sjhibbits
472296177Sjhibbits @Description   reset all statistics counters
473296177Sjhibbits
474296177Sjhibbits @Param[in]     h_FmMac     A handle to a FM MAC Module.
475296177Sjhibbits
476296177Sjhibbits @Return        E_OK on success; Error code otherwise.
477296177Sjhibbits
478296177Sjhibbits @Cautions      Allowed only following FM_MAC_Init().
479296177Sjhibbits*//***************************************************************************/
480296177Sjhibbitst_Error FM_MAC_ResetCounters (t_Handle h_FmMac);
481296177Sjhibbits
482296177Sjhibbits/**************************************************************************//**
483296177Sjhibbits @Function      FM_MAC_SetException
484296177Sjhibbits
485296177Sjhibbits @Description   Enable/Disable a specific Exception
486296177Sjhibbits
487296177Sjhibbits @Param[in]     h_FmMac         A handle to a FM MAC Module.
488296177Sjhibbits @Param[in]     ex              Type of the desired exceptions
489296177Sjhibbits @Param[in]     enable          TRUE to enable the specified exception, FALSE to disable it.
490296177Sjhibbits
491296177Sjhibbits
492296177Sjhibbits @Return        E_OK on success; Error code otherwise.
493296177Sjhibbits
494296177Sjhibbits @Cautions      Allowed only following FM_MAC_Init().
495296177Sjhibbits*//***************************************************************************/
496296177Sjhibbitst_Error FM_MAC_SetException(t_Handle h_FmMac, e_FmMacExceptions ex, bool enable);
497296177Sjhibbits
498296177Sjhibbits/**************************************************************************//**
499296177Sjhibbits @Function      FM_MAC_SetStatistics
500296177Sjhibbits
501296177Sjhibbits @Description   Define Statistics level.
502296177Sjhibbits                                Where applicable, the routine also enables the MIB counters
503296177Sjhibbits                                overflow interrupt in order to keep counters accurate
504296177Sjhibbits                                and account for overflows.
505296177Sjhibbits
506296177Sjhibbits @Param[in]     h_FmMac         A handle to a FM MAC Module.
507296177Sjhibbits @Param[in]     statisticsLevel Full statistics level provides all standard counters but may
508296177Sjhibbits                                reduce performance. Partial statistics provides only special
509296177Sjhibbits                                event counters (errors etc.). If selected, regular counters (such as
510296177Sjhibbits                                byte/packet) will be invalid and will return -1.
511296177Sjhibbits
512296177Sjhibbits @Return        E_OK on success; Error code otherwise.
513296177Sjhibbits
514296177Sjhibbits @Cautions      Allowed only following FM_MAC_Init().
515296177Sjhibbits*//***************************************************************************/
516296177Sjhibbitst_Error FM_MAC_SetStatistics (t_Handle h_FmMac, e_FmMacStatisticsLevel statisticsLevel);
517296177Sjhibbits
518296177Sjhibbits/**************************************************************************//**
519296177Sjhibbits @Function      FM_MAC_GetStatistics
520296177Sjhibbits
521296177Sjhibbits @Description   get all statistics counters
522296177Sjhibbits
523296177Sjhibbits @Param[in]     h_FmMac         A handle to a FM MAC Module.
524296177Sjhibbits @Param[in]     p_Statistics    Staructure with statistics
525296177Sjhibbits
526296177Sjhibbits @Return        E_OK on success; Error code otherwise.
527296177Sjhibbits
528296177Sjhibbits @Cautions      Allowed only following FM_Init().
529296177Sjhibbits*//***************************************************************************/
530296177Sjhibbitst_Error FM_MAC_GetStatistics (t_Handle h_FmMac, t_FmMacStatistics *p_Statistics);
531296177Sjhibbits
532296177Sjhibbits/**************************************************************************//**
533296177Sjhibbits @Function      FM_MAC_ModifyMacAddr
534296177Sjhibbits
535296177Sjhibbits @Description   Replace the main MAC Address
536296177Sjhibbits
537296177Sjhibbits @Param[in]     h_FmMac     -   A handle to a FM Module.
538296177Sjhibbits @Param[in]     p_EnetAddr  -   Ethernet Mac address
539296177Sjhibbits
540296177Sjhibbits @Return        E_OK on success; Error code otherwise.
541296177Sjhibbits
542296177Sjhibbits @Cautions      Allowed only after FM_MAC_Init().
543296177Sjhibbits*//***************************************************************************/
544296177Sjhibbitst_Error FM_MAC_ModifyMacAddr (t_Handle h_FmMac, t_EnetAddr *p_EnetAddr);
545296177Sjhibbits
546296177Sjhibbits/**************************************************************************//**
547296177Sjhibbits @Function      FM_MAC_AddHashMacAddr
548296177Sjhibbits
549296177Sjhibbits @Description   Add an Address to the hash table. This is for filter purpose only.
550296177Sjhibbits
551296177Sjhibbits @Param[in]     h_FmMac     -   A handle to a FM Module.
552296177Sjhibbits @Param[in]     p_EnetAddr  -   Ethernet Mac address
553296177Sjhibbits
554296177Sjhibbits @Return        E_OK on success; Error code otherwise.
555296177Sjhibbits
556296177Sjhibbits @Cautions      Allowed only following FM_MAC_Init(). It is a filter only address.
557296177Sjhibbits @Cautions      Some address need to be filterd out in upper FM blocks.
558296177Sjhibbits*//***************************************************************************/
559296177Sjhibbitst_Error FM_MAC_AddHashMacAddr (t_Handle h_FmMac, t_EnetAddr *p_EnetAddr);
560296177Sjhibbits
561296177Sjhibbits/**************************************************************************//**
562296177Sjhibbits @Function      FM_MAC_RemoveHashMacAddr
563296177Sjhibbits
564296177Sjhibbits @Description   Delete an Address to the hash table. This is for filter purpose only.
565296177Sjhibbits
566296177Sjhibbits @Param[in]     h_FmMac     -   A handle to a FM Module.
567296177Sjhibbits @Param[in]     p_EnetAddr  -   Ethernet Mac address
568296177Sjhibbits
569296177Sjhibbits @Return        E_OK on success; Error code otherwise.
570296177Sjhibbits
571296177Sjhibbits @Cautions      Allowed only following FM_MAC_Init().
572296177Sjhibbits*//***************************************************************************/
573296177Sjhibbitst_Error FM_MAC_RemoveHashMacAddr (t_Handle h_FmMac, t_EnetAddr *p_EnetAddr);
574296177Sjhibbits
575296177Sjhibbits/**************************************************************************//**
576296177Sjhibbits @Function      FM_MAC_AddExactMatchMacAddr
577296177Sjhibbits
578296177Sjhibbits @Description   Add a unicast or multicast mac address for exact-match filtering
579296177Sjhibbits                (8 on dTSEC, 2 for 10G-MAC)
580296177Sjhibbits
581296177Sjhibbits @Param[in]     h_FmMac     -   A handle to a FM Module.
582296177Sjhibbits @Param[in]     p_EnetAddr  -   MAC Address to ADD
583296177Sjhibbits
584296177Sjhibbits @Return        E_OK on success; Error code otherwise.
585296177Sjhibbits
586296177Sjhibbits @Cautions      Allowed only after FM_MAC_Init().
587296177Sjhibbits*//***************************************************************************/
588296177Sjhibbitst_Error FM_MAC_AddExactMatchMacAddr (t_Handle h_FmMac, t_EnetAddr *p_EnetAddr);
589296177Sjhibbits
590296177Sjhibbits/**************************************************************************//**
591296177Sjhibbits @Function      FM_MAC_RemovelExactMatchMacAddr
592296177Sjhibbits
593296177Sjhibbits @Description   Remove a uni cast or multi cast mac address.
594296177Sjhibbits
595296177Sjhibbits @Param[in]     h_FmMac     -   A handle to a FM Module.
596296177Sjhibbits @Param[in]     p_EnetAddr  -   MAC Address to remove
597296177Sjhibbits
598296177Sjhibbits @Return        E_OK on success; Error code otherwise..
599296177Sjhibbits
600296177Sjhibbits @Cautions      Allowed only after FM_MAC_Init().
601296177Sjhibbits*//***************************************************************************/
602296177Sjhibbitst_Error FM_MAC_RemovelExactMatchMacAddr (t_Handle h_FmMac, t_EnetAddr *p_EnetAddr);
603296177Sjhibbits
604296177Sjhibbits/**************************************************************************//**
605296177Sjhibbits @Function      FM_MAC_SetPromiscuous
606296177Sjhibbits
607296177Sjhibbits @Description   Enable/Disable MAC Promiscuous mode for ALL mac addresses.
608296177Sjhibbits
609296177Sjhibbits @Param[in]     h_FmMac    - A handle to a FM MAC Module.
610296177Sjhibbits @Param[in]     enable     - TRUE to enable or FALSE to disable.
611296177Sjhibbits
612296177Sjhibbits @Return        E_OK on success; Error code otherwise.
613296177Sjhibbits
614296177Sjhibbits @Cautions      Allowed only after FM_MAC_Init().
615296177Sjhibbits*//***************************************************************************/
616296177Sjhibbitst_Error FM_MAC_SetPromiscuous (t_Handle h_FmMac, bool enable);
617296177Sjhibbits
618296177Sjhibbits/**************************************************************************//**
619296177Sjhibbits @Function      FM_MAC_AdjustLink
620296177Sjhibbits
621296177Sjhibbits @Description   Adjusts the Ethernet link with new speed/duplex setup.
622296177Sjhibbits
623296177Sjhibbits @Param[in]     h_FmMac     - A handle to a FM Module.
624296177Sjhibbits @Param[in]     speed       - Ethernet speed.
625296177Sjhibbits @Param[in]     fullDuplex  - TRUE for Full-Duplex mode;
626296177Sjhibbits                              FALSE for Half-Duplex mode.
627296177Sjhibbits
628296177Sjhibbits @Return        E_OK on success; Error code otherwise.
629296177Sjhibbits*//***************************************************************************/
630296177Sjhibbitst_Error FM_MAC_AdjustLink(t_Handle h_FmMac, e_EnetSpeed speed, bool fullDuplex);
631296177Sjhibbits
632296177Sjhibbits/**************************************************************************//**
633296177Sjhibbits @Function      FM_MAC_GetId
634296177Sjhibbits
635296177Sjhibbits @Description   Return the MAC ID
636296177Sjhibbits
637296177Sjhibbits @Param[in]     h_FmMac     -   A handle to a FM Module.
638296177Sjhibbits @Param[out]    p_MacId     -   MAC ID of device
639296177Sjhibbits
640296177Sjhibbits @Return        E_OK on success; Error code otherwise.
641296177Sjhibbits
642296177Sjhibbits @Cautions      Allowed only after FM_MAC_Init().
643296177Sjhibbits*//***************************************************************************/
644296177Sjhibbitst_Error FM_MAC_GetId (t_Handle h_FmMac, uint32_t *p_MacId);
645296177Sjhibbits
646296177Sjhibbits/**************************************************************************//**
647296177Sjhibbits @Function      FM_MAC_GetVesrion
648296177Sjhibbits
649296177Sjhibbits @Description   Return Mac HW chip version
650296177Sjhibbits
651296177Sjhibbits @Param[in]     h_FmMac      -   A handle to a FM Module.
652296177Sjhibbits @Param[out]    p_MacVresion -   Mac version as defined by the chip
653296177Sjhibbits
654296177Sjhibbits @Return        E_OK on success; Error code otherwise.
655296177Sjhibbits
656296177Sjhibbits @Cautions      Allowed only after FM_MAC_Init().
657296177Sjhibbits*//***************************************************************************/
658296177Sjhibbitst_Error FM_MAC_GetVesrion (t_Handle h_FmMac, uint32_t *p_MacVresion);
659296177Sjhibbits
660296177Sjhibbits/**************************************************************************//**
661296177Sjhibbits @Function      FM_MAC_MII_WritePhyReg
662296177Sjhibbits
663296177Sjhibbits @Description   Write data into Phy Register
664296177Sjhibbits
665296177Sjhibbits @Param[in]     h_FmMac     -   A handle to a FM Module.
666296177Sjhibbits @Param[in]     phyAddr     -   Phy Address on the MII bus
667296177Sjhibbits @Param[in]     reg         -   Register Number.
668296177Sjhibbits @Param[in]     data        -   Data to write.
669296177Sjhibbits
670296177Sjhibbits @Return        E_OK on success; Error code otherwise.
671296177Sjhibbits
672296177Sjhibbits @Cautions      Allowed only after FM_MAC_Init().
673296177Sjhibbits*//***************************************************************************/
674296177Sjhibbitst_Error FM_MAC_MII_WritePhyReg (t_Handle h_FmMac, uint8_t phyAddr, uint8_t reg, uint16_t data);
675296177Sjhibbits
676296177Sjhibbits/**************************************************************************//**
677296177Sjhibbits @Function      FM_MAC_MII_ReadPhyReg
678296177Sjhibbits
679296177Sjhibbits @Description   Read data from Phy Register
680296177Sjhibbits
681296177Sjhibbits @Param[in]     h_FmMac     -   A handle to a FM Module.
682296177Sjhibbits @Param[in]     phyAddr     -   Phy Address on the MII bus
683296177Sjhibbits @Param[in]     reg         -   Register Number.
684296177Sjhibbits @Param[out]    p_Data      -   Data from PHY.
685296177Sjhibbits
686296177Sjhibbits @Return        E_OK on success; Error code otherwise.
687296177Sjhibbits
688296177Sjhibbits @Cautions      Allowed only after FM_MAC_Init().
689296177Sjhibbits*//***************************************************************************/
690296177Sjhibbitst_Error FM_MAC_MII_ReadPhyReg(t_Handle h_FmMac,  uint8_t phyAddr, uint8_t reg, uint16_t *p_Data);
691296177Sjhibbits
692296177Sjhibbits#if (defined(DEBUG_ERRORS) && (DEBUG_ERRORS > 0))
693296177Sjhibbits/**************************************************************************//**
694296177Sjhibbits @Function      FM_MAC_DumpRegs
695296177Sjhibbits
696296177Sjhibbits @Description   Dump internal registers
697296177Sjhibbits
698296177Sjhibbits @Param[in]     h_FmMac     -   A handle to a FM Module.
699296177Sjhibbits
700296177Sjhibbits @Return        E_OK on success; Error code otherwise.
701296177Sjhibbits
702296177Sjhibbits @Cautions      Allowed only after FM_MAC_Init().
703296177Sjhibbits*//***************************************************************************/
704296177Sjhibbitst_Error FM_MAC_DumpRegs(t_Handle h_FmMac);
705296177Sjhibbits#endif /* (defined(DEBUG_ERRORS) && ... */
706296177Sjhibbits
707296177Sjhibbits/** @} */ /* end of FM_mac_runtime_control_grp group */
708296177Sjhibbits/** @} */ /* end of FM_mac_grp group */
709296177Sjhibbits/** @} */ /* end of FM_grp group */
710296177Sjhibbits
711296177Sjhibbits
712296177Sjhibbits
713296177Sjhibbits#endif /* __FM_MAC_EXT_H */
714