1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19#ifndef DBDEFS_
20#define DBDEFS_
21
22#include <linux/types.h>
23
24#include <dspbridge/rms_sh.h>
25
26#define PG_SIZE4K 4096
27#define PG_MASK(pg_size) (~((pg_size)-1))
28#define PG_ALIGN_LOW(addr, pg_size) ((addr) & PG_MASK(pg_size))
29#define PG_ALIGN_HIGH(addr, pg_size) (((addr)+(pg_size)-1) & PG_MASK(pg_size))
30
31
32#define DBAPI int
33
34
35#define DSP_MAXNAMELEN 32
36
37
38#define DSP_SIGNALEVENT 0x00000001
39
40
41#define DSP_PROCESSORSTATECHANGE 0x00000001
42#define DSP_PROCESSORATTACH 0x00000002
43#define DSP_PROCESSORDETACH 0x00000004
44#define DSP_PROCESSORRESTART 0x00000008
45
46
47#define DSP_MMUFAULT 0x00000010
48#define DSP_SYSERROR 0x00000020
49#define DSP_EXCEPTIONABORT 0x00000300
50#define DSP_PWRERROR 0x00000080
51#define DSP_WDTOVERFLOW 0x00000040
52
53
54#define IVA_MMUFAULT 0x00000040
55
56#define DSP_NODESTATECHANGE 0x00000100
57#define DSP_NODEMESSAGEREADY 0x00000200
58
59
60#define DSP_STREAMDONE 0x00001000
61#define DSP_STREAMIOCOMPLETION 0x00002000
62
63
64#define DSP_HGPPNODE 0xFFFFFFFF
65
66
67#define DSP_TONODE 1
68#define DSP_FROMNODE 2
69
70
71#define DSP_NODE_MIN_PRIORITY 1
72#define DSP_NODE_MAX_PRIORITY 15
73
74
75#define DSP_RMSBUFDESC RMS_BUFDESC
76
77
78#define DSP_UNIT 0
79#define IVA_UNIT 1
80
81#define DSPWORD unsigned char
82#define DSPWORDSIZE sizeof(DSPWORD)
83
84#define MAX_PROFILES 16
85
86
87#define DSPTYPE64 0x99
88
89
90#define VALID_PROC_EVENT (DSP_PROCESSORSTATECHANGE | DSP_PROCESSORATTACH | \
91 DSP_PROCESSORDETACH | DSP_PROCESSORRESTART | DSP_NODESTATECHANGE | \
92 DSP_STREAMDONE | DSP_STREAMIOCOMPLETION | DSP_MMUFAULT | \
93 DSP_SYSERROR | DSP_WDTOVERFLOW | DSP_PWRERROR)
94
95static inline bool is_valid_proc_event(u32 x)
96{
97 return (x == 0 || (x & VALID_PROC_EVENT && !(x & ~VALID_PROC_EVENT)));
98}
99
100
101struct dsp_uuid {
102 u32 data1;
103 u16 data2;
104 u16 data3;
105 u8 data4;
106 u8 data5;
107 u8 data6[6];
108};
109
110
111enum dsp_dcdobjtype {
112 DSP_DCDNODETYPE,
113 DSP_DCDPROCESSORTYPE,
114 DSP_DCDLIBRARYTYPE,
115 DSP_DCDCREATELIBTYPE,
116 DSP_DCDEXECUTELIBTYPE,
117 DSP_DCDDELETELIBTYPE,
118
119 DSP_DCDMAXOBJTYPE
120};
121
122
123enum dsp_procstate {
124 PROC_STOPPED,
125 PROC_LOADED,
126 PROC_RUNNING,
127 PROC_ERROR
128};
129
130
131
132
133
134
135
136enum node_type {
137 NODE_DEVICE,
138 NODE_TASK,
139 NODE_DAISSOCKET,
140 NODE_MESSAGE,
141 NODE_GPP
142};
143
144
145
146
147
148enum node_state {
149 NODE_ALLOCATED,
150 NODE_CREATED,
151 NODE_RUNNING,
152 NODE_PAUSED,
153 NODE_DONE,
154 NODE_CREATING,
155 NODE_STARTING,
156 NODE_PAUSING,
157 NODE_TERMINATING,
158 NODE_DELETING,
159};
160
161
162enum dsp_streamstate {
163 STREAM_IDLE,
164 STREAM_READY,
165 STREAM_PENDING,
166 STREAM_DONE
167};
168
169
170enum dsp_connecttype {
171 CONNECTTYPE_NODEOUTPUT,
172 CONNECTTYPE_GPPOUTPUT,
173 CONNECTTYPE_NODEINPUT,
174 CONNECTTYPE_GPPINPUT
175};
176
177
178enum dsp_strmmode {
179 STRMMODE_PROCCOPY,
180 STRMMODE_ZEROCOPY,
181 STRMMODE_LDMA,
182 STRMMODE_RDMA
183};
184
185
186enum dsp_resourceinfotype {
187 DSP_RESOURCE_DYNDARAM = 0,
188 DSP_RESOURCE_DYNSARAM,
189 DSP_RESOURCE_DYNEXTERNAL,
190 DSP_RESOURCE_DYNSRAM,
191 DSP_RESOURCE_PROCLOAD
192};
193
194
195enum dsp_memtype {
196 DSP_DYNDARAM = 0,
197 DSP_DYNSARAM,
198 DSP_DYNEXTERNAL,
199 DSP_DYNSRAM
200};
201
202
203enum dsp_flushtype {
204 PROC_INVALIDATE_MEM = 0,
205 PROC_WRITEBACK_MEM,
206 PROC_WRITEBACK_INVALIDATE_MEM,
207};
208
209
210struct dsp_memstat {
211 u32 size;
212 u32 total_free_size;
213 u32 len_max_free_block;
214 u32 num_free_blocks;
215 u32 num_alloc_blocks;
216};
217
218
219struct dsp_procloadstat {
220 u32 curr_load;
221 u32 predicted_load;
222 u32 curr_dsp_freq;
223 u32 predicted_freq;
224};
225
226
227struct dsp_strmattr {
228 u32 seg_id;
229 u32 buf_size;
230 u32 num_bufs;
231 u32 buf_alignment;
232 u32 timeout;
233 enum dsp_strmmode strm_mode;
234
235 u32 dma_chnl_id;
236 u32 dma_priority;
237};
238
239
240struct dsp_cbdata {
241 u32 cb_data;
242 u8 node_data[1];
243};
244
245
246struct dsp_msg {
247 u32 cmd;
248 u32 arg1;
249 u32 arg2;
250};
251
252
253struct dsp_resourcereqmts {
254 u32 cb_struct;
255 u32 static_data_size;
256 u32 global_data_size;
257 u32 program_mem_size;
258 u32 wc_execution_time;
259 u32 wc_period;
260 u32 wc_deadline;
261 u32 avg_exection_time;
262 u32 minimum_period;
263};
264
265
266
267
268
269struct dsp_streamconnect {
270 u32 cb_struct;
271 enum dsp_connecttype connect_type;
272 u32 this_node_stream_index;
273 void *connected_node;
274 struct dsp_uuid ui_connected_node_id;
275 u32 connected_node_stream_index;
276};
277
278struct dsp_nodeprofs {
279 u32 heap_size;
280};
281
282
283struct dsp_ndbprops {
284 u32 cb_struct;
285 struct dsp_uuid ui_node_id;
286 char ac_name[DSP_MAXNAMELEN];
287 enum node_type ntype;
288 u32 cache_on_gpp;
289 struct dsp_resourcereqmts dsp_resource_reqmts;
290 s32 prio;
291 u32 stack_size;
292 u32 sys_stack_size;
293 u32 stack_seg;
294 u32 message_depth;
295 u32 num_input_streams;
296 u32 num_output_streams;
297 u32 timeout;
298 u32 count_profiles;
299
300 struct dsp_nodeprofs node_profiles[MAX_PROFILES];
301 u32 stack_seg_name;
302};
303
304
305
306struct dsp_nodeattrin {
307 u32 cb_struct;
308 s32 prio;
309 u32 timeout;
310 u32 profile_id;
311
312 u32 heap_size;
313 void *pgpp_virt_addr;
314};
315
316
317
318struct dsp_nodeinfo {
319 u32 cb_struct;
320 struct dsp_ndbprops nb_node_database_props;
321 u32 execution_priority;
322 enum node_state ns_execution_state;
323 void *device_owner;
324 u32 number_streams;
325 struct dsp_streamconnect sc_stream_connection[16];
326 u32 node_env;
327};
328
329
330struct dsp_nodeattr {
331 u32 cb_struct;
332 struct dsp_nodeattrin in_node_attr_in;
333 u32 node_attr_inputs;
334 u32 node_attr_outputs;
335 struct dsp_nodeinfo node_info;
336};
337
338
339
340
341
342struct dsp_notification {
343 char *name;
344 void *handle;
345};
346
347
348struct dsp_processorattrin {
349 u32 cb_struct;
350 u32 timeout;
351};
352
353
354
355
356struct dsp_processorinfo {
357 u32 cb_struct;
358 int processor_family;
359 int processor_type;
360 u32 clock_rate;
361 u32 internal_mem_size;
362 u32 external_mem_size;
363 u32 processor_id;
364 int ty_running_rtos;
365 s32 node_min_priority;
366 s32 node_max_priority;
367};
368
369
370struct dsp_errorinfo {
371 u32 err_mask;
372 u32 val1;
373 u32 val2;
374 u32 val3;
375};
376
377
378struct dsp_processorstate {
379 u32 cb_struct;
380 enum dsp_procstate proc_state;
381};
382
383
384
385
386
387struct dsp_resourceinfo {
388 u32 cb_struct;
389 enum dsp_resourceinfotype resource_type;
390 union {
391 u32 resource;
392 struct dsp_memstat mem_stat;
393 struct dsp_procloadstat proc_load_stat;
394 } result;
395};
396
397
398
399
400
401
402struct dsp_streamattrin {
403 u32 cb_struct;
404 u32 timeout;
405 u32 segment_id;
406 u32 buf_alignment;
407 u32 num_bufs;
408 enum dsp_strmmode strm_mode;
409 u32 dma_chnl_id;
410 u32 dma_priority;
411};
412
413
414struct dsp_bufferattr {
415 u32 cb_struct;
416 u32 segment_id;
417 u32 buf_alignment;
418};
419
420
421
422
423
424struct dsp_streaminfo {
425 u32 cb_struct;
426 u32 number_bufs_allowed;
427 u32 number_bufs_in_stream;
428 u32 number_bytes;
429 void *sync_object_handle;
430 enum dsp_streamstate ss_stream_state;
431};
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450#define DSP_MAPVIRTUALADDR 0x00000000
451#define DSP_MAPPHYSICALADDR 0x00000001
452
453
454#define DSP_MAPBIGENDIAN 0x00000002
455#define DSP_MAPLITTLEENDIAN 0x00000000
456
457
458#define DSP_MAPMIXEDELEMSIZE 0x00000004
459
460
461
462
463
464#define DSP_MAPELEMSIZE8 0x00000008
465#define DSP_MAPELEMSIZE16 0x00000010
466#define DSP_MAPELEMSIZE32 0x00000020
467#define DSP_MAPELEMSIZE64 0x00000040
468
469#define DSP_MAPVMALLOCADDR 0x00000080
470
471#define DSP_MAPDONOTLOCK 0x00000100
472
473#define DSP_MAP_DIR_MASK 0x3FFF
474
475#define GEM_CACHE_LINE_SIZE 128
476#define GEM_L1P_PREFETCH_SIZE 128
477
478
479
480
481
482#define DSPPROCTYPE_C64 6410
483#define IVAPROCTYPE_ARM7 470
484
485
486#define MAXREGPATHLENGTH 255
487
488#endif
489