forked from thesofproject/sof
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpipeline.h
More file actions
456 lines (405 loc) · 11.8 KB
/
pipeline.h
File metadata and controls
456 lines (405 loc) · 11.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
/* SPDX-License-Identifier: BSD-3-Clause
*
* Copyright(c) 2021 Intel Corporation. All rights reserved.
*/
/*
* This file contains structures that are exact copies of an existing ABI used
* by IOT middleware. They are Intel specific and will be used by one middleware.
*
* Some of the structures may contain programming implementations that makes them
* unsuitable for generic use and general usage.
*
* This code is mostly copied "as-is" from existing C++ interface files hence the use of
* different style in places. The intention is to keep the interface as close as possible to
* original so it's easier to track changes with IPC host code.
*/
/**
* \file include/ipc4/pipeline.h
* \brief IPC4 pipeline definitions
* NOTE: This ABI uses bit fields and is non portable.
*/
#ifndef __SOF_IPC4_PIPELINE_H__
#define __SOF_IPC4_PIPELINE_H__
#include <stdint.h>
#include <ipc4/error_status.h>
/**< Pipeline priority */
enum ipc4_pipeline_priority {
/**< Priority 0 (run first) */
SOF_IPC4_PIPELINE_PRIORITY_0 = 0,
/**< Priority 1 */
SOF_IPC4_PIPELINE_PRIORITY_1,
/**< Priority 2 */
SOF_IPC4_PIPELINE_PRIORITY_2,
/**< Priority 3 */
SOF_IPC4_PIPELINE_PRIORITY_3,
/**< Priority 4 */
SOF_IPC4_PIPELINE_PRIORITY_4,
/**< Priority 5 */
SOF_IPC4_PIPELINE_PRIORITY_5,
/**< Priority 6 */
SOF_IPC4_PIPELINE_PRIORITY_6,
/**< Priority 7 */
SOF_IPC4_PIPELINE_PRIORITY_7,
/**< Max (and lowest) priority */
SOF_IPC4_MAX_PIPELINE_PRIORITY = SOF_IPC4_PIPELINE_PRIORITY_7
};
/**< Pipeline State */
enum ipc4_pipeline_state {
/**< Invalid value */
SOF_IPC4_PIPELINE_STATE_INVALID = 0,
/**< Created but initialization incomplete */
SOF_IPC4_PIPELINE_STATE_UNINITIALIZED = 1,
/**< Resets pipeline */
SOF_IPC4_PIPELINE_STATE_RESET = 2,
/**< Pauses pipeline */
SOF_IPC4_PIPELINE_STATE_PAUSED = 3,
/**< Starts pipeline */
SOF_IPC4_PIPELINE_STATE_RUNNING = 4,
/**< Marks pipeline as expecting End Of Stream */
SOF_IPC4_PIPELINE_STATE_EOS = 5,
/**< Stopped on error */
SOF_IPC4_PIPELINE_STATE_ERROR_STOP,
/**< Saved to the host memory */
SOF_IPC4_PIPELINE_STATE_SAVED
};
/* IDs for all pipeline ext data types in struct ipc4_pipeline_init_ext_object */
enum ipc4_pipeline_ext_obj_id {
IPC4_GLB_PIPE_EXT_OBJ_ID_INVALID = 0,
IPC4_GLB_PIPE_EXT_OBJ_ID_MEM_DATA = 1,
IPC4_GLB_PIPE_EXT_OBJ_ID_MAX = IPC4_GLB_PIPE_EXT_OBJ_ID_MEM_DATA,
};
/* data object for vendor bespoke data with ABI growth and backwards compat */
struct ipc4_pipeline_ext_object {
uint32_t last_object : 1; /* object is last in array if 1 else object follows. */
uint32_t object_id : 15; /* unique ID for this object or globally */
uint32_t object_words : 16; /* size in dwords (excluding this structure) */
} __packed __aligned(4);
/* the object data will be placed in memory here and will have size "object_words" */
/* Ext array data object for pipeline instance's memory requirements */
struct ipc4_pipeline_ext_obj_mem_data {
uint32_t domain_id; /* userspace domain ID */
uint32_t stack_bytes; /* required stack size in bytes */
uint32_t interim_heap_bytes; /* required interim heap size in bytes */
uint32_t lifetime_heap_bytes; /* required lifetime heap size in bytes */
uint32_t shared_bytes; /* required shared memory in bytes */
} __packed __aligned(4);
/*
* Host Driver sends this message to create a new pipeline instance.
*/
struct ipc4_pipeline_ext_payload {
uint32_t payload_words : 24; /* size in dwords (excluding this structure) */
uint32_t data_obj_array : 1; /* struct ipc4_pipeline_ext_object data */
uint32_t rsvd0 : 7;
uint32_t rsvd1;
uint32_t rsvd2;
} __packed __aligned(4);
/*!
* lp - indicates whether the pipeline should be kept on running in low power
* mode. On BXT the driver should set this flag to 1 for WoV pipeline.
*
* \remark hide_methods
*/
struct ipc4_pipeline_create {
union {
uint32_t dat;
struct {
/**< # pages for pipeline */
uint32_t ppl_mem_size : 11;
/**< priority - uses enum ipc4_pipeline_priority */
uint32_t ppl_priority : 5;
/**< pipeline id */
uint32_t instance_id : 8;
/**< Global::CREATE_PIPELINE */
uint32_t type : 5;
/**< Msg::MSG_REQUEST */
uint32_t rsp : 1;
/**< Msg::FW_GEN_MSG */
uint32_t msg_tgt : 1;
uint32_t _reserved_0 : 1;
} r;
} primary;
union{
uint32_t dat;
struct {
/**< 1 - is low power */
uint32_t lp : 1;
uint32_t rsvd1 : 3;
uint32_t attributes : 16;
uint32_t core_id : 4;
uint32_t rsvd2 : 5;
uint32_t payload : 1;
uint32_t _reserved_2 : 2;
} r;
} extension;
} __attribute__((packed, aligned(4)));
/*!
* SW Driver sends this IPC message to delete a pipeline from ADSP memory.
*
* All module instances and tasks that are associated with the pipeline are
* deleted too.
*
* There must be no existing binding from any pipeline's module instance
* to another pipeline to complete the command successfully.
*
* \remark hide_methods
*/
struct ipc4_pipeline_delete {
union {
uint32_t dat;
struct {
uint32_t rsvd0 : 16;
/**< Ppl instance id */
uint32_t instance_id : 8;
/**< Global::DELETE_PIPELINE */
uint32_t type : 5;
/**< Msg::MSG_REQUEST */
uint32_t rsp : 1;
/**< Msg::FW_GEN_MSG */
uint32_t msg_tgt : 1;
uint32_t _reserved_0 : 1;
} r;
} primary;
union{
uint32_t dat;
struct {
uint32_t rsvd1 : 30;
uint32_t _reserved_2 : 2;
} r;
} extension;
} __attribute__((packed, aligned(4)));
/*!
* Host SW sends this message to set a pipeline to the specified state.
*
* If there are multiple pipelines, from FW input to FW output, connected
* in a data processing stream, the driver should start them in reverse order,
* beginning with pipeline connected to the output gateway, in order to avoid
* overruns (FW protects the output gateway against underruns in this scenario).
*
* If driver starts multiple pipelines using a single Set Pipeline State
* command, it should take care of the pipeline ID order in the command payload
* to follow the above rule.
*
* sync_stop_start indicates whether all specified pipelines' gateways should
* be started with a minimal delay possible. If this flag is set to 0 while
* multiple pipelines are specified, the target pipelines' state is adjusted
* pipeline by pipeline meaning that internal propagation to all child modules
* may take more time between reaching state of attached gateways. Output and
* input gateways are grouped separately, and started/stopped separately.
*
* NOTE: Task Creation/Registration is part of the first state transition.
* There is no other dedicated call for this.
*
* \remark hide_methods
*/
struct ipc4_pipeline_set_state_data {
/**< Number of items in ppl_id[] */
uint32_t pipelines_count;
/**< Pipeline ids */
uint32_t ppl_id[];
} __attribute__((packed, aligned(4)));
struct ipc4_pipeline_set_state {
union {
uint32_t dat;
struct {
/**< new state, one of enum ipc4_pipeline_state */
uint32_t ppl_state : 16;
/**< pipeline instance id (ignored if multi_ppl =1) */
uint32_t ppl_id : 8;
/**< Global::SET_PIPELINE_STATE */
uint32_t type : 5;
/**< Msg::MSG_REQUEST */
uint32_t rsp : 1;
/**< Msg::FW_GEN_MSG */
uint32_t msg_tgt : 1;
uint32_t _reserved_0: 1;
} r;
} primary;
union{
uint32_t dat;
struct {
/**< = 1 if there are more pipeline ids in payload */
uint32_t multi_ppl : 1;
/**< = 1 if FW should sync state change across multiple ppls */
uint32_t sync_stop_start : 1;
uint32_t rsvd1 : 28;
uint32_t _reserved_2: 2;
} r;
} extension;
/* multiple pipeline states */
struct ipc4_pipeline_set_state_data s_data;
} __attribute__((packed, aligned(4)));
/**< Reply to Set Pipeline State */
/*!
* In case of error, there is failed pipeline id reported back.
*
\remark hide_methods
*/
struct ipc4_pipeline_set_state_reply {
union {
uint32_t dat;
struct {
/**< status */
uint32_t status : IPC4_IXC_STATUS_BITS;
/**< Global::SET_PIPELINE_STATE */
uint32_t type : 5;
/**< Msg::MSG_REPLY */
uint32_t rsp : 1;
/**< Msg::FW_GEN_MSG */
uint32_t msg_tgt : 1;
uint32_t _reserved_0: 1;
} r;
} primary;
union{
uint32_t dat;
struct {
/**< id of failed pipeline on error */
uint32_t ppl_id : 30;
uint32_t _reserved_2: 2;
} r;
} extension;
} __attribute__((packed, aligned(4)));
/**< This IPC message is sent to the FW in order to retrieve a pipeline state. */
/*! \remark hide_methods */
struct ipc4_pipeline_get_state {
union {
uint32_t dat;
struct {
/**< pipeline id */
uint32_t ppl_id : 8;
uint32_t rsvd : 16;
/**< Global::GET_PIPELINE_STATE */
uint32_t type : 5;
/**< Msg::MSG_REQUEST */
uint32_t rsp : 1;
/**< Msg::FW_GEN_MSG */
uint32_t msg_tgt : 1;
uint32_t _reserved_0: 1;
} r;
} primary;
union{
uint32_t dat;
struct {
uint32_t rsvd1 : 30;
uint32_t _reserved_2: 2;
} r;
} extension;
} __attribute__((packed, aligned(4)));
/**< Sent by the FW in response to GetPipelineState. */
/*! \remark hide_methods */
struct ipc4_pipeline_get_state_reply {
union {
uint32_t dat;
struct {
/**< status */
uint32_t status :IPC4_IXC_STATUS_BITS;
/**< Global::GET_PIPELINE_STATE */
uint32_t type : 5;
/**< Msg::MSG_REPLY */
uint32_t rsp : 1;
/**< Msg::FW_GEN_MSG */
uint32_t msg_tgt : 1;
uint32_t _reserved_0: 1;
} r;
} primary;
union{
uint32_t dat;
struct {
/**< one of PipelineState */
uint32_t state : 5;
uint32_t rsvd1 : 25;
uint32_t _reserved_2: 2;
} r;
} extension;
} __attribute__((packed, aligned(4)));
/*!
* The size is expressed in number of pages. It is a total number of memory pages
* allocated for pipeline memory buffer and all separately allocated child
* module instances.
*
* \remark hide_methods
*/
struct ipc4_pipeline_get_context_size {
union {
uint32_t dat;
struct {
uint32_t rsvd0 : 16;
/**< pipeline id */
uint32_t instance_id : 8;
/**< Global::GET_PIPELINE_CONTEXT_SIZE */
uint32_t type : 5;
/**< Msg::MSG_REQUEST */
uint32_t rsp : 1;
/**< Msg::FW_GEN_MSG */
uint32_t msg_tgt : 1;
uint32_t _reserved_0 : 1;
} r;
} primary;
union{
uint32_t dat;
struct {
uint32_t rsvd1 : 30;
uint32_t _reserved_2 : 2;
} r;
} extension;
} __attribute__((packed, aligned(4)));
/**< Reply to Get Pipeline Context Size. */
/*! \remark hide_methods */
struct ipc4_pipeline_get_context_size_reply {
union {
uint32_t dat;
struct {
/**< status */
uint32_t status :IPC4_IXC_STATUS_BITS;
/**< Global::GET_PIPELINE_CONTEXT_SIZE */
uint32_t type : 5;
/**< Msg::MSG_REPLY */
uint32_t rsp : 1;
/**< Msg::FW_GEN_MSG */
uint32_t msg_tgt : 1;
uint32_t _reserved_0: 1;
} r;
} primary;
union{
uint32_t dat;
struct {
/**< size of pipeline context (in number of pages) */
uint32_t ctx_size : 16;
uint32_t rsvd1 : 14;
uint32_t _reserved_2: 2;
} r;
} extension;
} __attribute__((packed, aligned(4)));
struct ipc4_chain_dma {
union {
uint32_t dat;
struct {
uint32_t host_dma_id : 5;
uint32_t rsvd4 : 3;
uint32_t link_dma_id : 5;
uint32_t rsvd3 : 3;
/* allocate buffer specified by FIFO size */
uint32_t allocate : 1;
uint32_t enable : 1;
/* controls SCS bit in both Host and Link gateway */
uint32_t scs : 1;
uint32_t rsvd2 : 5;
/* Global::CHAIN_DMA */
uint32_t type : 5;
/* Msg::MSG_REQUEST */
uint32_t rsp : 1;
/* Msg::FW_GEN_MSG */
uint32_t msg_tgt : 1;
uint32_t _reserved_0 : 1;
} r;
} primary;
union {
uint32_t dat;
struct {
/* size of FIFO (bytes) */
uint32_t fifo_size : 24;
uint32_t rsvd1 : 6;
uint32_t _reserved_2 : 2;
} r;
} extension;
} __attribute__((packed, aligned(4)));
#endif