hc32_ll_aos.h 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  1. /**
  2. *******************************************************************************
  3. * @file hc32_ll_aos.h
  4. * @brief This file contains all the functions prototypes of the AOS driver
  5. * library.
  6. @verbatim
  7. Change Logs:
  8. Date Author Notes
  9. 2022-12-31 CDT First version
  10. @endverbatim
  11. *******************************************************************************
  12. * Copyright (C) 2022, Xiaohua Semiconductor Co., Ltd. All rights reserved.
  13. *
  14. * This software component is licensed by XHSC under BSD 3-Clause license
  15. * (the "License"); You may not use this file except in compliance with the
  16. * License. You may obtain a copy of the License at:
  17. * opensource.org/licenses/BSD-3-Clause
  18. *
  19. *******************************************************************************
  20. */
  21. #ifndef __HC32_LL_AOS_H__
  22. #define __HC32_LL_AOS_H__
  23. /* C binding of definitions if building with C++ compiler */
  24. #ifdef __cplusplus
  25. extern "C"
  26. {
  27. #endif
  28. /*******************************************************************************
  29. * Include files
  30. ******************************************************************************/
  31. #include "hc32_ll_def.h"
  32. #include "hc32f4xx.h"
  33. #include "hc32f4xx_conf.h"
  34. /**
  35. * @addtogroup LL_Driver
  36. * @{
  37. */
  38. /**
  39. * @addtogroup LL_AOS
  40. * @{
  41. */
  42. #if (LL_AOS_ENABLE == DDL_ON)
  43. /*******************************************************************************
  44. * Global type definitions ('typedef')
  45. ******************************************************************************/
  46. /*******************************************************************************
  47. * Global pre-processor symbols/macros ('#define')
  48. ******************************************************************************/
  49. /**
  50. * @defgroup AOS_Global_Macros AOS Global Macros
  51. * @{
  52. */
  53. /**
  54. * @defgroup AOS_Target_Select AOS Target Select
  55. * @{
  56. */
  57. #define AOS_DCU1 (uint32_t)(&CM_AOS->DCU_TRGSEL1)
  58. #define AOS_DCU2 (uint32_t)(&CM_AOS->DCU_TRGSEL2)
  59. #define AOS_DCU3 (uint32_t)(&CM_AOS->DCU_TRGSEL3)
  60. #define AOS_DCU4 (uint32_t)(&CM_AOS->DCU_TRGSEL4)
  61. #define AOS_DMA1_0 (uint32_t)(&CM_AOS->DMA1_TRGSEL0)
  62. #define AOS_DMA1_1 (uint32_t)(&CM_AOS->DMA1_TRGSEL1)
  63. #define AOS_DMA1_2 (uint32_t)(&CM_AOS->DMA1_TRGSEL2)
  64. #define AOS_DMA1_3 (uint32_t)(&CM_AOS->DMA1_TRGSEL3)
  65. #define AOS_DMA1_4 (uint32_t)(&CM_AOS->DMA1_TRGSEL4)
  66. #define AOS_DMA1_5 (uint32_t)(&CM_AOS->DMA1_TRGSEL5)
  67. #define AOS_DMA2_0 (uint32_t)(&CM_AOS->DMA2_TRGSEL0)
  68. #define AOS_DMA2_1 (uint32_t)(&CM_AOS->DMA2_TRGSEL1)
  69. #define AOS_DMA2_2 (uint32_t)(&CM_AOS->DMA2_TRGSEL2)
  70. #define AOS_DMA2_3 (uint32_t)(&CM_AOS->DMA2_TRGSEL3)
  71. #define AOS_DMA2_4 (uint32_t)(&CM_AOS->DMA2_TRGSEL4)
  72. #define AOS_DMA2_5 (uint32_t)(&CM_AOS->DMA2_TRGSEL5)
  73. #define AOS_DMA_RC (uint32_t)(&CM_AOS->DMA_TRGSELRC)
  74. #define AOS_TMR6_0 (uint32_t)(&CM_AOS->TMR6_HTSSR0)
  75. #define AOS_TMR6_1 (uint32_t)(&CM_AOS->TMR6_HTSSR1)
  76. #define AOS_TMR4_0 (uint32_t)(&CM_AOS->TMR4_HTSSR0)
  77. #define AOS_TMR4_1 (uint32_t)(&CM_AOS->TMR4_HTSSR1)
  78. #define AOS_TMR4_2 (uint32_t)(&CM_AOS->TMR4_HTSSR2)
  79. #define AOS_EVTPORT12 (uint32_t)(&CM_AOS->PEVNTTRGSR12)
  80. #define AOS_EVTPORT34 (uint32_t)(&CM_AOS->PEVNTTRGSR34)
  81. #define AOS_TMR0 (uint32_t)(&CM_AOS->TMR0_HTSSR)
  82. #define AOS_TMRA_0 (uint32_t)(&CM_AOS->TMRA_HTSSR0)
  83. #define AOS_TMRA_1 (uint32_t)(&CM_AOS->TMRA_HTSSR1)
  84. #define AOS_TMRA_2 (uint32_t)(&CM_AOS->TMRA_HTSSR2)
  85. #define AOS_TMRA_3 (uint32_t)(&CM_AOS->TMRA_HTSSR3)
  86. #define AOS_ADC1_0 (uint32_t)(&CM_AOS->ADC1_ITRGSELR0)
  87. #define AOS_ADC1_1 (uint32_t)(&CM_AOS->ADC1_ITRGSELR1)
  88. #define AOS_ADC2_0 (uint32_t)(&CM_AOS->ADC2_ITRGSELR0)
  89. #define AOS_ADC2_1 (uint32_t)(&CM_AOS->ADC2_ITRGSELR1)
  90. #define AOS_ADC3_0 (uint32_t)(&CM_AOS->ADC3_ITRGSELR0)
  91. #define AOS_ADC3_1 (uint32_t)(&CM_AOS->ADC3_ITRGSELR1)
  92. #define AOS_COMM_1 (uint32_t)(&CM_AOS->COMTRG1)
  93. #define AOS_COMM_2 (uint32_t)(&CM_AOS->COMTRG2)
  94. /**
  95. * @}
  96. */
  97. /**
  98. * @defgroup AOS_Common_Trigger_ID AOS Common Trigger ID
  99. * @{
  100. */
  101. #define AOS_COMM_TRIG1 (1UL << 30U)
  102. #define AOS_COMM_TRIG2 (1UL << 31U)
  103. #define AOS_COMM_TRIG_MASK (AOS_COMM_TRIG1 | AOS_COMM_TRIG2)
  104. /**
  105. * @}
  106. */
  107. /**
  108. * @defgroup AOS_Trigger_Select_Mask AOS Trigger Select Mask
  109. * @{
  110. */
  111. #define AOS_TRIG_SEL_MASK (0x1FFUL)
  112. /**
  113. * @}
  114. */
  115. /**
  116. * @defgroup AOS_PLU_ID AOS PL Unit ID
  117. * @{
  118. */
  119. #define AOS_PLU_ID0 (0UL)
  120. #define AOS_PLU_ID1 (1UL)
  121. #define AOS_PLU_ID2 (2UL)
  122. #define AOS_PLU_ID3 (3UL)
  123. /**
  124. * @}
  125. */
  126. /**
  127. * @defgroup AOS_PLU_SEL AOS PL Unit Selection
  128. * @note AOS_PLU_SEL_NONE means selecting AOS source event to trigger AOS target.
  129. * otherwise selecting ouput of selected PLU to trigger AOS target
  130. * @{
  131. */
  132. #define AOS_PLU_SEL_UNIT0 (AOS_PLU_ID0)
  133. #define AOS_PLU_SEL_UNIT1 (AOS_PLU_ID1)
  134. #define AOS_PLU_SEL_UNIT2 (AOS_PLU_ID2)
  135. #define AOS_PLU_SEL_UNIT3 (AOS_PLU_ID3)
  136. #define AOS_PLU_SEL_NONE (0xFFFFUL)
  137. /**
  138. * @}
  139. */
  140. /**
  141. * @defgroup AOS_PLU_PLInput_ID AOS PLU PL Input ID
  142. * @{
  143. */
  144. #define AOS_PLU_PLIN_ID_A (0UL)
  145. #define AOS_PLU_PLIN_ID_B (1UL)
  146. #define AOS_PLU_PLIN_ID_C (2UL)
  147. #define AOS_PLU_PLIN_ID_D (3UL)
  148. /**
  149. * @}
  150. */
  151. /**
  152. * @defgroup AOS_PLU_PLInput_Src AOS PL Input Source
  153. * @{
  154. */
  155. #define AOS_PLU_PLIN_SRC_NUM0 (0UL)
  156. #define AOS_PLU_PLIN_SRC_NUM1 (1UL)
  157. #define AOS_PLU_PLIN_SRC_TRIG_EVT (2UL)
  158. #define AOS_PLU_PLIN_SRC_PORT_IN (3UL)
  159. /**
  160. * @}
  161. */
  162. /**
  163. * @defgroup AOS_PLU_Mode AOS PLU logic Operation Mode
  164. * @{
  165. */
  166. #define AOS_PLU_MODE_OR_OR (0UL) /*!< (PLINA | PLINB) | (PLINC | PLIND) */
  167. #define AOS_PLU_MODE_AND_OR (1UL) /*!< (PLINA & PLINB) | (PLINC & PLIND) */
  168. #define AOS_PLU_MODE_OR_XOR (2UL) /*!< (PLINA | PLINB) ^ (PLINC | PLIND) */
  169. #define AOS_PLU_MODE_AND_AND (3UL) /*!< (PLINA & PLINB) & (PLINC & PLIND) */
  170. /**
  171. * @}
  172. */
  173. /**
  174. * @}
  175. */
  176. /*******************************************************************************
  177. * Global variable definitions ('extern')
  178. ******************************************************************************/
  179. /*******************************************************************************
  180. Global function prototypes (definition in C source)
  181. ******************************************************************************/
  182. /**
  183. * @addtogroup AOS_Global_Functions
  184. * @{
  185. */
  186. /**
  187. * @brief AOS software trigger.
  188. * @param None
  189. * @retval None
  190. */
  191. __STATIC_INLINE void AOS_SW_Trigger(void)
  192. {
  193. WRITE_REG32(bCM_AOS->INTSFTTRG_b.STRG, SET);
  194. }
  195. void AOS_CommonTriggerCmd(uint32_t u32Target, uint32_t u32CommonTrigger, en_functional_state_t enNewState);
  196. void AOS_SetTriggerEventSrc(uint32_t u32Target, en_event_src_t enSource);
  197. void AOS_PLU_SetPlinTriggerEventSrc(uint32_t u32PluId, uint32_t u32PlinId, en_event_src_t enSource);
  198. void AOS_PLU_SetPlinSrc(uint32_t u32PluId, uint32_t u32PlinId, uint32_t u32Source);
  199. void AOS_PLU_SetLogicOperationMode(uint32_t u32PluId, uint32_t u32Mode);
  200. void AOS_SelectPLU(uint32_t u32Target, uint32_t u32PluSel);
  201. /**
  202. * @}
  203. */
  204. #endif /* LL_AOS_ENABLE */
  205. /**
  206. * @}
  207. */
  208. /**
  209. * @}
  210. */
  211. #ifdef __cplusplus
  212. }
  213. #endif
  214. #endif /* __HC32_LL_AOS_H__ */
  215. /*******************************************************************************
  216. * EOF (not truncated)
  217. ******************************************************************************/