|
| 1 | +/* |
| 2 | + * Copyright 2021-2025 NXP |
| 3 | + * |
| 4 | + * SPDX-License-Identifier: BSD-3-Clause |
| 5 | + */ |
| 6 | + |
| 7 | +#ifndef PSI5_IP_H |
| 8 | +#define PSI5_IP_H |
| 9 | + |
| 10 | +#if defined(__cplusplus) |
| 11 | +extern "C" { |
| 12 | +#endif |
| 13 | + |
| 14 | + |
| 15 | +/*================================================================================================== |
| 16 | +* INCLUDE FILES |
| 17 | +* 1) system and project includes |
| 18 | +* 2) needed interfaces from external units |
| 19 | +* 3) internal and external interfaces from this unit |
| 20 | +==================================================================================================*/ |
| 21 | +#include "Psi5_Ip_Types.h" |
| 22 | +#include "Psi5_Ip_Cfg.h" |
| 23 | + |
| 24 | +/*================================================================================================== |
| 25 | +* SOURCE FILE VERSION INFOPSI5ATION |
| 26 | +==================================================================================================*/ |
| 27 | +#define PSI5_IP_VENDOR_ID 43 |
| 28 | +#define PSI5_IP_AR_RELEASE_MAJOR_VERSION 4 |
| 29 | +#define PSI5_IP_AR_RELEASE_MINOR_VERSION 7 |
| 30 | +#define PSI5_IP_AR_RELEASE_REVISION_VERSION 0 |
| 31 | +#define PSI5_IP_SW_MAJOR_VERSION 2 |
| 32 | +#define PSI5_IP_SW_MINOR_VERSION 0 |
| 33 | +#define PSI5_IP_SW_PATCH_VERSION 1 |
| 34 | + |
| 35 | + |
| 36 | +/*================================================================================================== |
| 37 | +* FILE VERSION CHECKS |
| 38 | +==================================================================================================*/ |
| 39 | +/* Checks against Psi5_Ip_Types.h */ |
| 40 | +#if (PSI5_IP_VENDOR_ID != PSI5_IP_TYPES_VENDOR_ID) |
| 41 | + #error "Psi5_Ip.h and Psi5_Ip_Types.h have different vendor ids" |
| 42 | +#endif |
| 43 | +#if ((PSI5_IP_AR_RELEASE_MAJOR_VERSION != PSI5_IP_TYPES_AR_RELEASE_MAJOR_VERSION) || \ |
| 44 | + (PSI5_IP_AR_RELEASE_MINOR_VERSION != PSI5_IP_TYPES_AR_RELEASE_MINOR_VERSION) || \ |
| 45 | + (PSI5_IP_AR_RELEASE_REVISION_VERSION != PSI5_IP_TYPES_AR_RELEASE_REVISION_VERSION) \ |
| 46 | + ) |
| 47 | + #error "AUTOSAR Version Numbers of Psi5_Ip.h and Psi5_Ip_Types.h are different" |
| 48 | +#endif |
| 49 | +#if ((PSI5_IP_SW_MAJOR_VERSION != PSI5_IP_TYPES_SW_MAJOR_VERSION) || \ |
| 50 | + (PSI5_IP_SW_MINOR_VERSION != PSI5_IP_TYPES_SW_MINOR_VERSION) || \ |
| 51 | + (PSI5_IP_SW_PATCH_VERSION != PSI5_IP_TYPES_SW_PATCH_VERSION) \ |
| 52 | + ) |
| 53 | + #error "Software Version Numbers of Psi5_Ip.h and Psi5_Ip_Types.h are different" |
| 54 | +#endif |
| 55 | + |
| 56 | +/* Checks against Psi5_Ip_Cfg.h */ |
| 57 | +#if (PSI5_IP_VENDOR_ID != PSI5_IP_CFG_VENDOR_ID) |
| 58 | + #error "Psi5_Ip.h and Psi5_Ip_Cfg.h have different vendor ids" |
| 59 | +#endif |
| 60 | +#if ((PSI5_IP_AR_RELEASE_MAJOR_VERSION != PSI5_IP_CFG_AR_RELEASE_MAJOR_VERSION) || \ |
| 61 | + (PSI5_IP_AR_RELEASE_MINOR_VERSION != PSI5_IP_CFG_AR_RELEASE_MINOR_VERSION) || \ |
| 62 | + (PSI5_IP_AR_RELEASE_REVISION_VERSION != PSI5_IP_CFG_AR_RELEASE_REVISION_VERSION) \ |
| 63 | + ) |
| 64 | + #error "AUTOSAR Version Numbers of Psi5_Ip.h and Psi5_Ip_Cfg.h are different" |
| 65 | +#endif |
| 66 | +#if ((PSI5_IP_SW_MAJOR_VERSION != PSI5_IP_CFG_SW_MAJOR_VERSION) || \ |
| 67 | + (PSI5_IP_SW_MINOR_VERSION != PSI5_IP_CFG_SW_MINOR_VERSION) || \ |
| 68 | + (PSI5_IP_SW_PATCH_VERSION != PSI5_IP_CFG_SW_PATCH_VERSION) \ |
| 69 | + ) |
| 70 | + #error "Software Version Numbers of Psi5_Ip.h and Psi5_Ip_Cfg.h are different" |
| 71 | +#endif |
| 72 | + |
| 73 | +/*================================================================================================== |
| 74 | +* CONSTANTS |
| 75 | +==================================================================================================*/ |
| 76 | + |
| 77 | +/*================================================================================================== |
| 78 | +* DEFINES AND MACROS |
| 79 | +==================================================================================================*/ |
| 80 | + |
| 81 | +/*================================================================================================== |
| 82 | +* ENUMS |
| 83 | +==================================================================================================*/ |
| 84 | + |
| 85 | +/*================================================================================================== |
| 86 | +* STRUCTURES AND OTHER TYPEDEFS |
| 87 | +==================================================================================================*/ |
| 88 | + |
| 89 | +/*================================================================================================== |
| 90 | +* GLOBAL VARIABLE DECLARATIONS |
| 91 | +==================================================================================================*/ |
| 92 | + |
| 93 | +/*================================================================================================== |
| 94 | +* FUNCTION PROTOTYPES |
| 95 | +==================================================================================================*/ |
| 96 | + |
| 97 | +#define PSI5_START_SEC_CONFIG_DATA_UNSPECIFIED |
| 98 | +#include "Psi5_MemMap.h" |
| 99 | +/** |
| 100 | +* @brief Export PSI5 configurations. |
| 101 | +*/ |
| 102 | +PSI5_IP_CONFIG_EXT |
| 103 | + |
| 104 | +#define PSI5_STOP_SEC_CONFIG_DATA_UNSPECIFIED |
| 105 | +#include "Psi5_MemMap.h" |
| 106 | + |
| 107 | +#define PSI5_START_SEC_CODE |
| 108 | +#include "Psi5_MemMap.h" |
| 109 | + |
| 110 | + |
| 111 | +/** |
| 112 | +* @brief Interrupt handler signature for PSI5 module. |
| 113 | +* |
| 114 | +* @param[in] Psi5InstanceId Instance number |
| 115 | +* @param[in] Psi5ChannelId Instance channel number |
| 116 | +* @return void |
| 117 | +* |
| 118 | +*/ |
| 119 | +void Psi5_Ip_IRQ_Handler(const Psi5_Ip_InstanceIdType Psi5InstanceId, |
| 120 | + const Psi5_Ip_HwChannelIdType Psi5ChannelId |
| 121 | + ); |
| 122 | +/*! |
| 123 | + * @brief Main initializer for the driver |
| 124 | + * |
| 125 | + * Initializes the driver for a given peripheral |
| 126 | + * according to the given configuration structure. |
| 127 | + * |
| 128 | + * @param[in] configPtr Pointer to the configuration structure |
| 129 | + */ |
| 130 | +void Psi5_Ip_Init(const Psi5_Ip_ConfigType *configPtr); |
| 131 | + |
| 132 | +/*! |
| 133 | + * @brief Reset the peripheral. |
| 134 | + * |
| 135 | + * De-Initializes the peripheral and brings it's registers into a reset state. |
| 136 | + * |
| 137 | + */ |
| 138 | +void Psi5_Ip_DeInit(void); |
| 139 | + |
| 140 | +#if (STD_ON == PSI5_IP_TRANSMIT_API) |
| 141 | +/*! |
| 142 | + * @brief Transmit a data frame |
| 143 | + * |
| 144 | + * Transmits a data frame according to configuration. |
| 145 | + * |
| 146 | + * @param[in] Psi5InstanceId Instance number |
| 147 | + * @param[in] Psi5ChannelId Channel number |
| 148 | + * @param[in] Psi5Data Data to send |
| 149 | + * @return STATUS_SUCCESS If transmit succeeded |
| 150 | + * @return STATUS_ERROR If not configured or not enabled or not ready |
| 151 | + */ |
| 152 | +Std_ReturnType Psi5_Ip_Transmit(const Psi5_Ip_InstanceIdType Psi5InstanceId, |
| 153 | + const Psi5_Ip_HwChannelIdType Psi5ChannelId, |
| 154 | + const uint64 Psi5Data |
| 155 | + ); |
| 156 | +#endif |
| 157 | + |
| 158 | +#if (STD_ON == PSI5_IP_GET_TRANSMISSION_STATUS_API) |
| 159 | +/*! |
| 160 | + * @brief Transmission status |
| 161 | + * |
| 162 | + * Returns the status of the transmission. |
| 163 | + * |
| 164 | + * @param[in] Psi5InstanceId Instance number |
| 165 | + * @param[in] Psi5ChannelId Channel number |
| 166 | + * @return true If transmission ready |
| 167 | + * @return false If transmission pending |
| 168 | + */ |
| 169 | +boolean Psi5_Ip_GetTransmissionStatus(const Psi5_Ip_InstanceIdType Psi5InstanceId, |
| 170 | + const Psi5_Ip_HwChannelIdType Psi5ChannelId |
| 171 | + ); |
| 172 | +#endif |
| 173 | + |
| 174 | +#if (STD_ON == PSI5_IP_GET_PSI5_FRAME_API) |
| 175 | +/*! |
| 176 | + * @brief Gets a PSI5 frame |
| 177 | + * |
| 178 | + * Returns the last received PSI5 frame. |
| 179 | + * |
| 180 | + * @param[in] Psi5InstanceId Instance number |
| 181 | + * @param[in] Psi5ChannelId Channel number |
| 182 | + * @param[out] Psi5FramePtr Target variable |
| 183 | + */ |
| 184 | +Std_ReturnType Psi5_Ip_GetPsi5Frame(const Psi5_Ip_InstanceIdType Psi5InstanceId, |
| 185 | + const Psi5_Ip_HwChannelIdType Psi5ChannelId, |
| 186 | + Psi5_Ip_Psi5FrameType *PsiFramePtr |
| 187 | + ); |
| 188 | +#endif |
| 189 | + |
| 190 | +#if (STD_ON == PSI5_IP_GET_SMC_FRAME_API) |
| 191 | +/*! |
| 192 | + * @brief Gets a SMC frame |
| 193 | + * |
| 194 | + * Returns the last received SMC frame. |
| 195 | + * |
| 196 | + * @param[in] Psi5InstanceId Instance number |
| 197 | + * @param[in] Psi5ChannelId Channel number |
| 198 | + * @param[out] Psi5FramePtr Target variable |
| 199 | + */ |
| 200 | +Std_ReturnType Psi5_Ip_GetSmcFrame(const Psi5_Ip_InstanceIdType Psi5InstanceId, |
| 201 | + const Psi5_Ip_HwChannelIdType Psi5ChannelId, |
| 202 | + Psi5_Ip_SmcFrameType *Psi5SmcFramePtr |
| 203 | + ); |
| 204 | +#endif |
| 205 | + |
| 206 | +#if (STD_ON == PSI5_IP_SET_GLOBAL_SYNC_API) |
| 207 | +/*! |
| 208 | + * @brief Global sync state |
| 209 | + * |
| 210 | + * Changes the global sync pulse generator state |
| 211 | + * |
| 212 | + * @param[in] Psi5InstanceId Instance number |
| 213 | + * @param[in] Psi5State Desired state |
| 214 | + */ |
| 215 | +Std_ReturnType Psi5_Ip_SetGlobalSync(const uint8 Psi5InstanceId, |
| 216 | + const boolean PsiState |
| 217 | + ); |
| 218 | +#endif |
| 219 | + |
| 220 | +#if (STD_ON == PSI5_IP_SET_CHANNEL_SYNC_API) |
| 221 | +/*! |
| 222 | + * @brief Channel sync state |
| 223 | + * |
| 224 | + * Changes the channel sync pulse generator state |
| 225 | + * |
| 226 | + * @param[in] Psi5InstanceId Instance number |
| 227 | + * @param[in] Psi5ChannelId Instance channel number |
| 228 | + * @param[in] Psi5State Desired state |
| 229 | + */ |
| 230 | +Std_ReturnType Psi5_Ip_SetChannelSync(const Psi5_Ip_InstanceIdType Psi5InstanceId, |
| 231 | + const Psi5_Ip_HwChannelIdType Psi5ChannelId, |
| 232 | + const boolean PsiState |
| 233 | + ); |
| 234 | +#endif |
| 235 | + |
| 236 | +#define PSI5_STOP_SEC_CODE |
| 237 | +#include "Psi5_MemMap.h" |
| 238 | + |
| 239 | +#if defined(__cplusplus) |
| 240 | +} |
| 241 | +#endif |
| 242 | + |
| 243 | +/*! @}*/ |
| 244 | + |
| 245 | +/*! @}*/ /* End of addtogroup psi5 */ |
| 246 | + |
| 247 | +#endif /* PSI5_IP_H */ |
0 commit comments