1 /**********************************************************************
3 * Copyright(c) 2008 Imagination Technologies Ltd. All rights reserved.
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
9 * This program is distributed in the hope it will be useful but, except
10 * as otherwise stated in writing, without any warranty; without even the
11 * implied warranty of merchantability or fitness for a particular purpose.
12 * See the GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
18 * The full GNU General Public License is included in this distribution in
19 * the file called "COPYING".
21 * Contact Information:
22 * Imagination Technologies Ltd. <gpl-support@imgtec.com>
23 * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK
25 ******************************************************************************/
27 #include <linux/uaccess.h>
29 #include "img_types.h"
34 u32 DBGDIOCDrivCreateStream(void *pvInBuffer,
37 struct DBG_IN_CREATESTREAM *psIn;
41 psIn = (struct DBG_IN_CREATESTREAM *)pvInBuffer;
42 ppvOut = (void **)pvOutBuffer;
45 if (copy_from_user(name, psIn->pszName, 32) != 0)
48 ExtDBGDrivCreateStream(name, psIn->ui32CapMode, psIn->ui32OutMode,
55 u32 DBGDIOCDrivDestroyStream(void *pvInBuffer,
59 struct DBG_STREAM *psStream;
61 pStream = (u32 *) pvInBuffer;
62 psStream = (struct DBG_STREAM *)*pStream;
64 PVR_UNREFERENCED_PARAMETER(pvOutBuffer);
66 ExtDBGDrivDestroyStream(psStream);
71 u32 DBGDIOCDrivGetStream(void *pvInBuffer, void *pvOutBuffer)
73 struct DBG_IN_FINDSTREAM *psParams;
76 psParams = (struct DBG_IN_FINDSTREAM *)pvInBuffer;
77 pui32Stream = (u32 *) pvOutBuffer;
80 (u32) ExtDBGDrivFindStream(psParams->pszName,
81 psParams->bResetStream);
86 u32 DBGDIOCDrivWriteString(void *pvInBuffer, void *pvOutBuffer)
88 struct DBG_IN_WRITESTRING *psParams;
91 psParams = (struct DBG_IN_WRITESTRING *)pvInBuffer;
92 pui32OutLen = (u32 *) pvOutBuffer;
95 ExtDBGDrivWriteString((struct DBG_STREAM *)psParams->pvStream,
96 psParams->pszString, psParams->ui32Level);
101 u32 DBGDIOCDrivWriteStringCM(void *pvInBuffer,
104 struct DBG_IN_WRITESTRING *psParams;
107 psParams = (struct DBG_IN_WRITESTRING *)pvInBuffer;
108 pui32OutLen = (u32 *) pvOutBuffer;
111 ExtDBGDrivWriteStringCM((struct DBG_STREAM *)psParams->pvStream,
112 psParams->pszString, psParams->ui32Level);
117 u32 DBGDIOCDrivReadString(void *pvInBuffer, void *pvOutBuffer)
120 struct DBG_IN_READSTRING *psParams;
122 psParams = (struct DBG_IN_READSTRING *)pvInBuffer;
123 pui32OutLen = (u32 *) pvOutBuffer;
126 ExtDBGDrivReadString(psParams->pvStream, psParams->pszString,
127 psParams->ui32StringLen);
132 u32 DBGDIOCDrivWrite(void *pvInBuffer, void *pvOutBuffer)
134 u32 *pui32BytesCopied;
135 struct DBG_IN_WRITE *psInParams;
137 psInParams = (struct DBG_IN_WRITE *)pvInBuffer;
138 pui32BytesCopied = (u32 *) pvOutBuffer;
141 ExtDBGDrivWrite((struct DBG_STREAM *)psInParams->pvStream,
142 psInParams->pui8InBuffer,
143 psInParams->ui32TransferSize,
144 psInParams->ui32Level);
149 u32 DBGDIOCDrivWrite2(void *pvInBuffer, void *pvOutBuffer)
151 u32 *pui32BytesCopied;
152 struct DBG_IN_WRITE *psInParams;
154 psInParams = (struct DBG_IN_WRITE *)pvInBuffer;
155 pui32BytesCopied = (u32 *) pvOutBuffer;
158 ExtDBGDrivWrite2((struct DBG_STREAM *)psInParams->pvStream,
159 psInParams->pui8InBuffer,
160 psInParams->ui32TransferSize,
161 psInParams->ui32Level);
166 u32 DBGDIOCDrivWriteCM(void *pvInBuffer, void *pvOutBuffer)
168 u32 *pui32BytesCopied;
169 struct DBG_IN_WRITE *psInParams;
171 psInParams = (struct DBG_IN_WRITE *)pvInBuffer;
172 pui32BytesCopied = (u32 *) pvOutBuffer;
175 ExtDBGDrivWriteCM((struct DBG_STREAM *)psInParams->pvStream,
176 psInParams->pui8InBuffer,
177 psInParams->ui32TransferSize,
178 psInParams->ui32Level);
183 u32 DBGDIOCDrivRead(void *pvInBuffer, void *pvOutBuffer)
185 u32 *pui32BytesCopied;
186 struct DBG_IN_READ *psInParams;
188 psInParams = (struct DBG_IN_READ *)pvInBuffer;
189 pui32BytesCopied = (u32 *) pvOutBuffer;
192 ExtDBGDrivRead((struct DBG_STREAM *)psInParams->pvStream,
193 psInParams->bReadInitBuffer,
194 psInParams->ui32OutBufferSize,
195 psInParams->pui8OutBuffer);
200 u32 DBGDIOCDrivSetCaptureMode(void *pvInBuffer,
203 struct DBG_IN_SETDEBUGMODE *psParams;
205 psParams = (struct DBG_IN_SETDEBUGMODE *)pvInBuffer;
206 PVR_UNREFERENCED_PARAMETER(pvOutBuffer);
208 ExtDBGDrivSetCaptureMode((struct DBG_STREAM *)psParams->pvStream,
211 psParams->ui32End, psParams->ui32SampleRate);
216 u32 DBGDIOCDrivSetOutMode(void *pvInBuffer, void *pvOutBuffer)
218 struct DBG_IN_SETDEBUGOUTMODE *psParams;
220 psParams = (struct DBG_IN_SETDEBUGOUTMODE *)pvInBuffer;
221 PVR_UNREFERENCED_PARAMETER(pvOutBuffer);
223 ExtDBGDrivSetOutputMode((struct DBG_STREAM *)psParams->pvStream,
229 u32 DBGDIOCDrivSetDebugLevel(void *pvInBuffer,
232 struct DBG_IN_SETDEBUGLEVEL *psParams;
234 psParams = (struct DBG_IN_SETDEBUGLEVEL *)pvInBuffer;
235 PVR_UNREFERENCED_PARAMETER(pvOutBuffer);
237 ExtDBGDrivSetDebugLevel((struct DBG_STREAM *)psParams->pvStream,
238 psParams->ui32Level);
243 u32 DBGDIOCDrivSetFrame(void *pvInBuffer, void *pvOutBuffer)
245 struct DBG_IN_SETFRAME *psParams;
247 psParams = (struct DBG_IN_SETFRAME *)pvInBuffer;
248 PVR_UNREFERENCED_PARAMETER(pvOutBuffer);
250 ExtDBGDrivSetFrame((struct DBG_STREAM *)psParams->pvStream,
251 psParams->ui32Frame);
256 u32 DBGDIOCDrivGetFrame(void *pvInBuffer, void *pvOutBuffer)
259 struct DBG_STREAM *psStream;
262 pStream = (u32 *) pvInBuffer;
263 psStream = (struct DBG_STREAM *)*pStream;
264 pui32Current = (u32 *) pvOutBuffer;
266 *pui32Current = ExtDBGDrivGetFrame(psStream);
271 u32 DBGDIOCDrivIsCaptureFrame(void *pvInBuffer,
274 struct DBG_IN_ISCAPTUREFRAME *psParams;
277 psParams = (struct DBG_IN_ISCAPTUREFRAME *)pvInBuffer;
278 pui32Current = (u32 *) pvOutBuffer;
281 ExtDBGDrivIsCaptureFrame((struct DBG_STREAM *)psParams->pvStream,
282 psParams->bCheckPreviousFrame);
287 u32 DBGDIOCDrivOverrideMode(void *pvInBuffer,
290 struct DBG_IN_OVERRIDEMODE *psParams;
292 psParams = (struct DBG_IN_OVERRIDEMODE *)pvInBuffer;
293 PVR_UNREFERENCED_PARAMETER(pvOutBuffer);
295 ExtDBGDrivOverrideMode((struct DBG_STREAM *)psParams->pvStream,
301 u32 DBGDIOCDrivDefaultMode(void *pvInBuffer, void *pvOutBuffer)
304 struct DBG_STREAM *psStream;
306 pStream = (u32 *) pvInBuffer;
307 psStream = (struct DBG_STREAM *)*pStream;
309 PVR_UNREFERENCED_PARAMETER(pvOutBuffer);
311 ExtDBGDrivDefaultMode(psStream);
316 u32 DBGDIOCDrivSetMarker(void *pvInBuffer, void *pvOutBuffer)
318 struct DBG_IN_SETMARKER *psParams;
320 psParams = (struct DBG_IN_SETMARKER *)pvInBuffer;
321 PVR_UNREFERENCED_PARAMETER(pvOutBuffer);
323 ExtDBGDrivSetMarker((struct DBG_STREAM *)psParams->pvStream,
324 psParams->ui32Marker);
329 u32 DBGDIOCDrivGetMarker(void *pvInBuffer, void *pvOutBuffer)
332 struct DBG_STREAM *psStream;
335 pStream = (u32 *) pvInBuffer;
336 psStream = (struct DBG_STREAM *)*pStream;
337 pui32Current = (u32 *) pvOutBuffer;
339 *pui32Current = ExtDBGDrivGetMarker(psStream);
344 u32 DBGDIOCDrivGetServiceTable(void *pvInBuffer,
349 PVR_UNREFERENCED_PARAMETER(pvInBuffer);
350 pui32Out = (u32 *) pvOutBuffer;
352 *pui32Out = DBGDrivGetServiceTable();
357 u32 DBGDIOCDrivWriteLF(void *pvInBuffer, void *pvOutBuffer)
359 struct DBG_IN_WRITE_LF *psInParams;
360 u32 *pui32BytesCopied;
362 psInParams = (struct DBG_IN_WRITE_LF *)pvInBuffer;
363 pui32BytesCopied = (u32 *) pvOutBuffer;
365 *pui32BytesCopied = ExtDBGDrivWriteLF(psInParams->pvStream,
366 psInParams->pui8InBuffer,
367 psInParams->ui32BufferSize,
368 psInParams->ui32Level,
369 psInParams->ui32Flags);
374 u32 DBGDIOCDrivReadLF(void *pvInBuffer, void *pvOutBuffer)
376 u32 *pui32BytesCopied;
377 struct DBG_IN_READ *psInParams;
379 psInParams = (struct DBG_IN_READ *)pvInBuffer;
380 pui32BytesCopied = (u32 *) pvOutBuffer;
383 ExtDBGDrivReadLF((struct DBG_STREAM *)psInParams->pvStream,
384 psInParams->ui32OutBufferSize,
385 psInParams->pui8OutBuffer);
390 u32 DBGDIOCDrivWaitForEvent(void *pvInBuffer, void *pvOutBuffer)
392 enum DBG_EVENT eEvent = (enum DBG_EVENT)(*(u32 *) pvInBuffer);
394 PVR_UNREFERENCED_PARAMETER(pvOutBuffer);
396 ExtDBGDrivWaitForEvent(eEvent);