gh_dma.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  1. /*!
  2. *******************************************************************************
  3. **
  4. ** \file gh_dma.h
  5. **
  6. ** \brief DMA Engine Subsystem.
  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_DMA_H
  18. #define _GH_DMA_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_DMA_ENABLE_DEBUG_PRINT 0
  30. #ifdef __LINUX__
  31. #define GH_DMA_DEBUG_PRINT_FUNCTION printk
  32. #else
  33. #define GH_DMA_DEBUG_PRINT_FUNCTION printf
  34. #endif
  35. #ifndef __LINUX__
  36. #if GH_DMA_ENABLE_DEBUG_PRINT
  37. #include <stdio.h>
  38. #endif
  39. #endif
  40. /*----------------------------------------------------------------------------*/
  41. /* registers */
  42. /*----------------------------------------------------------------------------*/
  43. #define REG_DMA_CONTROL FIO_ADDRESS(DMA,0x90005300) /* read/write */
  44. #define REG_DMA_SOURCE_ADDRESS FIO_ADDRESS(DMA,0x90005304) /* read/write */
  45. #define REG_DMA_DESTINATION_ADDRESS FIO_ADDRESS(DMA,0x90005308) /* read/write */
  46. #define REG_DMA_STATUS FIO_ADDRESS(DMA,0x9000530C) /* read/write */
  47. #define REG_DMA_DESCRIPTOR_ADDRESS FIO_ADDRESS(DMA,0x90005380) /* read/write */
  48. #define REG_DMA_IR FIO_ADDRESS(DMA,0x900053F0) /* read */
  49. /*----------------------------------------------------------------------------*/
  50. /* bit group structures */
  51. /*----------------------------------------------------------------------------*/
  52. typedef union { /* DMA_Control */
  53. U32 all;
  54. struct {
  55. U32 count : 22;
  56. U32 ts : 2;
  57. U32 blk : 3;
  58. U32 ni : 1;
  59. U32 rm : 1;
  60. U32 wm : 1;
  61. U32 d : 1;
  62. U32 en : 1;
  63. } bitc;
  64. } GH_DMA_CONTROL_S;
  65. typedef union { /* DMA_Status */
  66. U32 all;
  67. struct {
  68. U32 count : 22;
  69. U32 dn : 1;
  70. U32 ae : 1;
  71. U32 rwe : 1;
  72. U32 be : 1;
  73. U32 me : 1;
  74. U32 od : 1;
  75. U32 dd : 1;
  76. U32 da : 1;
  77. U32 oe : 1;
  78. U32 dm : 1;
  79. } bitc;
  80. } GH_DMA_STATUS_S;
  81. typedef union { /* DMA_IR */
  82. U32 all;
  83. struct {
  84. U32 i0 : 1;
  85. U32 i1 : 1;
  86. U32 i2 : 1;
  87. U32 i3 : 1;
  88. U32 : 28;
  89. } bitc;
  90. } GH_DMA_IR_S;
  91. /*----------------------------------------------------------------------------*/
  92. /* mirror variables */
  93. /*----------------------------------------------------------------------------*/
  94. #ifdef __cplusplus
  95. extern "C" {
  96. #endif
  97. /*----------------------------------------------------------------------------*/
  98. /* register DMA_Control (read/write) */
  99. /*----------------------------------------------------------------------------*/
  100. /*! \brief Writes the register 'DMA_Control'. */
  101. void GH_DMA_set_Control(U8 index, U32 data);
  102. /*! \brief Reads the register 'DMA_Control'. */
  103. U32 GH_DMA_get_Control(U8 index);
  104. /*! \brief Writes the bit group 'count' of register 'DMA_Control'. */
  105. void GH_DMA_set_Control_count(U8 index, U32 data);
  106. /*! \brief Reads the bit group 'count' of register 'DMA_Control'. */
  107. U32 GH_DMA_get_Control_count(U8 index);
  108. /*! \brief Writes the bit group 'ts' of register 'DMA_Control'. */
  109. void GH_DMA_set_Control_ts(U8 index, U8 data);
  110. /*! \brief Reads the bit group 'ts' of register 'DMA_Control'. */
  111. U8 GH_DMA_get_Control_ts(U8 index);
  112. /*! \brief Writes the bit group 'blk' of register 'DMA_Control'. */
  113. void GH_DMA_set_Control_blk(U8 index, U8 data);
  114. /*! \brief Reads the bit group 'blk' of register 'DMA_Control'. */
  115. U8 GH_DMA_get_Control_blk(U8 index);
  116. /*! \brief Writes the bit group 'ni' of register 'DMA_Control'. */
  117. void GH_DMA_set_Control_ni(U8 index, U8 data);
  118. /*! \brief Reads the bit group 'ni' of register 'DMA_Control'. */
  119. U8 GH_DMA_get_Control_ni(U8 index);
  120. /*! \brief Writes the bit group 'rm' of register 'DMA_Control'. */
  121. void GH_DMA_set_Control_rm(U8 index, U8 data);
  122. /*! \brief Reads the bit group 'rm' of register 'DMA_Control'. */
  123. U8 GH_DMA_get_Control_rm(U8 index);
  124. /*! \brief Writes the bit group 'wm' of register 'DMA_Control'. */
  125. void GH_DMA_set_Control_wm(U8 index, U8 data);
  126. /*! \brief Reads the bit group 'wm' of register 'DMA_Control'. */
  127. U8 GH_DMA_get_Control_wm(U8 index);
  128. /*! \brief Writes the bit group 'd' of register 'DMA_Control'. */
  129. void GH_DMA_set_Control_d(U8 index, U8 data);
  130. /*! \brief Reads the bit group 'd' of register 'DMA_Control'. */
  131. U8 GH_DMA_get_Control_d(U8 index);
  132. /*! \brief Writes the bit group 'en' of register 'DMA_Control'. */
  133. void GH_DMA_set_Control_en(U8 index, U8 data);
  134. /*! \brief Reads the bit group 'en' of register 'DMA_Control'. */
  135. U8 GH_DMA_get_Control_en(U8 index);
  136. /*----------------------------------------------------------------------------*/
  137. /* register DMA_Source_Address (read/write) */
  138. /*----------------------------------------------------------------------------*/
  139. /*! \brief Writes the register 'DMA_Source_Address'. */
  140. void GH_DMA_set_Source_Address(U8 index, U32 data);
  141. /*! \brief Reads the register 'DMA_Source_Address'. */
  142. U32 GH_DMA_get_Source_Address(U8 index);
  143. /*----------------------------------------------------------------------------*/
  144. /* register DMA_Destination_Address (read/write) */
  145. /*----------------------------------------------------------------------------*/
  146. /*! \brief Writes the register 'DMA_Destination_Address'. */
  147. void GH_DMA_set_Destination_Address(U8 index, U32 data);
  148. /*! \brief Reads the register 'DMA_Destination_Address'. */
  149. U32 GH_DMA_get_Destination_Address(U8 index);
  150. /*----------------------------------------------------------------------------*/
  151. /* register DMA_Status (read/write) */
  152. /*----------------------------------------------------------------------------*/
  153. /*! \brief Writes the register 'DMA_Status'. */
  154. void GH_DMA_set_Status(U8 index, U32 data);
  155. /*! \brief Reads the register 'DMA_Status'. */
  156. U32 GH_DMA_get_Status(U8 index);
  157. /*! \brief Writes the bit group 'count' of register 'DMA_Status'. */
  158. void GH_DMA_set_Status_count(U8 index, U32 data);
  159. /*! \brief Reads the bit group 'count' of register 'DMA_Status'. */
  160. U32 GH_DMA_get_Status_count(U8 index);
  161. /*! \brief Writes the bit group 'dn' of register 'DMA_Status'. */
  162. void GH_DMA_set_Status_dn(U8 index, U8 data);
  163. /*! \brief Reads the bit group 'dn' of register 'DMA_Status'. */
  164. U8 GH_DMA_get_Status_dn(U8 index);
  165. /*! \brief Writes the bit group 'ae' of register 'DMA_Status'. */
  166. void GH_DMA_set_Status_ae(U8 index, U8 data);
  167. /*! \brief Reads the bit group 'ae' of register 'DMA_Status'. */
  168. U8 GH_DMA_get_Status_ae(U8 index);
  169. /*! \brief Writes the bit group 'rwe' of register 'DMA_Status'. */
  170. void GH_DMA_set_Status_rwe(U8 index, U8 data);
  171. /*! \brief Reads the bit group 'rwe' of register 'DMA_Status'. */
  172. U8 GH_DMA_get_Status_rwe(U8 index);
  173. /*! \brief Writes the bit group 'be' of register 'DMA_Status'. */
  174. void GH_DMA_set_Status_be(U8 index, U8 data);
  175. /*! \brief Reads the bit group 'be' of register 'DMA_Status'. */
  176. U8 GH_DMA_get_Status_be(U8 index);
  177. /*! \brief Writes the bit group 'me' of register 'DMA_Status'. */
  178. void GH_DMA_set_Status_me(U8 index, U8 data);
  179. /*! \brief Reads the bit group 'me' of register 'DMA_Status'. */
  180. U8 GH_DMA_get_Status_me(U8 index);
  181. /*! \brief Writes the bit group 'od' of register 'DMA_Status'. */
  182. void GH_DMA_set_Status_od(U8 index, U8 data);
  183. /*! \brief Reads the bit group 'od' of register 'DMA_Status'. */
  184. U8 GH_DMA_get_Status_od(U8 index);
  185. /*! \brief Writes the bit group 'dd' of register 'DMA_Status'. */
  186. void GH_DMA_set_Status_dd(U8 index, U8 data);
  187. /*! \brief Reads the bit group 'dd' of register 'DMA_Status'. */
  188. U8 GH_DMA_get_Status_dd(U8 index);
  189. /*! \brief Writes the bit group 'da' of register 'DMA_Status'. */
  190. void GH_DMA_set_Status_da(U8 index, U8 data);
  191. /*! \brief Reads the bit group 'da' of register 'DMA_Status'. */
  192. U8 GH_DMA_get_Status_da(U8 index);
  193. /*! \brief Writes the bit group 'oe' of register 'DMA_Status'. */
  194. void GH_DMA_set_Status_oe(U8 index, U8 data);
  195. /*! \brief Reads the bit group 'oe' of register 'DMA_Status'. */
  196. U8 GH_DMA_get_Status_oe(U8 index);
  197. /*! \brief Writes the bit group 'dm' of register 'DMA_Status'. */
  198. void GH_DMA_set_Status_dm(U8 index, U8 data);
  199. /*! \brief Reads the bit group 'dm' of register 'DMA_Status'. */
  200. U8 GH_DMA_get_Status_dm(U8 index);
  201. /*----------------------------------------------------------------------------*/
  202. /* register DMA_Descriptor_Address (read/write) */
  203. /*----------------------------------------------------------------------------*/
  204. /*! \brief Writes the register 'DMA_Descriptor_Address'. */
  205. void GH_DMA_set_Descriptor_Address(U8 index, U32 data);
  206. /*! \brief Reads the register 'DMA_Descriptor_Address'. */
  207. U32 GH_DMA_get_Descriptor_Address(U8 index);
  208. /*----------------------------------------------------------------------------*/
  209. /* register DMA_IR (read) */
  210. /*----------------------------------------------------------------------------*/
  211. /*! \brief Reads the register 'DMA_IR'. */
  212. U32 GH_DMA_get_IR(void);
  213. /*! \brief Reads the bit group 'i0' of register 'DMA_IR'. */
  214. U8 GH_DMA_get_IR_i0(void);
  215. /*! \brief Reads the bit group 'i1' of register 'DMA_IR'. */
  216. U8 GH_DMA_get_IR_i1(void);
  217. /*! \brief Reads the bit group 'i2' of register 'DMA_IR'. */
  218. U8 GH_DMA_get_IR_i2(void);
  219. /*! \brief Reads the bit group 'i3' of register 'DMA_IR'. */
  220. U8 GH_DMA_get_IR_i3(void);
  221. /*----------------------------------------------------------------------------*/
  222. /* init function */
  223. /*----------------------------------------------------------------------------*/
  224. /*! \brief Initialises the registers and mirror variables. */
  225. void GH_DMA_init(void);
  226. #ifdef SRC_INLINE
  227. #define SRC_INC 1
  228. #include "gh_dma.c"
  229. #undef SRC_INC
  230. #endif
  231. #ifdef __cplusplus
  232. }
  233. #endif
  234. #endif /* _GH_DMA_H */
  235. /*----------------------------------------------------------------------------*/
  236. /* end of file */
  237. /*----------------------------------------------------------------------------*/