drv_audio_cmdq.h 24 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013
  1. #ifndef _DRV_AUDIO_CMDQ_H
  2. #define _DRV_AUDIO_CMDQ_H
  3. #include "drv_types.h"
  4. //#define SISCMDQ_INFO_ADDR (0xba00d800)
  5. #define AUDIOCMDQ_INFO_ADDR 0xa0000200 //size : 32x64 = 2048 , cmdq buffer 0xa0000200 ~ 0xa0000a00
  6. #define AUDIOCMDQ_NUMBER (63)
  7. #define AUDIOCMDQ_STATUS_ADDR (AUDIOCMDQ_INFO_ADDR + 0x04)
  8. #define AUDIOCMDQ_RP_ADDR (AUDIOCMDQ_INFO_ADDR + 0x8)
  9. #define AUDIOCMDQ_WP_ADDR (AUDIOCMDQ_INFO_ADDR + 0xc)
  10. /* TODO: For decode only path only, SHOULE BE MODIFIED. */
  11. //#define AUDIO_ROM_LAST_DEC_ADDR_REG (AUDIOCMDQ_INFO_ADDR + 0x10)
  12. #define AUDIOCMDQ_BYPASS_ADDR (AUDIOCMDQ_INFO_ADDR + 0x14)
  13. ///////////////////////////////////////////////////////////////////////////////////////////////
  14. //
  15. // CMDQ VARIABLE DEFINITION
  16. //
  17. ///////////////////////////////////////////////////////////////////////////////////////////////
  18. //#define AUDIO_CURR_CPU2_USED_BUFFNO_ADDR (0x9a018100)
  19. #define AUDIO_CID 0x03
  20. #define AUDIO_FLAG_DECODING 0x01
  21. #define AUDIO_FLAG_BYPASS 0x02
  22. #define AUDIO_FLAG_PCM_OUT 0x03
  23. #define AUDIO_FLAG_REPACKAGE 0x04
  24. #define AUDIO_FLAG_INFO 0x05
  25. #define AUDIO_FLAG_MEDIA_PCM_OUT 0x06
  26. #define AUDIO_FLAG_SET_PTS_OFFSET 0x10
  27. #define AUDIO_FLAG_FREE_RUN_STOP_ENABLE 0x20
  28. #define AUDIO_FLAG_MUTE_ENABLE 0x30
  29. #define AUDIO_FLAG_MUTE_DISABLE 0x40
  30. #define AUDIO_FLAG_RESET_ALL 0x50
  31. #define AUDIO_FLAG_RESET_BYPASS 0x51 //hauchuen@20100630 add for bypass cmdq cmd when reset audio eng
  32. #define AUDIO_FLAG_RESET_AUDIOROM_ONLY 0x52 //HC add , only reset audiorom status.
  33. #define AUDIO_FLAG_TSXT_SETTING 0x60 // joujean add for SRS 20080221
  34. #define AUDIO_FLAG_TRUEVOL_SETTING 0x61 //20090410 Kai for SRS TrueVolume
  35. #define AUDIO_FLAG_TSHD_SETTING 0x62
  36. #define AUDIO_FLAG_DBXAUDIO_SETTING 0x63
  37. #define AUDIO_FLAG_TITOI_SETTING 0x64
  38. //#define AUDIO_FLAG_SIS_AUDIOEFFECT 0x66 // joujean add for Audio Effect 20080618
  39. #define AUDIO_FLAG_AUDIOEFFECT_SETTING 0x67
  40. #define AUDIO_FLAG_MAXIMUS_SURROUND 0x68 //20170113 BJT add for maximus surround
  41. #define AUDIO_FLAG_EQ_SETTING 0x70 // joujean add for EQ 20080221
  42. #define AUDIO_FLAG_PEQ_SETTING 0x71 // hauchuen@20100205
  43. #define AUDIO_FLAG_SHELVING_SETTING 0x72 // john@20130423
  44. #define AUDIO_FLAG_CUT_OFF 0x73
  45. #define AUDIO_FLAG_FADE_CTL 0x74 //AUDIO FADE IN OUT CONTROL
  46. #define AUDIO_FLAG_HPLP_SETTING 0x75 //AUDIO HIGH/LOW PASS FILTER
  47. #define AUDIO_FLAG_AGC_SETTING 0x80 // joujean add for AGC 20080320
  48. #define AUDIO_FLAG_DOLBY_DIGITAL_SETTINGS 0x90
  49. #define AUDIO_FLAG_WMA_SETTINGS 0x91 //Kai 20091223
  50. #define AUDIO_FLAG_ENCODING 0xa0 //steve add for encoding only path 20110423
  51. #define AUDIO_FLAG_DSP 0xb0
  52. #define AUDIO_FLAG_TXDESP 0xb1
  53. #define AUDIO_FLAG_CHECKTOKEN 0xc0
  54. #define AUDIO_FLAG_CANCEL 0xff
  55. #define AUDIO_DATA_TYPE_PCM 0x00
  56. #define AUDIO_DATA_TYPE_MPEG 0x01
  57. #define AUDIO_DATA_TYPE_AC3 0x02
  58. #define AUDIO_DATA_TYPE_DTS 0x03
  59. #define AUDIO_DATA_TYPE_AAC 0x04
  60. #define AUDIO_DATA_TYPE_MP3 0x05
  61. #define AUDIO_DATA_TYPE_REAL 0x06
  62. #define AUDIO_DATA_TYPE_EAC3 0x07
  63. #define AUDIO_DATA_TYPE_WMA 0x08 //Kai 20091223
  64. #define AUDIO_DATA_TYPE_COOK 0x09
  65. #define AUDIO_DATA_TYPE_AMRNB 0x0a
  66. #define AUDIO_DATA_TYPE_AMRWB 0x0b
  67. #define AUDIO_DATA_TYPE_VORBIS 0x0c
  68. #define AUDIO_DATA_TYPE_SILK 0x0d
  69. #define AUDIO_DATA_TYPE_ISAC 0x0e
  70. #define AUDIO_DATA_TYPE_DRA 0x0f
  71. #define AUDIO_DATA_TYPE_FLAC 0x10
  72. #define AUDIO_DATA_TYPE_UNKNOW 0xff
  73. #define AUDIO_RX_TYPE_TS 0x00
  74. #define AUDIO_RX_TYPE_HDMI 0x01
  75. #define AUDIO_RX_TYPE_RF 0x02
  76. #define AUDIO_RX_TYPE_LINE 0x03
  77. #define AUDIO_RX_TYPE_USB 0x04
  78. #define AUDIO_RX_TYPE_MP AUDIO_RX_TYPE_USB
  79. #define AUDIO_RX_TYPE_ALSA 0x05 // Super@20101026
  80. #define AUDIO_TX_TYPE_NO_OUTPUT 0x00
  81. #define AUDIO_TX_TYPE_ONLY_I2S 0x01
  82. #define AUDIO_TX_TYPE_ONLY_SPDIF 0x02
  83. #define AUDIO_TX_TYPE_I2S_AND_SPDIF_NONLINEAR 0x03
  84. #define AUDIO_TX_TYPE_I2S_AND_SPDIF_LINEAR 0x04
  85. #define AUDIO_TX_TYPE_I2S_AND_SPDIF AUDIO_TX_TYPE_I2S_AND_SPDIF_NONLINEAR// reserved for backward compatible
  86. #define AUDIO_TX_TYPE_AD 0x05
  87. #define BYPASS_MESSAGE 0xBABEBED
  88. /*
  89. * RETURN VALUE OF CMDQ
  90. * DEFAULT STORE IN 0xBA00D804
  91. */
  92. typedef enum
  93. {
  94. /*
  95. * NEGATIVE VALUE MEANS THE CODEC FATAL ERROR.
  96. */
  97. E_CMDQ_ERROR_BEGINNING = -32768,
  98. E_CMDQ_ERROR_GENERAL_ERROR,
  99. E_CMDQ_CODEC_INIT_ERROR,
  100. E_CMDQ_CODEC_READ_HEADER_ERROR,
  101. E_CMDQ_CODEC_PROCESS_ERROR,
  102. /* NORMAL RETUN */
  103. E_CMDQ_OK = 0,
  104. /*
  105. * 0 ~ 32767: RESERVED FOR CODEC ERROR RETURN
  106. * MUST TO CHECK EACH CODEC ERROR DEFINITION
  107. */
  108. /*
  109. * 32768 ~ MAX: FLOW CONTROL
  110. */
  111. E_CMDQ_FLOW_CONTROL_INDEX = 32768,
  112. E_CMDQ_DOLBY_DDP_NO_DATA = 32768,
  113. E_CMDQ_DOLBY_DDP_NO_MATCH_STREAM_ID_TYPE,
  114. E_CMDQ_DOLBY_DDP_NO_ENOUGH_PCM_DATA,
  115. E_CMDQ_CODEC_INIT_AND_SKIP_1ST_FRAME,
  116. E_CMDQ_CODEC_HDMI_SKIP_1ST_FRAME,
  117. }E_CMDQ_STATUS;
  118. /*~RETURN VALUE OF CMDQ*/
  119. enum
  120. {
  121. SFREQ_24000,
  122. SFREQ_48000,
  123. SFREQ_96000,
  124. SFREQ_192000,
  125. SFREQ_22050,
  126. SFREQ_44100,
  127. SFREQ_88200,
  128. SFREQ_176400,
  129. SFREQ_32000,
  130. SFREQ_8000,
  131. SFREQ_11025,
  132. SFREQ_12000,
  133. SFREQ_16000,
  134. };
  135. enum
  136. {
  137. SAMPLENUM_1024,
  138. SAMPLENUM_2048,
  139. };
  140. enum
  141. {
  142. CH_CNT_2,
  143. CH_CNT_6,
  144. CH_CNT_8,
  145. CH_CNT_RSV,
  146. };
  147. enum
  148. {
  149. I2S_2ch,
  150. I2S0_BYPASS,
  151. I2S1_BYPASS,
  152. I2S_Multi_ch, //I2S Muti output, non bypass feature
  153. };
  154. enum
  155. {
  156. No_CanalPlus,
  157. CanalPlus_from_SD3, //FullScart from SD3
  158. CanalPlus_from_SD2, //FullScart from SD2 (swap SD2 and SD3)
  159. };
  160. // Dolby Digital dual-mono modes
  161. enum _dualmonomode
  162. { MIPS_SAI_DDCD_DM_MODE_ST, // stereo
  163. MIPS_SAI_DDCD_DM_MODE_LM, // left mono
  164. MIPS_SAI_DDCD_DM_MODE_RM, // right mono
  165. MIPS_SAI_DDCD_DM_MODE_MM, // mixed mono
  166. MIPS_SAI_DDCD_NUM_DM_MODES
  167. };
  168. enum{
  169. SUCCESS = 0,
  170. EEMPTY,
  171. EFULL,
  172. EFAIL
  173. };
  174. enum{
  175. CID_RS232 = 1,
  176. CID_Controller,
  177. CID_AUDIO,
  178. CID_DEMUX,
  179. CID_VIDEO,
  180. CID_DMA,
  181. CID_I2C,
  182. CID_GPIO,
  183. CID_EXDEV,
  184. CID_VBI,
  185. CID_TELTEXT,
  186. CID_TIMER
  187. };
  188. typedef struct __AUDIOCMDQ_DATA
  189. {
  190. UINT8 data[32];
  191. }AUDIOCMDQ_DATA;
  192. #define AUDIOCMDQ_DATA_LENGTH (sizeof(AUDIOCMDQ_DATA))
  193. ///////////////////////////////////////////////////////////////////////////////////////////////
  194. //
  195. // CMDQ DATA STRUCTURE DEFINITION
  196. //
  197. ///////////////////////////////////////////////////////////////////////////////////////////////
  198. #pragma pack(push,1)
  199. typedef volatile struct __AUDIOCMDQ_INFO
  200. {
  201. /* DW 00 */
  202. UINT32 cmdq_base;
  203. /* DW 01 */
  204. UINT32 codec_status;
  205. #define CODECST_OK (0)
  206. #define CODECST_FIAL (1)
  207. #define CODECST_NODATA (2)
  208. #define CODECST_PROCESSING (3)
  209. /* DW 02 */
  210. UINT32 rp;
  211. /* DW 03 */
  212. UINT32 wp;
  213. /* DW 04 */
  214. union{
  215. UINT32 reserved04;
  216. UINT32 CMDQ_CUR_DATAPTR; //update current handle audio data pointer(decode and pcm path )
  217. };
  218. /* DW 05 */
  219. union{
  220. UINT32 reserved05;
  221. struct{
  222. UINT32 CMDQ_BYPASS_FLAG:8;
  223. UINT32 audiorom_debug_log:1;
  224. UINT32 audiorom_debug_write:1;
  225. UINT32 reserved02_00:22;
  226. };
  227. };
  228. /* DW 06 */
  229. union{
  230. UINT32 reserved06;
  231. struct
  232. {
  233. UINT32 sfreq : 4; // 0~12: 24/48/96/192/22.05/44.1/88.2/176.4/32 K/8k/11.025k/12k/16k
  234. UINT32 samplenum : 2; //0:1024 1:2048 2~reserved
  235. UINT32 reserved7_b6 : 1;
  236. UINT32 vaild_status : 1; //0: status didn't update yet, 1:status is valid for driver reference.
  237. UINT32 reserved7_b8_b31 : 24;
  238. };
  239. };
  240. /* DW 07 */
  241. UINT32 audiocmdq2_baseaddr;
  242. /* The following cmdqs */
  243. AUDIOCMDQ_DATA cmdq[0];
  244. }AUDIOCMDQ_INFO,*AUDIOCMDQ_INFO_PTR;
  245. typedef volatile struct __AUDIOCMDQ2_INFO
  246. {
  247. /* DW 00 */
  248. UINT32 reserved_dw00;
  249. /* DW 01 */
  250. UINT32 num;
  251. /* DW 02 */
  252. UINT32 rp;
  253. /* DW 03 */
  254. UINT32 wp;
  255. /* DW 04 */
  256. UINT32 reserved_dw04;
  257. /* DW 05 */
  258. UINT32 reserved_dw05;
  259. /* DW 06 */
  260. UINT32 reserved_dw06;
  261. /* DW 07 */
  262. UINT32 reserved_dw07;
  263. /* The following cmdqs */
  264. AUDIOCMDQ_DATA cmdq[0];
  265. }AUDIOCMDQ2_INFO,*AUDIOCMDQ2_INFO_PTR;
  266. typedef struct _AUDIO_CMDQ
  267. {
  268. // 1st UINT32
  269. UINT8 CID;
  270. UINT8 flag;
  271. struct
  272. {
  273. UINT8 pause : 1;
  274. UINT8 discontinue : 1;
  275. UINT8 sfreq : 4; // 0~12: 24/48/96/192/22.05/44.1/88.2/176.4/32 K/8k/11.025k/12k/16k
  276. UINT8 chcnt : 2; //0/1/2/rsv: sp,2ch/5.1ch/7.1ch/rsv
  277. };
  278. UINT8 FrameNo;
  279. // 2nd UINT32
  280. UINT8 inDataType; // 0->PCM 1->mpeg 2->AC3
  281. UINT8 outDataType; // 0->PCM 1->mpeg 2->AC3
  282. struct
  283. {
  284. UINT8 RxType : 4; // 0->TS 1->HDMI
  285. //ac3 library configuration
  286. UINT8 stereomode : 2; // stereo downmix mode. 0: auto. 1: Lt/Rt. 2: Lo/Ro.
  287. UINT8 outputselect : 2; // output select mode. 0: output L,R. 1: output Ls,Rs. 2: output C,Lfe.
  288. };
  289. struct
  290. {
  291. UINT8 TxType : 4; // 1->I2S 2->SPIF 3->Both
  292. UINT8 compmode : 2; // compression mode. 0: custom0. 1: custom1. 2: line out mode. 3: RF mode //ac3 library configuration
  293. UINT8 dualmonomode : 2; // dual mono mode. 0: streo. 1: left mono. 2: right mono. 3: mixed mono.
  294. };
  295. // 3th UINT32
  296. UINT32 DataPtr;
  297. // 4th UINT32
  298. union
  299. {
  300. UINT32 DataSize; // linear : real playing size
  301. UINT32 nonlinear_sample_no; // non-linear : sample number. ex. AC3-> 1536, MPEG->1152, etc...
  302. };
  303. // 5th UINT32
  304. union
  305. {
  306. UINT32 PTS; //PTS value 0th ~ 31th bit
  307. UINT32 ulTargetAddr; //file mode output target address
  308. UINT32 dspbuf_base; //mp used
  309. struct
  310. {
  311. UINT32 PTS_offset :24;
  312. UINT32 NLdelayCnt : 8;
  313. };
  314. };
  315. // 6th UINT32
  316. union
  317. {
  318. UINT32 reserved6_b0_b31 : 32;
  319. UINT32 dspdesp_idx; //mp used
  320. struct
  321. {
  322. UINT32 PTS_High : 1; //PTS value 32th bit
  323. UINT32 copy_protection : 1; //record HDMI CP bit setting
  324. UINT32 dolby_loudness_gain_idx: 3; // 0: 0db, 1: -1db, 3= -3db(EU) ,4 = -4db (ATSC)
  325. UINT32 reserved6_b5_b7: 3;
  326. UINT32 spdif_channel_status_category_code : 8;
  327. UINT32 nonlinear_frame_length : 16; //non-linear frame length without SPDIF header and alignment
  328. };
  329. };
  330. // 7th UINT32
  331. union
  332. {
  333. UINT32 ZeroStuffLen; //16 UINT8 unit, length starting from 0, means "length + 1"
  334. UINT32 NLsize; //16 UINT8 unit, size starting from 1, mean "length"
  335. };
  336. // 8th UINT32
  337. union
  338. {
  339. /* Audio Description Used */
  340. UINT32 AD_info;
  341. struct
  342. {
  343. UINT32 ucFade : 8;
  344. UINT32 ucPan : 8;
  345. //UINT32 usAD_Vol : 16;
  346. UINT32 usAD_Vol : 8;
  347. UINT32 usAD_reserved: 8;
  348. };
  349. /*~Audio Description Used */
  350. struct
  351. {
  352. union
  353. {
  354. UINT8 spkplace; /* HDMI SPEAKER PLACEMENT */
  355. struct
  356. {
  357. UINT8 L_invalid : 1; //O
  358. UINT8 R_invalid : 1; //P
  359. UINT8 Lfe_invalid : 1; //Q
  360. UINT8 C_invalid : 1; //R
  361. UINT8 Ls_invalid : 1; //S
  362. UINT8 Rs_invalid : 1; //T
  363. UINT8 SL_invalid : 1; //U
  364. UINT8 SR_invalid : 1; //V
  365. };
  366. };
  367. UINT8 sp_non_linear_type : 5; /* SPDIF CHANNEL STATUS */
  368. // 1 for AC3
  369. // 4 MPEG1L1
  370. // 5 MPEG1L2,3 or MPEG2 without extension
  371. // 6 MPEG2 with extension
  372. // 8 MPEG2 L1 low freq
  373. // 9 MPEG2 L1 low freq
  374. // 10 MPEG2 L1 low
  375. UINT8 reserved8_b13_b15 : 3;
  376. UINT8 sample_bit : 4; /* HDMI PCM out use*/
  377. UINT8 BuffNo : 4; /* not use now */
  378. union
  379. {
  380. struct
  381. {
  382. UINT8 reserved8_24_b27 : 4;
  383. UINT8 silk_fmt : 3; /* 0 :SILK_NB_V3 ,1: SILK_MB_V3, 2 SILK_WB_V3, 3 SILK_SW_V3 */
  384. UINT8 reserved8_b31: 1;
  385. };
  386. struct
  387. {
  388. UINT8 FileMode : 1; // file decode enable
  389. UINT8 outputmode : 3; /* AC3 library CONFIG */
  390. // 0: 3/2 (L,C,R,l,r). 1: 1/0(C). 2: 2/0(L,R). 3: 3/0(L,C,R).
  391. // 4: 2/1 (L,R,l). 5: 3/1(L,C,R,l). 6: 2/2 (L,R,l,r). 7: 3/2 (L,C,R,l,r)
  392. //AAC FORMAT SELECT FLAG
  393. UINT8 aac_fmt : 2;
  394. #define AAC_LATM 0
  395. #define AAC_ADTS 1
  396. #define AAC_ADIF 2
  397. #define AAC_RAW 3 //put AudioSpecificConfig data in cmdbuffer, first UINT8 is length.
  398. UINT8 ffmpeg_mode : 1;
  399. UINT8 aac_codec: 1; // 1: AAC MAIN 0: IIS AAC
  400. //UINT8 asynchronous : 1; //it only used on TXtype=AUDIO_TX_TYPE_NO_OUTPUT
  401. };
  402. };
  403. };
  404. };
  405. }AUDIO_CMDQ, *pAUDIO_CMDQ;
  406. //Kai 20091223
  407. typedef struct _AUDIO_WMA_SETTINGS_CMDQ
  408. {
  409. UINT8 CID;
  410. UINT8 flag;
  411. UINT8 bitspersample;
  412. struct
  413. {
  414. UINT8 channels : 4;
  415. UINT8 codec_id : 2;
  416. UINT8 tvnoise : 1;
  417. UINT8 reserved1 : 1;
  418. };
  419. UINT32 samplerate;
  420. UINT32 bitrate;
  421. UINT32 blockalign;
  422. UINT32 datalen;
  423. UINT8 data[6];
  424. unsigned short wEncodeOptions;
  425. UINT32 dwChannelMask;
  426. }AUDIO_WMA_SETTINGS_CMDQ, *pAUDIO_WMA_SETTINGS_CMDQ;
  427. //True Volume
  428. typedef struct _SRS_AUDIO_TRUEVOL_CMDQ
  429. {
  430. UINT8 CID;
  431. UINT8 flag;
  432. struct
  433. {
  434. UINT8 tv : 1; // TrueVolume enable/bypass
  435. UINT8 tvleftenable :1; //TrueVolume left channel enable/disable flag
  436. UINT8 tvrightenable :1; //TrueVolume right channel enable/disable flag
  437. UINT8 tvnoise : 1; // TrueVolume noise enable/disable flag
  438. UINT8 SRSTVEnable : 1;
  439. UINT8 reserved1 : 3;
  440. };
  441. struct
  442. {
  443. UINT8 tvmode : 1; // TrueVolume mode, 0~1
  444. UINT8 tvspksize: 3; // TrueVolume speaker size, 0~5 20Hz~410Hz
  445. UINT8 reserved2: 4; // TruBass speaker size, 0~7 40Hz~400Hz
  446. };
  447. UINT32 inputgain; //input gain, 0~0x7fffffff
  448. UINT32 outputgain; //output gain, 0~0x7fffffff
  449. UINT32 bypassgain; //bypass gain, 0~0x7fffffff
  450. UINT32 referencelevel; //reference gain, 0~0x7fffffff
  451. UINT32 maxgain;
  452. UINT32 noisethreshold;
  453. UINT32 reserved7;
  454. }SRS_TRUEVOL_CMDQ, *pSRS_TRUEVOL_CMDQ;
  455. //SRS TruSurround HD
  456. typedef struct _SRS_TSHD_CMDQ
  457. {
  458. //1st UINT32
  459. UINT8 CID;
  460. UINT8 flag;
  461. struct
  462. {
  463. UINT8 Enable : 1; // SRS TruSurroundHD Enable
  464. UINT8 Surround_En : 1; //Surround Enable
  465. UINT8 DialogClarity_En : 1; // Focus enable/disable flag (Dialog Clarity)
  466. UINT8 TruBassFront_En : 1; // TruBass enable/disable flag
  467. UINT8 DefinitionFront_En : 1;
  468. UINT8 TruBass_spksize : 3; //// TruBass speaker size, 0~7 40Hz~400Hz
  469. };
  470. struct
  471. {
  472. UINT8 Inputmode : 4; // TruSurround mode, 0~11
  473. UINT8 Outputmode: 3;
  474. UINT8 reserved2: 1;
  475. };
  476. //2nd UINT32
  477. UINT32 InputGain;
  478. UINT32 OutputGain;
  479. UINT32 BypassGain;
  480. UINT32 SurroundLevel;
  481. UINT32 DialogClarityLevel;
  482. UINT32 TruBassFrontLevel;
  483. UINT32 DefinitionFrontLevel;
  484. }SRS_TSHD_CMDQ, *pSRS_TSHD_CMDQ;
  485. typedef struct _AUDIO_AGC_CMDQ
  486. {
  487. // 1st UINT32
  488. UINT8 CID;
  489. UINT8 flag;
  490. UINT8 Enable; /* True = Process, False = Bypass */
  491. UINT8 limiter_level; //unit -1dB, 0: 0: 0.dB(default), 1: -1dB, 2: -2dB.... Max: 30 : -30dB
  492. // 2nd UINT32
  493. UINT8 pullup_gain; //unit: 0.1dB, 0: 0.dB(default), 1: 0.1 dB... max:180(18 dB)
  494. UINT8 at_re_rate; //attack/release rate , 0: 1/4 , 1: 1/8, 2: 1/16, 3: 1/32, 4: 1/64 , 5: 1/128 6: 1/256 , 7: 1/512 , 8: 1/1024 9: 1/2048, 10: 1/4096
  495. UINT8 at_speed; //Control attack speed, 0: default(slowest) ~ 7: fastest (30x default)
  496. UINT8 active_time; //unit 10ms, 0: 10ms, 1: 20ms .... 15: 160ms
  497. // 3rd UINT32
  498. struct
  499. {
  500. UINT32 pullup_active_level : 8;//unit -1dB, 0: 0: 0.dB(default), 1: -1dB, 2: -2dB.... Max: 30 : -30dB
  501. UINT32 free_run_count: 8; //free run count when agc reset, attacke and release rate will be 1:1
  502. UINT32 pl_rate : 8; //0: 1/8, 1:1/16 2: 1/32 3: 1/64, 4 :1/128 5: 1/256
  503. UINT32 detect_mode : 8; //0: peak mode , 1: rms mode
  504. };
  505. // 4th UINT32
  506. UINT32 reserved4;
  507. // 5th UINT32
  508. UINT32 reserved5;
  509. // 6th UINT32
  510. UINT32 reserved6;
  511. // 7th UINT32
  512. UINT32 reserved7;
  513. // 8th UINT32
  514. UINT32 reserved8;
  515. }AUDIO_AGC_CMDQ, *pAUDIO_AGC_CMDQ;
  516. typedef struct _AE_CMDQ
  517. {
  518. // 1st UINT32
  519. UINT8 CID;
  520. UINT8 flag;
  521. struct
  522. {
  523. UINT8 enable: 1;
  524. UINT8 surround_en:1;
  525. UINT8 voice_en: 1;
  526. UINT8 bass_en: 1;
  527. UINT8 sf_exp: 1;
  528. UINT8 Reserved0: 3;
  529. };
  530. UINT8 Sur_mode; //surround mode
  531. // 2nd UINT32
  532. UINT8 Sur_Lv; // surround level
  533. UINT8 Voice_Lv; //voice level
  534. UINT8 Bass_Lv; // bass level
  535. UINT8 Bass_Freq; // bass freq
  536. // 3rd UINT32
  537. struct
  538. {
  539. UINT32 inputgain :8;
  540. UINT32 directgain :8; //only use for S+ Surround
  541. UINT32 reverbgain :8; //only use for S+ Surround
  542. UINT32 ambiancegain :8; //only use for S+ Surround
  543. };
  544. UINT32 reserved4;
  545. UINT32 reserved5;
  546. UINT32 reserved6;
  547. UINT32 reserved7;
  548. UINT32 reserved8;
  549. }AE_CMDQ, *pAE_CMDQ;
  550. typedef struct _MS_AE_CMDQ
  551. {
  552. // 1st UINT32
  553. UINT8 CID;
  554. UINT8 flag;
  555. struct
  556. {
  557. UINT8 MS_enable: 1;
  558. UINT8 MS_surround_en:1;
  559. UINT8 MS_bass_en: 1;
  560. UINT8 MS_voice_en: 1;
  561. UINT8 MS_definition_en: 1;
  562. UINT8 MS_sf_exp: 1;
  563. UINT8 Reserved0: 2;
  564. };
  565. UINT8 Sur_mode; //reserved
  566. // 2nd UINT32
  567. UINT8 MS_AE_surround_gain ; //surround gain
  568. UINT8 MS_Sur_Lv; // surround level delay
  569. UINT8 MS_AE_Bass_Freq; // bass freq 0:100 1:200 2:400
  570. UINT8 MS_AE_bassfix_gain; // , default 8
  571. // 3rd UINT32
  572. struct
  573. {
  574. UINT32 MS_AE_Voice_Lv :8; //voice level ,dialog clarity //0~+10dB (2500Hz EQ)
  575. UINT32 MS_AE_Definition_gain :8; // high pass definition 0~+10dB (5000Hz EQ)
  576. UINT32 MS_AE_Sur_Delay :8; //for ae_EX
  577. UINT32 MS_Headroom :8; //for ae_EX
  578. };
  579. UINT32 reserved4;
  580. UINT32 reserved5;
  581. UINT32 reserved6;
  582. UINT32 reserved7;
  583. UINT32 reserved8;
  584. }MS_AE_CMDQ, *pMS_AE_CMDQ;
  585. typedef struct _CUT_OFF_CMDQ
  586. {
  587. // 1st UINT32
  588. UINT8 CID;
  589. UINT8 flag;
  590. UINT8 enable;
  591. UINT8 freq_index;
  592. UINT32 reserved2;
  593. UINT32 reserved3;
  594. UINT32 reserved4;
  595. UINT32 reserved5;
  596. UINT32 reserved6;
  597. UINT32 reserved7;
  598. UINT32 reserved8;
  599. }CUT_OFF_CMDQ,*pCUT_OFF_CMDQ;
  600. // WARNING!
  601. // Now, only use the compmode parameter.
  602. // In the future, must replace the dolby ditital settings with
  603. // DOLBY_DIGITAL_SETTINGS_CMDQ without using AUDIO_CMDQ
  604. typedef struct _DOLBY_DIGITAL_SETTINGS_CMDQ
  605. {
  606. // 1st UINT32
  607. struct
  608. {
  609. UINT32 CID : 8;
  610. UINT32 flag : 8;
  611. UINT32 reconfig : 1;
  612. UINT32 reserved1_b17_b23 : 7;
  613. UINT32 logo_enable : 1;
  614. UINT32 spdif_ac3_enable : 1;
  615. UINT32 enable_mixdata_file_out : 1;
  616. UINT32 reserved1_b26_b31 : 5;
  617. };
  618. // 2nd UINT32
  619. struct
  620. {
  621. UINT32 outnchans : 3;
  622. UINT32 outlfe : 1;
  623. UINT32 compmode : 2;
  624. UINT32 quitonerr :1;
  625. UINT32 reserved2_b7 : 1;
  626. UINT32 stereomode : 4;
  627. UINT32 dualmode : 4;
  628. UINT32 outchanconfig : 4;
  629. UINT32 reserved2_b20_b23 : 4;
  630. UINT32 upsample : 2;
  631. UINT32 kmode : 2;
  632. UINT32 enable_pcm_file_out : 1;
  633. UINT32 enable_dd_file_out : 1;
  634. UINT32 output_channel_select : 2; // 0: L, R. 1: Ls, Rs. 2: C, LFE.
  635. };
  636. // 3rd UINT32
  637. UINT32 dynscalehigh;
  638. // 4th UINT32
  639. UINT32 dynscalelow;
  640. // 5th UINT32
  641. UINT32 pcmscale;
  642. // 6th UINT32
  643. // 7th UINT32
  644. UINT8 chanrouting[6];
  645. UINT8 reserved7[2];
  646. // 8th UINT32
  647. UINT32 reserved8;
  648. }DOLBY_DIGITAL_SETTINGS_CMDQ, *pDOLBY_DIGITAL_SETTINGS_CMDQ;
  649. //hauchuen@20091029 use to send information to audiorom.
  650. typedef struct _AUDIO_INFO_CMDQ
  651. {
  652. // 1st UINT32
  653. UINT8 CID;
  654. UINT8 flag;
  655. UINT8 I2SPASS; // 0: Normal, 1: I2S0BYPASS, 2:I2S1BYPASS, 3.I2S_Nopass
  656. UINT8 CanalPlus; //0: No canalplus, 1:Outpu from SD3, 2, output from SD2(swap SD2&SD3)
  657. // 2nd UINT32
  658. UINT32 audio_feature; //support AC3, Real, MP3, SRS TSXT, SRS TV....etc.
  659. // 3rd UINT32
  660. struct
  661. {
  662. UINT32 ALSA_PCM_TYPE : 2; //0: 16bit , 1:24bit (size = 32) , 2,3 : reserved
  663. UINT32 dolby_5_8_frm_bypass : 1; //0: check 5/8 frame error , 1:bypass check
  664. UINT32 reserved3_b2_b31 : 29;
  665. };
  666. // 4th UINT32
  667. UINT32 reserved4;
  668. // 5th UINT32
  669. UINT32 reserved5;
  670. // 6th UINT32
  671. UINT32 reserved6;
  672. // 7th UINT32
  673. UINT32 reserved7;
  674. // 8th UINT32
  675. UINT32 reserved8;
  676. }AUDIO_INFO_CMDQ, *pAUDIO_INFO_CMDQ;
  677. // john@20110630 add for PEQ setting
  678. typedef struct _AUDIO_PEQ_SET_CMDQ
  679. {
  680. // 1st UINT32
  681. UINT8 CID;
  682. UINT8 flag;
  683. struct
  684. {
  685. UINT8 reserved1_1: 6;
  686. UINT8 type: 1; // set EQ or PEQ, 0=PEQ, 1=PEQ
  687. UINT8 enable: 1; // enable or disable peq
  688. };
  689. UINT8 reserved1_2;
  690. // 2nd UINT32
  691. UINT32 table_addr; // eq/peq table address
  692. // 3rd UINT32
  693. UINT32 reserved3;
  694. // 4th UINT32
  695. UINT32 reserved4;
  696. // 5th UINT32
  697. UINT32 reserved5;
  698. // 6th UINT32
  699. UINT32 reserved6;
  700. // 7th UINT32
  701. UINT32 reserved7;
  702. // 8th UINT32
  703. UINT32 reserved8;
  704. }AUDIO_PEQ_SET_CMDQ, *pAUDIO_PEQ_SET_CMDQ;
  705. // ~john
  706. typedef struct _AUDIO_TITOI_SET_CMDQ
  707. {
  708. // 1st UINT32
  709. UINT8 CID;
  710. UINT8 flag;
  711. struct
  712. {
  713. UINT8 reserved1_1: 7;
  714. UINT8 enable: 1;
  715. };
  716. UINT8 reserved1_2;
  717. // 2nd UINT32
  718. UINT32 table_addr; // eq/peq table address
  719. // 3rd UINT32
  720. UINT32 reserved3;
  721. // 4th UINT32
  722. UINT32 reserved4;
  723. // 5th UINT32
  724. UINT32 reserved5;
  725. // 6th UINT32
  726. UINT32 reserved6;
  727. // 7th UINT32
  728. UINT32 reserved7;
  729. // 8th UINT32
  730. UINT32 reserved8;
  731. }AUDIO_TITOI_SET_CMDQ, *pAUDIO_TITOI_SET_CMDQ;
  732. // john@20130423 add for shelving setting
  733. typedef struct _AUDIO_SHELVING_CMDQ
  734. {
  735. // 1st dword
  736. UINT8 CID;
  737. UINT8 flag;
  738. struct
  739. {
  740. UINT8 enable: 1;
  741. UINT8 treble_en: 1;
  742. UINT8 bass_en: 1;
  743. UINT8 reserved1_1: 5;
  744. };
  745. UINT8 reserved1_2;
  746. // 2nd dword
  747. INT8 treble;
  748. INT8 bass;
  749. UINT8 reserved2_1;
  750. UINT8 reserved2_2;
  751. // 3rd dword
  752. UINT32 samplerate;// not used
  753. // 4th dword
  754. UINT32 frequency_bass;
  755. // 5th dword
  756. UINT32 Q_bass;// not used
  757. // 6th dword
  758. UINT32 frequency_treble;
  759. // 7th dword
  760. UINT32 Q_treble;// not used
  761. // 8th dword
  762. UINT32 reserved8;
  763. }AUDIO_SHELVING_CMDQ, *pAUDIO_SHELVING_CMDQ;
  764. typedef struct _AUDIO_HPLP_CMDQ
  765. {
  766. // 1st dword
  767. UINT8 CID;
  768. UINT8 flag;
  769. struct
  770. {
  771. UINT8 enable: 1;
  772. UINT8 hp_en: 1;
  773. UINT8 lp_en: 1;
  774. UINT8 reserved1_1: 5;
  775. };
  776. UINT8 reserved1_2;
  777. // 2nd dword
  778. INT32 reserved2;
  779. // 3rd dword
  780. INT32 samplerate;
  781. // 4th dword
  782. INT32 frequency_hp;
  783. // 5th dword
  784. INT32 Q_hp;//not used
  785. // 6th dword
  786. INT32 frequency_lp;
  787. // 7th dword
  788. INT32 Q_lp;//not used
  789. // 8th dword
  790. UINT32 reserved8;
  791. }AUDIO_HPLP_CMDQ, *pAUDIO_HPLP_CMDQ;
  792. enum
  793. {
  794. DBXCMD_TYPE_SET_MODE, //DBX CHANGE MODE
  795. DBXCMD_TYPE_INT_TABLE, //DBX TABLE INIT
  796. DBXCMD_TYPE_SET_PARAM, //SET DBX PARAMETER
  797. };
  798. typedef struct _DBXAUDIO_SET_CMDQ
  799. {
  800. // 1st dword
  801. UINT8 CID;
  802. UINT8 flag;
  803. UINT8 dbx_enable; // enable or disable dbx function
  804. UINT8 type; //o: set mode, 1: table init , 2:set parameter
  805. // 2nd dword
  806. struct
  807. {
  808. UINT32 totvol_mode:8;
  809. UINT32 totsur_mode:8;
  810. UINT32 totson_mode:8;
  811. UINT32 reserved2:8;
  812. };
  813. // 3rd dword
  814. UINT32 enable_flag; //sub_function enable flag. 0x1f = all enable
  815. // 4th dword
  816. UINT32 dbx_table_addr; //table address for audiorom update parameter
  817. // 5th dword
  818. UINT32 ParamCoeff;
  819. // 6th dword
  820. UINT32 ParamCoeffOffset;
  821. // 7th dword
  822. UINT32 ParamCoeffValue;
  823. // 8th dword
  824. UINT32 reserved8;
  825. }DBXAUDIO_SET_CMDQ, *pDBXAUDIO_SET_CMDQ;
  826. /*
  827. AUDIO FADE IN OUT CONTROL
  828. */
  829. typedef struct _AUDIO_FADE_CMDQ
  830. {
  831. // 1st dword
  832. UINT8 CID;
  833. UINT8 flag;
  834. UINT8 Enable; /* True = Process, False = Bypass */
  835. UINT8 mode; //0: linear , 1: (Reserved)
  836. // 2nd dword
  837. UINT8 type; //0: Fade in , 1: (Reserved)
  838. UINT8 fade_speed; //0: 1db/ms. 1: db/2ms, 2: db/4ms 3, db/8ms (linear mode)
  839. UINT8 fade_level; //fade level : 0:-60db, 1: -40db 2: -20db
  840. UINT8 reserved2_4;
  841. // 3rd dword
  842. UINT32 reserved3;
  843. // 4th dword
  844. UINT32 reserved4;
  845. // 5th dword
  846. UINT32 reserved5;
  847. // 6th dword
  848. UINT32 reserved6;
  849. // 7th dword
  850. UINT32 reserved7;
  851. // 8th dword
  852. UINT32 reserved8;
  853. }AUDIO_FADE_CMDQ, *pAUDIO_FADE_CMDQ;
  854. #pragma pack(pop)
  855. static inline INT32 READ_CMDQ_STATUS(void)
  856. {
  857. return *(int*)AUDIOCMDQ_STATUS_ADDR;
  858. }
  859. static inline void WRITE_CMDQ_STATUS(E_CMDQ_STATUS e_cmdq_status)
  860. {
  861. (*(int*)AUDIOCMDQ_STATUS_ADDR)=e_cmdq_status;
  862. };
  863. static inline UINT32* Get_CmdQ_RP(void)
  864. {
  865. return (UINT32*)AUDIOCMDQ_RP_ADDR;
  866. }
  867. static inline UINT32* Get_CmdQ_WP(void)
  868. {
  869. return (UINT32*)AUDIOCMDQ_WP_ADDR;
  870. }
  871. /*~ RETURN VALUE OF CMDQ */
  872. INT32 DRV_Audio_intcmdqfire(void *data);
  873. INT32 DRV_Audio_intcmdqfire2(void *data);
  874. #endif