gh_vic.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487
  1. /*!
  2. *******************************************************************************
  3. **
  4. ** \file gh_vic.h
  5. **
  6. ** \brief VIC.
  7. **
  8. ** Copyright: 2012 - 2013 (C) GoKe Microelectronics ShangHai Branch
  9. **
  10. ** \attention THIS SAMPLE CODE IS PROVIDED AS IS. GOKE MICROELECTRONICS
  11. ** ACCEPTS NO RESPONSIBILITY OR LIABILITY FOR ANY ERRORS OR
  12. ** OMMISSIONS.
  13. **
  14. ** \note Do not modify this file as it is generated automatically.
  15. **
  16. ******************************************************************************/
  17. #ifndef _GH_VIC_H
  18. #define _GH_VIC_H
  19. #ifdef __LINUX__
  20. #include "reg4linux.h"
  21. #else
  22. #define FIO_ADDRESS(block,address) (address)
  23. #define FIO_MOFFSET(block,moffset) (moffset)
  24. #endif
  25. #ifndef __LINUX__
  26. #include "gtypes.h" /* global type definitions */
  27. #include "gh_lib_cfg.h" /* configuration */
  28. #endif
  29. #define GH_VIC_ENABLE_DEBUG_PRINT 0
  30. #ifdef __LINUX__
  31. #define GH_VIC_DEBUG_PRINT_FUNCTION printk
  32. #else
  33. #define GH_VIC_DEBUG_PRINT_FUNCTION printf
  34. #endif
  35. #ifndef __LINUX__
  36. #if GH_VIC_ENABLE_DEBUG_PRINT
  37. #include <stdio.h>
  38. #endif
  39. #endif
  40. /* check configuration */
  41. #ifndef GH_INLINE_LEVEL
  42. #error "GH_INLINE_LEVEL is not defined!"
  43. #endif
  44. #if GH_INLINE_LEVEL > 2
  45. #error "GH_INLINE_LEVEL must be set 0, 1 or 2!"
  46. #endif
  47. #ifndef GH_INLINE
  48. #error "GH_INLINE is not defined!"
  49. #endif
  50. /* disable inlining for debugging */
  51. #ifdef DEBUG
  52. #undef GH_INLINE_LEVEL
  53. #define GH_INLINE_LEVEL 0
  54. #endif
  55. /*----------------------------------------------------------------------------*/
  56. /* registers */
  57. /*----------------------------------------------------------------------------*/
  58. #define REG_VIC_SENSE FIO_ADDRESS(VIC,0x90008000) /* read/write */
  59. #define REG_VIC_EVENT FIO_ADDRESS(VIC,0x90008004) /* read/write */
  60. #define REG_VIC_BOTHEDGE FIO_ADDRESS(VIC,0x90008008) /* read/write */
  61. #define REG_VIC_SELECT FIO_ADDRESS(VIC,0x9000800C) /* read/write */
  62. #define REG_VIC_ENABLE FIO_ADDRESS(VIC,0x90008010) /* read/write */
  63. #define REG_VIC_ENCLR FIO_ADDRESS(VIC,0x90008014) /* write */
  64. #define REG_VIC_RAWSTS FIO_ADDRESS(VIC,0x90008018) /* read */
  65. #define REG_VIC_SOFTINT FIO_ADDRESS(VIC,0x9000801C) /* read/write */
  66. #define REG_VIC_SOFTINTRCLR FIO_ADDRESS(VIC,0x90008020) /* write */
  67. #define REG_VIC_PROTECT FIO_ADDRESS(VIC,0x90008024) /* read/write */
  68. #define REG_VIC_IRQSTS FIO_ADDRESS(VIC,0x90008030) /* read */
  69. #define REG_VIC_FIQSTS FIO_ADDRESS(VIC,0x90008034) /* read */
  70. #define REG_VIC_EDGECLR FIO_ADDRESS(VIC,0x90008038) /* write */
  71. /*----------------------------------------------------------------------------*/
  72. /* bit group structures */
  73. /*----------------------------------------------------------------------------*/
  74. typedef union { /* VIC_Protect */
  75. U32 all;
  76. struct {
  77. U32 protect : 1;
  78. U32 : 31;
  79. } bitc;
  80. } GH_VIC_PROTECT_S;
  81. /*----------------------------------------------------------------------------*/
  82. /* mirror variables */
  83. /*----------------------------------------------------------------------------*/
  84. extern U32 m_vic_enclr[2];
  85. extern U32 m_vic_softintrclr[2];
  86. extern U32 m_vic_edgeclr[2];
  87. #ifdef __cplusplus
  88. extern "C" {
  89. #endif
  90. /*----------------------------------------------------------------------------*/
  91. /* register VIC_Sense (read/write) */
  92. /*----------------------------------------------------------------------------*/
  93. #if GH_INLINE_LEVEL == 0
  94. /*! \brief Writes the register 'VIC_Sense'. */
  95. void GH_VIC_set_Sense(U8 index, U32 data);
  96. /*! \brief Reads the register 'VIC_Sense'. */
  97. U32 GH_VIC_get_Sense(U8 index);
  98. #else /* GH_INLINE_LEVEL == 0 */
  99. GH_INLINE void GH_VIC_set_Sense(U8 index, U32 data)
  100. {
  101. *(volatile U32 *)(REG_VIC_SENSE + index * FIO_MOFFSET(VIC,0x00001000)) = data;
  102. #if GH_VIC_ENABLE_DEBUG_PRINT
  103. GH_VIC_DEBUG_PRINT_FUNCTION( "WRREG(0x%08x,0x%08x); \\\\ [GH_VIC_set_Sense] <-- 0x%08x\n",
  104. (REG_VIC_SENSE + index * FIO_MOFFSET(VIC,0x00001000)),data,data);
  105. #endif
  106. }
  107. GH_INLINE U32 GH_VIC_get_Sense(U8 index)
  108. {
  109. U32 value = (*(volatile U32 *)(REG_VIC_SENSE + index * FIO_MOFFSET(VIC,0x00001000)));
  110. #if GH_VIC_ENABLE_DEBUG_PRINT
  111. GH_VIC_DEBUG_PRINT_FUNCTION( "value = RDREG(0x%08x); \\\\ [GH_VIC_get_Sense] --> 0x%08x\n",
  112. (REG_VIC_SENSE + index * FIO_MOFFSET(VIC,0x00001000)),value);
  113. #endif
  114. return value;
  115. }
  116. #endif /* GH_INLINE_LEVEL == 0 */
  117. /*----------------------------------------------------------------------------*/
  118. /* register VIC_Event (read/write) */
  119. /*----------------------------------------------------------------------------*/
  120. #if GH_INLINE_LEVEL == 0
  121. /*! \brief Writes the register 'VIC_Event'. */
  122. void GH_VIC_set_Event(U8 index, U32 data);
  123. /*! \brief Reads the register 'VIC_Event'. */
  124. U32 GH_VIC_get_Event(U8 index);
  125. #else /* GH_INLINE_LEVEL == 0 */
  126. GH_INLINE void GH_VIC_set_Event(U8 index, U32 data)
  127. {
  128. *(volatile U32 *)(REG_VIC_EVENT + index * FIO_MOFFSET(VIC,0x00001000)) = data;
  129. #if GH_VIC_ENABLE_DEBUG_PRINT
  130. GH_VIC_DEBUG_PRINT_FUNCTION( "WRREG(0x%08x,0x%08x); \\\\ [GH_VIC_set_Event] <-- 0x%08x\n",
  131. (REG_VIC_EVENT + index * FIO_MOFFSET(VIC,0x00001000)),data,data);
  132. #endif
  133. }
  134. GH_INLINE U32 GH_VIC_get_Event(U8 index)
  135. {
  136. U32 value = (*(volatile U32 *)(REG_VIC_EVENT + index * FIO_MOFFSET(VIC,0x00001000)));
  137. #if GH_VIC_ENABLE_DEBUG_PRINT
  138. GH_VIC_DEBUG_PRINT_FUNCTION( "value = RDREG(0x%08x); \\\\ [GH_VIC_get_Event] --> 0x%08x\n",
  139. (REG_VIC_EVENT + index * FIO_MOFFSET(VIC,0x00001000)),value);
  140. #endif
  141. return value;
  142. }
  143. #endif /* GH_INLINE_LEVEL == 0 */
  144. /*----------------------------------------------------------------------------*/
  145. /* register VIC_BothEdge (read/write) */
  146. /*----------------------------------------------------------------------------*/
  147. #if GH_INLINE_LEVEL == 0
  148. /*! \brief Writes the register 'VIC_BothEdge'. */
  149. void GH_VIC_set_BothEdge(U8 index, U32 data);
  150. /*! \brief Reads the register 'VIC_BothEdge'. */
  151. U32 GH_VIC_get_BothEdge(U8 index);
  152. #else /* GH_INLINE_LEVEL == 0 */
  153. GH_INLINE void GH_VIC_set_BothEdge(U8 index, U32 data)
  154. {
  155. *(volatile U32 *)(REG_VIC_BOTHEDGE + index * FIO_MOFFSET(VIC,0x00001000)) = data;
  156. #if GH_VIC_ENABLE_DEBUG_PRINT
  157. GH_VIC_DEBUG_PRINT_FUNCTION( "WRREG(0x%08x,0x%08x); \\\\ [GH_VIC_set_BothEdge] <-- 0x%08x\n",
  158. (REG_VIC_BOTHEDGE + index * FIO_MOFFSET(VIC,0x00001000)),data,data);
  159. #endif
  160. }
  161. GH_INLINE U32 GH_VIC_get_BothEdge(U8 index)
  162. {
  163. U32 value = (*(volatile U32 *)(REG_VIC_BOTHEDGE + index * FIO_MOFFSET(VIC,0x00001000)));
  164. #if GH_VIC_ENABLE_DEBUG_PRINT
  165. GH_VIC_DEBUG_PRINT_FUNCTION( "value = RDREG(0x%08x); \\\\ [GH_VIC_get_BothEdge] --> 0x%08x\n",
  166. (REG_VIC_BOTHEDGE + index * FIO_MOFFSET(VIC,0x00001000)),value);
  167. #endif
  168. return value;
  169. }
  170. #endif /* GH_INLINE_LEVEL == 0 */
  171. /*----------------------------------------------------------------------------*/
  172. /* register VIC_Select (read/write) */
  173. /*----------------------------------------------------------------------------*/
  174. #if GH_INLINE_LEVEL == 0
  175. /*! \brief Writes the register 'VIC_Select'. */
  176. void GH_VIC_set_Select(U8 index, U32 data);
  177. /*! \brief Reads the register 'VIC_Select'. */
  178. U32 GH_VIC_get_Select(U8 index);
  179. #else /* GH_INLINE_LEVEL == 0 */
  180. GH_INLINE void GH_VIC_set_Select(U8 index, U32 data)
  181. {
  182. *(volatile U32 *)(REG_VIC_SELECT + index * FIO_MOFFSET(VIC,0x00001000)) = data;
  183. #if GH_VIC_ENABLE_DEBUG_PRINT
  184. GH_VIC_DEBUG_PRINT_FUNCTION( "WRREG(0x%08x,0x%08x); \\\\ [GH_VIC_set_Select] <-- 0x%08x\n",
  185. (REG_VIC_SELECT + index * FIO_MOFFSET(VIC,0x00001000)),data,data);
  186. #endif
  187. }
  188. GH_INLINE U32 GH_VIC_get_Select(U8 index)
  189. {
  190. U32 value = (*(volatile U32 *)(REG_VIC_SELECT + index * FIO_MOFFSET(VIC,0x00001000)));
  191. #if GH_VIC_ENABLE_DEBUG_PRINT
  192. GH_VIC_DEBUG_PRINT_FUNCTION( "value = RDREG(0x%08x); \\\\ [GH_VIC_get_Select] --> 0x%08x\n",
  193. (REG_VIC_SELECT + index * FIO_MOFFSET(VIC,0x00001000)),value);
  194. #endif
  195. return value;
  196. }
  197. #endif /* GH_INLINE_LEVEL == 0 */
  198. /*----------------------------------------------------------------------------*/
  199. /* register VIC_Enable (read/write) */
  200. /*----------------------------------------------------------------------------*/
  201. #if GH_INLINE_LEVEL == 0
  202. /*! \brief Writes the register 'VIC_Enable'. */
  203. void GH_VIC_set_Enable(U8 index, U32 data);
  204. /*! \brief Reads the register 'VIC_Enable'. */
  205. U32 GH_VIC_get_Enable(U8 index);
  206. #else /* GH_INLINE_LEVEL == 0 */
  207. GH_INLINE void GH_VIC_set_Enable(U8 index, U32 data)
  208. {
  209. *(volatile U32 *)(REG_VIC_ENABLE + index * FIO_MOFFSET(VIC,0x00001000)) = data;
  210. #if GH_VIC_ENABLE_DEBUG_PRINT
  211. GH_VIC_DEBUG_PRINT_FUNCTION( "WRREG(0x%08x,0x%08x); \\\\ [GH_VIC_set_Enable] <-- 0x%08x\n",
  212. (REG_VIC_ENABLE + index * FIO_MOFFSET(VIC,0x00001000)),data,data);
  213. #endif
  214. }
  215. GH_INLINE U32 GH_VIC_get_Enable(U8 index)
  216. {
  217. U32 value = (*(volatile U32 *)(REG_VIC_ENABLE + index * FIO_MOFFSET(VIC,0x00001000)));
  218. #if GH_VIC_ENABLE_DEBUG_PRINT
  219. GH_VIC_DEBUG_PRINT_FUNCTION( "value = RDREG(0x%08x); \\\\ [GH_VIC_get_Enable] --> 0x%08x\n",
  220. (REG_VIC_ENABLE + index * FIO_MOFFSET(VIC,0x00001000)),value);
  221. #endif
  222. return value;
  223. }
  224. #endif /* GH_INLINE_LEVEL == 0 */
  225. /*----------------------------------------------------------------------------*/
  226. /* register VIC_EnClr (write) */
  227. /*----------------------------------------------------------------------------*/
  228. #if GH_INLINE_LEVEL < 2
  229. /*! \brief Writes the register 'VIC_EnClr'. */
  230. void GH_VIC_set_EnClr(U8 index, U32 data);
  231. /*! \brief Reads the mirror variable of the register 'VIC_EnClr'. */
  232. U32 GH_VIC_getm_EnClr(U8 index);
  233. #else /* GH_INLINE_LEVEL < 2 */
  234. GH_INLINE void GH_VIC_set_EnClr(U8 index, U32 data)
  235. {
  236. m_vic_enclr[index] = data;
  237. *(volatile U32 *)(REG_VIC_ENCLR + index * FIO_MOFFSET(VIC,0x00001000)) = data;
  238. #if GH_VIC_ENABLE_DEBUG_PRINT
  239. GH_VIC_DEBUG_PRINT_FUNCTION( "WRREG(0x%08x,0x%08x); \\\\ [GH_VIC_set_EnClr] <-- 0x%08x\n",
  240. (REG_VIC_ENCLR + index * FIO_MOFFSET(VIC,0x00001000)),data,data);
  241. #endif
  242. }
  243. GH_INLINE U32 GH_VIC_getm_EnClr(U8 index)
  244. {
  245. #if GH_VIC_ENABLE_DEBUG_PRINT
  246. GH_VIC_DEBUG_PRINT_FUNCTION( "[GH_VIC_getm_EnClr] --> 0x%08x\n",
  247. m_vic_enclr[index]);
  248. #endif
  249. return m_vic_enclr[index];
  250. }
  251. #endif /* GH_INLINE_LEVEL < 2 */
  252. /*----------------------------------------------------------------------------*/
  253. /* register VIC_RawSts (read) */
  254. /*----------------------------------------------------------------------------*/
  255. #if GH_INLINE_LEVEL == 0
  256. /*! \brief Reads the register 'VIC_RawSts'. */
  257. U32 GH_VIC_get_RawSts(U8 index);
  258. #else /* GH_INLINE_LEVEL == 0 */
  259. GH_INLINE U32 GH_VIC_get_RawSts(U8 index)
  260. {
  261. U32 value = (*(volatile U32 *)(REG_VIC_RAWSTS + index * FIO_MOFFSET(VIC,0x00001000)));
  262. #if GH_VIC_ENABLE_DEBUG_PRINT
  263. GH_VIC_DEBUG_PRINT_FUNCTION( "value = RDREG(0x%08x); \\\\ [GH_VIC_get_RawSts] --> 0x%08x\n",
  264. (REG_VIC_RAWSTS + index * FIO_MOFFSET(VIC,0x00001000)),value);
  265. #endif
  266. return value;
  267. }
  268. #endif /* GH_INLINE_LEVEL == 0 */
  269. /*----------------------------------------------------------------------------*/
  270. /* register VIC_SoftInt (read/write) */
  271. /*----------------------------------------------------------------------------*/
  272. #if GH_INLINE_LEVEL == 0
  273. /*! \brief Writes the register 'VIC_SoftInt'. */
  274. void GH_VIC_set_SoftInt(U8 index, U32 data);
  275. /*! \brief Reads the register 'VIC_SoftInt'. */
  276. U32 GH_VIC_get_SoftInt(U8 index);
  277. #else /* GH_INLINE_LEVEL == 0 */
  278. GH_INLINE void GH_VIC_set_SoftInt(U8 index, U32 data)
  279. {
  280. *(volatile U32 *)(REG_VIC_SOFTINT + index * FIO_MOFFSET(VIC,0x00001000)) = data;
  281. #if GH_VIC_ENABLE_DEBUG_PRINT
  282. GH_VIC_DEBUG_PRINT_FUNCTION( "WRREG(0x%08x,0x%08x); \\\\ [GH_VIC_set_SoftInt] <-- 0x%08x\n",
  283. (REG_VIC_SOFTINT + index * FIO_MOFFSET(VIC,0x00001000)),data,data);
  284. #endif
  285. }
  286. GH_INLINE U32 GH_VIC_get_SoftInt(U8 index)
  287. {
  288. U32 value = (*(volatile U32 *)(REG_VIC_SOFTINT + index * FIO_MOFFSET(VIC,0x00001000)));
  289. #if GH_VIC_ENABLE_DEBUG_PRINT
  290. GH_VIC_DEBUG_PRINT_FUNCTION( "value = RDREG(0x%08x); \\\\ [GH_VIC_get_SoftInt] --> 0x%08x\n",
  291. (REG_VIC_SOFTINT + index * FIO_MOFFSET(VIC,0x00001000)),value);
  292. #endif
  293. return value;
  294. }
  295. #endif /* GH_INLINE_LEVEL == 0 */
  296. /*----------------------------------------------------------------------------*/
  297. /* register VIC_SoftIntrClr (write) */
  298. /*----------------------------------------------------------------------------*/
  299. #if GH_INLINE_LEVEL < 2
  300. /*! \brief Writes the register 'VIC_SoftIntrClr'. */
  301. void GH_VIC_set_SoftIntrClr(U8 index, U32 data);
  302. /*! \brief Reads the mirror variable of the register 'VIC_SoftIntrClr'. */
  303. U32 GH_VIC_getm_SoftIntrClr(U8 index);
  304. #else /* GH_INLINE_LEVEL < 2 */
  305. GH_INLINE void GH_VIC_set_SoftIntrClr(U8 index, U32 data)
  306. {
  307. m_vic_softintrclr[index] = data;
  308. *(volatile U32 *)(REG_VIC_SOFTINTRCLR + index * FIO_MOFFSET(VIC,0x00001000)) = data;
  309. #if GH_VIC_ENABLE_DEBUG_PRINT
  310. GH_VIC_DEBUG_PRINT_FUNCTION( "WRREG(0x%08x,0x%08x); \\\\ [GH_VIC_set_SoftIntrClr] <-- 0x%08x\n",
  311. (REG_VIC_SOFTINTRCLR + index * FIO_MOFFSET(VIC,0x00001000)),data,data);
  312. #endif
  313. }
  314. GH_INLINE U32 GH_VIC_getm_SoftIntrClr(U8 index)
  315. {
  316. #if GH_VIC_ENABLE_DEBUG_PRINT
  317. GH_VIC_DEBUG_PRINT_FUNCTION( "[GH_VIC_getm_SoftIntrClr] --> 0x%08x\n",
  318. m_vic_softintrclr[index]);
  319. #endif
  320. return m_vic_softintrclr[index];
  321. }
  322. #endif /* GH_INLINE_LEVEL < 2 */
  323. /*----------------------------------------------------------------------------*/
  324. /* register VIC_Protect (read/write) */
  325. /*----------------------------------------------------------------------------*/
  326. #if GH_INLINE_LEVEL == 0
  327. /*! \brief Writes the register 'VIC_Protect'. */
  328. void GH_VIC_set_Protect(U8 index, U32 data);
  329. /*! \brief Reads the register 'VIC_Protect'. */
  330. U32 GH_VIC_get_Protect(U8 index);
  331. /*! \brief Writes the bit group 'Protect' of register 'VIC_Protect'. */
  332. void GH_VIC_set_Protect_Protect(U8 index, U8 data);
  333. /*! \brief Reads the bit group 'Protect' of register 'VIC_Protect'. */
  334. U8 GH_VIC_get_Protect_Protect(U8 index);
  335. #else /* GH_INLINE_LEVEL == 0 */
  336. GH_INLINE void GH_VIC_set_Protect(U8 index, U32 data)
  337. {
  338. *(volatile U32 *)(REG_VIC_PROTECT + index * FIO_MOFFSET(VIC,0x00001000)) = data;
  339. #if GH_VIC_ENABLE_DEBUG_PRINT
  340. GH_VIC_DEBUG_PRINT_FUNCTION( "WRREG(0x%08x,0x%08x); \\\\ [GH_VIC_set_Protect] <-- 0x%08x\n",
  341. (REG_VIC_PROTECT + index * FIO_MOFFSET(VIC,0x00001000)),data,data);
  342. #endif
  343. }
  344. GH_INLINE U32 GH_VIC_get_Protect(U8 index)
  345. {
  346. U32 value = (*(volatile U32 *)(REG_VIC_PROTECT + index * FIO_MOFFSET(VIC,0x00001000)));
  347. #if GH_VIC_ENABLE_DEBUG_PRINT
  348. GH_VIC_DEBUG_PRINT_FUNCTION( "value = RDREG(0x%08x); \\\\ [GH_VIC_get_Protect] --> 0x%08x\n",
  349. (REG_VIC_PROTECT + index * FIO_MOFFSET(VIC,0x00001000)),value);
  350. #endif
  351. return value;
  352. }
  353. GH_INLINE void GH_VIC_set_Protect_Protect(U8 index, U8 data)
  354. {
  355. GH_VIC_PROTECT_S d;
  356. d.all = *(volatile U32 *)(REG_VIC_PROTECT + index * FIO_MOFFSET(VIC,0x00001000));
  357. d.bitc.protect = data;
  358. *(volatile U32 *)(REG_VIC_PROTECT + index * FIO_MOFFSET(VIC,0x00001000)) = d.all;
  359. #if GH_VIC_ENABLE_DEBUG_PRINT
  360. GH_VIC_DEBUG_PRINT_FUNCTION( "WRREG(0x%08x,0x%08x); \\\\ [GH_VIC_set_Protect_Protect] <-- 0x%08x\n",
  361. (REG_VIC_PROTECT + index * FIO_MOFFSET(VIC,0x00001000)),d.all,d.all);
  362. #endif
  363. }
  364. GH_INLINE U8 GH_VIC_get_Protect_Protect(U8 index)
  365. {
  366. GH_VIC_PROTECT_S tmp_value;
  367. U32 value = (*(volatile U32 *)(REG_VIC_PROTECT + index * FIO_MOFFSET(VIC,0x00001000)));
  368. tmp_value.all = value;
  369. #if GH_VIC_ENABLE_DEBUG_PRINT
  370. GH_VIC_DEBUG_PRINT_FUNCTION( "value = RDREG(0x%08x); \\\\ [GH_VIC_get_Protect_Protect] --> 0x%08x\n",
  371. (REG_VIC_PROTECT + index * FIO_MOFFSET(VIC,0x00001000)),value);
  372. #endif
  373. return tmp_value.bitc.protect;
  374. }
  375. #endif /* GH_INLINE_LEVEL == 0 */
  376. /*----------------------------------------------------------------------------*/
  377. /* register VIC_IRQSts (read) */
  378. /*----------------------------------------------------------------------------*/
  379. #if GH_INLINE_LEVEL == 0
  380. /*! \brief Reads the register 'VIC_IRQSts'. */
  381. U32 GH_VIC_get_IRQSts(U8 index);
  382. #else /* GH_INLINE_LEVEL == 0 */
  383. GH_INLINE U32 GH_VIC_get_IRQSts(U8 index)
  384. {
  385. U32 value = (*(volatile U32 *)(REG_VIC_IRQSTS + index * FIO_MOFFSET(VIC,0x00001000)));
  386. #if GH_VIC_ENABLE_DEBUG_PRINT
  387. GH_VIC_DEBUG_PRINT_FUNCTION( "value = RDREG(0x%08x); \\\\ [GH_VIC_get_IRQSts] --> 0x%08x\n",
  388. (REG_VIC_IRQSTS + index * FIO_MOFFSET(VIC,0x00001000)),value);
  389. #endif
  390. return value;
  391. }
  392. #endif /* GH_INLINE_LEVEL == 0 */
  393. /*----------------------------------------------------------------------------*/
  394. /* register VIC_FIQSts (read) */
  395. /*----------------------------------------------------------------------------*/
  396. #if GH_INLINE_LEVEL == 0
  397. /*! \brief Reads the register 'VIC_FIQSts'. */
  398. U32 GH_VIC_get_FIQSts(U8 index);
  399. #else /* GH_INLINE_LEVEL == 0 */
  400. GH_INLINE U32 GH_VIC_get_FIQSts(U8 index)
  401. {
  402. U32 value = (*(volatile U32 *)(REG_VIC_FIQSTS + index * FIO_MOFFSET(VIC,0x00001000)));
  403. #if GH_VIC_ENABLE_DEBUG_PRINT
  404. GH_VIC_DEBUG_PRINT_FUNCTION( "value = RDREG(0x%08x); \\\\ [GH_VIC_get_FIQSts] --> 0x%08x\n",
  405. (REG_VIC_FIQSTS + index * FIO_MOFFSET(VIC,0x00001000)),value);
  406. #endif
  407. return value;
  408. }
  409. #endif /* GH_INLINE_LEVEL == 0 */
  410. /*----------------------------------------------------------------------------*/
  411. /* register VIC_EdgeClr (write) */
  412. /*----------------------------------------------------------------------------*/
  413. #if GH_INLINE_LEVEL < 2
  414. /*! \brief Writes the register 'VIC_EdgeClr'. */
  415. void GH_VIC_set_EdgeClr(U8 index, U32 data);
  416. /*! \brief Reads the mirror variable of the register 'VIC_EdgeClr'. */
  417. U32 GH_VIC_getm_EdgeClr(U8 index);
  418. #else /* GH_INLINE_LEVEL < 2 */
  419. GH_INLINE void GH_VIC_set_EdgeClr(U8 index, U32 data)
  420. {
  421. m_vic_edgeclr[index] = data;
  422. *(volatile U32 *)(REG_VIC_EDGECLR + index * FIO_MOFFSET(VIC,0x00001000)) = data;
  423. #if GH_VIC_ENABLE_DEBUG_PRINT
  424. GH_VIC_DEBUG_PRINT_FUNCTION( "WRREG(0x%08x,0x%08x); \\\\ [GH_VIC_set_EdgeClr] <-- 0x%08x\n",
  425. (REG_VIC_EDGECLR + index * FIO_MOFFSET(VIC,0x00001000)),data,data);
  426. #endif
  427. }
  428. GH_INLINE U32 GH_VIC_getm_EdgeClr(U8 index)
  429. {
  430. #if GH_VIC_ENABLE_DEBUG_PRINT
  431. GH_VIC_DEBUG_PRINT_FUNCTION( "[GH_VIC_getm_EdgeClr] --> 0x%08x\n",
  432. m_vic_edgeclr[index]);
  433. #endif
  434. return m_vic_edgeclr[index];
  435. }
  436. #endif /* GH_INLINE_LEVEL < 2 */
  437. /*----------------------------------------------------------------------------*/
  438. /* init function */
  439. /*----------------------------------------------------------------------------*/
  440. /*! \brief Initialises the registers and mirror variables. */
  441. void GH_VIC_init(void);
  442. #ifdef __cplusplus
  443. }
  444. #endif
  445. #endif /* _GH_VIC_H */
  446. /*----------------------------------------------------------------------------*/
  447. /* end of file */
  448. /*----------------------------------------------------------------------------*/