esparser.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. /*
  2. * AMLOGIC Audio/Video streaming port driver.
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 2 of the named License,
  7. * or any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write to the Free Software
  16. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
  17. *
  18. * Author: Tim Yao <timyao@amlogic.com>
  19. *
  20. */
  21. #ifndef ESPARSER_H
  22. #define ESPARSER_H
  23. extern s32 esparser_init(struct stream_buf_s *buf);
  24. extern void esparser_release(struct stream_buf_s *buf);
  25. extern ssize_t esparser_write(struct file *file,
  26. struct stream_buf_s *stbuf,
  27. const char __user *buf, size_t count);
  28. extern int es_vpts_checkin(struct stream_buf_s *buf, u32 pts);
  29. extern int es_apts_checkin(struct stream_buf_s *buf, u32 pts);
  30. extern void esparser_audio_reset(struct stream_buf_s *buf);
  31. extern void esparser_sub_reset(void);
  32. #ifdef CONFIG_ARCH_MESON6
  33. // TODO: move to register headers
  34. #define ES_PACK_SIZE_BIT 8
  35. #define ES_PACK_SIZE_WID 24
  36. #define ES_CTRL_WID 8
  37. #define ES_CTRL_BIT 0
  38. #define ES_TYPE_MASK (3 << 6)
  39. #define ES_TYPE_VIDEO (0 << 6)
  40. #define ES_TYPE_AUDIO (1 << 6)
  41. #define ES_TYPE_SUBTITLE (2 << 6)
  42. #define ES_WRITE (1<<5)
  43. #define ES_PASSTHROUGH (1<<4)
  44. #define ES_INSERT_BEFORE_ES_WRITE (1<<3)
  45. #define ES_DISCARD (1<<2)
  46. #define ES_SEARCH (1<<1)
  47. #define ES_PARSER_START (1<<0)
  48. #define ES_PARSER_BUSY (1<<0)
  49. #define PARSER_INTSTAT_FETCH_CMD (1<<7)
  50. #define PARSER_INTSTAT_PARSE (1<<4)
  51. #define PARSER_INTSTAT_DISCARD (1<<3)
  52. #define PARSER_INTSTAT_INSZERO (1<<2)
  53. #define PARSER_INTSTAT_ACT_NOSSC (1<<1)
  54. #define PARSER_INTSTAT_SC_FOUND (1<<0)
  55. #define FETCH_CIR_BUF (1<<31)
  56. #define FETCH_CHK_BUF_STOP (1<<30)
  57. #define FETCH_PASSTHROUGH (1<<29)
  58. #define FETCH_ENDIAN 27
  59. #define FETCH_PASSTHROUGH_TYPE_MASK (0x3<<27)
  60. #define FETCH_ENDIAN_MASK (0x7<<27)
  61. #define FETCH_BUF_SIZE_MASK (0x7ffffff)
  62. #define FETCH_CMD_PTR_MASK 3
  63. #define FETCH_CMD_RD_PTR_BIT 5
  64. #define FETCH_CMD_WR_PTR_BIT 3
  65. #define FETCH_CMD_NUM_MASK 3
  66. #define FETCH_CMD_NUM_BIT 0
  67. #define ES_COUNT_MASK 0xfff
  68. #define ES_COUNT_BIT 20
  69. #define ES_REQ_PENDING (1<<19)
  70. #define ES_PASSTHROUGH_EN (1<<18)
  71. #define ES_PASSTHROUGH_TYPE_MASK (3<<16)
  72. #define ES_PASSTHROUGH_TYPE_VIDEO (0<<16)
  73. #define ES_PASSTHROUGH_TYPE_AUDIO (1<<16)
  74. #define ES_PASSTHROUGH_TYPE_SUBTITLE (2<<16)
  75. #define ES_WR_ENDIAN_MASK (0x7)
  76. #define ES_SUB_WR_ENDIAN_BIT 9
  77. #define ES_SUB_MAN_RD_PTR (1<<8)
  78. #define ES_AUD_WR_ENDIAN_BIT 5
  79. #define ES_AUD_MAN_RD_PTR (1<<4)
  80. #define ES_VID_WR_ENDIAN_BIT 1
  81. #define ES_VID_MAN_RD_PTR (1<<0)
  82. #define PS_CFG_FETCH_DMA_URGENT (1<<31)
  83. #define PS_CFG_STREAM_DMA_URGENT (1<<30)
  84. #define PS_CFG_FORCE_PFIFO_REN (1<<29)
  85. #define PS_CFG_PFIFO_PEAK_EN (1<<28)
  86. #define PS_CFG_SRC_SEL_BIT 24
  87. #define PS_CFG_SRC_SEL_MASK (3<<PS_CFG_SRC_SEL_BIT)
  88. #define PS_CFG_SRC_SEL_FETCH (0<<PS_CFG_SRC_SEL_BIT)
  89. #define PS_CFG_SRC_SEL_AUX1 (1<<PS_CFG_SRC_SEL_BIT) // from NDMA
  90. #define PS_CFG_SRC_SEL_AUX2 (2<<PS_CFG_SRC_SEL_BIT)
  91. #define PS_CFG_SRC_SEL_AUX3 (3<<PS_CFG_SRC_SEL_BIT)
  92. #define PS_CFG_PFIFO_EMPTY_CNT_BIT 16
  93. #define PS_CFG_PFIFO_EMPTY_CNT_MASK 0xff
  94. #define PS_CFG_MAX_ES_WR_CYCLE_BIT 12
  95. #define PS_CFG_MAX_ES_WR_CYCLE_MASK 0xf
  96. #define PS_CFG_STARTCODE_WID_MASK (0x3<<10)
  97. #define PS_CFG_STARTCODE_WID_8 (0x0<<10)
  98. #define PS_CFG_STARTCODE_WID_16 (0x1<<10)
  99. #define PS_CFG_STARTCODE_WID_24 (0x2<<10)
  100. #define PS_CFG_STARTCODE_WID_32 (0x3<<10)
  101. #define PS_CFG_PFIFO_ACCESS_WID_MASK (0x3<<8)
  102. #define PS_CFG_PFIFO_ACCESS_WID_8 (0x0<<8)
  103. #define PS_CFG_PFIFO_ACCESS_WID_16 (0x1<<8)
  104. #define PS_CFG_PFIFO_ACCESS_WID_24 (0x2<<8)
  105. #define PS_CFG_PFIFO_ACCESS_WID_32 (0x3<<8)
  106. #define PS_CFG_MAX_FETCH_CYCLE_BIT 0
  107. #define PS_CFG_MAX_FETCH_CYCLE_MASK 0xff
  108. #define PARSER_INT_DISABLE_CNT_MASK 0xffff
  109. #define PARSER_INT_DISABLE_CNT_BIT 16
  110. #define PARSER_INT_HOST_EN_MASK 0xff
  111. #define PARSER_INT_HOST_EN_BIT 8
  112. #define PARSER_INT_AMRISC_EN_MASK 0xff
  113. #define PARSER_INT_AMRISC_EN_BIT 0
  114. #define PARSER_INT_ALL 0xff
  115. #define RESET_PARSER (1<<8)
  116. #define TS_HIU_ENABLE 5
  117. #define USE_HI_BSF_INTERFACE 7
  118. #endif
  119. #endif /* ESPARSER_H */