1 /*
2  * Copyright 2023 NXP
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #ifndef _FSL_NETC_SOC_H_
8 #define _FSL_NETC_SOC_H_
9 
10 #include "netc_hw/fsl_netc_hw.h"
11 #include "netc_hw/fsl_netc_hw_enetc.h"
12 #include "netc_hw/fsl_netc_hw_si.h"
13 
14 #define TMR_PCI_HDR_TYPE0   TMR0_PCI_HDR_TYPE0
15 #define EMDIO_PCI_HDR_TYPE0 EMDIO0_PCI_HDR_TYPE0
16 
17 /*! @brief Station interface index enumerator */
18 typedef enum _netc_hw_si_idx
19 {
20     kNETC_ENETC0PSI0 = (0U << 8U) | (0U << 4U) | 0U, /*!< ENETC0 PSI0, index 0 */
21     kNETC_ENETC1PSI0 = (1U << 8U) | (0U << 4U) | 1U, /*!< ENETC1 PSI0, index 1 */
22     kNETC_ENETC2PSI0 = (2U << 8U) | (0U << 4U) | 2U, /*!< ENETC2 PSI0, index 2 */
23     kNETC_ENETC0VSI0 = (0U << 8U) | (1U << 4U) | 3U, /*!< ENETC0 VSI0, index 3 */
24     kNETC_ENETC1VSI0 = (1U << 8U) | (1U << 4U) | 4U, /*!< ENETC1 VSI0, index 4 */
25     kNETC_ENETC2VSI0 = (2U << 8U) | (1U << 4U) | 5U, /*!< ENETC2 VSI0, index 5 */
26     kNETC_ENETC0VSI1 = (0U << 8U) | (2U << 4U) | 6U, /*!< ENETC0 VSI1, index 6 */
27     kNETC_ENETC1VSI1 = (1U << 8U) | (2U << 4U) | 7U, /*!< ENETC1 VSI1, index 7 */
28     kNETC_ENETC2VSI1 = (2U << 8U) | (2U << 4U) | 8U, /*!< ENETC2 VSI1, index 8 */
29 } netc_hw_si_idx_t;
30 
31 /*! @brief Ethernet MAC port resource for the NETC module */
32 typedef enum _netc_hw_eth_port_idx
33 {
34     kNETC_ENETC0EthPort   = 0U, /*!< Ethernet MAC port for ENETC0 */
35     kNETC_ENETC1EthPort   = 1U, /*!< Ethernet MAC port for ENETC1 */
36     kNETC_ENETC2EthPort   = 2U, /*!< Ethernet MAC port for ENETC2 */
37 } netc_hw_eth_port_idx_t;
38 
39 /*!
40  * @brief Enumeration for NETC timer external trigger index
41  */
42 typedef enum _netc_timer_exttrig_index
43 {
44     kNETC_TimerExtTrig1 = 0,
45     kNETC_TimerExtTrig2,
46 } netc_timer_exttrig_index_t;
47 
48 /*!
49  * @brief Get register map resource
50  *
51  * @param handle  The enetc hw handle.
52  * @param si      The SI object.
53  */
54 void NETC_SocGetBaseResource(netc_enetc_hw_t *hw, netc_hw_si_idx_t si);
55 
56 /*!
57  * @brief Get func instance from mac port
58  *
59  * @param port  The enetc mac port.
60  * @return uint32_t
61  */
62 uint32_t NETC_SocGetFuncInstance(netc_hw_eth_port_idx_t port);
63 
64 /*!
65  * @brief Preinit VSIs
66  *
67  * @param hw      The enetc hw handle.
68  * @param si      The SI object.
69  * @return status_t
70  */
71 status_t NETC_SocPreInitVsi(netc_enetc_hw_t *hw, netc_hw_si_idx_t si);
72 #endif /* _FSL_NETC_SOC_H_ */
73