gh_gpio.h 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849
  1. /*!
  2. *******************************************************************************
  3. **
  4. ** \file gh_gpio.h
  5. **
  6. ** \brief These GPIO pins can be configured as I/O pins for other hardware modules..
  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_GPIO_H
  18. #define _GH_GPIO_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. /* 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_GPIO_IS_LOW FIO_ADDRESS(GPIO,0xA0009000) /* read/write */
  59. #define REG_GPIO_IS_HIGH FIO_ADDRESS(GPIO,0xA0009004) /* read/write */
  60. #define REG_GPIO_IBE_LOW FIO_ADDRESS(GPIO,0xA0009008) /* read/write */
  61. #define REG_GPIO_IBE_HIGH FIO_ADDRESS(GPIO,0xA000900C) /* read/write */
  62. #define REG_GPIO_IEV_LOW FIO_ADDRESS(GPIO,0xA0009010) /* read/write */
  63. #define REG_GPIO_IEV_HIGH FIO_ADDRESS(GPIO,0xA0009014) /* read/write */
  64. #define REG_GPIO_IE_LOW FIO_ADDRESS(GPIO,0xA0009018) /* read/write */
  65. #define REG_GPIO_IE_HIGH FIO_ADDRESS(GPIO,0xA000901C) /* read/write */
  66. #define REG_GPIO_IC_LOW FIO_ADDRESS(GPIO,0xA0009020) /* write */
  67. #define REG_GPIO_IC_HIGH FIO_ADDRESS(GPIO,0xA0009024) /* write */
  68. #define REG_GPIO_RIS_LOW FIO_ADDRESS(GPIO,0xA0009028) /* read */
  69. #define REG_GPIO_RIS_HIGH FIO_ADDRESS(GPIO,0xA000902C) /* read */
  70. #define REG_GPIO_MIS_LOW FIO_ADDRESS(GPIO,0xA0009030) /* read */
  71. #define REG_GPIO_MIS_HIGH FIO_ADDRESS(GPIO,0xA0009034) /* read */
  72. #define REG_GPIO_INT_EN FIO_ADDRESS(GPIO,0xA0009038) /* write */
  73. #define REG_GPIO_PER_SEL FIO_ADDRESS(GPIO,0xA000903C) /* read/write */
  74. #define REG_GPIO_DIN_LOW FIO_ADDRESS(GPIO,0xA0009040) /* read */
  75. #define REG_GPIO_DIN_HIGH FIO_ADDRESS(GPIO,0xA0009044) /* read */
  76. #define REG_GPIO_OUTPUT_CFG FIO_ADDRESS(GPIO,0xA0009100) /* write */
  77. #define REG_GPIO_INPUT_CFG FIO_ADDRESS(GPIO,0xA0009200) /* write */
  78. /*----------------------------------------------------------------------------*/
  79. /* bit group structures */
  80. /*----------------------------------------------------------------------------*/
  81. typedef union { /* GPIO_INT_EN */
  82. U32 all;
  83. struct {
  84. U32 int_en : 1;
  85. U32 : 31;
  86. } bitc;
  87. } GH_GPIO_INT_EN_S;
  88. typedef union { /* GPIO_PER_SEL */
  89. U32 all;
  90. struct {
  91. U32 enet_sel : 1;
  92. U32 i2s_sel : 1;
  93. U32 : 30;
  94. } bitc;
  95. } GH_GPIO_PER_SEL_S;
  96. typedef union { /* GPIO_OUTPUT_CFG */
  97. U32 all;
  98. struct {
  99. U32 out_sel : 7;
  100. U32 : 1;
  101. U32 oen_sel : 6;
  102. U32 out_invert : 1;
  103. U32 oen_invert : 1;
  104. U32 : 16;
  105. } bitc;
  106. } GH_GPIO_OUTPUT_CFG_S;
  107. typedef union { /* GPIO_INPUT_CFG */
  108. U32 all;
  109. struct {
  110. U32 in_sel : 6;
  111. U32 : 26;
  112. } bitc;
  113. } GH_GPIO_INPUT_CFG_S;
  114. /*----------------------------------------------------------------------------*/
  115. /* mirror variables */
  116. /*----------------------------------------------------------------------------*/
  117. extern U32 m_gpio_ic_low;
  118. extern U32 m_gpio_ic_high;
  119. extern GH_GPIO_INT_EN_S m_gpio_int_en;
  120. extern GH_GPIO_OUTPUT_CFG_S m_gpio_output_cfg[64];
  121. extern GH_GPIO_INPUT_CFG_S m_gpio_input_cfg[64];
  122. #ifdef __cplusplus
  123. extern "C" {
  124. #endif
  125. /*----------------------------------------------------------------------------*/
  126. /* register GPIO_IS_LOW (read/write) */
  127. /*----------------------------------------------------------------------------*/
  128. #if GH_INLINE_LEVEL == 0
  129. /*! \brief Writes the register 'GPIO_IS_LOW'. */
  130. void GH_GPIO_set_IS_LOW(U32 data);
  131. /*! \brief Reads the register 'GPIO_IS_LOW'. */
  132. U32 GH_GPIO_get_IS_LOW(void);
  133. #else /* GH_INLINE_LEVEL == 0 */
  134. GH_INLINE void GH_GPIO_set_IS_LOW(U32 data)
  135. {
  136. *(volatile U32 *)REG_GPIO_IS_LOW = data;
  137. #if GH_GPIO_ENABLE_DEBUG_PRINT
  138. GH_GPIO_DEBUG_PRINT_FUNCTION( "WRREG(0x%08x,0x%08x); \\\\ [GH_GPIO_set_IS_LOW] <-- 0x%08x\n",
  139. REG_GPIO_IS_LOW,data,data);
  140. #endif
  141. }
  142. GH_INLINE U32 GH_GPIO_get_IS_LOW(void)
  143. {
  144. U32 value = (*(volatile U32 *)REG_GPIO_IS_LOW);
  145. #if GH_GPIO_ENABLE_DEBUG_PRINT
  146. GH_GPIO_DEBUG_PRINT_FUNCTION( "value = RDREG(0x%08x); \\\\ [GH_GPIO_get_IS_LOW] --> 0x%08x\n",
  147. REG_GPIO_IS_LOW,value);
  148. #endif
  149. return value;
  150. }
  151. #endif /* GH_INLINE_LEVEL == 0 */
  152. /*----------------------------------------------------------------------------*/
  153. /* register GPIO_IS_HIGH (read/write) */
  154. /*----------------------------------------------------------------------------*/
  155. #if GH_INLINE_LEVEL == 0
  156. /*! \brief Writes the register 'GPIO_IS_HIGH'. */
  157. void GH_GPIO_set_IS_HIGH(U32 data);
  158. /*! \brief Reads the register 'GPIO_IS_HIGH'. */
  159. U32 GH_GPIO_get_IS_HIGH(void);
  160. #else /* GH_INLINE_LEVEL == 0 */
  161. GH_INLINE void GH_GPIO_set_IS_HIGH(U32 data)
  162. {
  163. *(volatile U32 *)REG_GPIO_IS_HIGH = data;
  164. #if GH_GPIO_ENABLE_DEBUG_PRINT
  165. GH_GPIO_DEBUG_PRINT_FUNCTION( "WRREG(0x%08x,0x%08x); \\\\ [GH_GPIO_set_IS_HIGH] <-- 0x%08x\n",
  166. REG_GPIO_IS_HIGH,data,data);
  167. #endif
  168. }
  169. GH_INLINE U32 GH_GPIO_get_IS_HIGH(void)
  170. {
  171. U32 value = (*(volatile U32 *)REG_GPIO_IS_HIGH);
  172. #if GH_GPIO_ENABLE_DEBUG_PRINT
  173. GH_GPIO_DEBUG_PRINT_FUNCTION( "value = RDREG(0x%08x); \\\\ [GH_GPIO_get_IS_HIGH] --> 0x%08x\n",
  174. REG_GPIO_IS_HIGH,value);
  175. #endif
  176. return value;
  177. }
  178. #endif /* GH_INLINE_LEVEL == 0 */
  179. /*----------------------------------------------------------------------------*/
  180. /* register GPIO_IBE_LOW (read/write) */
  181. /*----------------------------------------------------------------------------*/
  182. #if GH_INLINE_LEVEL == 0
  183. /*! \brief Writes the register 'GPIO_IBE_LOW'. */
  184. void GH_GPIO_set_IBE_LOW(U32 data);
  185. /*! \brief Reads the register 'GPIO_IBE_LOW'. */
  186. U32 GH_GPIO_get_IBE_LOW(void);
  187. #else /* GH_INLINE_LEVEL == 0 */
  188. GH_INLINE void GH_GPIO_set_IBE_LOW(U32 data)
  189. {
  190. *(volatile U32 *)REG_GPIO_IBE_LOW = data;
  191. #if GH_GPIO_ENABLE_DEBUG_PRINT
  192. GH_GPIO_DEBUG_PRINT_FUNCTION( "WRREG(0x%08x,0x%08x); \\\\ [GH_GPIO_set_IBE_LOW] <-- 0x%08x\n",
  193. REG_GPIO_IBE_LOW,data,data);
  194. #endif
  195. }
  196. GH_INLINE U32 GH_GPIO_get_IBE_LOW(void)
  197. {
  198. U32 value = (*(volatile U32 *)REG_GPIO_IBE_LOW);
  199. #if GH_GPIO_ENABLE_DEBUG_PRINT
  200. GH_GPIO_DEBUG_PRINT_FUNCTION( "value = RDREG(0x%08x); \\\\ [GH_GPIO_get_IBE_LOW] --> 0x%08x\n",
  201. REG_GPIO_IBE_LOW,value);
  202. #endif
  203. return value;
  204. }
  205. #endif /* GH_INLINE_LEVEL == 0 */
  206. /*----------------------------------------------------------------------------*/
  207. /* register GPIO_IBE_HIGH (read/write) */
  208. /*----------------------------------------------------------------------------*/
  209. #if GH_INLINE_LEVEL == 0
  210. /*! \brief Writes the register 'GPIO_IBE_HIGH'. */
  211. void GH_GPIO_set_IBE_HIGH(U32 data);
  212. /*! \brief Reads the register 'GPIO_IBE_HIGH'. */
  213. U32 GH_GPIO_get_IBE_HIGH(void);
  214. #else /* GH_INLINE_LEVEL == 0 */
  215. GH_INLINE void GH_GPIO_set_IBE_HIGH(U32 data)
  216. {
  217. *(volatile U32 *)REG_GPIO_IBE_HIGH = data;
  218. #if GH_GPIO_ENABLE_DEBUG_PRINT
  219. GH_GPIO_DEBUG_PRINT_FUNCTION( "WRREG(0x%08x,0x%08x); \\\\ [GH_GPIO_set_IBE_HIGH] <-- 0x%08x\n",
  220. REG_GPIO_IBE_HIGH,data,data);
  221. #endif
  222. }
  223. GH_INLINE U32 GH_GPIO_get_IBE_HIGH(void)
  224. {
  225. U32 value = (*(volatile U32 *)REG_GPIO_IBE_HIGH);
  226. #if GH_GPIO_ENABLE_DEBUG_PRINT
  227. GH_GPIO_DEBUG_PRINT_FUNCTION( "value = RDREG(0x%08x); \\\\ [GH_GPIO_get_IBE_HIGH] --> 0x%08x\n",
  228. REG_GPIO_IBE_HIGH,value);
  229. #endif
  230. return value;
  231. }
  232. #endif /* GH_INLINE_LEVEL == 0 */
  233. /*----------------------------------------------------------------------------*/
  234. /* register GPIO_IEV_LOW (read/write) */
  235. /*----------------------------------------------------------------------------*/
  236. #if GH_INLINE_LEVEL == 0
  237. /*! \brief Writes the register 'GPIO_IEV_LOW'. */
  238. void GH_GPIO_set_IEV_LOW(U32 data);
  239. /*! \brief Reads the register 'GPIO_IEV_LOW'. */
  240. U32 GH_GPIO_get_IEV_LOW(void);
  241. #else /* GH_INLINE_LEVEL == 0 */
  242. GH_INLINE void GH_GPIO_set_IEV_LOW(U32 data)
  243. {
  244. *(volatile U32 *)REG_GPIO_IEV_LOW = data;
  245. #if GH_GPIO_ENABLE_DEBUG_PRINT
  246. GH_GPIO_DEBUG_PRINT_FUNCTION( "WRREG(0x%08x,0x%08x); \\\\ [GH_GPIO_set_IEV_LOW] <-- 0x%08x\n",
  247. REG_GPIO_IEV_LOW,data,data);
  248. #endif
  249. }
  250. GH_INLINE U32 GH_GPIO_get_IEV_LOW(void)
  251. {
  252. U32 value = (*(volatile U32 *)REG_GPIO_IEV_LOW);
  253. #if GH_GPIO_ENABLE_DEBUG_PRINT
  254. GH_GPIO_DEBUG_PRINT_FUNCTION( "value = RDREG(0x%08x); \\\\ [GH_GPIO_get_IEV_LOW] --> 0x%08x\n",
  255. REG_GPIO_IEV_LOW,value);
  256. #endif
  257. return value;
  258. }
  259. #endif /* GH_INLINE_LEVEL == 0 */
  260. /*----------------------------------------------------------------------------*/
  261. /* register GPIO_IEV_HIGH (read/write) */
  262. /*----------------------------------------------------------------------------*/
  263. #if GH_INLINE_LEVEL == 0
  264. /*! \brief Writes the register 'GPIO_IEV_HIGH'. */
  265. void GH_GPIO_set_IEV_HIGH(U32 data);
  266. /*! \brief Reads the register 'GPIO_IEV_HIGH'. */
  267. U32 GH_GPIO_get_IEV_HIGH(void);
  268. #else /* GH_INLINE_LEVEL == 0 */
  269. GH_INLINE void GH_GPIO_set_IEV_HIGH(U32 data)
  270. {
  271. *(volatile U32 *)REG_GPIO_IEV_HIGH = data;
  272. #if GH_GPIO_ENABLE_DEBUG_PRINT
  273. GH_GPIO_DEBUG_PRINT_FUNCTION( "WRREG(0x%08x,0x%08x); \\\\ [GH_GPIO_set_IEV_HIGH] <-- 0x%08x\n",
  274. REG_GPIO_IEV_HIGH,data,data);
  275. #endif
  276. }
  277. GH_INLINE U32 GH_GPIO_get_IEV_HIGH(void)
  278. {
  279. U32 value = (*(volatile U32 *)REG_GPIO_IEV_HIGH);
  280. #if GH_GPIO_ENABLE_DEBUG_PRINT
  281. GH_GPIO_DEBUG_PRINT_FUNCTION( "value = RDREG(0x%08x); \\\\ [GH_GPIO_get_IEV_HIGH] --> 0x%08x\n",
  282. REG_GPIO_IEV_HIGH,value);
  283. #endif
  284. return value;
  285. }
  286. #endif /* GH_INLINE_LEVEL == 0 */
  287. /*----------------------------------------------------------------------------*/
  288. /* register GPIO_IE_LOW (read/write) */
  289. /*----------------------------------------------------------------------------*/
  290. #if GH_INLINE_LEVEL == 0
  291. /*! \brief Writes the register 'GPIO_IE_LOW'. */
  292. void GH_GPIO_set_IE_LOW(U32 data);
  293. /*! \brief Reads the register 'GPIO_IE_LOW'. */
  294. U32 GH_GPIO_get_IE_LOW(void);
  295. #else /* GH_INLINE_LEVEL == 0 */
  296. GH_INLINE void GH_GPIO_set_IE_LOW(U32 data)
  297. {
  298. *(volatile U32 *)REG_GPIO_IE_LOW = data;
  299. #if GH_GPIO_ENABLE_DEBUG_PRINT
  300. GH_GPIO_DEBUG_PRINT_FUNCTION( "WRREG(0x%08x,0x%08x); \\\\ [GH_GPIO_set_IE_LOW] <-- 0x%08x\n",
  301. REG_GPIO_IE_LOW,data,data);
  302. #endif
  303. }
  304. GH_INLINE U32 GH_GPIO_get_IE_LOW(void)
  305. {
  306. U32 value = (*(volatile U32 *)REG_GPIO_IE_LOW);
  307. #if GH_GPIO_ENABLE_DEBUG_PRINT
  308. GH_GPIO_DEBUG_PRINT_FUNCTION( "value = RDREG(0x%08x); \\\\ [GH_GPIO_get_IE_LOW] --> 0x%08x\n",
  309. REG_GPIO_IE_LOW,value);
  310. #endif
  311. return value;
  312. }
  313. #endif /* GH_INLINE_LEVEL == 0 */
  314. /*----------------------------------------------------------------------------*/
  315. /* register GPIO_IE_HIGH (read/write) */
  316. /*----------------------------------------------------------------------------*/
  317. #if GH_INLINE_LEVEL == 0
  318. /*! \brief Writes the register 'GPIO_IE_HIGH'. */
  319. void GH_GPIO_set_IE_HIGH(U32 data);
  320. /*! \brief Reads the register 'GPIO_IE_HIGH'. */
  321. U32 GH_GPIO_get_IE_HIGH(void);
  322. #else /* GH_INLINE_LEVEL == 0 */
  323. GH_INLINE void GH_GPIO_set_IE_HIGH(U32 data)
  324. {
  325. *(volatile U32 *)REG_GPIO_IE_HIGH = data;
  326. #if GH_GPIO_ENABLE_DEBUG_PRINT
  327. GH_GPIO_DEBUG_PRINT_FUNCTION( "WRREG(0x%08x,0x%08x); \\\\ [GH_GPIO_set_IE_HIGH] <-- 0x%08x\n",
  328. REG_GPIO_IE_HIGH,data,data);
  329. #endif
  330. }
  331. GH_INLINE U32 GH_GPIO_get_IE_HIGH(void)
  332. {
  333. U32 value = (*(volatile U32 *)REG_GPIO_IE_HIGH);
  334. #if GH_GPIO_ENABLE_DEBUG_PRINT
  335. GH_GPIO_DEBUG_PRINT_FUNCTION( "value = RDREG(0x%08x); \\\\ [GH_GPIO_get_IE_HIGH] --> 0x%08x\n",
  336. REG_GPIO_IE_HIGH,value);
  337. #endif
  338. return value;
  339. }
  340. #endif /* GH_INLINE_LEVEL == 0 */
  341. /*----------------------------------------------------------------------------*/
  342. /* register GPIO_IC_LOW (write) */
  343. /*----------------------------------------------------------------------------*/
  344. #if GH_INLINE_LEVEL < 2
  345. /*! \brief Writes the register 'GPIO_IC_LOW'. */
  346. void GH_GPIO_set_IC_LOW(U32 data);
  347. /*! \brief Reads the mirror variable of the register 'GPIO_IC_LOW'. */
  348. U32 GH_GPIO_getm_IC_LOW(void);
  349. #else /* GH_INLINE_LEVEL < 2 */
  350. GH_INLINE void GH_GPIO_set_IC_LOW(U32 data)
  351. {
  352. m_gpio_ic_low = data;
  353. *(volatile U32 *)REG_GPIO_IC_LOW = data;
  354. #if GH_GPIO_ENABLE_DEBUG_PRINT
  355. GH_GPIO_DEBUG_PRINT_FUNCTION( "WRREG(0x%08x,0x%08x); \\\\ [GH_GPIO_set_IC_LOW] <-- 0x%08x\n",
  356. REG_GPIO_IC_LOW,data,data);
  357. #endif
  358. }
  359. GH_INLINE U32 GH_GPIO_getm_IC_LOW(void)
  360. {
  361. #if GH_GPIO_ENABLE_DEBUG_PRINT
  362. GH_GPIO_DEBUG_PRINT_FUNCTION( "[GH_GPIO_getm_IC_LOW] --> 0x%08x\n",
  363. m_gpio_ic_low);
  364. #endif
  365. return m_gpio_ic_low;
  366. }
  367. #endif /* GH_INLINE_LEVEL < 2 */
  368. /*----------------------------------------------------------------------------*/
  369. /* register GPIO_IC_HIGH (write) */
  370. /*----------------------------------------------------------------------------*/
  371. #if GH_INLINE_LEVEL < 2
  372. /*! \brief Writes the register 'GPIO_IC_HIGH'. */
  373. void GH_GPIO_set_IC_HIGH(U32 data);
  374. /*! \brief Reads the mirror variable of the register 'GPIO_IC_HIGH'. */
  375. U32 GH_GPIO_getm_IC_HIGH(void);
  376. #else /* GH_INLINE_LEVEL < 2 */
  377. GH_INLINE void GH_GPIO_set_IC_HIGH(U32 data)
  378. {
  379. m_gpio_ic_high = data;
  380. *(volatile U32 *)REG_GPIO_IC_HIGH = data;
  381. #if GH_GPIO_ENABLE_DEBUG_PRINT
  382. GH_GPIO_DEBUG_PRINT_FUNCTION( "WRREG(0x%08x,0x%08x); \\\\ [GH_GPIO_set_IC_HIGH] <-- 0x%08x\n",
  383. REG_GPIO_IC_HIGH,data,data);
  384. #endif
  385. }
  386. GH_INLINE U32 GH_GPIO_getm_IC_HIGH(void)
  387. {
  388. #if GH_GPIO_ENABLE_DEBUG_PRINT
  389. GH_GPIO_DEBUG_PRINT_FUNCTION( "[GH_GPIO_getm_IC_HIGH] --> 0x%08x\n",
  390. m_gpio_ic_high);
  391. #endif
  392. return m_gpio_ic_high;
  393. }
  394. #endif /* GH_INLINE_LEVEL < 2 */
  395. /*----------------------------------------------------------------------------*/
  396. /* register GPIO_RIS_LOW (read) */
  397. /*----------------------------------------------------------------------------*/
  398. #if GH_INLINE_LEVEL == 0
  399. /*! \brief Reads the register 'GPIO_RIS_LOW'. */
  400. U32 GH_GPIO_get_RIS_LOW(void);
  401. #else /* GH_INLINE_LEVEL == 0 */
  402. GH_INLINE U32 GH_GPIO_get_RIS_LOW(void)
  403. {
  404. U32 value = (*(volatile U32 *)REG_GPIO_RIS_LOW);
  405. #if GH_GPIO_ENABLE_DEBUG_PRINT
  406. GH_GPIO_DEBUG_PRINT_FUNCTION( "value = RDREG(0x%08x); \\\\ [GH_GPIO_get_RIS_LOW] --> 0x%08x\n",
  407. REG_GPIO_RIS_LOW,value);
  408. #endif
  409. return value;
  410. }
  411. #endif /* GH_INLINE_LEVEL == 0 */
  412. /*----------------------------------------------------------------------------*/
  413. /* register GPIO_RIS_HIGH (read) */
  414. /*----------------------------------------------------------------------------*/
  415. #if GH_INLINE_LEVEL == 0
  416. /*! \brief Reads the register 'GPIO_RIS_HIGH'. */
  417. U32 GH_GPIO_get_RIS_HIGH(void);
  418. #else /* GH_INLINE_LEVEL == 0 */
  419. GH_INLINE U32 GH_GPIO_get_RIS_HIGH(void)
  420. {
  421. U32 value = (*(volatile U32 *)REG_GPIO_RIS_HIGH);
  422. #if GH_GPIO_ENABLE_DEBUG_PRINT
  423. GH_GPIO_DEBUG_PRINT_FUNCTION( "value = RDREG(0x%08x); \\\\ [GH_GPIO_get_RIS_HIGH] --> 0x%08x\n",
  424. REG_GPIO_RIS_HIGH,value);
  425. #endif
  426. return value;
  427. }
  428. #endif /* GH_INLINE_LEVEL == 0 */
  429. /*----------------------------------------------------------------------------*/
  430. /* register GPIO_MIS_LOW (read) */
  431. /*----------------------------------------------------------------------------*/
  432. #if GH_INLINE_LEVEL == 0
  433. /*! \brief Reads the register 'GPIO_MIS_LOW'. */
  434. U32 GH_GPIO_get_MIS_LOW(void);
  435. #else /* GH_INLINE_LEVEL == 0 */
  436. GH_INLINE U32 GH_GPIO_get_MIS_LOW(void)
  437. {
  438. U32 value = (*(volatile U32 *)REG_GPIO_MIS_LOW);
  439. #if GH_GPIO_ENABLE_DEBUG_PRINT
  440. GH_GPIO_DEBUG_PRINT_FUNCTION( "value = RDREG(0x%08x); \\\\ [GH_GPIO_get_MIS_LOW] --> 0x%08x\n",
  441. REG_GPIO_MIS_LOW,value);
  442. #endif
  443. return value;
  444. }
  445. #endif /* GH_INLINE_LEVEL == 0 */
  446. /*----------------------------------------------------------------------------*/
  447. /* register GPIO_MIS_HIGH (read) */
  448. /*----------------------------------------------------------------------------*/
  449. #if GH_INLINE_LEVEL == 0
  450. /*! \brief Reads the register 'GPIO_MIS_HIGH'. */
  451. U32 GH_GPIO_get_MIS_HIGH(void);
  452. #else /* GH_INLINE_LEVEL == 0 */
  453. GH_INLINE U32 GH_GPIO_get_MIS_HIGH(void)
  454. {
  455. U32 value = (*(volatile U32 *)REG_GPIO_MIS_HIGH);
  456. #if GH_GPIO_ENABLE_DEBUG_PRINT
  457. GH_GPIO_DEBUG_PRINT_FUNCTION( "value = RDREG(0x%08x); \\\\ [GH_GPIO_get_MIS_HIGH] --> 0x%08x\n",
  458. REG_GPIO_MIS_HIGH,value);
  459. #endif
  460. return value;
  461. }
  462. #endif /* GH_INLINE_LEVEL == 0 */
  463. /*----------------------------------------------------------------------------*/
  464. /* register GPIO_INT_EN (write) */
  465. /*----------------------------------------------------------------------------*/
  466. #if GH_INLINE_LEVEL < 2
  467. /*! \brief Writes the register 'GPIO_INT_EN'. */
  468. void GH_GPIO_set_INT_EN(U32 data);
  469. /*! \brief Reads the mirror variable of the register 'GPIO_INT_EN'. */
  470. U32 GH_GPIO_getm_INT_EN(void);
  471. /*! \brief Writes the bit group 'int_en' of register 'GPIO_INT_EN'. */
  472. void GH_GPIO_set_INT_EN_int_en(U8 data);
  473. /*! \brief Reads the bit group 'int_en' from the mirror variable of register 'GPIO_INT_EN'. */
  474. U8 GH_GPIO_getm_INT_EN_int_en(void);
  475. #else /* GH_INLINE_LEVEL < 2 */
  476. GH_INLINE void GH_GPIO_set_INT_EN(U32 data)
  477. {
  478. m_gpio_int_en.all = data;
  479. *(volatile U32 *)REG_GPIO_INT_EN = data;
  480. #if GH_GPIO_ENABLE_DEBUG_PRINT
  481. GH_GPIO_DEBUG_PRINT_FUNCTION( "WRREG(0x%08x,0x%08x); \\\\ [GH_GPIO_set_INT_EN] <-- 0x%08x\n",
  482. REG_GPIO_INT_EN,data,data);
  483. #endif
  484. }
  485. GH_INLINE U32 GH_GPIO_getm_INT_EN(void)
  486. {
  487. #if GH_GPIO_ENABLE_DEBUG_PRINT
  488. GH_GPIO_DEBUG_PRINT_FUNCTION( "[GH_GPIO_getm_INT_EN] --> 0x%08x\n",
  489. m_gpio_int_en.all);
  490. #endif
  491. return m_gpio_int_en.all;
  492. }
  493. GH_INLINE void GH_GPIO_set_INT_EN_int_en(U8 data)
  494. {
  495. m_gpio_int_en.bitc.int_en = data;
  496. *(volatile U32 *)REG_GPIO_INT_EN = m_gpio_int_en.all;
  497. #if GH_GPIO_ENABLE_DEBUG_PRINT
  498. GH_GPIO_DEBUG_PRINT_FUNCTION( "WRREG(0x%08x,0x%08x); \\\\ [GH_GPIO_set_INT_EN_int_en] <-- 0x%08x\n",
  499. REG_GPIO_INT_EN,m_gpio_int_en.all,m_gpio_int_en.all);
  500. #endif
  501. }
  502. GH_INLINE U8 GH_GPIO_getm_INT_EN_int_en(void)
  503. {
  504. #if GH_GPIO_ENABLE_DEBUG_PRINT
  505. GH_GPIO_DEBUG_PRINT_FUNCTION( "[GH_GPIO_getm_INT_EN_int_en] --> 0x%08x\n",
  506. m_gpio_int_en.bitc.int_en);
  507. #endif
  508. return m_gpio_int_en.bitc.int_en;
  509. }
  510. #endif /* GH_INLINE_LEVEL < 2 */
  511. /*----------------------------------------------------------------------------*/
  512. /* register GPIO_PER_SEL (read/write) */
  513. /*----------------------------------------------------------------------------*/
  514. #if GH_INLINE_LEVEL == 0
  515. /*! \brief Writes the register 'GPIO_PER_SEL'. */
  516. void GH_GPIO_set_PER_SEL(U32 data);
  517. /*! \brief Reads the register 'GPIO_PER_SEL'. */
  518. U32 GH_GPIO_get_PER_SEL(void);
  519. /*! \brief Writes the bit group 'enet_sel' of register 'GPIO_PER_SEL'. */
  520. void GH_GPIO_set_PER_SEL_enet_sel(U8 data);
  521. /*! \brief Reads the bit group 'enet_sel' of register 'GPIO_PER_SEL'. */
  522. U8 GH_GPIO_get_PER_SEL_enet_sel(void);
  523. /*! \brief Writes the bit group 'i2s_sel' of register 'GPIO_PER_SEL'. */
  524. void GH_GPIO_set_PER_SEL_i2s_sel(U8 data);
  525. /*! \brief Reads the bit group 'i2s_sel' of register 'GPIO_PER_SEL'. */
  526. U8 GH_GPIO_get_PER_SEL_i2s_sel(void);
  527. #else /* GH_INLINE_LEVEL == 0 */
  528. GH_INLINE void GH_GPIO_set_PER_SEL(U32 data)
  529. {
  530. *(volatile U32 *)REG_GPIO_PER_SEL = data;
  531. #if GH_GPIO_ENABLE_DEBUG_PRINT
  532. GH_GPIO_DEBUG_PRINT_FUNCTION( "WRREG(0x%08x,0x%08x); \\\\ [GH_GPIO_set_PER_SEL] <-- 0x%08x\n",
  533. REG_GPIO_PER_SEL,data,data);
  534. #endif
  535. }
  536. GH_INLINE U32 GH_GPIO_get_PER_SEL(void)
  537. {
  538. U32 value = (*(volatile U32 *)REG_GPIO_PER_SEL);
  539. #if GH_GPIO_ENABLE_DEBUG_PRINT
  540. GH_GPIO_DEBUG_PRINT_FUNCTION( "value = RDREG(0x%08x); \\\\ [GH_GPIO_get_PER_SEL] --> 0x%08x\n",
  541. REG_GPIO_PER_SEL,value);
  542. #endif
  543. return value;
  544. }
  545. GH_INLINE void GH_GPIO_set_PER_SEL_enet_sel(U8 data)
  546. {
  547. GH_GPIO_PER_SEL_S d;
  548. d.all = *(volatile U32 *)REG_GPIO_PER_SEL;
  549. d.bitc.enet_sel = data;
  550. *(volatile U32 *)REG_GPIO_PER_SEL = d.all;
  551. #if GH_GPIO_ENABLE_DEBUG_PRINT
  552. GH_GPIO_DEBUG_PRINT_FUNCTION( "WRREG(0x%08x,0x%08x); \\\\ [GH_GPIO_set_PER_SEL_enet_sel] <-- 0x%08x\n",
  553. REG_GPIO_PER_SEL,d.all,d.all);
  554. #endif
  555. }
  556. GH_INLINE U8 GH_GPIO_get_PER_SEL_enet_sel(void)
  557. {
  558. GH_GPIO_PER_SEL_S tmp_value;
  559. U32 value = (*(volatile U32 *)REG_GPIO_PER_SEL);
  560. tmp_value.all = value;
  561. #if GH_GPIO_ENABLE_DEBUG_PRINT
  562. GH_GPIO_DEBUG_PRINT_FUNCTION( "value = RDREG(0x%08x); \\\\ [GH_GPIO_get_PER_SEL_enet_sel] --> 0x%08x\n",
  563. REG_GPIO_PER_SEL,value);
  564. #endif
  565. return tmp_value.bitc.enet_sel;
  566. }
  567. GH_INLINE void GH_GPIO_set_PER_SEL_i2s_sel(U8 data)
  568. {
  569. GH_GPIO_PER_SEL_S d;
  570. d.all = *(volatile U32 *)REG_GPIO_PER_SEL;
  571. d.bitc.i2s_sel = data;
  572. *(volatile U32 *)REG_GPIO_PER_SEL = d.all;
  573. #if GH_GPIO_ENABLE_DEBUG_PRINT
  574. GH_GPIO_DEBUG_PRINT_FUNCTION( "WRREG(0x%08x,0x%08x); \\\\ [GH_GPIO_set_PER_SEL_i2s_sel] <-- 0x%08x\n",
  575. REG_GPIO_PER_SEL,d.all,d.all);
  576. #endif
  577. }
  578. GH_INLINE U8 GH_GPIO_get_PER_SEL_i2s_sel(void)
  579. {
  580. GH_GPIO_PER_SEL_S tmp_value;
  581. U32 value = (*(volatile U32 *)REG_GPIO_PER_SEL);
  582. tmp_value.all = value;
  583. #if GH_GPIO_ENABLE_DEBUG_PRINT
  584. GH_GPIO_DEBUG_PRINT_FUNCTION( "value = RDREG(0x%08x); \\\\ [GH_GPIO_get_PER_SEL_i2s_sel] --> 0x%08x\n",
  585. REG_GPIO_PER_SEL,value);
  586. #endif
  587. return tmp_value.bitc.i2s_sel;
  588. }
  589. #endif /* GH_INLINE_LEVEL == 0 */
  590. /*----------------------------------------------------------------------------*/
  591. /* register GPIO_DIN_LOW (read) */
  592. /*----------------------------------------------------------------------------*/
  593. #if GH_INLINE_LEVEL == 0
  594. /*! \brief Reads the register 'GPIO_DIN_LOW'. */
  595. U32 GH_GPIO_get_DIN_LOW(void);
  596. #else /* GH_INLINE_LEVEL == 0 */
  597. GH_INLINE U32 GH_GPIO_get_DIN_LOW(void)
  598. {
  599. U32 value = (*(volatile U32 *)REG_GPIO_DIN_LOW);
  600. #if GH_GPIO_ENABLE_DEBUG_PRINT
  601. GH_GPIO_DEBUG_PRINT_FUNCTION( "value = RDREG(0x%08x); \\\\ [GH_GPIO_get_DIN_LOW] --> 0x%08x\n",
  602. REG_GPIO_DIN_LOW,value);
  603. #endif
  604. return value;
  605. }
  606. #endif /* GH_INLINE_LEVEL == 0 */
  607. /*----------------------------------------------------------------------------*/
  608. /* register GPIO_DIN_HIGH (read) */
  609. /*----------------------------------------------------------------------------*/
  610. #if GH_INLINE_LEVEL == 0
  611. /*! \brief Reads the register 'GPIO_DIN_HIGH'. */
  612. U32 GH_GPIO_get_DIN_HIGH(void);
  613. #else /* GH_INLINE_LEVEL == 0 */
  614. GH_INLINE U32 GH_GPIO_get_DIN_HIGH(void)
  615. {
  616. U32 value = (*(volatile U32 *)REG_GPIO_DIN_HIGH);
  617. #if GH_GPIO_ENABLE_DEBUG_PRINT
  618. GH_GPIO_DEBUG_PRINT_FUNCTION( "value = RDREG(0x%08x); \\\\ [GH_GPIO_get_DIN_HIGH] --> 0x%08x\n",
  619. REG_GPIO_DIN_HIGH,value);
  620. #endif
  621. return value;
  622. }
  623. #endif /* GH_INLINE_LEVEL == 0 */
  624. /*----------------------------------------------------------------------------*/
  625. /* register GPIO_OUTPUT_CFG (write) */
  626. /*----------------------------------------------------------------------------*/
  627. #if GH_INLINE_LEVEL < 2
  628. /*! \brief Writes the register 'GPIO_OUTPUT_CFG'. */
  629. void GH_GPIO_set_OUTPUT_CFG(U8 index, U32 data);
  630. /*! \brief Reads the mirror variable of the register 'GPIO_OUTPUT_CFG'. */
  631. U32 GH_GPIO_getm_OUTPUT_CFG(U8 index);
  632. /*! \brief Writes the bit group 'out_sel' of register 'GPIO_OUTPUT_CFG'. */
  633. void GH_GPIO_set_OUTPUT_CFG_out_sel(U8 index, U8 data);
  634. /*! \brief Reads the bit group 'out_sel' from the mirror variable of register 'GPIO_OUTPUT_CFG'. */
  635. U8 GH_GPIO_getm_OUTPUT_CFG_out_sel(U8 index);
  636. /*! \brief Writes the bit group 'oen_sel' of register 'GPIO_OUTPUT_CFG'. */
  637. void GH_GPIO_set_OUTPUT_CFG_oen_sel(U8 index, U8 data);
  638. /*! \brief Reads the bit group 'oen_sel' from the mirror variable of register 'GPIO_OUTPUT_CFG'. */
  639. U8 GH_GPIO_getm_OUTPUT_CFG_oen_sel(U8 index);
  640. /*! \brief Writes the bit group 'out_invert' of register 'GPIO_OUTPUT_CFG'. */
  641. void GH_GPIO_set_OUTPUT_CFG_out_invert(U8 index, U8 data);
  642. /*! \brief Reads the bit group 'out_invert' from the mirror variable of register 'GPIO_OUTPUT_CFG'. */
  643. U8 GH_GPIO_getm_OUTPUT_CFG_out_invert(U8 index);
  644. /*! \brief Writes the bit group 'oen_invert' of register 'GPIO_OUTPUT_CFG'. */
  645. void GH_GPIO_set_OUTPUT_CFG_oen_invert(U8 index, U8 data);
  646. /*! \brief Reads the bit group 'oen_invert' from the mirror variable of register 'GPIO_OUTPUT_CFG'. */
  647. U8 GH_GPIO_getm_OUTPUT_CFG_oen_invert(U8 index);
  648. #else /* GH_INLINE_LEVEL < 2 */
  649. GH_INLINE void GH_GPIO_set_OUTPUT_CFG(U8 index, U32 data)
  650. {
  651. m_gpio_output_cfg[index].all = data;
  652. *(volatile U32 *)(REG_GPIO_OUTPUT_CFG + index * FIO_MOFFSET(GPIO,0x4)) = data;
  653. #if GH_GPIO_ENABLE_DEBUG_PRINT
  654. GH_GPIO_DEBUG_PRINT_FUNCTION( "WRREG(0x%08x,0x%08x); \\\\ [GH_GPIO_set_OUTPUT_CFG] <-- 0x%08x\n",
  655. (REG_GPIO_OUTPUT_CFG + index * FIO_MOFFSET(GPIO,0x4)),data,data);
  656. #endif
  657. }
  658. GH_INLINE U32 GH_GPIO_getm_OUTPUT_CFG(U8 index)
  659. {
  660. #if GH_GPIO_ENABLE_DEBUG_PRINT
  661. GH_GPIO_DEBUG_PRINT_FUNCTION( "[GH_GPIO_getm_OUTPUT_CFG] --> 0x%08x\n",
  662. m_gpio_output_cfg[index].all);
  663. #endif
  664. return m_gpio_output_cfg[index].all;
  665. }
  666. GH_INLINE void GH_GPIO_set_OUTPUT_CFG_out_sel(U8 index, U8 data)
  667. {
  668. m_gpio_output_cfg[index].bitc.out_sel = data;
  669. *(volatile U32 *)(REG_GPIO_OUTPUT_CFG + index * FIO_MOFFSET(GPIO,0x4)) = m_gpio_output_cfg[index].all;
  670. #if GH_GPIO_ENABLE_DEBUG_PRINT
  671. GH_GPIO_DEBUG_PRINT_FUNCTION( "WRREG(0x%08x,0x%08x); \\\\ [GH_GPIO_set_OUTPUT_CFG_out_sel] <-- 0x%08x\n",
  672. (REG_GPIO_OUTPUT_CFG + index * FIO_MOFFSET(GPIO,0x4)),m_gpio_output_cfg[index].all,m_gpio_output_cfg[index].all);
  673. #endif
  674. }
  675. GH_INLINE U8 GH_GPIO_getm_OUTPUT_CFG_out_sel(U8 index)
  676. {
  677. #if GH_GPIO_ENABLE_DEBUG_PRINT
  678. GH_GPIO_DEBUG_PRINT_FUNCTION( "[GH_GPIO_getm_OUTPUT_CFG_out_sel] --> 0x%08x\n",
  679. m_gpio_output_cfg[index].bitc.out_sel);
  680. #endif
  681. return m_gpio_output_cfg[index].bitc.out_sel;
  682. }
  683. GH_INLINE void GH_GPIO_set_OUTPUT_CFG_oen_sel(U8 index, U8 data)
  684. {
  685. m_gpio_output_cfg[index].bitc.oen_sel = data;
  686. *(volatile U32 *)(REG_GPIO_OUTPUT_CFG + index * FIO_MOFFSET(GPIO,0x4)) = m_gpio_output_cfg[index].all;
  687. #if GH_GPIO_ENABLE_DEBUG_PRINT
  688. GH_GPIO_DEBUG_PRINT_FUNCTION( "WRREG(0x%08x,0x%08x); \\\\ [GH_GPIO_set_OUTPUT_CFG_oen_sel] <-- 0x%08x\n",
  689. (REG_GPIO_OUTPUT_CFG + index * FIO_MOFFSET(GPIO,0x4)),m_gpio_output_cfg[index].all,m_gpio_output_cfg[index].all);
  690. #endif
  691. }
  692. GH_INLINE U8 GH_GPIO_getm_OUTPUT_CFG_oen_sel(U8 index)
  693. {
  694. #if GH_GPIO_ENABLE_DEBUG_PRINT
  695. GH_GPIO_DEBUG_PRINT_FUNCTION( "[GH_GPIO_getm_OUTPUT_CFG_oen_sel] --> 0x%08x\n",
  696. m_gpio_output_cfg[index].bitc.oen_sel);
  697. #endif
  698. return m_gpio_output_cfg[index].bitc.oen_sel;
  699. }
  700. GH_INLINE void GH_GPIO_set_OUTPUT_CFG_out_invert(U8 index, U8 data)
  701. {
  702. m_gpio_output_cfg[index].bitc.out_invert = data;
  703. *(volatile U32 *)(REG_GPIO_OUTPUT_CFG + index * FIO_MOFFSET(GPIO,0x4)) = m_gpio_output_cfg[index].all;
  704. #if GH_GPIO_ENABLE_DEBUG_PRINT
  705. GH_GPIO_DEBUG_PRINT_FUNCTION( "WRREG(0x%08x,0x%08x); \\\\ [GH_GPIO_set_OUTPUT_CFG_out_invert] <-- 0x%08x\n",
  706. (REG_GPIO_OUTPUT_CFG + index * FIO_MOFFSET(GPIO,0x4)),m_gpio_output_cfg[index].all,m_gpio_output_cfg[index].all);
  707. #endif
  708. }
  709. GH_INLINE U8 GH_GPIO_getm_OUTPUT_CFG_out_invert(U8 index)
  710. {
  711. #if GH_GPIO_ENABLE_DEBUG_PRINT
  712. GH_GPIO_DEBUG_PRINT_FUNCTION( "[GH_GPIO_getm_OUTPUT_CFG_out_invert] --> 0x%08x\n",
  713. m_gpio_output_cfg[index].bitc.out_invert);
  714. #endif
  715. return m_gpio_output_cfg[index].bitc.out_invert;
  716. }
  717. GH_INLINE void GH_GPIO_set_OUTPUT_CFG_oen_invert(U8 index, U8 data)
  718. {
  719. m_gpio_output_cfg[index].bitc.oen_invert = data;
  720. *(volatile U32 *)(REG_GPIO_OUTPUT_CFG + index * FIO_MOFFSET(GPIO,0x4)) = m_gpio_output_cfg[index].all;
  721. #if GH_GPIO_ENABLE_DEBUG_PRINT
  722. GH_GPIO_DEBUG_PRINT_FUNCTION( "WRREG(0x%08x,0x%08x); \\\\ [GH_GPIO_set_OUTPUT_CFG_oen_invert] <-- 0x%08x\n",
  723. (REG_GPIO_OUTPUT_CFG + index * FIO_MOFFSET(GPIO,0x4)),m_gpio_output_cfg[index].all,m_gpio_output_cfg[index].all);
  724. #endif
  725. }
  726. GH_INLINE U8 GH_GPIO_getm_OUTPUT_CFG_oen_invert(U8 index)
  727. {
  728. #if GH_GPIO_ENABLE_DEBUG_PRINT
  729. GH_GPIO_DEBUG_PRINT_FUNCTION( "[GH_GPIO_getm_OUTPUT_CFG_oen_invert] --> 0x%08x\n",
  730. m_gpio_output_cfg[index].bitc.oen_invert);
  731. #endif
  732. return m_gpio_output_cfg[index].bitc.oen_invert;
  733. }
  734. #endif /* GH_INLINE_LEVEL < 2 */
  735. /*----------------------------------------------------------------------------*/
  736. /* register GPIO_INPUT_CFG (write) */
  737. /*----------------------------------------------------------------------------*/
  738. #if GH_INLINE_LEVEL < 2
  739. /*! \brief Writes the register 'GPIO_INPUT_CFG'. */
  740. void GH_GPIO_set_INPUT_CFG(U8 index, U32 data);
  741. /*! \brief Reads the mirror variable of the register 'GPIO_INPUT_CFG'. */
  742. U32 GH_GPIO_getm_INPUT_CFG(U8 index);
  743. /*! \brief Writes the bit group 'in_sel' of register 'GPIO_INPUT_CFG'. */
  744. void GH_GPIO_set_INPUT_CFG_in_sel(U8 index, U8 data);
  745. /*! \brief Reads the bit group 'in_sel' from the mirror variable of register 'GPIO_INPUT_CFG'. */
  746. U8 GH_GPIO_getm_INPUT_CFG_in_sel(U8 index);
  747. #else /* GH_INLINE_LEVEL < 2 */
  748. GH_INLINE void GH_GPIO_set_INPUT_CFG(U8 index, U32 data)
  749. {
  750. m_gpio_input_cfg[index].all = data;
  751. *(volatile U32 *)(REG_GPIO_INPUT_CFG + index * FIO_MOFFSET(GPIO,0x4)) = data;
  752. #if GH_GPIO_ENABLE_DEBUG_PRINT
  753. GH_GPIO_DEBUG_PRINT_FUNCTION( "WRREG(0x%08x,0x%08x); \\\\ [GH_GPIO_set_INPUT_CFG] <-- 0x%08x\n",
  754. (REG_GPIO_INPUT_CFG + index * FIO_MOFFSET(GPIO,0x4)),data,data);
  755. #endif
  756. }
  757. GH_INLINE U32 GH_GPIO_getm_INPUT_CFG(U8 index)
  758. {
  759. #if GH_GPIO_ENABLE_DEBUG_PRINT
  760. GH_GPIO_DEBUG_PRINT_FUNCTION( "[GH_GPIO_getm_INPUT_CFG] --> 0x%08x\n",
  761. m_gpio_input_cfg[index].all);
  762. #endif
  763. return m_gpio_input_cfg[index].all;
  764. }
  765. GH_INLINE void GH_GPIO_set_INPUT_CFG_in_sel(U8 index, U8 data)
  766. {
  767. m_gpio_input_cfg[index].bitc.in_sel = data;
  768. *(volatile U32 *)(REG_GPIO_INPUT_CFG + index * FIO_MOFFSET(GPIO,0x4)) = m_gpio_input_cfg[index].all;
  769. #if GH_GPIO_ENABLE_DEBUG_PRINT
  770. GH_GPIO_DEBUG_PRINT_FUNCTION( "WRREG(0x%08x,0x%08x); \\\\ [GH_GPIO_set_INPUT_CFG_in_sel] <-- 0x%08x\n",
  771. (REG_GPIO_INPUT_CFG + index * FIO_MOFFSET(GPIO,0x4)),m_gpio_input_cfg[index].all,m_gpio_input_cfg[index].all);
  772. #endif
  773. }
  774. GH_INLINE U8 GH_GPIO_getm_INPUT_CFG_in_sel(U8 index)
  775. {
  776. #if GH_GPIO_ENABLE_DEBUG_PRINT
  777. GH_GPIO_DEBUG_PRINT_FUNCTION( "[GH_GPIO_getm_INPUT_CFG_in_sel] --> 0x%08x\n",
  778. m_gpio_input_cfg[index].bitc.in_sel);
  779. #endif
  780. return m_gpio_input_cfg[index].bitc.in_sel;
  781. }
  782. #endif /* GH_INLINE_LEVEL < 2 */
  783. /*----------------------------------------------------------------------------*/
  784. /* init function */
  785. /*----------------------------------------------------------------------------*/
  786. /*! \brief Initialises the registers and mirror variables. */
  787. void GH_GPIO_init(void);
  788. #ifdef __cplusplus
  789. }
  790. #endif
  791. #endif /* _GH_GPIO_H */
  792. /*----------------------------------------------------------------------------*/
  793. /* end of file */
  794. /*----------------------------------------------------------------------------*/