IntCtrl_Ip.h 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359
  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 INTCTRL_IP_H_
  25. #define INTCTRL_IP_H_
  26. /**
  27. * @file
  28. *
  29. * @defgroup IntCtrl_Ip Interrupt Controller IP
  30. * @ingroup Platform
  31. *
  32. * @addtogroup IntCtrl_Ip
  33. * @{
  34. */
  35. /*==================================================================================================
  36. * INCLUDE FILES
  37. ==================================================================================================*/
  38. #include "IntCtrl_Ip_Cfg.h"
  39. #include "Devassert.h"
  40. /*==================================================================================================
  41. * SOURCE FILE VERSION INFORMATION
  42. ==================================================================================================*/
  43. #define PLATFORM_INTCTRL_IP_VENDOR_ID 43
  44. #define PLATFORM_INTCTRL_IP_SW_MAJOR_VERSION 1
  45. #define PLATFORM_INTCTRL_IP_SW_MINOR_VERSION 0
  46. #define PLATFORM_INTCTRL_IP_SW_PATCH_VERSION 0
  47. /*==================================================================================================
  48. FILE VERSION CHECKS
  49. ==================================================================================================*/
  50. /* Check if current file and IntCtrl_Ip_Cfg header file are of the same vendor */
  51. #if (PLATFORM_INTCTRL_IP_VENDOR_ID != PLATFORM_INTCTRL_IP_CFG_VENDOR_ID)
  52. #error "IntCtrl_Ip.h and IntCtrl_Ip_Cfg.h have different vendor ids"
  53. #endif
  54. /* Check if current file and IntCtrl_Ip_Cfg header file are of the same Software version */
  55. #if ((PLATFORM_INTCTRL_IP_SW_MAJOR_VERSION != PLATFORM_INTCTRL_IP_CFG_SW_MAJOR_VERSION) || \
  56. (PLATFORM_INTCTRL_IP_SW_MINOR_VERSION != PLATFORM_INTCTRL_IP_CFG_SW_MINOR_VERSION) || \
  57. (PLATFORM_INTCTRL_IP_SW_PATCH_VERSION != PLATFORM_INTCTRL_IP_CFG_SW_PATCH_VERSION) \
  58. )
  59. #error "Software Version Numbers of IntCtrl_Ip.h and IntCtrl_Ip_Cfg.h are different"
  60. #endif
  61. /*==================================================================================================
  62. * FUNCTION PROTOTYPES
  63. ==================================================================================================*/
  64. #if defined(__cplusplus)
  65. extern "C" {
  66. #endif /* __cplusplus*/
  67. #define PLATFORM_START_SEC_CODE
  68. #include "Platform_MemMap.h"
  69. /**
  70. * @brief Initializes the configured interrupts at interrupt controller level.
  71. *
  72. * @details This function is non-reentrant and initializes the interrupts.
  73. *
  74. * @param[in] pIntCtrlCtrlConfig: pointer to configuration structure for interrupts.
  75. * @return IntCtrl_Ip_StatusType: error code.
  76. *
  77. * @api
  78. *
  79. * */
  80. IntCtrl_Ip_StatusType IntCtrl_Ip_Init(const IntCtrl_Ip_CtrlConfigType *pIntCtrlCtrlConfig);
  81. #if (INT_CTRL_IP_MSCM_SYSTEM_INTERRUPT_ROUTER == STD_ON)
  82. /**
  83. * @brief Initializes the configured routing interrupts .
  84. *
  85. * @details This function is non-reentrant and initializes the routing interrupts.
  86. *
  87. * @param[in] routeConfig: pointer to configuration structure for interrupts.
  88. * @return IntCtrl_Ip_StatusType: error code.
  89. *
  90. * @api
  91. *
  92. * */
  93. IntCtrl_Ip_StatusType IntCtrl_Ip_ConfigIrqRouting(const IntCtrl_Ip_GlobalRouteConfigType *routeConfig);
  94. #endif
  95. /**
  96. * @brief Installs a handler for an IRQ.
  97. *
  98. * @details This function is non-reentrant; it installs an new ISR for an interrupt line.
  99. * @note This function works only when the interrupt vector table resides in RAM.
  100. *
  101. * @param[in] eIrqNumber: interrupt number.
  102. * @param[in] pfNewHandler: function pointer for the new handler.
  103. * @param[out] pfOldHandler: stores the address of the old interrupt handler.
  104. * @return void.
  105. *
  106. * @api
  107. *
  108. * */
  109. void IntCtrl_Ip_InstallHandler(IRQn_Type eIrqNumber,
  110. const IntCtrl_Ip_IrqHandlerType pfNewHandler,
  111. IntCtrl_Ip_IrqHandlerType* const pfOldHandler);
  112. /**
  113. * @brief Enables an interrupt request.
  114. *
  115. * @details This function is non-reentrant; it enables the interrupt request at
  116. * interrupt controller level.
  117. *
  118. * @param[in] eIrqNumber: interrupt number to be enabled.
  119. * @return void.
  120. *
  121. * @api
  122. *
  123. * */
  124. void IntCtrl_Ip_EnableIrq(IRQn_Type eIrqNumber);
  125. /**
  126. * @brief Disables an interrupt request.
  127. *
  128. * @details This function is non-reentrant; it disables the interrupt request at
  129. * interrupt controller level.
  130. *
  131. * @param[in] eIrqNumber: interrupt number to be disabled.
  132. * @return void.
  133. *
  134. * @api
  135. *
  136. * */
  137. void IntCtrl_Ip_DisableIrq(IRQn_Type eIrqNumber);
  138. /**
  139. * @brief Sets the priority for an interrupt request.
  140. *
  141. * @details This function is non-reentrant; it sets the priority for the
  142. * interrupt request.
  143. *
  144. * @param[in] eIrqNumber: interrupt number for which the priority is set.
  145. * @param[in] u8Priority: the priority to be set.
  146. * @return void.
  147. *
  148. * @api
  149. *
  150. * */
  151. void IntCtrl_Ip_SetPriority(IRQn_Type eIrqNumber, uint8 u8Priority);
  152. /**
  153. * @brief Gets the priority for an interrupt request.
  154. *
  155. * @details This function is non-reentrant; it retrieves the priority for the
  156. * interrupt request.
  157. *
  158. * @param[in] eIrqNumber: interrupt number for which the priority is set.
  159. * @return uint8: the priority of the interrupt.
  160. *
  161. * @api
  162. *
  163. * */
  164. uint8 IntCtrl_Ip_GetPriority(IRQn_Type eIrqNumber);
  165. /**
  166. * @brief Clears the pending flag for an interrupt request.
  167. *
  168. * @details This function is reentrant; it clears the pending flag for the
  169. * interrupt request.
  170. *
  171. * @param[in] eIrqNumber: interrupt number for which the pending flag is cleared.
  172. * @return void.
  173. *
  174. * @api
  175. *
  176. * */
  177. void IntCtrl_Ip_ClearPending(IRQn_Type eIrqNumber);
  178. #if (INT_CTRL_IP_CORTEXR == STD_ON)
  179. /**
  180. * @brief Set ID interrupt to group1.
  181. *
  182. * @details This function is reentrant; it set the ID for the
  183. * interrupt request.
  184. *
  185. * @param[in] eIrqNumber: interrupt number for which ID need to write to group1.
  186. * @return void.
  187. *
  188. * @api
  189. *
  190. * */
  191. void IntCtrl_Ip_Group1(IRQn_Type eIrqNumber);
  192. /**
  193. * @brief Configures the specified ID as being level or edge triggered for an interrupt.
  194. *
  195. * @details This function is reentrant; the software must specify whether the interrupt is edge-triggered or level-sensitive. SGIs are always
  196. * treated as edge-triggered, and therefore GICR_ICFGR0 behaves as Read-As-One, Writes Ignored (RAO/WI) for these
  197. * interrupts.
  198. *
  199. * @param[in] eIrqNumber: interrupt number for which configures the specified ID asbeing level or edge triggered for an interrupt.
  200. * @param[in] conf: Configure the interrupt to be edge-triggered or level-sensitive.
  201. * @return void.
  202. *
  203. * @api
  204. *
  205. * */
  206. void IntCtrl_Ip_ConfigureSpi(IRQn_Type eIrqNumber, IntCtrl_Ip_TriggerType conf);
  207. /**
  208. * @brief Sets the target CPUs of the specified ID
  209. *
  210. * @details This function is reentrant; The SPI is delivered to the PE A.B.C.D, which are the affinity co-ordinates specified in the register. the affinity co-ordinates specified in the register
  211. *
  212. * @param[in] eIrqNumber: interrupt number for which Sets the target CPUs.
  213. * @param[in] target: the target of the interrupt routing mode
  214. * @return void.
  215. *
  216. * @api
  217. *
  218. * */
  219. void IntCtrl_Ip_SetIntTarget(IRQn_Type eIrqNumber, IntCtrl_Ip_Routing_ModeType target);
  220. #endif
  221. #if (INT_CTRL_IP_STANDALONE_APIS == STD_ON)
  222. /**
  223. * @brief Sets the pending flag for an interrupt request.
  224. *
  225. * @details This function is reentrant; it sets the pending flag for the
  226. * interrupt request.
  227. *
  228. * @param[in] eIrqNumber: interrupt number for which the pending flag is set.
  229. * @return void.
  230. *
  231. * @api
  232. *
  233. * */
  234. void IntCtrl_Ip_SetPending(IRQn_Type eIrqNumber);
  235. /**
  236. * @brief Gets the pending flag for an interrupt request.
  237. *
  238. * @details This function is reentrant; it retrieves the pending flag for the
  239. * interrupt request.
  240. *
  241. * @param[in] eIrqNumber: interrupt number for which the pending flag is returned.
  242. * @return boolean: TRUE - pending flag set, FALSE - pending flag cleared.
  243. *
  244. * @api
  245. *
  246. * */
  247. boolean IntCtrl_Ip_GetPending(IRQn_Type eIrqNumber);
  248. /**
  249. * @brief Gets the active flag for an interrupt request.
  250. *
  251. * @details This function is reentrant; it retrieves the active flag for the
  252. * interrupt request.
  253. *
  254. * @param[in] eIrqNumber: interrupt number for which the active flag is returned.
  255. * @return boolean: TRUE - active flag set, FALSE - active flag cleared.
  256. *
  257. * @api
  258. *
  259. * */
  260. #if !defined(S32K116) && !defined(S32K118)
  261. boolean IntCtrl_Ip_GetActive(IRQn_Type eIrqNumber);
  262. #endif
  263. #endif /* INT_CTRL_IP_STANDALONE_APIS*/
  264. #if ((INT_CTRL_IP_MSCM_SYSTEM_INTERRUPT_ROUTER == STD_ON) && (INT_CTRL_IP_ROUTING_CONTROL_REGISTER == STD_ON))
  265. /**
  266. * @brief Sets the target cores for an interrupt request.
  267. *
  268. * @details This function is non-reentrant; it configures the target cores for the
  269. * interrupt request.
  270. *
  271. * @param[in] eIrqNumber: interrupt number for which the target cores are set.
  272. * @param[in] u8TargetCores: uint8 mask to defining the target cores.
  273. * @note u8TargetCores parameter encodes the CPU targets as defined in each platform
  274. * (see MSCM IRSPRCx register) - the function writes this value to the corresponding
  275. * IRSPRCx register directly.
  276. * @return void.
  277. *
  278. * @api
  279. *
  280. * */
  281. void IntCtrl_Ip_SetTargetCores(IRQn_Type eIrqNumber, uint8 u8TargetCores);
  282. #endif
  283. #if (INT_CTRL_IP_MSI_AVAILABLE == STD_ON)
  284. /**
  285. * @brief Clear directed cpu Interrupt interrupt flag.
  286. *
  287. * @details This function is non-reentrant; it is provided for clearing directed cpu Interrupt interrupt flag.
  288. *
  289. * @param[in] eIrqNumber: interrupt number
  290. * @return void.
  291. *
  292. * @api
  293. *
  294. * */
  295. void IntCtrl_Ip_ClearDirectedCpuInterrupt(IRQn_Type eIrqNumber);
  296. /**
  297. * @brief Get directed cpu Interrupt interrupt flag.
  298. *
  299. * @details This function is non-reentrant; it is provided for getting directed cpu Interrupt interrupt flag.
  300. *
  301. * @param[in] eIrqNumber: interrupt number
  302. * @return boolean: TRUE - flag set, FALSE - flag cleared.
  303. *
  304. * @api
  305. *
  306. * */
  307. boolean IntCtrl_Ip_GetDirectedCpuInterrupt(IRQn_Type eIrqNumber);
  308. /**
  309. * @brief Generates an interrupt request to a CPU target.
  310. *
  311. * @details This function is non-reentrant; it is provided for generating a directed interrupt
  312. * to a CPU defined by target parameter.
  313. *
  314. * @param[in] eIrqNumber: interrupt number to be triggered.
  315. * @param[in] eCpuTarget: target core for the interrupt request.
  316. * @return void.
  317. *
  318. * @api
  319. *
  320. * */
  321. void IntCtrl_Ip_GenerateDirectedCpuInterrupt(IRQn_Type eIrqNumber, IntCtrl_Ip_IrqTargetType eCpuTarget);
  322. #endif
  323. #define PLATFORM_STOP_SEC_CODE
  324. #include "Platform_MemMap.h"
  325. #if defined(__cplusplus)
  326. }
  327. #endif /* __cplusplus*/
  328. #endif /* INTCTRL_IP_H_ */
  329. /** @} */