1 /* 2 * Copyright 2020-2023 NXP 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 */ 6 7 /** 8 * @file Emios_Mcl_Ip_Types.h 9 * 10 * @version 3.0.0 11 * 12 * @brief AUTOSAR Mcl - Emios Common driver header file. 13 * 14 * @addtogroup EMIOS_IP_DRIVER EMIOS IP Driver 15 * @{ 16 */ 17 18 #ifndef EMIOS_MCL_IP_TYPES_H 19 #define EMIOS_MCL_IP_TYPES_H 20 21 #ifdef __cplusplus 22 extern "C"{ 23 #endif 24 25 /*================================================================================================== 26 INCLUDE FILES 27 1) system and project includes 28 2) needed interfaces from external units 29 3) internal and external interfaces from this unit 30 ==================================================================================================*/ 31 #include "StandardTypes.h" 32 #include "Emios_Mcl_Ip_Cfg_Defines.h" 33 34 /*================================================================================================== 35 * HEADER FILE VERSION INFORMATION 36 ==================================================================================================*/ 37 #define EMIOS_MCL_IP_TYPES_VENDOR_ID 43 38 #define EMIOS_MCL_IP_TYPES_AR_RELEASE_MAJOR_VERSION 4 39 #define EMIOS_MCL_IP_TYPES_AR_RELEASE_MINOR_VERSION 7 40 #define EMIOS_MCL_IP_TYPES_AR_RELEASE_REVISION_VERSION 0 41 #define EMIOS_MCL_IP_TYPES_SW_MAJOR_VERSION 3 42 #define EMIOS_MCL_IP_TYPES_SW_MINOR_VERSION 0 43 #define EMIOS_MCL_IP_TYPES_SW_PATCH_VERSION 0 44 /*================================================================================================== 45 * FILE VERSION CHECKS 46 ==================================================================================================*/ 47 #if (EMIOS_MCL_IP_TYPES_VENDOR_ID != EMIOS_MCL_IP_CFG_DEFINES_VENDOR_ID) 48 #error "Emios_Mcl_Ip_Types.h and Emios_Mcl_Ip_Cfg_Defines.h have different vendor ids" 49 #endif 50 51 /* Check if header file and Emios_Mcl_Ip_Cfg_Defines.h file are of the same Autosar version */ 52 #if ((EMIOS_MCL_IP_TYPES_AR_RELEASE_MAJOR_VERSION != EMIOS_MCL_IP_CFG_DEFINES_AR_RELEASE_MAJOR_VERSION) || \ 53 (EMIOS_MCL_IP_TYPES_AR_RELEASE_MINOR_VERSION != EMIOS_MCL_IP_CFG_DEFINES_AR_RELEASE_MINOR_VERSION) || \ 54 (EMIOS_MCL_IP_TYPES_AR_RELEASE_REVISION_VERSION != EMIOS_MCL_IP_CFG_DEFINES_AR_RELEASE_REVISION_VERSION)) 55 #error "AutoSar Version Numbers of Emios_Mcl_Ip_Types.h and Emios_Mcl_Ip_Cfg_Defines.h are different" 56 #endif 57 58 /* Check if header file and Emios_Mcl_Ip_Cfg_Defines.h file are of the same Software version */ 59 #if ((EMIOS_MCL_IP_TYPES_SW_MAJOR_VERSION != EMIOS_MCL_IP_CFG_DEFINES_SW_MAJOR_VERSION) || \ 60 (EMIOS_MCL_IP_TYPES_SW_MINOR_VERSION != EMIOS_MCL_IP_CFG_DEFINES_SW_MINOR_VERSION) || \ 61 (EMIOS_MCL_IP_TYPES_SW_PATCH_VERSION != EMIOS_MCL_IP_CFG_DEFINES_SW_PATCH_VERSION)) 62 #error "Software Version Numbers of Emios_Mcl_Ip_Types.h and Emios_Mcl_Ip_Cfg_Defines.h are different" 63 #endif 64 65 #ifndef DISABLE_MCAL_INTERMODULE_ASR_CHECK 66 /* Check if this header file and StandardTypes.h file are of the same Autosar version */ 67 #if ((EMIOS_MCL_IP_TYPES_AR_RELEASE_MAJOR_VERSION != STD_AR_RELEASE_MAJOR_VERSION) || \ 68 (EMIOS_MCL_IP_TYPES_AR_RELEASE_MINOR_VERSION != STD_AR_RELEASE_MINOR_VERSION)) 69 #error "AutoSar Version Numbers of Emios_Mcl_Ip_Types.h and StandardTypes.h are different" 70 #endif 71 72 #endif 73 74 /*================================================================================================== 75 * CONSTANTS 76 ==================================================================================================*/ 77 78 /*================================================================================================== 79 * DEFINES AND MACROS 80 ==================================================================================================*/ 81 /** @brief Channel mask maxim value. */ 82 #define EMIOS_CHANNELMASK_MAXVAL 0x00FFFFFFU 83 84 /*================================================================================================== 85 * ENUMS 86 ==================================================================================================*/ 87 88 /*================================================================================================== 89 * STRUCTURES AND OTHER TYPEDEFS 90 ==================================================================================================*/ 91 typedef enum 92 { 93 EMIOS_IP_COMMON_STATUS_SUCCESS = E_OK, 94 EMIOS_IP_COMMON_STATUS_FAIL = E_NOT_OK, 95 #if (STD_ON == EMIOS_IP_MULTICORE_IS_AVAILABLE) 96 EMIOS_IP_COMMON_STATUS_WRONG_CORE = 2U 97 #endif 98 } Emios_Ip_CommonStatusType; 99 100 typedef enum 101 { 102 EMIOS_IP_NO_MASTER_MODE = 0U, 103 EMIOS_IP_MC_UP_COUNTER_START = 16U, 104 EMIOS_IP_MC_UP_COUNTER_END = 18U, 105 EMIOS_IP_MC_UP_DOWN_COUNTER = 20U, 106 EMIOS_IP_MCB_UP_COUNTER = 80U, 107 EMIOS_IP_MCB_UP_DOWN_COUNTER = 84U 108 } Emios_Ip_MasterBusModeType; 109 110 typedef struct 111 { 112 const uint8 hwChannel; 113 const Emios_Ip_MasterBusModeType masterMode; 114 const uint32 defaultPeriod; 115 const uint32 offsetStartValue; 116 const uint8 masterBusPrescaler; 117 const uint8 masterBusAltPrescaler; 118 const boolean allowDebugMode; 119 } Emios_Ip_MasterBusConfigType; 120 121 typedef struct 122 { 123 const boolean allowDebugMode; /**< Allow all channel in EMIOS group can enter debug mode */ 124 const uint8 clkDivVal; /**< Select the clock divider value for the global prescaler in range (1-256) */ 125 const boolean enableGlobalTimeBase; /**< Enable global timebase or disable */ 126 } Emios_Ip_GlobalConfigType; 127 128 /** @brief EMIOS IP configuration structure. */ 129 typedef struct 130 { 131 const uint8 channelsNumber; /**< @brief Number of master buses used. */ 132 #if (STD_ON == EMIOS_IP_MULTICORE_IS_AVAILABLE) 133 const uint8 instanceCoreNumber; /**< @brief Core number where EMIOS instance is used. */ 134 #endif 135 const Emios_Ip_GlobalConfigType *emiosGlobalConfig; /**< @brief Pointer to EMIOS configuration. */ 136 const Emios_Ip_MasterBusConfigType (*masterBusConfig)[]; /**< @brief Pointer to an array with all master buses used. */ 137 } Emios_Mcl_Ip_ConfigType; 138 139 /** @brief Store EMIOS channel state. */ 140 typedef struct 141 { 142 Emios_Ip_MasterBusModeType counterMode; /* Current mode of the configured master bus. */ 143 boolean channelInitState; /* Store TRUE channel is initialized, FALSE otherwise. */ 144 } Emios_Ip_ChStateType; 145 146 147 /** @brief Store EMIOS instance state. */ 148 typedef struct 149 { 150 boolean instanceInitState; /* Store TRUE channel is initialized, FALSE otherwise. */ 151 #if (STD_ON == EMIOS_IP_MULTICORE_IS_AVAILABLE) 152 uint8 runCore; /* Store the core on which current EMIOS instance is running. */ 153 #endif 154 } Emios_Ip_InstStateType; 155 156 /*================================================================================================== 157 * GLOBAL VARIABLE DECLARATIONS 158 ==================================================================================================*/ 159 160 /*================================================================================================== 161 * FUNCTION PROTOTYPES 162 ==================================================================================================*/ 163 164 #ifdef __cplusplus 165 } 166 #endif 167 168 /** @} */ 169 170 #endif /* EMIOS_MCL_IP_TYPES_H */ 171 172