lzma.h 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. /* Copyright (C) 2018 RDA Technologies Limited and/or its affiliates("RDA").
  2. * All rights reserved.
  3. *
  4. * This software is supplied "AS IS" without any warranties.
  5. * RDA assumes no responsibility or liability for the use of the software,
  6. * conveys no license or title under any patent, copyright, or mask work
  7. * right to the product. RDA reserves the right to make changes in the
  8. * software without notification. RDA also make no representation or
  9. * warranty that such application will be suitable for the specified use
  10. * without further testing or modification.
  11. */
  12. #ifndef _LZMA_H_
  13. #define _LZMA_H_
  14. // Auto generated by dtools(see dtools.txt for its version).
  15. // Don't edit it manually!
  16. #define REG_LZMA_BASE (0x04800000)
  17. typedef volatile struct
  18. {
  19. uint32_t lzma_cmd_reg; // 0x00000000
  20. uint32_t lzma_status_reg; // 0x00000004
  21. uint32_t lzma_irq_mask; // 0x00000008
  22. uint32_t reserve0; // 0x0000000c
  23. uint32_t lzma_config_reg1; // 0x00000010
  24. uint32_t lzma_config_reg2; // 0x00000014
  25. uint32_t lzma_config_reg3; // 0x00000018
  26. uint32_t lzma_status_reg2; // 0x0000001c
  27. uint32_t lzma_status_reg3; // 0x00000020
  28. uint32_t lzma_error_type; // 0x00000024
  29. uint32_t reserve1; // 0x00000028
  30. uint32_t reserve2; // 0x0000002c
  31. uint32_t lzma_input_crc; // 0x00000030
  32. uint32_t lzma_output_crc; // 0x00000034
  33. uint32_t reserve3; // 0x00000038
  34. uint32_t reserve4; // 0x0000003c
  35. uint32_t lzma_dma_raddr_reg; // 0x00000040
  36. uint32_t lzma_dma_waddr_reg; // 0x00000044
  37. uint32_t lzma_inbuf_rwmargin_reg; // 0x00000048
  38. } HWP_LZMA_T;
  39. #define hwp_lzma ((HWP_LZMA_T *)REG_ACCESS_ADDRESS(REG_LZMA_BASE))
  40. // lzma_cmd_reg
  41. typedef union {
  42. uint32_t v;
  43. struct
  44. {
  45. uint32_t start : 1; // [0]
  46. uint32_t __31_1 : 31; // [31:1]
  47. } b;
  48. } REG_LZMA_LZMA_CMD_REG_T;
  49. // lzma_status_reg
  50. typedef union {
  51. uint32_t v;
  52. struct
  53. {
  54. uint32_t dec_done : 1; // [0]
  55. uint32_t dec_err : 1; // [1]
  56. uint32_t axi_err : 1; // [2]
  57. uint32_t __31_3 : 29; // [31:3]
  58. } b;
  59. } REG_LZMA_LZMA_STATUS_REG_T;
  60. // lzma_irq_mask
  61. typedef union {
  62. uint32_t v;
  63. struct
  64. {
  65. uint32_t dec_doneirqmask : 1; // [0]
  66. uint32_t dec_errirqmask : 1; // [1]
  67. uint32_t axi_errirqmask : 1; // [2]
  68. uint32_t __31_3 : 29; // [31:3]
  69. } b;
  70. } REG_LZMA_LZMA_IRQ_MASK_T;
  71. // lzma_config_reg1
  72. typedef union {
  73. uint32_t v;
  74. struct
  75. {
  76. uint32_t reg_block_size : 17; // [16:0]
  77. uint32_t reg_dict_size : 13; // [29:17]
  78. uint32_t __31_30 : 2; // [31:30]
  79. } b;
  80. } REG_LZMA_LZMA_CONFIG_REG1_T;
  81. // lzma_config_reg2
  82. typedef union {
  83. uint32_t v;
  84. struct
  85. {
  86. uint32_t reg_stream_len : 17; // [16:0]
  87. uint32_t __31_17 : 15; // [31:17]
  88. } b;
  89. } REG_LZMA_LZMA_CONFIG_REG2_T;
  90. // lzma_config_reg3
  91. typedef union {
  92. uint32_t v;
  93. struct
  94. {
  95. uint32_t reg_cabac_totalbits : 1; // [0]
  96. uint32_t reg_cabac_movebits : 1; // [1]
  97. uint32_t reg_refbyte_en : 1; // [2]
  98. uint32_t __31_3 : 29; // [31:3]
  99. } b;
  100. } REG_LZMA_LZMA_CONFIG_REG3_T;
  101. // lzma_status_reg2
  102. typedef union {
  103. uint32_t v;
  104. struct
  105. {
  106. uint32_t stream_byte_pos : 17; // [16:0], read only
  107. uint32_t __31_17 : 15; // [31:17]
  108. } b;
  109. } REG_LZMA_LZMA_STATUS_REG2_T;
  110. // lzma_status_reg3
  111. typedef union {
  112. uint32_t v;
  113. struct
  114. {
  115. uint32_t dict_byte_pos : 17; // [16:0], read only
  116. uint32_t __31_17 : 15; // [31:17]
  117. } b;
  118. } REG_LZMA_LZMA_STATUS_REG3_T;
  119. // lzma_error_type
  120. typedef union {
  121. uint32_t v;
  122. struct
  123. {
  124. uint32_t inbuf_overflow : 1; // [0], read only
  125. uint32_t symbol_type_err : 1; // [1], read only
  126. uint32_t symbol_reps_err1 : 1; // [2], read only
  127. uint32_t symbol_reps_err0 : 1; // [3], read only
  128. uint32_t symbol_len_err : 1; // [4], read only
  129. uint32_t outbuf_overflow : 1; // [5], read only
  130. uint32_t inbuf_underflow : 1; // [6], read only
  131. uint32_t __31_7 : 25; // [31:7]
  132. } b;
  133. } REG_LZMA_LZMA_ERROR_TYPE_T;
  134. // lzma_inbuf_rwmargin_reg
  135. typedef union {
  136. uint32_t v;
  137. struct
  138. {
  139. uint32_t inbuf_rwmargin_reg : 6; // [5:0]
  140. uint32_t __31_6 : 26; // [31:6]
  141. } b;
  142. } REG_LZMA_LZMA_INBUF_RWMARGIN_REG_T;
  143. // lzma_cmd_reg
  144. #define LZMA_START (1 << 0)
  145. // lzma_status_reg
  146. #define LZMA_DEC_DONE (1 << 0)
  147. #define LZMA_DEC_ERR (1 << 1)
  148. #define LZMA_AXI_ERR (1 << 2)
  149. // lzma_irq_mask
  150. #define LZMA_DEC_DONEIRQMASK (1 << 0)
  151. #define LZMA_DEC_ERRIRQMASK (1 << 1)
  152. #define LZMA_AXI_ERRIRQMASK (1 << 2)
  153. // lzma_config_reg1
  154. #define LZMA_REG_BLOCK_SIZE(n) (((n)&0x1ffff) << 0)
  155. #define LZMA_REG_DICT_SIZE(n) (((n)&0x1fff) << 17)
  156. // lzma_config_reg2
  157. #define LZMA_REG_STREAM_LEN(n) (((n)&0x1ffff) << 0)
  158. // lzma_config_reg3
  159. #define LZMA_REG_CABAC_TOTALBITS (1 << 0)
  160. #define LZMA_REG_CABAC_MOVEBITS (1 << 1)
  161. #define LZMA_REG_REFBYTE_EN (1 << 2)
  162. // lzma_status_reg2
  163. #define LZMA_STREAM_BYTE_POS(n) (((n)&0x1ffff) << 0)
  164. // lzma_status_reg3
  165. #define LZMA_DICT_BYTE_POS(n) (((n)&0x1ffff) << 0)
  166. // lzma_error_type
  167. #define LZMA_INBUF_OVERFLOW (1 << 0)
  168. #define LZMA_SYMBOL_TYPE_ERR (1 << 1)
  169. #define LZMA_SYMBOL_REPS_ERR1 (1 << 2)
  170. #define LZMA_SYMBOL_REPS_ERR0 (1 << 3)
  171. #define LZMA_SYMBOL_LEN_ERR (1 << 4)
  172. #define LZMA_OUTBUF_OVERFLOW (1 << 5)
  173. #define LZMA_INBUF_UNDERFLOW (1 << 6)
  174. // lzma_inbuf_rwmargin_reg
  175. #define LZMA_INBUF_RWMARGIN_REG(n) (((n)&0x3f) << 0)
  176. #endif // _LZMA_H_