1 /* 2 * Copyright 2020-2023 NXP 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 */ 6 7 #ifndef WKPU_IP_TYPES_H 8 #define WKPU_IP_TYPES_H 9 10 /** 11 * @file 12 * 13 * @addtogroup wkpu_icu_ip WKPU IPL 14 * @{ 15 */ 16 17 #ifdef __cplusplus 18 extern "C"{ 19 #endif 20 21 /*================================================================================================== 22 INCLUDE FILES 23 ==================================================================================================*/ 24 #include "Std_Types.h" 25 #include "Wkpu_Ip_Defines.h" 26 27 /*================================================================================================== 28 SOURCE FILE VERSION INFORMATION 29 ==================================================================================================*/ 30 #define WKPU_IP_TYPES_VENDOR_ID 43 31 #define WKPU_IP_TYPES_AR_RELEASE_MAJOR_VERSION 4 32 #define WKPU_IP_TYPES_AR_RELEASE_MINOR_VERSION 7 33 #define WKPU_IP_TYPES_AR_RELEASE_REVISION_VERSION 0 34 #define WKPU_IP_TYPES_SW_MAJOR_VERSION 3 35 #define WKPU_IP_TYPES_SW_MINOR_VERSION 0 36 #define WKPU_IP_TYPES_SW_PATCH_VERSION 0 37 38 /*================================================================================================== 39 FILE VERSION CHECKS 40 ==================================================================================================*/ 41 #ifndef DISABLE_MCAL_INTERMODULE_ASR_CHECK 42 /* Check if header file and Std_Types.h file are of the same Autosar version */ 43 #if ((WKPU_IP_TYPES_AR_RELEASE_MAJOR_VERSION != STD_AR_RELEASE_MAJOR_VERSION) || \ 44 (WKPU_IP_TYPES_AR_RELEASE_MINOR_VERSION != STD_AR_RELEASE_MINOR_VERSION)) 45 #error "AutoSar Version Numbers of Wkpu_Ip_Types.h and Std_Types.h are different" 46 #endif 47 #endif 48 49 /* Check if source file and ICU header file are of the same vendor */ 50 #if (WKPU_IP_TYPES_VENDOR_ID != WKPU_IP_DEFINES_VENDOR_ID) 51 #error "Wkpu_Ip_Types.h and Wkpu_Ip_Defines.h have different vendor IDs" 52 #endif 53 /* Check if source file and ICU header file are of the same AutoSar version */ 54 #if ((WKPU_IP_TYPES_AR_RELEASE_MAJOR_VERSION != WKPU_IP_DEFINES_AR_RELEASE_MAJOR_VERSION) || \ 55 (WKPU_IP_TYPES_AR_RELEASE_MINOR_VERSION != WKPU_IP_DEFINES_AR_RELEASE_MINOR_VERSION) || \ 56 (WKPU_IP_TYPES_AR_RELEASE_REVISION_VERSION != WKPU_IP_DEFINES_AR_RELEASE_REVISION_VERSION)) 57 #error "AutoSar Version Numbers of Wkpu_Ip_Types.h and Wkpu_Ip_Defines.h are different" 58 #endif 59 /* Check if source file and ICU header file are of the same Software version */ 60 #if ((WKPU_IP_TYPES_SW_MAJOR_VERSION != WKPU_IP_DEFINES_SW_MAJOR_VERSION) || \ 61 (WKPU_IP_TYPES_SW_MINOR_VERSION != WKPU_IP_DEFINES_SW_MINOR_VERSION) || \ 62 (WKPU_IP_TYPES_SW_PATCH_VERSION != WKPU_IP_DEFINES_SW_PATCH_VERSION)) 63 #error "Software Version Numbers of Wkpu_Ip_Types.h and Wkpu_Ip_Defines.h are different" 64 #endif 65 66 /*================================================================================================== 67 CONSTANTS 68 ==================================================================================================*/ 69 70 /*================================================================================================== 71 GLOBAL VARIABLE DECLARATIONS 72 ==================================================================================================*/ 73 74 /*================================================================================================== 75 DEFINES AND MACROS 76 ==================================================================================================*/ 77 78 /*================================================================================================== 79 ENUMS 80 ==================================================================================================*/ 81 #if (STD_ON == WKPU_IP_USED) 82 83 #if (defined (WKPU_IP_NMI_API) && (STD_ON == WKPU_IP_NMI_API)) 84 /** 85 * @brief NMI destination source 86 */ 87 typedef enum 88 { 89 #ifdef WKPU_IP_SUPPORT_NONE_REQUEST 90 WKPU_IP_NMI_NONE = 3U, /**< @brief No NMI, critical interrupt, or machine check request generated */ 91 #endif 92 #ifdef WKPU_IP_SUPPORT_MACHINE_CHK_REQ 93 WKPU_IP_NMI_MACHINE_CHK_REQ = 2U, /**< @brief Machine check request interrupt */ 94 #endif 95 #ifdef WKPU_IP_SUPPORT_CRITICAL_INT 96 WKPU_IP_NMI_CRITICAL_INT = 1U, /**< @brief Critical interrupt */ 97 #endif 98 #ifdef WKPU_IP_SUPPORT_NON_MASK_INT 99 WKPU_IP_NMI_NON_MASK_INT = 0U /**< @brief Non-maskable interrupt */ 100 #endif 101 } Wkpu_Ip_NmiDestSrcType; 102 #endif 103 104 /** @brief Edge event. */ 105 typedef enum 106 { 107 WKPU_IP_NONE_EDGE = 0U, /**< @brief None event */ 108 WKPU_IP_RISING_EDGE = 1U, /**< @brief Rising edge event */ 109 WKPU_IP_FALLING_EDGE = 2U, /**< @brief Falling edge event */ 110 WKPU_IP_BOTH_EDGES = 3U /**< @brief Both rising and falling edge event */ 111 } Wkpu_Ip_EdgeType; 112 113 /** 114 * @brief Wkpu_Ip_StatusType 115 * @details This indicates the operation success or fail 116 */ 117 typedef enum 118 { 119 WKPU_IP_SUCCESS = 0x0U, /**< @brief Status for success operation return. */ 120 WKPU_IP_ERROR = 0x1U, /**< @brief General error return status. */ 121 } Wkpu_Ip_StatusType; 122 /*================================================================================================== 123 STRUCTURES AND OTHER TYPEDEFS 124 ==================================================================================================*/ 125 /** @brief The notification functions shall have no parameters and no return value.*/ 126 typedef void (*Wkpu_Ip_NotifyType)(void); 127 #if (defined (WKPU_IP_NMI_API) && (STD_ON == WKPU_IP_NMI_API)) 128 /* @brief WKPU core source. */ 129 typedef enum 130 { 131 WKPU_CORE0 = 0U, /*!< Core 0 */ 132 WKPU_CORE1 = 1U, /*!< Core 1 */ 133 WKPU_CORE2 = 2U, /*!< Core 2 */ 134 WKPU_CORE3 = 3U /*!< Core 3 */ 135 } Wkpu_Ip_CoreType; 136 137 /*! 138 * @brief NMI configuration structure. 139 */ 140 141 typedef struct 142 { 143 Wkpu_Ip_CoreType core; /**< @brief WKPU core source */ 144 Wkpu_Ip_NmiDestSrcType destination; /**< @brief NMI destination source */ 145 boolean wkpReqEn; /**< @brief NMI request enable */ 146 boolean filterEn; /**< @brief NMI filter enable */ 147 Wkpu_Ip_EdgeType edgeEvent; /**< @brief NMI edge events */ 148 boolean lockEn; /**< @brief NMI configuration lock register */ 149 } Wkpu_Ip_NmiCfgType; 150 #endif 151 152 #ifdef WKPU_IP_SUPPORT_INTERRUPT_REQUEST 153 /* Callback type for each channel */ 154 typedef void (*Wkpu_Ip_CallbackType)(uint16 callbackParam1, boolean callbackParam2); 155 156 /** @brief WKPU interrupt configuration structure. */ 157 typedef struct 158 { 159 uint8 hwChannel; /**< @brief The WKPU hardware channel. */ 160 boolean filterEn; /**< @brief WKPU/interrupt filter enable. */ 161 boolean pullEn; /**< @brief WKPU/interrupt pull enable. */ 162 Wkpu_Ip_EdgeType edgeEvent; /**< @brief WKPU/interrupt edge events. */ 163 #ifdef WKPU_IP_SUPPORT_SELECT_BOOT_MODE 164 boolean fullBoot; /**< @brief WKPU select boot mode. 165 * If true, WKPU will trigger a full boot, 166 * otherwise it will trigger a shot boot. */ 167 #endif /* WKPU_IP_SUPPORT_SELECT_BOOT_MODE */ 168 Wkpu_Ip_CallbackType callback; /**< @brief Pointer to the callback function. */ 169 Wkpu_Ip_NotifyType WkpuChannelNotification; /**< @brief The notification functions shall have no parameters and no return value.*/ 170 uint16 callbackParam; /**< @brief The logic channel for which callback is set. */ 171 } Wkpu_Ip_ChannelConfigType; 172 #endif /* WKPU_IP_SUPPORT_INTERRUPT_REQUEST */ 173 174 /** @brief Wkpu IP specific configuration structure type. */ 175 typedef struct 176 { 177 #if (defined (WKPU_IP_NMI_API) && (STD_ON == WKPU_IP_NMI_API)) 178 /** @brief Number of channels in NMI configuration */ 179 uint8 numNMIChannels; 180 /** @brief Pointer to channels configration */ 181 Wkpu_Ip_NmiCfgType (*pNMIChannelsConfig)[]; 182 #endif 183 /** @brief Number of channels in configuration */ 184 uint8 numChannels; 185 /** @brief Pointer to channels configration */ 186 const Wkpu_Ip_ChannelConfigType (*pChannelsConfig)[]; 187 } Wkpu_Ip_IrqConfigType; 188 189 /** 190 * @brief WKPU IP state structure. 191 * @details This structure is used by the IPL driver for internal logic. 192 * The content is populated at initialization time. 193 */ 194 typedef struct 195 { 196 /** @brief Initialization state. */ 197 boolean chInit; 198 /** @brief Pointer to the callback function. */ 199 Wkpu_Ip_CallbackType callback; 200 /** @brief The notification functions for SIGNAL_EDGE_DETECT mode. */ 201 Wkpu_Ip_NotifyType WkpuChannelNotification; 202 /** @brief The logic channel for which callback is set. */ 203 uint16 callbackParam; 204 /** @brief Store the initialization state that determines whether Notifications are enabled. */ 205 boolean notificationEnable; 206 } Wkpu_Ip_State; 207 208 #endif /* WKPU_IP_USED */ 209 /*================================================================================================== 210 FUNCTION PROTOTYPES 211 ==================================================================================================*/ 212 213 #ifdef __cplusplus 214 } 215 #endif 216 217 /**@}*/ 218 219 #endif /* WKPU_IP_TYPES_H */ 220