hantrodec.h 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. /****************************************************************************
  2. *
  3. * The MIT License (MIT)
  4. *
  5. * Copyright (c) 2014 - 2021 VERISILICON
  6. *
  7. * Permission is hereby granted, free of charge, to any person obtaining a
  8. * copy of this software and associated documentation files (the "Software"),
  9. * to deal in the Software without restriction, including without limitation
  10. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  11. * and/or sell copies of the Software, and to permit persons to whom the
  12. * Software is furnished to do so, subject to the following conditions:
  13. *
  14. * The above copyright notice and this permission notice shall be included in
  15. * all copies or substantial portions of the Software.
  16. *
  17. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  18. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  19. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  20. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  21. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  22. * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  23. * DEALINGS IN THE SOFTWARE.
  24. *
  25. *****************************************************************************
  26. *
  27. * The GPL License (GPL)
  28. *
  29. * Copyright (C) 2014 - 2021 VERISILICON
  30. *
  31. * This program is free software; you can redistribute it and/or
  32. * modify it under the terms of the GNU General Public License
  33. * as published by the Free Software Foundation; either version 2
  34. * of the License, or (at your option) any later version.
  35. *
  36. * This program is distributed in the hope that it will be useful,
  37. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  38. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  39. * GNU General Public License for more details.
  40. *
  41. * You should have received a copy of the GNU General Public License
  42. * along with this program; if not, write to the Free Software Foundation,
  43. * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  44. *
  45. *****************************************************************************
  46. *
  47. * Note: This software is released under dual MIT and GPL licenses. A
  48. * recipient may use this file under the terms of either the MIT license or
  49. * GPL License. If you wish to use only one license not the other, you can
  50. * indicate your decision by deleting one of the above license notices in your
  51. * version of this file.
  52. *
  53. *****************************************************************************/
  54. #ifndef _HANTRODEC_H_
  55. #define _HANTRODEC_H_
  56. #ifdef __FREERTOS__
  57. #include "basetype.h"
  58. #include "dev_common_freertos.h"
  59. #elif defined(__linux__)
  60. #include <linux/ioctl.h>
  61. #include <linux/types.h>
  62. #include "hantrommu.h"
  63. #else //For other os
  64. //TODO...
  65. #endif
  66. #include "hantrovcmd.h"
  67. enum CoreType {
  68. /* Decoder */
  69. HW_VC8000D = 0,
  70. HW_VC8000DJ,
  71. HW_BIGOCEAN,
  72. HW_VCMD,
  73. HW_MMU, //if set HW_MMU_WR, then HW_MMU means HW_MMU_RD
  74. HW_MMU_WR,
  75. HW_DEC400,
  76. HW_L2CACHE,
  77. HW_SHAPER,
  78. /* Encoder*/
  79. /* Auxiliary IPs */
  80. HW_NOC,
  81. HW_AXIFE,
  82. HW_APBFILTER,
  83. HW_CORE_MAX /* max number of cores supported */
  84. };
  85. struct core_desc {
  86. __u32 id; /* id of the subsystem */
  87. __u32 type; /* type of core to be written */
  88. __u32 *regs; /* pointer to user registers */
  89. __u32 size; /* size of register space */
  90. __u32 reg_id; /* id of reigster to be read/written */
  91. };
  92. struct regsize_desc {
  93. __u32 slice; /* id of the slice */
  94. __u32 id; /* id of the subsystem */
  95. __u32 type; /* type of core to be written */
  96. __u32 size; /* iosize of the core */
  97. };
  98. struct core_param {
  99. __u32 slice; /* id of the slice */
  100. __u32 id; /* id of the subsystem */
  101. __u32 type; /* type of core to be written */
  102. __u32 size; /* iosize of the core */
  103. __u32 asic_id; /* asic id of the core */
  104. };
  105. struct subsys_desc {
  106. __u32 subsys_num; /* total subsystems count */
  107. __u32 subsys_vcmd_num; /* subsystems with vcmd */
  108. };
  109. struct axife_cfg {
  110. __u8 axi_rd_chn_num;
  111. __u8 axi_wr_chn_num;
  112. __u8 axi_rd_burst_length;
  113. __u8 axi_wr_burst_length;
  114. __u8 fe_mode;
  115. __u32 id;
  116. };
  117. struct apbfilter_cfg {
  118. __u32 nbr_mask_regs;
  119. __u32 mask_reg_offset;
  120. __u32 page_sel_addr;
  121. __u8 num_mode;
  122. __u8 mask_bits_per_reg;
  123. __u32 id; /* id of the subsystem */
  124. __u32 type; /* type of core to be written */
  125. __u32 has_apbfilter;
  126. };
  127. /* Use 'k' as magic number */
  128. #define HANTRODEC_IOC_MAGIC 'k'
  129. /*
  130. * S means "Set" through a ptr,
  131. * T means "Tell" directly with the argument value
  132. * G means "Get": reply by setting through a pointer
  133. * Q means "Query": response is on the return value
  134. * X means "eXchange": G and S atomically
  135. * H means "sHift": T and Q atomically
  136. */
  137. #define HANTRODEC_PP_INSTANCE _IO(HANTRODEC_IOC_MAGIC, 1)
  138. #define HANTRODEC_HW_PERFORMANCE _IO(HANTRODEC_IOC_MAGIC, 2)
  139. #define HANTRODEC_IOCGHWOFFSET _IOR(HANTRODEC_IOC_MAGIC, 3, unsigned long *)
  140. #define HANTRODEC_IOCGHWIOSIZE _IOR(HANTRODEC_IOC_MAGIC, 4, struct regsize_desc *)
  141. #define HANTRODEC_IOC_CLI _IO(HANTRODEC_IOC_MAGIC, 5)
  142. #define HANTRODEC_IOC_STI _IO(HANTRODEC_IOC_MAGIC, 6)
  143. #define HANTRODEC_IOC_MC_OFFSETS _IOR(HANTRODEC_IOC_MAGIC, 7, unsigned long *)
  144. #define HANTRODEC_IOC_MC_CORES _IOR(HANTRODEC_IOC_MAGIC, 8, unsigned int *)
  145. #define HANTRODEC_IOCS_DEC_PUSH_REG _IOW(HANTRODEC_IOC_MAGIC, 9, struct core_desc *)
  146. #define HANTRODEC_IOCS_PP_PUSH_REG _IOW(HANTRODEC_IOC_MAGIC, 10, struct core_desc *)
  147. #define HANTRODEC_IOCH_DEC_RESERVE _IO(HANTRODEC_IOC_MAGIC, 11)
  148. #define HANTRODEC_IOCT_DEC_RELEASE _IO(HANTRODEC_IOC_MAGIC, 12)
  149. #define HANTRODEC_IOCQ_PP_RESERVE _IO(HANTRODEC_IOC_MAGIC, 13)
  150. #define HANTRODEC_IOCT_PP_RELEASE _IO(HANTRODEC_IOC_MAGIC, 14)
  151. #define HANTRODEC_IOCX_DEC_WAIT _IOWR(HANTRODEC_IOC_MAGIC, 15, struct core_desc *)
  152. #define HANTRODEC_IOCX_PP_WAIT _IOWR(HANTRODEC_IOC_MAGIC, 16, struct core_desc *)
  153. #define HANTRODEC_IOCS_DEC_PULL_REG _IOWR(HANTRODEC_IOC_MAGIC, 17, struct core_desc *)
  154. #define HANTRODEC_IOCS_PP_PULL_REG _IOWR(HANTRODEC_IOC_MAGIC, 18, struct core_desc *)
  155. #define HANTRODEC_IOCG_CORE_WAIT _IOR(HANTRODEC_IOC_MAGIC, 19, int *)
  156. #define HANTRODEC_IOX_ASIC_ID _IOWR(HANTRODEC_IOC_MAGIC, 20, struct core_param *)
  157. #define HANTRODEC_IOCG_CORE_ID _IOR(HANTRODEC_IOC_MAGIC, 21, unsigned long)
  158. #define HANTRODEC_IOCS_DEC_WRITE_REG _IOW(HANTRODEC_IOC_MAGIC, 22, struct core_desc *)
  159. #define HANTRODEC_IOCS_DEC_READ_REG _IOWR(HANTRODEC_IOC_MAGIC, 23, struct core_desc *)
  160. #define HANTRODEC_IOX_ASIC_BUILD_ID _IOWR(HANTRODEC_IOC_MAGIC, 24, __u32 *)
  161. #define HANTRODEC_IOX_SUBSYS _IOWR(HANTRODEC_IOC_MAGIC, 25, struct subsys_desc *)
  162. #define HANTRODEC_IOCX_POLL _IO(HANTRODEC_IOC_MAGIC, 26)
  163. #define HANTRODEC_DEBUG_STATUS _IO(HANTRODEC_IOC_MAGIC, 29)
  164. #define HANTRODEC_IOCS_DEC_WRITE_APBFILTER_REG _IOW(HANTRODEC_IOC_MAGIC, 30, struct core_desc *)
  165. #define HANTRODEC_IOC_APBFILTER_CONFIG _IOR(HANTRODEC_IOC_MAGIC, 31, struct apbfilter_cfg *)
  166. #define HANTRODEC_IOC_AXIFE_CONFIG _IOR(HANTRODEC_IOC_MAGIC, 32, struct axife_cfg *)
  167. #define HANTRODEC_IOC_MAXNR 32
  168. #endif /* !_HANTRODEC_H_ */