gh_efuse.h 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. /*!
  2. *******************************************************************************
  3. **
  4. ** \file gh_efuse.h
  5. **
  6. ** \brief EFUSE controller.
  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_EFUSE_H
  18. #define _GH_EFUSE_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_EFUSE_ENABLE_DEBUG_PRINT 0
  30. #ifdef __LINUX__
  31. #define GH_EFUSE_DEBUG_PRINT_FUNCTION printk
  32. #else
  33. #define GH_EFUSE_DEBUG_PRINT_FUNCTION printf
  34. #endif
  35. #ifndef __LINUX__
  36. #if GH_EFUSE_ENABLE_DEBUG_PRINT
  37. #include <stdio.h>
  38. #endif
  39. #endif
  40. /*----------------------------------------------------------------------------*/
  41. /* registers */
  42. /*----------------------------------------------------------------------------*/
  43. #define REG_EFUSE_KEY FIO_ADDRESS(EFUSE,0x9000B000) /* read */
  44. #define REG_EFUSE_DATA FIO_ADDRESS(EFUSE,0x9000B010) /* read */
  45. #define REG_EFUSE_USER_DATA FIO_ADDRESS(EFUSE,0x9000B014) /* read */
  46. #define REG_EFUSE_CTRL FIO_ADDRESS(EFUSE,0x9000B100) /* read/write */
  47. #define REG_EFUSE_BOOT FIO_ADDRESS(EFUSE,0x9000B104) /* read/write */
  48. /*----------------------------------------------------------------------------*/
  49. /* bit group structures */
  50. /*----------------------------------------------------------------------------*/
  51. typedef union { /* EFUSE_Data */
  52. U32 all;
  53. struct {
  54. U32 boot_mode_sel : 1;
  55. U32 engine_sel : 1;
  56. U32 user_data : 30;
  57. } bitc;
  58. } GH_EFUSE_DATA_S;
  59. typedef union { /* EFUSE_CTRL */
  60. U32 all;
  61. struct {
  62. U32 wr_progen_high_cnt : 9;
  63. U32 wr_progen_low_cnt : 6;
  64. U32 wr_addr_setup_cnt : 4;
  65. U32 rd_addr_setup_cnt : 3;
  66. U32 rd_prchg_setup_cnt : 2;
  67. U32 rd_prchg_hold_cnt : 2;
  68. U32 rd_sense_hold_cnt : 3;
  69. U32 wait_rd_addr_update_cnt : 3;
  70. } bitc;
  71. } GH_EFUSE_CTRL_S;
  72. typedef union { /* EFUSE_BOOT */
  73. U32 all;
  74. struct {
  75. U32 en : 1;
  76. U32 rd_ok : 1;
  77. U32 : 30;
  78. } bitc;
  79. } GH_EFUSE_BOOT_S;
  80. /*----------------------------------------------------------------------------*/
  81. /* mirror variables */
  82. /*----------------------------------------------------------------------------*/
  83. #ifdef __cplusplus
  84. extern "C" {
  85. #endif
  86. /*----------------------------------------------------------------------------*/
  87. /* register EFUSE_KEY (read) */
  88. /*----------------------------------------------------------------------------*/
  89. /*! \brief Reads the register 'EFUSE_KEY'. */
  90. U32 GH_EFUSE_get_KEY(U8 index);
  91. /*----------------------------------------------------------------------------*/
  92. /* register EFUSE_Data (read) */
  93. /*----------------------------------------------------------------------------*/
  94. /*! \brief Reads the register 'EFUSE_Data'. */
  95. U32 GH_EFUSE_get_Data(U8 index);
  96. /*! \brief Reads the bit group 'boot_mode_sel' of register 'EFUSE_Data'. */
  97. U8 GH_EFUSE_get_Data_boot_mode_sel(U8 index);
  98. /*! \brief Reads the bit group 'engine_sel' of register 'EFUSE_Data'. */
  99. U8 GH_EFUSE_get_Data_engine_sel(U8 index);
  100. /*! \brief Reads the bit group 'User_Data' of register 'EFUSE_Data'. */
  101. U32 GH_EFUSE_get_Data_User_Data(U8 index);
  102. /*----------------------------------------------------------------------------*/
  103. /* register EFUSE_User_Data (read) */
  104. /*----------------------------------------------------------------------------*/
  105. /*! \brief Reads the register 'EFUSE_User_Data'. */
  106. U32 GH_EFUSE_get_User_Data(U8 index);
  107. /*----------------------------------------------------------------------------*/
  108. /* register EFUSE_CTRL (read/write) */
  109. /*----------------------------------------------------------------------------*/
  110. /*! \brief Writes the register 'EFUSE_CTRL'. */
  111. void GH_EFUSE_set_CTRL(U32 data);
  112. /*! \brief Reads the register 'EFUSE_CTRL'. */
  113. U32 GH_EFUSE_get_CTRL(void);
  114. /*! \brief Writes the bit group 'wr_progen_high_cnt' of register 'EFUSE_CTRL'. */
  115. void GH_EFUSE_set_CTRL_wr_progen_high_cnt(U16 data);
  116. /*! \brief Reads the bit group 'wr_progen_high_cnt' of register 'EFUSE_CTRL'. */
  117. U16 GH_EFUSE_get_CTRL_wr_progen_high_cnt(void);
  118. /*! \brief Writes the bit group 'wr_progen_low_cnt' of register 'EFUSE_CTRL'. */
  119. void GH_EFUSE_set_CTRL_wr_progen_low_cnt(U8 data);
  120. /*! \brief Reads the bit group 'wr_progen_low_cnt' of register 'EFUSE_CTRL'. */
  121. U8 GH_EFUSE_get_CTRL_wr_progen_low_cnt(void);
  122. /*! \brief Writes the bit group 'wr_addr_setup_cnt' of register 'EFUSE_CTRL'. */
  123. void GH_EFUSE_set_CTRL_wr_addr_setup_cnt(U8 data);
  124. /*! \brief Reads the bit group 'wr_addr_setup_cnt' of register 'EFUSE_CTRL'. */
  125. U8 GH_EFUSE_get_CTRL_wr_addr_setup_cnt(void);
  126. /*! \brief Writes the bit group 'rd_addr_setup_cnt' of register 'EFUSE_CTRL'. */
  127. void GH_EFUSE_set_CTRL_rd_addr_setup_cnt(U8 data);
  128. /*! \brief Reads the bit group 'rd_addr_setup_cnt' of register 'EFUSE_CTRL'. */
  129. U8 GH_EFUSE_get_CTRL_rd_addr_setup_cnt(void);
  130. /*! \brief Writes the bit group 'rd_prchg_setup_cnt' of register 'EFUSE_CTRL'. */
  131. void GH_EFUSE_set_CTRL_rd_prchg_setup_cnt(U8 data);
  132. /*! \brief Reads the bit group 'rd_prchg_setup_cnt' of register 'EFUSE_CTRL'. */
  133. U8 GH_EFUSE_get_CTRL_rd_prchg_setup_cnt(void);
  134. /*! \brief Writes the bit group 'rd_prchg_hold_cnt' of register 'EFUSE_CTRL'. */
  135. void GH_EFUSE_set_CTRL_rd_prchg_hold_cnt(U8 data);
  136. /*! \brief Reads the bit group 'rd_prchg_hold_cnt' of register 'EFUSE_CTRL'. */
  137. U8 GH_EFUSE_get_CTRL_rd_prchg_hold_cnt(void);
  138. /*! \brief Writes the bit group 'rd_sense_hold_cnt' of register 'EFUSE_CTRL'. */
  139. void GH_EFUSE_set_CTRL_rd_sense_hold_cnt(U8 data);
  140. /*! \brief Reads the bit group 'rd_sense_hold_cnt' of register 'EFUSE_CTRL'. */
  141. U8 GH_EFUSE_get_CTRL_rd_sense_hold_cnt(void);
  142. /*! \brief Writes the bit group 'Wait_rd_addr_update_cnt' of register 'EFUSE_CTRL'. */
  143. void GH_EFUSE_set_CTRL_Wait_rd_addr_update_cnt(U8 data);
  144. /*! \brief Reads the bit group 'Wait_rd_addr_update_cnt' of register 'EFUSE_CTRL'. */
  145. U8 GH_EFUSE_get_CTRL_Wait_rd_addr_update_cnt(void);
  146. /*----------------------------------------------------------------------------*/
  147. /* register EFUSE_BOOT (read/write) */
  148. /*----------------------------------------------------------------------------*/
  149. /*! \brief Writes the register 'EFUSE_BOOT'. */
  150. void GH_EFUSE_set_BOOT(U32 data);
  151. /*! \brief Reads the register 'EFUSE_BOOT'. */
  152. U32 GH_EFUSE_get_BOOT(void);
  153. /*! \brief Writes the bit group 'EN' of register 'EFUSE_BOOT'. */
  154. void GH_EFUSE_set_BOOT_EN(U8 data);
  155. /*! \brief Reads the bit group 'EN' of register 'EFUSE_BOOT'. */
  156. U8 GH_EFUSE_get_BOOT_EN(void);
  157. /*! \brief Writes the bit group 'RD_OK' of register 'EFUSE_BOOT'. */
  158. void GH_EFUSE_set_BOOT_RD_OK(U8 data);
  159. /*! \brief Reads the bit group 'RD_OK' of register 'EFUSE_BOOT'. */
  160. U8 GH_EFUSE_get_BOOT_RD_OK(void);
  161. /*----------------------------------------------------------------------------*/
  162. /* init function */
  163. /*----------------------------------------------------------------------------*/
  164. /*! \brief Initialises the registers and mirror variables. */
  165. void GH_EFUSE_init(void);
  166. #ifdef SRC_INLINE
  167. #define SRC_INC 1
  168. #include "gh_efuse.c"
  169. #undef SRC_INC
  170. #endif
  171. #ifdef __cplusplus
  172. }
  173. #endif
  174. #endif /* _GH_EFUSE_H */
  175. /*----------------------------------------------------------------------------*/
  176. /* end of file */
  177. /*----------------------------------------------------------------------------*/