gh_gpio_amba.h 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. /*!
  2. *******************************************************************************
  3. **
  4. ** \file gh_gpio_amba.h
  5. **
  6. ** \brief These GPIO pins can be configured as I/O pins for other hardware modules..
  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_GPIO_AMBA_H
  18. #define _GH_GPIO_AMBA_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_GPIO_ENABLE_DEBUG_PRINT 0
  30. #ifdef __LINUX__
  31. #define GH_GPIO_DEBUG_PRINT_FUNCTION printk
  32. #else
  33. #define GH_GPIO_DEBUG_PRINT_FUNCTION printf
  34. #endif
  35. #ifndef __LINUX__
  36. #if GH_GPIO_ENABLE_DEBUG_PRINT
  37. #include <stdio.h>
  38. #endif
  39. #endif
  40. /*----------------------------------------------------------------------------*/
  41. /* registers */
  42. /*----------------------------------------------------------------------------*/
  43. #define REG_GPIO_DATA FIO_ADDRESS(GPIO,0xa0009000) /* read/write */
  44. #define REG_GPIO_DIR FIO_ADDRESS(GPIO,0xa0009004) /* read/write */
  45. #define REG_GPIO_IS FIO_ADDRESS(GPIO,0xa0009008) /* read/write */
  46. #define REG_GPIO_IBE FIO_ADDRESS(GPIO,0xa000900C) /* read/write */
  47. #define REG_GPIO_IEV FIO_ADDRESS(GPIO,0xa0009010) /* read/write */
  48. #define REG_GPIO_IE FIO_ADDRESS(GPIO,0xa0009014) /* read/write */
  49. #define REG_GPIO_AFSEL FIO_ADDRESS(GPIO,0xa0009018) /* read/write */
  50. #define REG_GPIO_RIS FIO_ADDRESS(GPIO,0xa000901C) /* read */
  51. #define REG_GPIO_MIS FIO_ADDRESS(GPIO,0xa0009020) /* read */
  52. #define REG_GPIO_IC FIO_ADDRESS(GPIO,0xa0009024) /* write */
  53. #define REG_GPIO_MASK FIO_ADDRESS(GPIO,0xa0009028) /* read/write */
  54. #define REG_GPIO_ENABLE FIO_ADDRESS(GPIO,0xa000902C) /* read/write */
  55. /*----------------------------------------------------------------------------*/
  56. /* bit group structures */
  57. /*----------------------------------------------------------------------------*/
  58. typedef union { /* GPIO_ENABLE */
  59. U32 all;
  60. struct {
  61. U32 enb : 1;
  62. U32 : 31;
  63. } bitc;
  64. } GH_GPIO_ENABLE_S;
  65. /*----------------------------------------------------------------------------*/
  66. /* mirror variables */
  67. /*----------------------------------------------------------------------------*/
  68. extern U32 m_gpio_ic[6];
  69. #ifdef __cplusplus
  70. extern "C" {
  71. #endif
  72. /*----------------------------------------------------------------------------*/
  73. /* register GPIO_DATA (read/write) */
  74. /*----------------------------------------------------------------------------*/
  75. /*! \brief Writes the register 'GPIO_DATA'. */
  76. void GH_GPIO_set_DATA(U8 index, U32 data);
  77. /*! \brief Reads the register 'GPIO_DATA'. */
  78. U32 GH_GPIO_get_DATA(U8 index);
  79. /*----------------------------------------------------------------------------*/
  80. /* register GPIO_DIR (read/write) */
  81. /*----------------------------------------------------------------------------*/
  82. /*! \brief Writes the register 'GPIO_DIR'. */
  83. void GH_GPIO_set_DIR(U8 index, U32 data);
  84. /*! \brief Reads the register 'GPIO_DIR'. */
  85. U32 GH_GPIO_get_DIR(U8 index);
  86. /*----------------------------------------------------------------------------*/
  87. /* register GPIO_IS (read/write) */
  88. /*----------------------------------------------------------------------------*/
  89. /*! \brief Writes the register 'GPIO_IS'. */
  90. void GH_GPIO_set_IS(U8 index, U32 data);
  91. /*! \brief Reads the register 'GPIO_IS'. */
  92. U32 GH_GPIO_get_IS(U8 index);
  93. /*----------------------------------------------------------------------------*/
  94. /* register GPIO_IBE (read/write) */
  95. /*----------------------------------------------------------------------------*/
  96. /*! \brief Writes the register 'GPIO_IBE'. */
  97. void GH_GPIO_set_IBE(U8 index, U32 data);
  98. /*! \brief Reads the register 'GPIO_IBE'. */
  99. U32 GH_GPIO_get_IBE(U8 index);
  100. /*----------------------------------------------------------------------------*/
  101. /* register GPIO_IEV (read/write) */
  102. /*----------------------------------------------------------------------------*/
  103. /*! \brief Writes the register 'GPIO_IEV'. */
  104. void GH_GPIO_set_IEV(U8 index, U32 data);
  105. /*! \brief Reads the register 'GPIO_IEV'. */
  106. U32 GH_GPIO_get_IEV(U8 index);
  107. /*----------------------------------------------------------------------------*/
  108. /* register GPIO_IE (read/write) */
  109. /*----------------------------------------------------------------------------*/
  110. /*! \brief Writes the register 'GPIO_IE'. */
  111. void GH_GPIO_set_IE(U8 index, U32 data);
  112. /*! \brief Reads the register 'GPIO_IE'. */
  113. U32 GH_GPIO_get_IE(U8 index);
  114. /*----------------------------------------------------------------------------*/
  115. /* register GPIO_AFSEL (read/write) */
  116. /*----------------------------------------------------------------------------*/
  117. /*! \brief Writes the register 'GPIO_AFSEL'. */
  118. void GH_GPIO_set_AFSEL(U8 index, U32 data);
  119. /*! \brief Reads the register 'GPIO_AFSEL'. */
  120. U32 GH_GPIO_get_AFSEL(U8 index);
  121. /*----------------------------------------------------------------------------*/
  122. /* register GPIO_RIS (read) */
  123. /*----------------------------------------------------------------------------*/
  124. /*! \brief Reads the register 'GPIO_RIS'. */
  125. U32 GH_GPIO_get_RIS(U8 index);
  126. /*----------------------------------------------------------------------------*/
  127. /* register GPIO_MIS (read) */
  128. /*----------------------------------------------------------------------------*/
  129. /*! \brief Reads the register 'GPIO_MIS'. */
  130. U32 GH_GPIO_get_MIS(U8 index);
  131. /*----------------------------------------------------------------------------*/
  132. /* register GPIO_IC (write) */
  133. /*----------------------------------------------------------------------------*/
  134. /*! \brief Writes the register 'GPIO_IC'. */
  135. void GH_GPIO_set_IC(U8 index, U32 data);
  136. /*! \brief Reads the mirror variable of the register 'GPIO_IC'. */
  137. U32 GH_GPIO_getm_IC(U8 index);
  138. /*----------------------------------------------------------------------------*/
  139. /* register GPIO_MASK (read/write) */
  140. /*----------------------------------------------------------------------------*/
  141. /*! \brief Writes the register 'GPIO_MASK'. */
  142. void GH_GPIO_set_MASK(U8 index, U32 data);
  143. /*! \brief Reads the register 'GPIO_MASK'. */
  144. U32 GH_GPIO_get_MASK(U8 index);
  145. /*----------------------------------------------------------------------------*/
  146. /* register GPIO_ENABLE (read/write) */
  147. /*----------------------------------------------------------------------------*/
  148. /*! \brief Writes the register 'GPIO_ENABLE'. */
  149. void GH_GPIO_set_ENABLE(U8 index, U32 data);
  150. /*! \brief Reads the register 'GPIO_ENABLE'. */
  151. U32 GH_GPIO_get_ENABLE(U8 index);
  152. /*! \brief Writes the bit group 'enb' of register 'GPIO_ENABLE'. */
  153. void GH_GPIO_set_ENABLE_enb(U8 index, U8 data);
  154. /*! \brief Reads the bit group 'enb' of register 'GPIO_ENABLE'. */
  155. U8 GH_GPIO_get_ENABLE_enb(U8 index);
  156. /*----------------------------------------------------------------------------*/
  157. /* init function */
  158. /*----------------------------------------------------------------------------*/
  159. /*! \brief Initialises the registers and mirror variables. */
  160. void GH_GPIO_init(void);
  161. #ifdef SRC_INLINE
  162. #define SRC_INC 1
  163. #include "gh_gpio_amba.c"
  164. #undef SRC_INC
  165. #endif
  166. #ifdef __cplusplus
  167. }
  168. #endif
  169. #endif /* _GH_GPIO_AMBA_H */
  170. /*----------------------------------------------------------------------------*/
  171. /* end of file */
  172. /*----------------------------------------------------------------------------*/