blob: 6e2f63de97564bec2899b7f67c4ff25bce449074 [file] [log] [blame]
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +05301/* Copyright (c) 2011-2014, The Linux Foundation. All rights reserved.
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 */
13#ifndef __APR_US_H__
14#define __APR_US_H__
15
Laxminath Kasam605b42f2017-08-01 22:02:15 +053016#include <ipc/apr.h>
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +053017
18/* ======================================================================= */
19/* Session Level commands */
20
21#define USM_SESSION_CMD_RUN 0x00012306
22struct usm_stream_cmd_run {
23 struct apr_hdr hdr;
24 u32 flags;
25 u32 msw_ts;
26 u32 lsw_ts;
27} __packed;
28
29/* Stream level commands */
30#define USM_STREAM_CMD_OPEN_READ 0x00012309
31struct usm_stream_cmd_open_read {
32 struct apr_hdr hdr;
33 u32 uMode;
34 u32 src_endpoint;
35 u32 pre_proc_top;
36 u32 format;
37} __packed;
38
39#define USM_STREAM_CMD_OPEN_WRITE 0x00011271
40struct usm_stream_cmd_open_write {
41 struct apr_hdr hdr;
42 u32 format;
43} __packed;
44
45
46#define USM_STREAM_CMD_CLOSE 0x0001230A
47
48#define USM_STREAM_CMD_SET_PARAM 0x00012731
49struct usm_stream_cmd_set_param {
50 struct apr_hdr hdr;
51 u32 buf_addr_lsw;
52 u32 buf_addr_msw;
53 u32 mem_map_handle;
54 u32 buf_size;
55 u32 module_id;
56 u32 param_id;
57} __packed;
58
59#define USM_STREAM_CMD_GET_PARAM 0x00012732
60struct usm_stream_cmd_get_param {
61 struct apr_hdr hdr;
62 u32 buf_addr_lsw;
63 u32 buf_addr_msw;
64 u32 mem_map_handle;
65 u32 buf_size;
66 u32 module_id;
67 u32 param_id;
68} __packed;
69
70/* Encoder configuration definitions */
71#define USM_STREAM_CMD_SET_ENC_PARAM 0x0001230B
72/* Decoder configuration definitions */
73#define USM_DATA_CMD_MEDIA_FORMAT_UPDATE 0x00011272
74
75/* Encoder/decoder configuration block */
76#define USM_PARAM_ID_ENCDEC_ENC_CFG_BLK 0x0001230D
77
78/* Max number of static located ports (bytes) */
79#define USM_MAX_PORT_NUMBER 8
80
81/* Max number of static located transparent data (bytes) */
82#define USM_MAX_CFG_DATA_SIZE 100
83
84/* Parameter structures used in USM_STREAM_CMD_SET_ENCDEC_PARAM command */
85/* common declarations */
86struct usm_cfg_common {
87 u16 ch_cfg;
88 u16 bits_per_sample;
89 u32 sample_rate;
90 u32 dev_id;
91 u8 data_map[USM_MAX_PORT_NUMBER];
92} __packed;
93
94struct us_encdec_cfg {
95 u32 format_id;
96 struct usm_cfg_common cfg_common;
97 u16 params_size;
98 u8 *params;
99} __packed;
100
101/* Start/stop US signal detection */
102#define USM_SESSION_CMD_SIGNAL_DETECT_MODE 0x00012719
103
104struct usm_session_cmd_detect_info {
105 struct apr_hdr hdr;
106 u32 detect_mode;
107 u32 skip_interval;
108 u32 algorithm_cfg_size;
109} __packed;
110
111/* US signal detection result */
112#define USM_SESSION_EVENT_SIGNAL_DETECT_RESULT 0x00012720
113
114/* ======================================================================= */
115/* Session Level commands */
116#define USM_CMD_SHARED_MEM_MAP_REGION 0x00012728
117struct usm_cmd_memory_map_region {
118 struct apr_hdr hdr;
119 u16 mempool_id;
120 u16 num_regions;
121 u32 flags;
122 u32 shm_addr_lsw;
123 u32 shm_addr_msw;
124 u32 mem_size_bytes;
125} __packed;
126
127#define USM_CMDRSP_SHARED_MEM_MAP_REGION 0x00012729
128struct usm_cmdrsp_memory_map_region {
129 u32 mem_map_handle;
130} __packed;
131
132#define USM_CMD_SHARED_MEM_UNMAP_REGION 0x0001272A
133struct usm_cmd_memory_unmap_region {
134 struct apr_hdr hdr;
135 u32 mem_map_handle;
136} __packed;
137
138#define USM_DATA_CMD_READ 0x00012724
139struct usm_stream_cmd_read {
140 struct apr_hdr hdr;
141 u32 buf_addr_lsw;
142 u32 buf_addr_msw;
143 u32 mem_map_handle;
144 u32 buf_size;
145 u32 seq_id;
146 u32 counter;
147} __packed;
148
149#define USM_DATA_EVENT_READ_DONE 0x00012725
150
151#define USM_DATA_CMD_WRITE 0x00012726
152struct usm_stream_cmd_write {
153 struct apr_hdr hdr;
154 u32 buf_addr_lsw;
155 u32 buf_addr_msw;
156 u32 mem_map_handle;
157 u32 buf_size;
158 u32 seq_id;
159 u32 res0;
160 u32 res1;
161 u32 res2;
162} __packed;
163
164#define USM_DATA_EVENT_WRITE_DONE 0x00012727
165
166struct usm_stream_media_format_update {
167 struct apr_hdr hdr;
168 u32 format_id;
169 /* <cfg_size> = sizeof(usm_cfg_common)+|transp_data| */
170 u32 cfg_size;
171 struct usm_cfg_common cfg_common;
172 /* Transparent configuration data for specific encoder */
173 u8 transp_data[USM_MAX_CFG_DATA_SIZE];
174} __packed;
175
176struct usm_encode_cfg_blk {
177 u32 frames_per_buf;
178 u32 format_id;
179 /* <cfg_size> = sizeof(usm_cfg_common)+|transp_data| */
180 u32 cfg_size;
181 struct usm_cfg_common cfg_common;
182 /* Transparent configuration data for specific encoder */
183 u8 transp_data[USM_MAX_CFG_DATA_SIZE];
184} __packed;
185
186struct usm_stream_cmd_encdec_cfg_blk {
187 struct apr_hdr hdr;
188 u32 param_id;
189 u32 param_size;
190 struct usm_encode_cfg_blk enc_blk;
191} __packed;
192
193#endif /* __APR_US_H__ */