[android-sdk/device-ti-proprietary-open.git] / omap5 / sgx_src / eurasia_km / tools / intern / debug / dbgdriv / common / ioctl.c
1 /*************************************************************************/ /*!
2 @Title IOCTL implementations for debug device.
3 @Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
4 @License Dual MIT/GPLv2
6 The contents of this file are subject to the MIT license as set out below.
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:
15 The above copyright notice and this permission notice shall be included in
16 all copies or substantial portions of the Software.
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.
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.
30 This License is also included in this distribution in the file called
31 "MIT-COPYING".
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 */ /**************************************************************************/
43 #ifdef LINUX
44 #include <asm/uaccess.h>
45 #include "pvr_uaccess.h"
46 #endif /* LINUX */
48 #include "img_types.h"
49 #include "dbgdrvif.h"
50 #include "dbgdriv.h"
51 #include "hotkey.h"
52 #include "dbgdriv_ioctl.h"
55 /*****************************************************************************
56 Code
57 *****************************************************************************/
59 /*****************************************************************************
60 FUNCTION : DBGDrivCreateStream
62 PURPOSE :
64 PARAMETERS :
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
76 psIn = (PDBG_IN_CREATESTREAM) pvInBuffer;
77 ppvOut = (IMG_VOID * *) pvOutBuffer;
79 #ifdef LINUX
81 if(pvr_copy_from_user(name, psIn->u.pszName, 32) != 0)
82 {
83 return IMG_FALSE;
84 }
86 *ppvOut = ExtDBGDrivCreateStream(name, psIn->ui32CapMode, psIn->ui32OutMode, 0, psIn->ui32Pages);
88 #else
89 *ppvOut = ExtDBGDrivCreateStream(psIn->u.pszName, psIn->ui32CapMode, psIn->ui32OutMode, DEBUG_FLAGS_NO_BUF_EXPANDSION, psIn->ui32Pages);
90 #endif
93 return(IMG_TRUE);
94 }
96 /*****************************************************************************
97 FUNCTION : DBGDrivDestroyStream
99 PURPOSE :
101 PARAMETERS :
103 RETURNS :
104 *****************************************************************************/
105 static IMG_UINT32 DBGDIOCDrivDestroyStream(IMG_VOID * pvInBuffer, IMG_VOID * pvOutBuffer)
106 {
107 PDBG_STREAM *ppsStream;
108 PDBG_STREAM psStream;
110 ppsStream = (PDBG_STREAM *) pvInBuffer;
111 psStream = (PDBG_STREAM) *ppsStream;
113 PVR_UNREFERENCED_PARAMETER( pvOutBuffer);
115 ExtDBGDrivDestroyStream(psStream);
117 return(IMG_TRUE);
118 }
120 /*****************************************************************************
121 FUNCTION : DBGDrivGetStream
123 PURPOSE :
125 PARAMETERS :
127 RETURNS :
128 *****************************************************************************/
129 static IMG_UINT32 DBGDIOCDrivGetStream(IMG_VOID * pvInBuffer, IMG_VOID * pvOutBuffer)
130 {
131 PDBG_IN_FINDSTREAM psParams;
132 IMG_SID * phStream;
134 psParams = (PDBG_IN_FINDSTREAM)pvInBuffer;
135 phStream = (IMG_SID *)pvOutBuffer;
137 *phStream = PStream2SID(ExtDBGDrivFindStream(psParams->u.pszName, psParams->bResetStream));
139 return(IMG_TRUE);
140 }
142 /*****************************************************************************
143 FUNCTION : DBGDrivWriteString
145 PURPOSE :
147 PARAMETERS :
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;
157 psParams = (PDBG_IN_WRITESTRING) pvInBuffer;
158 pui32OutLen = (IMG_UINT32 *) pvOutBuffer;
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 }
174 /*****************************************************************************
175 FUNCTION : DBGDrivWriteStringCM
177 PURPOSE : Same as DBGDrivWriteString, but takes notice of capture mode.
179 PARAMETERS :
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;
189 psParams = (PDBG_IN_WRITESTRING) pvInBuffer;
190 pui32OutLen = (IMG_UINT32 *) pvOutBuffer;
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 }
206 /*****************************************************************************
207 FUNCTION : DBGDrivReadString
209 PURPOSE :
211 PARAMETERS :
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;
221 psParams = (PDBG_IN_READSTRING) pvInBuffer;
222 pui32OutLen = (IMG_UINT32 *) pvOutBuffer;
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 }
239 /*****************************************************************************
240 FUNCTION : DBGDrivWrite
242 PURPOSE :
244 PARAMETERS :
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;
254 psInParams = (PDBG_IN_WRITE) pvInBuffer;
255 pui32BytesCopied = (IMG_UINT32 *) pvOutBuffer;
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 }
274 /*****************************************************************************
275 FUNCTION : DBGDrivWrite2
277 PURPOSE :
279 PARAMETERS :
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;
289 psInParams = (PDBG_IN_WRITE) pvInBuffer;
290 pui32BytesCopied = (IMG_UINT32 *) pvOutBuffer;
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 }
309 /*****************************************************************************
310 FUNCTION : DBGDrivWriteCM
312 PURPOSE : Same as DBGDIOCDrivWrite2, but takes notice of capture mode.
314 PARAMETERS :
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;
324 psInParams = (PDBG_IN_WRITE) pvInBuffer;
325 pui32BytesCopied = (IMG_UINT32 *) pvOutBuffer;
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 }
344 /*****************************************************************************
345 FUNCTION : DBGDrivRead
347 PURPOSE :
349 PARAMETERS :
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;
359 psInParams = (PDBG_IN_READ) pvInBuffer;
360 pui32BytesCopied = (IMG_UINT32 *) pvOutBuffer;
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 }
379 /*****************************************************************************
380 FUNCTION : DBGDIOCDrivSetCaptureMode
382 PURPOSE :
384 PARAMETERS :
386 RETURNS :
387 *****************************************************************************/
388 static IMG_UINT32 DBGDIOCDrivSetCaptureMode(IMG_VOID * pvInBuffer, IMG_VOID * pvOutBuffer)
389 {
390 PDBG_IN_SETDEBUGMODE psParams;
391 PDBG_STREAM psStream;
393 psParams = (PDBG_IN_SETDEBUGMODE) pvInBuffer;
394 PVR_UNREFERENCED_PARAMETER(pvOutBuffer);
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 }
413 /*****************************************************************************
414 FUNCTION : DBGDIOCDrivSetOutMode
416 PURPOSE :
418 PARAMETERS :
420 RETURNS :
421 *****************************************************************************/
422 static IMG_UINT32 DBGDIOCDrivSetOutMode(IMG_VOID * pvInBuffer, IMG_VOID * pvOutBuffer)
423 {
424 PDBG_IN_SETDEBUGOUTMODE psParams;
425 PDBG_STREAM psStream;
427 psParams = (PDBG_IN_SETDEBUGOUTMODE) pvInBuffer;
428 PVR_UNREFERENCED_PARAMETER(pvOutBuffer);
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 }
443 /*****************************************************************************
444 FUNCTION : DBGDIOCDrivSetDebugLevel
446 PURPOSE :
448 PARAMETERS :
450 RETURNS :
451 *****************************************************************************/
452 static IMG_UINT32 DBGDIOCDrivSetDebugLevel(IMG_VOID * pvInBuffer, IMG_VOID * pvOutBuffer)
453 {
454 PDBG_IN_SETDEBUGLEVEL psParams;
455 PDBG_STREAM psStream;
457 psParams = (PDBG_IN_SETDEBUGLEVEL) pvInBuffer;
458 PVR_UNREFERENCED_PARAMETER(pvOutBuffer);
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 }
473 /*****************************************************************************
474 FUNCTION : DBGDrivSetFrame
476 PURPOSE :
478 PARAMETERS :
480 RETURNS :
481 *****************************************************************************/
482 static IMG_UINT32 DBGDIOCDrivSetFrame(IMG_VOID * pvInBuffer, IMG_VOID * pvOutBuffer)
483 {
484 PDBG_IN_SETFRAME psParams;
485 PDBG_STREAM psStream;
487 psParams = (PDBG_IN_SETFRAME) pvInBuffer;
488 PVR_UNREFERENCED_PARAMETER(pvOutBuffer);
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 }
503 /*****************************************************************************
504 FUNCTION : DBGDrivGetFrame
506 PURPOSE :
508 PARAMETERS :
510 RETURNS :
511 *****************************************************************************/
512 static IMG_UINT32 DBGDIOCDrivGetFrame(IMG_VOID * pvInBuffer, IMG_VOID * pvOutBuffer)
513 {
514 PDBG_STREAM psStream;
515 IMG_UINT32 *pui32Current;
517 pui32Current = (IMG_UINT32 *) pvOutBuffer;
518 psStream = SID2PStream(*(IMG_SID *)pvInBuffer);
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 }
533 /*****************************************************************************
534 FUNCTION : DBGDIOCDrivIsCaptureFrame
536 PURPOSE : Determines if this frame is a capture frame
538 PARAMETERS :
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;
548 psParams = (PDBG_IN_ISCAPTUREFRAME) pvInBuffer;
549 pui32Current = (IMG_UINT32 *) pvOutBuffer;
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 }
566 /*****************************************************************************
567 FUNCTION : DBGDrivOverrideMode
569 PURPOSE :
571 PARAMETERS :
573 RETURNS :
574 *****************************************************************************/
575 static IMG_UINT32 DBGDIOCDrivOverrideMode(IMG_VOID * pvInBuffer, IMG_VOID * pvOutBuffer)
576 {
577 PDBG_IN_OVERRIDEMODE psParams;
578 PDBG_STREAM psStream;
580 psParams = (PDBG_IN_OVERRIDEMODE) pvInBuffer;
581 PVR_UNREFERENCED_PARAMETER( pvOutBuffer);
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 }
596 /*****************************************************************************
597 FUNCTION : DBGDrivDefaultMode
599 PURPOSE :
601 PARAMETERS :
603 RETURNS :
604 *****************************************************************************/
605 static IMG_UINT32 DBGDIOCDrivDefaultMode(IMG_VOID * pvInBuffer, IMG_VOID * pvOutBuffer)
606 {
607 PDBG_STREAM psStream;
609 PVR_UNREFERENCED_PARAMETER(pvOutBuffer);
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 }
624 /*****************************************************************************
625 FUNCTION : DBGDIOCDrivSetMarker
627 PURPOSE : Sets the marker in the stream to split output files
629 PARAMETERS : pvInBuffer, pvOutBuffer
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;
638 psParams = (PDBG_IN_SETMARKER) pvInBuffer;
639 PVR_UNREFERENCED_PARAMETER(pvOutBuffer);
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 }
654 /*****************************************************************************
655 FUNCTION : DBGDIOCDrivGetMarker
657 PURPOSE : Gets the marker in the stream to split output files
659 PARAMETERS : pvInBuffer, pvOutBuffer
661 RETURNS : success
662 *****************************************************************************/
663 static IMG_UINT32 DBGDIOCDrivGetMarker(IMG_VOID * pvInBuffer, IMG_VOID * pvOutBuffer)
664 {
665 PDBG_STREAM psStream;
666 IMG_UINT32 *pui32Current;
668 pui32Current = (IMG_UINT32 *) pvOutBuffer;
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 }
684 /*****************************************************************************
685 FUNCTION : DBGDrivGetServiceTable
687 PURPOSE :
689 PARAMETERS :
691 RETURNS :
692 *****************************************************************************/
693 static IMG_UINT32 DBGDIOCDrivGetServiceTable(IMG_VOID * pvInBuffer, IMG_VOID * pvOutBuffer)
694 {
695 IMG_PVOID * ppvOut;
697 PVR_UNREFERENCED_PARAMETER(pvInBuffer);
698 ppvOut = (IMG_PVOID *) pvOutBuffer;
700 *ppvOut = DBGDrivGetServiceTable();
702 return(IMG_TRUE);
703 }
705 /*****************************************************************************
706 FUNCTION : DBGDIOCDrivWriteLF
708 PURPOSE :
710 PARAMETERS :
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;
720 psInParams = (PDBG_IN_WRITE_LF) pvInBuffer;
721 pui32BytesCopied = (IMG_UINT32 *) pvOutBuffer;
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 }
740 /*****************************************************************************
741 FUNCTION : DBGDIOCDrivReadLF
743 PURPOSE :
745 PARAMETERS :
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;
755 psInParams = (PDBG_IN_READ) pvInBuffer;
756 pui32BytesCopied = (IMG_UINT32 *) pvOutBuffer;
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 }
774 /*****************************************************************************
775 FUNCTION : DBGDIOCDrivWaitForEvent
777 PURPOSE :
779 PARAMETERS :
781 RETURNS :
782 *****************************************************************************/
783 static IMG_UINT32 DBGDIOCDrivWaitForEvent(IMG_VOID * pvInBuffer, IMG_VOID * pvOutBuffer)
784 {
785 DBG_EVENT eEvent = (DBG_EVENT)(*(IMG_UINT32 *)pvInBuffer);
787 PVR_UNREFERENCED_PARAMETER(pvOutBuffer);
789 ExtDBGDrivWaitForEvent(eEvent);
791 return(IMG_TRUE);
792 }
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 };
825 /*****************************************************************************
826 End of file (IOCTL.C)
827 *****************************************************************************/