/arch/arm/mach-fsm/qdsp6v2/apr_audio.h

https://bitbucket.org/sammyz/iscream_thunderc-2.6.35-rebase · C++ Header · 910 lines · 706 code · 110 blank · 94 comment · 0 complexity · 1bd4a3094233a5f17111e43aa43beb9d MD5 · raw file

  1. /*
  2. *
  3. * Copyright (c) 2010, Code Aurora Forum. All rights reserved.
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License version 2 and
  7. * only version 2 as published by the Free Software Foundation.
  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., 51 Franklin Street, Fifth Floor, Boston, MA
  17. * 02110-1301, USA.
  18. *
  19. */
  20. #ifndef _APR_AUDIO_H_
  21. #define _APR_AUDIO_H_
  22. /* ASM opcodes without APR payloads*/
  23. #include "apr.h"
  24. /*
  25. * Audio Front End (AFE)
  26. */
  27. /* Port ID */
  28. enum {
  29. PRIMARY_I2S_RX = 0,
  30. PRIMARY_I2S_TX = 1,
  31. PCM_RX = 2,
  32. PCM_TX = 3,
  33. SECONDARY_I2S_RX = 4,
  34. SECONDARY_I2S_TX = 5,
  35. MI2S_RX = 6,
  36. RSVD_1 = 7,
  37. HDMI_RX = 8,
  38. RSVD_2 = 9,
  39. RSVD_3 = 10,
  40. DIGI_MIC_TX = 11,
  41. AFE_MAX_PORTS ,
  42. };
  43. #define AFE_PORT_CMD_START 0x000100ca
  44. struct afe_port_start_command {
  45. struct apr_hdr hdr;
  46. u16 port_id;
  47. u16 gain; /* Q13 */
  48. u32 sample_rate; /* 8 , 16, 48khz */
  49. } __attribute__ ((packed));
  50. #define AFE_PORT_CMD_STOP 0x000100cb
  51. struct afe_port_stop_command {
  52. struct apr_hdr hdr;
  53. u16 port_id;
  54. u16 reserved;
  55. } __attribute__ ((packed));
  56. #define AFE_PORT_CMD_APPLY_GAIN 0x000100cc
  57. struct afe_port_gain_command {
  58. struct apr_hdr hdr;
  59. u16 port_id;
  60. u16 gain; /* Q13 */
  61. } __attribute__ ((packed));
  62. #define AFE_PORT_CMD_SIDETONE_CTL 0x000100cd
  63. struct afe_port_sidetone_command {
  64. struct apr_hdr hdr;
  65. u16 tx_port_id; /* Primary i2s rx = 0 */
  66. /* PCM rx = 2 */
  67. /* Secondary i2s rx = 4 */
  68. /* Mi2S rx = 6 */
  69. /* HDMI rx = 8 */
  70. u16 rx_port_id; /* Primary i2s tx = 1 */
  71. /* PCM tx = 3 */
  72. /* Secondary i2s tx = 5 */
  73. /* Mi2s tx = 7 */
  74. /* Digital mic tx = 11 */
  75. u16 gain; /* Q13 */
  76. u16 enable; /* 1 = enable, 0 = disable */
  77. } __attribute__ ((packed));
  78. #define AFE_PORT_CMD_LOOPBACK 0x000100ce
  79. struct afe_loopback_command {
  80. struct apr_hdr hdr;
  81. u16 tx_port_id; /* Primary i2s rx = 0 */
  82. /* PCM rx = 2 */
  83. /* Secondary i2s rx = 4 */
  84. /* Mi2S rx = 6 */
  85. /* HDMI rx = 8 */
  86. u16 rx_port_id; /* Primary i2s tx = 1 */
  87. /* PCM tx = 3 */
  88. /* Secondary i2s tx = 5 */
  89. /* Mi2s tx = 7 */
  90. /* Digital mic tx = 11 */
  91. u16 mode; /* Default -1, DSP will conver
  92. the tx to rx format */
  93. u16 enable; /* 1 = enable, 0 = disable */
  94. } __attribute__ ((packed));
  95. #define AFE_PSEUDOPORT_CMD_START 0x000100cf
  96. struct afe_pseudoport_start_command {
  97. struct apr_hdr hdr;
  98. u16 port_id; /* Pseudo Port 1 = 0x8000 */
  99. /* Pseudo Port 2 = 0x8001 */
  100. /* Pseudo Port 3 = 0x8002 */
  101. u16 timing; /* FTRT = 0 , AVTimer = 1, */
  102. } __attribute__ ((packed));
  103. #define AFE_PSEUDOPORT_CMD_STOP 0x000100d0
  104. struct afe_pseudoport_stop_command {
  105. struct apr_hdr hdr;
  106. u16 port_id; /* Pseudo Port 1 = 0x8000 */
  107. /* Pseudo Port 2 = 0x8001 */
  108. /* Pseudo Port 3 = 0x8002 */
  109. u16 reserved;
  110. } __attribute__ ((packed));
  111. #define AFE_CMD_GET_ACTIVE_PORTS 0x000100d1
  112. #define AFE_CMD_GET_ACTIVE_HANDLES_FOR_PORT 0x000100d2
  113. struct afe_get_active_handles_command {
  114. struct apr_hdr hdr;
  115. u16 port_id;
  116. u16 reserved;
  117. } __attribute__ ((packed));
  118. struct afe_port_pcm_cfg {
  119. u16 port_id;
  120. u16 mode; /* PCM (short sync) = 0, AUXPCM (long sync) = 1 */
  121. u16 sync; /* external = 0 , internal = 1 */
  122. u16 frame; /* 8 bpf = 0 */
  123. /* 16 bpf = 1 */
  124. /* 32 bpf = 2 */
  125. /* 64 bpf = 3 */
  126. /* 128 bpf = 4 */
  127. /* 256 bpf = 5 */
  128. u16 quant;
  129. u16 slot; /* Slot for PCM stream , 0 - 31 */
  130. u16 data; /* 0, PCM block is the only master */
  131. /* 1, PCM block is shares to driver data out signal */
  132. /* other master */
  133. u16 reserved;
  134. } __attribute__ ((packed));
  135. struct afe_port_mi2s_cfg {
  136. u16 port_id;
  137. u16 bitwidth; /* 16,24,32 */
  138. u16 line; /* i2s_sd0 = 1 */
  139. /* i2s_sd1 = 2 */
  140. /* i2s_sd2 = 3 */
  141. /* i2s_sd3 = 4 */
  142. /* i2s_quad01 = 5 */
  143. /* i2s_quad23 = 6 */
  144. /* i2s_6chs = 7 */
  145. /* i2s_8chs = 8 */
  146. u16 channel; /* i2s mono = 0 */
  147. /* i2s mono right = 1 */
  148. /* i2s mono left = 2 */
  149. /* i2s stereo = 3 */
  150. u16 ws; /* 0, word select signal from external source */
  151. /* 1, word select signal from internal source */
  152. u16 reserved;
  153. } __attribute__ ((packed));
  154. #define AFE_PORT_AUDIO_IF_CONFIG 0x000100d3
  155. struct afe_audioif_config_command {
  156. struct apr_hdr hdr;
  157. union {
  158. struct afe_port_pcm_cfg pcm;
  159. struct afe_port_mi2s_cfg mi2s;
  160. } __attribute__((packed)) port;
  161. } __attribute__ ((packed));
  162. #define AFE_TEST_CODEC_LOOPBACK_CTL 0x000100d5
  163. struct afe_codec_loopback_command {
  164. u16 port_inf; /* Primary i2s = 0 */
  165. /* PCM = 2 */
  166. /* Secondary i2s = 4 */
  167. /* Mi2s = 6 */
  168. u16 enable; /* 0, disable. 1, enable */
  169. } __attribute__ ((packed));
  170. #define AFE_EVENT_GET_ACTIVE_PORTS 0x00010100
  171. struct afe_get_active_ports_rsp {
  172. u16 num_ports;
  173. u16 port_id;
  174. } __attribute__ ((packed));
  175. #define AFE_EVENT_GET_ACTIVE_HANDLES 0x00010102
  176. struct afe_get_active_handles_rsp {
  177. u16 port_id;
  178. u16 num_handles;
  179. u16 mode; /* 0, voice rx */
  180. /* 1, voice tx */
  181. /* 2, audio rx */
  182. /* 3, audio tx */
  183. u16 handle;
  184. } __attribute__ ((packed));
  185. #define ADM_MAX_COPPS 5
  186. #define ADM_SERVICE_CMD_GET_COPP_HANDLES 0x00010300
  187. struct adm_get_copp_handles_command {
  188. struct apr_hdr hdr;
  189. } __attribute__ ((packed));
  190. #define ADM_CMD_MATRIX_MAP_ROUTINGS 0x00010301
  191. struct adm_routings_session {
  192. u16 id;
  193. u16 num_copps;
  194. u16 copp_id[ADM_MAX_COPPS];
  195. } __attribute__ ((packed));
  196. struct adm_routings_command {
  197. struct apr_hdr hdr;
  198. u32 path; /* 0 = Rx, 1 Tx */
  199. u32 num_sessions;
  200. struct adm_routings_session sessions[8];
  201. } __attribute__ ((packed));
  202. #define ADM_CMD_MATRIX_RAMP_GAINS 0x00010302
  203. struct adm_ramp_gain {
  204. struct apr_hdr hdr;
  205. u16 session_id;
  206. u16 copp_id;
  207. u16 initial_gain;
  208. u16 gain_increment;
  209. u16 ramp_duration;
  210. u16 reserved;
  211. } __attribute__ ((packed));
  212. struct adm_ramp_gains_command {
  213. struct apr_hdr hdr;
  214. u32 id;
  215. u32 num_gains;
  216. struct adm_ramp_gain gains[ADM_MAX_COPPS];
  217. } __attribute__ ((packed));
  218. #define ADM_CMD_COPP_OPEN 0x00010304
  219. struct adm_copp_open_command {
  220. struct apr_hdr hdr;
  221. u16 flags;
  222. u16 endpoint_id;
  223. u32 topology_id;
  224. } __attribute__ ((packed));
  225. #define ADM_CMD_COPP_CLOSE 0x00010305
  226. #define DEFAULT_TOPOLOGY 0x00010be4
  227. struct asm_pp_param_data_hdr {
  228. u32 module_id;
  229. u32 param_id;
  230. u16 param_size;
  231. u16 updated_flag;
  232. } __attribute__ ((packed));
  233. #define VOLUME_CONTROL_MODULE_ID 0x00010bfe
  234. #define MASTER_GAIN_PARAM_ID 0x00010bff
  235. #define L_R_CHANNEL_GAIN_PARAM_ID 0x00010c00
  236. #define MUTE_CONFIG_PARAM_ID 0x00010c01
  237. #define IIR_FILTER_ENABLE_PARAM_ID 0x00010c03
  238. #define IIR_FILTER_PREGAIN_PARAM_ID 0x00010c04
  239. #define IIR_FILTER_CONFIG_PARAM_ID 0x00010c05
  240. #define MBADRC_MODULE_ID 0x00010c06
  241. #define MBADRC_ENABLE_PARAM_ID 0x00010c07
  242. #define MBADRC_CONFIG_PARAM_ID 0x00010c08
  243. struct asm_pp_params {
  244. struct asm_pp_param_data_hdr hdr;
  245. } __attribute__ ((packed));
  246. #define ADM_CMD_SET_PARAMS 0x00010306
  247. struct adm_set_params_command {
  248. struct apr_hdr hdr;
  249. struct asm_pp_params param;
  250. } __attribute__ ((packed));
  251. #define ADM_CMD_TAP_COPP_PCM 0x00010307
  252. struct adm_tap_copp_pcm_command {
  253. struct apr_hdr hdr;
  254. } __attribute__ ((packed));
  255. /* QDSP6 to Client messages
  256. */
  257. #define ADM_SERVICE_CMDRSP_GET_COPP_HANDLES 0x00010308
  258. struct adm_get_copp_handles_respond {
  259. struct apr_hdr hdr;
  260. u32 handles;
  261. u32 copp_id;
  262. } __attribute__ ((packed));
  263. #define ADM_CMDRSP_COPP_OPEN 0x0001030A
  264. struct adm_copp_open_respond {
  265. u32 status;
  266. u16 copp_id;
  267. u16 reserved;
  268. } __attribute__ ((packed));
  269. #define ASM_STREAM_PRIORITY_NORMAL 0
  270. #define ASM_STREAM_PRIORITY_LOW 1
  271. #define ASM_STREAM_PRIORITY_HIGH 2
  272. #define ASM_STREAM_PRIORITY_RESERVED 3
  273. #define ASM_END_POINT_DEVICE_MATRIX 0
  274. #define ASM_END_POINT_STREAM 1
  275. #define ASM_STREAM_CMD_CLOSE 0x00010BCD
  276. #define ASM_STREAM_CMD_FLUSH 0x00010BCE
  277. #define ASM_STREAM_CMD_SET_PP_PARAMS 0x00010BCF
  278. #define ASM_STREAM_CMD_GET_PP_PARAMS 0x00010BD0
  279. #define ASM_STREAM_CMDRSP_GET_PP_PARAMS 0x00010BD1
  280. #define ASM_SESSION_CMD_PAUSE 0x00010BD3
  281. #define ASM_SESSION_CMD_GET_SESSION_TIME 0x00010BD4
  282. #define ASM_DATA_CMD_EOS 0x00010BDB
  283. #define ASM_DATA_EVENT_EOS 0x00010BDD
  284. #define ASM_SERVICE_CMD_GET_STREAM_HANDLES 0x00010C0B
  285. #define ASM_STREAM_CMD_FLUSH_READBUFS 0x00010C09
  286. #define ASM_SESSION_EVENT_RX_UNDERFLOW 0x00010C17
  287. #define ASM_SESSION_EVENT_TX_OVERFLOW 0x00010C18
  288. #define ASM_SERVICE_CMD_GET_WALLCLOCK_TIME 0x00010C19
  289. #define ASM_DATA_CMDRSP_EOS 0x00010C1C
  290. /* ASM Data structures */
  291. /* common declarations */
  292. struct asm_pcm_cfg {
  293. u16 ch_cfg;
  294. u16 bits_per_sample;
  295. u32 sample_rate;
  296. u16 is_signed;
  297. u16 interleaved;
  298. };
  299. struct asm_adpcm_cfg {
  300. u16 ch_cfg;
  301. u16 bits_per_sample;
  302. u32 sample_rate;
  303. u32 block_size;
  304. };
  305. struct asm_yadpcm_cfg {
  306. u16 ch_cfg;
  307. u16 bits_per_sample;
  308. u32 sample_rate;
  309. };
  310. struct asm_midi_cfg {
  311. u32 nMode;
  312. };
  313. struct asm_wma_cfg {
  314. u16 format_tag;
  315. u16 ch_cfg;
  316. u32 sample_rate;
  317. u32 ave_bytes_per_sec;
  318. u16 block_align;
  319. u16 valid_bits_per_sample;
  320. u32 ch_mask;
  321. u16 encode_opt;
  322. u16 adv_encode_opt;
  323. u16 adv_encode_opt2;
  324. u32 drc_peak_ref;
  325. u32 drc_peak_target;
  326. u32 drc_ave_ref;
  327. u32 drc_ave_target;
  328. };
  329. struct asm_aac_cfg {
  330. u16 format;
  331. u16 aot;
  332. u16 ep_config;
  333. u16 section_data_resilience;
  334. u16 scalefactor_data_resilience;
  335. u16 spectral_data_resilience;
  336. u16 sbr_on;
  337. u16 sbr_ps_on;
  338. u16 ch_cfg;
  339. u16 reserved;
  340. u32 sample_rate;
  341. };
  342. struct asm_flac_cfg {
  343. u16 stream_info_present;
  344. u16 min_blk_size;
  345. u16 max_blk_size;
  346. u16 ch_cfg;
  347. u16 sample_size;
  348. u16 sample_rate;
  349. u16 md5_sum;
  350. u32 ext_sample_rate;
  351. u32 min_frame_size;
  352. u32 max_frame_size;
  353. };
  354. struct asm_vorbis_cfg {
  355. u32 ch_cfg;
  356. u32 bit_rate;
  357. u32 min_bit_rate;
  358. u32 max_bit_rate;
  359. u16 bit_depth_pcm_sample;
  360. u16 bit_stream_format;
  361. };
  362. struct asm_aac_read_cfg {
  363. u32 bitrate;
  364. u32 enc_mode;
  365. u16 format;
  366. u16 ch_cfg;
  367. u32 sample_rate;
  368. };
  369. struct asm_amrnb_read_cfg {
  370. u16 mode;
  371. u16 dtx_mode;
  372. u16 min_rate;
  373. u16 max_rate;
  374. };
  375. struct asm_evrc_read_cfg {
  376. u16 min_rate;
  377. u16 max_rate;
  378. };
  379. struct asm_qcelp13_read_cfg {
  380. u16 min_rate;
  381. u16 max_rate;
  382. };
  383. struct asm_sbc_read_cfg {
  384. u32 subband;
  385. u32 block_len;
  386. u32 ch_mode;
  387. u32 alloc_method;
  388. u32 bit_rate;
  389. u32 sample_rate;
  390. };
  391. struct asm_sbc_bitrate {
  392. u32 bitrate;
  393. };
  394. struct asm_aac_immed_decode {
  395. u16 mode;
  396. u16 padding;
  397. };
  398. struct asm_frame_meta_info {
  399. u32 offset_to_frame;
  400. u32 encoded_pcm_samples;
  401. u32 msw_ts;
  402. u32 lsw_ts;
  403. };
  404. /* Stream level commands */
  405. #define ASM_STREAM_CMD_OPEN_READ 0x00010BCB
  406. struct asm_stream_cmd_open_read {
  407. struct apr_hdr hdr;
  408. u32 uMode;
  409. u32 src_endpoint;
  410. u32 frames_per_buf;
  411. u32 pre_proc_top;
  412. u32 format;
  413. u32 cfg_size;
  414. union {
  415. struct asm_pcm_cfg pcm_cfg;
  416. struct asm_aac_read_cfg aac_cfg;
  417. struct asm_amrnb_read_cfg amr_cfg;
  418. struct asm_evrc_read_cfg evrc_cfg;
  419. struct asm_qcelp13_read_cfg qcelp13_cfg;
  420. struct asm_sbc_read_cfg sbc_cfg;
  421. } __attribute__((packed)) read_cfg;
  422. } __attribute__((packed));
  423. /* Supported formats */
  424. #define LINEAR_PCM 0x00010BE5
  425. #define DTMF 0x00010BE6
  426. #define ADPCM 0x00010BE7
  427. #define YADPCM 0x00010BE8
  428. #define MP3 0x00010BE9
  429. #define MPEG4_AAC 0x00010BEA
  430. #define AMRNB_FS 0x00010BEB
  431. #define V13K_FS 0x00010BED
  432. #define EVRC_FS 0x00010BEE
  433. #define EVRCB_FS 0x00010BEF
  434. #define EVRCWB_FS 0x00010BF0
  435. #define MIDI 0x00010BF1
  436. #define SBC 0x00010BF2
  437. #define WMA_V10PRO 0x00010BF3
  438. #define WMA_V9 0x00010BF4
  439. #define AMR_WB_PLUS 0x00010BF5
  440. #define AC3_DECODER 0x00010BF6
  441. #define G711_ALAW_FS 0x00010BF7
  442. #define G711_MLAW_FS 0x00010BF8
  443. #define G711_PCM_FS 0x00010BF9
  444. #define ASM_STREAM_CMD_OPEN_WRITE 0x00010BCA
  445. struct asm_stream_cmd_open_write {
  446. struct apr_hdr hdr;
  447. u32 uMode;
  448. u16 sink_endpoint;
  449. u16 stream_handle;
  450. u32 post_proc_top;
  451. u32 format;
  452. u32 cfg_size;
  453. union {
  454. struct asm_pcm_cfg pcm_cfg;
  455. struct asm_adpcm_cfg adpcm_cfg;
  456. struct asm_yadpcm_cfg yadpcm_cfg;
  457. struct asm_midi_cfg midi_cfg;
  458. struct asm_wma_cfg wma_cfg;
  459. struct asm_aac_cfg aac_cfg;
  460. struct asm_flac_cfg flac_cfg;
  461. struct asm_vorbis_cfg vorbis_cfg;
  462. } __attribute__((packed)) write_cfg;
  463. } __attribute__((packed));
  464. #define ASM_STREAM_CMD_OPEN_READWRITE 0x00010BCC
  465. /* pcm in; aac, amrnb, evrc, qcelp13, sbc out */
  466. struct asm_stream_cmd_open_read_pcmwrite {
  467. struct apr_hdr hdr;
  468. u32 uMode;
  469. u32 post_proc_top;
  470. u32 sample_rate;
  471. u32 write_format;
  472. u32 write_cfg_size;
  473. u32 frames_per_buffer;
  474. u32 read_format;
  475. u32 read_cfg_size;
  476. struct asm_pcm_cfg pcm_write_cfg;
  477. union {
  478. struct asm_pcm_cfg pcm_cfg;
  479. struct asm_aac_read_cfg aac_cfg;
  480. struct asm_amrnb_read_cfg amr_cfg;
  481. struct asm_evrc_read_cfg evrc_cfg;
  482. struct asm_qcelp13_read_cfg qcelp13_cfg;
  483. struct asm_sbc_read_cfg sbc_cfg;
  484. } __attribute__((packed)) read_cfg;
  485. } __attribute__((packed));
  486. /* adpcm in;pcm, aac, amrnb, evrc, qcelp13, sbc out */
  487. struct asm_stream_cmd_open_read_adpcmwrite {
  488. struct apr_hdr hdr;
  489. u32 uMode;
  490. u32 post_proc_top;
  491. u32 sample_rate;
  492. u32 write_format;
  493. u32 write_cfg_size;
  494. u32 frames_per_buffer;
  495. u32 read_format;
  496. u32 read_cfg_size;
  497. struct asm_adpcm_cfg adpcm_write_cfg;
  498. union {
  499. struct asm_pcm_cfg pcm_cfg;
  500. struct asm_aac_read_cfg aac_cfg;
  501. struct asm_amrnb_read_cfg amr_cfg;
  502. struct asm_evrc_read_cfg evrc_cfg;
  503. struct asm_qcelp13_read_cfg qcelp13_cfg;
  504. struct asm_sbc_read_cfg sbc_cfg;
  505. } __attribute__((packed)) read_cfg;
  506. } __attribute__((packed));
  507. /* yadpcm in:pcm, aac, amrnb, evrc, qcelp13, sbc out */
  508. struct asm_stream_cmd_open_read_yadpcmwrite {
  509. struct apr_hdr hdr;
  510. u32 uMode;
  511. u32 post_proc_top;
  512. u32 sample_rate;
  513. u32 write_format;
  514. u32 write_cfg_size;
  515. u32 frames_per_buffer;
  516. u32 read_format;
  517. u32 read_cfg_size;
  518. struct asm_yadpcm_cfg yadpcm_write_cfg;
  519. union {
  520. struct asm_pcm_cfg pcm_cfg;
  521. struct asm_aac_read_cfg aac_cfg;
  522. struct asm_amrnb_read_cfg amr_cfg;
  523. struct asm_evrc_read_cfg evrc_cfg;
  524. struct asm_qcelp13_read_cfg qcelp13_cfg;
  525. struct asm_sbc_read_cfg sbc_cfg;
  526. } __attribute__((packed)) read_cfg;
  527. } __attribute__((packed));
  528. /* midi in;pcm, aac, amrnb, evrc, qcelp13, sbc out */
  529. struct asm_stream_cmd_open_read_midiwrite {
  530. struct apr_hdr hdr;
  531. u32 uMode;
  532. u32 post_proc_top;
  533. u32 sample_rate;
  534. u32 write_format;
  535. u32 write_cfg_size;
  536. u32 frames_per_buffer;
  537. u32 read_format;
  538. u32 read_cfg_size;
  539. struct asm_midi_cfg midi_write_cfg;
  540. union {
  541. struct asm_pcm_cfg pcm_cfg;
  542. struct asm_aac_read_cfg aac_cfg;
  543. struct asm_amrnb_read_cfg amr_cfg;
  544. struct asm_evrc_read_cfg evrc_cfg;
  545. struct asm_qcelp13_read_cfg qcelp13_cfg;
  546. struct asm_sbc_read_cfg sbc_cfg;
  547. } __attribute__((packed)) read_cfg;
  548. } __attribute__((packed));
  549. /* wma in: pcm, aac, amrnb, evrc, qcelp13, sbc out */
  550. struct asm_stream_cmd_open_read_wmawrite {
  551. struct apr_hdr hdr;
  552. u32 uMode;
  553. u32 post_proc_top;
  554. u32 sample_rate;
  555. u32 write_format;
  556. u32 write_cfg_size;
  557. u32 frames_per_buffer;
  558. u32 read_format;
  559. u32 read_cfg_size;
  560. struct asm_wma_cfg wma_write_cfg;
  561. union {
  562. struct asm_pcm_cfg pcm_cfg;
  563. struct asm_aac_read_cfg aac_cfg;
  564. struct asm_amrnb_read_cfg amr_cfg;
  565. struct asm_evrc_read_cfg evrc_cfg;
  566. struct asm_qcelp13_read_cfg qcelp13_cfg;
  567. struct asm_sbc_read_cfg sbc_cfg;
  568. } __attribute__((packed)) read_cfg;
  569. } __attribute__((packed));
  570. /* aac in; pcm, aac, amrnb, evrc, qcelp13, sbc out */
  571. struct asm_stream_cmd_open_read_aacwrite {
  572. struct apr_hdr hdr;
  573. u32 uMode;
  574. u32 post_proc_top;
  575. u32 sample_rate;
  576. u32 write_format;
  577. u32 write_cfg_size;
  578. u32 frames_per_buffer;
  579. u32 read_format;
  580. u32 read_cfg_size;
  581. struct asm_aac_cfg aac_write_cfg;
  582. union {
  583. struct asm_pcm_cfg pcm_cfg;
  584. struct asm_aac_read_cfg aac_cfg;
  585. struct asm_amrnb_read_cfg amr_cfg;
  586. struct asm_evrc_read_cfg evrc_cfg;
  587. struct asm_qcelp13_read_cfg qcelp13_cfg;
  588. struct asm_sbc_read_cfg sbc_cfg;
  589. } __attribute__((packed)) read_cfg;
  590. } __attribute__((packed));
  591. /* flac in; pcm, aac, amrnb, evrc, qcelp13, sbc out */
  592. struct asm_stream_cmd_open_read_flacwrite {
  593. struct apr_hdr hdr;
  594. u32 uMode;
  595. u32 post_proc_top;
  596. u32 sample_rate;
  597. u32 write_format;
  598. u32 write_cfg_size;
  599. u32 frames_per_buffer;
  600. u32 read_format;
  601. u32 read_cfg_size;
  602. struct asm_flac_cfg flac_write_cfg;
  603. union {
  604. struct asm_pcm_cfg pcm_cfg;
  605. struct asm_aac_read_cfg aac_cfg;
  606. struct asm_amrnb_read_cfg amr_cfg;
  607. struct asm_evrc_read_cfg evrc_cfg;
  608. struct asm_qcelp13_read_cfg qcelp13_cfg;
  609. struct asm_sbc_read_cfg sbc_cfg;
  610. } __attribute__((packed)) read_cfg;
  611. } __attribute__((packed));
  612. /* vorbis in; pcm, aac, amrnb, evrc, qcelp13, sbc out */
  613. struct asm_stream_cmd_open_read_vorbiswrite {
  614. struct apr_hdr hdr;
  615. u32 uMode;
  616. u32 post_proc_top;
  617. u32 sample_rate;
  618. u32 write_format;
  619. u32 write_cfg_size;
  620. u32 frames_per_buffer;
  621. u32 read_format;
  622. u32 read_cfg_size;
  623. struct asm_vorbis_cfg vorbis_write_cfg;
  624. union {
  625. struct asm_pcm_cfg pcm_cfg;
  626. struct asm_aac_read_cfg aac_cfg;
  627. struct asm_amrnb_read_cfg amr_cfg;
  628. struct asm_evrc_read_cfg evrc_cfg;
  629. struct asm_qcelp13_read_cfg qcelp13_cfg;
  630. struct asm_sbc_read_cfg sbc_cfg;
  631. } __attribute__((packed)) read_cfg;
  632. } __attribute__((packed));
  633. #define ASM_STREAM_CMD_SET_ENCDEC_PARAM 0x00010C10
  634. struct asm_stream_cmd_set_readwrite_param{
  635. struct apr_hdr hdr;
  636. u32 param_id;
  637. u16 param_size;
  638. u16 padding;
  639. union {
  640. struct asm_sbc_bitrate sbc_bitrate;
  641. struct asm_aac_immed_decode aac_dec;
  642. } __attribute__((packed)) read_write_cfg;
  643. } __attribute__((packed));
  644. #define ASM_STREAM_CMD_GET_ENCDEC_PARAM 0x00010C11
  645. struct asm_stream_cmd_get_readwrite_param{
  646. struct apr_hdr hdr;
  647. u32 param_id;
  648. u16 param_size;
  649. u16 padding;
  650. union {
  651. struct asm_sbc_bitrate sbc_bitrate;
  652. struct asm_aac_immed_decode aac_dec;
  653. } __attribute__((packed)) read_write_cfg;
  654. } __attribute__((packed));
  655. #define ASM_STREAM _CMD_ADJUST_SAMPLES 0x00010C0A
  656. struct asm_stream_cmd_adjust_samples{
  657. struct apr_hdr hdr;
  658. u16 nsamples;
  659. u16 reserved;
  660. } __attribute__((packed));
  661. #define ASM_STREAM_CMD_TAP_POPP_PCM 0x00010BF9
  662. struct asm_stream_cmd_tap_popp_pcm{
  663. struct apr_hdr hdr;
  664. u16 enable;
  665. u16 reserved;
  666. u32 module_id;
  667. } __attribute__((packed));
  668. /* Session Level commands */
  669. #define ASM_SESSION_CMD_RUN 0x00010BD2
  670. struct asm_stream_cmd_run{
  671. struct apr_hdr hdr;
  672. u32 flags;
  673. u32 msw_ts;
  674. u32 lsw_ts;
  675. } __attribute__((packed));
  676. /* Session level events */
  677. #define ASM_SESSION_CMD_REGISTER_FOR_RX_UNDERFLOW_EVENTS 0x00010BD5
  678. struct asm_stream_cmd_reg_rx_underflow_event{
  679. struct apr_hdr hdr;
  680. u16 enable;
  681. u16 reserved;
  682. } __attribute__((packed));
  683. #define ASM_SESSION_CMD_REGISTER_FOR_TX_OVERFLOW_EVENTS 0x00010BD6
  684. struct asm_stream_cmd_reg_tx_overflow_event{
  685. struct apr_hdr hdr;
  686. u16 enable;
  687. u16 reserved;
  688. } __attribute__((packed));
  689. /* Data Path commands */
  690. #define ASM_DATA_CMD_WRITE 0x00010BD9
  691. struct asm_stream_cmd_write{
  692. struct apr_hdr hdr;
  693. u32 buf_add;
  694. u32 avail_bytes;
  695. u32 msw_ts;
  696. u32 lsw_ts;
  697. u32 uflags;
  698. u32 uid;
  699. } __attribute__((packed));
  700. #define ASM_DATA_CMD_READ 0x00010BDA
  701. struct asm_stream_cmd_read{
  702. struct apr_hdr hdr;
  703. u32 buf_add;
  704. u32 buf_size;
  705. u32 uid;
  706. } __attribute__((packed));
  707. #define ASM_DATA_CMD_MEDIA_FORMAT_UPDATE 0x00010BDC
  708. #define ASM_DATA_EVENT_MEDIA_FORMAT_UPDATE 0x00010BDE
  709. struct asm_stream_media_format_update{
  710. struct apr_hdr hdr;
  711. u32 format;
  712. u32 cfg_size;
  713. union {
  714. struct asm_pcm_cfg pcm_cfg;
  715. struct asm_adpcm_cfg adpcm_cfg;
  716. struct asm_yadpcm_cfg yadpcm_cfg;
  717. struct asm_midi_cfg midi_cfg;
  718. struct asm_wma_cfg wma_cfg;
  719. struct asm_aac_cfg aac_cfg;
  720. struct asm_flac_cfg flac_cfg;
  721. struct asm_vorbis_cfg vorbis_cfg;
  722. } __attribute__((packed)) write_cfg;
  723. } __attribute__((packed));
  724. /* Command Responses */
  725. #define ASM_STREAM_CMDRSP_GET_ENCDEC_PARAM 0x00010C12
  726. struct asm_stream_cmdrsp_get_readwrite_param{
  727. struct apr_hdr hdr;
  728. u32 status;
  729. u32 param_id;
  730. u16 param_size;
  731. u16 padding;
  732. union {
  733. struct asm_sbc_bitrate sbc_bitrate;
  734. struct asm_aac_immed_decode aac_dec;
  735. } __attribute__((packed)) read_write_cfg;
  736. } __attribute__((packed));
  737. #define ASM_SESSION_CMDRSP_GET_SESSION_TIME 0x00010BD8
  738. struct asm_stream_cmdrsp_get_session_time{
  739. struct apr_hdr hdr;
  740. u32 status;
  741. u32 msw_ts;
  742. u32 lsw_ts;
  743. } __attribute__((packed));
  744. #define ASM_DATA_EVENT_WRITE_DONE 0x00010BDF
  745. struct asm_data_event_write_done{
  746. u32 buf_add;
  747. u32 status;
  748. } __attribute__((packed));
  749. #define ASM_DATA_EVENT_READ_DONE 0x00010BE0
  750. struct asm_data_event_read_done{
  751. u32 status;
  752. u32 buffer_add;
  753. u32 enc_frame_size;
  754. u32 offset;
  755. u32 msw_ts;
  756. u32 lsw_ts;
  757. u32 flags;
  758. u32 num_frames;
  759. u32 id;
  760. } __attribute__((packed));
  761. /* service level events */
  762. #define ASM_SERVICE_CMDRSP_GET_STREAM_HANDLES 0x00010C1B
  763. struct asm_svc_cmdrsp_get_strm_handles{
  764. struct apr_hdr hdr;
  765. u32 num_handles;
  766. u32 stream_handles;
  767. } __attribute__((packed));
  768. #define ASM_SERVICE_CMDRSP_GET_WALLCLOCK_TIME 0x00010C1A
  769. struct asm_svc_cmdrsp_get_wallclock_time{
  770. struct apr_hdr hdr;
  771. u32 status;
  772. u32 msw_ts;
  773. u32 lsw_ts;
  774. } __attribute__((packed));
  775. /*
  776. * Error code
  777. */
  778. #define ADSP_EOK 0x00000000 /* Success / completed / no errors. */
  779. #define ADSP_EFAILED 0x00000001 /* General failure. */
  780. #define ADSP_EBADPARAM 0x00000002 /* Bad operation parameter(s). */
  781. #define ADSP_EUNSUPPORTED 0x00000003 /* Unsupported routine/operation. */
  782. #define ADSP_EVERSION 0x00000004 /* Unsupported version. */
  783. #define ADSP_EUNEXPECTED 0x00000005 /* Unexpected problem encountered. */
  784. #define ADSP_EPANIC 0x00000006 /* Unhandled problem occurred. */
  785. #define ADSP_ENORESOURCE 0x00000007 /* Unable to allocate resource(s). */
  786. #define ADSP_EHANDLE 0x00000008 /* Invalid handle. */
  787. #define ADSP_EALREADY 0x00000009 /* Operation is already processed. */
  788. #define ADSP_ENOTREADY 0x0000000A /* Operation not ready to be processed*/
  789. #define ADSP_EPENDING 0x0000000B /* Operation is pending completion*/
  790. #define ADSP_EBUSY 0x0000000C /* Operation could not be accepted or
  791. processed. */
  792. #define ADSP_EABORTED 0x0000000D /* Operation aborted due to an error. */
  793. #define ADSP_EPREEMPTED 0x0000000E /* Operation preempted by higher priority*/
  794. #define ADSP_ECONTINUE 0x0000000F /* Operation requests intervention
  795. to complete. */
  796. #define ADSP_EIMMEDIATE 0x00000010 /* Operation requests immediate
  797. intervention to complete. */
  798. #define ADSP_ENOTIMPL 0x00000011 /* Operation is not implemented. */
  799. #define ADSP_ENEEDMORE 0x00000012 /* Operation needs more data or resources*/
  800. #endif /*_APR_AUDIO_H_*/