1 /*
2  * Copyright 2021-2022 NXP
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #ifndef NETC_ETHSWT_IP_H
8 #define NETC_ETHSWT_IP_H
9 
10 /**
11  *   @file Netc_EthSwt_Ip.h
12  *   @addtogroup NETC_ETHSWT_IP NETC_ETHSWT Driver
13  *   @{
14  */
15 
16 #ifdef __cplusplus
17 extern "C"{
18 #endif
19 
20 /*==================================================================================================
21 *                                          INCLUDE FILES
22 * 1) system and project includes
23 * 2) needed interfaces from external units
24 * 3) internal and external interfaces from this unit
25 ==================================================================================================*/
26 #include "Mcal.h"
27 #include "Netc_EthSwt_Ip_Types.h"
28 #include "Netc_EthSwt_Ip_Cfg.h"
29 
30 /*==================================================================================================
31 *                                 SOURCE FILE VERSION INFORMATION
32 ==================================================================================================*/
33 #define NETC_ETHSWT_IP_VENDOR_ID                    43
34 #define NETC_ETHSWT_IP_MODULE_ID                    89
35 #define NETC_ETHSWT_IP_AR_RELEASE_MAJOR_VERSION     4
36 #define NETC_ETHSWT_IP_AR_RELEASE_MINOR_VERSION     7
37 #define NETC_ETHSWT_IP_AR_RELEASE_REVISION_VERSION  0
38 #define NETC_ETHSWT_IP_SW_MAJOR_VERSION             0
39 #define NETC_ETHSWT_IP_SW_MINOR_VERSION             9
40 #define NETC_ETHSWT_IP_SW_PATCH_VERSION             0
41 
42 /*==================================================================================================
43 *                                       FILE VERSION CHECKS
44 ==================================================================================================*/
45 #ifndef DISABLE_MCAL_INTERMODULE_ASR_CHECK
46 
47 /* Check if current file and Mcal.h header file are of the same Autosar version */
48 #if ((NETC_ETHSWT_IP_AR_RELEASE_MAJOR_VERSION != MCAL_AR_RELEASE_MAJOR_VERSION) || \
49      (NETC_ETHSWT_IP_AR_RELEASE_MINOR_VERSION != MCAL_AR_RELEASE_MINOR_VERSION)    \
50     )
51     #error "AutoSar Version Numbers of Netc_EthSwt_Ip.h and Mcal.h are different"
52 #endif
53 #endif
54 
55 /* Checks against Netc_EthSwt_Ip_Types.h */
56 #if (NETC_ETHSWT_IP_VENDOR_ID !=  NETC_ETHSWT_IP_TYPES_VENDOR_ID)
57     #error "Netc_EthSwt_Ip.h and Netc_EthSwt_Ip_Types.h have different vendor ids"
58 #endif
59 #if (( NETC_ETHSWT_IP_AR_RELEASE_MAJOR_VERSION    !=  NETC_ETHSWT_IP_TYPES_AR_RELEASE_MAJOR_VERSION) || \
60      ( NETC_ETHSWT_IP_AR_RELEASE_MINOR_VERSION    !=  NETC_ETHSWT_IP_TYPES_AR_RELEASE_MINOR_VERSION) || \
61      ( NETC_ETHSWT_IP_AR_RELEASE_REVISION_VERSION !=  NETC_ETHSWT_IP_TYPES_AR_RELEASE_REVISION_VERSION))
62      #error "AUTOSAR Version Numbers of Netc_EthSwt_Ip.h and Netc_EthSwt_Ip_Types.h are different"
63 #endif
64 #if (( NETC_ETHSWT_IP_SW_MAJOR_VERSION !=  NETC_ETHSWT_IP_TYPES_SW_MAJOR_VERSION) || \
65      ( NETC_ETHSWT_IP_SW_MINOR_VERSION !=  NETC_ETHSWT_IP_TYPES_SW_MINOR_VERSION) || \
66      ( NETC_ETHSWT_IP_SW_PATCH_VERSION !=  NETC_ETHSWT_IP_TYPES_SW_PATCH_VERSION))
67     #error "Software Version Numbers of Netc_EthSwt_Ip.h and Netc_EthSwt_Ip_Types.h are different"
68 #endif
69 
70 /* Checks against Netc_EthSwt_Ip_Cfg.h */
71 #if (NETC_ETHSWT_IP_VENDOR_ID !=  NETC_ETHSWT_IP_CFG_VENDOR_ID)
72     #error "Netc_EthSwt_Ip.h and Netc_EthSwt_Ip_Cfg.h have different vendor ids"
73 #endif
74 #if (( NETC_ETHSWT_IP_AR_RELEASE_MAJOR_VERSION    !=  NETC_ETHSWT_IP_CFG_AR_RELEASE_MAJOR_VERSION) || \
75      ( NETC_ETHSWT_IP_AR_RELEASE_MINOR_VERSION    !=  NETC_ETHSWT_IP_CFG_AR_RELEASE_MINOR_VERSION) || \
76      ( NETC_ETHSWT_IP_AR_RELEASE_REVISION_VERSION !=  NETC_ETHSWT_IP_CFG_AR_RELEASE_REVISION_VERSION))
77      #error "AUTOSAR Version Numbers of Netc_EthSwt_Ip.h and Netc_EthSwt_Ip_Cfg.h are different"
78 #endif
79 #if (( NETC_ETHSWT_IP_SW_MAJOR_VERSION !=  NETC_ETHSWT_IP_CFG_SW_MAJOR_VERSION) || \
80      ( NETC_ETHSWT_IP_SW_MINOR_VERSION !=  NETC_ETHSWT_IP_CFG_SW_MINOR_VERSION) || \
81      ( NETC_ETHSWT_IP_SW_PATCH_VERSION !=  NETC_ETHSWT_IP_CFG_SW_PATCH_VERSION))
82     #error "Software Version Numbers of Netc_EthSwt_Ip.h and Netc_EthSwt_Ip_Cfg.h are different"
83 #endif
84 /*==================================================================================================
85 *                                            CONSTANTS
86 ==================================================================================================*/
87 #define NETC_ETHSWT_IP_NOMATCHEDPORTMACADDR                (255U)
88 /*==================================================================================================
89 *                                       DEFINES AND MACROS
90 ==================================================================================================*/
91 #define ETHSWT_43_NETC_START_SEC_CONFIG_DATA_UNSPECIFIED
92 #include "EthSwt_43_NETC_MemMap.h"
93 
94 NETC_ETHSWT_CONFIG_EXT
95 
96 #define ETHSWT_43_NETC_STOP_SEC_CONFIG_DATA_UNSPECIFIED
97 #include "EthSwt_43_NETC_MemMap.h"
98 
99 /* Base address of the registers for the MAC Ports */
100 extern Netc_EthSwt_Ip_PortBaseType* Netc_EthSwt_Ip_PortBaseTable[];
101 
102 /* Base address of the registers for the pseudo Port */
103 extern Netc_EthSwt_Ip_PseudoPortBaseType* Netc_EthSwt_Ip_PseudoPortBaseTable[];
104 extern SW_PORT0_Type *Netc_EthSwt_Ip_SW0_PortxBaseAddr[NETC_ETHSWT_NUMBER_OF_PORTS];
105 
106 /* Ingress Port Filter Entry ID for mirroing */
107 extern uint32 MirroringIngressPortFilterEntryId;
108 
109 #define NETC_ETHSWT_IP_MACADDRLEN  (6U)                             /*!< mac addr length */
110 #define NETC_ETHSWT_IP_BITMAPLEN   (24U)                            /*!< bit map length */
111 #define NETC_ETHSWT_IP_32BIT_SHIFT (32U)                            /*!< 32 bits shift */
112 #define NETC_ETHSWT_IP_24BIT_SHIFT (24U)                            /*!< 24 bits shift */
113 #define NETC_ETHSWT_IP_16BIT_SHIFT (16U)                            /*!< 16 bits shift */
114 #define NETC_ETHSWT_IP_8BIT_SHIFT  (8U)                             /*!< 8 bits shift */
115 
116 #define NETC_ETHSWT_IP_0XFF_MASK                           (0xFFU)
117 #define NETC_ETHSWT_IP_0XFFFF_MASK                         (0xFFFFU)
118 #define NETC_ETHSWT_IP_0XFFFF0000_MASK                     (0xFFFF0000UL)
119 
120 #define NETC_ETHSWT_IP_CBDR_NUM                            (2U)      /*!< number of switch commang ring */
121 #define NETC_ETHSWT_IP_CBDR_0                              (0U)      /*!< switch command ring 0 */
122 #define NETC_ETHSWT_IP_CBDR_1                              (1U)      /*!< switch command ring 1 */
123 
124 #define NETC_ETHSWT_IP_CBDR0_LENGTH                        (2U)      /*!< size of command ring 0. 2 means the size is 16 because it is in sets of 8 BDs */
125 #define NETC_ETHSWT_IP_SET_OF_BD                           (8U)       /*!< set of BD */
126 #define NETC_ETHSWT_IP_ACTUAL_CBDR0_LENGTH                 ((NETC_ETHSWT_IP_CBDR0_LENGTH) * (NETC_ETHSWT_IP_SET_OF_BD)) /*!< CBDR0 length */
127 #define NETC_ETHSWT_IP_CBDR1_LENGTH                        (2U)      /*!< size of command ring 1. 2 means the size is 16 because it is in sets of 8 BDs */
128 #define NETC_ETHSWT_IP_ACTUAL_CBDR1_LENGTH                 ((NETC_ETHSWT_IP_CBDR1_LENGTH) * 8U) /*!< CBDR1 length */
129 
130 #define NETC_ETHSWT_IP_CBD_ALIGNED_SIZE                    (128U)    /*!< 128-byte aligned memory for command buffer descriptors */
131 #define NETC_ETHSWT_IP_TABLE_ALIGNED_SIZE                  (16U)     /*!< 16-byte aligned memory for command tables */
132 
133 /* Macros for NTMP request message header */
134 #define NETC_ETHSWT_IP_CMDBD_REQFMT_PROTOCOL_VERSION       (2U)      /*!< protocol version = 0x2 */
135 #define NETC_ETHSWT_IP_CMDBD_REQFMT_NTMP_PROTOCOL_VERSION  (1U)      /*!< NTMP version is 2.0 */
136 
137 /* MDIO related defines */
138 #define NETC_ETHSWT_IP_MDIO_CLK_DIV                        (200U)   /*!< MDIO clock divisor, it has to be set to 0x40 */
139 #define NETC_ETHSWT_IP_MDIO_REG_READ_FLAG                  (0x80000003U)    /*!< An MDIO transaction is occurring, and MDIO read error occurs */
140 #define NETC_ETHSWT_IP_MDIO_REG_WRITE_FLAG                 (0x80000001U)    /*!< An MDIO transaction is occurring  */
141 /*==================================================================================================
142 *                                              ENUMS
143 ==================================================================================================*/
144 
145 /*==================================================================================================
146 *                                  STRUCTURES AND OTHER TYPEDEFS
147 ==================================================================================================*/
148 
149 /*==================================================================================================
150                                  GLOBAL VARIABLE DECLARATIONS
151 ==================================================================================================*/
152 
153 /*==================================================================================================
154                                      FUNCTION PROTOTYPES
155 ==================================================================================================*/
156 #define ETHSWT_43_NETC_START_SEC_CODE
157 #include "EthSwt_43_NETC_MemMap.h"
158 
159 /**
160 * @brief            Ethernet Switch switch initialization function.
161 * @details          Initializes the indexed swtich with a given configuration for the switch index
162 *                   EthSwt_Ip_Init shall:
163 *                   - Configure all configuration parameters (e.g. port structure, VLAN configuration, ...)
164 *                     at all ports of the switch and the switch itself.
165 *                   - Perform a soft reset
166 *                   - Youri: Not initial version but should: After resetting the switch and
167 *                     EthSwtLowPowerModeSupport set to TRUE, the Ethernet switch shall
168 *                     enter an inactive or low power mode. If EthSwtLowPowerModeSupport is not defined or set to
169 *                     FALSE the Ethernet switch shall enter an active state
170 *
171 * @param[in]        SwitchIdx   Index of the switch within the context of the Ethernet Switch Driver
172 *                   Config      Structure for the initialization
173 *
174 * @return           Result of the operation
175 * @retval           E_OK        success
176 * @retval           E_NOT_OK    switch could not be initialized
177 *
178 * @api
179 *
180 */
181 Std_ReturnType Netc_EthSwt_Ip_Init(uint8 SwitchIdx, const Netc_EthSwt_Ip_ConfigType * Config);
182 
183 /**
184 * @brief            Ethernet Switch read transceiver reg function.
185 * @details          Generic API for reading the content of a transceiver register
186 *
187 * @param[in]        SwitchIdx       Index of the switch within the context of the Ethernet Switch Driver
188 *                   SwitchPortIdx   Index of the port at the addressed switch
189 *                   RegIdx          Index of the register
190 *
191 * @param[out]       RegVal       Pointer to the register content
192 *
193 * @return           Result of the operation
194 * @retval           E_OK        success
195 * @retval           E_NOT_OK    drop counter could not be obtained
196 *
197 * @api
198 *
199 */
200 Std_ReturnType Netc_EthSwt_Ip_ReadTrcvRegister( uint8 SwitchIdx, uint8 TrcvIdx, uint8 RegIdx, uint16 * RegVal );
201 
202 /**
203 * @brief            Ethernet Switch read transceiver reg function.
204 * @details          Generic API for reading the content of a transceiver register
205 *
206 * @param[in]        SwitchIdx       Index of the switch within the context of the Ethernet Switch Driver
207 *                   TrcvIdx         Index of the transceiver referenced by port
208 *                   RegIdx          Index of the register
209 *                   RegVal          Content for the indexed register
210 *
211 * @return           Result of the operation
212 * @retval           E_OK        success
213 * @retval           E_NOT_OK    drop counter could not be obtained
214 *
215 * @api
216 *
217 *
218 */
219 Std_ReturnType Netc_EthSwt_Ip_WriteTrcvRegister( uint8 SwitchIdx, uint8 TrcvIdx, uint8 RegIdx, uint16 RegVal );
220 
221 /**
222  * @brief   Ethernet Switch write transceiver reg function.
223  * @details Generic API for writing the content of a transceiver register
224  *
225     @param[in]      SwitchIdx       Index of the switch within the context of the Ethernet Switch Driver
226 *                   TrcvIdx         Index of the transceiver referenced by port
227 *                   RegIdx          Index of the register
228 *                   RegVal          Content for the indexed register
229  *
230  * @return Result of the operation
231  * @retval E_OK        success
232  * @retval E_NOT_OK    The indexed switch port could not be set to PortMode
233  *
234  */
235 Std_ReturnType Netc_EthSwt_Ip_SetPortMode(uint8 SwitchIdx,
236                                           uint8 SwitchPortIdx,
237                                           boolean PortEnable);
238 
239 /**
240 * @brief            Ethernet Switch Get switch port mode function.
241 * @details          Obtains the mode of the indexed switch port
242 *                   The function EthSwt_GetPortMode shall read the mode of the indexed port of the switch.
243 *
244 * @param[in]        SwitchIdx       Index of the switch within the context of the Ethernet Switch Driver
245 *                   SwitchPortIdx   Index of the port at the addressed switch
246 *
247 * @param[out]       PortEnable     FALSE: the port of the switch is disabled
248 *                                  TRUE: the port of the switch is enabled
249 *
250 * @return           Result of the operation
251 * @retval           E_OK        success
252 * @retval           E_NOT_OK    The mode of the indexed switch port could not be obtained.
253 *
254 * @api
255 *
256 *
257 */
258 Std_ReturnType Netc_EthSwt_Ip_GetPortMode( uint8 SwitchIdx,
259                                            uint8 SwitchPortIdx,
260                                            boolean *PortEnable
261                                            );
262 
263 /**
264 * @brief            Ethernet Switch get baud rate function.
265 * @details          Obtains the baud rate of the indexed switch port
266 *                   The function EthSwt_GetBaudRate shall read the current baud rate of the indexed switch port.
267 *
268 * @param[in]        SwitchIdx       Index of the switch within the context of the Ethernet Switch Driver
269 *                   SwitchPortIdx   Index of the port at the addressed switch
270 *
271 * @param[out]       BaudRate     ETHTRCV_BAUD_RATE_10MBIT: 10MBit connection
272 *                                ETHTRCV_BAUD_RATE_100MBIT: 100MBit connection
273 *                                ETHTRCV_BAUD_RATE_1000MBIT: 1000MBit connection
274 *
275 * @return           Result of the operation
276 * @retval           E_OK        success
277 * @retval           E_NOT_OK    Baud rate of the indexed switch port could not be obtained
278 *
279 * @api
280 *
281 */
282 Std_ReturnType Netc_EthSwt_Ip_GetPortSpeed( uint8 SwitchIdx,
283                                             uint8 SwitchPortIdx,
284                                             EthTrcv_BaudRateType * BaudRate
285                                           );
286 
287 /**
288 * @brief            Ethernet Switch set baud rate function.
289 * @details          Set the baud rate of the indexed switch port
290 *                   The function EthSwt_SetBaudRate shall set the current baud rate of the indexed switch port.
291 *
292 * @param[in]        SwitchIdx       Index of the switch within the context of the Ethernet Switch Driver
293 *                   SwitchPortIdx   Index of the port at the addressed switch
294 *                   BaudRate     ETHTRCV_BAUD_RATE_10MBIT: 10MBit connection
295 *                                ETHTRCV_BAUD_RATE_100MBIT: 100MBit connection
296 *                                ETHTRCV_BAUD_RATE_1000MBIT: 1000MBit connection
297 *
298 * @return           Result of the operation
299 * @retval           E_OK        success
300 * @retval           E_NOT_OK    Baud rate of the indexed switch port could not be changed
301 *
302 * @api
303 *
304 */
305 Std_ReturnType Netc_EthSwt_Ip_SetPortSpeed( uint8 SwitchIdx, uint8 SwitchPortIdx, EthTrcv_BaudRateType BaudRate);
306 
307 /**
308 * @brief            Ethernet Switch get duplex mode function.
309 * @details          Obtains the duplex mode of the indexed switch port
310 *                   The function EthSwt_GetDuplexMode shall read the current duplex mode of the indexed switch
311 *                   port.
312 *
313 * @param[in]        SwitchIdx       Index of the switch within the context of the Ethernet Switch Driver
314 *                   SwitchPortIdx   Index of the port at the addressed switch
315 *
316 * @param[out]       DuplexModePtr   ETHTRCV_DUPLEX_MODE_HALF: half duplex connections
317 *                                   ETHTRCV_DUPLEXMODE_FULL: full duplex connection
318 *
319 * @return           Result of the operation
320 * @retval           E_OK        success
321 * @retval           E_NOT_OK    duplex mode of the indexed switch port could not be obtained
322 *
323 * @api
324 *
325 */
326 Std_ReturnType Netc_EthSwt_Ip_GetDuplexMode( uint8 SwitchIdx,
327                                              uint8 SwitchPortIdx,
328                                              EthTrcv_DuplexModeType * DuplexMode
329                                            );
330 
331 /**
332  * @brief       This function sets the MAC address of a certain
333  * @description This will be used to set the MAC address asignated to a certain port of the switch
334  *
335  * @param[in]  switchIndex  the index of the switch
336  * @param[in]  portIndex    the index of the port
337  * @param[out] macAddr      The physical address of the port
338  *
339  * @return      0: E_OK
340  *             1: E_NOT_OK, portIndex error
341  * @api
342  *
343  */
344 Std_ReturnType Netc_EthSwt_Ip_SetMacAddr(uint8 SwitchIdx, uint8 portIndex, const uint8 *macAddr);
345 
346 /**
347  * @brief       This function reads the MAC address of a certain port
348  * @description This will be used to read the MAC address asignated to a certain port of the switch
349  *
350  * @param[in]  switchIndex  the index of the switch
351  * @param[in]  portIndex    the index of the port
352  * @param[out] macAddr      The physical address of the port
353  *
354  * @api
355  *
356  */
357 void Netc_EthSwt_Ip_GetMacAddr(uint8 SwitchIdx, uint8 portIndex, uint8 *macAddr);
358 
359 /**
360 * @brief            Ethernet Switch get port MAC address function.
361 * @details          Obtains the port over which this MAC-address at the indexed switch can be reached.
362 *                   The result might be used for a DHCP-server which will need the port - MAC-resolution.
363 *                   If for the PortIdxPtr the maximal possible value (255) is returned the given MAC address cannot
364 *                   be reached via a port of this switch. If multiple ports were found the API returns E_NOT_OK.
365 *
366 * @param[in]        SwitchIdx    The switch index
367 *                   cbdrIndex:   Index of switch command BD rings
368 *                   Fid:         Filtering ID
369 *                   MacAddr      MAC-address for which a switch port is searched over which the node with this
370 *                                MAC-address can be reached.
371 *
372 * @param[out]       PortIdxPtr      Pointer to the port index
373 *
374 * @return           Result of the operation
375 * @retval           E_OK        success
376 * @retval           E_NOT_OK    multiple ports were found
377 *
378 * @api
379 *
380 */
381 Std_ReturnType Netc_EthSwt_Ip_GetPortMacAddr( uint8 SwitchIdx, uint16 Fid, const uint8 * MacAddr, uint8 * PortIdx);
382 
383 
384 /**
385 * @brief            Ethernet Switch get counter values function.
386 * @details          Reads a list with drop counter values of the corresponding port of the switch.
387 *                   The meaning of these values is described at Netc_EthSwt_Ip_CounterType.
388 *
389 * @param[in]        SwitchIdx       Index of the switch within the context of the Ethernet Switch Driver
390 *                   SwitchPortIdx   Index of the port at the addressed switch
391 *
392 * @param[out]       Counter      counter values. The meaning of these values is described at Netc_EthSwt_Ip_CounterType
393 *
394 * @return           Result of the operation
395 * @retval           E_OK        success
396 * @retval           E_NOT_OK    counter values read failure
397 *
398 * @api
399 *
400 */
401 Std_ReturnType Netc_EthSwt_Ip_GetCounters( uint8 SwitchIdx, uint8 SwitchPortIdx, Netc_EthSwt_Ip_CounterType *Counter );
402 
403 /**
404  * @brief         Ethernet Switch get single counter value function.
405  * @details       Reads a single drop counter value of the corresponding port of the switch.
406  *                The meaning of these values is described at Netc_EthSwt_Ip_SingleCounterType.
407  *
408  * @param[in]     SwitchIdx       Index of the switch within the context of the Ethernet Switch Driver
409  *                SwitchPortIdx   Index of the port at the addressed switch
410  *
411  * @param[in]    Counter         single counter register offset
412  *
413  * @return       Single counter value. The meaning of these values is described at Netc_EthSwt_Ip_SingleCounterType.
414  *
415  *
416  * @api
417  *
418  */
419 Netc_EthSwt_Ip_CounterValueType Netc_EthSwt_Ip_GetCounter( uint8 SwitchIdx, uint8 SwitchPortIdx, Netc_EthSwt_Ip_SingleCounterType Counter );
420 
421 /**
422 * @brief            Ethernet switch enable VLAN function.
423 * @details          Enables or disables a pre-configured VLAN at a certain port of a switch.
424 *
425 * @param[in]        SwitchIdx       Index of the switch within the context of the Ethernet Switch Driver
426 *                   SwitchPortIdx   Index of the port at the addressed switch
427 *                   VlanId          VLAN-ID to a preconfigured configuration on the given ingress port
428 *                   Enable          1 = VLAN-configuration enabled
429 *                                   0 = VLAN-configuration disabled (frames with given VLAN-ID will be dropped)
430 *
431 * @return           Result of the operation
432 * @retval           E_OK        success
433 * @retval           E_NOT_OK    Query command error or no mached Vlan ID entry found
434 *
435 * @api
436 *
437 */
438 Std_ReturnType Netc_EthSwt_Ip_EnableVlan( uint8 SwitchIdx, uint8 SwitchPortIdx, uint16 VlanId, boolean Enable );
439 
440 /**
441 * @brief            Ethernet switch set MAC learning mode function.
442 * @details          Sets the MAC learning mode in one of the tree modes:
443 *                   1) HW learning enabled
444 *                   2) Hardware learning disabled
445 *
446 * @param[in]        SwitchIdx       Index of the switch within the context of the Ethernet Switch Driver
447 * @param[in]        MacLearningMode Defines whether MAC addresses shall be learned and if they shall be learned in software or hardware
448 *
449 * @return           Result of the operation
450 * @retval           E_OK        success
451 * @retval           E_NOT_OK    configuration could be persistently reset
452 *
453 * @api
454 *
455 */
456 Std_ReturnType Netc_EthSwt_Ip_SetMacLearningMode( uint8 SwitchIdx, Netc_EthSwt_Ip_MacLearningOptionType MacLearningMode );
457 
458 /**
459 * @brief            Ethernet switch get MAC learning mode function.
460 * @details          Returns the MAC learning mode:
461 *                   1) HW learning enabled
462 *                   2) Hardware learning disabled
463 *
464 * @param[in]        SwitchIdx       Index of the switch within the context of the Ethernet Switch Driver
465 *
466 * @param[out]       MacLearningMode Defines whether MAC addresses shall be learned and if they shall be learned in software or hardware
467 *
468 * @return           Result of the operation
469 * @retval           E_OK        success
470 * @retval           E_NOT_OK    configuration could be persistently reset
471 *
472 * @api
473 *
474 */
475 Std_ReturnType Netc_EthSwt_Ip_GetMacLearningMode( uint8 SwitchIdx, Netc_EthSwt_Ip_MacLearningOptionType * MacLearningMode );
476 
477 /**
478 * @brief            Ethernet switch get loopback state function.
479 * @details          Obtain the current status of the port loopback for the indexed external Ethernet switch port
480 *
481 * @param[in]        SwitchIdx       Index of the switch within the context of the Ethernet Switch Driver
482 *                   SwitchPortIdx   Index of the port at the addressed switch
483 *
484 * @param[out]       LoopbackEnable  Pointer to the memory where the port loopback mode true/false
485 *
486 * @return           Result of the operation
487 * @retval           E_OK        the requested port loopback state for the indexed Ethernet switch port was set successfully.
488 * @retval           E_NOT_OK    the port loopback configuration for the indexed Ethernet switch returned not successfully.
489 *                               (i.e. indexed ethernet switch is not available)
490 *
491 * @api
492 *
493 */
494 Std_ReturnType Netc_EthSwt_Ip_PortGetLoopbackMode( uint8 SwitchIdx,
495                                                    uint8 SwitchPortIdx,
496                                                    boolean * LoopbackEnable
497                                                   );
498 
499 /**
500 * @brief            Ethernet switch set loopback state function.
501 * @details          Set the current state of port loopback for the indexed Ethernet external switch port
502 *
503 * @param[in]        SwitchIdx       Index of the switch within the context of the Ethernet Switch Driver
504 *                   SwitchPortIdx   Index of the port at the addressed switch
505 *                   LoopbackEnable  Contain the requested port loopback mode
506 *
507 * @return           Result of the operation
508 * @retval           E_OK        the port loopback state for the indexed Ethernet switch port was set successfully.
509 * @retval           E_NOT_OK    the port loopback configuration for the indexed Ethernet switch was not set successfully.
510 *                               (i.e. indexed ethernet switch is not available)
511 *
512 * @api
513 *
514 */
515 Std_ReturnType Netc_EthSwt_Ip_PortSetLoopbackMode( uint8 SwitchIdx,
516                                                    uint8 SwitchPortIdx,
517                                                    boolean LoopbackEnable
518                                                   );
519 
520 /**
521  * @brief            Reset configuration of switch
522  * @details          External function for reseting the learned entries from the FDB table of the switch..
523  *
524  * @param[in]        SwitchIdx  Index of the switch within the context of the Ethernet Switch Driver
525  *
526  * @return           Result of the operation
527  * @retval           E_OK :  reset dynamic FDB entries successfully
528  * @retval           E_NOT_OK : fail to reset dynamic FDB entries
529  */
530 Std_ReturnType Netc_EthSwt_Ip_ResetConfiguration(uint8 SwitchIdx);
531 
532 /**
533  * @brief            Get Fdb Table Entry List function
534  * @details          External function for getting existing FDB table entries in command ring 0.
535  *                   Provide the static entries first and then the dynamic entries if the value of NumberOfElements is not 0.
536  *
537  * @param[in]        SwitchIdx        Index of the switch within the context of the Ethernet Switch Driver
538  * @param[in]        NumberOfElements Maximum number of entries which can be written into the FdbTableList
539  * @param[out]       NumberOfElements Number of available entries which are currently be written into the FdbTableList
540  * @param[out]       FdbTableList     A pointer points to a list of FDB entry structure Netc_EthSwt_Ip_FdbEntryDataType
541  *
542  * @return           Result of the operation
543  * @retval           0 :  success
544  * @retval           others : fail
545  */
546 Std_ReturnType Netc_EthSwt_Ip_GetFdbTable(uint8 SwitchIdx, uint16 * NumberOfElements, Netc_EthSwt_Ip_FdbEntryDataType * FdbTableList);
547 
548 /**
549  * @brief            Search Fdb Table Entry function
550  * @details          External function for searching existing FDB table entries one by one in command ring 0.
551  *
552  * @param[in]        SwitchIdx          Index of the switch within the context of the Ethernet Switch Driver
553  * @param[in]        ResumeEntryId      To start the search, ResumeEntryId should be set to 0xFFFFFFFF
554  * @param[in]        SearchCriteriaData The data of match criteria and match data. To start a specific search, you have to fill in SearchCriteriaData with Netc_EthSwt_Ip_FDBTableMatchCriteriaDataType
555  *                                      and its corresponding match data (ACTE data, CFGE data or KEYE data).
556  * @param[out]       ResumeEntryId      The next valid Entry ID that is used to continue the search. If ResumeEntryId equals 0xFFFFFFFF, then that means (a)the search is completed
557  *                                      or (b)there is no matched entry found.
558  * @param[out]       FdbTableEntry      A pointer points to a FDB entry structure Netc_EthSwt_Ip_FdbEntryDataType.
559  *
560  * @return           Result of the operation
561  * @retval           0 :  success
562  * @retval           others : fail
563  */
564 Std_ReturnType Netc_EthSwt_Ip_SearchFdbTable( uint8 SwitchIdx,
565                                               uint32 * ResumeEntryId,
566                                               const Netc_EthSwt_Ip_FDBTableSearchCriteriaDataType * SearchCriteriaData,
567                                               Netc_EthSwt_Ip_FdbEntryDataType * FdbTableEntry
568                                             );
569 
570 /**
571  * @brief            Query Fdb Table Entry function
572  * @details          External function for querying one FDB entry with "Exact Match Key Element Match" access method.
573  *                   That means only "Exact Match Key Element Match" access method is supported.
574  *
575  * @param[in]        SwitchIdx       Index of the switch within the context of the Ethernet Switch Driver
576  * @param[out]       MatchedEntries  Number of matched entry
577  * @param[in]        FdbTableEntry   Pointer points to a FDB entry structure Netc_EthSwt_Ip_FdbEntryDataType
578  *                                   which provides the data for "query" operation
579  * @param[out]       FdbTableEntry   A pointer that returns the data of a matched entry by "query" operation
580  *                                   The data is valid only when MatchedEntries equals 1.
581  *
582  * @return           Result of the operation
583  * @retval           0 : NETC_ETHSWT_CBDRSTATUS_SUCCES, success
584  * @retval           others : fail
585  */
586 Netc_EthSwt_Ip_CBDRStatusType Netc_EthSwt_Ip_QueryFdbTableEntry( uint8 SwitchIdx,
587                                                                  uint32 *MatchedEntries,
588                                                                  Netc_EthSwt_Ip_FdbEntryDataType * FdbTableEntry
589                                                                );
590 
591 /**
592  * @brief            Delete Fdb Table Entry function
593  * @details          External function for deleting one FDB entry with "Exact Match Key Element Match" access method.
594  *                   That means only "Exact Match Key Element Match" access method is supported.
595  *
596  * @param[in]        SwitchIdx       Index of the switch within the context of the Ethernet Switch Driver
597  * @param[out]       MatchedEntries  Number of matched entry
598  * @param[in]        FdbTableEntry   Pointer points to a FDB entry structure Netc_EthSwt_Ip_FdbEntryDataType
599  *
600  * @return           Result of the operation
601  * @retval           0 : NETC_ETHSWT_CBDRSTATUS_SUCCES, success
602  * @retval           others : fail
603  */
604 Netc_EthSwt_Ip_CBDRStatusType Netc_EthSwt_Ip_DeleteFdbTableEntry( uint8 SwitchIdx,
605                                                                   uint32 *MatchedEntries,
606                                                                   const Netc_EthSwt_Ip_FdbEntryDataType * FdbTableEntry
607                                                                 );
608 
609 /**
610  * @brief            Add or Update Fdb Table Entry function
611  * @details          External function for adding or updating one FDB entry with "Exact Match Key Element Match" access method.
612  *                   That means only "Exact Match Key Element Match" access method is supported.
613  *
614  * @param[in]        SwitchIdx        Index of the switch within the context of the Ethernet Switch Driver
615  * @param[in]        Cmd              Add, Update and AddOrUpdate commands are supported
616  * @param[out]       MatchedEntries   Number of matched entries
617  * @param[in]        FdbTableEntry    Pointer points to a FDB entry structure Netc_EthSwt_Ip_FdbEntryDataType
618  *
619  * @return           Result of the operation
620  * @retval           0 : NETC_ETHSWT_CBDRSTATUS_SUCCES, success
621  * @retval           others : fail
622  */
623 Netc_EthSwt_Ip_CBDRStatusType Netc_EthSwt_Ip_AddOrUpdateFdbTableEntry( uint8 SwitchIdx, Netc_EthSwt_Ip_CommandsType Cmd, uint32 *MatchedEntries, const Netc_EthSwt_Ip_FdbEntryDataType * FdbTableEntry);
624 
625 /**
626  * @brief   Query the Switch Hardware Version
627  * @details External function for Query Switch Hardware Version
628  *
629  * @param[in]  SwitchIdx  Index of the switch within the context of the Ethernet Switch Driver
630  * @param[out] HwVersion  The switch hardware version.
631  *
632  * @return Result of the operation
633  * @retval E_OK : success
634  */
635 Std_ReturnType Netc_EthSwt_Ip_GetSwitchIdentifier(uint8 SwitchIdx, uint32 *HwVersion);
636 
637 /**
638  * @brief            Get Vlan filter Table Entry List function
639  * @details          External function for getting existing Vlan filter table entries in command ring 0.
640  *
641  * @param[in]        SwitchIdx               Index of the switch within the context of the Ethernet Switch Driver
642  * @param[in]        NumberOfElements        Maximum number of entries which can be written into the VlanFilterTableList
643  * @param[out]       NumberOfElements        Number of available entries which are currently be written into the VlanFilterTableList
644  * @param[out]       VlanFilterTableList     A pointer points to a list of Vlan filter entry structure Netc_EthSwt_Ip_VlanFilterEntryDataType
645  *
646  * @return           Result of the operation
647  * @retval           0 :  success
648  * @retval           others : fail
649  */
650 Std_ReturnType Netc_EthSwt_Ip_GetVlanFilterTable( uint8 SwitchIdx, uint16 * NumberOfElements, Netc_EthSwt_Ip_VlanFilterEntryDataType * VlanFilterTableList );
651 
652 /**
653  * @brief            Add or Update Vlan Filter Table Entry function
654  * @details          External function for adding or updating one Vlan Filter entry to command ring with "Exact Match Key Element Match" access method.
655  *                   That means only "Exact Match Key Element Match" access method is supported.
656  *
657  * @param[in]        SwitchIdx              Index of the switch within the context of the Ethernet Switch Driver
658  * @param[in]        Cmd                    Add, Update and AddOrUpdate commands are supported
659  * @param[out]       MatchedEntries         Number of matched entries
660  * @param[in]        VlanFilterTableEntry:  Pointer points to a Vlan Filter entry structure Netc_EthSwt_Ip_VlanFilterEntryDataType
661  *
662  * @return           Result of the operation
663  * @retval           0 : NETC_ETHSWT_CBDRSTATUS_SUCCES, success
664  * @retval           others : fail
665  */
666 Netc_EthSwt_Ip_CBDRStatusType Netc_EthSwt_Ip_AddOrUpdateVlanFilterTableEntry( uint8 SwitchIdx,
667                                                                               Netc_EthSwt_Ip_CommandsType Cmd,
668                                                                               uint32 *MatchedEntries,
669                                                                               const Netc_EthSwt_Ip_VlanFilterEntryDataType * VlanFilterTableEntry
670                                                                             );
671 
672 /**
673  * @brief            Query Vlan Filter Table Entry function
674  * @details          External function for querying one Vlan Filter entry with "full query" and "Exact Match Key Element Match" access method.
675  *                   That means only "Exact Match Key Element Match" access method is supported.
676  *
677  * @param[in]        SwitchIdx                Index of the switch within the context of the Ethernet Switch Driver
678  * @param[out]       MatchedEntries           Number of matched entries
679  * @param[in]        VlanFilterTableEntry:    A pointer that provides the data needed by "query" operation, like Vlan Filter entry Id
680  * @param[out]       VlanFilterTableEntry:    A pointer that returns the data of a matched entry by "query" operation
681  *                                            The data is valid only when MatchedEntries equals 1.
682  *
683  * @return           Result of the operation
684  * @retval           0 : NETC_ETHSWT_CBDRSTATUS_SUCCES, success
685  * @retval           others : fail
686  */
687 Netc_EthSwt_Ip_CBDRStatusType Netc_EthSwt_Ip_QueryVlanFilterTableEntry( uint8 SwitchIdx,
688                                                                         uint32 *MatchedEntries,
689                                                                         Netc_EthSwt_Ip_VlanFilterEntryDataType * VlanFilterTableEntry
690                                                                       );
691 
692 /**
693  * @brief            Delete Vlan Filter Table Entry function
694  * @details          External function for deleting one Vlan Filter entry with "Exact Match Key Element Match" access method.
695  *
696  * @param[in]        SwitchIdx                Index of the switch within the context of the Ethernet Switch Driver
697  * @param[out]       MatchedEntries           Number of matched entries
698  * @param[in]        VlanFilterTableEntryId:  Vlan Filter entry Id
699  *
700  * @return           Result of the operation
701  * @retval           0 : NETC_ETHSWT_CBDRSTATUS_SUCCES, success
702  * @retval           others : fail
703  */
704 Netc_EthSwt_Ip_CBDRStatusType Netc_EthSwt_Ip_DeleteVlanFilterTableEntry( uint8 SwitchIdx,
705                                                                          uint32 *MatchedEntries,
706                                                                          uint32 VlanFilterTableEntryId
707                                                                        );
708 
709 /**
710  * @brief            Query Egress Count Table Entry function
711  * @details          External function for querying one Egress Count entry with "Entry Id Match" access method.
712  *
713  * @param[in]        SwitchIdx              Index of the switch within the context of the Ethernet Switch Driver
714  * @param[out]       EntryId                Egress Counter Entry ID (EC_EID), an index to an entry in Egress Count Table.
715  *                                          The EC_EID is specified in the Egress Treatment table.
716  * @param[out]       MatchedEntries         Number of matched entries
717  * @param[out]       StatisticsData:        Pointer points to an Egress Count entry structure Netc_EthSwt_Ip_ECTableStatisticsDataType.
718  *                                          It contains the data of Enqueued Frame Count and Rejected Frame Count.
719  *
720  * @return           Result of the operation
721  * @retval           0 : NETC_ETHSWT_CBDRSTATUS_SUCCES, success
722  * @retval           others : fail
723  */
724 Netc_EthSwt_Ip_CBDRStatusType Netc_EthSwt_Ip_QueryEgressCountTableEntry( uint8 SwitchIdx,
725                                                                          uint32 EntryId,
726                                                                          uint32 *MatchedEntries,
727                                                                          Netc_EthSwt_Ip_ECTableStatisticsDataType *StatisticsData
728                                                                        );
729 
730 /**
731  * @brief            Reset Egress Count Table Entry function
732  * @details          External function for reseting one Egress Count entry with "Entry Id Match" access method.
733  *
734  * @param[in]        SwitchIdx              Index of the switch within the context of the Ethernet Switch Driver
735  * @param[out]       EntryId                Egress Counter Entry ID (EC_EID), an index to an entry in Egress Count Table.
736  *                                          The EC_EID is specified in the Egress Treatment table.
737  * @param[out]       MatchedEntries         Number of matched entries.
738  *                                          1: found a matched entry and reset the statistics data of the entry successfully.
739  *                                          0: no matched entry found.
740  *
741  * @return           Result of the operation
742  * @retval           0 : NETC_ETHSWT_CBDRSTATUS_SUCCES, success
743  * @retval           others : fail
744  */
745 Netc_EthSwt_Ip_CBDRStatusType Netc_EthSwt_Ip_ResetEgressCountTableEntry( uint8 SwitchIdx,
746                                                                          uint32 EntryId,
747                                                                          uint32 *MatchedEntries
748                                                                        );
749 
750 /**
751  * @brief            Add or Update Egress Treatment Table Entry function
752  * @details          External function for adding or updating one Egress Treatment entry to command ring with "Entry Id Match" access method.
753  *                   That means only "Entry Id Match" access method is supported.
754  *
755  * @param[in]        SwitchIdx                  Index of the switch within the context of the Ethernet Switch Driver
756  * @param[in]        Cmd                        Add, Update and AddOrUpdate commands are supported
757  * @param[out]       MatchedEntries             Number of matched entries
758  * @param[in]        EgressTreatmentTableEntry: Pointer points to a Egress Treatment entry structure Netc_EthSwt_Ip_EgressTreatmentEntryDataType
759  *
760  * @return           Result of the operation
761  * @retval           0 : NETC_ETHSWT_CBDRSTATUS_SUCCES, success
762  * @retval           others : fail
763  */
764 Netc_EthSwt_Ip_CBDRStatusType Netc_EthSwt_Ip_AddOrUpdateEgressTreatmentTableEntry( uint8 SwitchIdx,
765                                                                                    Netc_EthSwt_Ip_CommandsType Cmd,
766                                                                                    uint32 *MatchedEntries,
767                                                                                    const Netc_EthSwt_Ip_EgressTreatmentEntryDataType * EgressTreatmentTableEntry
768                                                                                  );
769 
770 /**
771  * @brief            Query Egress Treatment Table Entry function
772  * @details          External function for querying one Egress Treatment entry with "Entry Id Match" access method.
773  *
774  * @param[in]        SwitchIdx                      Index of the switch within the context of the Ethernet Switch Driver
775  * @param[in]        EgressTreatmentTableEntry      A pointer that provides the data needed by "query" operation
776  * @param[out]       MatchedEntries                 Number of matched entries
777  * @param[out]       EgressTreatmentTableEntry      A pointer that returns the data of a matched entry by "query" operation
778  *                                                  The data is valid only when MatchedEntries equals 1.
779  *
780  * @return           Result of the operation
781  * @retval           0 : NETC_ETHSWT_CBDRSTATUS_SUCCES, success
782  * @retval           others : fail
783  */
784 Netc_EthSwt_Ip_CBDRStatusType Netc_EthSwt_Ip_QueryEgressTreatmentTableEntry( uint8 SwitchIdx,
785                                                                              uint32 *MatchedEntries,
786                                                                              Netc_EthSwt_Ip_EgressTreatmentEntryDataType * EgressTreatmentTableEntry
787                                                                            );
788 
789 /**
790  * @brief            Delete Egress Treatment Table Entry function
791  * @details          External function for deleting one Egress Treatment entry with "Entry Id Match" access method.
792  *
793  * @param[in]        SwitchIdx                      Index of the switch within the context of the Ethernet Switch Driver
794  * @param[in]        EgressTreatmentTableEntryId    Egress Treatment Entry ID, an index to an entry in Egress Treatment Table.
795  * @param[out]       MatchedEntries                 Number of matched entries
796  *
797  * @return           Result of the operation
798  * @retval           0 : NETC_ETHSWT_CBDRSTATUS_SUCCES, success
799  * @retval           others : fail
800  */
801 Netc_EthSwt_Ip_CBDRStatusType Netc_EthSwt_Ip_DeleteEgressTreatmentTableEntry( uint8 SwitchIdx,
802                                                                               uint32 EgressTreatmentTableEntryId,
803                                                                               uint32 *MatchedEntries
804                                                                             );
805 /**
806  * @brief            Add or Update Frame Modification Table Entry function
807  * @details          External function for adding or updating one Frame Modification entry to command ring with "Entry Id Match" access method.
808  *                   That means only "Entry Id Match" access method is supported.
809  *
810  * @param[in]        SwitchIdx                  Index of the switch within the context of the Ethernet Switch Driver
811  * @param[in]        Cmd                        Add, Update and AddOrUpdate commands are supported
812  * @param[out]       MatchedEntries             Number of matched entries
813  * @param[in]        FrmModificationTableEntry: Pointer points to a Frame Modification entry structure Netc_EthSwt_Ip_FrmModificationEntryDataType
814  *
815  * @return           Result of the operation
816  * @retval           0 : NETC_ETHSWT_CBDRSTATUS_SUCCES, success
817  * @retval           others : fail
818  */
819 Netc_EthSwt_Ip_CBDRStatusType Netc_EthSwt_Ip_AddOrUpdateFrmModificationTableEntry( uint8 SwitchIdx,
820                                                                                    Netc_EthSwt_Ip_CommandsType Cmd,
821                                                                                    uint32 *MatchedEntries,
822                                                                                    const Netc_EthSwt_Ip_FrmModificationEntryDataType * FrmModificationTableEntry
823                                                                                  );
824 
825 /**
826  * @brief            Query Frame Modification Table Entry function
827  * @details          External function for querying one Frame Modification entry with "Entry Id Match" access method.
828  *
829  * @param[in]        SwitchIdx                      Index of the switch within the context of the Ethernet Switch Driver
830  * @param[in]        FrmModificationTableEntry      A pointer that provides the data needed by "query" operation
831  * @param[out]       MatchedEntries                 Number of matched entries
832  * @param[out]       FrmModificationTableEntry      A pointer that returns the data of a matched entry by "query" operation
833  *                                                  The data is valid only when MatchedEntries equals 1.
834  *
835  * @return           Result of the operation
836  * @retval           0 : NETC_ETHSWT_CBDRSTATUS_SUCCES, success
837  * @retval           others : fail
838  */
839 Netc_EthSwt_Ip_CBDRStatusType Netc_EthSwt_Ip_QueryFrmModificationTableEntry( uint8 SwitchIdx,
840                                                                              uint32 *MatchedEntries,
841                                                                              Netc_EthSwt_Ip_FrmModificationEntryDataType * FrmModificationTableEntry
842                                                                             );
843 
844 /**
845  * @brief            Delete Frame Modification Table Entry function
846  * @details          External function for deleting one Frame Modification entry with "Entry Id Match" access method.
847  *
848  * @param[in]        SwitchIdx                      Index of the switch within the context of the Ethernet Switch Driver
849  * @param[in]        FrmModificationEntryID         Frame Modification Entry ID, an index to an entry in Frame Modification Table.
850  * @param[out]       MatchedEntries                 Number of matched entries
851  *
852  * @return           Result of the operation
853  * @retval           0 : NETC_ETHSWT_CBDRSTATUS_SUCCES, success
854  * @retval           others : fail
855  */
856 Netc_EthSwt_Ip_CBDRStatusType Netc_EthSwt_Ip_DeleteFrmModificationTableEntry( uint8 SwitchIdx,
857                                                                               uint32 FrmModificationEntryID,
858                                                                               uint32 *MatchedEntries
859                                                                             );
860 
861 /**
862  * @brief            Add Ingress Port Filter Table Entry function
863  * @details          External function for adding ingress port filter table entry to command ring with "NETC_ETHSWT_TERNARY_MATCH_KEY_ELEMENT_MATCH" access method.
864  *
865  * @param[in]        SwitchIdx                    Index of the switch within the context of the Ethernet Switch Driver
866  * @param[out]       MatchedEntries               Number of matched entries
867  * @param[in]        IngressPortFilterTableEntry  Pointer points to an ingress port filter table entry structure Netc_EthSwt_Ip_IngressPortFilterEntryDataType
868  *
869  * @return           Result of the operation
870  * @retval           0 : NETC_ETHSWT_CBDRSTATUS_SUCCES, success
871  * @retval           others : fail
872  */
873 Netc_EthSwt_Ip_CBDRStatusType Netc_EthSwt_Ip_AddIngressPortFilterTableEntry( uint8 SwitchIdx,
874                                                                              uint32 *MatchedEntries,
875                                                                              Netc_EthSwt_Ip_IngressPortFilterEntryDataType * IngressPortFilterTableEntry
876                                                                            );
877 
878 /**
879  * @brief            Query Ingress Port Filter Table Entry function
880  * @details          External function for querying one Ingress Port Filter Table entry with "Entry Id Match" access method.
881  *
882  * @param[in]        SwitchIdx                        Index of the switch within the context of the Ethernet Switch Driver
883  * @param[in]        IngressPortFilterTableEntry      A pointer that provides the data needed by "query" operation, Entry_ID specifically
884  * @param[out]       MatchedEntries                   Number of matched entries
885  * @param[out]       IngressPortFilterTableEntry      A pointer that returns the data of a matched entry by "query" operation
886  *                                                    The data is valid only when MatchedEntries equals 1.
887  *
888  * @return           Result of the operation
889  * @retval           0 : NETC_ETHSWT_CBDRSTATUS_SUCCES, success
890  * @retval           others : fail
891  */
892 Netc_EthSwt_Ip_CBDRStatusType Netc_EthSwt_Ip_QueryIngressPortFilterTableEntry( uint8 SwitchIdx,
893                                                                                uint32 *MatchedEntries,
894                                                                                Netc_EthSwt_Ip_IngressPortFilterEntryDataType * IngressPortFilterTableEntry
895                                                                              );
896 
897 /**
898  * @brief            Delete Ingress Port Filter Table Entry function
899  * @details          External function for deleting one Ingress Port Filter entry with "Entry Id Match" access method.
900  *
901  * @param[in]        SwitchIdx                      Index of the switch within the context of the Ethernet Switch Driver
902  * @param[in]        IngressPortFilterEntry         Ingress Port Filter Entry ID
903  * @param[out]       MatchedEntries                 Number of matched entries
904  *
905  * @return           Result of the operation
906  * @retval           0 : NETC_ETHSWT_CBDRSTATUS_SUCCES, success
907  * @retval           others : fail
908  */
909 Netc_EthSwt_Ip_CBDRStatusType Netc_EthSwt_Ip_DeleteIngressPortFilterTableEntry( uint8 SwitchIdx,
910                                                                                 uint32 *MatchedEntries,
911                                                                                 uint32 IngressPortFilterEntry
912                                                                               );
913 
914 /**
915  * @brief            Enable Ingress Port Filter Table Entry lookup function for ports
916  * @details          External function for enabling Ingress Port Filter entry lookup functions for ports.
917  *
918  * @param[in]        SwitchIdx                      Index of the switch within the context of the Ethernet Switch Driver
919  * @param[in]        SwitchPortIdx                  Index of the port at the addressed switch
920  * @param[in]        Enable                         Enable or disable the lookup function
921  *
922  * @return           Result of the operation
923  * @retval           E_OK : success
924  * @retval           others : fail
925  */
926 Std_ReturnType Netc_EthSwt_Ip_EnableIngressPortFiltering( uint8 SwitchIdx, uint8 SwitchPortIdx, boolean Enable );
927 
928 /**
929  * @brief            Enable/disable Switch mirroring
930  * @details          External function for setting mirroring state for the switch.
931  *
932  * @param[in]        SwitchIdx                      Index of the switch within the context of the Ethernet Switch Driver
933  * @param[in]        MirrorState                    0: switch mirroring disabled. 1: switch mirroring enabled.
934  *
935  * @return           Result of the operation
936  * @retval           E_OK : success
937  * @retval           others : fail
938  */
939 Std_ReturnType Netc_EthSwt_Ip_SetMirrorState( uint8 SwitchIdx, Netc_EthSwt_Ip_SwitchMirrorStateType MirrorState );
940 
941 /**
942  * @brief            Obtain Switch mirroring state
943  * @details          External function for obtaining mirroring state of the switch.
944  *
945  * @param[in]        SwitchIdx                      Index of the switch within the context of the Ethernet Switch Driver
946  * @param[out]       MirrorStatePtr                 0: switch mirroring disabled. 1: switch mirroring enabled.
947  *
948  * @return           Result of the operation
949  * @retval           E_OK : success
950  * @retval           others : fail
951  */
952 Std_ReturnType Netc_EthSwt_Ip_GetMirrorState( uint8 SwitchIdx, Netc_EthSwt_Ip_SwitchMirrorStateType *MirrorStatePtr );
953 
954 /**
955  * @brief            Write mirror configuration
956  * @details          External function for writing mirror configuration to the switch.
957  *
958  * @param[in]        MirroredSwitchIdx              Index of the switch within the context of the Ethernet Switch Driver
959  * @param[in]        MirrorConfigurationPtr         A Netc_EthSwt_Ip_SwitchMirrorCfgType pointer with the configuration data of mirroring
960  *
961  * @return           Result of the operation
962  * @retval           E_OK : success
963  * @retval           others : fail
964  */
965 Std_ReturnType Netc_EthSwt_Ip_WriteMirrorConfiguration( uint8 MirroredSwitchIdx, const Netc_EthSwt_Ip_SwitchMirrorCfgType* MirrorConfigurationPtr );
966 
967 /**
968  * @brief            Read mirror configuration
969  * @details          External function for obtaining mirror configuration of the switch.
970  *
971  * @param[in]        MirroredSwitchIdx              Index of the switch within the context of the Ethernet Switch Driver
972  * @param[out]       MirrorConfigurationPtr         A Netc_EthSwt_Ip_SwitchMirrorCfgType pointer with the configuration data of mirroring
973  *
974  * @return           Result of the operation
975  * @retval           E_OK : success
976  * @retval           others : fail
977  */
978 Std_ReturnType Netc_EthSwt_Ip_ReadMirrorConfiguration( uint8 MirroredSwitchIdx, Netc_EthSwt_Ip_SwitchMirrorCfgType* MirrorConfigurationPtr );
979 
980 /**
981  * @brief            Delete mirror configuration
982  * @details          External function for deleting the mirror configuration of the switch.
983  *
984  * @param[in]        MirroredSwitchIdx              Index of the switch within the context of the Ethernet Switch Driver
985  *
986  * @return           Result of the operation
987  * @retval           E_OK : success
988  * @retval           others : fail
989  */
990 Std_ReturnType Netc_EthSwt_Ip_DeleteMirrorConfiguration( uint8 MirroredSwitchIdx );
991 
992 /**
993  * @brief            Set the credit based shaper slope
994  * @details          Set the idle slope for the credit based shaper
995  *
996  * Parameters:
997  * -[in]     SwitchIdx           Index of the switch within the context of the Ethernet Switch Driver
998  * -[in]     SwitchPortIdx   Index of the port at the addressed switch
999  * -[in]     TrafficClass        The value range is 0 to 7
1000  * -[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.
1001  */
1002 Std_ReturnType Netc_EthSwt_Ip_ConfigureCreditBasedShaper(uint8 SwitchIdx, const uint8 SwitchPortIdx, const uint8 TrafficClass, const uint64 idleSlope);
1003 
1004 /**
1005  * @brief            Enable credit based shaper
1006  * @details          The credit base shaper TrafficClass is Enable/Disable
1007  *
1008  * Parameters:
1009  * -[in]     SwitchIdx            Index of the switch within the context of the Ethernet Switch Driver
1010  * -[in]     SwitchPortIdx    Index of the port at the addressed switch
1011  * -[in]     TrafficClass         The value range is 0 to 7
1012  * -[in]     Enable                  TRUE: enable credit based shaper on the port. FALSE: disable credit based shaper on the port.
1013  *
1014  */
1015 Std_ReturnType Netc_EthSwt_Ip_EnableCreditBasedShaper(uint8 SwitchIdx, const uint8 SwitchPortIdx, const uint8 TrafficClass, const boolean Enable);
1016 
1017 /**
1018  * @brief            Add or Update Time Gate Scheduling Table Entry function
1019  * @details          External function for adding/updating time gate scheduling table entry to command ring with "NETC_ETHSWT_ENTRY_ID_MATCH" access method.
1020  *
1021  * @param[in]        SwitchIdx                    Index of the switch within the context of the Ethernet Switch Driver
1022  * @param[in]        TimeGateSchedulingTableEntry Pointer points to an time gate scheduling table entry structure Netc_EthSwt_Ip_TimeGateSchedulingEntryDataType
1023  *
1024  * @return           Result of the operation
1025  * @retval           0 : NETC_ETHSWT_CBDRSTATUS_SUCCES, success
1026  * @retval           others : fail
1027  */
1028 Netc_EthSwt_Ip_CBDRStatusType Netc_EthSwt_Ip_AddOrUpdateTimeGateSchedulingTableEntry( uint8 SwitchIdx,
1029                                                                                       const Netc_EthSwt_Ip_TimeGateSchedulingEntryDataType *TimeGateSchedulingTableEntry
1030                                                                                     );
1031 
1032 /**
1033  * @brief            Enable or disable Time Gate Scheduling on a switch port.
1034  * @details          External function for enabling/disabling time gate scheduling on a switch port.
1035  *
1036  * @param[in]        SwitchIdx            Index of the switch within the context of the Ethernet Switch Driver
1037  * @param[in]        SwitchPortIdx        Index of the port at the addressed switch
1038  * @param[in]        Enable               Enable or disable the time gate scheduling
1039  *
1040  * @return           Result of the operation
1041  * @retval           0 : NETC_ETHSWT_CBDRSTATUS_SUCCES, success
1042  * @retval           others : fail
1043  */
1044 Netc_EthSwt_Ip_CBDRStatusType Netc_EthSwt_Ip_ConfigPortTimeGateScheduling( uint8 SwitchIdx,
1045                                                                            uint8 SwitchPortIdx,
1046                                                                            boolean Enable
1047                                                                          );
1048 
1049 /**
1050  * @brief            Set the mac layer duplex mode on a switch port.
1051  * @details
1052  *
1053  * @param[in]        SwitchIdx                      Index of the switch within the context of the Ethernet Switch Driver
1054  * @param[in]        SwitchPortIdx                  Index of the port at the addressed switch
1055  * @param[in]        EthSwtPortMacLayerDuplexMode   1 : full duplex mode; 0 : half duplex mode
1056  *
1057  * @return          Result of the operation
1058  * @retval          E_OK        success
1059  * @retval          E_NOT_OK    fail to set the duplx mode
1060  */
1061 Std_ReturnType Netc_EthSwt_Ip_SetPortMacLayerDuplexMode( uint8 SwitchIdx,
1062                                                          uint8 SwitchPortIdx,
1063                                                          Netc_EthSwt_Ip_PortDuplexType EthSwtPortMacLayerDuplexMode
1064                                                        );
1065 
1066 
1067 #define ETHSWT_43_NETC_STOP_SEC_CODE
1068 #include "EthSwt_43_NETC_MemMap.h"
1069 
1070 #ifdef __cplusplus
1071 }
1072 #endif
1073 
1074 /** @} */
1075 
1076 #endif
1077