diff options
Diffstat (limited to 'jacinto6/sgx_src/eurasia_km/tools/intern/debug/dbgdriv/common/ioctl.c')
-rw-r--r-- | jacinto6/sgx_src/eurasia_km/tools/intern/debug/dbgdriv/common/ioctl.c | 827 |
1 files changed, 827 insertions, 0 deletions
diff --git a/jacinto6/sgx_src/eurasia_km/tools/intern/debug/dbgdriv/common/ioctl.c b/jacinto6/sgx_src/eurasia_km/tools/intern/debug/dbgdriv/common/ioctl.c new file mode 100644 index 0000000..1767a9b --- /dev/null +++ b/jacinto6/sgx_src/eurasia_km/tools/intern/debug/dbgdriv/common/ioctl.c | |||
@@ -0,0 +1,827 @@ | |||
1 | /*************************************************************************/ /*! | ||
2 | @Title IOCTL implementations for debug device. | ||
3 | @Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved | ||
4 | @License Dual MIT/GPLv2 | ||
5 | |||
6 | The contents of this file are subject to the MIT license as set out below. | ||
7 | |||
8 | Permission is hereby granted, free of charge, to any person obtaining a copy | ||
9 | of this software and associated documentation files (the "Software"), to deal | ||
10 | in the Software without restriction, including without limitation the rights | ||
11 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
12 | copies of the Software, and to permit persons to whom the Software is | ||
13 | furnished to do so, subject to the following conditions: | ||
14 | |||
15 | The above copyright notice and this permission notice shall be included in | ||
16 | all copies or substantial portions of the Software. | ||
17 | |||
18 | Alternatively, the contents of this file may be used under the terms of | ||
19 | the GNU General Public License Version 2 ("GPL") in which case the provisions | ||
20 | of GPL are applicable instead of those above. | ||
21 | |||
22 | If you wish to allow use of your version of this file only under the terms of | ||
23 | GPL, and not to allow others to use your version of this file under the terms | ||
24 | of the MIT license, indicate your decision by deleting the provisions above | ||
25 | and replace them with the notice and other provisions required by GPL as set | ||
26 | out in the file called "GPL-COPYING" included in this distribution. If you do | ||
27 | not delete the provisions above, a recipient may use your version of this file | ||
28 | under the terms of either the MIT license or GPL. | ||
29 | |||
30 | This License is also included in this distribution in the file called | ||
31 | "MIT-COPYING". | ||
32 | |||
33 | EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS | ||
34 | PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING | ||
35 | BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR | ||
36 | PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR | ||
37 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
38 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
39 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
40 | */ /**************************************************************************/ | ||
41 | |||
42 | |||
43 | #ifdef LINUX | ||
44 | #include <asm/uaccess.h> | ||
45 | #include "pvr_uaccess.h" | ||
46 | #endif /* LINUX */ | ||
47 | |||
48 | #include "img_types.h" | ||
49 | #include "dbgdrvif.h" | ||
50 | #include "dbgdriv.h" | ||
51 | #include "hotkey.h" | ||
52 | #include "dbgdriv_ioctl.h" | ||
53 | |||
54 | |||
55 | /***************************************************************************** | ||
56 | Code | ||
57 | *****************************************************************************/ | ||
58 | |||
59 | /***************************************************************************** | ||
60 | FUNCTION : DBGDrivCreateStream | ||
61 | |||
62 | PURPOSE : | ||
63 | |||
64 | PARAMETERS : | ||
65 | |||
66 | RETURNS : | ||
67 | *****************************************************************************/ | ||
68 | static IMG_UINT32 DBGDIOCDrivCreateStream(IMG_VOID * pvInBuffer, IMG_VOID * pvOutBuffer) | ||
69 | { | ||
70 | PDBG_IN_CREATESTREAM psIn; | ||
71 | IMG_VOID * *ppvOut; | ||
72 | #ifdef LINUX | ||
73 | static IMG_CHAR name[32]; | ||
74 | #endif | ||
75 | |||
76 | psIn = (PDBG_IN_CREATESTREAM) pvInBuffer; | ||
77 | ppvOut = (IMG_VOID * *) pvOutBuffer; | ||
78 | |||
79 | #ifdef LINUX | ||
80 | |||
81 | if(pvr_copy_from_user(name, psIn->u.pszName, 32) != 0) | ||
82 | { | ||
83 | return IMG_FALSE; | ||
84 | } | ||
85 | |||
86 | *ppvOut = ExtDBGDrivCreateStream(name, psIn->ui32CapMode, psIn->ui32OutMode, 0, psIn->ui32Pages); | ||
87 | |||
88 | #else | ||
89 | *ppvOut = ExtDBGDrivCreateStream(psIn->u.pszName, psIn->ui32CapMode, psIn->ui32OutMode, DEBUG_FLAGS_NO_BUF_EXPANDSION, psIn->ui32Pages); | ||
90 | #endif | ||
91 | |||
92 | |||
93 | return(IMG_TRUE); | ||
94 | } | ||
95 | |||
96 | /***************************************************************************** | ||
97 | FUNCTION : DBGDrivDestroyStream | ||
98 | |||
99 | PURPOSE : | ||
100 | |||
101 | PARAMETERS : | ||
102 | |||
103 | RETURNS : | ||
104 | *****************************************************************************/ | ||
105 | static IMG_UINT32 DBGDIOCDrivDestroyStream(IMG_VOID * pvInBuffer, IMG_VOID * pvOutBuffer) | ||
106 | { | ||
107 | PDBG_STREAM *ppsStream; | ||
108 | PDBG_STREAM psStream; | ||
109 | |||
110 | ppsStream = (PDBG_STREAM *) pvInBuffer; | ||
111 | psStream = (PDBG_STREAM) *ppsStream; | ||
112 | |||
113 | PVR_UNREFERENCED_PARAMETER( pvOutBuffer); | ||
114 | |||
115 | ExtDBGDrivDestroyStream(psStream); | ||
116 | |||
117 | return(IMG_TRUE); | ||
118 | } | ||
119 | |||
120 | /***************************************************************************** | ||
121 | FUNCTION : DBGDrivGetStream | ||
122 | |||
123 | PURPOSE : | ||
124 | |||
125 | PARAMETERS : | ||
126 | |||
127 | RETURNS : | ||
128 | *****************************************************************************/ | ||
129 | static IMG_UINT32 DBGDIOCDrivGetStream(IMG_VOID * pvInBuffer, IMG_VOID * pvOutBuffer) | ||
130 | { | ||
131 | PDBG_IN_FINDSTREAM psParams; | ||
132 | IMG_SID * phStream; | ||
133 | |||
134 | psParams = (PDBG_IN_FINDSTREAM)pvInBuffer; | ||
135 | phStream = (IMG_SID *)pvOutBuffer; | ||
136 | |||
137 | *phStream = PStream2SID(ExtDBGDrivFindStream(psParams->u.pszName, psParams->bResetStream)); | ||
138 | |||
139 | return(IMG_TRUE); | ||
140 | } | ||
141 | |||
142 | /***************************************************************************** | ||
143 | FUNCTION : DBGDrivWriteString | ||
144 | |||
145 | PURPOSE : | ||
146 | |||
147 | PARAMETERS : | ||
148 | |||
149 | RETURNS : | ||
150 | *****************************************************************************/ | ||
151 | static IMG_UINT32 DBGDIOCDrivWriteString(IMG_VOID * pvInBuffer, IMG_VOID * pvOutBuffer) | ||
152 | { | ||
153 | PDBG_IN_WRITESTRING psParams; | ||
154 | IMG_UINT32 *pui32OutLen; | ||
155 | PDBG_STREAM psStream; | ||
156 | |||
157 | psParams = (PDBG_IN_WRITESTRING) pvInBuffer; | ||
158 | pui32OutLen = (IMG_UINT32 *) pvOutBuffer; | ||
159 | |||
160 | psStream = SID2PStream(psParams->hStream); | ||
161 | if (psStream != (PDBG_STREAM)IMG_NULL) | ||
162 | { | ||
163 | *pui32OutLen = ExtDBGDrivWriteString(psStream,psParams->u.pszString,psParams->ui32Level); | ||
164 | return(IMG_TRUE); | ||
165 | } | ||
166 | else | ||
167 | { | ||
168 | /* invalid SID */ | ||
169 | *pui32OutLen = 0; | ||
170 | return(IMG_FALSE); | ||
171 | } | ||
172 | } | ||
173 | |||
174 | /***************************************************************************** | ||
175 | FUNCTION : DBGDrivWriteStringCM | ||
176 | |||
177 | PURPOSE : Same as DBGDrivWriteString, but takes notice of capture mode. | ||
178 | |||
179 | PARAMETERS : | ||
180 | |||
181 | RETURNS : | ||
182 | *****************************************************************************/ | ||
183 | static IMG_UINT32 DBGDIOCDrivWriteStringCM(IMG_VOID * pvInBuffer, IMG_VOID * pvOutBuffer) | ||
184 | { | ||
185 | PDBG_IN_WRITESTRING psParams; | ||
186 | IMG_UINT32 *pui32OutLen; | ||
187 | PDBG_STREAM psStream; | ||
188 | |||
189 | psParams = (PDBG_IN_WRITESTRING) pvInBuffer; | ||
190 | pui32OutLen = (IMG_UINT32 *) pvOutBuffer; | ||
191 | |||
192 | psStream = SID2PStream(psParams->hStream); | ||
193 | if (psStream != (PDBG_STREAM)IMG_NULL) | ||
194 | { | ||
195 | *pui32OutLen = ExtDBGDrivWriteStringCM(psStream,psParams->u.pszString,psParams->ui32Level); | ||
196 | return(IMG_TRUE); | ||
197 | } | ||
198 | else | ||
199 | { | ||
200 | /* invalid SID */ | ||
201 | *pui32OutLen = 0; | ||
202 | return(IMG_FALSE); | ||
203 | } | ||
204 | } | ||
205 | |||
206 | /***************************************************************************** | ||
207 | FUNCTION : DBGDrivReadString | ||
208 | |||
209 | PURPOSE : | ||
210 | |||
211 | PARAMETERS : | ||
212 | |||
213 | RETURNS : | ||
214 | *****************************************************************************/ | ||
215 | static IMG_UINT32 DBGDIOCDrivReadString(IMG_VOID * pvInBuffer, IMG_VOID * pvOutBuffer) | ||
216 | { | ||
217 | IMG_UINT32 * pui32OutLen; | ||
218 | PDBG_IN_READSTRING psParams; | ||
219 | PDBG_STREAM psStream; | ||
220 | |||
221 | psParams = (PDBG_IN_READSTRING) pvInBuffer; | ||
222 | pui32OutLen = (IMG_UINT32 *) pvOutBuffer; | ||
223 | |||
224 | psStream = SID2PStream(psParams->hStream); | ||
225 | if (psStream != (PDBG_STREAM)IMG_NULL) | ||
226 | { | ||
227 | *pui32OutLen = ExtDBGDrivReadString(psStream, | ||
228 | psParams->u.pszString,psParams->ui32StringLen); | ||
229 | return(IMG_TRUE); | ||
230 | } | ||
231 | else | ||
232 | { | ||
233 | /* invalid SID */ | ||
234 | *pui32OutLen = 0; | ||
235 | return(IMG_FALSE); | ||
236 | } | ||
237 | } | ||
238 | |||
239 | /***************************************************************************** | ||
240 | FUNCTION : DBGDrivWrite | ||
241 | |||
242 | PURPOSE : | ||
243 | |||
244 | PARAMETERS : | ||
245 | |||
246 | RETURNS : | ||
247 | *****************************************************************************/ | ||
248 | static IMG_UINT32 DBGDIOCDrivWrite(IMG_VOID * pvInBuffer, IMG_VOID * pvOutBuffer) | ||
249 | { | ||
250 | IMG_UINT32 * pui32BytesCopied; | ||
251 | PDBG_IN_WRITE psInParams; | ||
252 | PDBG_STREAM psStream; | ||
253 | |||
254 | psInParams = (PDBG_IN_WRITE) pvInBuffer; | ||
255 | pui32BytesCopied = (IMG_UINT32 *) pvOutBuffer; | ||
256 | |||
257 | psStream = SID2PStream(psInParams->hStream); | ||
258 | if (psStream != (PDBG_STREAM)IMG_NULL) | ||
259 | { | ||
260 | *pui32BytesCopied = ExtDBGDrivWrite(psStream, | ||
261 | psInParams->u.pui8InBuffer, | ||
262 | psInParams->ui32TransferSize, | ||
263 | psInParams->ui32Level); | ||
264 | return(IMG_TRUE); | ||
265 | } | ||
266 | else | ||
267 | { | ||
268 | /* invalid SID */ | ||
269 | *pui32BytesCopied = 0; | ||
270 | return(IMG_FALSE); | ||
271 | } | ||
272 | } | ||
273 | |||
274 | /***************************************************************************** | ||
275 | FUNCTION : DBGDrivWrite2 | ||
276 | |||
277 | PURPOSE : | ||
278 | |||
279 | PARAMETERS : | ||
280 | |||
281 | RETURNS : | ||
282 | *****************************************************************************/ | ||
283 | static IMG_UINT32 DBGDIOCDrivWrite2(IMG_VOID * pvInBuffer, IMG_VOID * pvOutBuffer) | ||
284 | { | ||
285 | IMG_UINT32 * pui32BytesCopied; | ||
286 | PDBG_IN_WRITE psInParams; | ||
287 | PDBG_STREAM psStream; | ||
288 | |||
289 | psInParams = (PDBG_IN_WRITE) pvInBuffer; | ||
290 | pui32BytesCopied = (IMG_UINT32 *) pvOutBuffer; | ||
291 | |||
292 | psStream = SID2PStream(psInParams->hStream); | ||
293 | if (psStream != (PDBG_STREAM)IMG_NULL) | ||
294 | { | ||
295 | *pui32BytesCopied = ExtDBGDrivWrite2(psStream, | ||
296 | psInParams->u.pui8InBuffer, | ||
297 | psInParams->ui32TransferSize, | ||
298 | psInParams->ui32Level); | ||
299 | return(IMG_TRUE); | ||
300 | } | ||
301 | else | ||
302 | { | ||
303 | /* invalid SID */ | ||
304 | *pui32BytesCopied = 0; | ||
305 | return(IMG_FALSE); | ||
306 | } | ||
307 | } | ||
308 | |||
309 | /***************************************************************************** | ||
310 | FUNCTION : DBGDrivWriteCM | ||
311 | |||
312 | PURPOSE : Same as DBGDIOCDrivWrite2, but takes notice of capture mode. | ||
313 | |||
314 | PARAMETERS : | ||
315 | |||
316 | RETURNS : | ||
317 | *****************************************************************************/ | ||
318 | static IMG_UINT32 DBGDIOCDrivWriteCM(IMG_VOID * pvInBuffer, IMG_VOID * pvOutBuffer) | ||
319 | { | ||
320 | IMG_UINT32 * pui32BytesCopied; | ||
321 | PDBG_IN_WRITE psInParams; | ||
322 | PDBG_STREAM psStream; | ||
323 | |||
324 | psInParams = (PDBG_IN_WRITE) pvInBuffer; | ||
325 | pui32BytesCopied = (IMG_UINT32 *) pvOutBuffer; | ||
326 | |||
327 | psStream = SID2PStream(psInParams->hStream); | ||
328 | if (psStream != (PDBG_STREAM)IMG_NULL) | ||
329 | { | ||
330 | *pui32BytesCopied = ExtDBGDrivWriteCM(psStream, | ||
331 | psInParams->u.pui8InBuffer, | ||
332 | psInParams->ui32TransferSize, | ||
333 | psInParams->ui32Level); | ||
334 | return(IMG_TRUE); | ||
335 | } | ||
336 | else | ||
337 | { | ||
338 | /* invalid SID */ | ||
339 | *pui32BytesCopied = 0; | ||
340 | return(IMG_FALSE); | ||
341 | } | ||
342 | } | ||
343 | |||
344 | /***************************************************************************** | ||
345 | FUNCTION : DBGDrivRead | ||
346 | |||
347 | PURPOSE : | ||
348 | |||
349 | PARAMETERS : | ||
350 | |||
351 | RETURNS : | ||
352 | *****************************************************************************/ | ||
353 | static IMG_UINT32 DBGDIOCDrivRead(IMG_VOID * pvInBuffer, IMG_VOID * pvOutBuffer) | ||
354 | { | ||
355 | IMG_UINT32 * pui32BytesCopied; | ||
356 | PDBG_IN_READ psInParams; | ||
357 | PDBG_STREAM psStream; | ||
358 | |||
359 | psInParams = (PDBG_IN_READ) pvInBuffer; | ||
360 | pui32BytesCopied = (IMG_UINT32 *) pvOutBuffer; | ||
361 | |||
362 | psStream = SID2PStream(psInParams->hStream); | ||
363 | if (psStream != (PDBG_STREAM)IMG_NULL) | ||
364 | { | ||
365 | *pui32BytesCopied = ExtDBGDrivRead(psStream, | ||
366 | psInParams->bReadInitBuffer, | ||
367 | psInParams->ui32OutBufferSize, | ||
368 | psInParams->u.pui8OutBuffer); | ||
369 | return(IMG_TRUE); | ||
370 | } | ||
371 | else | ||
372 | { | ||
373 | /* invalid SID */ | ||
374 | *pui32BytesCopied = 0; | ||
375 | return(IMG_FALSE); | ||
376 | } | ||
377 | } | ||
378 | |||
379 | /***************************************************************************** | ||
380 | FUNCTION : DBGDIOCDrivSetCaptureMode | ||
381 | |||
382 | PURPOSE : | ||
383 | |||
384 | PARAMETERS : | ||
385 | |||
386 | RETURNS : | ||
387 | *****************************************************************************/ | ||
388 | static IMG_UINT32 DBGDIOCDrivSetCaptureMode(IMG_VOID * pvInBuffer, IMG_VOID * pvOutBuffer) | ||
389 | { | ||
390 | PDBG_IN_SETDEBUGMODE psParams; | ||
391 | PDBG_STREAM psStream; | ||
392 | |||
393 | psParams = (PDBG_IN_SETDEBUGMODE) pvInBuffer; | ||
394 | PVR_UNREFERENCED_PARAMETER(pvOutBuffer); | ||
395 | |||
396 | psStream = SID2PStream(psParams->hStream); | ||
397 | if (psStream != (PDBG_STREAM)IMG_NULL) | ||
398 | { | ||
399 | ExtDBGDrivSetCaptureMode(psStream, | ||
400 | psParams->ui32Mode, | ||
401 | psParams->ui32Start, | ||
402 | psParams->ui32End, | ||
403 | psParams->ui32SampleRate); | ||
404 | return(IMG_TRUE); | ||
405 | } | ||
406 | else | ||
407 | { | ||
408 | /* invalid SID */ | ||
409 | return(IMG_FALSE); | ||
410 | } | ||
411 | } | ||
412 | |||
413 | /***************************************************************************** | ||
414 | FUNCTION : DBGDIOCDrivSetOutMode | ||
415 | |||
416 | PURPOSE : | ||
417 | |||
418 | PARAMETERS : | ||
419 | |||
420 | RETURNS : | ||
421 | *****************************************************************************/ | ||
422 | static IMG_UINT32 DBGDIOCDrivSetOutMode(IMG_VOID * pvInBuffer, IMG_VOID * pvOutBuffer) | ||
423 | { | ||
424 | PDBG_IN_SETDEBUGOUTMODE psParams; | ||
425 | PDBG_STREAM psStream; | ||
426 | |||
427 | psParams = (PDBG_IN_SETDEBUGOUTMODE) pvInBuffer; | ||
428 | PVR_UNREFERENCED_PARAMETER(pvOutBuffer); | ||
429 | |||
430 | psStream = SID2PStream(psParams->hStream); | ||
431 | if (psStream != (PDBG_STREAM)IMG_NULL) | ||
432 | { | ||
433 | ExtDBGDrivSetOutputMode(psStream,psParams->ui32Mode); | ||
434 | return(IMG_TRUE); | ||
435 | } | ||
436 | else | ||
437 | { | ||
438 | /* invalid SID */ | ||
439 | return(IMG_FALSE); | ||
440 | } | ||
441 | } | ||
442 | |||
443 | /***************************************************************************** | ||
444 | FUNCTION : DBGDIOCDrivSetDebugLevel | ||
445 | |||
446 | PURPOSE : | ||
447 | |||
448 | PARAMETERS : | ||
449 | |||
450 | RETURNS : | ||
451 | *****************************************************************************/ | ||
452 | static IMG_UINT32 DBGDIOCDrivSetDebugLevel(IMG_VOID * pvInBuffer, IMG_VOID * pvOutBuffer) | ||
453 | { | ||
454 | PDBG_IN_SETDEBUGLEVEL psParams; | ||
455 | PDBG_STREAM psStream; | ||
456 | |||
457 | psParams = (PDBG_IN_SETDEBUGLEVEL) pvInBuffer; | ||
458 | PVR_UNREFERENCED_PARAMETER(pvOutBuffer); | ||
459 | |||
460 | psStream = SID2PStream(psParams->hStream); | ||
461 | if (psStream != (PDBG_STREAM)IMG_NULL) | ||
462 | { | ||
463 | ExtDBGDrivSetDebugLevel(psStream,psParams->ui32Level); | ||
464 | return(IMG_TRUE); | ||
465 | } | ||
466 | else | ||
467 | { | ||
468 | /* invalid SID */ | ||
469 | return(IMG_FALSE); | ||
470 | } | ||
471 | } | ||
472 | |||
473 | /***************************************************************************** | ||
474 | FUNCTION : DBGDrivSetFrame | ||
475 | |||
476 | PURPOSE : | ||
477 | |||
478 | PARAMETERS : | ||
479 | |||
480 | RETURNS : | ||
481 | *****************************************************************************/ | ||
482 | static IMG_UINT32 DBGDIOCDrivSetFrame(IMG_VOID * pvInBuffer, IMG_VOID * pvOutBuffer) | ||
483 | { | ||
484 | PDBG_IN_SETFRAME psParams; | ||
485 | PDBG_STREAM psStream; | ||
486 | |||
487 | psParams = (PDBG_IN_SETFRAME) pvInBuffer; | ||
488 | PVR_UNREFERENCED_PARAMETER(pvOutBuffer); | ||
489 | |||
490 | psStream = SID2PStream(psParams->hStream); | ||
491 | if (psStream != (PDBG_STREAM)IMG_NULL) | ||
492 | { | ||
493 | ExtDBGDrivSetFrame(psStream,psParams->ui32Frame); | ||
494 | return(IMG_TRUE); | ||
495 | } | ||
496 | else | ||
497 | { | ||
498 | /* invalid SID */ | ||
499 | return(IMG_FALSE); | ||
500 | } | ||
501 | } | ||
502 | |||
503 | /***************************************************************************** | ||
504 | FUNCTION : DBGDrivGetFrame | ||
505 | |||
506 | PURPOSE : | ||
507 | |||
508 | PARAMETERS : | ||
509 | |||
510 | RETURNS : | ||
511 | *****************************************************************************/ | ||
512 | static IMG_UINT32 DBGDIOCDrivGetFrame(IMG_VOID * pvInBuffer, IMG_VOID * pvOutBuffer) | ||
513 | { | ||
514 | PDBG_STREAM psStream; | ||
515 | IMG_UINT32 *pui32Current; | ||
516 | |||
517 | pui32Current = (IMG_UINT32 *) pvOutBuffer; | ||
518 | psStream = SID2PStream(*(IMG_SID *)pvInBuffer); | ||
519 | |||
520 | if (psStream != (PDBG_STREAM)IMG_NULL) | ||
521 | { | ||
522 | *pui32Current = ExtDBGDrivGetFrame(psStream); | ||
523 | return(IMG_TRUE); | ||
524 | } | ||
525 | else | ||
526 | { | ||
527 | /* invalid SID */ | ||
528 | *pui32Current = 0; | ||
529 | return(IMG_FALSE); | ||
530 | } | ||
531 | } | ||
532 | |||
533 | /***************************************************************************** | ||
534 | FUNCTION : DBGDIOCDrivIsCaptureFrame | ||
535 | |||
536 | PURPOSE : Determines if this frame is a capture frame | ||
537 | |||
538 | PARAMETERS : | ||
539 | |||
540 | RETURNS : IMG_TRUE if current frame is to be captured | ||
541 | *****************************************************************************/ | ||
542 | static IMG_UINT32 DBGDIOCDrivIsCaptureFrame(IMG_VOID * pvInBuffer, IMG_VOID * pvOutBuffer) | ||
543 | { | ||
544 | PDBG_IN_ISCAPTUREFRAME psParams; | ||
545 | IMG_UINT32 * pui32Current; | ||
546 | PDBG_STREAM psStream; | ||
547 | |||
548 | psParams = (PDBG_IN_ISCAPTUREFRAME) pvInBuffer; | ||
549 | pui32Current = (IMG_UINT32 *) pvOutBuffer; | ||
550 | |||
551 | psStream = SID2PStream(psParams->hStream); | ||
552 | if (psStream != (PDBG_STREAM)IMG_NULL) | ||
553 | { | ||
554 | *pui32Current = ExtDBGDrivIsCaptureFrame(psStream, | ||
555 | psParams->bCheckPreviousFrame); | ||
556 | return(IMG_TRUE); | ||
557 | } | ||
558 | else | ||
559 | { | ||
560 | /* invalid SID */ | ||
561 | *pui32Current = 0; | ||
562 | return(IMG_FALSE); | ||
563 | } | ||
564 | } | ||
565 | |||
566 | /***************************************************************************** | ||
567 | FUNCTION : DBGDrivOverrideMode | ||
568 | |||
569 | PURPOSE : | ||
570 | |||
571 | PARAMETERS : | ||
572 | |||
573 | RETURNS : | ||
574 | *****************************************************************************/ | ||
575 | static IMG_UINT32 DBGDIOCDrivOverrideMode(IMG_VOID * pvInBuffer, IMG_VOID * pvOutBuffer) | ||
576 | { | ||
577 | PDBG_IN_OVERRIDEMODE psParams; | ||
578 | PDBG_STREAM psStream; | ||
579 | |||
580 | psParams = (PDBG_IN_OVERRIDEMODE) pvInBuffer; | ||
581 | PVR_UNREFERENCED_PARAMETER( pvOutBuffer); | ||
582 | |||
583 | psStream = SID2PStream(psParams->hStream); | ||
584 | if (psStream != (PDBG_STREAM)IMG_NULL) | ||
585 | { | ||
586 | ExtDBGDrivOverrideMode(psStream,psParams->ui32Mode); | ||
587 | return(IMG_TRUE); | ||
588 | } | ||
589 | else | ||
590 | { | ||
591 | /* invalid SID */ | ||
592 | return(IMG_FALSE); | ||
593 | } | ||
594 | } | ||
595 | |||
596 | /***************************************************************************** | ||
597 | FUNCTION : DBGDrivDefaultMode | ||
598 | |||
599 | PURPOSE : | ||
600 | |||
601 | PARAMETERS : | ||
602 | |||
603 | RETURNS : | ||
604 | *****************************************************************************/ | ||
605 | static IMG_UINT32 DBGDIOCDrivDefaultMode(IMG_VOID * pvInBuffer, IMG_VOID * pvOutBuffer) | ||
606 | { | ||
607 | PDBG_STREAM psStream; | ||
608 | |||
609 | PVR_UNREFERENCED_PARAMETER(pvOutBuffer); | ||
610 | |||
611 | psStream = SID2PStream(*(IMG_SID *)pvInBuffer); | ||
612 | if (psStream != (PDBG_STREAM)IMG_NULL) | ||
613 | { | ||
614 | ExtDBGDrivDefaultMode(psStream); | ||
615 | return(IMG_TRUE); | ||
616 | } | ||
617 | else | ||
618 | { | ||
619 | /* invalid SID */ | ||
620 | return(IMG_FALSE); | ||
621 | } | ||
622 | } | ||
623 | |||
624 | /***************************************************************************** | ||
625 | FUNCTION : DBGDIOCDrivSetMarker | ||
626 | |||
627 | PURPOSE : Sets the marker in the stream to split output files | ||
628 | |||
629 | PARAMETERS : pvInBuffer, pvOutBuffer | ||
630 | |||
631 | RETURNS : success | ||
632 | *****************************************************************************/ | ||
633 | static IMG_UINT32 DBGDIOCDrivSetMarker(IMG_VOID * pvInBuffer, IMG_VOID * pvOutBuffer) | ||
634 | { | ||
635 | PDBG_IN_SETMARKER psParams; | ||
636 | PDBG_STREAM psStream; | ||
637 | |||
638 | psParams = (PDBG_IN_SETMARKER) pvInBuffer; | ||
639 | PVR_UNREFERENCED_PARAMETER(pvOutBuffer); | ||
640 | |||
641 | psStream = SID2PStream(psParams->hStream); | ||
642 | if (psStream != (PDBG_STREAM)IMG_NULL) | ||
643 | { | ||
644 | ExtDBGDrivSetMarker(psStream, psParams->ui32Marker); | ||
645 | return(IMG_TRUE); | ||
646 | } | ||
647 | else | ||
648 | { | ||
649 | /* invalid SID */ | ||
650 | return(IMG_FALSE); | ||
651 | } | ||
652 | } | ||
653 | |||
654 | /***************************************************************************** | ||
655 | FUNCTION : DBGDIOCDrivGetMarker | ||
656 | |||
657 | PURPOSE : Gets the marker in the stream to split output files | ||
658 | |||
659 | PARAMETERS : pvInBuffer, pvOutBuffer | ||
660 | |||
661 | RETURNS : success | ||
662 | *****************************************************************************/ | ||
663 | static IMG_UINT32 DBGDIOCDrivGetMarker(IMG_VOID * pvInBuffer, IMG_VOID * pvOutBuffer) | ||
664 | { | ||
665 | PDBG_STREAM psStream; | ||
666 | IMG_UINT32 *pui32Current; | ||
667 | |||
668 | pui32Current = (IMG_UINT32 *) pvOutBuffer; | ||
669 | |||
670 | psStream = SID2PStream(*(IMG_SID *)pvInBuffer); | ||
671 | if (psStream != (PDBG_STREAM)IMG_NULL) | ||
672 | { | ||
673 | *pui32Current = ExtDBGDrivGetMarker(psStream); | ||
674 | return(IMG_TRUE); | ||
675 | } | ||
676 | else | ||
677 | { | ||
678 | /* invalid SID */ | ||
679 | *pui32Current = 0; | ||
680 | return(IMG_FALSE); | ||
681 | } | ||
682 | } | ||
683 | |||
684 | /***************************************************************************** | ||
685 | FUNCTION : DBGDrivGetServiceTable | ||
686 | |||
687 | PURPOSE : | ||
688 | |||
689 | PARAMETERS : | ||
690 | |||
691 | RETURNS : | ||
692 | *****************************************************************************/ | ||
693 | static IMG_UINT32 DBGDIOCDrivGetServiceTable(IMG_VOID * pvInBuffer, IMG_VOID * pvOutBuffer) | ||
694 | { | ||
695 | IMG_PVOID * ppvOut; | ||
696 | |||
697 | PVR_UNREFERENCED_PARAMETER(pvInBuffer); | ||
698 | ppvOut = (IMG_PVOID *) pvOutBuffer; | ||
699 | |||
700 | *ppvOut = DBGDrivGetServiceTable(); | ||
701 | |||
702 | return(IMG_TRUE); | ||
703 | } | ||
704 | |||
705 | /***************************************************************************** | ||
706 | FUNCTION : DBGDIOCDrivWriteLF | ||
707 | |||
708 | PURPOSE : | ||
709 | |||
710 | PARAMETERS : | ||
711 | |||
712 | RETURNS : | ||
713 | *****************************************************************************/ | ||
714 | static IMG_UINT32 DBGDIOCDrivWriteLF(IMG_VOID * pvInBuffer, IMG_VOID * pvOutBuffer) | ||
715 | { | ||
716 | PDBG_IN_WRITE_LF psInParams; | ||
717 | IMG_UINT32 *pui32BytesCopied; | ||
718 | PDBG_STREAM psStream; | ||
719 | |||
720 | psInParams = (PDBG_IN_WRITE_LF) pvInBuffer; | ||
721 | pui32BytesCopied = (IMG_UINT32 *) pvOutBuffer; | ||
722 | |||
723 | psStream = SID2PStream(psInParams->hStream); | ||
724 | if (psStream != (PDBG_STREAM)IMG_NULL) | ||
725 | { | ||
726 | *pui32BytesCopied = ExtDBGDrivWriteLF(psStream, | ||
727 | psInParams->u.pui8InBuffer, | ||
728 | psInParams->ui32BufferSize, | ||
729 | psInParams->ui32Level, | ||
730 | psInParams->ui32Flags); | ||
731 | return(IMG_TRUE); | ||
732 | } | ||
733 | else | ||
734 | { | ||
735 | /* invalid SID */ | ||
736 | return(IMG_FALSE); | ||
737 | } | ||
738 | } | ||
739 | |||
740 | /***************************************************************************** | ||
741 | FUNCTION : DBGDIOCDrivReadLF | ||
742 | |||
743 | PURPOSE : | ||
744 | |||
745 | PARAMETERS : | ||
746 | |||
747 | RETURNS : | ||
748 | *****************************************************************************/ | ||
749 | static IMG_UINT32 DBGDIOCDrivReadLF(IMG_VOID * pvInBuffer, IMG_VOID * pvOutBuffer) | ||
750 | { | ||
751 | IMG_UINT32 * pui32BytesCopied; | ||
752 | PDBG_IN_READ psInParams; | ||
753 | PDBG_STREAM psStream; | ||
754 | |||
755 | psInParams = (PDBG_IN_READ) pvInBuffer; | ||
756 | pui32BytesCopied = (IMG_UINT32 *) pvOutBuffer; | ||
757 | |||
758 | psStream = SID2PStream(psInParams->hStream); | ||
759 | if (psStream != (PDBG_STREAM)IMG_NULL) | ||
760 | { | ||
761 | *pui32BytesCopied = ExtDBGDrivReadLF(psStream, | ||
762 | psInParams->ui32OutBufferSize, | ||
763 | psInParams->u.pui8OutBuffer); | ||
764 | return(IMG_TRUE); | ||
765 | } | ||
766 | else | ||
767 | { | ||
768 | /* invalid SID */ | ||
769 | *pui32BytesCopied = 0; | ||
770 | return(IMG_FALSE); | ||
771 | } | ||
772 | } | ||
773 | |||
774 | /***************************************************************************** | ||
775 | FUNCTION : DBGDIOCDrivWaitForEvent | ||
776 | |||
777 | PURPOSE : | ||
778 | |||
779 | PARAMETERS : | ||
780 | |||
781 | RETURNS : | ||
782 | *****************************************************************************/ | ||
783 | static IMG_UINT32 DBGDIOCDrivWaitForEvent(IMG_VOID * pvInBuffer, IMG_VOID * pvOutBuffer) | ||
784 | { | ||
785 | DBG_EVENT eEvent = (DBG_EVENT)(*(IMG_UINT32 *)pvInBuffer); | ||
786 | |||
787 | PVR_UNREFERENCED_PARAMETER(pvOutBuffer); | ||
788 | |||
789 | ExtDBGDrivWaitForEvent(eEvent); | ||
790 | |||
791 | return(IMG_TRUE); | ||
792 | } | ||
793 | |||
794 | /* | ||
795 | VxD DIOC interface jump table. | ||
796 | */ | ||
797 | IMG_UINT32 (*g_DBGDrivProc[25])(IMG_VOID *, IMG_VOID *) = | ||
798 | { | ||
799 | DBGDIOCDrivCreateStream, | ||
800 | DBGDIOCDrivDestroyStream, | ||
801 | DBGDIOCDrivGetStream, | ||
802 | DBGDIOCDrivWriteString, | ||
803 | DBGDIOCDrivReadString, | ||
804 | DBGDIOCDrivWrite, | ||
805 | DBGDIOCDrivRead, | ||
806 | DBGDIOCDrivSetCaptureMode, | ||
807 | DBGDIOCDrivSetOutMode, | ||
808 | DBGDIOCDrivSetDebugLevel, | ||
809 | DBGDIOCDrivSetFrame, | ||
810 | DBGDIOCDrivGetFrame, | ||
811 | DBGDIOCDrivOverrideMode, | ||
812 | DBGDIOCDrivDefaultMode, | ||
813 | DBGDIOCDrivGetServiceTable, | ||
814 | DBGDIOCDrivWrite2, | ||
815 | DBGDIOCDrivWriteStringCM, | ||
816 | DBGDIOCDrivWriteCM, | ||
817 | DBGDIOCDrivSetMarker, | ||
818 | DBGDIOCDrivGetMarker, | ||
819 | DBGDIOCDrivIsCaptureFrame, | ||
820 | DBGDIOCDrivWriteLF, | ||
821 | DBGDIOCDrivReadLF, | ||
822 | DBGDIOCDrivWaitForEvent | ||
823 | }; | ||
824 | |||
825 | /***************************************************************************** | ||
826 | End of file (IOCTL.C) | ||
827 | *****************************************************************************/ | ||