Platform.h 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  1. /*==================================================================================================
  2. * Project : RTD AUTOSAR 4.4
  3. * Platform : CORTEXM
  4. * Peripheral :
  5. * Dependencies : none
  6. *
  7. * Autosar Version : 4.4.0
  8. * Autosar Revision : ASR_REL_4_4_REV_0000
  9. * Autosar Conf.Variant :
  10. * SW Version : 1.0.0
  11. * Build Version : S32K1_RTD_1_0_0_HF01_D2109_ASR_REL_4_4_REV_0000_20210907
  12. *
  13. * (c) Copyright 2020-2021 NXP Semiconductors
  14. * All Rights Reserved.
  15. *
  16. * NXP Confidential. This software is owned or controlled by NXP and may only be
  17. * used strictly in accordance with the applicable license terms. By expressly
  18. * accepting such terms or by downloading, installing, activating and/or otherwise
  19. * using the software, you are agreeing that you have read, and that you agree to
  20. * comply with and are bound by, such license terms. If you do not agree to be
  21. * bound by the applicable license terms, then you may not retain, install,
  22. * activate or otherwise use the software.
  23. ==================================================================================================*/
  24. #ifndef PLATFORM_H_
  25. #define PLATFORM_H_
  26. /**
  27. * @file
  28. *
  29. * @addtogroup Platform
  30. * @{
  31. */
  32. /*==================================================================================================
  33. * INCLUDE FILES
  34. ==================================================================================================*/
  35. #include "Platform_Cfg.h"
  36. /*==================================================================================================
  37. * SOURCE FILE VERSION INFORMATION
  38. ==================================================================================================*/
  39. #define PLATFORM_VENDOR_ID 43
  40. #define PLATFORM_MODULE_ID 255
  41. #define PLATFORM_AR_RELEASE_MAJOR_VERSION 4
  42. #define PLATFORM_AR_RELEASE_MINOR_VERSION 4
  43. #define PLATFORM_AR_RELEASE_REVISION_VERSION 0
  44. #define PLATFORM_SW_MAJOR_VERSION 1
  45. #define PLATFORM_SW_MINOR_VERSION 0
  46. #define PLATFORM_SW_PATCH_VERSION 0
  47. /*==================================================================================================
  48. * FILE VERSION CHECKS
  49. ==================================================================================================*/
  50. /* Check if current file and Platform_Cfg header file are of the same vendor */
  51. #if (PLATFORM_VENDOR_ID != PLATFORM_CFG_VENDOR_ID)
  52. #error "Platform.h and Platform_TypesDef.h have different vendor ids"
  53. #endif
  54. /* Check if current file and Platform_Cfg header file are of the same Autosar version */
  55. #if ((PLATFORM_AR_RELEASE_MAJOR_VERSION != PLATFORM_CFG_AR_RELEASE_MAJOR_VERSION) || \
  56. (PLATFORM_AR_RELEASE_MINOR_VERSION != PLATFORM_CFG_AR_RELEASE_MINOR_VERSION) || \
  57. (PLATFORM_AR_RELEASE_REVISION_VERSION != PLATFORM_CFG_AR_RELEASE_REVISION_VERSION) \
  58. )
  59. #error "AutoSar Version Numbers of Platform.h and Platform_Cfg.h are different"
  60. #endif
  61. /* Check if current file and Platform_Cfg header file are of the same Software version */
  62. #if ((PLATFORM_SW_MAJOR_VERSION != PLATFORM_CFG_SW_MAJOR_VERSION) || \
  63. (PLATFORM_SW_MINOR_VERSION != PLATFORM_CFG_SW_MINOR_VERSION) || \
  64. (PLATFORM_SW_PATCH_VERSION != PLATFORM_CFG_SW_PATCH_VERSION) \
  65. )
  66. #error "Software Version Numbers of Platform.h and Platform_Cfg.h are different"
  67. #endif
  68. /*==================================================================================================
  69. * FUNCTION PROTOTYPES
  70. ==================================================================================================*/
  71. #if defined(__cplusplus)
  72. extern "C" {
  73. #endif /* __cplusplus*/
  74. #define PLATFORM_START_SEC_CODE
  75. #include "Platform_MemMap.h"
  76. /**
  77. * @brief Initializes the paltform settings based on user configuration.
  78. *
  79. * @details This function is non-reentrant; it initializes the interrupts,
  80. * interrupt monitors (if available), as well as other platform specific settings
  81. * as defined for each SoC.
  82. *
  83. * @param[in] pConfig: pointer to platform configuration structure.
  84. * @return void
  85. *
  86. * @api
  87. *
  88. * */
  89. void Platform_Init(const Platform_ConfigType *pConfig);
  90. /**
  91. * @brief Configures (enables/disables) an interrupt request.
  92. *
  93. * @details This function is non-reentrant; it enables/disables the selected interrupt.
  94. *
  95. * @param[in] eIrqNumber: interrupt to be configured.
  96. * @param[in] bEnable: TRUE - enable interrupt, FALSE - disable interrupt.
  97. * @return Std_ReturnType: E_OK/E_NOT_OK; specific errors are reported through DET.
  98. *
  99. * @api
  100. *
  101. * */
  102. Std_ReturnType Platform_SetIrq(IRQn_Type eIrqNumber, boolean bEnable);
  103. /**
  104. * @brief Configures the priority of an interrupt request.
  105. *
  106. * @details This function is non-reentrant; it sets the priority for the selected interrupt.
  107. *
  108. * @param[in] eIrqNumber: interrupt number for which priority is configured.
  109. * @param[in] u8Priority: desired priority of the interrupt.
  110. * @return Std_ReturnType: E_OK/E_NOT_OK; specific errors are reported through DET.
  111. *
  112. * @api
  113. *
  114. * */
  115. Std_ReturnType Platform_SetIrqPriority(IRQn_Type eIrqNumber, uint8 u8Priority);
  116. /**
  117. * @brief Returns the priority of an interrupt request.
  118. *
  119. * @details This function is non-reentrant; it retrieves the current priority of
  120. * the selected interrupt.
  121. *
  122. * @param[in] eIrqNumber: interrupt number for which priority is returned.
  123. * @param[out] u8Priority: output parameter storing the priority of the interrupt.
  124. * @return Std_ReturnType: E_OK/E_NOT_OK; specific errors are reported through DET.
  125. *
  126. * @api
  127. *
  128. * */
  129. Std_ReturnType Platform_GetIrqPriority(IRQn_Type eIrqNumber, uint8 * u8Priority);
  130. /**
  131. * @brief Installs a new handler for an interrupt request.
  132. *
  133. * @details This function is non-reentrant; it replaces the current interrupt handler
  134. * for the selected interrupt with the new function provided as the second
  135. * parameter. The address of the old handler can be optionally stored in the third
  136. * parameter.
  137. *
  138. * @param[in] eIrqNumber: interrupt number for which priority is returned.
  139. * @param[in] pfNewHandler: function pointer for the new handler.
  140. * @param[out] pfOldHandler: function pointer that will store the address of the old handler
  141. * @note - this parameter can be passed as NULL if not needed.
  142. * @return pfOldHandler: E_OK/E_NOT_OK; specific errors are reported through DET.
  143. *
  144. * @api
  145. *
  146. * */
  147. Std_ReturnType Platform_InstallIrqHandler(IRQn_Type eIrqNumber,
  148. const Platform_IrqHandlerType pfNewHandler,
  149. Platform_IrqHandlerType* const pfOldHandler);
  150. #if (PLATFORM_INT_MONITOR == STD_ON)
  151. /**
  152. * @brief Configures (enables/disables) the interrupt monitor.
  153. *
  154. * @details This function is reentrant; it enables/disables the interrupt monitoring feature.
  155. *
  156. * @param[in] bEnable: TRUE - enable interrupt monitoring, FALSE - disable interrupt monitoring.
  157. * @return void
  158. *
  159. * @api
  160. *
  161. * */
  162. void Platform_SetIrqMonitor(boolean bEnable);
  163. /**
  164. * @brief Acknowledges a monitored interrupt has been served.
  165. *
  166. * @details This function is reentrant; it confirms that a monitored interrupt has been served.
  167. *
  168. * @param[in] bEnable: enable or disable monitoring, TRUE-enable FALSE-disablw.
  169. * @return void.
  170. *
  171. * @api
  172. *
  173. * */
  174. void Platform_AckIrq(IRQn_Type eIrqNumber);
  175. /**
  176. * @brief Selects an interrupt to monitor.
  177. *
  178. * @details This function is reentrant; it selects which interrupt is monitored on which
  179. * interrupt monitor.
  180. *
  181. * @param[in] u8Channel: Logical channel of interrupt monitor used.
  182. * @param[in] eIrqNumber: the interrupt vector to be monitored.
  183. * @return void.
  184. *
  185. * @api
  186. *
  187. * */
  188. void Platform_SelectMonitoredIrq(uint8 u8Channel , IRQn_Type eIrqNumber);
  189. /**
  190. * @brief Sets the latency for a monitored interrupt.
  191. *
  192. * @details This function is reentrant; it sets the accepted latency for the
  193. * monitored interrupt.
  194. *
  195. * @param[in] u8Channel: Logical channel of interrupt monitor used.
  196. * @param[in] u32Latency: The accepted latency for the monitored interrupt.
  197. * @return void.
  198. *
  199. * @api
  200. *
  201. * */
  202. void Platform_SetMonitoredIrqLatency(uint8 u8Channel, uint32 u32Latency);
  203. /**
  204. * @brief Resets the timer for an interrupt monitor.
  205. *
  206. * @details This function is reentrant; it resets the timer for the interrupt monitor.
  207. *
  208. * @param[in] u8Channel: Logical channel of interrupt monitor used.
  209. * @return void.
  210. *
  211. * @api
  212. *
  213. * */
  214. void Platform_ResetIrqMonitorTimer(uint8 u8Channel);
  215. /**
  216. * @brief Retrieves the status of an interrupt monitor.
  217. *
  218. * @details This function is reentrant; return the status of an interrupt monitor:
  219. * E_OK - latency not exceeded; E_NOT_OK - timer exceeded latency.
  220. *
  221. * @param[in] u8Channel: Logical channel of interrupt monitor used.
  222. * @return indicate that timer exceed defined latency or not
  223. * E_OK latency not exceeded
  224. * E_NOT_OK. timer exceeded latency
  225. *
  226. * @api
  227. *
  228. * */
  229. Std_ReturnType Platform_GetIrqMonitorStatus(uint8 u8Channel);
  230. #endif
  231. #define PLATFORM_STOP_SEC_CODE
  232. #include "Platform_MemMap.h"
  233. #if defined(__cplusplus)
  234. }
  235. #endif /* __cplusplus*/
  236. #endif /* PLATFORM_H_ */
  237. /** @} */