het.h 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378
  1. /** @file het.h
  2. * @brief HET Driver Definition File
  3. * @date 29.May.2013
  4. * @version 03.05.02
  5. *
  6. */
  7. /* (c) Texas Instruments 2009-2013, All rights reserved. */
  8. #ifndef __HET_H__
  9. #define __HET_H__
  10. #include "reg_het.h"
  11. #include <string.h>
  12. /* USER CODE BEGIN (0) */
  13. /* USER CODE END */
  14. /** @def pwm0
  15. * @brief Pwm signal 0
  16. *
  17. * Alias for pwm signal 0
  18. */
  19. #define pwm0 0U
  20. /** @def pwm1
  21. * @brief Pwm signal 1
  22. *
  23. * Alias for pwm signal 1
  24. */
  25. #define pwm1 1U
  26. /** @def pwm2
  27. * @brief Pwm signal 2
  28. *
  29. * Alias for pwm signal 2
  30. */
  31. #define pwm2 2U
  32. /** @def pwm3
  33. * @brief Pwm signal 3
  34. *
  35. * Alias for pwm signal 3
  36. */
  37. #define pwm3 3U
  38. /** @def pwm4
  39. * @brief Pwm signal 4
  40. *
  41. * Alias for pwm signal 4
  42. */
  43. #define pwm4 4U
  44. /** @def pwm5
  45. * @brief Pwm signal 5
  46. *
  47. * Alias for pwm signal 5
  48. */
  49. #define pwm5 5U
  50. /** @def pwm6
  51. * @brief Pwm signal 6
  52. *
  53. * Alias for pwm signal 6
  54. */
  55. #define pwm6 6U
  56. /** @def pwm7
  57. * @brief Pwm signal 7
  58. *
  59. * Alias for pwm signal 7
  60. */
  61. #define pwm7 7U
  62. /** @def edge0
  63. * @brief Edge signal 0
  64. *
  65. * Alias for edge signal 0
  66. */
  67. #define edge0 0U
  68. /** @def edge1
  69. * @brief Edge signal 1
  70. *
  71. * Alias for edge signal 1
  72. */
  73. #define edge1 1U
  74. /** @def edge2
  75. * @brief Edge signal 2
  76. *
  77. * Alias for edge signal 2
  78. */
  79. #define edge2 2U
  80. /** @def edge3
  81. * @brief Edge signal 3
  82. *
  83. * Alias for edge signal 3
  84. */
  85. #define edge3 3U
  86. /** @def edge4
  87. * @brief Edge signal 4
  88. *
  89. * Alias for edge signal 4
  90. */
  91. #define edge4 4U
  92. /** @def edge5
  93. * @brief Edge signal 5
  94. *
  95. * Alias for edge signal 5
  96. */
  97. #define edge5 5U
  98. /** @def edge6
  99. * @brief Edge signal 6
  100. *
  101. * Alias for edge signal 6
  102. */
  103. #define edge6 6U
  104. /** @def edge7
  105. * @brief Edge signal 7
  106. *
  107. * Alias for edge signal 7
  108. */
  109. #define edge7 7U
  110. /** @def cap0
  111. * @brief Capture signal 0
  112. *
  113. * Alias for capture signal 0
  114. */
  115. #define cap0 0U
  116. /** @def cap1
  117. * @brief Capture signal 1
  118. *
  119. * Alias for capture signal 1
  120. */
  121. #define cap1 1U
  122. /** @def cap2
  123. * @brief Capture signal 2
  124. *
  125. * Alias for capture signal 2
  126. */
  127. #define cap2 2U
  128. /** @def cap3
  129. * @brief Capture signal 3
  130. *
  131. * Alias for capture signal 3
  132. */
  133. #define cap3 3U
  134. /** @def cap4
  135. * @brief Capture signal 4
  136. *
  137. * Alias for capture signal 4
  138. */
  139. #define cap4 4U
  140. /** @def cap5
  141. * @brief Capture signal 5
  142. *
  143. * Alias for capture signal 5
  144. */
  145. #define cap5 5U
  146. /** @def cap6
  147. * @brief Capture signal 6
  148. *
  149. * Alias for capture signal 6
  150. */
  151. #define cap6 6U
  152. /** @def cap7
  153. * @brief Capture signal 7
  154. *
  155. * Alias for capture signal 7
  156. */
  157. #define cap7 7U
  158. /** @def pwmEND_OF_DUTY
  159. * @brief Pwm end of duty
  160. *
  161. * Alias for pwm end of duty notification
  162. */
  163. #define pwmEND_OF_DUTY 2U
  164. /** @def pwmEND_OF_PERIOD
  165. * @brief Pwm end of period
  166. *
  167. * Alias for pwm end of period notification
  168. */
  169. #define pwmEND_OF_PERIOD 4U
  170. /** @def pwmEND_OF_BOTH
  171. * @brief Pwm end of duty and period
  172. *
  173. * Alias for pwm end of duty and period notification
  174. */
  175. #define pwmEND_OF_BOTH 6U
  176. /* USER CODE BEGIN (1) */
  177. /* USER CODE END */
  178. /** @struct hetBase
  179. * @brief HET Register Definition
  180. *
  181. * This structure is used to access the HET module registers.
  182. */
  183. /** @typedef hetBASE_t
  184. * @brief HET Register Frame Type Definition
  185. *
  186. * This type is used to access the HET Registers.
  187. */
  188. enum hetPinSelect
  189. {
  190. PIN_HET_0 = 0U,
  191. PIN_HET_1 = 1U,
  192. PIN_HET_2 = 2U,
  193. PIN_HET_3 = 3U,
  194. PIN_HET_4 = 4U,
  195. PIN_HET_5 = 5U,
  196. PIN_HET_6 = 6U,
  197. PIN_HET_7 = 7U,
  198. PIN_HET_8 = 8U,
  199. PIN_HET_9 = 9U,
  200. PIN_HET_10 = 10U,
  201. PIN_HET_11 = 11U,
  202. PIN_HET_12 = 12U,
  203. PIN_HET_13 = 13U,
  204. PIN_HET_14 = 14U,
  205. PIN_HET_15 = 15U,
  206. PIN_HET_16 = 16U,
  207. PIN_HET_17 = 17U,
  208. PIN_HET_18 = 18U,
  209. PIN_HET_19 = 19U,
  210. PIN_HET_20 = 20U,
  211. PIN_HET_21 = 21U,
  212. PIN_HET_22 = 22U,
  213. PIN_HET_23 = 23U,
  214. PIN_HET_24 = 24U,
  215. PIN_HET_25 = 25U,
  216. PIN_HET_26 = 26U,
  217. PIN_HET_27 = 27U,
  218. PIN_HET_28 = 28U,
  219. PIN_HET_29 = 29U,
  220. PIN_HET_30 = 30U,
  221. PIN_HET_31 = 31U
  222. };
  223. /** @struct hetInstructionBase
  224. * @brief HET Instruction Definition
  225. *
  226. * This structure is used to access the HET RAM.
  227. */
  228. /** @typedef hetINSTRUCTION_t
  229. * @brief HET Instruction Type Definition
  230. *
  231. * This type is used to access a HET Instruction.
  232. */
  233. typedef volatile struct hetInstructionBase
  234. {
  235. uint32 Program;
  236. uint32 Control;
  237. uint32 Data;
  238. uint32 rsvd1;
  239. } hetINSTRUCTION_t;
  240. /** @struct hetRamBase
  241. * @brief HET RAM Definition
  242. *
  243. * This structure is used to access the HET RAM.
  244. */
  245. /** @typedef hetRAMBASE_t
  246. * @brief HET RAM Type Definition
  247. *
  248. * This type is used to access the HET RAM.
  249. */
  250. typedef volatile struct het1RamBase
  251. {
  252. hetINSTRUCTION_t Instruction[160U];
  253. } hetRAMBASE_t;
  254. /** @struct hetSignal
  255. * @brief HET Signal Definition
  256. *
  257. * This structure is used to define a pwm signal.
  258. */
  259. /** @typedef hetSIGNAL_t
  260. * @brief HET Signal Type Definition
  261. *
  262. * This type is used to access HET Signal Information.
  263. */
  264. typedef struct hetSignal
  265. {
  266. uint32 duty; /**< Duty cycle in % of the period */
  267. float64 period; /**< Period in us */
  268. } hetSIGNAL_t;
  269. /**
  270. * @defgroup HET HET
  271. * @brief Inter-Integrated Circuit Module.
  272. *
  273. * The HET is a software-controlled timer with a dedicated specialized timer micromachine and a set of 30 instructions.
  274. * The HET micromachine is connected to a port of up to 32 input/output (I/O) pins.
  275. *
  276. * Related Files
  277. * - reg_het.h
  278. * - het.h
  279. * - het.c
  280. * - reg_htu.h
  281. * - htu.h
  282. * - std_nhet.h
  283. * @addtogroup HET
  284. * @{
  285. */
  286. /* HET Interface Functions */
  287. void hetInit(void);
  288. /* PWM Interface Functions */
  289. void pwmStart(hetRAMBASE_t * hetRAM,uint32 pwm);
  290. void pwmStop(hetRAMBASE_t * hetRAM,uint32 pwm);
  291. void pwmSetDuty(hetRAMBASE_t * hetRAM,uint32 pwm, uint32 pwmDuty);
  292. void pwmSetSignal(hetRAMBASE_t * hetRAM,uint32 pwm, hetSIGNAL_t signal);
  293. hetSIGNAL_t pwmGetSignal(hetRAMBASE_t * hetRAM,uint32 pwm);
  294. void pwmEnableNotification(hetBASE_t * hetREG,uint32 pwm, uint32 notification);
  295. void pwmDisableNotification(hetBASE_t * hetREG,uint32 pwm, uint32 notification);
  296. void pwmNotification(hetBASE_t * hetREG,uint32 pwm, uint32 notification);
  297. /* Edge Interface Functions */
  298. void edgeResetCounter(hetRAMBASE_t * hetRAM,uint32 edge);
  299. uint32 edgeGetCounter(hetRAMBASE_t * hetRAM,uint32 edge);
  300. void edgeEnableNotification(hetBASE_t * hetREG,uint32 edge);
  301. void edgeDisableNotification(hetBASE_t * hetREG,uint32 edge);
  302. void edgeNotification(hetBASE_t * hetREG,uint32 edge);
  303. /* Captured Signal Interface Functions */
  304. hetSIGNAL_t capGetSignal(hetRAMBASE_t * hetRAM,uint32 cap);
  305. /* Timestamp Interface Functions */
  306. void hetResetTimestamp(hetRAMBASE_t * hetRAM);
  307. uint32 hetGetTimestamp(hetRAMBASE_t * hetRAM);
  308. /** @fn void hetNotification(hetBASE_t *het, uint32 offset)
  309. * @brief het interrupt callback
  310. * @param[in] het - Het module base address
  311. * - hetREG1: HET1 module base address pointer
  312. * - hetREG2: HET2 module base address pointer
  313. * @param[in] offset - het interrupt offset / Source number
  314. *
  315. * @note This function has to be provide by the user.
  316. *
  317. * This is a interrupt callback that is provided by the application and is call upon
  318. * an het interrupt. The parameter passed to the callback is a copy of the interrupt
  319. * offset register which is used to decode the interrupt source.
  320. */
  321. void hetNotification(hetBASE_t *het, uint32 offset);
  322. /**@}*/
  323. /* USER CODE BEGIN (2) */
  324. /* USER CODE END */
  325. #endif