1 /* 2 * drivers/amlogic/media/stream_input/parser/tsdemux.h 3 * 4 * Copyright (C) 2016 Amlogic, Inc. All rights reserved. 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 2 of the License, or 9 * (at your option) any later version. 10 * 11 * This program is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 14 * more details. 15 * 16 */ 17 18 #ifndef TSDEMUX_H 19 #define TSDEMUX_H 20 #include <linux/amlogic/media/utils/amports_config.h> 21 22 /* TODO: move to register headers */ 23 #define NEW_PDTS_READY 4 24 #define AUDIO_PTS_READY 2 25 #define VIDEO_PTS_READY 0 26 #define DIS_CONTINUITY_PACKET 6 27 #define SUB_PES_READY 7 28 #define PCR_READY 11 29 30 #define PARSER_INTSTAT_FETCH_CMD (1<<7) 31 32 #define FETCH_ENDIAN 27 33 #define FETCH_ENDIAN_MASK (0x7<<27) 34 35 #define RESET_DEMUXSTB (1<<1) 36 #define RESET_PARSER (1<<8) 37 38 #define VIDEO_PACKET 0 39 #define AUDIO_PACKET 1 40 #define SUB_PACKET 2 41 42 #define OTHER_ENDIAN 6 43 #define BYPASS_ENDIAN 3 44 #define SECTION_ENDIAN 0 45 46 #define USE_HI_BSF_INTERFACE 7 47 #define DES_OUT_DLY 8 48 #define TRANSPORT_SCRAMBLING_CONTROL_ODD 6 49 #define TS_HIU_ENABLE 5 50 #define FEC_FILE_CLK_DIV 0 51 #define STB_DEMUX_ENABLE 4 52 #define KEEP_DUPLICATE_PACKAGE 6 53 54 #define ES_VID_MAN_RD_PTR (1<<0) 55 #define ES_AUD_MAN_RD_PTR (1<<4) 56 57 #define PS_CFG_PFIFO_EMPTY_CNT_BIT 16 58 #define PS_CFG_MAX_ES_WR_CYCLE_BIT 12 59 #define PS_CFG_MAX_FETCH_CYCLE_BIT 0 60 61 #define ES_SUB_WR_ENDIAN_BIT 9 62 #define ES_SUB_MAN_RD_PTR (1<<8) 63 #define PARSER_INTSTAT_FETCH_CMD (1<<7) 64 65 #define PARSER_INT_HOST_EN_BIT 8 66 67 struct stream_buf_s; 68 struct vdec_s; 69 70 extern s32 tsdemux_init(u32 vid, u32 aid, u32 sid, u32 pcrid, bool is_hevc, 71 struct vdec_s *vdec); 72 73 extern void tsdemux_release(void); 74 extern ssize_t drm_tswrite(struct file *file, 75 struct stream_buf_s *vbuf, 76 struct stream_buf_s *abuf, 77 const char __user *buf, size_t count); 78 79 extern ssize_t tsdemux_write(struct file *file, 80 struct stream_buf_s *vbuf, 81 struct stream_buf_s *abuf, 82 const char __user *buf, size_t count); 83 84 extern u32 tsdemux_pcrscr_get(void); 85 extern u8 tsdemux_pcrscr_valid(void); 86 extern u8 tsdemux_pcraudio_valid(void); 87 extern u8 tsdemux_pcrvideo_valid(void); 88 extern u32 tsdemux_first_pcrscr_get(void); 89 extern void timestamp_pcrscr_enable(u32 enable); 90 extern void timestamp_pcrscr_set(u32 pts); 91 int get_discontinue_counter(void); 92 93 int tsdemux_class_register(void); 94 void tsdemux_class_unregister(void); 95 void tsdemux_change_avid(unsigned int vid, unsigned int aid); 96 void tsdemux_change_sid(unsigned int sid); 97 void tsdemux_audio_reset(void); 98 void tsdemux_sub_reset(void); 99 void tsdemux_set_skipbyte(int skipbyte); 100 void tsdemux_set_demux(int dev); 101 void tsdemux_tsync_func_init(void); 102 103 104 #endif /* TSDEMUX_H */ 105