1 /*
2  * Copyright 2022 NXP
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #ifndef NETC_ETH_IP_CFG_DEFINES_H
8 #define NETC_ETH_IP_CFG_DEFINES_H
9 
10 /**
11 *   @file Netc_Eth_Ip_Cfg_Defines.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 "Mcal.h"
28 #include "S32Z2_ENETC_PORT.h"
29 #include "S32Z2_NETC_F3_SI0.h"
30 #include "S32Z2_NETC_F3_SI1.h"
31 #include "S32Z2_NETC_F3_SI2.h"
32 #include "S32Z2_NETC_F3_SI3.h"
33 #include "S32Z2_NETC_F3_SI4.h"
34 #include "S32Z2_NETC_F3_SI5.h"
35 #include "S32Z2_NETC_F3_SI6.h"
36 #include "S32Z2_NETC_F3_SI7.h"
37 
38 #include "S32Z2_NETC_VF1_PCI_HDR_TYPE0.h"
39 #include "S32Z2_NETC_VF2_PCI_HDR_TYPE0.h"
40 #include "S32Z2_NETC_VF3_PCI_HDR_TYPE0.h"
41 #include "S32Z2_NETC_VF4_PCI_HDR_TYPE0.h"
42 #include "S32Z2_NETC_VF5_PCI_HDR_TYPE0.h"
43 #include "S32Z2_NETC_VF6_PCI_HDR_TYPE0.h"
44 #include "S32Z2_NETC_VF7_PCI_HDR_TYPE0.h"
45 
46 #include "S32Z2_NETC_F3.h"
47 #include "S32Z2_NETC_F0_PCI_HDR_TYPE0.h"
48 #include "S32Z2_NETC_F1_PCI_HDR_TYPE0.h"
49 #include "S32Z2_NETC_F2_PCI_HDR_TYPE0.h"
50 #include "S32Z2_NETC_F3_PCI_HDR_TYPE0.h"
51 #include "S32Z2_ENETC_PORT.h"
52 #include "S32Z2_NETC_F3_COMMON.h"
53 
54 #include "S32Z2_TMR0_BASE.h"
55 #include "S32Z2_SW_ETH_MAC_PORT0.h"
56 #include "S32Z2_SW_ETH_MAC_PORT1.h"
57 /*==================================================================================================
58 *                              SOURCE FILE VERSION INFORMATION
59 ==================================================================================================*/
60 #define NETC_ETH_IP_CFG_DEFINES_VENDOR_ID                    43
61 #define NETC_ETH_IP_CFG_DEFINES_AR_RELEASE_MAJOR_VERSION     4
62 #define NETC_ETH_IP_CFG_DEFINES_AR_RELEASE_MINOR_VERSION     7
63 #define NETC_ETH_IP_CFG_DEFINES_AR_RELEASE_REVISION_VERSION  0
64 #define NETC_ETH_IP_CFG_DEFINES_SW_MAJOR_VERSION             0
65 #define NETC_ETH_IP_CFG_DEFINES_SW_MINOR_VERSION             9
66 #define NETC_ETH_IP_CFG_DEFINES_SW_PATCH_VERSION             0
67 
68 /*==================================================================================================
69 *                                     FILE VERSION CHECKS
70 ==================================================================================================*/
71 #ifndef DISABLE_MCAL_INTERMODULE_ASR_CHECK
72     /* Checks against Mcal.h */
73     #if ((NETC_ETH_IP_CFG_DEFINES_AR_RELEASE_MAJOR_VERSION != MCAL_AR_RELEASE_MAJOR_VERSION) || \
74          (NETC_ETH_IP_CFG_DEFINES_AR_RELEASE_MINOR_VERSION != MCAL_AR_RELEASE_MINOR_VERSION))
75         #error "AUTOSAR Version Numbers of Netc_Eth_Ip_Cfg_Defines.h and Mcal.h are different"
76     #endif
77 #endif
78 
79 /*==================================================================================================
80                                            CONSTANTS
81 ==================================================================================================*/
82 
83 /*==================================================================================================
84                                        DEFINES AND MACROS
85 ==================================================================================================*/
86 
87 /** TODO: This must be generated in function of what user is using in configuration.
88  *        LIMITATION: must be multiple of 8.
89  */
90 /** @brief Total number of command BDRs. */
91 #define NETC_ETH_IP_COMMAND_BDR_LENGTH          (8U)
92 
93 /** @brief Development error enable/disable. */
94 #define NETC_ETH_IP_DEV_ERROR_DETECT            (STD_OFF)
95 /*! @brief Extended buffer support enable/disable */
96 #define NETC_ETH_IP_EXTENDED_BUFF            (STD_OFF)
97 
98 /** @brief Minimum number of bytes supported by a frame. */
99 #define NETC_ETH_IP_MIN_FRAME_LENGTH         (16U)
100 
101 /** @brief Number of traffic classes. */
102 #define NETC_ETH_IP_NUMBER_OF_PRIORITIES        (8U)
103 
104 /** @brief TX buffer descriptor final bit mask. */
105 #define NETC_ETH_IP_TXBD_FINAL_MASK             (0x80000000UL)
106 /** @brief TX buffer descriptor extended bit mask. */
107 #define NETC_ETH_IP_TXBD_EXTENDED_BUFFER_MASK   (0x40000000UL)
108 /** @brief TX buffer descriptor writeback bit mask. */
109 #define NETC_ETH_IP_TXBD_WRITEBACK_MASK         (0x04000000UL)
110 /** @brief TX buffer descriptor frame interrupt bit mask. */
111 #define NETC_ETH_IP_TXBD_FRAME_INTERRUPT_MASK   (0x20000000UL)
112 
113 /** @brief TX frame buffer interrupt enable bit mask. */
114 #define NETC_ETH_IP_TBIER_TXFIE_MASK            (0x00000002UL)
115 
116 /** @brief TX threshold(coalescing) interrupt enable bit mask. */
117 #define NETC_ETH_IP_TBIER_TXTIE_MASK            (0x00000001UL)
118 
119 /* RX buffer descriptor information. */
120 /** @brief RX buffer descriptor priority code point mask. */
121 #define NETC_ETH_IP_RXBD_PCP_MASK               (0xE0000000UL)
122 /** @brief RX buffer descriptor priority code point shift value. */
123 #define NETC_ETH_IP_RXBD_PCP_SHIFT              (29UL)
124 /** @brief RX buffer descriptor drop eligible indicator mask. */
125 #define NETC_ETH_IP_RXBD_DEI_MASK               (0x10000000UL)
126 /** @brief RX buffer descriptor drop eligible indicator shift value. */
127 #define NETC_ETH_IP_RXBD_DEI_SHIFT              (28UL)
128 /** @brief RX buffer descriptor VLAN identifier mask. */
129 #define NETC_ETH_IP_RXBD_VID_MASK               (0x0FFF0000UL)
130 /** @brief RX buffer descriptor VLAN identifier shift value. */
131 #define NETC_ETH_IP_RXBD_VID_SHIFT              (16UL)
132 /** @brief RX buffer descriptor VLAN tag protocol identifier mask. */
133 #define NETC_ETH_IP_RXBD_TPID_MASK               (0x00000003UL)
134 /** @brief RX buffer descriptor final mask. */
135 #define NETC_ETH_IP_RXBD_FINAL_MASK             (0x80000000UL)
136 /** @brief RX buffer descriptor ready mask. */
137 #define NETC_ETH_IP_RXBD_READY_MASK             (0x40000000UL)
138 /** @brief RX buffer descriptor length mask. */
139 #define NETC_ETH_IP_RXBD_LENGTH_MASK            (0x0000FFFFUL)
140 /** @brief RX buffer descriptor error mask. */
141 #define NETC_ETH_IP_RXBD_ERROR_MASK             (0x00FF0000UL)
142 /** @brief RX buffer descriptor error shift value. */
143 #define NETC_ETH_IP_RXBD_ERROR_SHIFT            (16UL)
144 /** @brief RX buffer descriptor L4 flag mask. */
145 #define NETC_ETH_IP_RXBD_L4_FLAG_MASK           (0x00001000UL)
146 /** @brief RX buffer descriptor L3 flag mask. */
147 #define NETC_ETH_IP_RXBD_L3_FLAG_MASK           (0x00000800UL)
148 /** @brief RX buffer descriptor timespamp flag mask. */
149 #define NETC_ETH_IP_RXBD_TIMESTAMP_FLAG_MASK    (0x00000400UL)
150 /** @brief RX buffer descriptor VLAN head flag mask. */
151 #define NETC_ETH_IP_RXBD_VLAN_HEAD_FLAG_MASK    (0x00000200UL)
152 /** @brief RX buffer descriptor host reason mask. */
153 #define NETC_ETH_IP_RXBD_HOST_REASON_MASK       (0x0000003CUL)
154 /** @brief RX buffer descriptor host reason shift value. */
155 #define NETC_ETH_IP_RXBD_HOST_REASON_SHIFT            (2UL)
156 /** @brief Receive threshold interrupt enable mask. */
157 #define NETC_ETH_IP_RBIER_RXTIE_MASK            (0x00000001UL)
158 
159 /** @brief Station interface(SI) type. */
160 #define Netc_Eth_Ip_SiBaseType               NETC_F3_SI0_Type
161 
162 /** @brief Virtual station interface(VSI) type. */
163 #define Netc_Eth_Ip_VsiBaseType              NETC_F3_SI1_Type
164 
165 /** @brief Virtual function(VF) type */
166 #define Netc_Eth_Ip_VfBaseType               NETC_F1_PCI_HDR_TYPE0_Type
167 
168 /** @brief ENETC function struct type. */
169 #define Netc_Eth_Ip_EnetcBaseType            NETC_F3_Type
170 
171 /* Descriptor options for normal buffer. */
172 /** @brief Flags shift value. */
173 #define NETC_ETH_IP_FL_SHIFT                 (27U)
174 /** @brief This field contains the only Flags Qualifier setting supported by NETCv3. */
175 /* It is used as a value because is the only one supported. If the next version support more, code will be updated. */
176 #define NETC_ETH_IP_FLQ_VALUE                (0x02U)
177 /** @brief Flags Qualifier shift value. */
178 #define NETC_ETH_IP_FLQ_SHIFT                (24U)
179 /** @brief Switch Management Sending Options shift value. */
180 #define NETC_ETH_IP_SMSO_SHIFT               (23U)
181 /** @brief Ingress/Egress switch port number this frame is to be injected towards/to be transmitted shift value. */
182 #define NETC_ETH_IP_INGR_EGRESS_PORT_SHIFT   (16U)
183 /** @brief Timestamp Reference Request shift value. */
184 #define NETC_ETH_IP_TSR_SHIFT                (22U)
185 /** @brief Internal Priority Value shift value. */
186 #define NETC_ETH_IP_IPV_SHIFT                (12U)
187 /** @brief Discard Resilience shift value. */
188 #define NETC_ETH_IP_DR_SHIFT                 (10U)
189 
190 /* TX write-back fields. */
191 #define NETC_ETH_IP_HOSTREASON_WB_MASK       (0x0000003CUL)
192 #define NETC_ETH_IP_HOSTREASON_REGULAR_FRAME (0x00000000UL)
193 #define NETC_ETH_IP_HOSTREASON_TIMESTAMP     (0x0000000CUL)
194 #define NETC_ETH_IP_TX_WB_STATUS_MASK        (0x01FFU)
195 
196 /* Descriptor options for extended buffer. */
197 #if (STD_ON == NETC_ETH_IP_EXTENDED_BUFF)
198     /** @brief Priority code point shift value. */
199     #define NETC_ETH_IP_PCP_SHIFT                (29U)
200     /** @brief Priority code point bit mask. */
201     #define NETC_ETH_IP_PCP_MASK                 (0xE0000000UL)
202     /** @brief Drop eligible indicator shift value. */
203     #define NETC_ETH_IP_DEI_SHIFT                (28U)
204     /** @brief Drop eligible indicator bit mask. */
205     #define NETC_ETH_IP_DEI_MASK                 (0x10000000UL)
206     /** @brief VLAN identifier shift value. */
207     #define NETC_ETH_IP_VID_SHIFT                (16U)
208     /** @brief VLAN identifier bit mask. */
209     #define NETC_ETH_IP_VID_MASK                 (0x0FFF0000UL)
210     /** @brief Tag protocol identifier shift value. */
211     #define NETC_ETH_IP_TPID_SHIFT               (14U)
212     /** @brief Tag protocol identifier bit mask. */
213     #define NETC_ETH_IP_TPID_MASK                (0x0000C000UL)
214     /** @brief Extension flags shift value. */
215     #define NETC_ETH_IP_E_FLAGS_SHIFT            (16U)
216     /** @brief Extension flags bit mask. */
217     #define NETC_ETH_IP_E_FLAGS_MASK             (0x00FF0000UL)
218 #endif
219 
220 /* VSI-to-PSI message used defines. */
221 /** @brief Define the bit used by VSI-to-PSI messaging to show if the process is still in progress. */
222 #define NETC_ETH_IP_VSI_MSG_PROGRESS_STATUS      (0x00000001UL)
223 /** @brief Define the bit used to show the message status. */
224 #define NETC_ETH_IP_VSI_MSG_STATUS               (0x00000002UL)
225 /** @brief Define used to code the 32 bytes message. */
226 #define NETC_ETH_IP_VSITOPSI_MSG_SIZE            (0x00000001UL)
227 
228 #define NETC_ETH_IP_VLAN_SUPPORT          (STD_ON)
229 /*! @brief Enables/Disables internal cache management */
230 #define  NETC_ETH_IP_HAS_CACHE_MANAGEMENT       (STD_OFF)
231 /*==================================================================================================
232                                              ENUMS
233 ==================================================================================================*/
234 
235 /*==================================================================================================
236                                  STRUCTURES AND OTHER TYPEDEFS
237 ==================================================================================================*/
238 
239 /*==================================================================================================
240                                  GLOBAL VARIABLE DECLARATIONS
241 ==================================================================================================*/
242 
243 /*==================================================================================================
244                                      FUNCTION PROTOTYPES
245 ==================================================================================================*/
246 
247 #ifdef __cplusplus
248 }
249 #endif
250 
251 /** @} */
252 
253 #endif /* NETC_ETH_IP_CFG_DEFINES_H */
254