GUI: Fix Tomato RAF theme for all builds. Compilation typo.
[tomato.git] / release / src-rt-6.x.4708 / linux / linux-2.6.36 / drivers / staging / tidspbridge / include / dspbridge / dbdefs.h
blob5af075def8713a17a24f9de38b4632c5a2f7aa39
1 /*
2 * dbdefs.h
4 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
6 * Global definitions and constants for DSP/BIOS Bridge.
8 * Copyright (C) 2005-2006 Texas Instruments, Inc.
10 * This package is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
14 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
15 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
16 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
19 #ifndef DBDEFS_
20 #define DBDEFS_
22 #include <linux/types.h>
24 #include <dspbridge/rms_sh.h> /* Types shared between GPP and DSP */
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))
31 /* API return value and calling convention */
32 #define DBAPI int
34 /* Infinite time value for the utimeout parameter to DSPStream_Select() */
35 #define DSP_FOREVER (-1)
37 /* Maximum length of node name, used in dsp_ndbprops */
38 #define DSP_MAXNAMELEN 32
40 /* notify_type values for the RegisterNotify() functions. */
41 #define DSP_SIGNALEVENT 0x00000001
43 /* Types of events for processors */
44 #define DSP_PROCESSORSTATECHANGE 0x00000001
45 #define DSP_PROCESSORATTACH 0x00000002
46 #define DSP_PROCESSORDETACH 0x00000004
47 #define DSP_PROCESSORRESTART 0x00000008
49 /* DSP exception events (DSP/BIOS and DSP MMU fault) */
50 #define DSP_MMUFAULT 0x00000010
51 #define DSP_SYSERROR 0x00000020
52 #define DSP_EXCEPTIONABORT 0x00000300
53 #define DSP_PWRERROR 0x00000080
54 #define DSP_WDTOVERFLOW 0x00000040
56 /* IVA exception events (IVA MMU fault) */
57 #define IVA_MMUFAULT 0x00000040
58 /* Types of events for nodes */
59 #define DSP_NODESTATECHANGE 0x00000100
60 #define DSP_NODEMESSAGEREADY 0x00000200
62 /* Types of events for streams */
63 #define DSP_STREAMDONE 0x00001000
64 #define DSP_STREAMIOCOMPLETION 0x00002000
66 /* Handle definition representing the GPP node in DSPNode_Connect() calls */
67 #define DSP_HGPPNODE 0xFFFFFFFF
69 /* Node directions used in DSPNode_Connect() */
70 #define DSP_TONODE 1
71 #define DSP_FROMNODE 2
73 /* Define Node Minimum and Maximum Priorities */
74 #define DSP_NODE_MIN_PRIORITY 1
75 #define DSP_NODE_MAX_PRIORITY 15
77 /* Pre-Defined Message Command Codes available to user: */
78 #define DSP_RMSUSERCODESTART RMS_USER /* Start of RMS user cmd codes */
79 /* end of user codes */
80 #define DSP_RMSUSERCODEEND (RMS_USER + RMS_MAXUSERCODES);
81 /* msg_ctrl contains SM buffer description */
82 #define DSP_RMSBUFDESC RMS_BUFDESC
84 /* Shared memory identifier for MEM segment named "SHMSEG0" */
85 #define DSP_SHMSEG0 (u32)(-1)
87 /* Processor ID numbers */
88 #define DSP_UNIT 0
89 #define IVA_UNIT 1
91 #define DSPWORD unsigned char
92 #define DSPWORDSIZE sizeof(DSPWORD)
94 /* Power control enumerations */
95 #define PROC_PWRCONTROL 0x8070
97 #define PROC_PWRMGT_ENABLE (PROC_PWRCONTROL + 0x3)
98 #define PROC_PWRMGT_DISABLE (PROC_PWRCONTROL + 0x4)
100 /* Bridge Code Version */
101 #define BRIDGE_VERSION_CODE 333
103 #define MAX_PROFILES 16
105 /* DSP chip type */
106 #define DSPTYPE64 0x99
108 /* Handy Macros */
109 #define VALID_PROC_EVENT (DSP_PROCESSORSTATECHANGE | DSP_PROCESSORATTACH | \
110 DSP_PROCESSORDETACH | DSP_PROCESSORRESTART | DSP_NODESTATECHANGE | \
111 DSP_STREAMDONE | DSP_STREAMIOCOMPLETION | DSP_MMUFAULT | \
112 DSP_SYSERROR | DSP_WDTOVERFLOW | DSP_PWRERROR)
114 static inline bool is_valid_proc_event(u32 x)
116 return (x == 0 || (x & VALID_PROC_EVENT && !(x & ~VALID_PROC_EVENT)));
119 /* The Node UUID structure */
120 struct dsp_uuid {
121 u32 ul_data1;
122 u16 us_data2;
123 u16 us_data3;
124 u8 uc_data4;
125 u8 uc_data5;
126 u8 uc_data6[6];
129 /* DCD types */
130 enum dsp_dcdobjtype {
131 DSP_DCDNODETYPE,
132 DSP_DCDPROCESSORTYPE,
133 DSP_DCDLIBRARYTYPE,
134 DSP_DCDCREATELIBTYPE,
135 DSP_DCDEXECUTELIBTYPE,
136 DSP_DCDDELETELIBTYPE,
137 /* DSP_DCDMAXOBJTYPE is meant to be the last DCD object type */
138 DSP_DCDMAXOBJTYPE
141 /* Processor states */
142 enum dsp_procstate {
143 PROC_STOPPED,
144 PROC_LOADED,
145 PROC_RUNNING,
146 PROC_ERROR
150 * Node types: Message node, task node, xDAIS socket node, and
151 * device node. _NODE_GPP is used when defining a stream connection
152 * between a task or socket node and the GPP.
155 enum node_type {
156 NODE_DEVICE,
157 NODE_TASK,
158 NODE_DAISSOCKET,
159 NODE_MESSAGE,
160 NODE_GPP
164 * ======== node_state ========
165 * Internal node states.
167 enum node_state {
168 NODE_ALLOCATED,
169 NODE_CREATED,
170 NODE_RUNNING,
171 NODE_PAUSED,
172 NODE_DONE,
173 NODE_CREATING,
174 NODE_STARTING,
175 NODE_PAUSING,
176 NODE_TERMINATING,
177 NODE_DELETING,
180 /* Stream states */
181 enum dsp_streamstate {
182 STREAM_IDLE,
183 STREAM_READY,
184 STREAM_PENDING,
185 STREAM_DONE
188 /* Stream connect types */
189 enum dsp_connecttype {
190 CONNECTTYPE_NODEOUTPUT,
191 CONNECTTYPE_GPPOUTPUT,
192 CONNECTTYPE_NODEINPUT,
193 CONNECTTYPE_GPPINPUT
196 /* Stream mode types */
197 enum dsp_strmmode {
198 STRMMODE_PROCCOPY, /* Processor(s) copy stream data payloads */
199 STRMMODE_ZEROCOPY, /* Strm buffer ptrs swapped no data copied */
200 STRMMODE_LDMA, /* Local DMA : OMAP's System-DMA device */
201 STRMMODE_RDMA /* Remote DMA: OMAP's DSP-DMA device */
204 /* Resource Types */
205 enum dsp_resourceinfotype {
206 DSP_RESOURCE_DYNDARAM = 0,
207 DSP_RESOURCE_DYNSARAM,
208 DSP_RESOURCE_DYNEXTERNAL,
209 DSP_RESOURCE_DYNSRAM,
210 DSP_RESOURCE_PROCLOAD
213 /* Memory Segment Types */
214 enum dsp_memtype {
215 DSP_DYNDARAM = 0,
216 DSP_DYNSARAM,
217 DSP_DYNEXTERNAL,
218 DSP_DYNSRAM
221 /* Memory Flush Types */
222 enum dsp_flushtype {
223 PROC_INVALIDATE_MEM = 0,
224 PROC_WRITEBACK_MEM,
225 PROC_WRITEBACK_INVALIDATE_MEM,
228 /* Memory Segment Status Values */
229 struct dsp_memstat {
230 u32 ul_size;
231 u32 ul_total_free_size;
232 u32 ul_len_max_free_block;
233 u32 ul_num_free_blocks;
234 u32 ul_num_alloc_blocks;
237 /* Processor Load information Values */
238 struct dsp_procloadstat {
239 u32 curr_load;
240 u32 predicted_load;
241 u32 curr_dsp_freq;
242 u32 predicted_freq;
245 /* Attributes for STRM connections between nodes */
246 struct dsp_strmattr {
247 u32 seg_id; /* Memory segment on DSP to allocate buffers */
248 u32 buf_size; /* Buffer size (DSP words) */
249 u32 num_bufs; /* Number of buffers */
250 u32 buf_alignment; /* Buffer alignment */
251 u32 utimeout; /* Timeout for blocking STRM calls */
252 enum dsp_strmmode strm_mode; /* mode of stream when opened */
253 /* DMA chnl id if dsp_strmmode is LDMA or RDMA */
254 u32 udma_chnl_id;
255 u32 udma_priority; /* DMA channel priority 0=lowest, >0=high */
258 /* The dsp_cbdata structure */
259 struct dsp_cbdata {
260 u32 cb_data;
261 u8 node_data[1];
264 /* The dsp_msg structure */
265 struct dsp_msg {
266 u32 dw_cmd;
267 u32 dw_arg1;
268 u32 dw_arg2;
271 /* The dsp_resourcereqmts structure for node's resource requirements */
272 struct dsp_resourcereqmts {
273 u32 cb_struct;
274 u32 static_data_size;
275 u32 global_data_size;
276 u32 program_mem_size;
277 u32 uwc_execution_time;
278 u32 uwc_period;
279 u32 uwc_deadline;
280 u32 avg_exection_time;
281 u32 minimum_period;
285 * The dsp_streamconnect structure describes a stream connection
286 * between two nodes, or between a node and the GPP
288 struct dsp_streamconnect {
289 u32 cb_struct;
290 enum dsp_connecttype connect_type;
291 u32 this_node_stream_index;
292 void *connected_node;
293 struct dsp_uuid ui_connected_node_id;
294 u32 connected_node_stream_index;
297 struct dsp_nodeprofs {
298 u32 ul_heap_size;
301 /* The dsp_ndbprops structure reports the attributes of a node */
302 struct dsp_ndbprops {
303 u32 cb_struct;
304 struct dsp_uuid ui_node_id;
305 char ac_name[DSP_MAXNAMELEN];
306 enum node_type ntype;
307 u32 cache_on_gpp;
308 struct dsp_resourcereqmts dsp_resource_reqmts;
309 s32 prio;
310 u32 stack_size;
311 u32 sys_stack_size;
312 u32 stack_seg;
313 u32 message_depth;
314 u32 num_input_streams;
315 u32 num_output_streams;
316 u32 utimeout;
317 u32 count_profiles; /* Number of supported profiles */
318 /* Array of profiles */
319 struct dsp_nodeprofs node_profiles[MAX_PROFILES];
320 u32 stack_seg_name; /* Stack Segment Name */
323 /* The dsp_nodeattrin structure describes the attributes of a
324 * node client */
325 struct dsp_nodeattrin {
326 u32 cb_struct;
327 s32 prio;
328 u32 utimeout;
329 u32 profile_id;
330 /* Reserved, for Bridge Internal use only */
331 u32 heap_size;
332 void *pgpp_virt_addr; /* Reserved, for Bridge Internal use only */
335 /* The dsp_nodeinfo structure is used to retrieve information
336 * about a node */
337 struct dsp_nodeinfo {
338 u32 cb_struct;
339 struct dsp_ndbprops nb_node_database_props;
340 u32 execution_priority;
341 enum node_state ns_execution_state;
342 void *device_owner;
343 u32 number_streams;
344 struct dsp_streamconnect sc_stream_connection[16];
345 u32 node_env;
348 /* The dsp_nodeattr structure describes the attributes of a node */
349 struct dsp_nodeattr {
350 u32 cb_struct;
351 struct dsp_nodeattrin in_node_attr_in;
352 u32 node_attr_inputs;
353 u32 node_attr_outputs;
354 struct dsp_nodeinfo node_info;
358 * Notification type: either the name of an opened event, or an event or
359 * window handle.
361 struct dsp_notification {
362 char *ps_name;
363 void *handle;
366 /* The dsp_processorattrin structure describes the attributes of a processor */
367 struct dsp_processorattrin {
368 u32 cb_struct;
369 u32 utimeout;
372 * The dsp_processorinfo structure describes basic capabilities of a
373 * DSP processor
375 struct dsp_processorinfo {
376 u32 cb_struct;
377 int processor_family;
378 int processor_type;
379 u32 clock_rate;
380 u32 ul_internal_mem_size;
381 u32 ul_external_mem_size;
382 u32 processor_id;
383 int ty_running_rtos;
384 s32 node_min_priority;
385 s32 node_max_priority;
388 /* Error information of last DSP exception signalled to the GPP */
389 struct dsp_errorinfo {
390 u32 dw_err_mask;
391 u32 dw_val1;
392 u32 dw_val2;
393 u32 dw_val3;
396 /* The dsp_processorstate structure describes the state of a DSP processor */
397 struct dsp_processorstate {
398 u32 cb_struct;
399 enum dsp_procstate proc_state;
403 * The dsp_resourceinfo structure is used to retrieve information about a
404 * processor's resources
406 struct dsp_resourceinfo {
407 u32 cb_struct;
408 enum dsp_resourceinfotype resource_type;
409 union {
410 u32 ul_resource;
411 struct dsp_memstat mem_stat;
412 struct dsp_procloadstat proc_load_stat;
413 } result;
417 * The dsp_streamattrin structure describes the attributes of a stream,
418 * including segment and alignment of data buffers allocated with
419 * DSPStream_AllocateBuffers(), if applicable
421 struct dsp_streamattrin {
422 u32 cb_struct;
423 u32 utimeout;
424 u32 segment_id;
425 u32 buf_alignment;
426 u32 num_bufs;
427 enum dsp_strmmode strm_mode;
428 u32 udma_chnl_id;
429 u32 udma_priority;
432 /* The dsp_bufferattr structure describes the attributes of a data buffer */
433 struct dsp_bufferattr {
434 u32 cb_struct;
435 u32 segment_id;
436 u32 buf_alignment;
440 * The dsp_streaminfo structure is used to retrieve information
441 * about a stream.
443 struct dsp_streaminfo {
444 u32 cb_struct;
445 u32 number_bufs_allowed;
446 u32 number_bufs_in_stream;
447 u32 ul_number_bytes;
448 void *sync_object_handle;
449 enum dsp_streamstate ss_stream_state;
452 /* DMM MAP attributes
453 It is a bit mask with each bit value indicating a specific attribute
454 bit 0 - GPP address type (user virtual=0, physical=1)
455 bit 1 - MMU Endianism (Big Endian=1, Little Endian=0)
456 bit 2 - MMU mixed page attribute (Mixed/ CPUES=1, TLBES =0)
457 bit 3 - MMU element size = 8bit (valid only for non mixed page entries)
458 bit 4 - MMU element size = 16bit (valid only for non mixed page entries)
459 bit 5 - MMU element size = 32bit (valid only for non mixed page entries)
460 bit 6 - MMU element size = 64bit (valid only for non mixed page entries)
462 bit 14 - Input (read only) buffer
463 bit 15 - Output (writeable) buffer
466 /* Types of mapping attributes */
468 /* MPU address is virtual and needs to be translated to physical addr */
469 #define DSP_MAPVIRTUALADDR 0x00000000
470 #define DSP_MAPPHYSICALADDR 0x00000001
472 /* Mapped data is big endian */
473 #define DSP_MAPBIGENDIAN 0x00000002
474 #define DSP_MAPLITTLEENDIAN 0x00000000
476 /* Element size is based on DSP r/w access size */
477 #define DSP_MAPMIXEDELEMSIZE 0x00000004
480 * Element size for MMU mapping (8, 16, 32, or 64 bit)
481 * Ignored if DSP_MAPMIXEDELEMSIZE enabled
483 #define DSP_MAPELEMSIZE8 0x00000008
484 #define DSP_MAPELEMSIZE16 0x00000010
485 #define DSP_MAPELEMSIZE32 0x00000020
486 #define DSP_MAPELEMSIZE64 0x00000040
488 #define DSP_MAPVMALLOCADDR 0x00000080
490 #define DSP_MAPDONOTLOCK 0x00000100
492 #define DSP_MAP_DIR_MASK 0x3FFF
494 #define GEM_CACHE_LINE_SIZE 128
495 #define GEM_L1P_PREFETCH_SIZE 128
498 * Definitions from dbreg.h
501 #define DSPPROCTYPE_C64 6410
502 #define IVAPROCTYPE_ARM7 470
504 #define REG_MGR_OBJECT 1
505 #define REG_DRV_OBJECT 2
507 /* registry */
508 #define DRVOBJECT "DrvObject"
509 #define MGROBJECT "MgrObject"
511 /* Max registry path length. Also the max registry value length. */
512 #define MAXREGPATHLENGTH 255
514 #endif /* DBDEFS_ */