1/*
2 * dspbridge/mpu_api/inc/wcdioctl.h
3 *
4 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
5 *
6 * Copyright (C) 2007 Texas Instruments, Inc.
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU Lesser General Public License as published
10 * by the Free Software Foundation version 2.1 of the License.
11 *
12 * This program is distributed .as is. WITHOUT ANY WARRANTY of any kind,
13 * whether express or implied; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15 * Lesser General Public License for more details.
16 */
17
18
19/*
20 *  ======== wcdioctl.h ========
21 *  Purpose:
22 *      Contains structures and commands that are used for interaction
23 *      between the DDSP API and class driver.
24 *
25 *! Revision History
26 *! ================
27 *! 19-Apr-2004 sb  Aligned DMM definitions with Symbian
28 *! 08-Mar-2004 sb  Added the Dynamic Memory Mapping structs & offsets
29 *! 15-Oct-2002 kc  Updated definitions for private PERF module.
30 *! 16-Aug-2002 map Added ARGS_MGR_REGISTEROBJECT & ARGS_MGR_UNREGISTEROBJECT
31 *!                 Added CMD_MGR_REGISTEROBJECT_OFFSET &
32 *!                 CMD_MGR_UNREGISTEROBJECT_OFFSET
33 *! 15-Jan-2002 ag  Added actaul bufSize to ARGS_STRM_[RECLAIM][ISSUE].
34 *! 15-Nov-2001 ag  change to STRMINFO in ARGS_STRM_GETINFO.
35 *! 11-Sep-2001 ag  ARGS_CMM_GETHANDLE defn uses DSP_HPROCESSOR.
36 *! 23-Apr-2001 jeh Added pStatus to NODE_TERMINATE args.
37 *! 13-Feb-2001 kc  DSP/BIOS Bridge name updates.
38 *! 22-Nov-2000 kc: Added CMD_MGR_GETPERF_DATA_OFFSET for acquiring PERF stats.
39 *! 27-Oct-2000 jeh Added timeouts to NODE_GETMESSAGE, NODE_PUTMESSAGE args.
40 *!                 Removed NODE_GETMESSAGESTRM args.
41 *! 11-Oct-2000 ag: Added SM mgr(CMM) args.
42 *! 27-Sep-2000 jeh Removed struct DSP_BUFFERATTR param from ARGS_STRM_ALLOCATEBUFFER.
43 *! 25-Sep-2000 rr: Updated to Version 0.9
44 *! 07-Sep-2000 jeh Changed HANDLE to DSP_HNOTIFICATION in RegisterNotify args.
45 *!                 Added DSP_STRMATTR to DSPNode_Connect args.
46 *! 04-Aug-2000 rr: MEM and UTIL added to RM.
47 *! 27-Jul-2000 rr: NODE, MGR,STRM and PROC added
48 *! 27-Jun-2000 rr: Modifed to Use either PM or DSP/BIOS Bridge
49 *!                 IFDEF to build for PM or DSP/BIOS Bridge
50 *! 28-Jan-2000 rr: NT_CMD_FROM_OFFSET moved out to dsptrap.h
51 *! 24-Jan-2000 rr: Merged with Scott's code.
52 *! 21-Jan-2000 sg: In ARGS_CHNL_GETMODE changed mode to be ULONG to be
53 *!                 consistent with chnldefs.h.
54 *! 11-Jan-2000 rr: CMD_CFG_GETCDVERSION_OFFSET added.
55 *! 12-Nov-1999 rr: CMD_BRD_MONITOR_OFFSET added
56 *! 09-Nov-1999 kc: Added MEMRY and enabled CMD_BRD_IOCTL_OFFSET.
57 *! 05-Nov-1999 ag: Added CHNL.
58 *! 02-Nov-1999 kc: Removed field from ARGS_UTIL_TESTDLL.
59 *! 29-Oct-1999 kc: Cleaned up for code review.
60 *! 08-Oct-1999 rr: Util control offsets added.
61 *! 13-Sep-1999 kc: Added ARGS_UTIL_TESTDLL for PM test infrastructure.
62 *! 19-Aug-1999 rr: Created from WSX. Minimal Implementaion of BRD_Start and BRD
63 *!                 and BRD_Stop. IOCTL Offsets and CTRL Code.
64 */
65
66#ifndef WCDIOCTL_
67#define WCDIOCTL_
68
69#include <mem.h>
70#include <cmm.h>
71#include <strmdefs.h>
72#include <dbdcd.h>
73
74typedef union {
75
76	/* MGR Module */
77	struct {
78		UINT uNode;
79		struct DSP_NDBPROPS *pNDBProps;
80		UINT uNDBPropsSize;
81		UINT *puNumNodes;
82	} ARGS_MGR_ENUMNODE_INFO;
83
84	struct {
85		UINT uProcessor;
86		struct DSP_PROCESSORINFO *pProcessorInfo;
87		UINT uProcessorInfoSize;
88		UINT *puNumProcs;
89	} ARGS_MGR_ENUMPROC_INFO;
90
91	struct {
92		struct DSP_UUID *pUuid;
93		DSP_DCDOBJTYPE objType;
94		CHAR *pszPathName;
95	} ARGS_MGR_REGISTEROBJECT;
96
97	struct {
98		struct DSP_UUID *pUuid;
99		DSP_DCDOBJTYPE objType;
100	} ARGS_MGR_UNREGISTEROBJECT;
101
102	struct {
103		struct DSP_NOTIFICATION* *aNotifications;
104		UINT uCount;
105		UINT *puIndex;
106		UINT uTimeout;
107	} ARGS_MGR_WAIT;
108
109	/* PROC Module */
110	struct {
111		UINT uProcessor;
112		struct DSP_PROCESSORATTRIN *pAttrIn;
113		DSP_HPROCESSOR *phProcessor;
114	} ARGS_PROC_ATTACH;
115
116	struct {
117		DSP_HPROCESSOR hProcessor;
118		ULONG dwCmd;
119		struct DSP_CBDATA *pArgs;
120	} ARGS_PROC_CTRL;
121
122	struct {
123		DSP_HPROCESSOR hProcessor;
124	} ARGS_PROC_DETACH;
125
126	struct {
127		DSP_HPROCESSOR hProcessor;
128		DSP_HNODE *aNodeTab;
129		UINT uNodeTabSize;
130		UINT *puNumNodes;
131		UINT *puAllocated;
132	} ARGS_PROC_ENUMNODE_INFO;
133
134	struct {
135		DSP_HPROCESSOR hProcessor;
136		UINT uResourceType;
137		struct DSP_RESOURCEINFO *pResourceInfo;
138		UINT uResourceInfoSize;
139	} ARGS_PROC_ENUMRESOURCES;
140
141	struct {
142		DSP_HPROCESSOR hProcessor;
143		struct DSP_PROCESSORSTATE *pProcStatus;
144		UINT uStateInfoSize;
145	} ARGS_PROC_GETSTATE;
146
147	struct {
148		DSP_HPROCESSOR hProcessor;
149		BYTE *pBuf;
150
151	#ifndef RES_CLEANUP_DISABLE
152	    BYTE *  pSize;
153    #endif
154		UINT uMaxSize;
155	} ARGS_PROC_GETTRACE;
156
157	struct {
158		DSP_HPROCESSOR hProcessor;
159		INT iArgc;
160		CHAR **aArgv;
161		CHAR **aEnvp;
162	} ARGS_PROC_LOAD;
163
164	struct {
165		DSP_HPROCESSOR hProcessor;
166		UINT uEventMask;
167		UINT uNotifyType;
168		struct DSP_NOTIFICATION* hNotification;
169	} ARGS_PROC_REGISTER_NOTIFY;
170
171	struct {
172		DSP_HPROCESSOR hProcessor;
173	} ARGS_PROC_START;
174
175	struct {
176		DSP_HPROCESSOR hProcessor;
177		ULONG ulSize;
178		PVOID *ppRsvAddr;
179	} ARGS_PROC_RSVMEM;
180
181	struct {
182		DSP_HPROCESSOR hProcessor;
183		ULONG ulSize;
184		PVOID pRsvAddr;
185	} ARGS_PROC_UNRSVMEM;
186
187	struct {
188		DSP_HPROCESSOR hProcessor;
189		PVOID pMpuAddr;
190		ULONG ulSize;
191		PVOID pReqAddr;
192		PVOID *ppMapAddr;
193		ULONG ulMapAttr;
194	} ARGS_PROC_MAPMEM;
195
196	struct {
197		DSP_HPROCESSOR hProcessor;
198		ULONG ulSize;
199		PVOID pMapAddr;
200	} ARGS_PROC_UNMAPMEM;
201
202	struct {
203		DSP_HPROCESSOR hProcessor;
204		PVOID pMpuAddr;
205		ULONG ulSize;
206		ULONG ulFlags;
207	} ARGS_PROC_FLUSHMEMORY;
208
209	struct {
210		DSP_HPROCESSOR hProcessor;
211	} ARGS_PROC_STOP;
212
213	struct {
214                DSP_HPROCESSOR hProcessor;
215                PVOID pMpuAddr;
216                ULONG ulSize;
217        } ARGS_PROC_INVALIDATEMEMORY;
218
219
220	/* NODE Module */
221	struct {
222		DSP_HPROCESSOR hProcessor;
223		struct DSP_UUID *pNodeID;
224		struct DSP_CBDATA *pArgs;
225		struct DSP_NODEATTRIN *pAttrIn;
226		DSP_HNODE *phNode;
227	} ARGS_NODE_ALLOCATE;
228
229	struct {
230		DSP_HNODE hNode;
231		UINT uSize;
232		struct DSP_BUFFERATTR *pAttr;
233		BYTE **pBuffer;
234	} ARGS_NODE_ALLOCMSGBUF;
235
236	struct {
237		DSP_HNODE hNode;
238		INT iPriority;
239	} ARGS_NODE_CHANGEPRIORITY;
240
241	struct {
242		DSP_HNODE hNode;
243		UINT uStream;
244		DSP_HNODE hOtherNode;
245		UINT uOtherStream;
246		struct DSP_STRMATTR *pAttrs;
247		struct DSP_CBDATA *pConnParam;
248	} ARGS_NODE_CONNECT;
249
250	struct {
251		DSP_HNODE hNode;
252	} ARGS_NODE_CREATE;
253
254	struct {
255		DSP_HNODE hNode;
256	} ARGS_NODE_DELETE;
257
258	struct {
259		DSP_HNODE hNode;
260		struct DSP_BUFFERATTR *pAttr;
261		BYTE *pBuffer;
262	} ARGS_NODE_FREEMSGBUF;
263
264	struct {
265		DSP_HNODE hNode;
266		struct DSP_NODEATTR *pAttr;
267		UINT uAttrSize;
268	} ARGS_NODE_GETATTR;
269
270	struct {
271		DSP_HNODE hNode;
272		struct DSP_MSG *pMessage;
273		UINT uTimeout;
274	} ARGS_NODE_GETMESSAGE;
275
276	struct {
277		DSP_HNODE hNode;
278	} ARGS_NODE_PAUSE;
279
280	struct {
281		DSP_HNODE hNode;
282		struct DSP_MSG *pMessage;
283		UINT uTimeout;
284	} ARGS_NODE_PUTMESSAGE;
285
286	struct {
287		DSP_HNODE hNode;
288		UINT uEventMask;
289		UINT uNotifyType;
290		struct DSP_NOTIFICATION* hNotification;
291	} ARGS_NODE_REGISTERNOTIFY;
292
293	struct {
294		DSP_HNODE hNode;
295	} ARGS_NODE_RUN;
296
297	struct {
298		DSP_HNODE hNode;
299		DSP_STATUS *pStatus;
300	} ARGS_NODE_TERMINATE;
301
302	struct {
303		DSP_HPROCESSOR hProcessor;
304		struct DSP_UUID *pNodeID;
305		struct DSP_NDBPROPS *pNodeProps;
306	} ARGS_NODE_GETUUIDPROPS;
307
308        /* STRM module */
309
310	struct {
311		DSP_HSTREAM hStream;
312		UINT uSize;
313		BYTE **apBuffer;
314		UINT uNumBufs;
315	} ARGS_STRM_ALLOCATEBUFFER;
316
317	struct {
318		DSP_HSTREAM hStream;
319	} ARGS_STRM_CLOSE;
320
321	struct {
322		DSP_HSTREAM hStream;
323		BYTE **apBuffer;
324		UINT uNumBufs;
325	} ARGS_STRM_FREEBUFFER;
326
327	struct {
328		DSP_HSTREAM hStream;
329		HANDLE *phEvent;
330	} ARGS_STRM_GETEVENTHANDLE;
331
332	struct {
333		DSP_HSTREAM hStream;
334		struct STRM_INFO *pStreamInfo;
335		UINT uStreamInfoSize;
336	} ARGS_STRM_GETINFO;
337
338	struct {
339		DSP_HSTREAM hStream;
340		bool bFlush;
341	} ARGS_STRM_IDLE;
342
343	struct {
344		DSP_HSTREAM hStream;
345		BYTE *pBuffer;
346		ULONG dwBytes;
347		ULONG dwBufSize;
348		DWORD dwArg;
349	} ARGS_STRM_ISSUE;
350
351	struct {
352		DSP_HNODE hNode;
353		UINT uDirection;
354		UINT uIndex;
355		struct STRM_ATTR *pAttrIn;
356		DSP_HSTREAM *phStream;
357	} ARGS_STRM_OPEN;
358
359	struct {
360		DSP_HSTREAM hStream;
361		BYTE **pBufPtr;
362		ULONG *pBytes;
363		ULONG *pBufSize;
364		DWORD *pdwArg;
365	} ARGS_STRM_RECLAIM;
366
367	struct {
368		DSP_HSTREAM hStream;
369		UINT uEventMask;
370		UINT uNotifyType;
371		struct DSP_NOTIFICATION* hNotification;
372	} ARGS_STRM_REGISTERNOTIFY;
373
374	struct {
375		DSP_HSTREAM *aStreamTab;
376		UINT nStreams;
377		UINT *pMask;
378		UINT uTimeout;
379	} ARGS_STRM_SELECT;
380
381	/* CMM Module */
382	struct {
383		struct CMM_OBJECT* hCmmMgr;
384		UINT uSize;
385		struct CMM_ATTRS *pAttrs;
386		OUT PVOID *ppBufVA;
387	} ARGS_CMM_ALLOCBUF;
388
389	struct {
390		struct CMM_OBJECT* hCmmMgr;
391		PVOID pBufPA;
392		ULONG ulSegId;
393	} ARGS_CMM_FREEBUF;
394
395	struct {
396		DSP_HPROCESSOR hProcessor;
397		struct CMM_OBJECT* *phCmmMgr;
398	} ARGS_CMM_GETHANDLE;
399
400	struct {
401		struct CMM_OBJECT* hCmmMgr;
402		struct CMM_INFO *pCmmInfo;
403	} ARGS_CMM_GETINFO;
404
405	/* MEM Module */
406	struct {
407		ULONG cBytes;
408		MEM_POOLATTRS type;
409		PVOID pMem;
410	} ARGS_MEM_ALLOC;
411
412	struct {
413		ULONG cBytes;
414		MEM_POOLATTRS type;
415		PVOID pMem;
416	} ARGS_MEM_CALLOC;
417
418	struct {
419		PVOID pMem;
420	} ARGS_MEM_FREE;
421
422	struct {
423		PVOID pBuffer;
424		ULONG cSize;
425		PVOID pLockedBuffer;
426	} ARGS_MEM_PAGELOCK;
427
428	struct {
429		PVOID pBuffer;
430		ULONG cSize;
431	} ARGS_MEM_PAGEUNLOCK;
432
433	/* UTIL module */
434	struct {
435		INT cArgc;
436		CHAR **ppArgv;
437	} ARGS_UTIL_TESTDLL;
438
439} Trapped_Args;
440
441#define CMD_BASE                    100
442
443/* MGR module offsets */
444#define CMD_MGR_BASE_OFFSET             CMD_BASE
445#define CMD_MGR_ENUMNODE_INFO_OFFSET    (CMD_MGR_BASE_OFFSET + 0)
446#define CMD_MGR_ENUMPROC_INFO_OFFSET    (CMD_MGR_BASE_OFFSET + 1)
447#define CMD_MGR_REGISTEROBJECT_OFFSET   (CMD_MGR_BASE_OFFSET + 2)
448#define CMD_MGR_UNREGISTEROBJECT_OFFSET (CMD_MGR_BASE_OFFSET + 3)
449#define CMD_MGR_WAIT_OFFSET             (CMD_MGR_BASE_OFFSET + 4)
450
451#ifndef RES_CLEANUP_DISABLE
452#define CMD_MGR_RESOUCES_OFFSET         (CMD_MGR_BASE_OFFSET + 5)
453#define CMD_MGR_END_OFFSET              CMD_MGR_RESOUCES_OFFSET
454#else
455#define CMD_MGR_END_OFFSET              CMD_MGR_WAIT_OFFSET
456#endif
457
458#define CMD_PROC_BASE_OFFSET            (CMD_MGR_END_OFFSET + 1)
459#define CMD_PROC_ATTACH_OFFSET          (CMD_PROC_BASE_OFFSET + 0)
460#define CMD_PROC_CTRL_OFFSET            (CMD_PROC_BASE_OFFSET + 1)
461#define CMD_PROC_DETACH_OFFSET          (CMD_PROC_BASE_OFFSET + 2)
462#define CMD_PROC_ENUMNODE_OFFSET        (CMD_PROC_BASE_OFFSET + 3)
463#define CMD_PROC_ENUMRESOURCES_OFFSET   (CMD_PROC_BASE_OFFSET + 4)
464#define CMD_PROC_GETSTATE_OFFSET        (CMD_PROC_BASE_OFFSET + 5)
465#define CMD_PROC_GETTRACE_OFFSET        (CMD_PROC_BASE_OFFSET + 6)
466#define CMD_PROC_LOAD_OFFSET            (CMD_PROC_BASE_OFFSET + 7)
467#define CMD_PROC_REGISTERNOTIFY_OFFSET  (CMD_PROC_BASE_OFFSET + 8)
468#define CMD_PROC_START_OFFSET           (CMD_PROC_BASE_OFFSET + 9)
469#define CMD_PROC_RSVMEM_OFFSET          (CMD_PROC_BASE_OFFSET + 10)
470#define CMD_PROC_UNRSVMEM_OFFSET        (CMD_PROC_BASE_OFFSET + 11)
471#define CMD_PROC_MAPMEM_OFFSET          (CMD_PROC_BASE_OFFSET + 12)
472#define CMD_PROC_UNMAPMEM_OFFSET        (CMD_PROC_BASE_OFFSET + 13)
473#define CMD_PROC_FLUSHMEMORY_OFFSET      (CMD_PROC_BASE_OFFSET + 14)
474#define CMD_PROC_STOP_OFFSET            (CMD_PROC_BASE_OFFSET + 15)
475#define CMD_PROC_INVALIDATEMEMORY_OFFSET (CMD_PROC_BASE_OFFSET + 16)
476#define CMD_PROC_END_OFFSET             CMD_PROC_INVALIDATEMEMORY_OFFSET
477
478
479#define CMD_NODE_BASE_OFFSET            (CMD_PROC_END_OFFSET + 1)
480#define CMD_NODE_ALLOCATE_OFFSET        (CMD_NODE_BASE_OFFSET + 0)
481#define CMD_NODE_ALLOCMSGBUF_OFFSET     (CMD_NODE_BASE_OFFSET + 1)
482#define CMD_NODE_CHANGEPRIORITY_OFFSET  (CMD_NODE_BASE_OFFSET + 2)
483#define CMD_NODE_CONNECT_OFFSET         (CMD_NODE_BASE_OFFSET + 3)
484#define CMD_NODE_CREATE_OFFSET          (CMD_NODE_BASE_OFFSET + 4)
485#define CMD_NODE_DELETE_OFFSET          (CMD_NODE_BASE_OFFSET + 5)
486#define CMD_NODE_FREEMSGBUF_OFFSET      (CMD_NODE_BASE_OFFSET + 6)
487#define CMD_NODE_GETATTR_OFFSET         (CMD_NODE_BASE_OFFSET + 7)
488#define CMD_NODE_GETMESSAGE_OFFSET      (CMD_NODE_BASE_OFFSET + 8)
489#define CMD_NODE_PAUSE_OFFSET           (CMD_NODE_BASE_OFFSET + 9)
490#define CMD_NODE_PUTMESSAGE_OFFSET      (CMD_NODE_BASE_OFFSET + 10)
491#define CMD_NODE_REGISTERNOTIFY_OFFSET  (CMD_NODE_BASE_OFFSET + 11)
492#define CMD_NODE_RUN_OFFSET             (CMD_NODE_BASE_OFFSET + 12)
493#define CMD_NODE_TERMINATE_OFFSET       (CMD_NODE_BASE_OFFSET + 13)
494#define CMD_NODE_GETUUIDPROPS_OFFSET    (CMD_NODE_BASE_OFFSET + 14)
495#define CMD_NODE_END_OFFSET             CMD_NODE_GETUUIDPROPS_OFFSET
496
497#define CMD_STRM_BASE_OFFSET            (CMD_NODE_END_OFFSET + 1)
498#define CMD_STRM_ALLOCATEBUFFER_OFFSET  (CMD_STRM_BASE_OFFSET + 0)
499#define CMD_STRM_CLOSE_OFFSET           (CMD_STRM_BASE_OFFSET + 1)
500#define CMD_STRM_FREEBUFFER_OFFSET      (CMD_STRM_BASE_OFFSET + 2)
501#define CMD_STRM_GETEVENTHANDLE_OFFSET  (CMD_STRM_BASE_OFFSET + 3)
502#define CMD_STRM_GETINFO_OFFSET         (CMD_STRM_BASE_OFFSET + 4)
503#define CMD_STRM_IDLE_OFFSET            (CMD_STRM_BASE_OFFSET + 5)
504#define CMD_STRM_ISSUE_OFFSET           (CMD_STRM_BASE_OFFSET + 6)
505#define CMD_STRM_OPEN_OFFSET            (CMD_STRM_BASE_OFFSET + 7)
506#define CMD_STRM_RECLAIM_OFFSET         (CMD_STRM_BASE_OFFSET + 8)
507#define CMD_STRM_REGISTERNOTIFY_OFFSET  (CMD_STRM_BASE_OFFSET + 9)
508#define CMD_STRM_SELECT_OFFSET          (CMD_STRM_BASE_OFFSET + 10)
509#define CMD_STRM_END_OFFSET             CMD_STRM_SELECT_OFFSET
510
511/* Communication Memory Manager (UCMM) */
512#define CMD_CMM_BASE_OFFSET             (CMD_STRM_END_OFFSET + 1)
513#define CMD_CMM_ALLOCBUF_OFFSET         (CMD_CMM_BASE_OFFSET + 0)
514#define CMD_CMM_FREEBUF_OFFSET          (CMD_CMM_BASE_OFFSET + 1)
515#define CMD_CMM_GETHANDLE_OFFSET        (CMD_CMM_BASE_OFFSET + 2)
516#define CMD_CMM_GETINFO_OFFSET          (CMD_CMM_BASE_OFFSET + 3)
517#define CMD_CMM_END_OFFSET              CMD_CMM_GETINFO_OFFSET
518
519/* MEMRY module offsets */
520#define CMD_MEM_BASE_OFFSET             (CMD_CMM_END_OFFSET + 1)
521#define CMD_MEM_ALLOC_OFFSET            (CMD_MEM_BASE_OFFSET + 0)
522#define CMD_MEM_CALLOC_OFFSET           (CMD_MEM_BASE_OFFSET + 1)
523#define CMD_MEM_FREE_OFFSET             (CMD_MEM_BASE_OFFSET + 2)
524#define CMD_MEM_PAGELOCK_OFFSET         (CMD_MEM_BASE_OFFSET + 3)
525#define CMD_MEM_PAGEUNLOCK_OFFSET       (CMD_MEM_BASE_OFFSET + 4)
526#define CMD_MEM_END_OFFSET              CMD_MEM_PAGEUNLOCK_OFFSET
527
528/* UTIL module */
529#define CMD_UTIL_BASE_OFFSET            (CMD_MEM_END_OFFSET + 1)
530#define CMD_UTIL_TESTDLL_OFFSET         (CMD_UTIL_BASE_OFFSET + 0)
531#define CMD_UTIL_END_OFFSET             CMD_UTIL_TESTDLL_OFFSET
532
533/* !!! place all command modules before CMD_BASE_END_OFFSET */
534#define CMD_BASE_END_OFFSET             CMD_UTIL_END_OFFSET
535
536#endif				/* WCDIOCTL_ */
537