1 /*
2  * Copyright 2021-2024 NXP
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #ifndef NETC_ETH_IP_H
8 #define NETC_ETH_IP_H
9 
10 /**
11 *   @file Netc_Eth_Ip.h
12 *
13 *   @addtogroup NETC_ETH_DRIVER NETC_ETH Driver
14 *   @{
15 */
16 
17 #ifdef __cplusplus
18 extern "C"{
19 #endif
20 
21 /*==================================================================================================
22 *                                          INCLUDE FILES
23 * 1) system and project includes
24 * 2) needed interfaces from external units
25 * 3) internal and external interfaces from this unit
26 ==================================================================================================*/
27 #include "Netc_Eth_Ip_Types.h"
28 #include "Eth_GeneralTypes.h"
29 
30 /*==================================================================================================
31 *                                 SOURCE FILE VERSION INFORMATION
32 ==================================================================================================*/
33 #define NETC_ETH_IP_VENDOR_ID                    43
34 #define NETC_ETH_IP_AR_RELEASE_MAJOR_VERSION     4
35 #define NETC_ETH_IP_AR_RELEASE_MINOR_VERSION     7
36 #define NETC_ETH_IP_AR_RELEASE_REVISION_VERSION  0
37 #define NETC_ETH_IP_SW_MAJOR_VERSION             2
38 #define NETC_ETH_IP_SW_MINOR_VERSION             0
39 #define NETC_ETH_IP_SW_PATCH_VERSION             0
40 
41 /*==================================================================================================
42 *                                       FILE VERSION CHECKS
43 ==================================================================================================*/
44 /* Checks against Netc_Eth_Ip_Types.h */
45 #if (NETC_ETH_IP_VENDOR_ID != NETC_ETH_IP_TYPES_VENDOR_ID)
46     #error "Netc_Eth_Ip.h and Netc_Eth_Ip_Types.h have different vendor ids"
47 #endif
48 #if ((NETC_ETH_IP_AR_RELEASE_MAJOR_VERSION    != NETC_ETH_IP_TYPES_AR_RELEASE_MAJOR_VERSION) || \
49      (NETC_ETH_IP_AR_RELEASE_MINOR_VERSION    != NETC_ETH_IP_TYPES_AR_RELEASE_MINOR_VERSION) || \
50      (NETC_ETH_IP_AR_RELEASE_REVISION_VERSION != NETC_ETH_IP_TYPES_AR_RELEASE_REVISION_VERSION))
51     #error "AUTOSAR Version Numbers of Netc_Eth_Ip.h and Netc_Eth_Ip_Types.h are different"
52 #endif
53 #if ((NETC_ETH_IP_SW_MAJOR_VERSION != NETC_ETH_IP_TYPES_SW_MAJOR_VERSION) || \
54      (NETC_ETH_IP_SW_MINOR_VERSION != NETC_ETH_IP_TYPES_SW_MINOR_VERSION) || \
55      (NETC_ETH_IP_SW_PATCH_VERSION != NETC_ETH_IP_TYPES_SW_PATCH_VERSION) \
56     )
57     #error "Software Version Numbers of Netc_Eth_Ip.h and Netc_Eth_Ip_Types.h are different"
58 #endif
59 
60 /*==================================================================================================
61 *                                            CONSTANTS
62 ==================================================================================================*/
63 
64 /*==================================================================================================
65 *                                       DEFINES AND MACROS
66 ==================================================================================================*/
67 #define ETH_43_NETC_START_SEC_CONFIG_DATA_UNSPECIFIED
68 #include "Eth_43_NETC_MemMap.h"
69 
70 NETC_ETH_IP_CONFIG_EXT
71 
72 #define ETH_43_NETC_STOP_SEC_CONFIG_DATA_UNSPECIFIED
73 #include "Eth_43_NETC_MemMap.h"
74 
75 #define NETC_ETH_IP_32BIT_SHIFT (32U)    /*!< 32 bits shift */
76 #define NETC_ETH_IP_24BIT_SHIFT (24U)    /*!< 24 bits shift */
77 #define NETC_ETH_IP_16BIT_SHIFT (16U)    /*!< 16 bits shift */
78 #define NETC_ETH_IP_8BIT_SHIFT  (8U)     /*!< 8 bits shift */
79 
80 #define NETC_ETH_IP_0XFF_MASK                           (0xFFU)
81 #define NETC_ETH_IP_0XFFFF_MASK                         (0xFFFFU)
82 #define NETC_ETH_IP_0XFFFF0000_MASK                     (0xFFFF0000UL)
83 
84 /* Macros for NTMP request message header */
85 #define NETC_ETH_IP_CMDBD_REQFMT_PROTOCOL_VERSION       (2U)      /*!< protocol version = 0x2 */
86 #define NETC_ETH_IP_CMDBD_REQFMT_NTMP_PROTOCOL_VERSION  (1U)      /*!< NTMP version is 2.0 */
87 
88 /*==================================================================================================
89 *                                              ENUMS
90 ==================================================================================================*/
91 
92 /*==================================================================================================
93 *                                  STRUCTURES AND OTHER TYPEDEFS
94 ==================================================================================================*/
95 
96 /*==================================================================================================
97 *                                  GLOBAL VARIABLE DECLARATIONS
98 ==================================================================================================*/
99 
100 #define ETH_43_NETC_START_SEC_VAR_CLEARED_UNSPECIFIED_NO_CACHEABLE
101 #include "Eth_43_NETC_MemMap.h"
102 
103 /** @brief Pointers to NETC internal driver state for each controller(SI). */
104 extern Netc_Eth_Ip_StateType *Netc_Eth_Ip_apxState[FEATURE_NETC_ETH_NUMBER_OF_CTRLS];
105 #define ETH_43_NETC_STOP_SEC_VAR_CLEARED_UNSPECIFIED_NO_CACHEABLE
106 
107 #include "Eth_43_NETC_MemMap.h"
108 
109 /*==================================================================================================
110 *                                       FUNCTION PROTOTYPES
111 ==================================================================================================*/
112 #define ETH_43_NETC_START_SEC_CODE
113 #include "Eth_43_NETC_MemMap.h"
114 
115 /*!
116  * @brief Initializes the ENETC station interface
117  *
118  * This function initializes and enables the ENETC station instance, configuring receive and transmit control
119  * settings, the receive and transmit descriptors rings and the MAC physical address.
120  *
121  * @param[in] ctrlIndex Instance number
122  * @param[in] config Pointer to the instance configuration structure
123  *
124  * @retval NETC_ETH_IP_STATUS_SUCCESS The initialization was successful.
125  * @retval NETC_ETH_IP_STATUS_TIMEOUT The initialization returned a timeout.
126  */
127 Netc_Eth_Ip_StatusType Netc_Eth_Ip_Init(uint8 ctrlIndex, const Netc_Eth_Ip_ConfigType *config);
128 
129 /**
130 * @brief            Ethernet controller function for starting TSN.
131 * @details          This function enables the statically configured TSN settings. If stream gating or time aware shaping is used, the API must be called after the clock is synchronized.
132 *                   Eth_Ip_StartTSN shall:
133 *                   - Populate all tables related to 802.1qci.
134 *
135 * @param[in]        ctrlIndex   Instance number
136 *
137 * @return           Result of the operation
138 * @retval           E_OK        success
139 * @retval           E_NOT_OK    TSN could not be started
140 */
141 Std_ReturnType Netc_Eth_Ip_StartTSN(uint8 ctrlIndex);
142 
143 /**
144  * @brief            Add or Update Ingress Stream Identification Table Entry function
145  * @details          External function for adding or updating one Ingress Stream Identification entry with "KEY_ELEMENT" access method.
146  *                   That means only "KEY_ELEMENT" access method is supported.
147  *
148  * @param[in]        ctrlIndex        Instance number
149  * @param[in]        Cmd              Add and Update commands are supported
150  * @param[out]       MatchedEntries   Number of matched entries
151  * @param[in]        ISQGTableEntry   Pointer points to a Ingress Stream Identification entry structure Netc_Eth_Ip_IngrStremIdentificationTableDataType
152  *
153  * @return           Result of the operation
154  * @retval           0 : NETC_ETH_IP_STATUS_SUCCESS, success
155  * @retval           others : fail
156  */
157 Netc_Eth_Ip_StatusType Netc_Eth_Ip_AddOrUpdateIngrStreamIdentificationTableEntry( const uint8 CtrlIndex,
158                                                                                   Netc_Eth_Ip_CommandsType Cmd,
159                                                                                   uint32 *MatchedEntries,
160                                                                                   const Netc_Eth_Ip_IngrStremIdentificationTableDataType * ISITableEntry
161                                                                                 );
162 
163 /**
164  * @brief            Query Ingress Stream Identification Table Entry function
165  * @details          External function for querying one Ingress Stream Identification entry with "KEY_ELEMENT" access method.
166  *                   That means only "KEY_ELEMENT" access method is supported.
167  *
168  * @param[in]        ctrlIndex              Instance number
169  * @param[out]       MatchedEntries         Number of matched entry
170  * @param[in]        ISITableEntry          A pointer that provides the data with the "query" operation
171  * @param[out]       ISITableEntry          A pointer that returns the data of a matched entry by "query" operation
172  *                                          The data is valid only when MatchedEntries equals 1.
173  *
174  * @return           Result of the operation
175  * @retval           0 : NETC_ETH_IP_STATUS_SUCCESS, success
176  * @retval           others : fail
177  */
178 Netc_Eth_Ip_StatusType Netc_Eth_Ip_QueryIngrStreamIdentificationTableEntry( const uint8 CtrlIndex,
179                                                                             uint32 *MatchedEntries,
180                                                                             Netc_Eth_Ip_IngrStremIdentificationTableDataType * ISITableEntry
181                                                                           );
182 
183 /**
184  * @brief            Delete Ingress Stream Identification Table Entry function
185  * @details          External function for deleting one Ingress Stream Identification entry with "KEY_ELEMENT" access method.
186  *                   That means only "KEY_ELEMENT" access method is supported.
187  *
188  * @param[in]        ctrlIndex              Instance number
189  * @param[out]       MatchedEntries         Number of matched entry
190  * @param[in]        ISITableEntry          A pointer that provides the data with the "delete" operation
191  *
192  * @return           Result of the operation
193  * @retval           0 : NETC_ETH_IP_STATUS_SUCCESS, success
194  * @retval           others : fail
195  */
196 Netc_Eth_Ip_StatusType Netc_Eth_Ip_DeleteIngrStreamIdentificationTableEntry( const uint8 CtrlIndex,
197                                                                                        uint32 *MatchedEntries,
198                                                                                        const Netc_Eth_Ip_IngrStremIdentificationTableDataType * ISITableEntry
199                                                                                      );
200 
201 /**
202  * @brief            Dump all Ingress Stream Identification Table Entries function
203  * @details          External function for dumping all Ingress Stream Identification entries with "SEARCH_CRITERIA" access method.
204  *                   That means only "SEARCH_CRITERIA" access method is supported.
205  *
206  * @param[in]        ctrlIndex              Instance number
207  * @param[in]        NumberOfElements       Number of entries that want to be dumped
208  * @param[out]       NumberOfElements       Number of entries that actually are dumped (number of existing entries)
209  * @param[out]       ISITableList           A pointer that returns the list of NumberOfElements entries
210  *
211  * @return           Result of the operation
212  * @retval           0 : NETC_ETH_IP_STATUS_SUCCESS, success
213  * @retval           others : fail
214  */
215 Netc_Eth_Ip_StatusType Netc_Eth_Ip_GetIngrStreamIdentificationTable( const uint8 CtrlIndex,
216                                                                      uint16 * NumberOfElements,
217                                                                      Netc_Eth_Ip_IngrStremIdentificationTableDataType * ISITableList
218                                                                    );
219 
220 /**
221  * @brief            Add or Update Stream Gate Instance Table Entry function
222  * @details          External function for adding or updating one Stream Gate Instance entry with "Entry ID Match" access method.
223  *                   That means only "Entry ID Match" access method is supported.
224  *
225  * @param[in]        ctrlIndex        Instance number
226  * @param[in]        Cmd              Add and Update commands are supported
227  * @param[out]       MatchedEntries   Number of matched entries
228  * @param[in]        StreamGateInstanceTableEntry    Pointer points to a Stream Gate Instance entry structure Netc_Eth_Ip_StreamGateInstanceEntryDataType
229  *
230  * @return           Result of the operation
231  * @retval           0 : NETC_ETH_IP_STATUS_SUCCESS, success
232  * @retval           others : fail
233  */
234 Netc_Eth_Ip_StatusType Netc_Eth_Ip_AddOrUpdateStreamGateInstanceTableEntry( const uint8 CtrlIndex,
235                                                                             Netc_Eth_Ip_CommandsType Cmd,
236                                                                             uint32 *MatchedEntries,
237                                                                             const Netc_Eth_Ip_StreamGateInstanceEntryDataType * StreamGateInstanceTableEntry
238                                                                            );
239 
240 /**
241  * @brief            Query Stream Gate Instance Table Entry function
242  * @details          External function for querying one Stream Gate Instance entry with "Entry ID Match" access method.
243  *                   That means only "Entry ID Match" access method is supported.
244  *
245  * @param[in]        ctrlIndex              Instance number
246  * @param[out]       MatchedEntries         Number of matched entry
247  * @param[in]        SGIEntryId             Stream Gate Instance entry ID
248  * @param[out]       SGITableEntryRspData   A pointer that returns the data of a matched entry by "query" operation
249  *                                          The data is valid only when MatchedEntries equals 1.
250  *
251  * @return           Result of the operation
252  * @retval           0 : NETC_ETH_IP_STATUS_SUCCESS, success
253  * @retval           others : fail
254  */
255 Netc_Eth_Ip_StatusType Netc_Eth_Ip_QueryStreamGateInstanceTableEntry( const uint8 CtrlIndex,
256                                                                       uint32 *MatchedEntries,
257                                                                       uint32 SGIEntryId,
258                                                                       Netc_Eth_Ip_StreamGateInstanceEntryRspDataType * SGITableEntryRspData
259                                                                     );
260 
261 /**
262  * @brief            Delete Stream Gate Instance Table Entry function
263  * @details          External function for deleting one Stream Gate Instance entry with "Entry ID Match" access method.
264  *                   That means only "Entry ID Match" access method is supported.
265  *
266  * @param[in]        ctrlIndex              Instance number
267  * @param[out]       MatchedEntries         Number of matched entry
268  * @param[in]        SGIEntryId             Stream Gate Instance entry ID
269  *
270  * @return           Result of the operation
271  * @retval           0 : NETC_ETH_IP_STATUS_SUCCESS, success
272  * @retval           others : fail
273  */
274 Netc_Eth_Ip_StatusType Netc_Eth_Ip_DeleteStreamGateInstanceTableEntry( const uint8 CtrlIndex,
275                                                                        uint32 *MatchedEntries,
276                                                                        uint32 SGIEntryId
277                                                                      );
278 
279 /**
280  * @brief            Add Stream Gate Control List Table Entry function
281  * @details          External function for adding one Stream Gate Control List entry with "Entry ID Match" access method.
282  *                   That means only "Entry ID Match" access method is supported.
283  *
284  * @param[in]        ctrlIndex        Instance number
285  * @param[in]        Cmd              Add and Update commands are supported
286  * @param[out]       MatchedEntries   Number of matched entries
287  * @param[in]        SGCLTableEntry   Pointer points to a Stream Gate Control List entry structure Netc_Eth_Ip_SGCLTableDataType
288  *
289  * @return           Result of the operation
290  * @retval           0 : NETC_ETH_IP_STATUS_SUCCESS, success
291  * @retval           others : fail
292  */
293 Netc_Eth_Ip_StatusType Netc_Eth_Ip_AddStreamGateControlListTableEntry( const uint8 CtrlIndex,
294                                                                        Netc_Eth_Ip_CommandsType Cmd,
295                                                                        uint32 *MatchedEntries,
296                                                                        const Netc_Eth_Ip_SGCLTableDataType * SGCLTableEntry
297                                                                      );
298 
299 /**
300  * @brief            Query Stream Gate Control List Table Entry function
301  * @details          External function for querying one Stream Gate Control List entry with "Entry ID Match" access method.
302  *                   That means only "Entry ID Match" access method is supported.
303  *
304  * @param[in]        ctrlIndex              Instance number
305  * @param[out]       MatchedEntries         Number of matched entry
306  * @param[in]        SGCLEntryId            Stream Gate Control List entry ID
307  * @param[in]        ListLen                Stream Gate Control List entry length, it has to be set to the same value as LIST_LENGTH when adding the entry
308  * @param[out]       SGCLTableEntryRspData  A pointer that returns the data of a matched entry by "query" operation
309  *                                          The data is valid only when MatchedEntries equals 1.
310  *
311  * @return           Result of the operation
312  * @retval           0 : NETC_ETH_IP_STATUS_SUCCESS, success
313  * @retval           others : fail
314  */
315 Netc_Eth_Ip_StatusType Netc_Eth_Ip_QueryStreamGateControlListTableEntry( const uint8 CtrlIndex,
316                                                                          uint32 *MatchedEntries,
317                                                                          uint32 SGCLEntryId,
318                                                                          uint8 ListLen,
319                                                                          Netc_Eth_Ip_SGCLTableDataType * SGCLTableEntryRspData
320                                                                        );
321 
322 /**
323  * @brief            Delete Stream Gate Control List Table Entry function
324  * @details          External function for deleting one Stream Gate Control List entry with "Entry ID Match" access method.
325  *                   That means only "Entry ID Match" access method is supported.
326  *
327  * @param[in]        ctrlIndex              Instance number
328  * @param[out]       MatchedEntries         Number of matched entry
329  * @param[in]        SGCLEntryId            Stream Gate Control List entry ID
330  *
331  * @return           Result of the operation
332  * @retval           0 : NETC_ETH_IP_STATUS_SUCCESS, success
333  * @retval           others : fail
334  */
335 Netc_Eth_Ip_StatusType Netc_Eth_Ip_DeleteStreamGateControlListTableEntry( const uint8 CtrlIndex,
336                                                                           uint32 *MatchedEntries,
337                                                                           uint32 SGCLEntryId
338                                                                         );
339 
340 /**
341  * @brief            Add or Update Ingress Stream Table Entry function
342  * @details          External function for adding or updating one Ingress Stream entry with "Entry ID Match" access method.
343  *                   That means only "Entry ID Match" access method is supported.
344  *
345  * @param[in]        ctrlIndex        Instance number
346  * @param[in]        Cmd              Add and Update commands are supported
347  * @param[out]       MatchedEntries   Number of matched entries
348  * @param[in]        IngressStreamTableEntry    Pointer points to a Ingress Stream entry structure Netc_Eth_Ip_IngressStreamEntryDataType
349  *
350  * @return           Result of the operation
351  * @retval           0 : NETC_ETH_IP_STATUS_SUCCESS, success
352  * @retval           others : fail
353  */
354 Netc_Eth_Ip_StatusType Netc_Eth_Ip_AddOrUpdateIngressStreamTableEntry( const uint8 CtrlIndex,
355                                                                        Netc_Eth_Ip_CommandsType Cmd,
356                                                                        uint32 *MatchedEntries,
357                                                                        const Netc_Eth_Ip_IngressStreamEntryDataType * IngressStreamTableEntry
358                                                                      );
359 
360 /**
361  * @brief            Query Ingress Stream Table Entry function
362  * @details          External function for querying one Ingress Stream entry with "Entry ID Match" access method.
363  *                   That means only "Entry ID Match" access method is supported.
364  *
365  * @param[in]        ctrlIndex              Instance number
366  * @param[out]       MatchedEntries         Number of matched entry
367  * @param[in]        IngressStreamEntryId     Ingress Stream table entry ID
368  * @param[out]       IngressStreamTableEntry  A pointer that returns the data of a matched entry by "query" operation
369  *                                            The data is valid only when MatchedEntries equals 1.
370  *
371  * @return           Result of the operation
372  * @retval           0 : NETC_ETH_IP_STATUS_SUCCESS, success
373  * @retval           others : fail
374  */
375 Netc_Eth_Ip_StatusType Netc_Eth_Ip_QueryIngressStreamTableEntry( const uint8 CtrlIndex,
376                                                                  uint32 *MatchedEntries,
377                                                                  uint32 IngressStreamEntryId,
378                                                                  Netc_Eth_Ip_IngressStreamEntryDataType * IngressStreamTableEntry
379                                                                );
380 
381 /**
382  * @brief            Delete Ingress Stream Table Entry function
383  * @details          External function for deleting one Ingress Stream entry with "Entry ID Match" access method.
384  *                   That means only "Entry ID Match" access method is supported.
385  *
386  * @param[in]        ctrlIndex              Instance number
387  * @param[out]       MatchedEntries         Number of matched entry
388  * @param[in]        IngressStreamEntryId     Ingress Stream entry ID
389  *
390  * @return           Result of the operation
391  * @retval           0 : NETC_ETH_IP_STATUS_SUCCESS, success
392  * @retval           others : fail
393  */
394 Netc_Eth_Ip_StatusType Netc_Eth_Ip_DeleteIngressStreamTableEntry( const uint8 CtrlIndex,
395                                                                   uint32 *MatchedEntries,
396                                                                   uint32 IngressStreamEntryId
397                                                                 );
398 
399 /**
400  * @brief            Set the credit based shaper slope
401  * @details          Set the idle slope for the credit based shaper
402  *
403  * Parameters:
404  * -[in]     ctrlIndex           Index of the controller within the context of the Ethernet Driver
405  * -[in]     TrafficClass        The value range is 0 to 7
406  * -[in]     idleSlope           Idleslope is the rate of credits that is accumulated (in bits per second)  when there  is  at  least  one packet waiting for transmission.
407  */
408 Std_ReturnType Netc_Eth_Ip_ConfigureCreditBasedShaper(const uint8 ctrlIndex, const uint8 TrafficClass, const uint64 idleSlope);
409 
410 /**
411  * @brief            Enable/Disable the credit based shaper
412  * @details          The credit based shaper TrafficClass is Enable/Disable
413  *
414  * Parameters:
415  * -[in]     ctrlIndex            Index of the controller within the context of the Ethernet Driver
416  * -[in]     TrafficClass         The value range is 0 to 7
417  * -[in]     Enable               TRUE: enable credit based shaper. FALSE: disable credit based shaper.
418  *
419  */
420 Std_ReturnType Netc_Eth_Ip_EnableCreditBasedShaper(const uint8 ctrlIndex, const uint8 TrafficClass, const boolean Enable);
421 
422 /*!
423  * @brief Gets the current power state of the NETC instance
424  *
425  * @param[in] CtrlIndex Instance number
426  * @return Netc_Eth_Ip_PowerStateType The power state of the controller
427  */
428 Netc_Eth_Ip_PowerStateType Netc_Eth_Ip_GetPowerState(uint8 CtrlIndex);
429 
430 /*!
431  * @brief Enables the specified SI.
432  *
433  * @param[in] ctrlIndex SI number
434  *
435  * @retval NETC_ETH_IP_STATUS_SUCCESS The initialization was successful.
436  */
437 Netc_Eth_Ip_StatusType Netc_Eth_Ip_EnableController(uint8 ctrlIndex);
438 
439 /*!
440  * @brief Disables the controller and resets all the configured transmit and receive buffers
441  *
442  * Warning: This function ignores all pending transmission and reception requests
443  *
444  * @param[in] ctrlIndex SI number
445  *
446  * @retval NETC_ETH_IP_STATUS_SUCCESS The controller was successfully disabled.
447  * @retval NETC_ETH_IP_STATUS_ERROR   The controller cannot be disabled because of consuming pending ring.
448  */
449 Netc_Eth_Ip_StatusType Netc_Eth_Ip_DisableController(uint8 ctrlIndex);
450 
451 /*!
452  * @brief Provides a transmit buffer to be used by the application for transmission.
453  *
454  * This function provides an internal buffer which can further be used by the application
455  * to store the transmit data.
456  *
457  * Note: The buffer will be marked as locked and won't be released until after a call to
458  * Netc_Eth_Ip_GetTransmitStatus for the same buffer returns NETC_ETH_IP_STATUS_SUCCESS.
459  *
460  * Important: The driver does not ensure synchronization between different threads trying
461  * to get a buffer at the same time. This synchronization shall be implemented by the
462  * application.
463  *
464  * @param[in]     ctrlIndex Instance number
465  * @param[in]     ring   Ring number
466  * @param[in,out] buff   In:  Buffer containing the desired length
467  *                       Out: Buffer containing the granted length or available length in case of overflow.
468  * @param[out]    buffId Index of the buffer (descriptor) within the ring.
469  *                       If this information is not needed, this parameter should be NULL_PTR.
470  * @retval NETC_ETH_IP_STATUS_SUCCESS The buffer has been successfully locked.
471  * @retval NETC_ETH_IP_STATUS_TX_BUFF_BUSY All buffers are currently in use for the current ring.
472  * @retval NETC_ETH_IP_STATUS_TX_BUFF_OVERFLOW The requested buffer length cannot be granted.
473  * @retval NETC_ETH_IP_STATUS_INVALID_FRAME_LENGTH The buffer length is smaller than minium of frame length.
474  */
475 Netc_Eth_Ip_StatusType Netc_Eth_Ip_GetTxBuff(uint8 ctrlIndex,
476                                              uint8 ring,
477                                              Netc_Eth_Ip_BufferType *buff,
478                                              uint16 *buffId);
479 
480 /*!
481  * @brief Sends an Ethernet frame
482  *
483  * This function sends an Ethernet frame, contained in the buffer received as parameter.
484  *
485  * Note: Since the transmission of the frame is not complete when this function returns,
486  * the application must not change/alter/re-use the provided buffer until after a call
487  * to Netc_Eth_Ip_GetTransmitStatus for the same buffer returns NETC_ETH_IP_STATUS_SUCCESS.
488  *
489  * Important: The driver does not ensure synchronization between different threads trying
490  * to send a frame at the same time. This synchronization shall be implemented by the
491  * application.
492  *
493  * @param[in] ctrlIndex Instance number
494  * @param[in] ring The ring number
495  * @param[in] buff The buffer containing the frame
496  * @param[in] options Configuration options applicable to this buffer's transmission only.
497  * Can be NULL_PTR, if no special option is required.
498  * @retval NETC_ETH_IP_STATUS_SUCCESS       The frame was successfully enqueued for transmission.
499  * @retval NETC_ETH_IP_STATUS_TX_BUFF_BUSY  All internal TX buffers are currently in use.
500  * @retval NETC_ETH_IP_STATUS_INVALID_FRAME_LENGTH Length of the external buffer is smaller than minium of frame length.
501  * @retval NETC_ETH_IP_STATUS_TX_BUFF_OVERFLOW The requested buffer length cannot be granted.
502  */
503 Netc_Eth_Ip_StatusType Netc_Eth_Ip_SendFrame(uint8 ctrlIndex,
504                                              uint8 ring,
505                                             Netc_Eth_Ip_BufferType * buff,
506                                              const Netc_Eth_Ip_TxOptionsType * options
507                                             );
508 
509 
510 /*!
511  * @brief Sends an Ethernet frame which is scattered in multiple buffers
512  *
513  * This function sends an Ethernet frame, contained in the buffers received as parameter.
514  *
515  * Note: Since the transmission of the frame is not complete when this function returns,
516  * the application must not change/alter/re-use the provided buffer until after a call
517  * to Netc_Eth_Ip_GetTransmitStatus for the same buffer returns NETC_ETH_IP_STATUS_SUCCESS.
518  *
519  * Important: The driver does not ensure synchronization between different threads trying
520  * to send a frame at the same time. This synchronization shall be implemented by the
521  * application.
522  *
523  * @param[in] ctrlIndex Instance number
524  * @param[in] ring The ring number
525  * @param[in] Buffers The list of buffers containing the frame
526  * @param[in] options Configuration options applicable to this buffer's transmission only.
527  *                    Can be NULL_PTR, if no special option is required.
528  * @param[in] NumBuffers Number of buffers available in Buffers
529  * @retval NETC_ETH_IP_STATUS_SUCCESS       The frame was successfully enqueued for transmission.
530  * @retval NETC_ETH_IP_STATUS_TX_BUFF_BUSY  All internal TX buffers are currently in use.
531  * @retval NETC_ETH_IP_STATUS_INVALID_FRAME_LENGTH Length of the external buffer is smaller than minium of frame length.
532  * @retval NETC_ETH_IP_STATUS_TX_BUFF_OVERFLOW The requested buffer length cannot be granted.
533  */
534 Netc_Eth_Ip_StatusType Netc_Eth_Ip_SendMultiBufferFrame(uint8 ctrlIndex,
535                                                         uint8 ring,
536                                                         Netc_Eth_Ip_BufferType Buffers[],
537                                                         const Netc_Eth_Ip_TxOptionsType *options,
538                                                         uint16 NumBuffers);
539 
540 /*!
541  * @brief Provides a transmit buffer to be used by the application for transmission.
542  *
543  * This function will verify if there are enough descriptors free and that each of
544  * the descriptors can hold the parts of the frame to be send using Netc_Eth_Ip_SendMultiBufferFrame.
545  *
546  * Note: This function will only return the first buffer descriptor index starting with which the
547  * multi buffer frame can be sent.
548  *
549  * Important: This function is meant for internal use only and will be called from an upper layer to get
550  * the first buffer descriptor index from a sequence of buffers that will be used for sending a
551  * multi buffer frame.
552  *
553  * @param[in]     ctrlIndex     Instance number
554  * @param[in]     ring          Ring number
555  * @param[in]     NumBuffers    Number of buffers
556  * @param[in]     BufferLength  List with the length of each chunk of the frame
557  * @param[out]    buffId        Index of the buffer (descriptor) within the ring.
558  * @retval NETC_ETH_IP_STATUS_SUCCESS The buffer has been successfully locked.
559  * @retval NETC_ETH_IP_STATUS_TX_BUFF_BUSY All buffers are currently in use for the current ring.
560  * @retval NETC_ETH_IP_STATUS_TX_BUFF_OVERFLOW The requested buffer length cannot be granted.
561  * @retval NETC_ETH_IP_STATUS_INVALID_FRAME_LENGTH The buffer length is smaller than minium of frame length.
562  */
563 Netc_Eth_Ip_StatusType Netc_Eth_Ip_GetTxMultiBuff(uint8 ctrlIndex,
564                                                   uint8 ring,
565                                                   uint16 NumBuffers,
566                                                   const uint16 BufferLength[],
567                                                   uint16 *buffId);
568 
569 /*!
570  * @brief Reads a received Ethernet frame
571  *
572  * This function reads the first received Ethernet frame in the Rx queue. The buffer received
573  * as parameter will be updated by the driver and the .data field will point to a memory area
574  * containing the frame data.
575  *
576  * Note: Once the application finished processing the buffer, it could be reused by the
577  * driver for further receptions by invoking Netc_Eth_Ip_ProvideRxBuff.
578  *
579  * Important: The driver does not ensure synchronization between different threads trying
580  * to read a frame at the same time. This synchronization shall be implemented by the
581  * application.
582  *
583  * @param[in]  ctrlIndex Instance number
584  * @param[in]  ring The ring number
585  * @param[out] buff The buffer containing the frame
586  * @param[out] info Enhanced information related to the data contained by this receive buffer.
587  * If this information is not needed, this parameter should be NULL_PTR.
588  * @retval NETC_ETH_IP_STATUS_SUCCESS        A frame was successfully read.
589  * @retval NETC_ETH_IP_STATUS_RX_QUEUE_EMPTY There is no available frame in the queue.
590  * @retval NETC_ETH_IP_STATUS_ERROR       There is at least an error in reception.
591  */
592 Netc_Eth_Ip_StatusType Netc_Eth_Ip_ReadFrame(uint8 ctrlIndex,
593                                              uint8 ring,
594                                              Netc_Eth_Ip_BufferType *buff,
595                                              Netc_Eth_Ip_RxInfoType *info
596                                             );
597 
598 /*!
599  * @brief Provides a receive buffer to be used by the driver for reception.
600  *
601  * This function provides a buffer which can further be used by the reception mechanism
602  * in order to store the received data.
603  *
604  * Note: The application can either provide a buffer previously obtained in a Netc_Eth_Ip_ReadFrame
605  * call (when it is no longer needed after being fully processed), or allocate a new buffer.
606  * The former approach is recommended as it has a simpler usage model and re-uses the same initial
607  * memory range for the entire driver lifetime operation. The later approach could provide more
608  * flexibility, but since it involves constant memory free/alloc operations it is only recommended
609  * with an efficient pool-based memory allocator.
610  *
611  * Important: The driver does not ensure synchronization between different threads trying
612  * to provide a buffer at the same time. This synchronization shall be implemented by the
613  * application.
614  *
615  * Important: The application is responsible for providing one Rx buffer for every frame it
616  * receives, otherwise the reception ring can fill-up, affecting further reception.
617  *
618  * Usage example:
619  *
620  * stat = Netc_Eth_Ip_ReadFrame(0U, 0U, &rxBuff);
621  *
622  * if (stat == NETC_ETH_IP_STATUS_SUCCESS)
623  * {
624  *     process_buffer(&rxBuff);
625  *     Netc_Eth_Ip_ProvideRxBuff(0U, 0U, &rxBuff);
626  * }
627  *
628  * @param[in] ctrlIndex Instance number
629  * @param[in] ring The ring number
630  * @param[in] buff The buffer to be added to the reception ring
631  */
632 Netc_Eth_Ip_StatusType Netc_Eth_Ip_ProvideRxBuff(uint8 ctrlIndex,
633                                                  uint8 ring,
634                                                  const Netc_Eth_Ip_BufferType *buff);
635 
636 /**
637  * @brief This function will be used when RX should be used at maximum capacity, instead of providing
638  *        one by one buffer for reception, a batch of buffers will be provided
639  *
640  * @param[in] CtrlIndex Instance number.
641  * @param[in] Ring      The ring number.
642  * @param[in] BuffList  This should be NULL_PTR if internal buffers are used, otherwise this should respect
643  *                  the follwing indications:
644  *                   - List of the external buffers used for descriptor restauration;
645  * @param[inout] BuffListSize [IN]  Number of buffers in list. When the internal buffers are in use, this parameter shall
646  *                                  contain the number of BD which need to be restored after a reception of a more than one packet.
647  *                            [OUT] Returns how many Buffer Descriptors have been released.
648  */
649 void Netc_Eth_Ip_ProvideMultipleRxBuff(const uint8 CtrlIndex,
650                                                          const uint8 Ring,
651                                                          uint8* BuffList[],
652                                                          uint16* BuffListSize);
653 
654 /*!
655  * @brief Checks if there are more frames available in the given queue
656  *
657  * This function takes a peek at the given Rx queue to check if there are more Ethernet
658  * frames to be received. Its intended usage is to provide this information without
659  * also extracting the frame as "Netc_Eth_Ip_ReadFrame".
660  *
661  * @param[in]  ctrlIndex Instance number
662  * @param[in]  ring The ring number
663  * @retval TRUE  There is an available frame in the queue.
664  * @retval FALSE There is no available frame in the queue.
665  */
666 boolean Netc_Eth_Ip_IsFrameAvailable(uint8 ctrlIndex,
667                                      uint8 ring
668                                     );
669 /*!
670  * @brief Checks if the transmission of a buffer is complete.
671  *
672  * This function checks if the transmission of the given buffer is complete.
673  *
674  * TODO: Descrition should be improved to indicate that this is not normally
675  * needed in regular transmit workflow since GetTxBuff already exposes HW
676  * consumption of TX entries
677  *
678  * Note: If the buffer is not found in the Tx ring, the function will return NETC_ETH_IP_STATUS_BUFF_NOT_FOUND.
679  *
680  * @param[in]  CtrlIndex Instance number
681  * @param[in]  ring The ring number
682  * @param[in]  buff The transmit buffer for which the status shall be checked
683  * @param[out] info Extended information related to the buffer. If this information is not needed,
684  * this parameter should be NULL_PTR.
685  * @retval NETC_ETH_IP_STATUS_TX_BUFF_BUSY    The frame is still enqueued for transmission.
686  * @retval NETC_ETH_IP_STATUS_BUFF_NOT_FOUND  The buffer was not found in the Tx queue.
687  * @retval NETC_ETH_IP_STATUS_ERROR        There is at least an error in transmission.
688  * @retval NETC_ETH_IP_STATUS_SUCCESS         Otherwise.
689  */
690 Netc_Eth_Ip_StatusType Netc_Eth_Ip_GetTransmitStatus(uint8 ctrlIndex,
691                                                      uint8 ring,
692                                                      const Netc_Eth_Ip_BufferType * buff,
693                                                      Netc_Eth_Ip_TxInfoType * info
694                                                     );
695 
696 /*!
697  * @brief Configures the physical address of the MAC
698  *
699  * @param[in] CtrlIndex Instance number
700  * @param[in] MacAddr The MAC address to be configured
701  *
702  * @retval NETC_ETH_IP_STATUS_SUCCESS Physical address of mac is configured successfully.
703  * @retval NETC_ETH_IP_STATUS_TIMEOUT Changing the physical address was not changed because a timeout has occured.
704  */
705 Netc_Eth_Ip_StatusType Netc_Eth_Ip_SetMacAddr(uint8 CtrlIndex, const uint8 *MacAddr);
706 
707 /**
708  * @brief Gets the physical address of the MAC for a controller.
709  *
710  * @param[in]  CtrlIndex Instance number
711  * @param[out] MacAddr The physical address of the MAC
712  */
713 void Netc_Eth_Ip_GetMacAddr(uint8 CtrlIndex, uint8 *MacAddr);
714 
715 /**
716  * @brief Gets statistics from the specified counter
717  *
718  * @param[in] CtrlIndex Instance number
719  * @param[in] Counter The counter to be read
720  * @return The low 32-bit value of the requested counter
721  */
722 uint32 Netc_Eth_Ip_GetCounter(uint8 CtrlIndex, Netc_Eth_Ip_CounterType Counter);
723 
724 /**
725  * @brief Gets statistics from the specified counter
726  *
727  * @param[in] CtrlIndex Instance number
728  * @param[in] Counter The counter to be read
729  * @return The 64-bit value of the requested counter
730  */
731 uint64 Netc_Eth_Ip_GetCounter64(uint8 CtrlIndex, Netc_Eth_Ip_CounterType Counter);
732 
733 /**
734  * @brief Adds a hardware address to the hash filter. The destination address of
735  * an incoming packet is passed through hash function and then is added as an
736  * entry in the hash table.
737  *
738  * @param[in] CtrlIndex Instance number.
739  * @param[in] MacAddr   Destination MAC address to be added in hash filter.
740  * @return Netc_Eth_Ip_StatusType NETC_ETH_IP_STATUS_SUCCESS - successfully operation
741  *                                NETC_ETH_IP_STATUS_ERROR   - unsuccessfully operation
742  *                                NETC_ETH_IP_STATUS_MAC_ADDR_TABLE_FULL - MAC table used for hash filter is full
743  *                                NETC_ETH_IP_STATUS_TIMEOUT - Only for VSIs - the command was not processed in the allotted time
744  */
745 Netc_Eth_Ip_StatusType Netc_Eth_Ip_AddMulticastDstAddrToHashFilter(const uint8 CtrlIndex, const uint8 *MacAddr);
746 
747 /**
748  * @brief Removes a hardware address from the hash filter. The destination address of
749  * an incoming packet is passed through hash function and then is removed from
750  * hash table.
751  *
752  * @param[in] CtrlIndex Instance number.
753  * @param[in] MacAddr   Destination MAC address to be removed from hash filer.
754  * @return Netc_Eth_Ip_StatusType NETC_ETH_IP_STATUS_SUCCESS - successfully operation
755  *                                NETC_ETH_IP_STATUS_ERROR   - unsuccessfully operation
756  *                                NETC_ETH_IP_STATUS_MAC_ADDR_NOT_FOUND - the current destination MAC was not
757  *                                found in the hash filter table
758  *                                NETC_ETH_IP_STATUS_TIMEOUT - Only for VSIs - the command was not processed in the allotted time
759  */
760 Netc_Eth_Ip_StatusType Netc_Eth_Ip_RemoveMulticastDstAddrFromHashFilter(const uint8 CtrlIndex, const uint8 *MacAddr);
761 
762 /**
763  * @brief Enables/Disables forwarding of the multicast traffic.
764  *
765  * @param[in]  CtrlIdx Instance number
766  * @param[in]  EnableMulticast  TRUE -> cotroller will receive all the multicast traffic;
767  *                     FALSE-> cotroller will stop receive all the multicast traffic;
768  * @return Netc_Eth_Ip_StatusType NETC_ETH_IP_STATUS_SUCCESS - successfully operation
769  *                                NETC_ETH_IP_STATUS_TIMEOUT - Only for VSIs - the command was not processed in the allotted time
770  */
771 Netc_Eth_Ip_StatusType Netc_Eth_Ip_SetMulticastForwardAll(const uint8 CtrlIndex, const boolean EnableMulticast);
772 
773 /**
774  * @brief Disable multicast promiscuous and delete all entries in multicast MAC filter table.
775  *
776  * @param[in] CtrlIdx Instance number.
777  * @return Netc_Eth_Ip_StatusType NETC_ETH_IP_STATUS_SUCCESS - successfully operation
778  *                                NETC_ETH_IP_STATUS_TIMEOUT - Only for VSIs - the command was not processed in the allotted time
779  */
780 Netc_Eth_Ip_StatusType Netc_Eth_Ip_CloseMulticastReceiving(const uint8 CtrlIndex);
781 /**
782  * @brief Realease multiple transmission buffers at once.
783  *
784  * @param CtrlIdx Instance number.
785  * @param Ring    Ring number.
786  */
787 void Netc_Eth_Ip_ReleaseTxBuffers(const uint8 CtrlIdx, const uint8 Ring);
788 
789 /**
790  * @brief Set the threshold values for Rx coalescing interrupt.
791  *
792  * @param[in]  CtrlIdx  Controller number
793  * @param[in]  RingIdx  Ring Index on which the settings will be applied.
794  * @param[in]  PacketsThreshold  No of packets after which the ISR will be triggered. Must be different than 0 in order to set the value.
795  * @param[in]  TimerThreshold  No of ticks after which the ISR will be triggered. Must be different than 0 in order to set the value.
796  *
797  *
798  * @return Netc_Eth_Ip_StatusType NETC_ETH_IP_STATUS_SUCCESS - successfully operation
799  *                                NETC_ETH_IP_STATUS_ERROR - Either the coalescing interrupt is not enabled or the No of packets passed exceedes the
800  *                                                        size of the ring.
801  */
802 Netc_Eth_Ip_StatusType Netc_Eth_Ip_SetRxCoalescingThresholds(uint8 CtrlIdx, uint8 RingIdx, uint16 PacketsThreshold, uint32 TimerThreshold);
803 
804 /**
805  * @brief Set the threshold values for Tx coalescing interrupt.
806  *
807  * @param[in]  CtrlIdx  Controller number
808  * @param[in]  RingIdx  Ring Index on which the settings will be applied.
809  * @param[in]  PacketsThreshold  No of packets after which the ISR will be triggered. Must be different than 0 in order to set the value.
810  *                               If a value which is not a power of two is passed through this parameter, than the actual number of packets configured
811  *                               will be the greatest power of two which is smaller than the parameter value.
812  * @param[in]  TimerThreshold  No of ticks after which the ISR will be triggered. Must be different than 0 in order to set the value.
813  *
814  * @return Netc_Eth_Ip_StatusType NETC_ETH_IP_STATUS_SUCCESS - successfully operation
815  *                                NETC_ETH_IP_STATUS_ERROR - Either the coalescing interrupt is not enabled or the No of packets passed is equal
816  *                                                          to or greater than the size of the ring.
817  */
818 Netc_Eth_Ip_StatusType Netc_Eth_Ip_SetTxCoalescingThresholds(uint8 CtrlIdx, uint8 RingIdx, uint16 PacketsThreshold, uint32 TimerThreshold);
819 
820 /**
821  * @brief Add/Update time gate scheduling table entry.
822  *
823  * @param[in]  CtrlIndex Instance number
824  * @param[in]  TimeGateSchedulingTableEntry  pointer to structure Netc_Eth_Ip_TimeGateSchedulingEntryDataType that contains the data of time gate scheduling entry
825  *
826  * @return Netc_Eth_Ip_StatusType NETC_ETH_IP_STATUS_SUCCESS - successfully operation
827  *                                others - error code from command ring
828  */
829 Netc_Eth_Ip_StatusType Netc_Eth_Ip_AddOrUpdateTimeGateSchedulingTableEntry( const uint8 CtrlIndex,
830                                                                             const Netc_Eth_Ip_TimeGateSchedulingEntryDataType *TimeGateSchedulingTableEntry
831                                                                           );
832 
833 /**
834  * @brief Enables/Disables time gate scheduling feature.
835  *
836  * @param[in]  CtrlIndex Instance number
837  * @param[in]  Enable  TRUE -> time gate scheduling will be enabled;
838  *                     FALSE-> time gate scheduling will be disabled;
839  * @return Netc_Eth_Ip_StatusType NETC_ETH_IP_STATUS_SUCCESS - successfully operation
840  *                                NETC_ETH_IP_STATUS_ERROR - fail to enable time gating because Operational gate control list is active
841  */
842 Netc_Eth_Ip_StatusType Netc_Eth_Ip_ConfigPortTimeGateScheduling( const uint8 CtrlIndex, const boolean Enable );
843 
844 /**
845  * @brief Add/Update rate policer table entry.
846  *
847  * @param[in]  CtrlIndex Instance number
848  * @param[in]  Cmd              Add and Update commands are supported
849  * @param[out] MatchedEntries   Number of matched entries
850  * @param[in]  RatePolicerTableEntry  pointer to structure Netc_Eth_Ip_RatePolicerEntryDataType that contains the data of rate policer entry
851  *
852  * @return Netc_Eth_Ip_StatusType NETC_ETH_IP_STATUS_SUCCESS - successfully operation
853  *                                others - error code from command ring
854  */
855 Netc_Eth_Ip_StatusType Netc_Eth_Ip_AddOrUpdateRatePolicerTableEntry( const uint8 CtrlIndex,
856                                                                      Netc_Eth_Ip_CommandsType Cmd,
857                                                                      uint32 *MatchedEntries,
858                                                                      const Netc_Eth_Ip_RatePolicerEntryDataType * RatePolicerTableEntry
859                                                                    );
860 
861 /**
862  * @brief Query rate policer table entry.
863  *
864  * @param[in]   CtrlIndex Instance number
865  * @param[out]  MatchedEntries   Number of matched entries
866  * @param[in]   RatePolicerEntryId       Rate policer table entry id
867  * @param[out]  RatePolicerTableEntry    pointer to structure Netc_Eth_Ip_RatePolicerEntryRspDataType that contains the data of rate policer entry
868  *
869  * @return Netc_Eth_Ip_StatusType NETC_ETH_IP_STATUS_SUCCESS - successfully operation
870  *                                others - error code from command ring
871  */
872 Netc_Eth_Ip_StatusType Netc_Eth_Ip_QueryRatePolicerTableEntry( const uint8 CtrlIndex,
873                                                                uint32 *MatchedEntries,
874                                                                uint32 RatePolicerEntryId,
875                                                                Netc_Eth_Ip_RatePolicerEntryRspDataType * RatePolicerTableEntry
876                                                              );
877 
878 /**
879  * @brief Delete rate policer table entry.
880  *
881  * @param[in]   CtrlIndex Instance number
882  * @param[out]  MatchedEntries   Number of matched entries
883  * @param[in]   RatePolicerEntryId       Rate policer table entry id
884  *
885  * @return Netc_Eth_Ip_StatusType NETC_ETH_IP_STATUS_SUCCESS - successfully operation
886  *                                others - error code from command ring
887  */
888 Netc_Eth_Ip_StatusType Netc_Eth_Ip_DeleteRatePolicerTableEntry( const uint8 CtrlIndex,
889                                                                 uint32 *MatchedEntries,
890                                                                 uint32 RatePolicerEntryId
891                                                               );
892 
893 /**
894  * @brief Add VLAN Filter Table entry.
895  *
896  * @param[in]  CtrlIndex Instance number
897  * @param[in]  VLANTableEntry  pointer to structure Netc_Eth_Ip_VLANFilterTableEntryDataType that contains the data of the VLAN Filter Table entry
898  *
899  * @return Netc_Eth_Ip_StatusType NETC_ETH_IP_STATUS_SUCCESS - successfully operation
900  *                                others - error code from command ring
901  */
902 Netc_Eth_Ip_StatusType Netc_Eth_Ip_AddVLANFilterTableEntry( const uint8 ctrlIndex, const Netc_Eth_Ip_VLANFilterTableEntryDataType *VLANTableEntry);
903 
904 /**
905  * @brief Query VLAN Filter Table entry. Uses the entry ID for the entry and updates the rest of the fields in the structure if the entry is found.
906  *
907  * @param[in]  CtrlIndex Instance number
908  * @param[in,out]  VLANTableEntry  pointer to structure Netc_Eth_Ip_VLANFilterTableEntryDataType that contains the data of the VLAN Filter Table entry
909  *
910  * @return Netc_Eth_Ip_StatusType NETC_ETH_IP_STATUS_SUCCESS - successfully operation
911  *                                others - error code from command ring
912  */
913 Netc_Eth_Ip_StatusType Netc_Eth_Ip_QueryVLANFilterTableEntry(const uint8 ctrlIndex, Netc_Eth_Ip_VLANFilterTableEntryDataType *VLANTableEntry);
914 
915 #if (STD_ON == NETC_ETH_IP_EXTENDED_BUFF)
916 #ifdef NETC_ETH_0_USED
917 /**
918  * @brief Set management information for a frame which will be send using management.
919  *
920  * @param CtrlIdx Instance number
921  * @param BuffIdx Unique buffer index id.
922  * @param SwitchIndex Index number of the switch to be used by the frame
923  * @param PortIndex Index identifier of the switch's port to be used by the frame
924  * @param Enable Enable/Disable management transmission on this frame.
925  */
926 Netc_Eth_Ip_StatusType Netc_Eth_Ip_ManagementFrame(const uint8 CtrlIdx, uint16 BuffIdx, uint8 SwitchIndex, uint8 PortIndex, boolean Enable);
927 
928 /**
929  * @brief Set a management frame to be sent as a timestamping one
930  * @param CtrlIdx Instance number
931  * @param BuffIdx Unique buffer index id.
932  * @param Enable Enable/Disable timestamping for this frame
933  **/
934 Netc_Eth_Ip_StatusType Netc_Eth_Ip_TimestampTxFrame(const uint8 CtrlIdx, const uint16 BuffIdx, const boolean Enable);
935 
936 /**
937  * @brief
938  *
939  * @param CtrlIndex Instance number
940  * @param Ring
941  * @return void
942  * @internal This function is not an API.
943 
944  */
945 void Netc_Eth_Ip_ReleaseUnusedTxBuff(uint8 CtrlIndex, uint8 Ring);
946 
947 /**
948  * @brief Get a pointer to the timestamp information of a particular TX frame.
949  *
950  * @param CtrlIdx Instance number
951  * @param BuffIdx Unique buffer index id.
952  * @param MgmtInfo Pointer to management information for the frame identified by BuffIdx
953  * @param TimestampInfo Pointer to timestamp information for the frame identified by BuffIdx
954  * @return Netc_Eth_Ip_StatusType NETC_ETH_IP_STATUS_SUCCESS - succesfully returned a pointer to the latest timestamp information
955  *                                NETC_ETH_IP_STATUS_ERROR - no timestamp information found for the requested frame
956  */
957 Netc_Eth_Ip_StatusType Netc_Eth_Ip_GetTxTimestampInfo(const uint8 CtrlIdx, const uint32 BuffIdx, Netc_Eth_Ip_TxManagementInfoType **MgmtInfo, Netc_Eth_Ip_TxTimestampInfoType **TimestampInfo);
958 
959 #endif /* NETC_ETH_0_USED */
960 
961 /**
962  * @brief Get a pointer to the Ingress timestamp information of a particular RX frame.
963  *
964  * @param[in] CtrlIdx - Index of the SI.
965  * @param[in] DataPtr - Data buffer address of the received frame for which the timestamp information is requested.
966  * @param[out] RxTimestampInfo  Pointer to the timestamp information.
967  * @return Netc_Eth_Ip_StatusType NETC_ETH_IP_STATUS_SUCCESS - succesfully returned a pointer to the latest timestamp information
968  *                                NETC_ETH_IP_STATUS_ERROR - no timestamp information found for the requested frame
969  */
970 Netc_Eth_Ip_StatusType Netc_Eth_Ip_GetRxTimestampInfo(const uint8 CtrlIdx, const uint8 *DataPtr, Netc_Eth_Ip_RxTimestampInfoType **RxTimestampInfo);
971 
972 #endif /* STD_ON == NETC_ETH_IP_EXTENDED_BUFF */
973 
974 /**
975  * @brief Function updates the time pointer value with the current sys time
976  *
977  * @param ctrlIndex Index of the Eth controller.
978  * @param TimePtr Current time stamp pointer
979  */
980 void Netc_Eth_Ip_GetSysTime(uint8 ctrlIndex, Netc_Eth_Ip_TimeType *TimePtr);
981 
982 /**
983  * @brief Function de-initialises VSI controller.
984  * PSI de-init not supported since it will also reset all VSIs
985  * VSI-PSI messaging interrupt needs to be configured for the VSI reconfiguration, done by the PSI
986  *
987  * @param ctrlIndex Index of the Eth controller.
988  * @retval NETC_ETH_IP_STATUS_SUCCESS The de-initialization was successful.
989  * @retval NETC_ETH_IP_STATUS_TIMEOUT The de-initialization returned a timeout.
990  */
991 Netc_Eth_Ip_StatusType Netc_Eth_Ip_Deinit(uint8 ctrlIndex);
992 
993 /**
994  * @brief Checks the status of a transmissions and releases the resources
995  * @internal This function is not an API, but an internal function that needs to be used in the upper layer.
996  *
997  *
998  * @param ctrlIndex             Index of the SI.
999  * @param ring                  Ring Number.
1000  * @param ConsumerIndex         Consumer read from HW.
1001  * @param buff                  Buffer address.
1002  * @param info                  Parameter where the timestamp and the the transmission status can be provided for the transmitted frame.
1003  * @return Netc_Eth_Ip_StatusType NETC_ETH_IP_STATUS_SUCCESS - successfully operation
1004  *                                NETC_ETH_IP_STATUS_TIMEOUT - Only for VSIs - the command was not processed in time
1005  * @internal This function is not an API.
1006  */
1007 Netc_Eth_Ip_StatusType Netc_Eth_Ip_CheckFrameStatus(uint8 ctrlIndex,
1008                                                     uint8 ring,
1009                                                     uint32 ConsumerIndex,
1010                                                     const uint8 *buff,
1011                                                     Netc_Eth_Ip_TxInfoType *info);
1012 
1013 /**
1014  * @brief The Pcie Event Collector Interrupt handler
1015  * @internal This function is not an API. It must be added in the Interrupt Controller configuration as a handler.
1016  *
1017  * @param ctrlIndex             Index of the SI.
1018  * @return void
1019  */
1020 void Netc_Eth_Ip_PCIe_AER_Handler(uint8 ctrlIndex);
1021 
1022 /**
1023  * @brief         Enable/Disable the ingress port filter feature on ENETC port
1024  *
1025  * @param[in]     CtrlIndex            Index of the controller within the context of the Ethernet Driver
1026  * @param[in]     Enable               TRUE: enable ingress port filter feature. FALSE: disable ingress port filter feature.
1027  *
1028  */
1029 Std_ReturnType Netc_Eth_Ip_EnableIngressPortFiltering(const uint8 CtrlIndex, boolean Enable );
1030 
1031 /**
1032  * @brief Add ingress port filter table entry.
1033  *
1034  * @param[in]   CtrlIndex Instance number
1035  * @param[out]  MatchedEntries   Number of matched entries
1036  * @param[in]   IngressPortFilterTableEntry    pointer to structure Netc_Eth_Ip_IngressPortFilterEntryDataType that contains the data of ingress port filter entry
1037  * @param[out]  IngressPortFilterTableEntry    pointer to structure Netc_Eth_Ip_IngressPortFilterEntryDataType that contains the data of ingress port filter entry
1038  *
1039  * @return Netc_Eth_Ip_StatusType NETC_ETH_IP_STATUS_SUCCESS - successfully operation
1040  *                                others - error code from command ring
1041  */
1042 Netc_Eth_Ip_StatusType Netc_Eth_Ip_AddIngressPortFilterTableEntry( uint8 CtrlIndex,
1043                                                                    uint32 *MatchedEntries,
1044                                                                    Netc_Eth_Ip_IngressPortFilterEntryDataType * IngressPortFilterTableEntry
1045                                                                  );
1046 
1047 /**
1048  * @brief Query ingress port filter table entry.
1049  *
1050  * @param[in]   CtrlIndex Instance number
1051  * @param[out]  MatchedEntries   Number of matched entries
1052  * @param[in]   IngressPortFilterTableEntry    pointer to structure Netc_Eth_Ip_IngressPortFilterEntryDataType that contains the data of ingress port filter entry
1053  * @param[out]  IngressPortFilterTableEntry    pointer to structure Netc_Eth_Ip_IngressPortFilterEntryDataType that contains the data of ingress port filter entry
1054  *
1055  * @return Netc_Eth_Ip_StatusType NETC_ETH_IP_STATUS_SUCCESS - successfully operation
1056  *                                others - error code from command ring
1057  */
1058 Netc_Eth_Ip_StatusType Netc_Eth_Ip_QueryIngressPortFilterTableEntry( const uint8 CtrlIndex,
1059                                                                      uint32 *MatchedEntries,
1060                                                                      Netc_Eth_Ip_IngressPortFilterEntryDataType * IngressPortFilterTableEntry
1061                                                                    );
1062 
1063 /**
1064  * @brief Delete ingress port filter table entry.
1065  *
1066  * @param[in]   CtrlIndex Instance number
1067  * @param[out]  MatchedEntries   Number of matched entries
1068  * @param[in]   IngressPortFilterEntryId       Ingress port filter table entry id
1069  *
1070  * @return Netc_Eth_Ip_StatusType NETC_ETH_IP_STATUS_SUCCESS - successfully operation
1071  *                                others - error code from command ring
1072  */
1073 Netc_Eth_Ip_StatusType Netc_Eth_Ip_DeleteIngressPortFilterTableEntry( const uint8 CtrlIndex,
1074                                                                       uint32 *MatchedEntries,
1075                                                                       uint32 IngressPortFilterEntryId
1076                                                                     );
1077 
1078 
1079 /**
1080  * @brief This function dumps the Error Capture registers for a specific PCIE device (function).
1081 * @param[in]  ctrlIndex                Index of the SI. Input Parameter
1082 * @param[in]  function                 The PCIE function for which the error statistics are requested.Input Parameter
1083 * @param[out] numberOfRegisters        This is an output parameter. The function returns the number of statistics registers that have been written in the Buffer parameter.
1084 * @param[in]  siIndex                  This is an input parameter. Must be used only if he function is VSI or PSI. For PSI it must be set to 0 while for VSI must be set to the index of the SI.
1085 *                                      For other functions(ENET, TIMER, SWITCH, EMDIO), this parameter is ignored.
1086 * @param[in]  Buffers                  Array of pointers to Netc_Eth_Ip_ErrorCaptureRegisterInformation structures.
1087         *                              Application MUST allocate enough space for the maximum number of
1088         *                              registers that could have a function for Error detailing.
1089         *                              Netc driver offers two macros: NETC_ETH_IP_MAX_UNCORRECTABLE_ERROR_REPORTING_STATISTICS_LENGTH for the maximum number of
1090         *                              uncorrectable errors status registers among the PCIE function supported and
1091         *                              NETC_ETH_IP_MAX_CORRECTABLE_ERROR_REPORTING_STATISTICS_LENGTH for the maximum number of
1092         *                              correctable errors status registers among the PCIE function supported.
1093  * @return void
1094  */
1095 void Netc_Eth_Ip_DumpErrorCapture (     const uint8 ctrlIdx,
1096                                         const Netc_Eth_Ip_PcieFunction function,
1097                                         uint8 *numberOfRegisters,
1098                                         uint8 siIndex,
1099                                         Netc_Eth_Ip_ErrorCaptureRegisterInformation* const Buffers[]);
1100 
1101 /**
1102  * @brief This function gets Timer Syncronization State function.
1103 * @param[in]  CtrlIndex                Index of the SI. Input Parameter
1104 * @param[out]  SyncState                 Timer Syncronization State
1105 *
1106 * @return          Netc_Eth_Ip_StatusType
1107 * @retval          NETC_ETH_IP_STATUS_SUCCESS: successful.
1108 * @retval          NETC_ETH_IP_STATUS_TIMEOUT: failed
1109 */
1110 Netc_Eth_Ip_StatusType Netc_Eth_Ip_GetSyncState( const uint8 CtrlIndex,
1111                                                 boolean *SyncState);
1112 /*
1113  * @brief Query statistics Receive Flow Steering table entry.
1114  *
1115  * @param[in]   ctrlIndex Instance number
1116  * @param[in]   RfsTableEntry   Rfs Entry for querying
1117  * @param[out]  MatchedFramesNb    Number of matched frames
1118  *
1119  * @return Netc_Eth_Ip_StatusType NETC_ETH_IP_STATUS_SUCCESS - successfully operation
1120  *                                others - error code from command ring
1121  */
1122 Netc_Eth_Ip_StatusType Netc_Eth_Ip_QueryStatisticsRfsTableEntry(const uint8 ctrlIndex,
1123                                                                 uint8 RfsEntryIdx,
1124                                                                  uint32 * MatchedFramesNb);
1125 
1126 /**
1127  * @brief Query Receive Flow Steering table entry.
1128  *
1129  * @param[in]   ctrlIndex Instance number
1130  * @param[in]   RfsTableEntry   Rfs Entry for querying
1131  * @param[out]  RfsTableEntryAddr    Address of matched rfs entry
1132  *
1133  * @return Netc_Eth_Ip_StatusType NETC_ETH_IP_STATUS_SUCCESS - successfully operation
1134  *                                others - error code from command ring
1135  */
1136 Netc_Eth_Ip_StatusType Netc_Eth_Ip_QueryRfsTableEntry(const uint8 ctrlIndex,
1137                                                                 uint8 RfsEntryIdx,
1138                                                                  uint32 * RfsTableEntryAddr);
1139 
1140 /**
1141  * @brief Add Receive Flow Steering table entry.
1142  *
1143  * @param[in]   ctrlIndex Instance number
1144  * @param[in]   RfsTableEntry   Rfs Entry to add
1145  *
1146  * @return Netc_Eth_Ip_StatusType NETC_ETH_IP_STATUS_SUCCESS - successfully operation
1147  *                                others - error code from command ring
1148  */
1149 Netc_Eth_Ip_StatusType Netc_Eth_Ip_AddRfsTableEntry(const uint8 ctrlIndex,
1150                                                      const Netc_Eth_Ip_RfsEntryType * RfsTableEntry);
1151 
1152 /**
1153  * @brief This function sets SIs MAC address.
1154 * @param[in]  CtrlIndex           Index of the current controller. Input Parameter
1155 * @param[in]  SiId                Index of the SI which will have the MAC address changed. Input Parameter
1156 * @param[in]  MacAddr             MAC address. Input Parameter
1157 *
1158 * @return          Netc_Eth_Ip_StatusType
1159 * @retval          NETC_ETH_IP_STATUS_SUCCESS: successful.
1160 * @retval          NETC_ETH_IP_STATUS_UNSUPPORTED: SI identified by ctrlIndex parameter has type different than PSI
1161 */
1162 Netc_Eth_Ip_StatusType Netc_Eth_Ip_SetSiPhysAddr( const uint8 CtrlIndex,
1163                                                     const uint8 SiId,
1164                                                     const uint8 *MacAddr);
1165 
1166 #if defined(ERR_IPV_NETC_051247)
1167     #if (STD_ON == ERR_IPV_NETC_051247)
1168 /**
1169  * @brief This function calculates CRC8 for the VSItoPSI message
1170 * @param[in]  MsgCommandConfig           Pointer to the message
1171 * @param[in]  MsgLength                  Message length
1172 *
1173 * @return          uint8
1174 * @retval          resulted crc
1175 */
1176 uint8 Netc_Eth_Ip_VsiMsgCalculateCRC8(const Netc_Eth_Ip_VsiToPsiMsgType *MsgCommandConfig,
1177                                                     uint8 MsgLength);
1178     #endif
1179 #endif
1180 
1181 #if defined(NETC_ETH_IP_FILL_LEVEL_API_ENABLE)
1182 #if (NETC_ETH_IP_FILL_LEVEL_API_ENABLE == STD_ON)
1183 /**
1184  * @brief Get data on how much of a Tx Ring is occupied
1185  * @param[in]   CtrlIndex           Index of the current controller
1186  * @param[in]   RingIdx             Index of the queried Tx ring on the controller
1187  * @param[in]   FillInfo            Pointer to data structure to be populated with information about the Tx ring
1188  *
1189  * @return Netc_Eth_Ip_StatusType NETC_ETH_IP_STATUS_SUCCESS - successful operation
1190  *                                others - function called with invalid parameters or null pointers
1191 */
1192 Netc_Eth_Ip_StatusType Netc_Eth_Ip_GetTxRingFillLevel(const uint8 CtrlIndex, const uint8 RingIdx, Netc_Eth_Ip_FillLevelInfo * FillInfo);
1193 
1194 /**
1195  * @brief Get data on how much of a Rx Ring is occupied
1196  * @param[in]   CtrlIndex           Index of the current controller
1197  * @param[in]   RingIdx             Index of the queried Rx ring on the controller
1198  * @param[in]   FillInfo            Pointer to data structure to be populated with information about the Rx ring
1199  *
1200  * @return Netc_Eth_Ip_StatusType NETC_ETH_IP_STATUS_SUCCESS - successful operation
1201  *                                others - function called with invalid parameters or null pointers
1202 */
1203 Netc_Eth_Ip_StatusType Netc_Eth_Ip_GetRxRingFillLevel(const uint8 CtrlIndex, const uint8 RingIdx, Netc_Eth_Ip_FillLevelInfo * FillInfo);
1204 #endif  /* STD_ON == NETC_ETH_IP_FILL_LEVEL_API_ENABLE  */
1205 #endif /* defined(NETC_ETH_IP_FILL_LEVEL_API_ENABLE) */
1206 
1207 #define ETH_43_NETC_STOP_SEC_CODE
1208 #include "Eth_43_NETC_MemMap.h"
1209 
1210 #ifdef __cplusplus
1211 }
1212 #endif
1213 
1214 /** @} */
1215 
1216 #endif
1217