gh_vic.h 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285
  1. /*!
  2. *******************************************************************************
  3. **
  4. ** \file gh_vic.h
  5. **
  6. ** \brief VIC.
  7. **
  8. ** Copyright: 2012 - 2016 (C) GoKe Microelectronics
  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. /*----------------------------------------------------------------------------*/
  41. /* registers */
  42. /*----------------------------------------------------------------------------*/
  43. #define REG_VIC_IRQSTS FIO_ADDRESS(VIC,0x90003030) /* read */
  44. #define REG_VIC_FIQSTS FIO_ADDRESS(VIC,0x90003034) /* read */
  45. #define REG_VIC_RAWSTS FIO_ADDRESS(VIC,0x90003018) /* read */
  46. #define REG_VIC_SELECT FIO_ADDRESS(VIC,0x9000300C) /* read/write */
  47. #define REG_VIC_ENABLE FIO_ADDRESS(VIC,0x90003010) /* read/write */
  48. #define REG_VIC_ENCLR FIO_ADDRESS(VIC,0x90003014) /* write */
  49. #define REG_VIC_SOFTINT FIO_ADDRESS(VIC,0x9000301C) /* read/write */
  50. #define REG_VIC_SOFTINTRCLR FIO_ADDRESS(VIC,0x90003020) /* write */
  51. #define REG_VIC_PROTECT FIO_ADDRESS(VIC,0x90003024) /* read/write */
  52. #define REG_VIC_SENSE FIO_ADDRESS(VIC,0x90003000) /* read/write */
  53. #define REG_VIC_BOTHEDGE FIO_ADDRESS(VIC,0x90003008) /* read/write */
  54. #define REG_VIC_EVENT FIO_ADDRESS(VIC,0x90003004) /* read/write */
  55. #define REG_VIC_EDGECLR FIO_ADDRESS(VIC,0x90003038) /* write */
  56. /*!
  57. *******************************************************************************
  58. **
  59. ** \brief Interrupt vectors
  60. **
  61. ** The list below describes all available interrupt sources,
  62. ** a table containing the real interrupt service routines.
  63. ** All other interrupts are maskable and the priority can be set
  64. ** either to medium (1) or low (2).
  65. **
  66. ******************************************************************************/
  67. enum
  68. {
  69. GH_INT_SSI_SLAVE_IRQ = 0, //!<
  70. GH_INT_ETH_IRQ = 1, //!< level, Ethernet 1
  71. GH_INT_IDSP_ERROR_IRQ = 2, //!< edge, iDSP error
  72. GH_INT_RESERVED1_03_IRQ = 3, //!<
  73. GH_INT_RESERVED1_04_IRQ = 4, //!<
  74. GH_INT_RESERVED1_05_IRQ = 5, //!<
  75. GH_INT_RESERVED1_06_IRQ = 6, //!<
  76. GH_INT_CODING_ORC_VOUT1_IRQ = 7, //!<
  77. GH_INT_SD_CONTROLLER_IRQ = 8, //!< level, SD controller
  78. GH_INT_IDC_IRQ = 9, //!< level, i2c read/write, I2C0
  79. GH_INT_SSI_SPI_IRQ = 10, //!< level, Synchronous Serial Interface (SSI, SPI)
  80. GH_INT_WDT_IRQ = 11, //!< edge, Watchdog (WDT)
  81. GH_INT_IRIF_IRQ = 12, //!<
  82. GH_INT_RESERVED1_13_IRQ = 13, //!<
  83. GH_INT_SD_CARD_DETECT_IRQ = 14, //!< Both edges, SD card detect (state of SMIO5 pin)
  84. GH_INT_UART1_IRQ = 15, //!< level, uart read/write, UART1
  85. GH_INT_GPIO0_IRQ = 16, //!< level, GPIO0
  86. GH_INT_UART2_IRQ = 17, //!< level, uart read/write, UART1
  87. GH_INT_TIMER1_IRQ = 18, //!< edge, timer#1
  88. GH_INT_TIMER2_IRQ = 19, //!< edge, timer#2
  89. GH_INT_TIMER3_IRQ = 20, //!< edge, timer#3
  90. GH_INT_DMA_IRQ = 21, //!< level, DMA
  91. GH_INT_RESERVED1_22_IRQ = 22, //!<
  92. GH_INT_RESERVED1_23_IRQ = 23, //!<
  93. GH_INT_CODING_ORC_VIN_IRQ = 24, //!< edge, Coding Orc VIN
  94. GH_INT_CORDING_ORC_VDSP_IRQ = 25, //!<
  95. GH_INT_USB_IRQ = 26, //!< level, USB
  96. GH_INT_RESERVED1_27_IRQ = 27, //!<
  97. GH_INT_XIU_TIMEOUT_IRQ = 28, //!<
  98. GH_INT_AUDIO_I2S_TX_IRQ = 29, //!< level, Audio (I2S) TX
  99. GH_INT_AUDIO_I2S_RX_IRQ = 30, //!< level, Audio (I2S) RX
  100. GH_INT_UART_IRQ = 31, //!< level, GPIO0
  101. GH_INT_RESERVED2_00_IRQ = ( 0 + 32), //!<
  102. GH_INT_RESERVED2_01_IRQ = ( 1 + 32), //!<
  103. GH_INT_RESERVED2_02_IRQ = ( 2 + 32), //!<
  104. GH_INT_RESERVED2_03_IRQ = ( 3 + 32), //!<
  105. GH_INT_RESERVED2_04_IRQ = ( 4 + 32), //!<
  106. GH_INT_RESERVED2_05_IRQ = ( 5 + 32), //!<
  107. GH_INT_RESERVED2_06_IRQ = ( 6 + 32), //!<
  108. GH_INT_RESERVED2_07_IRQ = ( 7 + 32), //!<
  109. GH_INT_AUDIO_PHY_RX_IRQ = ( 8 + 32), //!<
  110. GH_INT_AUDIO_PHY_TX_IRQ = ( 9 + 32), //!<
  111. GH_INT_RESERVED2_10_IRQ = ( 10 + 32), //!<
  112. GH_INT_RESERVED2_11_IRQ = ( 11 + 32), //!<
  113. GH_INT_RESERVED2_12_IRQ = ( 12 + 32), //!<
  114. GH_INT_RESERVED2_13_IRQ = ( 13 + 32), //!<
  115. GH_INT_RESERVED2_14_IRQ = ( 14 + 32), //!<
  116. GH_INT_RESERVED2_15_IRQ = ( 15 + 32), //!<
  117. GH_INT_RESERVED2_16_IRQ = ( 16 + 32), //!< edge, iDSP Vsync (VIN on master mode)
  118. GH_INT_RESERVED2_17_IRQ = ( 17 + 32), //!<
  119. GH_INT_CODING_ORC_VOUT0_IRQ = ( 18 + 32), //!<
  120. GH_INT_AES_OUTPUT_READY_IRQ = ( 19 + 32), //!< edge, AES output ready from Crypt block
  121. GH_INT_DES_OUTPUT_READY_IRQ = ( 20 + 32), //!< edge, DES output ready from Crypt block
  122. GH_INT_RESERVED2_21_IRQ = ( 21 + 32), //!<
  123. GH_INT_GDMA_COMPLETION_IRQ = ( 22 + 32), //!<
  124. GH_INT_MOTOR_INTERRUPT_IRQ = ( 23 + 32), //!<
  125. GH_INT_ADC_LEVEL_CHANGE_IRQ = ( 24 + 32), //!< level, ADC level change
  126. GH_INT_RESERVED2_25_IRQ = ( 25 + 32), //!<
  127. GH_INT_IDC2_IRQ = ( 26 + 32), //!< level, IDC2
  128. GH_INT_IDSP_LAST_PIXEL_IRQ = ( 27 + 32), //!< edge, iDSP last pixel
  129. GH_INT_IDSP_VSYNC_IRQ = ( 28 + 32), //!< edge, iDSP Vsync (VIN on master mode)
  130. GH_INT_IDSP_SENSOR_VSYNC_IRQ= ( 29 + 32), //!< edge, iDSP sensor Vsync (VIN on slave mode)
  131. GH_INT_PMU_IRQ = ( 30 + 32), //!< level, PMU
  132. GH_INT_SSI2_IRQ = ( 31 + 32), //!< level, SSI2
  133. };
  134. /*----------------------------------------------------------------------------*/
  135. /* bit group structures */
  136. /*----------------------------------------------------------------------------*/
  137. typedef union { /* VIC_Protect */
  138. U32 all;
  139. struct {
  140. U32 protect : 1;
  141. U32 : 31;
  142. } bitc;
  143. } GH_VIC_PROTECT_S;
  144. /*----------------------------------------------------------------------------*/
  145. /* mirror variables */
  146. /*----------------------------------------------------------------------------*/
  147. extern U32 m_vic_enclr[2];
  148. extern U32 m_vic_softintrclr[2];
  149. extern U32 m_vic_edgeclr[2];
  150. #ifdef __cplusplus
  151. extern "C" {
  152. #endif
  153. /*----------------------------------------------------------------------------*/
  154. /* register VIC_IRQSts (read) */
  155. /*----------------------------------------------------------------------------*/
  156. /*! \brief Reads the register 'VIC_IRQSts'. */
  157. U32 GH_VIC_get_IRQSts(U8 index);
  158. /*----------------------------------------------------------------------------*/
  159. /* register VIC_FIQSts (read) */
  160. /*----------------------------------------------------------------------------*/
  161. /*! \brief Reads the register 'VIC_FIQSts'. */
  162. U32 GH_VIC_get_FIQSts(U8 index);
  163. /*----------------------------------------------------------------------------*/
  164. /* register VIC_RawSts (read) */
  165. /*----------------------------------------------------------------------------*/
  166. /*! \brief Reads the register 'VIC_RawSts'. */
  167. U32 GH_VIC_get_RawSts(U8 index);
  168. /*----------------------------------------------------------------------------*/
  169. /* register VIC_Select (read/write) */
  170. /*----------------------------------------------------------------------------*/
  171. /*! \brief Writes the register 'VIC_Select'. */
  172. void GH_VIC_set_Select(U8 index, U32 data);
  173. /*! \brief Reads the register 'VIC_Select'. */
  174. U32 GH_VIC_get_Select(U8 index);
  175. /*----------------------------------------------------------------------------*/
  176. /* register VIC_Enable (read/write) */
  177. /*----------------------------------------------------------------------------*/
  178. /*! \brief Writes the register 'VIC_Enable'. */
  179. void GH_VIC_set_Enable(U8 index, U32 data);
  180. /*! \brief Reads the register 'VIC_Enable'. */
  181. U32 GH_VIC_get_Enable(U8 index);
  182. /*----------------------------------------------------------------------------*/
  183. /* register VIC_EnClr (write) */
  184. /*----------------------------------------------------------------------------*/
  185. /*! \brief Writes the register 'VIC_EnClr'. */
  186. void GH_VIC_set_EnClr(U8 index, U32 data);
  187. /*! \brief Reads the mirror variable of the register 'VIC_EnClr'. */
  188. U32 GH_VIC_getm_EnClr(U8 index);
  189. /*----------------------------------------------------------------------------*/
  190. /* register VIC_SoftInt (read/write) */
  191. /*----------------------------------------------------------------------------*/
  192. /*! \brief Writes the register 'VIC_SoftInt'. */
  193. void GH_VIC_set_SoftInt(U8 index, U32 data);
  194. /*! \brief Reads the register 'VIC_SoftInt'. */
  195. U32 GH_VIC_get_SoftInt(U8 index);
  196. /*----------------------------------------------------------------------------*/
  197. /* register VIC_SoftIntrClr (write) */
  198. /*----------------------------------------------------------------------------*/
  199. /*! \brief Writes the register 'VIC_SoftIntrClr'. */
  200. void GH_VIC_set_SoftIntrClr(U8 index, U32 data);
  201. /*! \brief Reads the mirror variable of the register 'VIC_SoftIntrClr'. */
  202. U32 GH_VIC_getm_SoftIntrClr(U8 index);
  203. /*----------------------------------------------------------------------------*/
  204. /* register VIC_Protect (read/write) */
  205. /*----------------------------------------------------------------------------*/
  206. /*! \brief Writes the register 'VIC_Protect'. */
  207. void GH_VIC_set_Protect(U8 index, U32 data);
  208. /*! \brief Reads the register 'VIC_Protect'. */
  209. U32 GH_VIC_get_Protect(U8 index);
  210. /*! \brief Writes the bit group 'Protect' of register 'VIC_Protect'. */
  211. void GH_VIC_set_Protect_Protect(U8 index, U8 data);
  212. /*! \brief Reads the bit group 'Protect' of register 'VIC_Protect'. */
  213. U8 GH_VIC_get_Protect_Protect(U8 index);
  214. /*----------------------------------------------------------------------------*/
  215. /* register VIC_Sense (read/write) */
  216. /*----------------------------------------------------------------------------*/
  217. /*! \brief Writes the register 'VIC_Sense'. */
  218. void GH_VIC_set_Sense(U8 index, U32 data);
  219. /*! \brief Reads the register 'VIC_Sense'. */
  220. U32 GH_VIC_get_Sense(U8 index);
  221. /*----------------------------------------------------------------------------*/
  222. /* register VIC_BothEdge (read/write) */
  223. /*----------------------------------------------------------------------------*/
  224. /*! \brief Writes the register 'VIC_BothEdge'. */
  225. void GH_VIC_set_BothEdge(U8 index, U32 data);
  226. /*! \brief Reads the register 'VIC_BothEdge'. */
  227. U32 GH_VIC_get_BothEdge(U8 index);
  228. /*----------------------------------------------------------------------------*/
  229. /* register VIC_Event (read/write) */
  230. /*----------------------------------------------------------------------------*/
  231. /*! \brief Writes the register 'VIC_Event'. */
  232. void GH_VIC_set_Event(U8 index, U32 data);
  233. /*! \brief Reads the register 'VIC_Event'. */
  234. U32 GH_VIC_get_Event(U8 index);
  235. /*----------------------------------------------------------------------------*/
  236. /* register VIC_EdgeClr (write) */
  237. /*----------------------------------------------------------------------------*/
  238. /*! \brief Writes the register 'VIC_EdgeClr'. */
  239. void GH_VIC_set_EdgeClr(U8 index, U32 data);
  240. /*! \brief Reads the mirror variable of the register 'VIC_EdgeClr'. */
  241. U32 GH_VIC_getm_EdgeClr(U8 index);
  242. /*----------------------------------------------------------------------------*/
  243. /* init function */
  244. /*----------------------------------------------------------------------------*/
  245. /*! \brief Initialises the registers and mirror variables. */
  246. void GH_VIC_init(void);
  247. #ifdef SRC_INLINE
  248. #define SRC_INC 1
  249. #include "gh_vic.c"
  250. #undef SRC_INC
  251. #endif
  252. #ifdef __cplusplus
  253. }
  254. #endif
  255. #endif /* _GH_VIC_H */
  256. /*----------------------------------------------------------------------------*/
  257. /* end of file */
  258. /*----------------------------------------------------------------------------*/