Remove now unused dbgdrv files, and set the pdump Kconfig option to bool.
Signed-off-by: Luc Verhaegen <Luc.Verhaegen@basyskom.de>
Signed-off-by: Imre Deak <imre.deak@nokia.com>
the driver need to be built in debug mode as well.
config PVR_DEBUG_PDUMP
- tristate "PDUMP debug support"
+ bool "PDUMP debug support"
depends on PVR
default n
bufferclass_example_private.o
-obj-$(CONFIG_PVR_DEBUG_PDUMP) += pvrdbg.o
-
-pvrdbg-objs := tools/main.o tools/dbgdriv.o tools/ioctl.o \
- tools/hostfunc.o tools/hotkey.o
-
-
DATE := $(shell date "+%a %B %d %Z %Y" )
CBUILD := -O2 \
-DPVR_BUILD_DIR="\"$(PVR_BUILD_DIR)\"" \
-DPVR_BUILD_DATE="\"$(DATE)\""
ccflags-y += $(CBUILD) -include $(srctree)/$(src)/pvrconfig.h
-
-ccflags-$(CONFIG_PVR_DEBUG_PDUMP) += -I $(srctree)/$(src)/tools \
- -I $(srctree)/$(src)
ccflags-y += $(ccflags-m)
+++ /dev/null
-/**********************************************************************
- *
- * Copyright(c) 2008 Imagination Technologies Ltd. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful but, except
- * as otherwise stated in writing, without any warranty; without even the
- * implied warranty of merchantability or fitness for a particular purpose.
- * See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * The full GNU General Public License is included in this distribution in
- * the file called "COPYING".
- *
- * Contact Information:
- * Imagination Technologies Ltd. <gpl-support@imgtec.com>
- * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK
- *
- ******************************************************************************/
-
-#ifndef _DBGDRVIF_
-#define _DBGDRVIF_
-
-#include "ioctldef.h"
-
-#define DEBUG_CAPMODE_FRAMED 0x00000001
-#define DEBUG_CAPMODE_CONTINUOUS 0x00000002
-#define DEBUG_CAPMODE_HOTKEY 0x00000004
-
-#define DEBUG_OUTMODE_STANDARDDBG 0x00000001
-#define DEBUG_OUTMODE_MONO 0x00000002
-#define DEBUG_OUTMODE_STREAMENABLE 0x00000004
-#define DEBUG_OUTMODE_ASYNC 0x00000008
-#define DEBUG_OUTMODE_SGXVGA 0x00000010
-
-#define DEBUG_FLAGS_USE_NONPAGED_MEM 0x00000001
-#define DEBUG_FLAGS_NO_BUF_EXPANDSION 0x00000002
-#define DEBUG_FLAGS_ENABLESAMPLE 0x00000004
-
-#define DEBUG_FLAGS_TEXTSTREAM 0x80000000
-
-#define DEBUG_LEVEL_0 0x00000001
-#define DEBUG_LEVEL_1 0x00000003
-#define DEBUG_LEVEL_2 0x00000007
-#define DEBUG_LEVEL_3 0x0000000F
-#define DEBUG_LEVEL_4 0x0000001F
-#define DEBUG_LEVEL_5 0x0000003F
-#define DEBUG_LEVEL_6 0x0000007F
-#define DEBUG_LEVEL_7 0x000000FF
-#define DEBUG_LEVEL_8 0x000001FF
-#define DEBUG_LEVEL_9 0x000003FF
-#define DEBUG_LEVEL_10 0x000007FF
-#define DEBUG_LEVEL_11 0x00000FFF
-
-#define DEBUG_LEVEL_SEL0 0x00000001
-#define DEBUG_LEVEL_SEL1 0x00000002
-#define DEBUG_LEVEL_SEL2 0x00000004
-#define DEBUG_LEVEL_SEL3 0x00000008
-#define DEBUG_LEVEL_SEL4 0x00000010
-#define DEBUG_LEVEL_SEL5 0x00000020
-#define DEBUG_LEVEL_SEL6 0x00000040
-#define DEBUG_LEVEL_SEL7 0x00000080
-#define DEBUG_LEVEL_SEL8 0x00000100
-#define DEBUG_LEVEL_SEL9 0x00000200
-#define DEBUG_LEVEL_SEL10 0x00000400
-#define DEBUG_LEVEL_SEL11 0x00000800
-
-#define DEBUG_SERVICE_IOCTL_BASE 0x800
-#define DEBUG_SERVICE_CREATESTREAM \
- CTL_CODE(FILE_DEVICE_UNKNOWN, DEBUG_SERVICE_IOCTL_BASE + 0x01, \
- METHOD_BUFFERED, FILE_ANY_ACCESS)
-#define DEBUG_SERVICE_DESTROYSTREAM \
- CTL_CODE(FILE_DEVICE_UNKNOWN, DEBUG_SERVICE_IOCTL_BASE + 0x02, \
- METHOD_BUFFERED, FILE_ANY_ACCESS)
-#define DEBUG_SERVICE_GETSTREAM \
- CTL_CODE(FILE_DEVICE_UNKNOWN, DEBUG_SERVICE_IOCTL_BASE + 0x03, \
- METHOD_BUFFERED, FILE_ANY_ACCESS)
-#define DEBUG_SERVICE_WRITESTRING \
- CTL_CODE(FILE_DEVICE_UNKNOWN, DEBUG_SERVICE_IOCTL_BASE + 0x04, \
- METHOD_BUFFERED, FILE_ANY_ACCESS)
-#define DEBUG_SERVICE_READSTRING \
- CTL_CODE(FILE_DEVICE_UNKNOWN, DEBUG_SERVICE_IOCTL_BASE + 0x05, \
- METHOD_BUFFERED, FILE_ANY_ACCESS)
-#define DEBUG_SERVICE_WRITE \
- CTL_CODE(FILE_DEVICE_UNKNOWN, DEBUG_SERVICE_IOCTL_BASE + 0x06, \
- METHOD_BUFFERED, FILE_ANY_ACCESS)
-#define DEBUG_SERVICE_READ \
- CTL_CODE(FILE_DEVICE_UNKNOWN, DEBUG_SERVICE_IOCTL_BASE + 0x07, \
- METHOD_BUFFERED, FILE_ANY_ACCESS)
-#define DEBUG_SERVICE_SETDEBUGMODE \
- CTL_CODE(FILE_DEVICE_UNKNOWN, DEBUG_SERVICE_IOCTL_BASE + 0x08, \
- METHOD_BUFFERED, FILE_ANY_ACCESS)
-#define DEBUG_SERVICE_SETDEBUGOUTMODE \
- CTL_CODE(FILE_DEVICE_UNKNOWN, DEBUG_SERVICE_IOCTL_BASE + 0x09, \
- METHOD_BUFFERED, FILE_ANY_ACCESS)
-#define DEBUG_SERVICE_SETDEBUGLEVEL \
- CTL_CODE(FILE_DEVICE_UNKNOWN, DEBUG_SERVICE_IOCTL_BASE + 0x0A, \
- METHOD_BUFFERED, FILE_ANY_ACCESS)
-#define DEBUG_SERVICE_SETFRAME \
- CTL_CODE(FILE_DEVICE_UNKNOWN, DEBUG_SERVICE_IOCTL_BASE + 0x0B, \
- METHOD_BUFFERED, FILE_ANY_ACCESS)
-#define DEBUG_SERVICE_GETFRAME \
- CTL_CODE(FILE_DEVICE_UNKNOWN, DEBUG_SERVICE_IOCTL_BASE + 0x0C, \
- METHOD_BUFFERED, FILE_ANY_ACCESS)
-#define DEBUG_SERVICE_OVERRIDEMODE \
- CTL_CODE(FILE_DEVICE_UNKNOWN, DEBUG_SERVICE_IOCTL_BASE + 0x0D, \
- METHOD_BUFFERED, FILE_ANY_ACCESS)
-#define DEBUG_SERVICE_DEFAULTMODE \
- CTL_CODE(FILE_DEVICE_UNKNOWN, DEBUG_SERVICE_IOCTL_BASE + 0x0E, \
- METHOD_BUFFERED, FILE_ANY_ACCESS)
-#define DEBUG_SERVICE_GETSERVICETABLE \
- CTL_CODE(FILE_DEVICE_UNKNOWN, DEBUG_SERVICE_IOCTL_BASE + 0x0F, \
- METHOD_BUFFERED, FILE_ANY_ACCESS)
-#define DEBUG_SERVICE_WRITE2 \
- CTL_CODE(FILE_DEVICE_UNKNOWN, DEBUG_SERVICE_IOCTL_BASE + 0x10, \
- METHOD_BUFFERED, FILE_ANY_ACCESS)
-#define DEBUG_SERVICE_WRITESTRINGCM \
- CTL_CODE(FILE_DEVICE_UNKNOWN, DEBUG_SERVICE_IOCTL_BASE + 0x11, \
- METHOD_BUFFERED, FILE_ANY_ACCESS)
-#define DEBUG_SERVICE_WRITECM \
- CTL_CODE(FILE_DEVICE_UNKNOWN, DEBUG_SERVICE_IOCTL_BASE + 0x12, \
- METHOD_BUFFERED, FILE_ANY_ACCESS)
-#define DEBUG_SERVICE_SETMARKER \
- CTL_CODE(FILE_DEVICE_UNKNOWN, DEBUG_SERVICE_IOCTL_BASE + 0x13, \
- METHOD_BUFFERED, FILE_ANY_ACCESS)
-#define DEBUG_SERVICE_GETMARKER \
- CTL_CODE(FILE_DEVICE_UNKNOWN, DEBUG_SERVICE_IOCTL_BASE + 0x14, \
- METHOD_BUFFERED, FILE_ANY_ACCESS)
-#define DEBUG_SERVICE_ISCAPTUREFRAME \
- CTL_CODE(FILE_DEVICE_UNKNOWN, DEBUG_SERVICE_IOCTL_BASE + 0x15, \
- METHOD_BUFFERED, FILE_ANY_ACCESS)
-#define DEBUG_SERVICE_WRITELF \
- CTL_CODE(FILE_DEVICE_UNKNOWN, DEBUG_SERVICE_IOCTL_BASE + 0x16, \
- METHOD_BUFFERED, FILE_ANY_ACCESS)
-#define DEBUG_SERVICE_READLF \
- CTL_CODE(FILE_DEVICE_UNKNOWN, DEBUG_SERVICE_IOCTL_BASE + 0x17, \
- METHOD_BUFFERED, FILE_ANY_ACCESS)
-#define DEBUG_SERVICE_WAITFOREVENT \
- CTL_CODE(FILE_DEVICE_UNKNOWN, DEBUG_SERVICE_IOCTL_BASE + 0x18, \
- METHOD_BUFFERED, FILE_ANY_ACCESS)
-
-enum DBG_EVENT {
- DBG_EVENT_STREAM_DATA = 1
-};
-
-struct DBG_IN_CREATESTREAM {
- u32 ui32Pages;
- u32 ui32CapMode;
- u32 ui32OutMode;
- char *pszName;
-};
-
-struct DBG_IN_FINDSTREAM {
- IMG_BOOL bResetStream;
- char *pszName;
-};
-
-struct DBG_IN_WRITESTRING {
- void *pvStream;
- u32 ui32Level;
- char *pszString;
-};
-
-struct DBG_IN_READSTRING {
- void *pvStream;
- u32 ui32StringLen;
- char *pszString;
-};
-
-struct DBG_IN_SETDEBUGMODE {
- void *pvStream;
- u32 ui32Mode;
- u32 ui32Start;
- u32 ui32End;
- u32 ui32SampleRate;
-};
-
-struct DBG_IN_SETDEBUGOUTMODE {
- void *pvStream;
- u32 ui32Mode;
-};
-
-struct DBG_IN_SETDEBUGLEVEL {
- void *pvStream;
- u32 ui32Level;
-};
-
-struct DBG_IN_SETFRAME {
- void *pvStream;
- u32 ui32Frame;
-};
-
-struct DBG_IN_WRITE {
- void *pvStream;
- u32 ui32Level;
- u32 ui32TransferSize;
- u8 *pui8InBuffer;
-};
-
-struct DBG_IN_READ {
- void *pvStream;
- IMG_BOOL bReadInitBuffer;
- u32 ui32OutBufferSize;
- u8 *pui8OutBuffer;
-};
-
-struct DBG_IN_OVERRIDEMODE {
- void *pvStream;
- u32 ui32Mode;
-};
-
-struct DBG_IN_ISCAPTUREFRAME {
- void *pvStream;
- IMG_BOOL bCheckPreviousFrame;
-};
-
-struct DBG_IN_SETMARKER {
- void *pvStream;
- u32 ui32Marker;
-};
-
-struct DBG_IN_WRITE_LF {
- u32 ui32Flags;
- void *pvStream;
- u32 ui32Level;
- u32 ui32BufferSize;
- u8 *pui8InBuffer;
-};
-
-#define WRITELF_FLAGS_RESETBUF 0x00000001
-
-struct DBG_STREAM {
- struct DBG_STREAM *psNext;
- struct DBG_STREAM *psInitStream;
- IMG_BOOL bInitPhaseComplete;
- u32 ui32Flags;
- u32 ui32Base;
- u32 ui32Size;
- u32 ui32RPtr;
- u32 ui32WPtr;
- u32 ui32DataWritten;
- u32 ui32CapMode;
- u32 ui32OutMode;
- u32 ui32DebugLevel;
- u32 ui32DefaultMode;
- u32 ui32Start;
- u32 ui32End;
- u32 ui32Current;
- u32 ui32Access;
- u32 ui32SampleRate;
- u32 ui32Reserved;
- u32 ui32Timeout;
- u32 ui32Marker;
- char szName[30];
-};
-
-struct DBGKM_SERVICE_TABLE {
- u32 ui32Size;
- void *(*pfnCreateStream)(char *pszName, u32 ui32CapMode,
- u32 ui32OutMode, u32 ui32Flags, u32 ui32Pages);
- void (*pfnDestroyStream)(struct DBG_STREAM *psStream);
- void *(*pfnFindStream)(char *pszName, IMG_BOOL bResetInitBuffer);
- u32 (*pfnWriteString)(struct DBG_STREAM *psStream, char *pszString,
- u32 ui32Level);
- u32 (*pfnReadString)(struct DBG_STREAM *psStream, char *pszString,
- u32 ui32Limit);
- u32 (*pfnWriteBIN)(struct DBG_STREAM *psStream, u8 *pui8InBuf,
- u32 ui32InBuffSize, u32 ui32Level);
- u32 (*pfnReadBIN)(struct DBG_STREAM *psStream,
- IMG_BOOL bReadInitBuffer, u32 ui32OutBufferSize,
- u8 *pui8OutBuf);
- void (*pfnSetCaptureMode)(struct DBG_STREAM *psStream,
- u32 ui32CapMode, u32 ui32Start, u32 ui32Stop,
- u32 ui32SampleRate);
- void (*pfnSetOutputMode)(struct DBG_STREAM *psStream,
- u32 ui32OutMode);
- void (*pfnSetDebugLevel)(struct DBG_STREAM *psStream,
- u32 ui32DebugLevel);
- void (*pfnSetFrame)(struct DBG_STREAM *psStream,
- u32 ui32Frame);
- u32 (*pfnGetFrame)(struct DBG_STREAM *psStream); /* unused */
- void (*pfnOverrideMode)(struct DBG_STREAM *psStream,
- u32 ui32Mode);
- void (*pfnDefaultMode)(struct DBG_STREAM *psStream);
- u32 (*pfnDBGDrivWrite2)(struct DBG_STREAM *psStream,
- u8 *pui8InBuf, u32 ui32InBuffSize, u32 ui32Level);
- u32 (*pfnWriteStringCM)(struct DBG_STREAM *psStream, char *pszString,
- u32 ui32Level);
- u32 (*pfnWriteBINCM)(struct DBG_STREAM *psStream, u8 *pui8InBuf,
- u32 ui32InBuffSize, u32 ui32Level);
- void (*pfnSetMarker)(struct DBG_STREAM *psStream, u32 ui32Marker);
- u32 (*pfnGetMarker)(struct DBG_STREAM *psStream);
- void (*pfnStartInitPhase) (struct DBG_STREAM *psStream);
- void (*pfnStopInitPhase) (struct DBG_STREAM *psStream);
- u32 (*pfnIsCaptureFrame)(struct DBG_STREAM *psStream,
- IMG_BOOL bCheckPreviousFrame);
- u32 (*pfnWriteLF)(struct DBG_STREAM *psStream, u8 *pui8InBuf,
- u32 ui32InBuffSize, u32 ui32Level, u32 ui32Flags);
- u32 (*pfnReadLF)(struct DBG_STREAM *psStream, u32 ui32OutBuffSize,
- u8 *pui8OutBuf);
- u32 (*pfnGetStreamOffset)(struct DBG_STREAM *psStream);
- void (*pfnSetStreamOffset)(struct DBG_STREAM *psStream,
- u32 ui32StreamOffset);
- u32 (*pfnIsLastCaptureFrame)(struct DBG_STREAM *psStream);
- void (*pfnWaitForEvent) (enum DBG_EVENT eEvent);
-};
-
-extern struct DBGKM_SERVICE_TABLE g_sDBGKMServices;
-
-void DBGDrvGetServiceTable(void **fn_table);
-
-#endif
+++ /dev/null
-/**********************************************************************
- *
- * Copyright(c) 2008 Imagination Technologies Ltd. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful but, except
- * as otherwise stated in writing, without any warranty; without even the
- * implied warranty of merchantability or fitness for a particular purpose.
- * See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * The full GNU General Public License is included in this distribution in
- * the file called "COPYING".
- *
- * Contact Information:
- * Imagination Technologies Ltd. <gpl-support@imgtec.com>
- * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK
- *
- ******************************************************************************/
-
-#ifndef __IOCTLDEF_H__
-#define __IOCTLDEF_H__
-
-#define MAKEIOCTLINDEX(i) (((i) >> 2) & 0xFFF)
-
-#define DEVICE_TYPE ULONG
-
-#define FILE_DEVICE_BEEP 0x00000001
-#define FILE_DEVICE_CD_ROM 0x00000002
-#define FILE_DEVICE_CD_ROM_FILE_SYSTEM 0x00000003
-#define FILE_DEVICE_CONTROLLER 0x00000004
-#define FILE_DEVICE_DATALINK 0x00000005
-#define FILE_DEVICE_DFS 0x00000006
-#define FILE_DEVICE_DISK 0x00000007
-#define FILE_DEVICE_DISK_FILE_SYSTEM 0x00000008
-#define FILE_DEVICE_FILE_SYSTEM 0x00000009
-#define FILE_DEVICE_INPORT_PORT 0x0000000a
-#define FILE_DEVICE_KEYBOARD 0x0000000b
-#define FILE_DEVICE_MAILSLOT 0x0000000c
-#define FILE_DEVICE_MIDI_IN 0x0000000d
-#define FILE_DEVICE_MIDI_OUT 0x0000000e
-#define FILE_DEVICE_MOUSE 0x0000000f
-#define FILE_DEVICE_MULTI_UNC_PROVIDER 0x00000010
-#define FILE_DEVICE_NAMED_PIPE 0x00000011
-#define FILE_DEVICE_NETWORK 0x00000012
-#define FILE_DEVICE_NETWORK_BROWSER 0x00000013
-#define FILE_DEVICE_NETWORK_FILE_SYSTEM 0x00000014
-#define FILE_DEVICE_NULL 0x00000015
-#define FILE_DEVICE_PARALLEL_PORT 0x00000016
-#define FILE_DEVICE_PHYSICAL_NETCARD 0x00000017
-#define FILE_DEVICE_PRINTER 0x00000018
-#define FILE_DEVICE_SCANNER 0x00000019
-#define FILE_DEVICE_SERIAL_MOUSE_PORT 0x0000001a
-#define FILE_DEVICE_SERIAL_PORT 0x0000001b
-#define FILE_DEVICE_SCREEN 0x0000001c
-#define FILE_DEVICE_SOUND 0x0000001d
-#define FILE_DEVICE_STREAMS 0x0000001e
-#define FILE_DEVICE_TAPE 0x0000001f
-#define FILE_DEVICE_TAPE_FILE_SYSTEM 0x00000020
-#define FILE_DEVICE_TRANSPORT 0x00000021
-#define FILE_DEVICE_UNKNOWN 0x00000022
-#define FILE_DEVICE_VIDEO 0x00000023
-#define FILE_DEVICE_VIRTUAL_DISK 0x00000024
-#define FILE_DEVICE_WAVE_IN 0x00000025
-#define FILE_DEVICE_WAVE_OUT 0x00000026
-#define FILE_DEVICE_8042_PORT 0x00000027
-#define FILE_DEVICE_NETWORK_REDIRECTOR 0x00000028
-#define FILE_DEVICE_BATTERY 0x00000029
-#define FILE_DEVICE_BUS_EXTENDER 0x0000002a
-#define FILE_DEVICE_MODEM 0x0000002b
-#define FILE_DEVICE_VDM 0x0000002c
-#define FILE_DEVICE_MASS_STORAGE 0x0000002d
-
-#define CTL_CODE( DeviceType, Function, Method, Access) ( \
- ((DeviceType) << 16) | ((Access) << 14) | ((Function) << 2) | (Method) \
-)
-
-#define METHOD_BUFFERED 0
-#define METHOD_IN_DIRECT 1
-#define METHOD_OUT_DIRECT 2
-#define METHOD_NEITHER 3
-
-#define FILE_ANY_ACCESS 0
-#define FILE_READ_ACCESS 0x0001
-#define FILE_WRITE_ACCESS 0x0002
-
-#endif
# define DEBUG_BRIDGE_KM 1
#endif
-# if (defined CONFIG_PVR_DEBUG_PDUMP) || (defined CONFIG_PVR_DEBUG_PDUMP_MODULE)
+# ifdef CONFIG_PVR_DEBUG_PDUMP
# define PDUMP 1
# endif
+++ /dev/null
-#
-# Copyright(c) 2008 Imagination Technologies Ltd. All rights reserved.
-#
-# This program is free software; you can redistribute it and/or modify it
-# under the terms and conditions of the GNU General Public License,
-# version 2, as published by the Free Software Foundation.
-#
-# This program is distributed in the hope it will be useful but, except
-# as otherwise stated in writing, without any warranty; without even the
-# implied warranty of merchantability or fitness for a particular purpose.
-# See the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along with
-# this program; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# The full GNU General Public License is included in this distribution in
-# the file called "COPYING".
-#
-# Contact Information:
-# Imagination Technologies Ltd. <gpl-support@imgtec.com>
-# Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK
-
-
-objs-$(CONFIG_PVR_TOOLS) += dbgdrv
-
-dbgdrv-objs := main.c dbgdriv.c ioctl.c hostfunc.c \
- hotkey.c
-
+++ /dev/null
-/**********************************************************************
- *
- * Copyright(c) 2008 Imagination Technologies Ltd. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful but, except
- * as otherwise stated in writing, without any warranty; without even the
- * implied warranty of merchantability or fitness for a particular purpose.
- * See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * The full GNU General Public License is included in this distribution in
- * the file called "COPYING".
- *
- * Contact Information:
- * Imagination Technologies Ltd. <gpl-support@imgtec.com>
- * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK
- *
- ******************************************************************************/
-
-#include <linux/string.h>
-
-#include "img_types.h"
-#include "pvr_debug.h"
-#include "dbgdrvif.h"
-#include "dbgdriv.h"
-#include "hotkey.h"
-#include "hostfunc.h"
-
-#define LAST_FRAME_BUF_SIZE 1024
-
-struct DBG_LASTFRAME_BUFFER {
- struct DBG_STREAM *psStream;
- u8 ui8Buffer[LAST_FRAME_BUF_SIZE];
- u32 ui32BufLen;
- struct DBG_LASTFRAME_BUFFER *psNext;
-};
-
-static struct DBG_STREAM *g_psStreamList;
-static struct DBG_LASTFRAME_BUFFER *g_psLFBufferList;
-
-static u32 g_ui32LOff;
-static u32 g_ui32Line;
-static u32 g_ui32MonoLines = 25;
-
-static IMG_BOOL g_bHotkeyMiddump = IMG_FALSE;
-static u32 g_ui32HotkeyMiddumpStart = 0xffffffff;
-static u32 g_ui32HotkeyMiddumpEnd = 0xffffffff;
-
-void *g_pvAPIMutex;
-
-IMG_BOOL gbDumpThisFrame = IMG_FALSE;
-
-static u32 SpaceInStream(struct DBG_STREAM *psStream);
-static IMG_BOOL ExpandStreamBuffer(struct DBG_STREAM *psStream,
- u32 ui32NewSize);
-struct DBG_LASTFRAME_BUFFER *FindLFBuf(struct DBG_STREAM *psStream);
-
-struct DBGKM_SERVICE_TABLE g_sDBGKMServices = {
- sizeof(struct DBGKM_SERVICE_TABLE),
- ExtDBGDrivCreateStream,
- ExtDBGDrivDestroyStream,
- ExtDBGDrivFindStream,
- ExtDBGDrivWriteString,
- ExtDBGDrivReadString,
- ExtDBGDrivWrite,
- ExtDBGDrivRead,
- ExtDBGDrivSetCaptureMode,
- ExtDBGDrivSetOutputMode,
- ExtDBGDrivSetDebugLevel,
- ExtDBGDrivSetFrame,
- ExtDBGDrivGetFrame,
- ExtDBGDrivOverrideMode,
- ExtDBGDrivDefaultMode,
- ExtDBGDrivWrite2,
- ExtDBGDrivWriteStringCM,
- ExtDBGDrivWriteCM,
- ExtDBGDrivSetMarker,
- ExtDBGDrivGetMarker,
- ExtDBGDrivStartInitPhase,
- ExtDBGDrivStopInitPhase,
- ExtDBGDrivIsCaptureFrame,
- ExtDBGDrivWriteLF,
- ExtDBGDrivReadLF,
- ExtDBGDrivGetStreamOffset,
- ExtDBGDrivSetStreamOffset,
- ExtDBGDrivIsLastCaptureFrame,
- ExtDBGDrivWaitForEvent
-};
-
-void *ExtDBGDrivCreateStream(char *pszName,
- u32 ui32CapMode,
- u32 ui32OutMode,
- u32 ui32Flags,
- u32 ui32Size)
-{
- void *pvRet;
-
- HostAquireMutex(g_pvAPIMutex);
-
- pvRet =
- DBGDrivCreateStream(pszName, ui32CapMode, ui32OutMode, ui32Flags,
- ui32Size);
-
- HostReleaseMutex(g_pvAPIMutex);
-
- return pvRet;
-}
-
-void ExtDBGDrivDestroyStream(struct DBG_STREAM *psStream)
-{
-
- HostAquireMutex(g_pvAPIMutex);
-
- DBGDrivDestroyStream(psStream);
-
- HostReleaseMutex(g_pvAPIMutex);
-
- return;
-}
-
-void *ExtDBGDrivFindStream(char *pszName,
- IMG_BOOL bResetStream)
-{
- void *pvRet;
-
- HostAquireMutex(g_pvAPIMutex);
-
- pvRet = DBGDrivFindStream(pszName, bResetStream);
-
- HostReleaseMutex(g_pvAPIMutex);
-
- return pvRet;
-}
-
-u32 ExtDBGDrivWriteString(struct DBG_STREAM *psStream,
- char *pszString,
- u32 ui32Level)
-{
- u32 ui32Ret;
-
- HostAquireMutex(g_pvAPIMutex);
-
- ui32Ret = DBGDrivWriteString(psStream, pszString, ui32Level);
-
- HostReleaseMutex(g_pvAPIMutex);
-
- return ui32Ret;
-}
-
-u32 ExtDBGDrivReadString(struct DBG_STREAM *psStream,
- char *pszString,
- u32 ui32Limit)
-{
- u32 ui32Ret;
-
- HostAquireMutex(g_pvAPIMutex);
-
- ui32Ret = DBGDrivReadString(psStream, pszString, ui32Limit);
-
- HostReleaseMutex(g_pvAPIMutex);
-
- return ui32Ret;
-}
-
-u32 ExtDBGDrivWrite(struct DBG_STREAM *psStream,
- u8 *pui8InBuf,
- u32 ui32InBuffSize,
- u32 ui32Level)
-{
- u32 ui32Ret;
-
- HostAquireMutex(g_pvAPIMutex);
-
- ui32Ret = DBGDrivWrite(psStream, pui8InBuf, ui32InBuffSize, ui32Level);
-
- HostReleaseMutex(g_pvAPIMutex);
-
- return ui32Ret;
-}
-
-u32 ExtDBGDrivRead(struct DBG_STREAM *psStream,
- IMG_BOOL bReadInitBuffer,
- u32 ui32OutBuffSize,
- u8 *pui8OutBuf)
-{
- u32 ui32Ret;
-
- HostAquireMutex(g_pvAPIMutex);
-
- ui32Ret =
- DBGDrivRead(psStream, bReadInitBuffer, ui32OutBuffSize, pui8OutBuf);
-
- HostReleaseMutex(g_pvAPIMutex);
-
- return ui32Ret;
-}
-
-void ExtDBGDrivSetCaptureMode(struct DBG_STREAM *psStream,
- u32 ui32Mode,
- u32 ui32Start,
- u32 ui32End,
- u32 ui32SampleRate)
-{
-
- HostAquireMutex(g_pvAPIMutex);
-
- DBGDrivSetCaptureMode(psStream, ui32Mode, ui32Start, ui32End,
- ui32SampleRate);
-
- HostReleaseMutex(g_pvAPIMutex);
-
- return;
-}
-
-void ExtDBGDrivSetOutputMode(struct DBG_STREAM *psStream,
- u32 ui32OutMode)
-{
-
- HostAquireMutex(g_pvAPIMutex);
-
- DBGDrivSetOutputMode(psStream, ui32OutMode);
-
- HostReleaseMutex(g_pvAPIMutex);
-
- return;
-}
-
-void ExtDBGDrivSetDebugLevel(struct DBG_STREAM *psStream,
- u32 ui32DebugLevel)
-{
-
- HostAquireMutex(g_pvAPIMutex);
-
- DBGDrivSetDebugLevel(psStream, ui32DebugLevel);
-
- HostReleaseMutex(g_pvAPIMutex);
-
- return;
-}
-
-void ExtDBGDrivSetFrame(struct DBG_STREAM *psStream, u32 ui32Frame)
-{
-
- HostAquireMutex(g_pvAPIMutex);
-
- DBGDrivSetFrame(psStream, ui32Frame);
-
- HostReleaseMutex(g_pvAPIMutex);
-
- return;
-}
-
-u32 ExtDBGDrivGetFrame(struct DBG_STREAM *psStream)
-{
- u32 ui32Ret;
-
- HostAquireMutex(g_pvAPIMutex);
-
- ui32Ret = DBGDrivGetFrame(psStream);
-
- HostReleaseMutex(g_pvAPIMutex);
-
- return ui32Ret;
-}
-
-u32 ExtDBGDrivIsLastCaptureFrame(struct DBG_STREAM *psStream)
-{
- u32 ui32Ret;
-
- HostAquireMutex(g_pvAPIMutex);
-
- ui32Ret = DBGDrivIsLastCaptureFrame(psStream);
-
- HostReleaseMutex(g_pvAPIMutex);
-
- return ui32Ret;
-}
-
-u32 ExtDBGDrivIsCaptureFrame(struct DBG_STREAM *psStream,
- IMG_BOOL bCheckPreviousFrame)
-{
- u32 ui32Ret;
-
- HostAquireMutex(g_pvAPIMutex);
-
- ui32Ret = DBGDrivIsCaptureFrame(psStream, bCheckPreviousFrame);
-
- HostReleaseMutex(g_pvAPIMutex);
-
- return ui32Ret;
-}
-
-void ExtDBGDrivOverrideMode(struct DBG_STREAM *psStream,
- u32 ui32Mode)
-{
-
- HostAquireMutex(g_pvAPIMutex);
-
- DBGDrivOverrideMode(psStream, ui32Mode);
-
- HostReleaseMutex(g_pvAPIMutex);
-
- return;
-}
-
-void ExtDBGDrivDefaultMode(struct DBG_STREAM *psStream)
-{
-
- HostAquireMutex(g_pvAPIMutex);
-
- DBGDrivDefaultMode(psStream);
-
- HostReleaseMutex(g_pvAPIMutex);
-
- return;
-}
-
-u32 ExtDBGDrivWrite2(struct DBG_STREAM *psStream,
- u8 *pui8InBuf,
- u32 ui32InBuffSize,
- u32 ui32Level)
-{
- u32 ui32Ret;
-
- HostAquireMutex(g_pvAPIMutex);
-
- ui32Ret = DBGDrivWrite2(psStream, pui8InBuf, ui32InBuffSize, ui32Level);
-
- HostReleaseMutex(g_pvAPIMutex);
-
- return ui32Ret;
-}
-
-u32 ExtDBGDrivWriteStringCM(struct DBG_STREAM *psStream,
- char *pszString,
- u32 ui32Level)
-{
- u32 ui32Ret;
-
- HostAquireMutex(g_pvAPIMutex);
-
- ui32Ret = DBGDrivWriteStringCM(psStream, pszString, ui32Level);
-
- HostReleaseMutex(g_pvAPIMutex);
-
- return ui32Ret;
-}
-
-u32 ExtDBGDrivWriteCM(struct DBG_STREAM *psStream,
- u8 *pui8InBuf,
- u32 ui32InBuffSize,
- u32 ui32Level)
-{
- u32 ui32Ret;
-
- HostAquireMutex(g_pvAPIMutex);
-
- ui32Ret =
- DBGDrivWriteCM(psStream, pui8InBuf, ui32InBuffSize, ui32Level);
-
- HostReleaseMutex(g_pvAPIMutex);
-
- return ui32Ret;
-}
-
-void ExtDBGDrivSetMarker(struct DBG_STREAM *psStream,
- u32 ui32Marker)
-{
-
- HostAquireMutex(g_pvAPIMutex);
-
- DBGDrivSetMarker(psStream, ui32Marker);
-
- HostReleaseMutex(g_pvAPIMutex);
-
- return;
-}
-
-u32 ExtDBGDrivGetMarker(struct DBG_STREAM *psStream)
-{
- u32 ui32Marker;
-
- HostAquireMutex(g_pvAPIMutex);
-
- ui32Marker = DBGDrivGetMarker(psStream);
-
- HostReleaseMutex(g_pvAPIMutex);
-
- return ui32Marker;
-}
-
-u32 ExtDBGDrivWriteLF(struct DBG_STREAM *psStream,
- u8 *pui8InBuf,
- u32 ui32InBuffSize,
- u32 ui32Level,
- u32 ui32Flags)
-{
- u32 ui32Ret;
-
- HostAquireMutex(g_pvAPIMutex);
-
- ui32Ret =
- DBGDrivWriteLF(psStream, pui8InBuf, ui32InBuffSize, ui32Level,
- ui32Flags);
-
- HostReleaseMutex(g_pvAPIMutex);
-
- return ui32Ret;
-}
-
-u32 ExtDBGDrivReadLF(struct DBG_STREAM *psStream,
- u32 ui32OutBuffSize,
- u8 *pui8OutBuf)
-{
- u32 ui32Ret;
-
- HostAquireMutex(g_pvAPIMutex);
-
- ui32Ret = DBGDrivReadLF(psStream, ui32OutBuffSize, pui8OutBuf);
-
- HostReleaseMutex(g_pvAPIMutex);
-
- return ui32Ret;
-}
-
-void ExtDBGDrivStartInitPhase(struct DBG_STREAM *psStream)
-{
-
- HostAquireMutex(g_pvAPIMutex);
-
- DBGDrivStartInitPhase(psStream);
-
- HostReleaseMutex(g_pvAPIMutex);
-
- return;
-}
-
-void ExtDBGDrivStopInitPhase(struct DBG_STREAM *psStream)
-{
-
- HostAquireMutex(g_pvAPIMutex);
-
- DBGDrivStopInitPhase(psStream);
-
- HostReleaseMutex(g_pvAPIMutex);
-
- return;
-}
-
-u32 ExtDBGDrivGetStreamOffset(struct DBG_STREAM *psStream)
-{
- u32 ui32Ret;
-
- HostAquireMutex(g_pvAPIMutex);
-
- ui32Ret = DBGDrivGetStreamOffset(psStream);
-
- HostReleaseMutex(g_pvAPIMutex);
-
- return ui32Ret;
-}
-
-void ExtDBGDrivSetStreamOffset(struct DBG_STREAM *psStream,
- u32 ui32StreamOffset)
-{
-
- HostAquireMutex(g_pvAPIMutex);
-
- DBGDrivSetStreamOffset(psStream, ui32StreamOffset);
-
- HostReleaseMutex(g_pvAPIMutex);
-}
-
-void ExtDBGDrivWaitForEvent(enum DBG_EVENT eEvent)
-{
-#if defined(SUPPORT_DBGDRV_EVENT_OBJECTS)
- DBGDrivWaitForEvent(eEvent);
-#else
- PVR_UNREFERENCED_PARAMETER(eEvent);
-#endif
-}
-
-u32 AtoI(char *szIn)
-{
- u32 ui32Len = 0;
- u32 ui32Value = 0;
- u32 ui32Digit = 1;
- u32 ui32Base = 10;
- int iPos;
- char bc;
-
- while (szIn[ui32Len] > 0)
- ui32Len++;
-
- if (ui32Len == 0)
- return 0;
-
- iPos = 0;
- while (szIn[iPos] == '0')
- iPos++;
- if (szIn[iPos] == '\0')
- return 0;
- if (szIn[iPos] == 'x' || szIn[iPos] == 'X') {
- ui32Base = 16;
- szIn[iPos] = '0';
- }
-
- for (iPos = ui32Len - 1; iPos >= 0; iPos--) {
- bc = szIn[iPos];
-
- if ((bc >= 'a') && (bc <= 'f') && ui32Base == 16)
- bc -= 'a' - 0xa;
- else if ((bc >= 'A') && (bc <= 'F') && ui32Base == 16)
- bc -= 'A' - 0xa;
- else if ((bc >= '0') && (bc <= '9'))
- bc -= '0';
- else
- return 0;
-
- ui32Value += bc * ui32Digit;
-
- ui32Digit = ui32Digit * ui32Base;
- }
- return ui32Value;
-}
-
-IMG_BOOL StreamValid(struct DBG_STREAM *psStream)
-{
- struct DBG_STREAM *psThis;
-
- psThis = g_psStreamList;
-
- while (psThis)
- if (psStream && (psThis == psStream))
- return IMG_TRUE;
- else
- psThis = psThis->psNext;
-
- return IMG_FALSE;
-}
-
-void Write(struct DBG_STREAM *psStream, u8 *pui8Data,
- u32 ui32InBuffSize)
-{
-
- if ((psStream->ui32WPtr + ui32InBuffSize) > psStream->ui32Size) {
- u32 ui32B1 = psStream->ui32Size - psStream->ui32WPtr;
- u32 ui32B2 = ui32InBuffSize - ui32B1;
-
- HostMemCopy((void *) (psStream->ui32Base +
- psStream->ui32WPtr),
- (void *) pui8Data, ui32B1);
-
- HostMemCopy((void *) psStream->ui32Base,
- (void *) ((u32) pui8Data + ui32B1),
- ui32B2);
-
- psStream->ui32WPtr = ui32B2;
- } else {
- HostMemCopy((void *) (psStream->ui32Base +
- psStream->ui32WPtr),
- (void *) pui8Data, ui32InBuffSize);
-
- psStream->ui32WPtr += ui32InBuffSize;
-
- if (psStream->ui32WPtr == psStream->ui32Size)
- psStream->ui32WPtr = 0;
- }
- psStream->ui32DataWritten += ui32InBuffSize;
-}
-
-void MonoOut(char *pszString, IMG_BOOL bNewLine)
-{
- u32 i;
- char *pScreen;
-
- pScreen = (char *)DBGDRIV_MONOBASE;
-
- pScreen += g_ui32Line * 160;
-
- i = 0;
- do {
- pScreen[g_ui32LOff + (i * 2)] = pszString[i];
- pScreen[g_ui32LOff + (i * 2) + 1] = 127;
- i++;
- } while ((pszString[i] != 0) && (i < 4096));
-
- g_ui32LOff += i * 2;
-
- if (bNewLine) {
- g_ui32LOff = 0;
- g_ui32Line++;
- }
-
- if (g_ui32Line == g_ui32MonoLines) {
- g_ui32Line = g_ui32MonoLines - 1;
-
- HostMemCopy((void *) DBGDRIV_MONOBASE,
- (void *) (DBGDRIV_MONOBASE + 160),
- 160 * (g_ui32MonoLines - 1));
-
- HostMemSet((void *) (DBGDRIV_MONOBASE +
- (160 * (g_ui32MonoLines - 1))), 0,
- 160);
- }
-}
-
-void AppendName(char *pszOut, char *pszBase, char *pszName)
-{
- u32 i;
- u32 ui32Off;
-
- i = 0;
-
- while (pszBase[i] != 0) {
- pszOut[i] = pszBase[i];
- i++;
- }
-
- ui32Off = i;
- i = 0;
-
- while (pszName[i] != 0) {
- pszOut[ui32Off + i] = pszName[i];
- i++;
- }
-
- pszOut[ui32Off + i] = pszName[i];
-}
-
-void *DBGDrivCreateStream(char *pszName,
- u32 ui32CapMode,
- u32 ui32OutMode,
- u32 ui32Flags,
- u32 ui32Size)
-{
- struct DBG_STREAM *psStream;
- struct DBG_STREAM *psInitStream;
- struct DBG_LASTFRAME_BUFFER *psLFBuffer;
- u32 ui32Off;
- void *pvBase;
-
- psStream = (struct DBG_STREAM *)DBGDrivFindStream(pszName, IMG_FALSE);
-
- if (psStream)
- return (void *)psStream;
-
- psStream = HostNonPageablePageAlloc(1);
- psInitStream = HostNonPageablePageAlloc(1);
- psLFBuffer = HostNonPageablePageAlloc(1);
- if ((!psStream) || (!psInitStream) || (!psLFBuffer)
- ) {
- PVR_DPF(PVR_DBG_ERROR,
- "DBGDriv: Couldn't create buffer !!!!!\n\r");
- return NULL;
- }
-
- if ((ui32Flags & DEBUG_FLAGS_USE_NONPAGED_MEM) != 0)
- pvBase = HostNonPageablePageAlloc(ui32Size);
- else
- pvBase = HostPageablePageAlloc(ui32Size);
-
- if (!pvBase) {
- PVR_DPF(PVR_DBG_ERROR,
- "DBGDriv: Couldn't create buffer !!!!!\n\r");
- HostNonPageablePageFree(psStream);
- return NULL;
- }
-
- psStream->psNext = 0;
- psStream->ui32Flags = ui32Flags;
- psStream->ui32Base = (u32) pvBase;
- psStream->ui32Size = ui32Size * 4096;
- psStream->ui32RPtr = 0;
- psStream->ui32WPtr = 0;
- psStream->ui32DataWritten = 0;
- psStream->ui32CapMode = ui32CapMode;
- psStream->ui32OutMode = ui32OutMode;
- psStream->ui32DebugLevel = DEBUG_LEVEL_0;
- psStream->ui32DefaultMode = ui32CapMode;
- psStream->ui32Start = 0;
- psStream->ui32End = 0;
- psStream->ui32Current = 0;
- psStream->ui32SampleRate = 1;
- psStream->ui32Access = 0;
- psStream->ui32Timeout = 0;
- psStream->ui32Marker = 0;
- psStream->bInitPhaseComplete = IMG_FALSE;
-
- if ((ui32Flags & DEBUG_FLAGS_USE_NONPAGED_MEM) != 0)
- pvBase = HostNonPageablePageAlloc(ui32Size);
- else
- pvBase = HostPageablePageAlloc(ui32Size);
-
- if (!pvBase) {
- PVR_DPF(PVR_DBG_ERROR,
- "DBGDriv: Couldn't create buffer !!!!!\n\r");
-
- if ((psStream->ui32Flags & DEBUG_FLAGS_USE_NONPAGED_MEM) != 0)
- HostNonPageablePageFree((void *) psStream->
- ui32Base);
- else
- HostPageablePageFree((void *) psStream->ui32Base);
- HostNonPageablePageFree(psStream);
- return NULL;
- }
-
- psInitStream->psNext = 0;
- psInitStream->ui32Flags = ui32Flags;
- psInitStream->ui32Base = (u32) pvBase;
- psInitStream->ui32Size = ui32Size * 4096;
- psInitStream->ui32RPtr = 0;
- psInitStream->ui32WPtr = 0;
- psInitStream->ui32DataWritten = 0;
- psInitStream->ui32CapMode = ui32CapMode;
- psInitStream->ui32OutMode = ui32OutMode;
- psInitStream->ui32DebugLevel = DEBUG_LEVEL_0;
- psInitStream->ui32DefaultMode = ui32CapMode;
- psInitStream->ui32Start = 0;
- psInitStream->ui32End = 0;
- psInitStream->ui32Current = 0;
- psInitStream->ui32SampleRate = 1;
- psInitStream->ui32Access = 0;
- psInitStream->ui32Timeout = 0;
- psInitStream->ui32Marker = 0;
- psInitStream->bInitPhaseComplete = IMG_FALSE;
-
- psStream->psInitStream = psInitStream;
-
- psLFBuffer->psStream = psStream;
- psLFBuffer->ui32BufLen = 0;
-
- g_bHotkeyMiddump = IMG_FALSE;
- g_ui32HotkeyMiddumpStart = 0xffffffff;
- g_ui32HotkeyMiddumpEnd = 0xffffffff;
-
- ui32Off = 0;
-
- do {
- psStream->szName[ui32Off] = pszName[ui32Off];
-
- ui32Off++;
- } while ((pszName[ui32Off] != 0)
- && (ui32Off < (4096 - sizeof(struct DBG_STREAM))));
-
- psStream->szName[ui32Off] = pszName[ui32Off];
-
- psStream->psNext = g_psStreamList;
- g_psStreamList = psStream;
-
- psLFBuffer->psNext = g_psLFBufferList;
- g_psLFBufferList = psLFBuffer;
-
- return (void *)psStream;
-}
-
-void DBGDrivDestroyStream(struct DBG_STREAM *psStream)
-{
- struct DBG_STREAM *psStreamThis;
- struct DBG_STREAM *psStreamPrev;
- struct DBG_LASTFRAME_BUFFER *psLFBuffer;
- struct DBG_LASTFRAME_BUFFER *psLFThis;
- struct DBG_LASTFRAME_BUFFER *psLFPrev;
-
- PVR_DPF(PVR_DBG_MESSAGE, "DBGDriv: Destroying stream %s\r\n",
- psStream->szName);
-
- if (!StreamValid(psStream))
- return;
-
- psLFBuffer = FindLFBuf(psStream);
-
- psStreamThis = g_psStreamList;
- psStreamPrev = 0;
-
- while (psStreamThis)
- if (psStreamThis == psStream) {
- if (psStreamPrev)
- psStreamPrev->psNext = psStreamThis->psNext;
- else
- g_psStreamList = psStreamThis->psNext;
-
- psStreamThis = 0;
- } else {
- psStreamPrev = psStreamThis;
- psStreamThis = psStreamThis->psNext;
- }
-
- psLFThis = g_psLFBufferList;
- psLFPrev = 0;
-
- while (psLFThis)
- if (psLFThis == psLFBuffer) {
- if (psLFPrev)
- psLFPrev->psNext = psLFThis->psNext;
- else
- g_psLFBufferList = psLFThis->psNext;
-
- psLFThis = 0;
- } else {
- psLFPrev = psLFThis;
- psLFThis = psLFThis->psNext;
- }
-
- if (psStream->ui32CapMode & DEBUG_CAPMODE_HOTKEY)
- DeactivateHotKeys();
-
- if ((psStream->ui32Flags & DEBUG_FLAGS_USE_NONPAGED_MEM) != 0) {
- HostNonPageablePageFree((void *) psStream->ui32Base);
- HostNonPageablePageFree((void *) psStream->psInitStream->
- ui32Base);
- } else {
- HostPageablePageFree((void *) psStream->ui32Base);
- HostPageablePageFree((void *) psStream->psInitStream->
- ui32Base);
- }
-
- HostNonPageablePageFree(psStream->psInitStream);
- HostNonPageablePageFree(psStream);
- HostNonPageablePageFree(psLFBuffer);
-
- if (g_psStreamList == 0)
- PVR_DPF(PVR_DBG_MESSAGE, "DBGDriv: Stream list now empty");
-
- return;
-}
-
-void *DBGDrivFindStream(char *pszName,
- IMG_BOOL bResetStream)
-{
- struct DBG_STREAM *psStream;
- struct DBG_STREAM *psThis;
- u32 ui32Off;
- IMG_BOOL bAreSame;
-
- psStream = 0;
-
- for (psThis = g_psStreamList; psThis != NULL;
- psThis = psThis->psNext) {
- bAreSame = IMG_TRUE;
- ui32Off = 0;
-
- if (strlen(psThis->szName) == strlen(pszName)) {
- while ((psThis->szName[ui32Off] != 0)
- && (pszName[ui32Off] != 0) && (ui32Off < 128)
- && bAreSame) {
- if (psThis->szName[ui32Off] != pszName[ui32Off])
- bAreSame = IMG_FALSE;
-
- ui32Off++;
- }
- } else {
- bAreSame = IMG_FALSE;
- }
-
- if (bAreSame) {
- psStream = psThis;
- break;
- }
- }
-
- if (bResetStream && psStream) {
- static char szComment[] = "-- Init phase terminated\r\n";
- psStream->psInitStream->ui32RPtr = 0;
- psStream->ui32RPtr = 0;
- psStream->ui32WPtr = 0;
- psStream->ui32DataWritten =
- psStream->psInitStream->ui32DataWritten;
- if (psStream->bInitPhaseComplete == IMG_FALSE) {
- if (psStream->ui32Flags & DEBUG_FLAGS_TEXTSTREAM)
- DBGDrivWrite2(psStream, (u8 *) szComment,
- sizeof(szComment) - 1, 0x01);
- psStream->bInitPhaseComplete = IMG_TRUE;
- }
- }
-
- return (void *)psStream;
-}
-
-u32 DBGDrivWriteStringCM(struct DBG_STREAM *psStream,
- char *pszString,
- u32 ui32Level)
-{
-
- if (!StreamValid(psStream))
- return 0xFFFFFFFF;
-
- if (psStream->ui32CapMode & DEBUG_CAPMODE_FRAMED) {
- if (!(psStream->ui32Flags & DEBUG_FLAGS_ENABLESAMPLE))
- return 0;
- } else {
- if (psStream->ui32CapMode == DEBUG_CAPMODE_HOTKEY)
- if ((psStream->ui32Current != g_ui32HotKeyFrame)
- || (g_bHotKeyPressed == IMG_FALSE))
- return 0;
- }
-
- return DBGDrivWriteString(psStream, pszString, ui32Level);
-
-}
-
-u32 DBGDrivWriteString(struct DBG_STREAM *psStream,
- char *pszString,
- u32 ui32Level)
-{
- u32 ui32Len;
- u32 ui32Space;
- u32 ui32WPtr;
- u8 *pui8Buffer;
-
- if (!StreamValid(psStream))
- return 0xFFFFFFFF;
-
- if (!(psStream->ui32DebugLevel & ui32Level))
- return 0xFFFFFFFF;
-
- if (!(psStream->ui32OutMode & DEBUG_OUTMODE_ASYNC)) {
- if (psStream->ui32OutMode & DEBUG_OUTMODE_STANDARDDBG)
- PVR_DPF(PVR_DBG_MESSAGE, "%s: %s\r\n",
- psStream->szName, pszString);
-
- if (psStream->ui32OutMode & DEBUG_OUTMODE_MONO) {
- MonoOut(psStream->szName, IMG_FALSE);
- MonoOut(": ", IMG_FALSE);
- MonoOut(pszString, IMG_TRUE);
- }
- }
-
- if (!((psStream->ui32OutMode & DEBUG_OUTMODE_STREAMENABLE) ||
- (psStream->ui32OutMode & DEBUG_OUTMODE_ASYNC)
- )
- )
- return 0xFFFFFFFF;
-
- ui32Space = SpaceInStream(psStream);
-
- if (ui32Space > 0)
- ui32Space--;
-
- ui32Len = 0;
- ui32WPtr = psStream->ui32WPtr;
- pui8Buffer = (u8 *) psStream->ui32Base;
-
- while ((pszString[ui32Len] != 0) && (ui32Len < ui32Space)) {
- pui8Buffer[ui32WPtr] = pszString[ui32Len];
- ui32Len++;
- ui32WPtr++;
- if (ui32WPtr == psStream->ui32Size)
- ui32WPtr = 0;
- }
-
- if (ui32Len < ui32Space) {
-
- pui8Buffer[ui32WPtr] = pszString[ui32Len];
- ui32Len++;
- ui32WPtr++;
- if (ui32WPtr == psStream->ui32Size)
- ui32WPtr = 0;
-
- psStream->ui32WPtr = ui32WPtr;
- psStream->ui32DataWritten += ui32Len;
- } else {
- ui32Len = 0;
- }
-
-#if defined(SUPPORT_DBGDRV_EVENT_OBJECTS)
- if (ui32Len)
- HostSignalEvent(DBG_EVENT_STREAM_DATA);
-#endif
-
- return ui32Len;
-}
-
-u32 DBGDrivReadString(struct DBG_STREAM *psStream,
- char *pszString,
- u32 ui32Limit)
-{
- u32 ui32OutLen;
- u32 ui32Len;
- u32 ui32Offset;
- u8 *pui8Buff;
-
- if (!StreamValid(psStream))
- return 0;
-
- pui8Buff = (u8 *) psStream->ui32Base;
- ui32Offset = psStream->ui32RPtr;
-
- if (psStream->ui32RPtr == psStream->ui32WPtr)
- return 0;
-
- ui32Len = 0;
- while ((pui8Buff[ui32Offset] != 0)
- && (ui32Offset != psStream->ui32WPtr)) {
- ui32Offset++;
- ui32Len++;
-
- if (ui32Offset == psStream->ui32Size)
- ui32Offset = 0;
- }
-
- ui32OutLen = ui32Len + 1;
-
- if (ui32Len > ui32Limit)
- return 0;
-
- ui32Offset = psStream->ui32RPtr;
- ui32Len = 0;
-
- while ((pui8Buff[ui32Offset] != 0) && (ui32Len < ui32Limit)) {
- pszString[ui32Len] = pui8Buff[ui32Offset];
- ui32Offset++;
- ui32Len++;
-
- if (ui32Offset == psStream->ui32Size)
- ui32Offset = 0;
- }
-
- pszString[ui32Len] = pui8Buff[ui32Offset];
-
- psStream->ui32RPtr = ui32Offset + 1;
-
- if (psStream->ui32RPtr == psStream->ui32Size)
- psStream->ui32RPtr = 0;
-
- return ui32OutLen;
-}
-
-u32 DBGDrivWrite(struct DBG_STREAM *psMainStream,
- u8 *pui8InBuf,
- u32 ui32InBuffSize,
- u32 ui32Level)
-{
- u32 ui32Space;
- struct DBG_STREAM *psStream;
-
- if (!StreamValid(psMainStream))
- return 0xFFFFFFFF;
-
- if (!(psMainStream->ui32DebugLevel & ui32Level))
- return 0xFFFFFFFF;
-
- if (psMainStream->ui32CapMode & DEBUG_CAPMODE_FRAMED) {
- if (!(psMainStream->ui32Flags & DEBUG_FLAGS_ENABLESAMPLE))
- return 0xFFFFFFFF;
- } else {
- if (psMainStream->ui32CapMode == DEBUG_CAPMODE_HOTKEY)
- if ((psMainStream->ui32Current != g_ui32HotKeyFrame)
- || (g_bHotKeyPressed == IMG_FALSE))
- return 0xFFFFFFFF;
-
- }
-
- if (psMainStream->bInitPhaseComplete)
- psStream = psMainStream;
- else
- psStream = psMainStream->psInitStream;
-
- ui32Space = SpaceInStream(psStream);
-
- if (!(psStream->ui32OutMode & DEBUG_OUTMODE_STREAMENABLE))
- return 0;
-
- if (ui32Space < 8)
- return 0;
-
- if (ui32Space <= (ui32InBuffSize + 4))
- ui32InBuffSize = ui32Space - 8;
-
- Write(psStream, (u8 *) &ui32InBuffSize, 4);
- Write(psStream, pui8InBuf, ui32InBuffSize);
-
-#if defined(SUPPORT_DBGDRV_EVENT_OBJECTS)
- if (ui32InBuffSize)
- HostSignalEvent(DBG_EVENT_STREAM_DATA);
-#endif
- return ui32InBuffSize;
-}
-
-u32 DBGDrivWriteCM(struct DBG_STREAM *psStream,
- u8 *pui8InBuf,
- u32 ui32InBuffSize,
- u32 ui32Level)
-{
-
- if (!StreamValid(psStream))
- return 0xFFFFFFFF;
-
- if (psStream->ui32CapMode & DEBUG_CAPMODE_FRAMED) {
- if (!(psStream->ui32Flags & DEBUG_FLAGS_ENABLESAMPLE))
- return 0xFFFFFFFF;
- } else {
- if (psStream->ui32CapMode == DEBUG_CAPMODE_HOTKEY)
- if ((psStream->ui32Current != g_ui32HotKeyFrame)
- || (g_bHotKeyPressed == IMG_FALSE))
- return 0xFFFFFFFF;
- }
-
- return DBGDrivWrite2(psStream, pui8InBuf, ui32InBuffSize, ui32Level);
-}
-
-u32 DBGDrivWrite2(struct DBG_STREAM *psMainStream,
- u8 *pui8InBuf,
- u32 ui32InBuffSize,
- u32 ui32Level)
-{
- u32 ui32Space;
- struct DBG_STREAM *psStream;
-
- if (!StreamValid(psMainStream))
- return 0xFFFFFFFF;
-
- if (!(psMainStream->ui32DebugLevel & ui32Level))
- return 0xFFFFFFFF;
-
- if (psMainStream->bInitPhaseComplete)
- psStream = psMainStream;
- else
- psStream = psMainStream->psInitStream;
-
- ui32Space = SpaceInStream(psStream);
-
- if (!(psStream->ui32OutMode & DEBUG_OUTMODE_STREAMENABLE))
- return 0;
-
- if (psStream->ui32Flags & DEBUG_FLAGS_NO_BUF_EXPANDSION) {
-
- if (ui32Space < 32)
- return 0;
- } else {
- if ((ui32Space < 32) || (ui32Space <= (ui32InBuffSize + 4))) {
- u32 ui32NewBufSize;
-
- ui32NewBufSize = 2 * psStream->ui32Size;
-
- if (ui32InBuffSize > psStream->ui32Size)
- ui32NewBufSize += ui32InBuffSize;
-
- if (!ExpandStreamBuffer(psStream, ui32NewBufSize))
- if (ui32Space < 32)
- return 0;
-
- ui32Space = SpaceInStream(psStream);
- }
- }
-
- if (ui32Space <= (ui32InBuffSize + 4))
- ui32InBuffSize = ui32Space - 4;
-
- Write(psStream, pui8InBuf, ui32InBuffSize);
-
-#if defined(SUPPORT_DBGDRV_EVENT_OBJECTS)
- if (ui32InBuffSize)
- HostSignalEvent(DBG_EVENT_STREAM_DATA);
-#endif
- return ui32InBuffSize;
-}
-
-u32 DBGDrivRead(struct DBG_STREAM *psMainStream,
- IMG_BOOL bReadInitBuffer,
- u32 ui32OutBuffSize,
- u8 *pui8OutBuf)
-{
- u32 ui32Data;
- struct DBG_STREAM *psStream;
-
- if (!StreamValid(psMainStream))
- return 0;
-
- if (bReadInitBuffer)
- psStream = psMainStream->psInitStream;
- else
- psStream = psMainStream;
-
- if (psStream->ui32RPtr == psStream->ui32WPtr)
- return 0;
-
- if (psStream->ui32RPtr <= psStream->ui32WPtr) {
- ui32Data = psStream->ui32WPtr - psStream->ui32RPtr;
- } else {
- ui32Data =
- psStream->ui32WPtr + (psStream->ui32Size -
- psStream->ui32RPtr);
- }
-
- if (ui32Data > ui32OutBuffSize)
- ui32Data = ui32OutBuffSize;
-
- if ((psStream->ui32RPtr + ui32Data) > psStream->ui32Size) {
- u32 ui32B1 = psStream->ui32Size - psStream->ui32RPtr;
- u32 ui32B2 = ui32Data - ui32B1;
-
- HostMemCopy((void *) pui8OutBuf,
- (void *) (psStream->ui32Base +
- psStream->ui32RPtr), ui32B1);
-
- HostMemCopy((void *) ((u32) pui8OutBuf + ui32B1),
- (void *) psStream->ui32Base, ui32B2);
-
- psStream->ui32RPtr = ui32B2;
- } else {
- HostMemCopy((void *) pui8OutBuf,
- (void *) (psStream->ui32Base +
- psStream->ui32RPtr), ui32Data);
-
- psStream->ui32RPtr += ui32Data;
-
- if (psStream->ui32RPtr == psStream->ui32Size)
- psStream->ui32RPtr = 0;
- }
-
- return ui32Data;
-}
-
-void DBGDrivSetCaptureMode(struct DBG_STREAM *psStream,
- u32 ui32Mode,
- u32 ui32Start,
- u32 ui32End,
- u32 ui32SampleRate)
-{
-
- if (!StreamValid(psStream))
- return;
-
- psStream->ui32CapMode = ui32Mode;
- psStream->ui32DefaultMode = ui32Mode;
- psStream->ui32Start = ui32Start;
- psStream->ui32End = ui32End;
- psStream->ui32SampleRate = ui32SampleRate;
-
- if (psStream->ui32CapMode & DEBUG_CAPMODE_HOTKEY)
- ActivateHotKeys(psStream);
-}
-
-void DBGDrivSetOutputMode(struct DBG_STREAM *psStream,
- u32 ui32OutMode)
-{
-
- if (!StreamValid(psStream))
- return;
-
- psStream->ui32OutMode = ui32OutMode;
-}
-
-void DBGDrivSetDebugLevel(struct DBG_STREAM *psStream,
- u32 ui32DebugLevel)
-{
-
- if (!StreamValid(psStream))
- return;
-
- psStream->ui32DebugLevel = ui32DebugLevel;
-}
-
-void DBGDrivSetFrame(struct DBG_STREAM *psStream, u32 ui32Frame)
-{
-
- if (!StreamValid(psStream))
- return;
-
- psStream->ui32Current = ui32Frame;
-
- if ((ui32Frame >= psStream->ui32Start) &&
- (ui32Frame <= psStream->ui32End) &&
- (((ui32Frame - psStream->ui32Start) % psStream->ui32SampleRate) ==
- 0))
- psStream->ui32Flags |= DEBUG_FLAGS_ENABLESAMPLE;
- else
- psStream->ui32Flags &= ~DEBUG_FLAGS_ENABLESAMPLE;
-
- if (g_bHotkeyMiddump) {
- if ((ui32Frame >= g_ui32HotkeyMiddumpStart) &&
- (ui32Frame <= g_ui32HotkeyMiddumpEnd) &&
- (((ui32Frame -
- g_ui32HotkeyMiddumpStart) % psStream->ui32SampleRate) ==
- 0)) {
- psStream->ui32Flags |= DEBUG_FLAGS_ENABLESAMPLE;
- } else {
- psStream->ui32Flags &= ~DEBUG_FLAGS_ENABLESAMPLE;
- if (psStream->ui32Current > g_ui32HotkeyMiddumpEnd)
- g_bHotkeyMiddump = IMG_FALSE;
- }
- }
-
- if (g_bHotKeyRegistered) {
- g_bHotKeyRegistered = IMG_FALSE;
-
- PVR_DPF(PVR_DBG_MESSAGE, "Hotkey pressed (%08x)!\n",
- psStream);
-
- if (!g_bHotKeyPressed) {
-
- g_ui32HotKeyFrame = psStream->ui32Current + 2;
-
- g_bHotKeyPressed = IMG_TRUE;
- }
-
- if ((psStream->ui32CapMode & DEBUG_CAPMODE_FRAMED)
- && (psStream->ui32CapMode & DEBUG_CAPMODE_HOTKEY)) {
- if (!g_bHotkeyMiddump) {
-
- g_ui32HotkeyMiddumpStart =
- g_ui32HotKeyFrame + 1;
- g_ui32HotkeyMiddumpEnd = 0xffffffff;
- g_bHotkeyMiddump = IMG_TRUE;
- PVR_DPF(PVR_DBG_MESSAGE,
- "Sampling every %d frame(s)\n",
- psStream->ui32SampleRate);
- } else {
-
- g_ui32HotkeyMiddumpEnd = g_ui32HotKeyFrame;
- PVR_DPF(PVR_DBG_MESSAGE,
- "Turning off sampling\n");
- }
- }
-
- }
-
- if (psStream->ui32Current > g_ui32HotKeyFrame)
- g_bHotKeyPressed = IMG_FALSE;
-}
-
-u32 DBGDrivGetFrame(struct DBG_STREAM *psStream)
-{
-
- if (!StreamValid(psStream))
- return 0;
-
- return psStream->ui32Current;
-}
-
-u32 DBGDrivIsLastCaptureFrame(struct DBG_STREAM *psStream)
-{
- u32 ui32NextFrame;
-
- if (!StreamValid(psStream))
- return IMG_FALSE;
-
- if (psStream->ui32CapMode & DEBUG_CAPMODE_FRAMED) {
- ui32NextFrame =
- psStream->ui32Current + psStream->ui32SampleRate;
- if (ui32NextFrame > psStream->ui32End)
- return IMG_TRUE;
- }
- return IMG_FALSE;
-}
-
-u32 DBGDrivIsCaptureFrame(struct DBG_STREAM *psStream,
- IMG_BOOL bCheckPreviousFrame)
-{
- u32 ui32FrameShift = bCheckPreviousFrame ? 1 : 0;
-
- if (!StreamValid(psStream))
- return IMG_FALSE;
-
- if (psStream->ui32CapMode & DEBUG_CAPMODE_FRAMED) {
-
- if (g_bHotkeyMiddump) {
- if ((psStream->ui32Current >=
- (g_ui32HotkeyMiddumpStart - ui32FrameShift))
- && (psStream->ui32Current <=
- (g_ui32HotkeyMiddumpEnd - ui32FrameShift))
- &&
- ((((psStream->ui32Current + ui32FrameShift) -
- g_ui32HotkeyMiddumpStart) %
- psStream->ui32SampleRate) == 0))
- return IMG_TRUE;
- } else {
- if ((psStream->ui32Current >=
- (psStream->ui32Start - ui32FrameShift))
- && (psStream->ui32Current <=
- (psStream->ui32End - ui32FrameShift))
- &&
- ((((psStream->ui32Current + ui32FrameShift) -
- psStream->ui32Start) %
- psStream->ui32SampleRate) == 0))
- return IMG_TRUE;
- }
- } else if (psStream->ui32CapMode == DEBUG_CAPMODE_HOTKEY) {
- if ((psStream->ui32Current ==
- (g_ui32HotKeyFrame - ui32FrameShift))
- && (g_bHotKeyPressed))
- return IMG_TRUE;
- }
-
-
- return IMG_FALSE;
-}
-
-void DBGDrivOverrideMode(struct DBG_STREAM *psStream, u32 ui32Mode)
-{
-
- if (!StreamValid(psStream))
- return;
-
- psStream->ui32CapMode = ui32Mode;
-}
-
-void DBGDrivDefaultMode(struct DBG_STREAM *psStream)
-{
-
- if (!StreamValid(psStream))
- return;
-
- psStream->ui32CapMode = psStream->ui32DefaultMode;
-}
-
-void DBGDrivSetMarker(struct DBG_STREAM *psStream, u32 ui32Marker)
-{
-
- if (!StreamValid(psStream))
- return;
-
- psStream->ui32Marker = ui32Marker;
-}
-
-u32 DBGDrivGetMarker(struct DBG_STREAM *psStream)
-{
-
- if (!StreamValid(psStream))
- return 0;
-
- return psStream->ui32Marker;
-}
-
-u32 DBGDrivGetStreamOffset(struct DBG_STREAM *psMainStream)
-{
- struct DBG_STREAM *psStream;
-
- if (!StreamValid(psMainStream))
- return 0;
-
- if (psMainStream->bInitPhaseComplete)
- psStream = psMainStream;
- else
- psStream = psMainStream->psInitStream;
-
- return psStream->ui32DataWritten;
-}
-
-void DBGDrivSetStreamOffset(struct DBG_STREAM *psMainStream,
- u32 ui32StreamOffset)
-{
- struct DBG_STREAM *psStream;
-
- if (!StreamValid(psMainStream))
- return;
-
- if (psMainStream->bInitPhaseComplete)
- psStream = psMainStream;
- else
- psStream = psMainStream->psInitStream;
-
- psStream->ui32DataWritten = ui32StreamOffset;
-}
-
-u32 DBGDrivGetServiceTable(void)
-{
- return (u32)&g_sDBGKMServices;
-}
-
-u32 DBGDrivWriteLF(struct DBG_STREAM *psStream,
- u8 *pui8InBuf,
- u32 ui32InBuffSize,
- u32 ui32Level,
- u32 ui32Flags)
-{
- struct DBG_LASTFRAME_BUFFER *psLFBuffer;
-
- if (!StreamValid(psStream))
- return 0xFFFFFFFF;
-
- if (!(psStream->ui32DebugLevel & ui32Level))
- return 0xFFFFFFFF;
-
- if (psStream->ui32CapMode & DEBUG_CAPMODE_FRAMED) {
- if (!(psStream->ui32Flags & DEBUG_FLAGS_ENABLESAMPLE))
- return 0xFFFFFFFF;
- } else if (psStream->ui32CapMode == DEBUG_CAPMODE_HOTKEY) {
- if ((psStream->ui32Current != g_ui32HotKeyFrame)
- || (g_bHotKeyPressed == IMG_FALSE))
- return 0xFFFFFFFF;
- }
-
- psLFBuffer = FindLFBuf(psStream);
-
- if (ui32Flags & WRITELF_FLAGS_RESETBUF) {
-
- ui32InBuffSize =
- (ui32InBuffSize >
- LAST_FRAME_BUF_SIZE) ? LAST_FRAME_BUF_SIZE :
- ui32InBuffSize;
- HostMemCopy((void *) psLFBuffer->ui8Buffer,
- (void *) pui8InBuf, ui32InBuffSize);
- psLFBuffer->ui32BufLen = ui32InBuffSize;
- } else {
-
- ui32InBuffSize =
- ((psLFBuffer->ui32BufLen + ui32InBuffSize) >
- LAST_FRAME_BUF_SIZE) ? (LAST_FRAME_BUF_SIZE -
- psLFBuffer->
- ui32BufLen) : ui32InBuffSize;
- HostMemCopy((void *) (&psLFBuffer->
- ui8Buffer[psLFBuffer->ui32BufLen]),
- (void *) pui8InBuf, ui32InBuffSize);
- psLFBuffer->ui32BufLen += ui32InBuffSize;
- }
-
- return ui32InBuffSize;
-}
-
-u32 DBGDrivReadLF(struct DBG_STREAM *psStream,
- u32 ui32OutBuffSize,
- u8 *pui8OutBuf)
-{
- struct DBG_LASTFRAME_BUFFER *psLFBuffer;
- u32 ui32Data;
-
- if (!StreamValid(psStream))
- return 0;
-
- psLFBuffer = FindLFBuf(psStream);
-
- ui32Data =
- (ui32OutBuffSize <
- psLFBuffer->ui32BufLen) ? ui32OutBuffSize : psLFBuffer->ui32BufLen;
-
- HostMemCopy((void *) pui8OutBuf, (void *) psLFBuffer->ui8Buffer,
- ui32Data);
-
- return ui32Data;
-}
-
-void DBGDrivStartInitPhase(struct DBG_STREAM *psStream)
-{
- psStream->bInitPhaseComplete = IMG_FALSE;
-}
-
-void DBGDrivStopInitPhase(struct DBG_STREAM *psStream)
-{
- psStream->bInitPhaseComplete = IMG_TRUE;
-}
-
-#if defined(SUPPORT_DBGDRV_EVENT_OBJECTS)
-void DBGDrivWaitForEvent(enum DBG_EVENT eEvent)
-{
- HostWaitForEvent(eEvent);
-}
-#endif
-
-static IMG_BOOL ExpandStreamBuffer(struct DBG_STREAM *psStream, u32 ui32NewSize)
-{
- void *pvNewBuf;
- u32 ui32NewSizeInPages;
- u32 ui32NewWOffset;
- u32 ui32SpaceInOldBuf;
-
- if (psStream->ui32Size >= ui32NewSize)
- return IMG_FALSE;
-
- ui32SpaceInOldBuf = SpaceInStream(psStream);
-
- ui32NewSizeInPages = ((ui32NewSize + 0xfff) & ~0xfff) / 4096;
-
- if ((psStream->ui32Flags & DEBUG_FLAGS_USE_NONPAGED_MEM) != 0)
- pvNewBuf = HostNonPageablePageAlloc(ui32NewSizeInPages);
- else
- pvNewBuf = HostPageablePageAlloc(ui32NewSizeInPages);
-
- if (pvNewBuf == NULL)
- return IMG_FALSE;
-
- if (psStream->ui32RPtr <= psStream->ui32WPtr) {
-
- HostMemCopy((void *) pvNewBuf,
- (void *) (psStream->ui32Base +
- psStream->ui32RPtr),
- psStream->ui32WPtr - psStream->ui32RPtr);
- } else {
- u32 ui32FirstCopySize;
-
- ui32FirstCopySize = psStream->ui32Size - psStream->ui32RPtr;
-
- HostMemCopy((void *) pvNewBuf,
- (void *) (psStream->ui32Base +
- psStream->ui32RPtr),
- ui32FirstCopySize);
-
- HostMemCopy((void *) ((u32) pvNewBuf +
- ui32FirstCopySize),
- (void *) psStream->ui32Base,
- psStream->ui32WPtr);
- }
-
- ui32NewWOffset = psStream->ui32Size - ui32SpaceInOldBuf;
-
- if ((psStream->ui32Flags & DEBUG_FLAGS_USE_NONPAGED_MEM) != 0)
- HostNonPageablePageFree((void *) psStream->ui32Base);
- else
- HostPageablePageFree((void *) psStream->ui32Base);
-
- psStream->ui32Base = (u32) pvNewBuf;
- psStream->ui32RPtr = 0;
- psStream->ui32WPtr = ui32NewWOffset;
- psStream->ui32Size = ui32NewSizeInPages * 4096;
-
- return IMG_TRUE;
-}
-
-static u32 SpaceInStream(struct DBG_STREAM *psStream)
-{
- u32 ui32Space;
-
- if (psStream->ui32RPtr > psStream->ui32WPtr)
- ui32Space = psStream->ui32RPtr - psStream->ui32WPtr;
- else
- ui32Space =
- psStream->ui32RPtr + (psStream->ui32Size -
- psStream->ui32WPtr);
-
- return ui32Space;
-}
-
-void DestroyAllStreams(void)
-{
- while (g_psStreamList != NULL)
- DBGDrivDestroyStream(g_psStreamList);
- return;
-}
-
-struct DBG_LASTFRAME_BUFFER *FindLFBuf(struct DBG_STREAM *psStream)
-{
- struct DBG_LASTFRAME_BUFFER *psLFBuffer;
-
- psLFBuffer = g_psLFBufferList;
-
- while (psLFBuffer) {
- if (psLFBuffer->psStream == psStream)
- break;
-
- psLFBuffer = psLFBuffer->psNext;
- }
-
- return psLFBuffer;
-}
+++ /dev/null
-/**********************************************************************
- *
- * Copyright(c) 2008 Imagination Technologies Ltd. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful but, except
- * as otherwise stated in writing, without any warranty; without even the
- * implied warranty of merchantability or fitness for a particular purpose.
- * See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * The full GNU General Public License is included in this distribution in
- * the file called "COPYING".
- *
- * Contact Information:
- * Imagination Technologies Ltd. <gpl-support@imgtec.com>
- * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK
- *
- ******************************************************************************/
-
-#ifndef _DBGDRIV_
-#define _DBGDRIV_
-
-#define BUFFER_SIZE (64 * PAGESIZE)
-
-#define DBGDRIV_VERSION 0x100
-#define MAX_PROCESSES 2
-#define BLOCK_USED 0x01
-#define BLOCK_LOCKED 0x02
-#define DBGDRIV_MONOBASE 0x000B0000
-
-extern void *g_pvAPIMutex;
-
-void *DBGDrivCreateStream(char *pszName,
- u32 ui32CapMode,
- u32 ui32OutMode,
- u32 ui32Flags,
- u32 ui32Pages);
-void DBGDrivDestroyStream(struct DBG_STREAM *psStream);
-void *DBGDrivFindStream(char *pszName,
- IMG_BOOL bResetStream);
-u32 DBGDrivWriteString(struct DBG_STREAM *psStream,
- char *pszString,
- u32 ui32Level);
-u32 DBGDrivReadString(struct DBG_STREAM *psStream,
- char *pszString,
- u32 ui32Limit);
-u32 DBGDrivWrite(struct DBG_STREAM *psStream,
- u8 *pui8InBuf,
- u32 ui32InBuffSize,
- u32 ui32Level);
-u32 DBGDrivWrite2(struct DBG_STREAM *psStream,
- u8 *pui8InBuf,
- u32 ui32InBuffSize,
- u32 ui32Level);
-u32 DBGDrivRead(struct DBG_STREAM *psStream,
- IMG_BOOL bReadInitBuffer,
- u32 ui32OutBufferSize,
- u8 *pui8OutBuf);
-void DBGDrivSetCaptureMode(struct DBG_STREAM *psStream,
- u32 ui32Mode,
- u32 ui32Start,
- u32 ui32Stop,
- u32 ui32SampleRate);
-void DBGDrivSetOutputMode(struct DBG_STREAM *psStream,
- u32 ui32OutMode);
-void DBGDrivSetDebugLevel(struct DBG_STREAM *psStream,
- u32 ui32DebugLevel);
-void DBGDrivSetFrame(struct DBG_STREAM *psStream,
- u32 ui32Frame);
-u32 DBGDrivGetFrame(struct DBG_STREAM *psStream);
-void DBGDrivOverrideMode(struct DBG_STREAM *psStream,
- u32 ui32Mode);
-void DBGDrivDefaultMode(struct DBG_STREAM *psStream);
-u32 DBGDrivGetServiceTable(void);
-u32 DBGDrivWriteStringCM(struct DBG_STREAM *psStream,
- char *pszString,
- u32 ui32Level);
-u32 DBGDrivWriteCM(struct DBG_STREAM *psStream,
- u8 *pui8InBuf,
- u32 ui32InBuffSize,
- u32 ui32Level);
-void DBGDrivSetMarker(struct DBG_STREAM *psStream,
- u32 ui32Marker);
-u32 DBGDrivGetMarker(struct DBG_STREAM *psStream);
-u32 DBGDrivIsLastCaptureFrame(struct DBG_STREAM *psStream);
-u32 DBGDrivIsCaptureFrame(struct DBG_STREAM *psStream,
- IMG_BOOL bCheckPreviousFrame);
-u32 DBGDrivWriteLF(struct DBG_STREAM *psStream,
- u8 *pui8InBuf,
- u32 ui32InBuffSize,
- u32 ui32Level,
- u32 ui32Flags);
-u32 DBGDrivReadLF(struct DBG_STREAM *psStream,
- u32 ui32OutBuffSize,
- u8 *pui8OutBuf);
-void DBGDrivStartInitPhase(struct DBG_STREAM *psStream);
-void DBGDrivStopInitPhase(struct DBG_STREAM *psStream);
-u32 DBGDrivGetStreamOffset(struct DBG_STREAM *psStream);
-void DBGDrivSetStreamOffset(struct DBG_STREAM *psStream, u32 ui32StreamOffset);
-void DBGDrivWaitForEvent(enum DBG_EVENT eEvent);
-
-void DestroyAllStreams(void);
-
-u32 AtoI(char *szIn);
-
-void HostMemSet(void *pvDest, u8 ui8Value, u32 ui32Size);
-void HostMemCopy(void *pvDest, void *pvSrc, u32 ui32Size);
-IMG_BOOL StreamValid(struct DBG_STREAM *psStream);
-void Write(struct DBG_STREAM *psStream, u8 *pui8Data,
- u32 ui32InBuffSize);
-void MonoOut(char *pszString, IMG_BOOL bNewLine);
-
-void *ExtDBGDrivCreateStream(char *pszName,
- u32 ui32CapMode,
- u32 ui32OutMode,
- u32 ui32Flags,
- u32 ui32Size);
-void ExtDBGDrivDestroyStream(struct DBG_STREAM *psStream);
-void *ExtDBGDrivFindStream(char *pszName,
- IMG_BOOL bResetStream);
-u32 ExtDBGDrivWriteString(struct DBG_STREAM *psStream,
- char *pszString,
- u32 ui32Level);
-u32 ExtDBGDrivReadString(struct DBG_STREAM *psStream,
- char *pszString,
- u32 ui32Limit);
-u32 ExtDBGDrivWrite(struct DBG_STREAM *psStream,
- u8 *pui8InBuf,
- u32 ui32InBuffSize,
- u32 ui32Level);
-u32 ExtDBGDrivRead(struct DBG_STREAM *psStream,
- IMG_BOOL bReadInitBuffer,
- u32 ui32OutBuffSize,
- u8 *pui8OutBuf);
-void ExtDBGDrivSetCaptureMode(struct DBG_STREAM *psStream,
- u32 ui32Mode,
- u32 ui32Start,
- u32 ui32End,
- u32 ui32SampleRate);
-void ExtDBGDrivSetOutputMode(struct DBG_STREAM *psStream,
- u32 ui32OutMode);
-void ExtDBGDrivSetDebugLevel(struct DBG_STREAM *psStream,
- u32 ui32DebugLevel);
-void ExtDBGDrivSetFrame(struct DBG_STREAM *psStream,
- u32 ui32Frame);
-u32 ExtDBGDrivGetFrame(struct DBG_STREAM *psStream);
-void ExtDBGDrivOverrideMode(struct DBG_STREAM *psStream,
- u32 ui32Mode);
-void ExtDBGDrivDefaultMode(struct DBG_STREAM *psStream);
-u32 ExtDBGDrivWrite2(struct DBG_STREAM *psStream, u8 *pui8InBuf,
- u32 ui32InBuffSize, u32 ui32Level);
-u32 ExtDBGDrivWriteStringCM(struct DBG_STREAM *psStream, char *pszString,
- u32 ui32Level);
-u32 ExtDBGDrivWriteCM(struct DBG_STREAM *psStream, u8 *pui8InBuf,
- u32 ui32InBuffSize, u32 ui32Level);
-void ExtDBGDrivSetMarker(struct DBG_STREAM *psStream, u32 ui32Marker);
-u32 ExtDBGDrivGetMarker(struct DBG_STREAM *psStream);
-void ExtDBGDrivStartInitPhase(struct DBG_STREAM *psStream);
-void ExtDBGDrivStopInitPhase(struct DBG_STREAM *psStream);
-u32 ExtDBGDrivIsLastCaptureFrame(struct DBG_STREAM *psStream);
-u32 ExtDBGDrivIsCaptureFrame(struct DBG_STREAM *psStream,
- IMG_BOOL bCheckPreviousFrame);
-u32 ExtDBGDrivWriteLF(struct DBG_STREAM *psStream,
- u8 *pui8InBuf,
- u32 ui32InBuffSize,
- u32 ui32Level,
- u32 ui32Flags);
-u32 ExtDBGDrivReadLF(struct DBG_STREAM *psStream,
- u32 ui32OutBuffSize,
- u8 *pui8OutBuf);
-u32 ExtDBGDrivGetStreamOffset(struct DBG_STREAM *psStream);
-void ExtDBGDrivSetStreamOffset(struct DBG_STREAM *psStream,
- u32 ui32StreamOffset);
-void ExtDBGDrivWaitForEvent(enum DBG_EVENT eEvent);
-
-#endif
+++ /dev/null
-/**********************************************************************
- *
- * Copyright(c) 2008 Imagination Technologies Ltd. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful but, except
- * as otherwise stated in writing, without any warranty; without even the
- * implied warranty of merchantability or fitness for a particular purpose.
- * See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * The full GNU General Public License is included in this distribution in
- * the file called "COPYING".
- *
- * Contact Information:
- * Imagination Technologies Ltd. <gpl-support@imgtec.com>
- * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK
- *
- ******************************************************************************/
-
-#include <linux/version.h>
-#include <linux/errno.h>
-#include <linux/module.h>
-#include <linux/fs.h>
-#include <linux/kernel.h>
-#include <linux/mm.h>
-#include <linux/string.h>
-#include <asm/page.h>
-#include <linux/vmalloc.h>
-#include <linux/mutex.h>
-#include <linux/hardirq.h>
-
-#if defined(SUPPORT_DBGDRV_EVENT_OBJECTS)
-#include <linux/sched.h>
-#include <linux/wait.h>
-#include <linux/jiffies.h>
-#include <linux/delay.h>
-#endif
-
-#include "img_types.h"
-#include "pvr_debug.h"
-
-#include "dbgdrvif.h"
-#include "hostfunc.h"
-
-#define PVR_STRING_TERMINATOR '\0'
-#define PVR_IS_FILE_SEPARATOR(character) \
- (((character) == '\\') || ((character) == '/'))
-
-static u32 gPVRDebugLevel = DBGPRIV_WARNING;
-
-void PVRSRVDebugPrintf(u32 ui32DebugLevel,
- const char *pszFileName,
- u32 ui32Line, const char *pszFormat, ...
- )
-{
- IMG_BOOL bTrace, bDebug;
- char *pszLeafName;
-
- pszLeafName = (char *)strrchr(pszFileName, '\\');
-
- if (pszLeafName)
- pszFileName = pszLeafName;
-
- bTrace = gPVRDebugLevel & ui32DebugLevel & DBGPRIV_CALLTRACE;
- bDebug = ((gPVRDebugLevel & DBGPRIV_ALLLEVELS) >= ui32DebugLevel);
-
- if (bTrace || bDebug) {
- va_list vaArgs;
- static char szBuffer[256];
-
- va_start(vaArgs, pszFormat);
-
- if (bDebug) {
- switch (ui32DebugLevel) {
- case DBGPRIV_FATAL:
- {
- strcpy(szBuffer, "PVR_K:(Fatal): ");
- break;
- }
- case DBGPRIV_ERROR:
- {
- strcpy(szBuffer, "PVR_K:(Error): ");
- break;
- }
- case DBGPRIV_WARNING:
- {
- strcpy(szBuffer, "PVR_K:(Warning): ");
- break;
- }
- case DBGPRIV_MESSAGE:
- {
- strcpy(szBuffer, "PVR_K:(Message): ");
- break;
- }
- case DBGPRIV_VERBOSE:
- {
- strcpy(szBuffer, "PVR_K:(Verbose): ");
- break;
- }
- default:
- {
- strcpy(szBuffer,
- "PVR_K:(Unknown message level)");
- break;
- }
- }
- } else {
- strcpy(szBuffer, "PVR_K: ");
- }
-
- vsprintf(&szBuffer[strlen(szBuffer)], pszFormat, vaArgs);
-
- if (!bTrace)
- sprintf(&szBuffer[strlen(szBuffer)], " [%d, %s]",
- (int)ui32Line, pszFileName);
-
- printk(KERN_INFO "%s\r\n", szBuffer);
-
- va_end(vaArgs);
- }
-}
-
-void HostMemSet(void *pvDest, u8 ui8Value, u32 ui32Size)
-{
- memset(pvDest, (int)ui8Value, (size_t) ui32Size);
-}
-
-void HostMemCopy(void *pvDst, void *pvSrc, u32 ui32Size)
-{
- memcpy(pvDst, pvSrc, ui32Size);
-}
-
-u32 HostReadRegistryDWORDFromString(char *pcKey, char *pcValueName,
- u32 *pui32Data)
-{
-
- return 0;
-}
-
-void *HostPageablePageAlloc(u32 ui32Pages)
-{
- return (void *)vmalloc(ui32Pages * PAGE_SIZE);
-}
-
-void HostPageablePageFree(void *pvBase)
-{
- vfree(pvBase);
-}
-
-void *HostNonPageablePageAlloc(u32 ui32Pages)
-{
- return (void *)vmalloc(ui32Pages * PAGE_SIZE);
-}
-
-void HostNonPageablePageFree(void *pvBase)
-{
- vfree(pvBase);
-}
-
-void *HostMapKrnBufIntoUser(void *pvKrnAddr, u32 ui32Size,
- void **ppvMdl)
-{
-
- return NULL;
-}
-
-void HostUnMapKrnBufFromUser(void *pvUserAddr, void *pvMdl,
- void *pvProcess)
-{
-
-}
-
-void HostCreateRegDeclStreams(void)
-{
-
-}
-
-void *HostCreateMutex(void)
-{
- struct mutex *psSem;
-
- psSem = kmalloc(sizeof(*psSem), GFP_KERNEL);
- if (psSem)
- mutex_init(psSem);
-
- return psSem;
-}
-
-void HostAquireMutex(void *pvMutex)
-{
- BUG_ON(in_interrupt());
-
-#if defined(PVR_DEBUG_DBGDRV_DETECT_HOST_MUTEX_COLLISIONS)
- if (mutex_trylock((struct mutex *)pvMutex)) {
- printk(KERN_INFO "HostAquireMutex: Waiting for mutex\n");
- mutex_lock((struct mutex *)pvMutex);
- }
-#else
- mutex_lock((struct mutex *)pvMutex);
-#endif
-}
-
-void HostReleaseMutex(void *pvMutex)
-{
- mutex_unlock((struct mutex *)pvMutex);
-}
-
-void HostDestroyMutex(void *pvMutex)
-{
- kfree(pvMutex);
-}
-
-#if defined(SUPPORT_DBGDRV_EVENT_OBJECTS)
-
-#define EVENT_WAIT_TIMEOUT_MS 500
-#define EVENT_WAIT_TIMEOUT_JIFFIES (EVENT_WAIT_TIMEOUT_MS * HZ / 1000)
-
-static int iStreamData;
-static wait_queue_head_t sStreamDataEvent;
-
-s32 HostCreateEventObjects(void)
-{
- init_waitqueue_head(&sStreamDataEvent);
-
- return 0;
-}
-
-void HostWaitForEvent(enum DBG_EVENT eEvent)
-{
- switch (eEvent) {
- case DBG_EVENT_STREAM_DATA:
-
- wait_event_interruptible_timeout(sStreamDataEvent,
- iStreamData != 0,
- EVENT_WAIT_TIMEOUT_JIFFIES);
- iStreamData = 0;
- break;
- default:
-
- msleep_interruptible(EVENT_WAIT_TIMEOUT_MS);
- break;
- }
-}
-
-void HostSignalEvent(enum DBG_EVENT eEvent)
-{
- switch (eEvent) {
- case DBG_EVENT_STREAM_DATA:
- iStreamData = 1;
- wake_up_interruptible(&sStreamDataEvent);
- break;
- default:
- break;
- }
-}
-
-void HostDestroyEventObjects(void)
-{
-}
-#endif
+++ /dev/null
-/**********************************************************************
- *
- * Copyright(c) 2008 Imagination Technologies Ltd. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful but, except
- * as otherwise stated in writing, without any warranty; without even the
- * implied warranty of merchantability or fitness for a particular purpose.
- * See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * The full GNU General Public License is included in this distribution in
- * the file called "COPYING".
- *
- * Contact Information:
- * Imagination Technologies Ltd. <gpl-support@imgtec.com>
- * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK
- *
- ******************************************************************************/
-
-#ifndef _HOSTFUNC_
-#define _HOSTFUNC_
-
-#define HOST_PAGESIZE (4096)
-#define DBG_MEMORY_INITIALIZER (0xe2)
-
-u32 HostReadRegistryDWORDFromString(char *pcKey, char *pcValueName,
- u32 *pui32Data);
-
-void *HostPageablePageAlloc(u32 ui32Pages);
-void HostPageablePageFree(void *pvBase);
-void *HostNonPageablePageAlloc(u32 ui32Pages);
-void HostNonPageablePageFree(void *pvBase);
-
-void *HostMapKrnBufIntoUser(void *pvKrnAddr, u32 ui32Size, void **ppvMdl);
-void HostUnMapKrnBufFromUser(void *pvUserAddr, void *pvMdl, void *pvProcess);
-
-void HostCreateRegDeclStreams(void);
-
-void *HostCreateMutex(void);
-void HostAquireMutex(void *pvMutex);
-void HostReleaseMutex(void *pvMutex);
-void HostDestroyMutex(void *pvMutex);
-
-#if defined(SUPPORT_DBGDRV_EVENT_OBJECTS)
-s32 HostCreateEventObjects(void);
-void HostWaitForEvent(enum DBG_EVENT eEvent);
-void HostSignalEvent(enum DBG_EVENT eEvent);
-void HostDestroyEventObjects(void);
-#endif
-
-#endif
+++ /dev/null
-/**********************************************************************
- *
- * Copyright(c) 2008 Imagination Technologies Ltd. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful but, except
- * as otherwise stated in writing, without any warranty; without even the
- * implied warranty of merchantability or fitness for a particular purpose.
- * See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * The full GNU General Public License is included in this distribution in
- * the file called "COPYING".
- *
- * Contact Information:
- * Imagination Technologies Ltd. <gpl-support@imgtec.com>
- * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK
- *
- ******************************************************************************/
-
-#include "img_types.h"
-#include "pvr_debug.h"
-#include "dbgdrvif.h"
-#include "dbgdriv.h"
-#include "hotkey.h"
-#include "hostfunc.h"
-
-u32 g_ui32HotKeyFrame = 0xFFFFFFFF;
-IMG_BOOL g_bHotKeyPressed = IMG_FALSE;
-IMG_BOOL g_bHotKeyRegistered = IMG_FALSE;
-
-struct PRIVATEHOTKEYDATA g_PrivateHotKeyData;
-
-void ReadInHotKeys(void)
-{
- g_PrivateHotKeyData.ui32ScanCode = 0x58;
- g_PrivateHotKeyData.ui32ShiftState = 0x0;
-
- HostReadRegistryDWORDFromString("DEBUG\\Streams", "ui32ScanCode",
- &g_PrivateHotKeyData.ui32ScanCode);
- HostReadRegistryDWORDFromString("DEBUG\\Streams", "ui32ShiftState",
- &g_PrivateHotKeyData.ui32ShiftState);
-}
-
-void RegisterKeyPressed(u32 dwui32ScanCode, struct HOTKEYINFO *pInfo)
-{
- struct DBG_STREAM *psStream;
-
- PVR_UNREFERENCED_PARAMETER(pInfo);
-
- if (dwui32ScanCode == g_PrivateHotKeyData.ui32ScanCode) {
- PVR_DPF(PVR_DBG_MESSAGE, "PDUMP Hotkey pressed !\n");
-
- psStream = (struct DBG_STREAM *)
- g_PrivateHotKeyData.sHotKeyInfo.pvStream;
-
- if (!g_bHotKeyPressed) {
-
- g_ui32HotKeyFrame = psStream->ui32Current + 2;
-
- g_bHotKeyPressed = IMG_TRUE;
- }
- }
-}
-
-void ActivateHotKeys(struct DBG_STREAM *psStream)
-{
-
- ReadInHotKeys();
-
- if (!g_PrivateHotKeyData.sHotKeyInfo.hHotKey) {
- if (g_PrivateHotKeyData.ui32ScanCode != 0) {
- PVR_DPF(PVR_DBG_MESSAGE,
- "Activate HotKey for PDUMP.\n");
-
- g_PrivateHotKeyData.sHotKeyInfo.pvStream = psStream;
-
- DefineHotKey(g_PrivateHotKeyData.ui32ScanCode,
- g_PrivateHotKeyData.ui32ShiftState,
- &g_PrivateHotKeyData.sHotKeyInfo);
- } else {
- g_PrivateHotKeyData.sHotKeyInfo.hHotKey = 0;
- }
- }
-}
-
-void DeactivateHotKeys(void)
-{
- if (g_PrivateHotKeyData.sHotKeyInfo.hHotKey != 0) {
- PVR_DPF(PVR_DBG_MESSAGE, "Deactivate HotKey.\n");
-
- RemoveHotKey(g_PrivateHotKeyData.sHotKeyInfo.hHotKey);
- g_PrivateHotKeyData.sHotKeyInfo.hHotKey = 0;
- }
-}
+++ /dev/null
-/**********************************************************************
- *
- * Copyright(c) 2008 Imagination Technologies Ltd. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful but, except
- * as otherwise stated in writing, without any warranty; without even the
- * implied warranty of merchantability or fitness for a particular purpose.
- * See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * The full GNU General Public License is included in this distribution in
- * the file called "COPYING".
- *
- * Contact Information:
- * Imagination Technologies Ltd. <gpl-support@imgtec.com>
- * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK
- *
- ******************************************************************************/
-
-#ifndef _HOTKEY_
-#define _HOTKEY_
-
-struct HOTKEYINFO {
- u8 ui8ScanCode;
- u8 ui8Type;
- u8 ui8Flag;
- u8 ui8Filler1;
- u32 ui32ShiftState;
- u32 ui32HotKeyProc;
- void *pvStream;
- u32 hHotKey;
-};
-
-struct PRIVATEHOTKEYDATA {
- u32 ui32ScanCode;
- u32 ui32ShiftState;
- struct HOTKEYINFO sHotKeyInfo;
-};
-
-extern u32 g_ui32HotKeyFrame;
-extern IMG_BOOL g_bHotKeyPressed;
-extern IMG_BOOL g_bHotKeyRegistered;
-
-void ReadInHotKeys(void);
-void ActivateHotKeys(struct DBG_STREAM *psStream);
-void DeactivateHotKeys(void);
-
-void RemoveHotKey(u32 hHotKey);
-void DefineHotKey(u32 ui32ScanCode, u32 ui32ShiftState,
- struct HOTKEYINFO *psInfo);
-void RegisterKeyPressed(u32 ui32ScanCode, struct HOTKEYINFO *psInfo);
-
-#endif
+++ /dev/null
-/**********************************************************************
- *
- * Copyright(c) 2008 Imagination Technologies Ltd. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful but, except
- * as otherwise stated in writing, without any warranty; without even the
- * implied warranty of merchantability or fitness for a particular purpose.
- * See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * The full GNU General Public License is included in this distribution in
- * the file called "COPYING".
- *
- * Contact Information:
- * Imagination Technologies Ltd. <gpl-support@imgtec.com>
- * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK
- *
- ******************************************************************************/
-
-#include <linux/uaccess.h>
-
-#include "img_types.h"
-#include "dbgdrvif.h"
-#include "dbgdriv.h"
-#include "hotkey.h"
-
-u32 DBGDIOCDrivCreateStream(void *pvInBuffer,
- void *pvOutBuffer)
-{
- struct DBG_IN_CREATESTREAM *psIn;
- void **ppvOut;
- static char name[32];
-
- psIn = (struct DBG_IN_CREATESTREAM *)pvInBuffer;
- ppvOut = (void **)pvOutBuffer;
-
-
- if (copy_from_user(name, psIn->pszName, 32) != 0)
- return IMG_FALSE;
- *ppvOut =
- ExtDBGDrivCreateStream(name, psIn->ui32CapMode, psIn->ui32OutMode,
- 0, psIn->ui32Pages);
-
-
- return IMG_TRUE;
-}
-
-u32 DBGDIOCDrivDestroyStream(void *pvInBuffer,
- void *pvOutBuffer)
-{
- u32 *pStream;
- struct DBG_STREAM *psStream;
-
- pStream = (u32 *) pvInBuffer;
- psStream = (struct DBG_STREAM *)*pStream;
-
- PVR_UNREFERENCED_PARAMETER(pvOutBuffer);
-
- ExtDBGDrivDestroyStream(psStream);
-
- return IMG_TRUE;
-}
-
-u32 DBGDIOCDrivGetStream(void *pvInBuffer, void *pvOutBuffer)
-{
- struct DBG_IN_FINDSTREAM *psParams;
- u32 *pui32Stream;
-
- psParams = (struct DBG_IN_FINDSTREAM *)pvInBuffer;
- pui32Stream = (u32 *) pvOutBuffer;
-
- *pui32Stream =
- (u32) ExtDBGDrivFindStream(psParams->pszName,
- psParams->bResetStream);
-
- return IMG_TRUE;
-}
-
-u32 DBGDIOCDrivWriteString(void *pvInBuffer, void *pvOutBuffer)
-{
- struct DBG_IN_WRITESTRING *psParams;
- u32 *pui32OutLen;
-
- psParams = (struct DBG_IN_WRITESTRING *)pvInBuffer;
- pui32OutLen = (u32 *) pvOutBuffer;
-
- *pui32OutLen =
- ExtDBGDrivWriteString((struct DBG_STREAM *)psParams->pvStream,
- psParams->pszString, psParams->ui32Level);
-
- return IMG_TRUE;
-}
-
-u32 DBGDIOCDrivWriteStringCM(void *pvInBuffer,
- void *pvOutBuffer)
-{
- struct DBG_IN_WRITESTRING *psParams;
- u32 *pui32OutLen;
-
- psParams = (struct DBG_IN_WRITESTRING *)pvInBuffer;
- pui32OutLen = (u32 *) pvOutBuffer;
-
- *pui32OutLen =
- ExtDBGDrivWriteStringCM((struct DBG_STREAM *)psParams->pvStream,
- psParams->pszString, psParams->ui32Level);
-
- return IMG_TRUE;
-}
-
-u32 DBGDIOCDrivReadString(void *pvInBuffer, void *pvOutBuffer)
-{
- u32 *pui32OutLen;
- struct DBG_IN_READSTRING *psParams;
-
- psParams = (struct DBG_IN_READSTRING *)pvInBuffer;
- pui32OutLen = (u32 *) pvOutBuffer;
-
- *pui32OutLen =
- ExtDBGDrivReadString(psParams->pvStream, psParams->pszString,
- psParams->ui32StringLen);
-
- return IMG_TRUE;
-}
-
-u32 DBGDIOCDrivWrite(void *pvInBuffer, void *pvOutBuffer)
-{
- u32 *pui32BytesCopied;
- struct DBG_IN_WRITE *psInParams;
-
- psInParams = (struct DBG_IN_WRITE *)pvInBuffer;
- pui32BytesCopied = (u32 *) pvOutBuffer;
-
- *pui32BytesCopied =
- ExtDBGDrivWrite((struct DBG_STREAM *)psInParams->pvStream,
- psInParams->pui8InBuffer,
- psInParams->ui32TransferSize,
- psInParams->ui32Level);
-
- return IMG_TRUE;
-}
-
-u32 DBGDIOCDrivWrite2(void *pvInBuffer, void *pvOutBuffer)
-{
- u32 *pui32BytesCopied;
- struct DBG_IN_WRITE *psInParams;
-
- psInParams = (struct DBG_IN_WRITE *)pvInBuffer;
- pui32BytesCopied = (u32 *) pvOutBuffer;
-
- *pui32BytesCopied =
- ExtDBGDrivWrite2((struct DBG_STREAM *)psInParams->pvStream,
- psInParams->pui8InBuffer,
- psInParams->ui32TransferSize,
- psInParams->ui32Level);
-
- return IMG_TRUE;
-}
-
-u32 DBGDIOCDrivWriteCM(void *pvInBuffer, void *pvOutBuffer)
-{
- u32 *pui32BytesCopied;
- struct DBG_IN_WRITE *psInParams;
-
- psInParams = (struct DBG_IN_WRITE *)pvInBuffer;
- pui32BytesCopied = (u32 *) pvOutBuffer;
-
- *pui32BytesCopied =
- ExtDBGDrivWriteCM((struct DBG_STREAM *)psInParams->pvStream,
- psInParams->pui8InBuffer,
- psInParams->ui32TransferSize,
- psInParams->ui32Level);
-
- return IMG_TRUE;
-}
-
-u32 DBGDIOCDrivRead(void *pvInBuffer, void *pvOutBuffer)
-{
- u32 *pui32BytesCopied;
- struct DBG_IN_READ *psInParams;
-
- psInParams = (struct DBG_IN_READ *)pvInBuffer;
- pui32BytesCopied = (u32 *) pvOutBuffer;
-
- *pui32BytesCopied =
- ExtDBGDrivRead((struct DBG_STREAM *)psInParams->pvStream,
- psInParams->bReadInitBuffer,
- psInParams->ui32OutBufferSize,
- psInParams->pui8OutBuffer);
-
- return IMG_TRUE;
-}
-
-u32 DBGDIOCDrivSetCaptureMode(void *pvInBuffer,
- void *pvOutBuffer)
-{
- struct DBG_IN_SETDEBUGMODE *psParams;
-
- psParams = (struct DBG_IN_SETDEBUGMODE *)pvInBuffer;
- PVR_UNREFERENCED_PARAMETER(pvOutBuffer);
-
- ExtDBGDrivSetCaptureMode((struct DBG_STREAM *)psParams->pvStream,
- psParams->ui32Mode,
- psParams->ui32Start,
- psParams->ui32End, psParams->ui32SampleRate);
-
- return IMG_TRUE;
-}
-
-u32 DBGDIOCDrivSetOutMode(void *pvInBuffer, void *pvOutBuffer)
-{
- struct DBG_IN_SETDEBUGOUTMODE *psParams;
-
- psParams = (struct DBG_IN_SETDEBUGOUTMODE *)pvInBuffer;
- PVR_UNREFERENCED_PARAMETER(pvOutBuffer);
-
- ExtDBGDrivSetOutputMode((struct DBG_STREAM *)psParams->pvStream,
- psParams->ui32Mode);
-
- return IMG_TRUE;
-}
-
-u32 DBGDIOCDrivSetDebugLevel(void *pvInBuffer,
- void *pvOutBuffer)
-{
- struct DBG_IN_SETDEBUGLEVEL *psParams;
-
- psParams = (struct DBG_IN_SETDEBUGLEVEL *)pvInBuffer;
- PVR_UNREFERENCED_PARAMETER(pvOutBuffer);
-
- ExtDBGDrivSetDebugLevel((struct DBG_STREAM *)psParams->pvStream,
- psParams->ui32Level);
-
- return IMG_TRUE;
-}
-
-u32 DBGDIOCDrivSetFrame(void *pvInBuffer, void *pvOutBuffer)
-{
- struct DBG_IN_SETFRAME *psParams;
-
- psParams = (struct DBG_IN_SETFRAME *)pvInBuffer;
- PVR_UNREFERENCED_PARAMETER(pvOutBuffer);
-
- ExtDBGDrivSetFrame((struct DBG_STREAM *)psParams->pvStream,
- psParams->ui32Frame);
-
- return IMG_TRUE;
-}
-
-u32 DBGDIOCDrivGetFrame(void *pvInBuffer, void *pvOutBuffer)
-{
- u32 *pStream;
- struct DBG_STREAM *psStream;
- u32 *pui32Current;
-
- pStream = (u32 *) pvInBuffer;
- psStream = (struct DBG_STREAM *)*pStream;
- pui32Current = (u32 *) pvOutBuffer;
-
- *pui32Current = ExtDBGDrivGetFrame(psStream);
-
- return IMG_TRUE;
-}
-
-u32 DBGDIOCDrivIsCaptureFrame(void *pvInBuffer,
- void *pvOutBuffer)
-{
- struct DBG_IN_ISCAPTUREFRAME *psParams;
- u32 *pui32Current;
-
- psParams = (struct DBG_IN_ISCAPTUREFRAME *)pvInBuffer;
- pui32Current = (u32 *) pvOutBuffer;
-
- *pui32Current =
- ExtDBGDrivIsCaptureFrame((struct DBG_STREAM *)psParams->pvStream,
- psParams->bCheckPreviousFrame);
-
- return IMG_TRUE;
-}
-
-u32 DBGDIOCDrivOverrideMode(void *pvInBuffer,
- void *pvOutBuffer)
-{
- struct DBG_IN_OVERRIDEMODE *psParams;
-
- psParams = (struct DBG_IN_OVERRIDEMODE *)pvInBuffer;
- PVR_UNREFERENCED_PARAMETER(pvOutBuffer);
-
- ExtDBGDrivOverrideMode((struct DBG_STREAM *)psParams->pvStream,
- psParams->ui32Mode);
-
- return IMG_TRUE;
-}
-
-u32 DBGDIOCDrivDefaultMode(void *pvInBuffer, void *pvOutBuffer)
-{
- u32 *pStream;
- struct DBG_STREAM *psStream;
-
- pStream = (u32 *) pvInBuffer;
- psStream = (struct DBG_STREAM *)*pStream;
-
- PVR_UNREFERENCED_PARAMETER(pvOutBuffer);
-
- ExtDBGDrivDefaultMode(psStream);
-
- return IMG_TRUE;
-}
-
-u32 DBGDIOCDrivSetMarker(void *pvInBuffer, void *pvOutBuffer)
-{
- struct DBG_IN_SETMARKER *psParams;
-
- psParams = (struct DBG_IN_SETMARKER *)pvInBuffer;
- PVR_UNREFERENCED_PARAMETER(pvOutBuffer);
-
- ExtDBGDrivSetMarker((struct DBG_STREAM *)psParams->pvStream,
- psParams->ui32Marker);
-
- return IMG_TRUE;
-}
-
-u32 DBGDIOCDrivGetMarker(void *pvInBuffer, void *pvOutBuffer)
-{
- u32 *pStream;
- struct DBG_STREAM *psStream;
- u32 *pui32Current;
-
- pStream = (u32 *) pvInBuffer;
- psStream = (struct DBG_STREAM *)*pStream;
- pui32Current = (u32 *) pvOutBuffer;
-
- *pui32Current = ExtDBGDrivGetMarker(psStream);
-
- return IMG_TRUE;
-}
-
-u32 DBGDIOCDrivGetServiceTable(void *pvInBuffer,
- void *pvOutBuffer)
-{
- u32 *pui32Out;
-
- PVR_UNREFERENCED_PARAMETER(pvInBuffer);
- pui32Out = (u32 *) pvOutBuffer;
-
- *pui32Out = DBGDrivGetServiceTable();
-
- return IMG_TRUE;
-}
-
-u32 DBGDIOCDrivWriteLF(void *pvInBuffer, void *pvOutBuffer)
-{
- struct DBG_IN_WRITE_LF *psInParams;
- u32 *pui32BytesCopied;
-
- psInParams = (struct DBG_IN_WRITE_LF *)pvInBuffer;
- pui32BytesCopied = (u32 *) pvOutBuffer;
-
- *pui32BytesCopied = ExtDBGDrivWriteLF(psInParams->pvStream,
- psInParams->pui8InBuffer,
- psInParams->ui32BufferSize,
- psInParams->ui32Level,
- psInParams->ui32Flags);
-
- return IMG_TRUE;
-}
-
-u32 DBGDIOCDrivReadLF(void *pvInBuffer, void *pvOutBuffer)
-{
- u32 *pui32BytesCopied;
- struct DBG_IN_READ *psInParams;
-
- psInParams = (struct DBG_IN_READ *)pvInBuffer;
- pui32BytesCopied = (u32 *) pvOutBuffer;
-
- *pui32BytesCopied =
- ExtDBGDrivReadLF((struct DBG_STREAM *)psInParams->pvStream,
- psInParams->ui32OutBufferSize,
- psInParams->pui8OutBuffer);
-
- return IMG_TRUE;
-}
-
-u32 DBGDIOCDrivWaitForEvent(void *pvInBuffer, void *pvOutBuffer)
-{
- enum DBG_EVENT eEvent = (enum DBG_EVENT)(*(u32 *) pvInBuffer);
-
- PVR_UNREFERENCED_PARAMETER(pvOutBuffer);
-
- ExtDBGDrivWaitForEvent(eEvent);
-
- return IMG_TRUE;
-}
+++ /dev/null
-/**********************************************************************
- *
- * Copyright(c) 2008 Imagination Technologies Ltd. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful but, except
- * as otherwise stated in writing, without any warranty; without even the
- * implied warranty of merchantability or fitness for a particular purpose.
- * See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * The full GNU General Public License is included in this distribution in
- * the file called "COPYING".
- *
- * Contact Information:
- * Imagination Technologies Ltd. <gpl-support@imgtec.com>
- * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK
- *
- ******************************************************************************/
-
-#ifndef _IOCTL_
-#define _IOCTL_
-
-u32 DBGDIOCDrivCreateStream(void *, void *);
-u32 DBGDIOCDrivDestroyStream(void *, void *);
-u32 DBGDIOCDrivGetStream(void *, void *);
-u32 DBGDIOCDrivWriteString(void *, void *);
-u32 DBGDIOCDrivReadString(void *, void *);
-u32 DBGDIOCDrivWrite(void *, void *);
-u32 DBGDIOCDrivWrite2(void *, void *);
-u32 DBGDIOCDrivRead(void *, void *);
-u32 DBGDIOCDrivSetCaptureMode(void *, void *);
-u32 DBGDIOCDrivSetOutMode(void *, void *);
-u32 DBGDIOCDrivSetDebugLevel(void *, void *);
-u32 DBGDIOCDrivSetFrame(void *, void *);
-u32 DBGDIOCDrivGetFrame(void *, void *);
-u32 DBGDIOCDrivOverrideMode(void *, void *);
-u32 DBGDIOCDrivDefaultMode(void *, void *);
-u32 DBGDIOCDrivGetServiceTable(void *, void *);
-u32 DBGDIOCDrivWriteStringCM(void *, void *);
-u32 DBGDIOCDrivWriteCM(void *, void *);
-u32 DBGDIOCDrivSetMarker(void *, void *);
-u32 DBGDIOCDrivGetMarker(void *, void *);
-u32 DBGDIOCDrivIsCaptureFrame(void *, void *);
-u32 DBGDIOCDrivWriteLF(void *, void *);
-u32 DBGDIOCDrivReadLF(void *, void *);
-u32 DBGDIOCDrivWaitForEvent(void *, void *);
-
-u32(*g_DBGDrivProc[])(void *, void *) = {
-DBGDIOCDrivCreateStream,
- DBGDIOCDrivDestroyStream,
- DBGDIOCDrivGetStream,
- DBGDIOCDrivWriteString,
- DBGDIOCDrivReadString,
- DBGDIOCDrivWrite,
- DBGDIOCDrivRead,
- DBGDIOCDrivSetCaptureMode,
- DBGDIOCDrivSetOutMode,
- DBGDIOCDrivSetDebugLevel,
- DBGDIOCDrivSetFrame,
- DBGDIOCDrivGetFrame,
- DBGDIOCDrivOverrideMode,
- DBGDIOCDrivDefaultMode,
- DBGDIOCDrivGetServiceTable,
- DBGDIOCDrivWrite2,
- DBGDIOCDrivWriteStringCM,
- DBGDIOCDrivWriteCM,
- DBGDIOCDrivSetMarker,
- DBGDIOCDrivGetMarker,
- DBGDIOCDrivIsCaptureFrame,
- DBGDIOCDrivWriteLF, DBGDIOCDrivReadLF, DBGDIOCDrivWaitForEvent};
-
-#define MAX_DBGVXD_W32_API (sizeof(g_DBGDrivProc)/sizeof(u32))
-
-#endif
+++ /dev/null
-/**********************************************************************
- *
- * Copyright(c) 2008 Imagination Technologies Ltd. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful but, except
- * as otherwise stated in writing, without any warranty; without even the
- * implied warranty of merchantability or fitness for a particular purpose.
- * See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * The full GNU General Public License is included in this distribution in
- * the file called "COPYING".
- *
- * Contact Information:
- * Imagination Technologies Ltd. <gpl-support@imgtec.com>
- * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK
- *
- ******************************************************************************/
-
-#ifndef _LINUXSRV_H__
-#define _LINUXSRV_H__
-
-struct IOCTL_PACKAGE {
- u32 ui32Cmd;
- u32 ui32Size;
- void *pInBuffer;
- u32 ui32InBufferSize;
- void *pOutBuffer;
- u32 ui32OutBufferSize;
-};
-
-u32 DeviceIoControl(u32 hDevice,
- u32 ui32ControlCode,
- void *pInBuffer,
- u32 ui32InBufferSize,
- void *pOutBuffer,
- u32 ui32OutBufferSize,
- u32 *pui32BytesReturned);
-
-#endif
+++ /dev/null
-/**********************************************************************
- *
- * Copyright(c) 2008 Imagination Technologies Ltd. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful but, except
- * as otherwise stated in writing, without any warranty; without even the
- * implied warranty of merchantability or fitness for a particular purpose.
- * See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * The full GNU General Public License is included in this distribution in
- * the file called "COPYING".
- *
- * Contact Information:
- * Imagination Technologies Ltd. <gpl-support@imgtec.com>
- * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK
- *
- ******************************************************************************/
-
-#include <linux/errno.h>
-#include <linux/module.h>
-#include <linux/fs.h>
-#include <linux/kernel.h>
-#include <linux/kdev_t.h>
-#include <linux/pci.h>
-#include <linux/list.h>
-#include <linux/init.h>
-#include <linux/vmalloc.h>
-#include <linux/uaccess.h>
-
-#include "img_types.h"
-#include "linuxsrv.h"
-#include "ioctl.h"
-#include "dbgdrvif.h"
-#include "dbgdriv.h"
-#include "hostfunc.h"
-#include "pvr_debug.h"
-
-#define DRVNAME "dbgdrv"
-
-MODULE_AUTHOR("Imagination Technologies Ltd. <gpl-support@imgtec.com>");
-MODULE_LICENSE("GPL");
-MODULE_SUPPORTED_DEVICE(DRVNAME);
-
-static int AssignedMajorNumber;
-
-static long dbgdrv_ioctl(struct file *, unsigned int, unsigned long);
-
-static int dbgdrv_open(struct inode unref__ * pInode,
- struct file unref__ * pFile)
-{
- return 0;
-}
-
-static int dbgdrv_release(struct inode unref__ * pInode,
- struct file unref__ * pFile)
-{
- return 0;
-}
-
-static int dbgdrv_mmap(struct file *pFile, struct vm_area_struct *ps_vma)
-{
- return 0;
-}
-
-static const struct file_operations dbgdrv_fops = {
-owner: THIS_MODULE,
-unlocked_ioctl : dbgdrv_ioctl,
-open : dbgdrv_open,
-release : dbgdrv_release,
-mmap : dbgdrv_mmap,
-};
-
-void DBGDrvGetServiceTable(void **fn_table)
-{
- *fn_table = &g_sDBGKMServices;
-
-}
-EXPORT_SYMBOL(DBGDrvGetServiceTable);
-
-void cleanup_module(void)
-{
- if (AssignedMajorNumber > 0)
- unregister_chrdev(AssignedMajorNumber, DRVNAME);
-
-#if defined(SUPPORT_DBGDRV_EVENT_OBJECTS)
- HostDestroyEventObjects();
-#endif
-
- if (g_pvAPIMutex != NULL)
- HostDestroyMutex(g_pvAPIMutex);
-
- return;
-}
-
-int init_module(void)
-{
- g_pvAPIMutex = HostCreateMutex();
- if (g_pvAPIMutex == NULL) {
- cleanup_module();
- return -ENOMEM;
- }
-#if defined(SUPPORT_DBGDRV_EVENT_OBJECTS)
-
- (void)HostCreateEventObjects();
-#endif
-
- AssignedMajorNumber =
- register_chrdev(AssignedMajorNumber, DRVNAME, &dbgdrv_fops);
-
- if (AssignedMajorNumber <= 0) {
- PVR_DPF(PVR_DBG_ERROR, " unable to get major\n");
- cleanup_module();
- return -EBUSY;
- }
-
- return 0;
-}
-
-static long dbgdrv_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
-{
- struct IOCTL_PACKAGE *pIP = (struct IOCTL_PACKAGE *)arg;
-
- char *buffer, *in, *out;
-
- if ((pIP->ui32InBufferSize > (PAGE_SIZE >> 1))
- || (pIP->ui32OutBufferSize > (PAGE_SIZE >> 1))) {
- PVR_DPF(PVR_DBG_ERROR,
- "Sizes of the buffers are too large, cannot do ioctl\n");
- return -1;
- }
-
- buffer = (char *)HostPageablePageAlloc(1);
- if (!buffer) {
- PVR_DPF(PVR_DBG_ERROR,
- "Failed to allocate buffer, cannot do ioctl\n");
- return -EFAULT;
- }
-
- in = buffer;
- out = buffer + (PAGE_SIZE >> 1);
-
- if (copy_from_user(in, pIP->pInBuffer, pIP->ui32InBufferSize) != 0)
- goto init_failed;
-
- cmd = ((pIP->ui32Cmd >> 2) & 0xFFF) - 0x801;
-
- if (pIP->ui32Cmd == DEBUG_SERVICE_READ) {
- char *ui8Tmp;
- u32 *pui32BytesCopied = (u32 *) out;
- struct DBG_IN_READ *psReadInParams = (struct DBG_IN_READ *)in;
-
- ui8Tmp = vmalloc(psReadInParams->ui32OutBufferSize);
- if (!ui8Tmp)
- goto init_failed;
- *pui32BytesCopied = ExtDBGDrivRead((struct DBG_STREAM *)
- psReadInParams->pvStream,
- psReadInParams->bReadInitBuffer,
- psReadInParams->ui32OutBufferSize, ui8Tmp);
- if (copy_to_user(psReadInParams->pui8OutBuffer, ui8Tmp,
- *pui32BytesCopied) != 0) {
- vfree(ui8Tmp);
- goto init_failed;
- }
- vfree(ui8Tmp);
- } else {
- (g_DBGDrivProc[cmd]) (in, out);
- }
-
- if (copy_to_user(pIP->pOutBuffer, out, pIP->ui32OutBufferSize) != 0)
- goto init_failed;
-
- HostPageablePageFree((void *) buffer);
- return 0;
-
-init_failed:
- HostPageablePageFree((void *) buffer);
- return -EFAULT;
-}
-
-void RemoveHotKey(unsigned hHotKey)
-{
-
-}
-
-void DefineHotKey(unsigned ScanCode, unsigned ShiftState, void *pInfo)
-{
-
-}
-