]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - android-sdk/device-ti-proprietary-open.git/blob - omap5/sgx_src/eurasia_km/tools/intern/debug/dbgdriv/common/hotkey.c
SGX-BIN: DDK update for OMAP5 1.9IMG2166536_TI.0003
[android-sdk/device-ti-proprietary-open.git] / omap5 / sgx_src / eurasia_km / tools / intern / debug / dbgdriv / common / hotkey.c
1 /*************************************************************************/ /*!
2 @Title          Debug driver utilities implementations.
3 @Copyright      Copyright (c) Imagination Technologies Ltd. All Rights Reserved
4 @Description    Hotkey stuff
5 @License        Dual MIT/GPLv2
7 The contents of this file are subject to the MIT license as set out below.
9 Permission is hereby granted, free of charge, to any person obtaining a copy
10 of this software and associated documentation files (the "Software"), to deal
11 in the Software without restriction, including without limitation the rights
12 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 copies of the Software, and to permit persons to whom the Software is
14 furnished to do so, subject to the following conditions:
16 The above copyright notice and this permission notice shall be included in
17 all copies or substantial portions of the Software.
19 Alternatively, the contents of this file may be used under the terms of
20 the GNU General Public License Version 2 ("GPL") in which case the provisions
21 of GPL are applicable instead of those above.
23 If you wish to allow use of your version of this file only under the terms of
24 GPL, and not to allow others to use your version of this file under the terms
25 of the MIT license, indicate your decision by deleting the provisions above
26 and replace them with the notice and other provisions required by GPL as set
27 out in the file called "GPL-COPYING" included in this distribution. If you do
28 not delete the provisions above, a recipient may use your version of this file
29 under the terms of either the MIT license or GPL.
31 This License is also included in this distribution in the file called
32 "MIT-COPYING".
34 EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
35 PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
36 BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
37 PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
38 COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
39 IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
40 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
41 */ /**************************************************************************/
44 #if !defined(LINUX) && !defined(__QNXNTO__)
45 #include <ntddk.h>
46 #include <windef.h>
47 #endif
49 #include "img_types.h"
50 #include "pvr_debug.h"
51 #include "dbgdrvif.h"
52 #include "dbgdriv.h"
53 #include "hotkey.h"
54 #include "hostfunc.h"
59 /*****************************************************************************
60  Global vars
61 *****************************************************************************/
63 IMG_UINT32      g_ui32HotKeyFrame = 0xFFFFFFFF;
64 IMG_BOOL        g_bHotKeyPressed = IMG_FALSE;
65 IMG_BOOL        g_bHotKeyRegistered = IMG_FALSE;
67 /* Hotkey stuff */
68 PRIVATEHOTKEYDATA    g_PrivateHotKeyData;
71 /*****************************************************************************
72  Code
73 *****************************************************************************/
76 /******************************************************************************
77  * Function Name: ReadInHotKeys
78  *
79  * Inputs       : none
80  * Outputs      : -
81  * Returns      : nothing
82  * Globals Used : -
83  *
84  * Description  : Gets Hot key entries from system.ini
85  *****************************************************************************/
86 IMG_VOID ReadInHotKeys(IMG_VOID)
87 {
88         g_PrivateHotKeyData.ui32ScanCode = 0x58;        /* F12  */
89         g_PrivateHotKeyData.ui32ShiftState = 0x0;
91         /*
92                 Find buffer names etc..
93         */
94         HostReadRegistryDWORDFromString("DEBUG\\Streams", "ui32ScanCode"  , &g_PrivateHotKeyData.ui32ScanCode);
95         HostReadRegistryDWORDFromString("DEBUG\\Streams", "ui32ShiftState", &g_PrivateHotKeyData.ui32ShiftState);
96 }
98 /******************************************************************************
99  * Function Name: RegisterKeyPressed
100  *
101  * Inputs       : IMG_UINT32 dwui32ScanCode, PHOTKEYINFO pInfo
102  * Outputs      : -
103  * Returns      : nothing
104  * Globals Used : -
105  *
106  * Description  : Called when hotkey pressed.
107  *****************************************************************************/
108 IMG_VOID RegisterKeyPressed(IMG_UINT32 dwui32ScanCode, PHOTKEYINFO pInfo)
110         PDBG_STREAM     psStream;
112         PVR_UNREFERENCED_PARAMETER(pInfo);
114         if (dwui32ScanCode == g_PrivateHotKeyData.ui32ScanCode)
115         {
116                 PVR_DPF((PVR_DBG_MESSAGE,"PDUMP Hotkey pressed !\n"));
118                 psStream = (PDBG_STREAM) g_PrivateHotKeyData.sHotKeyInfo.pvStream;
120                 if (!g_bHotKeyPressed)
121                 {
122                         /*
123                                 Capture the next frame.
124                         */
125                         g_ui32HotKeyFrame = psStream->psCtrl->ui32Current + 2;
127                         /*
128                                 Do the flag.
129                         */
130                         g_bHotKeyPressed = IMG_TRUE;
131                 }
132         }
135 /******************************************************************************
136  * Function Name: ActivateHotKeys
137  *
138  * Inputs       : -
139  * Outputs      : -
140  * Returns      : -
141  * Globals Used : -
142  *
143  * Description  : Installs HotKey callbacks
144  *****************************************************************************/
145 IMG_VOID ActivateHotKeys(PDBG_STREAM psStream)
147         /*
148                 Setup hotkeys.
149         */
150         ReadInHotKeys();
152         /*
153                 Has it already been allocated.
154         */
155         if (!g_PrivateHotKeyData.sHotKeyInfo.hHotKey)
156         {
157                 if (g_PrivateHotKeyData.ui32ScanCode != 0)
158                 {
159                         PVR_DPF((PVR_DBG_MESSAGE,"Activate HotKey for PDUMP.\n"));
161                         /*
162                                 Add in stream data.
163                         */
164                         g_PrivateHotKeyData.sHotKeyInfo.pvStream = psStream;
166                         DefineHotKey(g_PrivateHotKeyData.ui32ScanCode, g_PrivateHotKeyData.ui32ShiftState, &g_PrivateHotKeyData.sHotKeyInfo);
167                 }
168                 else
169                 {
170                         g_PrivateHotKeyData.sHotKeyInfo.hHotKey = 0;
171                 }
172         }
175 /******************************************************************************
176  * Function Name: DeactivateHotKeys
177  *
178  * Inputs       : -
179  * Outputs      : -
180  * Returns      : -
181  * Globals Used : -
182  *
183  * Description  : Removes HotKey callbacks
184  *****************************************************************************/
185 IMG_VOID DeactivateHotKeys(IMG_VOID)
187         if (g_PrivateHotKeyData.sHotKeyInfo.hHotKey != 0)
188         {
189                 PVR_DPF((PVR_DBG_MESSAGE,"Deactivate HotKey.\n"));
191                 RemoveHotKey(g_PrivateHotKeyData.sHotKeyInfo.hHotKey);
192                 g_PrivateHotKeyData.sHotKeyInfo.hHotKey = 0;
193         }
197 /*****************************************************************************
198  End of file (HOTKEY.C)
199 *****************************************************************************/