wm_pmu.h 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  1. /**
  2. * @file wm_pmu.h
  3. *
  4. * @brief pmu driver module
  5. *
  6. * @author dave
  7. *
  8. * Copyright (c) 2014 Winner Microelectronics Co., Ltd.
  9. */
  10. #ifndef WM_PMU_H
  11. #define WM_PMU_H
  12. #include "wm_type_def.h"
  13. /** peripheral type */
  14. typedef enum {
  15. TLS_PERIPHERAL_TYPE_I2C = (1 << 0), /**< peripheral type : I2C */
  16. TLS_PERIPHERAL_TYPE_UART0 = (1 << 1), /**< peripheral type : UART0 */
  17. TLS_PERIPHERAL_TYPE_UART1 = (1 << 2), /**< peripheral type : UART1 */
  18. TLS_PERIPHERAL_TYPE_UART2 = (1 << 3), /**< peripheral type : UART2 */
  19. TLS_PERIPHERAL_TYPE_UART3 = (1 << 4), /**< peripheral type : UART3 */
  20. TLS_PERIPHERAL_TYPE_UART4 = (1 << 5), /**< peripheral type : UART4 */
  21. TLS_PERIPHERAL_TYPE_UART5 = (1 << 6), /**< peripheral type : UART4 */
  22. TLS_PERIPHERAL_TYPE_LSPI = (1 << 7), /**< peripheral type : LSPI */
  23. TLS_PERIPHERAL_TYPE_DMA = (1 << 8), /**< peripheral type : DMA */
  24. TLS_PERIPHERAL_TYPE_TIMER = (1 << 10), /**< peripheral type : TIMER */
  25. TLS_PERIPHERAL_TYPE_GPIO = (1 << 11), /**< peripheral type : GPIO */
  26. TLS_PERIPHERAL_TYPE_SDADC = (1 << 12), /**< peripheral type : SDADC */
  27. TLS_PERIPHERAL_TYPE_PWM = (1 << 13), /**< peripheral type : PWM */
  28. TLS_PERIPHERAL_TYPE_LCD = (1 << 14), /**< peripheral type : LCD */
  29. TLS_PERIPHERAL_TYPE_I2S = (1 << 15), /**< peripheral type : I2S */
  30. TLS_PERIPHERAL_TYPE_RSA = (1 << 16), /**< peripheral type : RSA */
  31. TLS_PERIPHERAL_TYPE_GPSEC = (1 << 17), /**< peripheral type : GPSEC */
  32. TLS_PERIPHERAL_TYPE_SDIO_MASTER = (1<<18), /**< peripheral type : SDIO */
  33. TLS_PERIPHERAL_TYPE_PSRAM = (1<<19), /**< peripheral type : PSRAM */
  34. TLS_PERIPHERAL_TYPE_BT = (1<<20), /**< peripheral type : BT */
  35. TLS_PERIPHERAL_TYPE_TOUCH_SENSOR = (1 << 21) /**< peripheral type : TOUCH */
  36. }tls_peripheral_type_s;
  37. /** callback function of PMU interrupt */
  38. typedef void (*tls_pmu_irq_callback)(void *arg);
  39. /**
  40. * @defgroup Driver_APIs Driver APIs
  41. * @brief Driver APIs
  42. */
  43. /**
  44. * @addtogroup Driver_APIs
  45. * @{
  46. */
  47. /**
  48. * @defgroup PMU_Driver_APIs PMU Driver APIs
  49. * @brief PMU driver APIs
  50. */
  51. /**
  52. * @addtogroup PMU_Driver_APIs
  53. * @{
  54. */
  55. /**
  56. * @brief This function is used to register pmu timer1 interrupt
  57. *
  58. * @param[in] callback the pmu timer1 interrupt call back function
  59. * @param[in] arg parameter of call back function
  60. *
  61. * @return None
  62. *
  63. * @note
  64. * user not need clear interrupt flag.
  65. * pmu timer1 callback function is called in interrupt,
  66. * so can not operate the critical data in the callback fuuction,
  67. * recommendation to send messages to other tasks to operate it.
  68. */
  69. void tls_pmu_timer1_isr_register(tls_pmu_irq_callback callback, void *arg);
  70. /**
  71. * @brief This function is used to register pmu timer0 interrupt
  72. *
  73. * @param[in] callback the pmu timer0 interrupt call back function
  74. * @param[in] arg parameter of call back function
  75. *
  76. * @return None
  77. *
  78. * @note
  79. * user not need clear interrupt flag.
  80. * pmu timer0 callback function is called in interrupt,
  81. * so can not operate the critical data in the callback fuuction,
  82. * recommendation to send messages to other tasks to operate it.
  83. */
  84. void tls_pmu_timer0_isr_register(tls_pmu_irq_callback callback, void *arg);
  85. /**
  86. * @brief This function is used to register pmu gpio interrupt
  87. *
  88. * @param[in] callback the pmu gpio interrupt call back function
  89. * @param[in] arg parameter of call back function
  90. *
  91. * @return None
  92. *
  93. * @note
  94. * user not need clear interrupt flag.
  95. * pmu gpio callback function is called in interrupt,
  96. * so can not operate the critical data in the callback fuuction,
  97. * recommendation to send messages to other tasks to operate it.
  98. */
  99. void tls_pmu_gpio_isr_register(tls_pmu_irq_callback callback, void *arg);
  100. /**
  101. * @brief This function is used to register pmu sdio interrupt
  102. *
  103. * @param[in] callback the pmu sdio interrupt call back function
  104. * @param[in] arg parameter of call back function
  105. *
  106. * @return None
  107. *
  108. * @note
  109. * user not need clear interrupt flag.
  110. * pmu sdio callback function is called in interrupt,
  111. * so can not operate the critical data in the callback fuuction,
  112. * recommendation to send messages to other tasks to operate it.
  113. */
  114. void tls_pmu_sdio_isr_register(tls_pmu_irq_callback callback, void *arg);
  115. /**
  116. * @brief This function is used to select pmu clk
  117. *
  118. * @param[in] bypass pmu clk whether or not use bypass mode
  119. * 1 pmu clk use 32K by 40MHZ
  120. * other pmu clk 32K by calibration circuit
  121. *
  122. * @return None
  123. *
  124. * @note None
  125. */
  126. void tls_pmu_clk_select(u8 bypass);
  127. /**
  128. * @brief This function is used to start pmu timer0
  129. *
  130. * @param[in] second vlaue of timer0 count[s]
  131. *
  132. * @return None
  133. *
  134. * @note None
  135. */
  136. void tls_pmu_timer0_start(u16 second);
  137. /**
  138. * @brief This function is used to stop pmu timer0
  139. *
  140. * @param None
  141. *
  142. * @return None
  143. *
  144. * @note None
  145. */
  146. void tls_pmu_timer0_stop(void);
  147. /**
  148. * @brief This function is used to start pmu timer1
  149. *
  150. * @param[in] second vlaue of timer1 count[ms]
  151. *
  152. * @return None
  153. *
  154. * @note None
  155. */
  156. void tls_pmu_timer1_start(u16 msec);
  157. /**
  158. * @brief This function is used to stop pmu timer1
  159. *
  160. * @param None
  161. *
  162. * @return None
  163. *
  164. * @note None
  165. */
  166. void tls_pmu_timer1_stop(void);
  167. /**
  168. * @brief This function is used to start pmu goto standby
  169. *
  170. * @param None
  171. *
  172. * @return None
  173. *
  174. * @note None
  175. */
  176. void tls_pmu_standby_start(void);
  177. /**
  178. * @brief This function is used to start pmu goto sleep
  179. *
  180. * @param None
  181. *
  182. * @return None
  183. *
  184. * @note None
  185. */
  186. void tls_pmu_sleep_start(void);
  187. /**
  188. * @brief This function is used to close peripheral's clock
  189. *
  190. * @param[in] devices peripherals
  191. *
  192. * @return None
  193. *
  194. * @note None
  195. */
  196. void tls_close_peripheral_clock(tls_peripheral_type_s devices);
  197. /**
  198. * @brief This function is used to open peripheral's clock
  199. *
  200. * @param[in] devices peripherals
  201. *
  202. * @return None
  203. *
  204. * @note None
  205. */
  206. void tls_open_peripheral_clock(tls_peripheral_type_s devices);
  207. /**
  208. * @}
  209. */
  210. /**
  211. * @}
  212. */
  213. #endif