hpm_sysctl_drv.h 51 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675
  1. /**
  2. * Copyright (c) 2021 HPMicro
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. *
  6. */
  7. #ifndef HPM_SYSCTL_DRV_H
  8. #define HPM_SYSCTL_DRV_H
  9. #include "hpm_common.h"
  10. #include "hpm_sysctl_regs.h"
  11. /**
  12. *
  13. * @brief SYSCTL driver APIs
  14. * @defgroup sysctl_interface SYSCTL driver APIs
  15. * @ingroup io_interfaces
  16. * @{
  17. */
  18. /**
  19. * @brief Retention domains
  20. */
  21. typedef enum {
  22. sysctl_retention_domain_sys = 0,
  23. sysctl_retention_domain_cpu0 = 2,
  24. sysctl_retention_domain_cpu1 = 4,
  25. sysctl_retention_domain_conn = 6,
  26. sysctl_retention_domain_vis = 8,
  27. sysctl_retention_domain_xtal24m = 10,
  28. sysctl_retention_domain_pll0 = 11,
  29. sysctl_retention_domain_pll1 = 12,
  30. sysctl_retention_domain_pll2 = 13,
  31. sysctl_retention_domain_pll3 = 14,
  32. sysctl_retention_domain_pll4 = 15,
  33. } sysctl_retention_domain_t;
  34. /**
  35. * @brief Clock presets
  36. */
  37. typedef enum {
  38. sysctl_preset_0 = 1 << 0,
  39. sysctl_preset_1 = 1 << 1,
  40. sysctl_preset_2 = 1 << 2,
  41. sysctl_preset_3 = 1 << 3,
  42. } sysctl_preset_t;
  43. /**
  44. * @brief Reset domains
  45. */
  46. typedef enum {
  47. sysctl_reset_domain_soc = 0,
  48. sysctl_reset_domain_con,
  49. sysctl_reset_domain_vis,
  50. sysctl_reset_domain_cpu0,
  51. sysctl_reset_domain_cpu1,
  52. } sysctl_reset_domain_t;
  53. /**
  54. * @brief Resource
  55. */
  56. typedef enum {
  57. sysctl_resource_cpu0 = 0,
  58. sysctl_resource_cpx0 = 1,
  59. sysctl_resource_exe0 = 2,
  60. sysctl_resource_wak0 = 3,
  61. sysctl_resource_cpu0_per = 4,
  62. sysctl_resource_cpu1 = 8,
  63. sysctl_resource_cpx1 = 9,
  64. sysctl_resource_exe1 = 10,
  65. sysctl_resource_wak1 = 11,
  66. sysctl_resource_cpu1_per = 12,
  67. sysctl_resource_logic0 = 16,
  68. sysctl_resource_logic1 = 17,
  69. sysctl_resource_logic2 = 18,
  70. sysctl_resource_logic3 = 19,
  71. sysctl_resource_pmic = 20,
  72. sysctl_resource_pow_con = 21,
  73. sysctl_resource_pow_vis = 22,
  74. sysctl_resource_pow_cpu0 = 23,
  75. sysctl_resource_pow_cpu1 = 24,
  76. sysctl_resource_rst_soc = 25,
  77. sysctl_resource_rst_con = 26,
  78. sysctl_resource_rst_vis = 27,
  79. sysctl_resource_rst_cpu0 = 28,
  80. sysctl_resource_rst_cpu1 = 29,
  81. sysctl_resource_xtal = 32,
  82. sysctl_resource_pll0 = 33,
  83. sysctl_resource_clk0_pll0 = 34,
  84. sysctl_resource_pll1 = 35,
  85. sysctl_resource_clk0_pll1 = 36,
  86. sysctl_resource_clk1_pll1 = 37,
  87. sysctl_resource_pll2 = 38,
  88. sysctl_resource_clk0_pll2 = 39,
  89. sysctl_resource_clk1_pll2 = 40,
  90. sysctl_resource_pll3 = 41,
  91. sysctl_resource_clk0_pll3 = 42,
  92. sysctl_resource_pll4 = 43,
  93. sysctl_resource_clk0_pll4 = 44,
  94. sysctl_resource_mbist_soc = 48,
  95. sysctl_resource_mbist_cpu = 49,
  96. sysctl_resource_mbist_cpu1 = 50,
  97. sysctl_resource_mbist_con = 51,
  98. sysctl_resource_mbist_vis = 52,
  99. sysctl_resource_clk_top_cpu0 = 64,
  100. sysctl_resource_clk_top_mchtmr0 = 65,
  101. sysctl_resource_clk_top_cpu1 = 66,
  102. sysctl_resource_clk_top_mchtmr1 = 67,
  103. sysctl_resource_clk_top_axi0 = 68,
  104. sysctl_resource_clk_top_axi1 = 69,
  105. sysctl_resource_clk_top_axi2 = 70,
  106. sysctl_resource_clk_top_ahb0 = 71,
  107. sysctl_resource_clk_top_femc = 72,
  108. sysctl_resource_clk_top_xpi0 = 73,
  109. sysctl_resource_clk_top_xpi1 = 74,
  110. sysctl_resource_clk_top_gptmr0 = 75,
  111. sysctl_resource_clk_top_gptmr1 = 76,
  112. sysctl_resource_clk_top_gptmr2 = 77,
  113. sysctl_resource_clk_top_gptmr3 = 78,
  114. sysctl_resource_clk_top_gptmr4 = 79,
  115. sysctl_resource_clk_top_gptmr5 = 80,
  116. sysctl_resource_clk_top_gptmr6 = 81,
  117. sysctl_resource_clk_top_gptmr7 = 82,
  118. sysctl_resource_clk_top_uart0 = 83,
  119. sysctl_resource_clk_top_uart1 = 84,
  120. sysctl_resource_clk_top_uart2 = 85,
  121. sysctl_resource_clk_top_uart3 = 86,
  122. sysctl_resource_clk_top_uart4 = 87,
  123. sysctl_resource_clk_top_uart5 = 88,
  124. sysctl_resource_clk_top_uart6 = 89,
  125. sysctl_resource_clk_top_uart7 = 90,
  126. sysctl_resource_clk_top_uart8 = 91,
  127. sysctl_resource_clk_top_uart9 = 92,
  128. sysctl_resource_clk_top_uarta = 93,
  129. sysctl_resource_clk_top_uartb = 94,
  130. sysctl_resource_clk_top_uartc = 95,
  131. sysctl_resource_clk_top_uartd = 96,
  132. sysctl_resource_clk_top_uarte = 97,
  133. sysctl_resource_clk_top_uartf = 98,
  134. sysctl_resource_clk_top_i2c0 = 99,
  135. sysctl_resource_clk_top_i2c1 = 100,
  136. sysctl_resource_clk_top_i2c2 = 101,
  137. sysctl_resource_clk_top_i2c3 = 102,
  138. sysctl_resource_clk_top_spi0 = 103,
  139. sysctl_resource_clk_top_spi1 = 104,
  140. sysctl_resource_clk_top_spi2 = 105,
  141. sysctl_resource_clk_top_spi3 = 106,
  142. sysctl_resource_clk_top_can0 = 107,
  143. sysctl_resource_clk_top_can1 = 108,
  144. sysctl_resource_clk_top_can2 = 109,
  145. sysctl_resource_clk_top_can3 = 110,
  146. sysctl_resource_clk_top_ptpc = 111,
  147. sysctl_resource_clk_top_ana0 = 112,
  148. sysctl_resource_clk_top_ana1 = 113,
  149. sysctl_resource_clk_top_ana2 = 114,
  150. sysctl_resource_clk_top_aud0 = 115,
  151. sysctl_resource_clk_top_aud1 = 116,
  152. sysctl_resource_clk_top_aud2 = 117,
  153. sysctl_resource_clk_top_dis0 = 118,
  154. sysctl_resource_clk_top_cam0 = 119,
  155. sysctl_resource_clk_top_cam1 = 120,
  156. sysctl_resource_clk_top_eth0 = 121,
  157. sysctl_resource_clk_top_eth1 = 122,
  158. sysctl_resource_clk_top_ptp0 = 123,
  159. sysctl_resource_clk_top_ptp1 = 124,
  160. sysctl_resource_clk_top_ref0 = 125,
  161. sysctl_resource_clk_top_ref1 = 126,
  162. sysctl_resource_clk_top_ntmr0 = 127,
  163. sysctl_resource_clk_top_ntmr1 = 128,
  164. sysctl_resource_clk_top_sdxc0 = 129,
  165. sysctl_resource_clk_top_sdxc1 = 130,
  166. sysctl_resource_clk_top_adc0 = 192,
  167. sysctl_resource_clk_top_adc1 = 193,
  168. sysctl_resource_clk_top_adc2 = 194,
  169. sysctl_resource_clk_top_adc3 = 195,
  170. sysctl_resource_clk_top_i2s0 = 196,
  171. sysctl_resource_clk_top_i2s1 = 197,
  172. sysctl_resource_clk_top_i2s2 = 198,
  173. sysctl_resource_clk_top_i2s3 = 199,
  174. sysctl_resource_linkable_start = 256,
  175. sysctl_resource_ahbp = 256,
  176. sysctl_resource_axis = 257,
  177. sysctl_resource_axic = 258,
  178. sysctl_resource_axiv = 259,
  179. sysctl_resource_femc = 260,
  180. sysctl_resource_rom0 = 261,
  181. sysctl_resource_lmm0 = 262,
  182. sysctl_resource_lmm1 = 263,
  183. sysctl_resource_mchtmr0 = 264,
  184. sysctl_resource_mchtmr1 = 265,
  185. sysctl_resource_ram0 = 266,
  186. sysctl_resource_ram1 = 267,
  187. sysctl_resource_xpi0 = 268,
  188. sysctl_resource_xpi1 = 269,
  189. sysctl_resource_sdp0 = 270,
  190. sysctl_resource_rng0 = 271,
  191. sysctl_resource_kman = 272,
  192. sysctl_resource_dma0 = 273,
  193. sysctl_resource_dma1 = 274,
  194. sysctl_resource_gpio = 275,
  195. sysctl_resource_mbx0 = 276,
  196. sysctl_resource_mbx1 = 277,
  197. sysctl_resource_wdg0 = 278,
  198. sysctl_resource_wdg1 = 279,
  199. sysctl_resource_wdg2 = 280,
  200. sysctl_resource_wdg3 = 281,
  201. sysctl_resource_gptmr0 = 282,
  202. sysctl_resource_gptmr1 = 283,
  203. sysctl_resource_gptmr2 = 284,
  204. sysctl_resource_gptmr3 = 285,
  205. sysctl_resource_gptmr4 = 286,
  206. sysctl_resource_gptmr5 = 287,
  207. sysctl_resource_gptmr6 = 288,
  208. sysctl_resource_gptmr7 = 289,
  209. sysctl_resource_uart0 = 290,
  210. sysctl_resource_uart1 = 291,
  211. sysctl_resource_uart2 = 292,
  212. sysctl_resource_uart3 = 293,
  213. sysctl_resource_uart4 = 294,
  214. sysctl_resource_uart5 = 295,
  215. sysctl_resource_uart6 = 296,
  216. sysctl_resource_uart7 = 297,
  217. sysctl_resource_uart8 = 298,
  218. sysctl_resource_uart9 = 299,
  219. sysctl_resource_uarta = 300,
  220. sysctl_resource_uartb = 301,
  221. sysctl_resource_uartc = 302,
  222. sysctl_resource_uartd = 303,
  223. sysctl_resource_uarte = 304,
  224. sysctl_resource_uartf = 305,
  225. sysctl_resource_i2c0 = 306,
  226. sysctl_resource_i2c1 = 307,
  227. sysctl_resource_i2c2 = 308,
  228. sysctl_resource_i2c3 = 309,
  229. sysctl_resource_spi0 = 310,
  230. sysctl_resource_spi1 = 311,
  231. sysctl_resource_spi2 = 312,
  232. sysctl_resource_spi3 = 313,
  233. sysctl_resource_can0 = 314,
  234. sysctl_resource_can1 = 315,
  235. sysctl_resource_can2 = 316,
  236. sysctl_resource_can3 = 317,
  237. sysctl_resource_ptpc = 318,
  238. sysctl_resource_adc0 = 319,
  239. sysctl_resource_adc1 = 320,
  240. sysctl_resource_adc2 = 321,
  241. sysctl_resource_adc3 = 322,
  242. sysctl_resource_acmp = 323,
  243. sysctl_resource_i2s0 = 324,
  244. sysctl_resource_i2s1 = 325,
  245. sysctl_resource_i2s2 = 326,
  246. sysctl_resource_i2s3 = 327,
  247. sysctl_resource_i2spdm0 = 328,
  248. sysctl_resource_i2sdao = 329,
  249. sysctl_resource_msyn = 330,
  250. sysctl_resource_mot0 = 331,
  251. sysctl_resource_mot1 = 332,
  252. sysctl_resource_mot2 = 333,
  253. sysctl_resource_mot3 = 334,
  254. sysctl_resource_dis0 = 335,
  255. sysctl_resource_cam0 = 336,
  256. sysctl_resource_cam1 = 337,
  257. sysctl_resource_jpeg = 338,
  258. sysctl_resource_pdma = 339,
  259. sysctl_resource_eth0 = 340,
  260. sysctl_resource_eth1 = 341,
  261. sysctl_resource_ntmr0 = 342,
  262. sysctl_resource_ntmr1 = 343,
  263. sysctl_resource_sdxc0 = 344,
  264. sysctl_resource_sdxc1 = 345,
  265. sysctl_resource_usb0 = 346,
  266. sysctl_resource_usb1 = 347,
  267. sysctl_resource_ref0 = 348,
  268. sysctl_resource_ref1 = 349,
  269. sysctl_resource_linkable_end,
  270. sysctl_resource_end = sysctl_resource_linkable_end,
  271. } sysctl_resource_t;
  272. /**
  273. * @brief Resource modes
  274. */
  275. typedef enum {
  276. sysctl_resource_mode_auto = 0,
  277. sysctl_resource_mode_force_on,
  278. sysctl_resource_mode_force_off,
  279. } sysctl_resource_mode_t;
  280. /**
  281. * @brief Clock nodes
  282. */
  283. typedef enum {
  284. clock_node_cpu0 = 0,
  285. clock_node_mchtmr0 = 1,
  286. clock_node_cpu1 = 2,
  287. clock_node_mchtmr1 = 3,
  288. clock_node_axi0 = 4,
  289. clock_node_axi1 = 5,
  290. clock_node_axi2 = 6,
  291. clock_node_ahb0 = 7,
  292. clock_node_femc = 8,
  293. clock_node_xpi0 = 9,
  294. clock_node_xpi1 = 10,
  295. clock_node_gptmr0 = 11,
  296. clock_node_gptmr1 = 12,
  297. clock_node_gptmr2 = 13,
  298. clock_node_gptmr3 = 14,
  299. clock_node_gptmr4 = 15,
  300. clock_node_gptmr5 = 16,
  301. clock_node_gptmr6 = 17,
  302. clock_node_gptmr7 = 18,
  303. clock_node_uart0 = 19,
  304. clock_node_uart1 = 20,
  305. clock_node_uart2 = 21,
  306. clock_node_uart3 = 22,
  307. clock_node_uart4 = 23,
  308. clock_node_uart5 = 24,
  309. clock_node_uart6 = 25,
  310. clock_node_uart7 = 26,
  311. clock_node_uart8 = 27,
  312. clock_node_uart9 = 28,
  313. clock_node_uarta = 29,
  314. clock_node_uartb = 30,
  315. clock_node_uartc = 31,
  316. clock_node_uartd = 32,
  317. clock_node_uarte = 33,
  318. clock_node_uartf = 34,
  319. clock_node_i2c0 = 35,
  320. clock_node_i2c1 = 36,
  321. clock_node_i2c2 = 37,
  322. clock_node_i2c3 = 38,
  323. clock_node_spi0 = 39,
  324. clock_node_spi1 = 40,
  325. clock_node_spi2 = 41,
  326. clock_node_spi3 = 42,
  327. clock_node_can0 = 43,
  328. clock_node_can1 = 44,
  329. clock_node_can2 = 45,
  330. clock_node_can3 = 46,
  331. clock_node_ptpc = 47,
  332. clock_node_ana0 = 48,
  333. clock_node_ana1 = 49,
  334. clock_node_ana2 = 50,
  335. clock_node_aud0 = 51,
  336. clock_node_aud1 = 52,
  337. clock_node_aud2 = 53,
  338. clock_node_dis0 = 54,
  339. clock_node_cam0 = 55,
  340. clock_node_cam1 = 56,
  341. clock_node_eth0 = 57,
  342. clock_node_eth1 = 58,
  343. clock_node_ptp0 = 59,
  344. clock_node_ptp1 = 60,
  345. clock_node_ref0 = 61,
  346. clock_node_ref1 = 62,
  347. clock_node_ntmr0 = 63,
  348. clock_node_ntmr1 = 64,
  349. clock_node_sdxc0 = 65,
  350. clock_node_sdxc1 = 66,
  351. clock_node_adc_i2s_start,
  352. clock_node_adc0 = clock_node_adc_i2s_start,
  353. clock_node_adc1,
  354. clock_node_adc2,
  355. clock_node_adc3,
  356. clock_node_i2s0,
  357. clock_node_i2s1,
  358. clock_node_i2s2,
  359. clock_node_i2s3,
  360. clock_node_end,
  361. } clock_node_t;
  362. /**
  363. * @brief General clock sources
  364. */
  365. typedef enum {
  366. clock_source_osc0_clk0 = 0,
  367. clock_source_pll0_clk0 = 1,
  368. clock_source_pll1_clk0 = 2,
  369. clock_source_pll1_clk1 = 3,
  370. clock_source_pll2_clk0 = 4,
  371. clock_source_pll2_clk1 = 5,
  372. clock_source_pll3_clk0 = 6,
  373. clock_source_pll4_clk0 = 7,
  374. clock_source_general_source_end,
  375. } clock_source_t;
  376. /**
  377. * @brief ADC/I2S clock sources
  378. */
  379. typedef enum {
  380. clock_source_adc_i2s_ahb_clk = 0,
  381. clock_source_adc_ana0_clk = 1,
  382. clock_source_i2s_aud0_clk = 1,
  383. clock_source_adc_ana1_clk = 2,
  384. clock_source_i2s_aud1_clk = 2,
  385. clock_source_adc_ana2_clk = 3,
  386. clock_source_i2s_aud2_clk = 3,
  387. clock_source_adc_i2s_clk_end,
  388. } clock_source_adc_i2s_t;
  389. /**
  390. * @brief CPU low power mode
  391. */
  392. typedef enum {
  393. cpu_lp_mode_gate_cpu_clock = 0,
  394. cpu_lp_mode_trigger_system_lp = 0x1,
  395. cpu_lp_mode_ungate_cpu_clock = 0x2,
  396. } cpu_lp_mode_t;
  397. /**
  398. * @brief Monitor targets
  399. */
  400. typedef enum {
  401. monitor_target_clk_32k = 0,
  402. monitor_target_clk_irc24m = 1,
  403. monitor_target_clk_xtal_24m = 2,
  404. monitor_target_clk_usb0_phy = 3,
  405. monitor_target_clk_usb1_phy = 4,
  406. monitor_target_osc0_clk0 = 8,
  407. monitor_target_pll0_clk0 = 9,
  408. monitor_target_pll1_clk0 = 10,
  409. monitor_target_pll1_clk1 = 11,
  410. monitor_target_pll2_clk0 = 12,
  411. monitor_target_pll2_clk1 = 13,
  412. monitor_target_pll3_clk0 = 14,
  413. monitor_target_pll4_clk0 = 15,
  414. monitor_target_clk_top_cpu0 = 128,
  415. monitor_target_clk_top_mchtmr0 = 129,
  416. monitor_target_clk_top_cpu1 = 130,
  417. monitor_target_clk_top_mchtmr1 = 131,
  418. monitor_target_clk_top_axi0 = 132,
  419. monitor_target_clk_top_axi1 = 133,
  420. monitor_target_clk_top_axi2 = 134,
  421. monitor_target_clk_top_ahb0 = 135,
  422. monitor_target_clk_top_femc = 136,
  423. monitor_target_clk_top_xpi0 = 137,
  424. monitor_target_clk_top_xpi1 = 138,
  425. monitor_target_clk_top_gptmr0 = 139,
  426. monitor_target_clk_top_gptmr1 = 140,
  427. monitor_target_clk_top_gptmr2 = 141,
  428. monitor_target_clk_top_gptmr3 = 142,
  429. monitor_target_clk_top_gptmr4 = 143,
  430. monitor_target_clk_top_gptmr5 = 144,
  431. monitor_target_clk_top_gptmr6 = 145,
  432. monitor_target_clk_top_gptmr7 = 146,
  433. monitor_target_clk_top_uart0 = 147,
  434. monitor_target_clk_top_uart1 = 148,
  435. monitor_target_clk_top_uart2 = 149,
  436. monitor_target_clk_top_uart3 = 150,
  437. monitor_target_clk_top_uart4 = 151,
  438. monitor_target_clk_top_uart5 = 152,
  439. monitor_target_clk_top_uart6 = 153,
  440. monitor_target_clk_top_uart7 = 154,
  441. monitor_target_clk_top_uart8 = 155,
  442. monitor_target_clk_top_uart9 = 156,
  443. monitor_target_clk_top_uarta = 157,
  444. monitor_target_clk_top_uartb = 158,
  445. monitor_target_clk_top_uartc = 159,
  446. monitor_target_clk_top_uartd = 160,
  447. monitor_target_clk_top_uarte = 161,
  448. monitor_target_clk_top_uartf = 162,
  449. monitor_target_clk_top_i2c0 = 163,
  450. monitor_target_clk_top_i2c1 = 164,
  451. monitor_target_clk_top_i2c2 = 165,
  452. monitor_target_clk_top_i2c3 = 166,
  453. monitor_target_clk_top_spi0 = 167,
  454. monitor_target_clk_top_spi1 = 168,
  455. monitor_target_clk_top_spi2 = 169,
  456. monitor_target_clk_top_spi3 = 170,
  457. monitor_target_clk_top_can0 = 171,
  458. monitor_target_clk_top_can1 = 172,
  459. monitor_target_clk_top_can2 = 173,
  460. monitor_target_clk_top_can3 = 174,
  461. monitor_target_clk_top_ptpc = 175,
  462. monitor_target_clk_top_ana0 = 176,
  463. monitor_target_clk_top_ana1 = 177,
  464. monitor_target_clk_top_ana2 = 178,
  465. monitor_target_clk_top_aud0 = 179,
  466. monitor_target_clk_top_aud1 = 180,
  467. monitor_target_clk_top_aud2 = 181,
  468. monitor_target_clk_top_dis0 = 182,
  469. monitor_target_clk_top_cam0 = 183,
  470. monitor_target_clk_top_cam1 = 184,
  471. monitor_target_clk_top_eth0 = 185,
  472. monitor_target_clk_top_eth1 = 186,
  473. monitor_target_clk_top_ptp0 = 187,
  474. monitor_target_clk_top_ptp1 = 188,
  475. monitor_target_clk_top_ref0 = 189,
  476. monitor_target_clk_top_ref1 = 190,
  477. monitor_target_clk_top_ntmr0 = 191,
  478. monitor_target_clk_top_ntmr1 = 192,
  479. monitor_target_clk_top_sdxc0 = 193,
  480. monitor_target_clk_top_sdxc1 = 194,
  481. } monitor_target_t;
  482. /**
  483. * @brief Monitor work mode
  484. */
  485. typedef enum {
  486. monitor_work_mode_compare = 0,
  487. monitor_work_mode_record = 1,
  488. } monitor_work_mode_t;
  489. /**
  490. * @brief Monitor accuracy
  491. */
  492. typedef enum {
  493. monitor_accuracy_1khz = 0,
  494. monitor_accuracy_1hz = 1,
  495. } monitor_accuracy_t;
  496. /**
  497. * @brief Monitor reference clock source
  498. */
  499. typedef enum {
  500. monitor_reference_32khz = 0,
  501. monitor_reference_24mhz = 1,
  502. } monitor_reference_t;
  503. typedef enum {
  504. cpu_event_flag_mask_reset = SYSCTL_CPU_LP_RESET_FLAG_MASK,
  505. cpu_event_flag_mask_sleep = SYSCTL_CPU_LP_SLEEP_FLAG_MASK,
  506. cpu_event_flag_mask_wake = SYSCTL_CPU_LP_WAKE_FLAG_MASK,
  507. cpu_event_flag_mask_all = SYSCTL_CPU_LP_RESET_FLAG_MASK | SYSCTL_CPU_LP_SLEEP_FLAG_MASK | SYSCTL_CPU_LP_WAKE_FLAG_MASK,
  508. } cpu_event_flag_mask_t;
  509. /**
  510. * @brief Monitor config
  511. */
  512. typedef struct monitor_config {
  513. uint8_t divide_by; /**< Divider to be used for OBS output to pads */
  514. monitor_work_mode_t mode; /**< Monitor work mode */
  515. monitor_accuracy_t accuracy; /**< Monitor reference accuracy */
  516. monitor_reference_t reference; /**< Monitor reference clock source */
  517. monitor_target_t target; /**< Monitor target */
  518. bool start_measure; /**< Start flag */
  519. bool enable_output; /**< Enable output to pads if true */
  520. uint32_t high_limit; /**< Maximum frequency at compare mode */
  521. uint32_t low_limit; /**< Minimum frequency at compare mode */
  522. } monitor_config_t;
  523. #ifdef __cplusplus
  524. extern "C" {
  525. #endif
  526. /**
  527. * @brief Check if monitor result is valid
  528. *
  529. * @param[in] ptr SYSCTL_Type base address
  530. * @param[in] monitor_index specific monitor instance to be used
  531. *
  532. * @return true if it is valid
  533. */
  534. static inline bool sysctl_monitor_result_is_valid(SYSCTL_Type *ptr, uint8_t monitor_index)
  535. {
  536. return SYSCTL_MONITOR_CONTROL_VALID_GET(ptr->MONITOR[monitor_index].CONTROL);
  537. }
  538. /**
  539. * @brief Get target monitor instance result
  540. *
  541. * @param[in] ptr SYSCTL_Type base address
  542. * @param[in] monitor_index specific monitor instance to be used
  543. * @return value of monitor result measured
  544. */
  545. static inline uint32_t sysctl_monitor_get_current_result(SYSCTL_Type *ptr,
  546. uint8_t monitor_index)
  547. {
  548. while (!sysctl_monitor_result_is_valid(ptr, monitor_index)) {
  549. }
  550. return ptr->MONITOR[monitor_index].CURRENT;
  551. }
  552. /**
  553. * @brief Set work mode for target monitor instance
  554. *
  555. * @param[in] ptr SYSCTL_Type base address
  556. * @param[in] monitor_index specific monitor instance to be used
  557. * @param[in] mode monitor_work_mode_compare, monitor_work_mode_record
  558. */
  559. static inline void sysctl_monitor_set_work_mode(SYSCTL_Type *ptr,
  560. uint8_t monitor_index,
  561. monitor_work_mode_t mode)
  562. {
  563. ptr->MONITOR[monitor_index].CONTROL =
  564. (ptr->MONITOR[monitor_index].CONTROL & ~SYSCTL_MONITOR_CONTROL_MODE_MASK)
  565. | (SYSCTL_MONITOR_CONTROL_MODE_SET(mode));
  566. }
  567. /**
  568. * @brief Set minimum frequency for target monitor instance
  569. *
  570. * @param[in] ptr SYSCTL_Type base address
  571. * @param[in] monitor_index specific monitor instance to be used
  572. * @param[in] limit measurement low limit
  573. */
  574. static inline hpm_stat_t sysctl_monitor_set_limit_low(SYSCTL_Type *ptr,
  575. uint8_t monitor_index,
  576. uint32_t limit)
  577. {
  578. if (ptr->MONITOR[monitor_index].CONTROL & SYSCTL_MONITOR_CONTROL_MODE_MASK) {
  579. return status_invalid_argument;
  580. }
  581. ptr->MONITOR[monitor_index].LOW_LIMIT = SYSCTL_MONITOR_LOW_LIMIT_FREQUENCY_SET(limit);
  582. return status_success;
  583. }
  584. /**
  585. * @brief Set maximum frequency for target monitor instance
  586. *
  587. * @param[in] ptr SYSCTL_Type base address
  588. * @param[in] monitor_index specific monitor instance to be used
  589. * @param[in] limit measurement high limit
  590. */
  591. static inline hpm_stat_t sysctl_monitor_set_limit_high(SYSCTL_Type *ptr,
  592. uint8_t monitor_index,
  593. uint32_t limit)
  594. {
  595. if (ptr->MONITOR[monitor_index].CONTROL & SYSCTL_MONITOR_CONTROL_MODE_MASK) {
  596. return status_invalid_argument;
  597. }
  598. ptr->MONITOR[monitor_index].HIGH_LIMIT = SYSCTL_MONITOR_HIGH_LIMIT_FREQUENCY_SET(limit);
  599. return status_success;
  600. }
  601. /**
  602. * @brief Set frequency limit for target monitor instance
  603. *
  604. * @param[in] ptr SYSCTL_Type base address
  605. * @param[in] monitor_index specific monitor instance to be used
  606. * @param[in] limit_high measurement high limit
  607. * @param[in] limit_low measurement low limit
  608. */
  609. static inline hpm_stat_t sysctl_monitor_set_limit(SYSCTL_Type *ptr,
  610. uint8_t monitor_index,
  611. uint32_t limit_high,
  612. uint32_t limit_low)
  613. {
  614. if (ptr->MONITOR[monitor_index].CONTROL & SYSCTL_MONITOR_CONTROL_MODE_MASK) {
  615. return status_invalid_argument;
  616. }
  617. ptr->MONITOR[monitor_index].HIGH_LIMIT = SYSCTL_MONITOR_HIGH_LIMIT_FREQUENCY_SET(limit_high);
  618. ptr->MONITOR[monitor_index].LOW_LIMIT = SYSCTL_MONITOR_LOW_LIMIT_FREQUENCY_SET(limit_low);
  619. return status_success;
  620. }
  621. /**
  622. * @brief Get maximum frequency for target monitor instance
  623. *
  624. * @param[in] ptr SYSCTL_Type base address
  625. * @param[in] monitor_index specific monitor instance to be used
  626. * @return current high limit value
  627. */
  628. static inline uint32_t sysctl_monitor_get_limit_high(SYSCTL_Type *ptr, uint32_t monitor_index)
  629. {
  630. return SYSCTL_MONITOR_HIGH_LIMIT_FREQUENCY_GET(ptr->MONITOR[monitor_index].HIGH_LIMIT);
  631. }
  632. /**
  633. * @brief Get minimum frequency for target monitor instance
  634. *
  635. * @param[in] ptr SYSCTL_Type base address
  636. * @param[in] monitor_index specific monitor instance to be used
  637. * @return current low limit value
  638. */
  639. static inline uint32_t sysctl_monitor_get_limit_low(SYSCTL_Type *ptr, uint32_t monitor_index)
  640. {
  641. return SYSCTL_MONITOR_LOW_LIMIT_FREQUENCY_SET(ptr->MONITOR[monitor_index].LOW_LIMIT);
  642. }
  643. /**
  644. * @brief Measure specific target frequency
  645. *
  646. * @param[in] ptr SYSCTL_Type base address
  647. * @param[in] monitor_index specific monitor instance to be used
  648. * @param[in] target monitor target to be measured
  649. * @param[in] enable_output enable clock obs output
  650. * @return frequency of monitor target measured
  651. */
  652. uint32_t sysctl_monitor_measure_frequency(SYSCTL_Type *ptr,
  653. uint8_t monitor_index,
  654. monitor_target_t target,
  655. bool enable_output);
  656. /**
  657. * @brief Link current CPU core its own group
  658. *
  659. * Once it is linked, peripherals state in that group will keep on as long as this core is not in low power mode
  660. *
  661. * @param[in] ptr SYSCTL_Type base address
  662. * @param[in] cpu_index cpu index to enable its own affiliated group
  663. */
  664. static inline void sysctl_set_enable_cpu_affiliate(SYSCTL_Type *ptr, uint8_t cpu_index)
  665. {
  666. ptr->AFFILIATE[cpu_index].SET = 1 << cpu_index;
  667. }
  668. /**
  669. * @brief Unlink current CPU core with its own group
  670. *
  671. * @param[in] ptr SYSCTL_Type base address
  672. * @param[in] cpu_index cpu index to enable its own affiliated group
  673. */
  674. static inline void sysctl_set_disable_cpu_affiliate(SYSCTL_Type *ptr, uint8_t cpu_index)
  675. {
  676. ptr->AFFILIATE[cpu_index].CLEAR = 1 << cpu_index;
  677. }
  678. /**
  679. * @brief Check if any resource is busy
  680. *
  681. * @param[in] ptr SYSCTL_Type base address
  682. * @return true if any resource is busy
  683. */
  684. static inline bool sysctl_resource_any_is_busy(SYSCTL_Type *ptr)
  685. {
  686. return ptr->RESOURCE[0] & SYSCTL_RESOURCE_GLB_BUSY_MASK;
  687. }
  688. /**
  689. * @brief Check if specific target is busy
  690. *
  691. * @param[in] ptr SYSCTL_Type base address
  692. * @param[in] resource target resource index
  693. * @return true if target resource is busy
  694. */
  695. static inline bool sysctl_resource_target_is_busy(SYSCTL_Type *ptr, sysctl_resource_t resource)
  696. {
  697. return ptr->RESOURCE[resource] & SYSCTL_RESOURCE_LOC_BUSY_MASK;
  698. }
  699. /**
  700. * @brief Set target mode
  701. *
  702. * @param[in] ptr SYSCTL_Type base address
  703. * @param[in] resource target resource index
  704. * @param[in] mode target resource mode
  705. */
  706. static inline void sysctl_resource_target_set_mode(SYSCTL_Type *ptr,
  707. sysctl_resource_t resource,
  708. sysctl_resource_mode_t mode)
  709. {
  710. ptr->RESOURCE[resource] =
  711. (ptr->RESOURCE[resource] & ~SYSCTL_RESOURCE_MODE_MASK) |
  712. SYSCTL_RESOURCE_MODE_SET(mode);
  713. }
  714. /**
  715. * @brief Disable resource retention when specific CPU enters stop mode
  716. *
  717. * @param[in] ptr SYSCTL_Type base address
  718. * @param[in] cpu_index cpu index
  719. * @param[in] mask bit mask to clear
  720. */
  721. static inline void sysctl_clear_cpu_lp_retention_with_mask(SYSCTL_Type *ptr,
  722. uint8_t cpu_index,
  723. uint32_t mask)
  724. {
  725. ptr->RETENTION[cpu_index].CLEAR = mask;
  726. }
  727. /**
  728. * @brief Disable resource retention when CPU0 enters stop mode
  729. *
  730. * @param[in] ptr SYSCTL_Type base address
  731. * @param[in] mask bit mask to clear
  732. */
  733. static inline void sysctl_clear_cpu0_lp_retention_with_mask(SYSCTL_Type *ptr,
  734. uint32_t mask)
  735. {
  736. sysctl_clear_cpu_lp_retention_with_mask(ptr, 0, mask);
  737. }
  738. /**
  739. * @brief Disable resource retention when CPU1 enters stop mode
  740. *
  741. * @param[in] ptr SYSCTL_Type base address
  742. * @param[in] mask bit mask to clear
  743. */
  744. static inline void sysctl_clear_cpu1_lp_retention_with_mask(SYSCTL_Type *ptr,
  745. uint32_t mask)
  746. {
  747. sysctl_clear_cpu_lp_retention_with_mask(ptr, 1, mask);
  748. }
  749. /**
  750. * @brief Enable resource retention when specific CPU enters stop mode
  751. *
  752. * @param[in] ptr SYSCTL_Type base address
  753. * @param[in] cpu_index cpu index
  754. * @param[in] mask bit mask to set
  755. */
  756. static inline void sysctl_set_cpu_lp_retention_with_mask(SYSCTL_Type *ptr,
  757. uint8_t cpu_index,
  758. uint32_t mask)
  759. {
  760. ptr->RETENTION[cpu_index].SET = mask;
  761. }
  762. /**
  763. * @brief Enable resource retention when CPU0 enters stop mode
  764. *
  765. * @param[in] ptr SYSCTL_Type base address
  766. * @param[in] mask bit mask to set
  767. */
  768. static inline void sysctl_set_cpu0_lp_retention_with_mask(SYSCTL_Type *ptr,
  769. uint32_t mask)
  770. {
  771. sysctl_set_cpu_lp_retention_with_mask(ptr, 0, mask);
  772. }
  773. /**
  774. * @brief Enable resource retention when CPU1 enters stop mode
  775. *
  776. * @param[in] ptr SYSCTL_Type base address
  777. * @param[in] mask bit mask to set
  778. */
  779. static inline void sysctl_set_cpu1_lp_retention_with_mask(SYSCTL_Type *ptr,
  780. uint32_t mask)
  781. {
  782. sysctl_set_cpu_lp_retention_with_mask(ptr, 1, mask);
  783. }
  784. /**
  785. * @brief Enable resource retention when specific CPU enters stop mode
  786. *
  787. * @param[in] ptr SYSCTL_Type base address
  788. * @param[in] cpu_index cpu index
  789. * @param[in] value value to be set
  790. */
  791. static inline void sysctl_set_cpu_lp_retention(SYSCTL_Type *ptr,
  792. uint8_t cpu_index,
  793. uint32_t value)
  794. {
  795. ptr->RETENTION[cpu_index].VALUE = value;
  796. }
  797. /**
  798. * @brief Enable resource retention when CPU0 enters stop mode
  799. *
  800. * @param[in] ptr SYSCTL_Type base address
  801. * @param[in] value value to be set
  802. */
  803. static inline void sysctl_set_cpu0_lp_retention(SYSCTL_Type *ptr, uint32_t value)
  804. {
  805. sysctl_set_cpu_lp_retention(ptr, 0, value);
  806. }
  807. /**
  808. * @brief Enable resource retention when CPU1 enters stop mode
  809. *
  810. * @param[in] ptr SYSCTL_Type base address
  811. * @param[in] value value to be set
  812. */
  813. static inline void sysctl_set_cpu1_lp_retention(SYSCTL_Type *ptr, uint32_t value)
  814. {
  815. sysctl_set_cpu_lp_retention(ptr, 1, value);
  816. }
  817. /**
  818. * @brief Retain target domain for specific CPU
  819. *
  820. * @param[in] ptr SYSCTL_Type base address
  821. * @param[in] cpu_index CPU index
  822. * @param[in] domain target domain power to be retained
  823. * @param[in] retain_mem set true to retain memory/register of target domain
  824. */
  825. static inline void sysctl_set_cpu_lp_retain_domain(SYSCTL_Type *ptr,
  826. uint8_t cpu_index,
  827. sysctl_retention_domain_t domain,
  828. bool retain_mem)
  829. {
  830. uint8_t set_mask = 0x1;
  831. if (domain < sysctl_retention_domain_xtal24m) {
  832. set_mask = retain_mem ? 0x3 : 0x1;
  833. }
  834. ptr->RETENTION[cpu_index].SET = (set_mask << domain);
  835. }
  836. /**
  837. * @brief Retain target domain for specific CPU0
  838. *
  839. * @param[in] ptr SYSCTL_Type base address
  840. * @param[in] domain target domain power to be retained
  841. * @param[in] retain_mem set true to retain memory/register of target domain
  842. */
  843. static inline void sysctl_set_cpu0_lp_retain_domain(SYSCTL_Type *ptr,
  844. sysctl_retention_domain_t domain,
  845. bool retain_mem)
  846. {
  847. sysctl_set_cpu_lp_retain_domain(ptr, 0, domain, retain_mem);
  848. }
  849. /**
  850. * @brief Retain target domain for specific CPU
  851. *
  852. * @param[in] ptr SYSCTL_Type base address
  853. * @param[in] domain target domain power to be retained
  854. * @param[in] retain_mem set true to retain memory/register of target domain
  855. */
  856. static inline void sysctl_set_cpu1_lp_retain_domain(SYSCTL_Type *ptr,
  857. sysctl_retention_domain_t domain,
  858. bool retain_mem)
  859. {
  860. sysctl_set_cpu_lp_retain_domain(ptr, 1, domain, retain_mem);
  861. }
  862. /**
  863. * @brief Check if any clock is busy
  864. *
  865. * @param[in] ptr SYSCTL_Type base address
  866. * @return true if any clock is busy
  867. */
  868. static inline bool sysctl_clock_any_is_busy(SYSCTL_Type *ptr)
  869. {
  870. return ptr->CLOCK[0] & SYSCTL_CLOCK_GLB_BUSY_MASK;
  871. }
  872. /**
  873. * @brief Check if target clock is busy
  874. *
  875. * @param[in] ptr SYSCTL_Type base address
  876. * @param[in] clock target clock
  877. * @return true if target clock is busy
  878. */
  879. static inline bool sysctl_clock_target_is_busy(SYSCTL_Type *ptr,
  880. uint32_t clock)
  881. {
  882. return ptr->CLOCK[clock] & SYSCTL_CLOCK_LOC_BUSY_MASK;
  883. }
  884. /**
  885. * @brief Set clock preset
  886. *
  887. * @param[in] ptr SYSCTL_Type base address
  888. * @param[in] preset preset
  889. */
  890. static inline void sysctl_clock_set_preset(SYSCTL_Type *ptr,
  891. sysctl_preset_t preset)
  892. {
  893. ptr->GLOBAL00 = (ptr->GLOBAL00 & ~SYSCTL_GLOBAL00_PRESET_MASK)
  894. | SYSCTL_GLOBAL00_PRESET_SET(preset);
  895. }
  896. /**
  897. * @brief Check if target reset domain wakeup status
  898. *
  899. * @param[in] ptr SYSCTL_Type base address
  900. * @param[in] domain target domain to be checked
  901. * @return true if target domain was taken wakeup reset
  902. */
  903. static inline bool sysctl_reset_check_target_domain_wakeup_flag(SYSCTL_Type *ptr,
  904. sysctl_reset_domain_t domain)
  905. {
  906. return ptr->RESET[domain].CONTROL & SYSCTL_RESET_CONTROL_FLAG_WAKE_MASK;
  907. }
  908. /**
  909. * @brief Clear target reset domain wakeup status
  910. *
  911. * @param[in] ptr SYSCTL_Type base address
  912. * @param[in] domain target domain to be checked
  913. */
  914. static inline void sysctl_reset_clear_target_domain_wakeup_flag(SYSCTL_Type *ptr,
  915. sysctl_reset_domain_t domain)
  916. {
  917. ptr->RESET[domain].CONTROL |= SYSCTL_RESET_CONTROL_FLAG_WAKE_MASK;
  918. }
  919. /**
  920. * @brief Clear target reset domain reset status
  921. *
  922. * @param[in] ptr SYSCTL_Type base address
  923. * @param[in] domain target domain to be checked
  924. * @return true if target domain was taken reset
  925. */
  926. static inline bool sysctl_reset_check_target_domain_flag(SYSCTL_Type *ptr,
  927. sysctl_reset_domain_t domain)
  928. {
  929. return ptr->RESET[domain].CONTROL & SYSCTL_RESET_CONTROL_FLAG_MASK;
  930. }
  931. /**
  932. * @brief Clear target reset domain reset status
  933. *
  934. * @param[in] ptr SYSCTL_Type base address
  935. * @param[in] domain target domain to be checked
  936. */
  937. static inline void sysctl_reset_clear_target_domain_flag(SYSCTL_Type *ptr,
  938. sysctl_reset_domain_t domain)
  939. {
  940. ptr->RESET[domain].CONTROL |= SYSCTL_RESET_CONTROL_FLAG_MASK;
  941. }
  942. /**
  943. * @brief Clear target reset domain for all reset status
  944. *
  945. * @param[in] ptr SYSCTL_Type base address
  946. * @param[in] domain target domain to be checked
  947. */
  948. static inline void sysctl_reset_clear_target_domain_all_flags(SYSCTL_Type *ptr,
  949. sysctl_reset_domain_t domain)
  950. {
  951. ptr->RESET[domain].CONTROL |= SYSCTL_RESET_CONTROL_FLAG_MASK | SYSCTL_RESET_CONTROL_FLAG_WAKE_MASK;
  952. }
  953. /**
  954. * @brief Get target CPU wakeup source status
  955. *
  956. * @param[in] ptr SYSCTL_Type base address
  957. * @param[in] cpu_index CPU index
  958. * @param[in] status_index wakeup status index 0 - 7
  959. * @return wakeup source status mask
  960. */
  961. static inline uint32_t sysctl_get_wakeup_source_status(SYSCTL_Type *ptr,
  962. uint8_t cpu_index,
  963. uint8_t status_index)
  964. {
  965. return ptr->CPU[cpu_index].WAKEUP_STATUS[status_index];
  966. }
  967. /**
  968. * @brief Get target CPU0 wakeup source status
  969. *
  970. * @param[in] ptr SYSCTL_Type base address
  971. * @param[in] status_index wakeup status index 0 - 7
  972. * @return wakeup source status mask
  973. */
  974. static inline uint32_t sysctl_get_cpu0_wakeup_source_status(SYSCTL_Type *ptr,
  975. uint8_t status_index)
  976. {
  977. return sysctl_get_wakeup_source_status(ptr, 0, status_index);
  978. }
  979. /**
  980. * @brief Get target CPU1 wakeup source status
  981. *
  982. * @param[in] ptr SYSCTL_Type base address
  983. * @param[in] status_index wakeup status index 0 - 7
  984. * @return wakeup source status mask
  985. */
  986. static inline uint32_t sysctl_get_cpu1_wakeup_source_status(SYSCTL_Type *ptr,
  987. uint8_t status_index)
  988. {
  989. return sysctl_get_wakeup_source_status(ptr, 1, status_index);
  990. }
  991. /**
  992. * @brief Check wakeup source status with mask
  993. *
  994. * @param[in] ptr SYSCTL_Type base address
  995. * @param[in] cpu_index CPU index
  996. * @param[in] status_index wakeup status index 0 - 7
  997. * @param[in] mask expected status mask
  998. * @return wakeup status according to given bit mask
  999. */
  1000. static inline
  1001. uint32_t sysctl_check_wakeup_source_status_with_mask(SYSCTL_Type *ptr,
  1002. uint8_t cpu_index,
  1003. uint8_t status_index,
  1004. uint32_t mask)
  1005. {
  1006. return ptr->CPU[cpu_index].WAKEUP_STATUS[status_index] & mask;
  1007. }
  1008. /**
  1009. * @brief Check CPU0 wakeup source status with mask
  1010. *
  1011. * @param[in] ptr SYSCTL_Type base address
  1012. * @param[in] status_index wakeup status index 0 - 7
  1013. * @param[in] mask expected status mask
  1014. * @return wakeup status according to given bit mask
  1015. */
  1016. static inline
  1017. uint32_t sysctl_check_cpu0_wakeup_source_status_with_mask(SYSCTL_Type *ptr,
  1018. uint8_t status_index,
  1019. uint32_t mask)
  1020. {
  1021. return sysctl_check_wakeup_source_status_with_mask(ptr, 0, status_index, mask);
  1022. }
  1023. /**
  1024. * @brief Check CPU1 wakeup source status with mask
  1025. *
  1026. * @param[in] ptr SYSCTL_Type base address
  1027. * @param[in] status_index wakeup status index 0 - 7
  1028. * @param[in] mask expected status mask
  1029. * @return wakeup status according to given bit mask
  1030. */
  1031. static inline
  1032. uint32_t sysctl_check_cpu1_wakeup_source_status_with_mask(SYSCTL_Type *ptr,
  1033. uint8_t status_index,
  1034. uint32_t mask)
  1035. {
  1036. return sysctl_check_wakeup_source_status_with_mask(ptr, 1, status_index, mask);
  1037. }
  1038. /**
  1039. * @brief Enable wakeup source status with mask
  1040. *
  1041. * @param[in] ptr SYSCTL_Type base address
  1042. * @param[in] cpu_index CPU index
  1043. * @param[in] enable_index wakeup enable index 0 - 7
  1044. * @param[in] mask expected status mask
  1045. */
  1046. static inline
  1047. void sysctl_enable_wakeup_source_with_mask(SYSCTL_Type *ptr,
  1048. uint8_t cpu_index,
  1049. uint8_t enable_index,
  1050. uint32_t mask)
  1051. {
  1052. ptr->CPU[cpu_index].WAKEUP_ENABLE[enable_index] |= mask;
  1053. }
  1054. /**
  1055. * @brief Enable CPU0 wakeup source status with mask
  1056. *
  1057. * @param[in] ptr SYSCTL_Type base address
  1058. * @param[in] enable_index wakeup enable index 0 - 7
  1059. * @param[in] mask expected status mask
  1060. */
  1061. static inline void sysctl_enable_cpu0_wakeup_source_with_mask(SYSCTL_Type *ptr,
  1062. uint8_t enable_index,
  1063. uint32_t mask)
  1064. {
  1065. ptr->CPU[0].WAKEUP_ENABLE[enable_index] |= mask;
  1066. }
  1067. /**
  1068. * @brief Enable CPU1 wakeup source status with mask
  1069. *
  1070. * @param[in] ptr SYSCTL_Type base address
  1071. * @param[in] enable_index wakeup enable index 0 - 7
  1072. * @param[in] mask expected status mask
  1073. */
  1074. static inline void sysctl_enable_cpu1_wakeup_source_with_mask(SYSCTL_Type *ptr,
  1075. uint8_t enable_index,
  1076. uint32_t mask)
  1077. {
  1078. ptr->CPU[1].WAKEUP_ENABLE[enable_index] |= mask;
  1079. }
  1080. /**
  1081. * @brief Disable wakeup source status with mask
  1082. *
  1083. * @param[in] ptr SYSCTL_Type base address
  1084. * @param[in] cpu_index CPU index
  1085. * @param[in] enable_index wakeup enable index 0 - 7
  1086. * @param[in] mask expected status mask
  1087. */
  1088. static inline
  1089. void sysctl_disable_wakeup_source_with_mask(SYSCTL_Type *ptr,
  1090. uint8_t cpu_index,
  1091. uint8_t enable_index,
  1092. uint32_t mask)
  1093. {
  1094. ptr->CPU[cpu_index].WAKEUP_ENABLE[enable_index] &= ~mask;
  1095. }
  1096. /**
  1097. * @brief Disable CPU0 wakeup source status with mask
  1098. *
  1099. * @param[in] ptr SYSCTL_Type base address
  1100. * @param[in] enable_index wakeup enable index 0 - 7
  1101. * @param[in] mask expected status mask
  1102. */
  1103. static inline void sysctl_disable_cpu0_wakeup_source_with_mask(SYSCTL_Type *ptr,
  1104. uint8_t enable_index,
  1105. uint32_t mask)
  1106. {
  1107. sysctl_disable_wakeup_source_with_mask(ptr, 0, enable_index, mask);
  1108. }
  1109. /**
  1110. * @brief Disable CPU1 wakeup source status with mask
  1111. *
  1112. * @param[in] ptr SYSCTL_Type base address
  1113. * @param[in] enable_index wakeup enable index 0 - 7
  1114. * @param[in] mask expected status mask
  1115. */
  1116. static inline void sysctl_disable_cpu1_wakeup_source_with_mask(SYSCTL_Type *ptr,
  1117. uint8_t enable_index,
  1118. uint32_t mask)
  1119. {
  1120. sysctl_disable_wakeup_source_with_mask(ptr, 1, enable_index, mask);
  1121. }
  1122. /**
  1123. * @brief Disable wakeup source status with irq
  1124. *
  1125. * @param[in] ptr SYSCTL_Type base address
  1126. * @param[in] cpu_index CPU index
  1127. * @param[in] irq_num irq number to be disabled as wakeup source
  1128. */
  1129. static inline void sysctl_disable_wakeup_source_with_irq(SYSCTL_Type *ptr,
  1130. uint8_t cpu_index,
  1131. uint16_t irq_num)
  1132. {
  1133. ptr->CPU[cpu_index].WAKEUP_ENABLE[irq_num >> 2] &= ~(1UL << (irq_num % 32));
  1134. }
  1135. /**
  1136. * @brief Disable CPU0 wakeup source status with irq
  1137. *
  1138. * @param[in] ptr SYSCTL_Type base address
  1139. * @param[in] irq_num irq number to be disabled as wakeup source
  1140. */
  1141. static inline void sysctl_disable_cpu0_wakeup_source_with_irq(SYSCTL_Type *ptr,
  1142. uint16_t irq_num)
  1143. {
  1144. sysctl_disable_wakeup_source_with_irq(ptr, 0, irq_num);
  1145. }
  1146. /**
  1147. * @brief Disable CPU1 wakeup source status with irq
  1148. *
  1149. * @param[in] ptr SYSCTL_Type base address
  1150. * @param[in] irq_num irq number to be disabled as wakeup source
  1151. */
  1152. static inline void sysctl_disable_cpu1_wakeup_source_with_irq(SYSCTL_Type *ptr,
  1153. uint16_t irq_num)
  1154. {
  1155. sysctl_disable_wakeup_source_with_irq(ptr, 1, irq_num);
  1156. }
  1157. /**
  1158. * @brief Enable wakeup source status with irq
  1159. *
  1160. * @param[in] ptr SYSCTL_Type base address
  1161. * @param[in] cpu_index CPU index
  1162. * @param[in] irq_num irq number to be set as wakeup source
  1163. */
  1164. static inline void sysctl_enable_wakeup_source_with_irq(SYSCTL_Type *ptr,
  1165. uint8_t cpu_index,
  1166. uint16_t irq_num)
  1167. {
  1168. ptr->CPU[cpu_index].WAKEUP_ENABLE[irq_num / 32] |= 1UL << (irq_num & 0x1F);
  1169. }
  1170. /**
  1171. * @brief Enable CPU0 wakeup source status with irq
  1172. *
  1173. * @param[in] ptr SYSCTL_Type base address
  1174. * @param[in] irq_num irq number to be set as wakeup source
  1175. */
  1176. static inline void sysctl_enable_cpu0_wakeup_source_with_irq(SYSCTL_Type *ptr,
  1177. uint16_t irq_num)
  1178. {
  1179. sysctl_enable_wakeup_source_with_irq(ptr, 0, irq_num);
  1180. }
  1181. /**
  1182. * @brief Enable CPU1 wakeup source status with irq
  1183. *
  1184. * @param[in] ptr SYSCTL_Type base address
  1185. * @param[in] irq_num irq number to be set as wakeup source
  1186. */
  1187. static inline void sysctl_enable_cpu1_wakeup_source_with_irq(SYSCTL_Type *ptr,
  1188. uint16_t irq_num)
  1189. {
  1190. sysctl_enable_wakeup_source_with_irq(ptr, 1, irq_num);
  1191. }
  1192. /**
  1193. * @brief Lock CPU gpr with mask
  1194. *
  1195. * @param[in] ptr SYSCTL_Type base address
  1196. * @param[in] cpu_index CPU index
  1197. * @param[in] gpr_mask bit mask of gpr registers to be locked
  1198. */
  1199. static inline void sysctl_cpu_lock_gpr_with_mask(SYSCTL_Type *ptr,
  1200. uint8_t cpu_index,
  1201. uint16_t gpr_mask)
  1202. {
  1203. ptr->CPU[cpu_index].LOCK |= SYSCTL_CPU_LOCK_GPR_SET(gpr_mask);
  1204. }
  1205. /**
  1206. * @brief Lock CPU0 gpr with mask
  1207. *
  1208. * @param[in] ptr SYSCTL_Type base address
  1209. * @param[in] gpr_mask bit mask of gpr registers to be locked
  1210. */
  1211. static inline void sysctl_cpu0_lock_gpr_with_mask(SYSCTL_Type *ptr,
  1212. uint16_t gpr_mask)
  1213. {
  1214. sysctl_cpu_lock_gpr_with_mask(ptr, 0, gpr_mask);
  1215. }
  1216. /**
  1217. * @brief Lock CPU1 gpr with mask
  1218. *
  1219. * @param[in] ptr SYSCTL_Type base address
  1220. * @param[in] gpr_mask bit mask of gpr registers to be locked
  1221. */
  1222. static inline void sysctl_cpu1_lock_gpr_with_mask(SYSCTL_Type *ptr,
  1223. uint16_t gpr_mask)
  1224. {
  1225. sysctl_cpu_lock_gpr_with_mask(ptr, 1, gpr_mask);
  1226. }
  1227. /**
  1228. * @brief Lock CPU lock
  1229. *
  1230. * @param[in] ptr SYSCTL_Type base address
  1231. * @param[in] cpu_index CPU index
  1232. */
  1233. static inline void sysctl_cpu_lock(SYSCTL_Type *ptr, uint8_t cpu_index)
  1234. {
  1235. ptr->CPU[cpu_index].LOCK |= SYSCTL_CPU_LOCK_LOCK_MASK;
  1236. }
  1237. /**
  1238. * @brief Lock CPU0 lock
  1239. *
  1240. * @param[in] ptr SYSCTL_Type base address
  1241. */
  1242. static inline void sysctl_cpu0_lock(SYSCTL_Type *ptr)
  1243. {
  1244. sysctl_cpu_lock(ptr, 0);
  1245. }
  1246. /**
  1247. * @brief Lock CPU1 lock
  1248. *
  1249. * @param[in] ptr SYSCTL_Type base address
  1250. */
  1251. static inline void sysctl_cpu1_lock(SYSCTL_Type *ptr)
  1252. {
  1253. sysctl_cpu_lock(ptr, 1);
  1254. }
  1255. /**
  1256. * @brief Set CPU low power mode
  1257. *
  1258. * @param[in] ptr SYSCTL_Type base address
  1259. * @param[in] cpu_index CPU index
  1260. * @param[in] mode target mode to set
  1261. */
  1262. static inline void sysctl_set_cpu_lp_mode(SYSCTL_Type *ptr, uint8_t cpu_index, cpu_lp_mode_t mode)
  1263. {
  1264. ptr->CPU[cpu_index].LP = (ptr->CPU[cpu_index].LP & ~(SYSCTL_CPU_LP_MODE_MASK)) | (mode);
  1265. }
  1266. /**
  1267. * @brief Set CPU0 low power mode
  1268. *
  1269. * @param[in] ptr SYSCTL_Type base address
  1270. * @param[in] mode target mode to set
  1271. */
  1272. static inline void sysctl_set_cpu0_lp_mode(SYSCTL_Type *ptr, cpu_lp_mode_t mode)
  1273. {
  1274. sysctl_set_cpu_lp_mode(ptr, 0, mode);
  1275. }
  1276. /**
  1277. * @brief Set CPU1 low power mode
  1278. *
  1279. * @param[in] ptr SYSCTL_Type base address
  1280. * @param[in] mode target mode to set
  1281. */
  1282. static inline void sysctl_set_cpu1_lp_mode(SYSCTL_Type *ptr, cpu_lp_mode_t mode)
  1283. {
  1284. sysctl_set_cpu_lp_mode(ptr, 1, mode);
  1285. }
  1286. /**
  1287. * @brief Clear CPU event flags
  1288. *
  1289. * @param[in] ptr SYSCTL_Type base address
  1290. * @param[in] cpu_index CPU index
  1291. * @param[in] flags flag mask to be cleared
  1292. */
  1293. static inline void sysctl_clear_cpu_flags(SYSCTL_Type *ptr, uint8_t cpu_index, cpu_event_flag_mask_t flags)
  1294. {
  1295. ptr->CPU[cpu_index].LP |= ((SYSCTL_CPU_LP_SLEEP_FLAG_MASK | SYSCTL_CPU_LP_WAKE_FLAG_MASK | SYSCTL_CPU_LP_RESET_FLAG_MASK) & flags);
  1296. }
  1297. /**
  1298. * @brief Clear CPU0 event flags
  1299. *
  1300. * @param[in] ptr SYSCTL_Type base address
  1301. * @param[in] flags flag mask to be cleared
  1302. */
  1303. static inline void sysctl_clear_cpu0_flags(SYSCTL_Type *ptr, cpu_event_flag_mask_t flags)
  1304. {
  1305. sysctl_clear_cpu_flags(ptr, 0, flags);
  1306. }
  1307. /**
  1308. * @brief Clear CPU1 event flags
  1309. *
  1310. * @param[in] ptr SYSCTL_Type base address
  1311. * @param[in] flags flag mask to be cleared
  1312. */
  1313. static inline void sysctl_clear_cpu1_flags(SYSCTL_Type *ptr, cpu_event_flag_mask_t flags)
  1314. {
  1315. sysctl_clear_cpu_flags(ptr, 1, flags);
  1316. }
  1317. /**
  1318. * @brief Get CPU event flags
  1319. *
  1320. * @param[in] ptr SYSCTL_Type base address
  1321. * @param[in] cpu_index CPU index
  1322. * @retval event flag mask
  1323. */
  1324. static inline uint32_t sysctl_get_cpu_flags(SYSCTL_Type *ptr, uint8_t cpu_index)
  1325. {
  1326. return ptr->CPU[cpu_index].LP & (SYSCTL_CPU_LP_SLEEP_FLAG_MASK | SYSCTL_CPU_LP_WAKE_FLAG_MASK | SYSCTL_CPU_LP_RESET_FLAG_MASK);
  1327. }
  1328. /**
  1329. * @brief Get CPU0 event flags
  1330. *
  1331. * @param[in] ptr SYSCTL_Type base address
  1332. * @retval event flag mask
  1333. */
  1334. static inline uint32_t sysctl_get_cpu0_flags(SYSCTL_Type *ptr)
  1335. {
  1336. return sysctl_get_cpu_flags(ptr, 0);
  1337. }
  1338. /**
  1339. * @brief Get CPU1 event flags
  1340. *
  1341. * @param[in] ptr SYSCTL_Type base address
  1342. * @retval event flag mask
  1343. */
  1344. static inline uint32_t sysctl_get_cpu1_flags(SYSCTL_Type *ptr)
  1345. {
  1346. return sysctl_get_cpu_flags(ptr, 1);
  1347. }
  1348. /**
  1349. * @brief Release cpu
  1350. *
  1351. * @param[in] ptr SYSCTL_Type base address
  1352. * @param[in] cpu_index CPU index
  1353. */
  1354. static inline void sysctl_release_cpu(SYSCTL_Type *ptr, uint8_t cpu_index)
  1355. {
  1356. ptr->CPU[cpu_index].LP &= ~SYSCTL_CPU_LP_HALT_MASK;
  1357. }
  1358. /**
  1359. * @brief Release cpu1
  1360. *
  1361. * @param[in] ptr SYSCTL_Type base address
  1362. */
  1363. static inline void sysctl_release_cpu1(SYSCTL_Type *ptr)
  1364. {
  1365. sysctl_release_cpu(ptr, 1);
  1366. }
  1367. /**
  1368. * @brief Check whether CPU is released or not
  1369. *
  1370. * @param [in] ptr SYSCTL_Type base address
  1371. * @param[in] cpu_index CPU index
  1372. * @retval true CPU is released
  1373. * @retval false CPU is on-hold
  1374. */
  1375. static inline bool sysctl_is_cpu_released(SYSCTL_Type *ptr, uint8_t cpu_index)
  1376. {
  1377. return ((ptr->CPU[cpu_index].LP & SYSCTL_CPU_LP_HALT_MASK) == 0U);
  1378. }
  1379. /**
  1380. * @brief Check whether CPU1 is released or not
  1381. *
  1382. * @param [in] ptr SYSCTL_Type base address
  1383. * @retval true CPU1 is released
  1384. * @retval false CPU1 is on-hold
  1385. */
  1386. static inline bool sysctl_is_cpu1_released(SYSCTL_Type *ptr)
  1387. {
  1388. return sysctl_is_cpu_released(ptr, 1);
  1389. }
  1390. /**
  1391. * @brief Config lock
  1392. *
  1393. * @param[in] ptr SYSCTL_Type base address
  1394. * @param[in] node clock node to be configured
  1395. * @param[in] source clock source to be used
  1396. * @param[in] divide_by clock frequency divider
  1397. * @return status_success if everything is okay
  1398. */
  1399. hpm_stat_t sysctl_config_clock(SYSCTL_Type *ptr,
  1400. clock_node_t node,
  1401. clock_source_t source,
  1402. uint32_t divide_by);
  1403. /**
  1404. * @brief Set ADC/I2S clock mux
  1405. *
  1406. * @param[in] ptr SYSCTL_Type base address
  1407. * @param[in] node clock node to be configured
  1408. * @param[in] source clock source to be used
  1409. * @return status_success if everything is okay
  1410. */
  1411. hpm_stat_t sysctl_set_adc_i2s_clock_mux(SYSCTL_Type *ptr,
  1412. clock_node_t node,
  1413. clock_source_adc_i2s_t source);
  1414. /**
  1415. * @brief Enable group resource
  1416. *
  1417. * @param[in] ptr SYSCTL_Type base address
  1418. * @param[in] group target group to be modified
  1419. * @param[in] resource target resource to be added/removed from group
  1420. * @param[in] enable set true to add resource, remove otherwise
  1421. * @return status_success if everything is okay
  1422. */
  1423. hpm_stat_t sysctl_enable_group_resource(SYSCTL_Type *ptr,
  1424. uint8_t group,
  1425. sysctl_resource_t resource,
  1426. bool enable);
  1427. /**
  1428. * @brief Add resource to CPU0
  1429. *
  1430. * @param[in] ptr SYSCTL_Type base address
  1431. * @param[in] resource resource to be added to CPU0
  1432. * @return status_success if everything is okay
  1433. */
  1434. hpm_stat_t sysctl_add_resource_to_cpu0(SYSCTL_Type *ptr, sysctl_resource_t resource);
  1435. /**
  1436. * @brief Remove resource from CPU0
  1437. *
  1438. * @param[in] ptr SYSCTL_Type base address
  1439. * @param[in] resource Resource to be removed to CPU0
  1440. * @return status_success if everything is okay
  1441. */
  1442. hpm_stat_t sysctl_remove_resource_from_cpu0(SYSCTL_Type *ptr, sysctl_resource_t resource);
  1443. /**
  1444. * @brief Add resource to CPU1
  1445. *
  1446. * @param[in] ptr SYSCTL_Type base address
  1447. * @param[in] resource Resource to be added to CPU1
  1448. * @return status_success if everything is okay
  1449. */
  1450. hpm_stat_t sysctl_add_resource_to_cpu1(SYSCTL_Type *ptr, sysctl_resource_t resource);
  1451. /**
  1452. * @brief Remove resource from CPU1
  1453. *
  1454. * @param[in] ptr SYSCTL_Type base address
  1455. * @param[in] resource Resource to be removed to CPU1
  1456. * @return status_success if everything is okay
  1457. */
  1458. hpm_stat_t sysctl_remove_resource_from_cpu1(SYSCTL_Type *ptr, sysctl_resource_t resource);
  1459. /**
  1460. * @brief Get default monitor config
  1461. *
  1462. * @param[in] ptr SYSCTL_Type base address
  1463. * @param[in] config Monitor config structure pointer
  1464. */
  1465. void sysctl_monitor_get_default_config(SYSCTL_Type *ptr, monitor_config_t *config);
  1466. /**
  1467. * @brief Initialize Monitor
  1468. *
  1469. * @param[in] ptr SYSCTL_Type base address
  1470. * @param[in] monitor_index Monitor instance to be initialized
  1471. * @param[in] config Monitor config structure pointer
  1472. */
  1473. void sysctl_monitor_init(SYSCTL_Type *ptr,
  1474. uint8_t monitor_index,
  1475. monitor_config_t *config);
  1476. /**
  1477. * @brief Save data to GPU0 GPR starting from given index
  1478. *
  1479. * @param[in] ptr SYSCTL_Type base address
  1480. * @param[in] start Starting GPR index
  1481. * @param[in] count Number of GPR registers to set
  1482. * @param[in] data Pointer to data buffer
  1483. * @param[in] lock Set true to lock written GPR registers after setting
  1484. * @return status_success if everything is okay
  1485. */
  1486. hpm_stat_t sysctl_cpu0_set_gpr(SYSCTL_Type *ptr,
  1487. uint8_t start,
  1488. uint8_t count,
  1489. uint32_t *data,
  1490. bool lock);
  1491. /**
  1492. * @brief Get data saved from GPU0 GPR starting from given index
  1493. *
  1494. * @param[in] ptr SYSCTL_Type base address
  1495. * @param[in] start Starting GPR index
  1496. * @param[in] count Number of GPR registers to set
  1497. * @param[out] data Pointer of buffer to save data
  1498. * @return status_success if everything is okay
  1499. */
  1500. hpm_stat_t sysctl_cpu0_get_gpr(SYSCTL_Type *ptr,
  1501. uint8_t start,
  1502. uint8_t count,
  1503. uint32_t *data);
  1504. /**
  1505. * @brief Set data to CPU1 GPR starting from given index
  1506. *
  1507. * @param[in] ptr SYSCTL_Type base address
  1508. * @param[in] start Starting GPR index
  1509. * @param[in] count Number of GPR registers to set
  1510. * @param[in] data Pointer to data buffer
  1511. * @param[in] lock Set true to lock written GPR registers after setting
  1512. * @return status_success if everything is okay
  1513. */
  1514. hpm_stat_t sysctl_cpu1_set_gpr(SYSCTL_Type *ptr,
  1515. uint8_t start,
  1516. uint8_t count,
  1517. uint32_t *data,
  1518. bool lock);
  1519. /**
  1520. * @brief Get data saved in CPU1 GPR starting from given index
  1521. *
  1522. * @param[in] ptr SYSCTL_Type base address
  1523. * @param[in] start Starting GPR index
  1524. * @param[in] count Number of GPR registers to set
  1525. * @param[out] data Pointer of buffer to save data
  1526. * @return status_success if everything is okay
  1527. */
  1528. hpm_stat_t sysctl_get_cpu1_gpr(SYSCTL_Type *ptr,
  1529. uint8_t start,
  1530. uint8_t count,
  1531. uint32_t *data);
  1532. /**
  1533. * @brief Set entry point on CPU boot or wakeup
  1534. *
  1535. * @param[in] ptr SYSCTL_Type base address
  1536. * @param[in] cpu CPU index
  1537. * @param[in] entry Entry address for CPU
  1538. * @return status_success if everything is okay
  1539. */
  1540. hpm_stat_t sysctl_set_cpu_entry(SYSCTL_Type *ptr, uint8_t cpu, uint32_t entry);
  1541. /**
  1542. * @brief Set entry point on CPU0 wakeup
  1543. *
  1544. * @param[in] ptr SYSCTL_Type base address
  1545. * @param[in] entry Entry address for CPU0 on its wakeup
  1546. * @return status_success if everything is okay
  1547. */
  1548. hpm_stat_t sysctl_set_cpu0_wakeup_entry(SYSCTL_Type *ptr, uint32_t entry);
  1549. /**
  1550. * @brief Set entry point on either CPU1 boot or wakeup
  1551. *
  1552. * @param[in] ptr SYSCTL_Type base address
  1553. * @param[in] entry Entry address for CPU1
  1554. * @return status_success if everything is okay
  1555. */
  1556. hpm_stat_t sysctl_set_cpu1_entry(SYSCTL_Type *ptr, uint32_t entry);
  1557. #ifdef __cplusplus
  1558. }
  1559. #endif
  1560. /**
  1561. * @}
  1562. */
  1563. #endif /* HPM_SYSCTL_DRV_H */