author | arunabha |
Tue, 09 Feb 2010 19:13:57 +0000 | |
changeset 21 | 524118fd998f |
parent 0 | 6663340f3fc9 |
child 51 | 254b9435d75e |
permissions | -rwxr-xr-x |
0 | 1 |
// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). |
2 |
// All rights reserved. |
|
3 |
// This component and the accompanying materials are made available |
|
4 |
// under the terms of the License "Eclipse Public License v1.0" |
|
5 |
// which accompanies this distribution, and is available |
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 |
// |
|
8 |
// Initial Contributors: |
|
9 |
// Nokia Corporation - initial contribution. |
|
10 |
// |
|
11 |
// Contributors: |
|
12 |
// |
|
13 |
// Description: |
|
14 |
// omap3530/beagle_drivers/serialmouse/serialmouse.cpp |
|
15 |
// Serial mouse driver |
|
16 |
// |
|
17 |
||
18 |
||
19 |
||
20 |
/** |
|
21 |
@file |
|
22 |
@internalTechnology |
|
23 |
*/ |
|
24 |
||
25 |
#include <e32keys.h> |
|
26 |
#include <arm.h> |
|
27 |
#include <comm.h> |
|
28 |
#include <assp.h> |
|
29 |
||
30 |
#include <assp/omap3530_assp/omap3530_uart.h> |
|
31 |
//#include <assp/omap3530_assp/omap3530_prm.h> |
|
32 |
#include <assp/omap3530_assp/omap3530_prcm.h> |
|
33 |
//#include <resourceman.h> |
|
34 |
||
35 |
#include "serialmouse.h" |
|
36 |
||
37 |
_LIT( KName, "SERMOUSE" ); |
|
38 |
||
39 |
#ifdef _FRAME_BUFFER_CURSOR_ |
|
40 |
# define CURSOR_SIZE 5 |
|
41 |
#endif |
|
42 |
||
21
524118fd998f
Fixes for the Keyboard mapping , serial Mouse and the LCD drivers
arunabha
parents:
0
diff
changeset
|
43 |
// AndyS Add support for sending keyboard events |
524118fd998f
Fixes for the Keyboard mapping , serial Mouse and the LCD drivers
arunabha
parents:
0
diff
changeset
|
44 |
#define STDKEY(x) (0x1FFF&(x)) |
0 | 45 |
|
46 |
LOCAL_C TInt halFunction(TAny* aPtr, TInt aFunction, TAny* a1, TAny* a2) |
|
47 |
{ |
|
48 |
TSerialMouse* pH=(TSerialMouse*)aPtr; |
|
49 |
return pH->HalFunction(aFunction,a1,a2); |
|
50 |
} |
|
51 |
||
52 |
TSerialMouse::TSerialMouse() |
|
53 |
: iKeyDfc( KeyDfcFn, this, Kern::DfcQue0(), 1 ), iState(ENormal), |
|
54 |
iUart( Omap3530Uart::EUart2 ) |
|
55 |
{ |
|
56 |
Kern::Printf("+TSerialMouse::TSerialMouse"); |
|
57 |
||
58 |
# ifdef _FRAME_BUFFER_CURSOR_ |
|
59 |
iCursorBuffer = new TUint16[CURSOR_SIZE*CURSOR_SIZE]; |
|
60 |
# endif |
|
61 |
||
62 |
} |
|
63 |
||
64 |
TSerialMouse::~TSerialMouse() |
|
65 |
{ |
|
66 |
# ifdef _FRAME_BUFFER_CURSOR_ |
|
67 |
delete[] iCursorBuffer; |
|
68 |
# endif |
|
69 |
} |
|
70 |
||
71 |
TInt TSerialMouse::Create() |
|
72 |
{ |
|
73 |
||
74 |
GetScreenInfo(); |
|
75 |
||
76 |
TInt r=Kern::AddHalEntry(EHalGroupMouse, halFunction, this); |
|
77 |
if (r!=KErrNone) |
|
78 |
return r; |
|
79 |
||
21
524118fd998f
Fixes for the Keyboard mapping , serial Mouse and the LCD drivers
arunabha
parents:
0
diff
changeset
|
80 |
Kern::Printf("TSerialMouse initialising"); |
0 | 81 |
|
82 |
__KTRACE_OPT(KBOOT,Kern::Printf("+TSerialMouse::Init")) ; |
|
21
524118fd998f
Fixes for the Keyboard mapping , serial Mouse and the LCD drivers
arunabha
parents:
0
diff
changeset
|
83 |
/* |
0 | 84 |
iDebugPort = Kern::SuperPage().iDebugPort; // Get the debug port number |
21
524118fd998f
Fixes for the Keyboard mapping , serial Mouse and the LCD drivers
arunabha
parents:
0
diff
changeset
|
85 |
Kern::Printf("Debugport=%d", iDebugPort); |
524118fd998f
Fixes for the Keyboard mapping , serial Mouse and the LCD drivers
arunabha
parents:
0
diff
changeset
|
86 |
|
0 | 87 |
if( Arm::EDebugPortJTAG == iDebugPort ) |
88 |
{ |
|
89 |
__KTRACE_OPT(KBOOT,Kern::Printf("-TSerialMouse::Init: JTAG not supported")); |
|
90 |
// We don't want to return an error here, just don't bother to initialize |
|
91 |
return KErrNone; |
|
92 |
} |
|
93 |
else if( 2 != iDebugPort ) |
|
94 |
{ |
|
95 |
__KTRACE_OPT(KBOOT,Kern::Printf("-TSerialMouse::Init: Only UART3 supported")); |
|
96 |
// We don't want to return an error here, just don't bother to initialize |
|
97 |
return KErrNone; |
|
98 |
} |
|
21
524118fd998f
Fixes for the Keyboard mapping , serial Mouse and the LCD drivers
arunabha
parents:
0
diff
changeset
|
99 |
*/ |
0 | 100 |
|
101 |
// Register with the power resource manager |
|
102 |
//r = PowerResourceManager::RegisterClient( iPrmClientId, KName ); |
|
103 |
//if( r != KErrNone ) |
|
104 |
// { |
|
105 |
// return r; |
|
106 |
// } |
|
107 |
||
108 |
//__KTRACE_OPT(KBOOT,Kern::Printf("+TSerialMouse::Init:PRM client ID=%x", iPrmClientId )) ; |
|
109 |
||
21
524118fd998f
Fixes for the Keyboard mapping , serial Mouse and the LCD drivers
arunabha
parents:
0
diff
changeset
|
110 |
Prcm::SetClockState(iUart.PrcmInterfaceClk(), Prcm::EClkOn); |
524118fd998f
Fixes for the Keyboard mapping , serial Mouse and the LCD drivers
arunabha
parents:
0
diff
changeset
|
111 |
Prcm::SetClockState(iUart.PrcmFunctionClk(), Prcm::EClkOn); |
524118fd998f
Fixes for the Keyboard mapping , serial Mouse and the LCD drivers
arunabha
parents:
0
diff
changeset
|
112 |
|
0 | 113 |
r =Interrupt::Bind( iUart.InterruptId(),Isr,this); |
114 |
if ( r < 0 ) |
|
115 |
{ |
|
116 |
Kern::Printf("TSerialMouse::Create Cant Bind to Interrupt %d ret %d",iUart.InterruptId(), r ); |
|
117 |
return r; |
|
118 |
} |
|
119 |
||
120 |
// Ask power resource manager to turn on clocks to the UART |
|
121 |
// (this could take some time but we're not in any hurry) |
|
122 |
//r = PowerResourceManager::ChangeResourceState( iPrmClientId, iUart.PrmFunctionClk(), Prcm::EClkAuto ); |
|
123 |
//if( KErrNone != r ) |
|
124 |
// { |
|
125 |
// return r; |
|
126 |
// } |
|
127 |
||
128 |
//r = PowerResourceManager::ChangeResourceState( iPrmClientId, iUart.PrmInterfaceClk(), Prcm::EClkAuto ); |
|
129 |
//if( KErrNone != r ) |
|
130 |
// { |
|
131 |
// return r; |
|
132 |
// } |
|
133 |
||
134 |
iUart.Init(); |
|
135 |
iUart.DefineMode( Omap3530Uart::TUart::EUart ); |
|
136 |
iUart.SetBaud( Omap3530Uart::TUart::E1200 ); |
|
137 |
iUart.SetDataFormat( Omap3530Uart::TUart::E7Data, Omap3530Uart::TUart::E1Stop, Omap3530Uart::TUart::ENone ); |
|
138 |
iUart.EnableFifo( Omap3530Uart::TUart::EEnabled, Omap3530Uart::TUart::ETriggerUnchanged, Omap3530Uart::TUart::ETrigger8 ); |
|
139 |
iUart.EnableInterrupt( Omap3530Uart::TUart::EIntRhr ); |
|
140 |
iUart.Enable(); |
|
141 |
||
142 |
Interrupt::Enable(iUart.InterruptId()); |
|
21
524118fd998f
Fixes for the Keyboard mapping , serial Mouse and the LCD drivers
arunabha
parents:
0
diff
changeset
|
143 |
|
524118fd998f
Fixes for the Keyboard mapping , serial Mouse and the LCD drivers
arunabha
parents:
0
diff
changeset
|
144 |
Kern::Printf("TSerialMouse initialised ID=%d", iUart.InterruptId()); |
524118fd998f
Fixes for the Keyboard mapping , serial Mouse and the LCD drivers
arunabha
parents:
0
diff
changeset
|
145 |
|
0 | 146 |
return KErrNone; |
147 |
} |
|
148 |
||
149 |
||
150 |
void TSerialMouse::Isr( TAny* aPtr ) |
|
151 |
// |
|
152 |
// Interrupt service routine. Called when we receive an interrupt |
|
153 |
// on the IRQ line it is bound to. If it's a receive, queues DFC |
|
154 |
// to post the event into the event queue. |
|
155 |
// |
|
156 |
{ |
|
157 |
TSerialMouse* self = (TSerialMouse*)aPtr; |
|
158 |
||
159 |
const TUint iir = Omap3530Uart::IIR::iMem.Read( self->iUart ); |
|
160 |
||
161 |
if ( 0 == (iir bitand Omap3530Uart::IIR::IT_PENDING::KMask) ) |
|
162 |
{ |
|
163 |
const TUint pending = iir bitand Omap3530Uart::IIR::IT_TYPE::KFieldMask; |
|
164 |
||
165 |
// Although the TI datasheet descrivwed IT_TYPE as being an enumerated priority-decoded interrupt |
|
166 |
// it appears to actually be a bitmask of active interrupt sources |
|
167 |
if ( (pending bitand Omap3530Uart::IIR::IT_TYPE::ERHR) || (pending bitand Omap3530Uart::IIR::IT_TYPE::ERxLineStatus) ) |
|
168 |
{ |
|
169 |
TUint byte = self->iUart.Read(); |
|
170 |
||
171 |
self->iKey = byte; |
|
172 |
self->iKeyDfc.Add(); |
|
173 |
Interrupt::Disable( self->iUart.InterruptId() ); |
|
174 |
} |
|
175 |
} |
|
176 |
} |
|
177 |
||
178 |
void TSerialMouse::KeyDfcFn( TAny* aPtr ) |
|
179 |
// |
|
180 |
// DFC function. Just calls inline function KeyDfc() |
|
181 |
// |
|
182 |
{ |
|
183 |
((TSerialMouse*)aPtr)->KeyDfc(); |
|
184 |
} |
|
185 |
||
186 |
inline void TSerialMouse::KeyDfc() |
|
187 |
// |
|
188 |
// Processes received characters |
|
189 |
// |
|
190 |
{ |
|
191 |
||
192 |
const TUint8 b = iKey; |
|
193 |
if ( b & 1<<6 ) |
|
194 |
{ |
|
195 |
// Beginning of a new frame |
|
196 |
iByteIndex = 0; |
|
197 |
iB0 = b; |
|
198 |
} |
|
199 |
else if ( iByteIndex == 0 ) |
|
200 |
{ |
|
201 |
iByteIndex = 1; |
|
202 |
iB1 = b; |
|
203 |
} |
|
204 |
else if ( iByteIndex == 1 ) |
|
205 |
{ |
|
206 |
iByteIndex = -1; |
|
207 |
iB2 = b; |
|
208 |
||
209 |
const TInt8 x_increment = (iB0 & 0x3)<<6 | (iB1 & 0x3f); |
|
210 |
const TInt8 y_increment = (iB0 & 0xC)<<4 | (iB2 & 0x3f); |
|
211 |
const TBool isLeftButtonDown = iB0& 1<<5; |
|
212 |
const TBool isRightButtonDown = iB0& 1<<4; |
|
213 |
||
21
524118fd998f
Fixes for the Keyboard mapping , serial Mouse and the LCD drivers
arunabha
parents:
0
diff
changeset
|
214 |
Kern::Printf("Mouse dx=%d dy=%d lmb=%d", x_increment, y_increment, isLeftButtonDown); |
524118fd998f
Fixes for the Keyboard mapping , serial Mouse and the LCD drivers
arunabha
parents:
0
diff
changeset
|
215 |
|
0 | 216 |
# ifdef _FRAME_BUFFER_CURSOR_ |
217 |
iLastX = iX; |
|
218 |
iLastY = iY; |
|
219 |
# endif |
|
220 |
||
221 |
iX += x_increment; //Scale ( x_increment ); |
|
222 |
iY += y_increment; //Scale ( y_increment ); |
|
223 |
||
224 |
Clip( iX, iY ); |
|
225 |
||
226 |
//DBG_PRINT4(_L("\nx:%d y:%d (%d,%d)"), x_increment, y_increment, iX, iY ); |
|
227 |
||
228 |
TBool rightButtonEvent = (isRightButtonDown != iLastRightButtonDown); |
|
229 |
TBool leftButtonEvent = (isLeftButtonDown != iLastLeftButtonDown); |
|
230 |
iLastLeftButtonDown = isLeftButtonDown; |
|
231 |
iLastRightButtonDown = isRightButtonDown; |
|
232 |
||
233 |
TRawEvent e; |
|
234 |
||
235 |
if ( rightButtonEvent ) |
|
236 |
{ |
|
21
524118fd998f
Fixes for the Keyboard mapping , serial Mouse and the LCD drivers
arunabha
parents:
0
diff
changeset
|
237 |
if(isRightButtonDown) |
524118fd998f
Fixes for the Keyboard mapping , serial Mouse and the LCD drivers
arunabha
parents:
0
diff
changeset
|
238 |
{ |
524118fd998f
Fixes for the Keyboard mapping , serial Mouse and the LCD drivers
arunabha
parents:
0
diff
changeset
|
239 |
e.Set( isRightButtonDown ? TRawEvent::EButton2Down : TRawEvent::EButton2Up, iX, iY ); |
524118fd998f
Fixes for the Keyboard mapping , serial Mouse and the LCD drivers
arunabha
parents:
0
diff
changeset
|
240 |
Kern::AddEvent(e); |
524118fd998f
Fixes for the Keyboard mapping , serial Mouse and the LCD drivers
arunabha
parents:
0
diff
changeset
|
241 |
} |
524118fd998f
Fixes for the Keyboard mapping , serial Mouse and the LCD drivers
arunabha
parents:
0
diff
changeset
|
242 |
else |
524118fd998f
Fixes for the Keyboard mapping , serial Mouse and the LCD drivers
arunabha
parents:
0
diff
changeset
|
243 |
{ |
524118fd998f
Fixes for the Keyboard mapping , serial Mouse and the LCD drivers
arunabha
parents:
0
diff
changeset
|
244 |
AddKey(EStdKeyApplication0); |
524118fd998f
Fixes for the Keyboard mapping , serial Mouse and the LCD drivers
arunabha
parents:
0
diff
changeset
|
245 |
} |
0 | 246 |
//DBG_PRINT1(_L(" right:%S"), isRightButtonDown?&_L("down"):&_L("up") ); |
247 |
} |
|
248 |
||
249 |
if ( leftButtonEvent ) |
|
250 |
{ |
|
251 |
e.Set( isLeftButtonDown ? TRawEvent::EButton1Down : TRawEvent::EButton1Up, iX, iY ); |
|
252 |
Kern::AddEvent(e); |
|
253 |
//DBG_PRINT1(_L(" left:%S"), isLeftButtonDown?&_L("down"):&_L("up") ); |
|
254 |
} |
|
255 |
||
256 |
if ( !rightButtonEvent && !leftButtonEvent ) |
|
257 |
{ |
|
258 |
# ifdef _TRACK_COORDINATES_ |
|
259 |
// Reoprt the exact coordinate to the windowserver |
|
260 |
e.Set(TRawEvent::EPointerMove,iX,iY); |
|
261 |
# else |
|
262 |
// Report the change in coordinates to the windowserver |
|
263 |
e.Set(TRawEvent::EPointerMove,x_increment,y_increment); |
|
264 |
# endif |
|
265 |
Kern::AddEvent(e); |
|
266 |
} |
|
267 |
||
268 |
# ifdef _FRAME_BUFFER_CURSOR_ |
|
269 |
DrawCursor(iX,iY); |
|
270 |
# endif |
|
271 |
||
272 |
} |
|
273 |
||
274 |
Interrupt::Enable(iUart.InterruptId()); // Can handle new chars now |
|
275 |
} /* end of function - KeyDfc - */ |
|
276 |
||
277 |
||
278 |
/* |
|
279 |
Perform 2:1 scaling on a mosue movement. |
|
280 |
*/ |
|
281 |
TInt TSerialMouse::Scale(const TInt& aVal) |
|
282 |
{ |
|
283 |
switch (aVal) |
|
284 |
{ |
|
285 |
case 0: return 0; |
|
286 |
case 1: |
|
287 |
case 2: return 1; |
|
288 |
case 3: return 3; |
|
289 |
case 4: return 6; |
|
290 |
case 5: return 9; |
|
291 |
case -1: |
|
292 |
case -2: return -1; |
|
293 |
case -3: return -3; |
|
294 |
case -4: return -6; |
|
295 |
case -5: return -9; |
|
296 |
default: return 2*aVal; |
|
297 |
} |
|
298 |
} |
|
299 |
||
300 |
/* |
|
301 |
Clip the mouse coordinates into the dimensions of the screen |
|
302 |
*/ |
|
303 |
void TSerialMouse::Clip(TInt& aX, TInt& aY) |
|
304 |
{ |
|
305 |
if ( aX < 0 ) aX = 0; |
|
306 |
if ( aX >= iScreenWidth ) aX = iScreenWidth - 1; |
|
307 |
if ( aY < 0 ) aY = 0; |
|
308 |
if ( aY >= iScreenHeight ) aY = iScreenHeight - 1; |
|
309 |
} |
|
310 |
||
311 |
void TSerialMouse::GetScreenInfo() |
|
312 |
{ |
|
313 |
TScreenInfoV01 screenInfo; |
|
314 |
TPckg<TScreenInfoV01> sI(screenInfo); |
|
315 |
Kern::HalFunction(EHalGroupDisplay,EDisplayHalScreenInfo,(TAny*)&sI,NULL); |
|
316 |
iScreenWidth = screenInfo.iScreenSize.iWidth; |
|
317 |
iScreenHeight = screenInfo.iScreenSize.iHeight; |
|
318 |
# ifdef _FRAME_BUFFER_CURSOR_ |
|
319 |
iVideoAddress = (TUint8*)screenInfo.iScreenAddress; |
|
320 |
# endif |
|
321 |
} |
|
322 |
||
323 |
#ifdef _FRAME_BUFFER_CURSOR_ |
|
324 |
void TSerialMouse::Blit(TInt x, TInt y, TUint16 aColour) |
|
325 |
{ |
|
326 |
||
327 |
TUint16* fb = (TUint16*)iVideoAddress; |
|
328 |
fb += (iLastY * iScreenWidth) + iLastX; |
|
329 |
for (TInt i = 0; i<CURSOR_SIZE; ++i) //row |
|
330 |
{ |
|
331 |
||
332 |
if ( (iLastY + i) >= iScreenHeight) break; |
|
333 |
||
334 |
for (TInt j = 0; j<CURSOR_SIZE; ++j) //column |
|
335 |
{ |
|
336 |
||
337 |
if ((iLastX+j) < iScreenWidth) |
|
338 |
{ |
|
339 |
*fb = iCursorBuffer[i*CURSOR_SIZE + j]; |
|
340 |
} |
|
341 |
||
342 |
++fb; |
|
343 |
} |
|
344 |
fb += iScreenWidth - CURSOR_SIZE; |
|
345 |
} |
|
346 |
||
347 |
||
348 |
fb = (TUint16*)iVideoAddress; |
|
349 |
fb += (y * iScreenWidth) + x; |
|
350 |
for (TInt i = 0; i<CURSOR_SIZE; ++i) //row |
|
351 |
{ |
|
352 |
||
353 |
if ( (y + i) >= iScreenHeight) break; |
|
354 |
||
355 |
for (TInt j = 0; j<CURSOR_SIZE; ++j) //column |
|
356 |
{ |
|
357 |
||
358 |
if ((x+j) < iScreenWidth) |
|
359 |
{ |
|
360 |
iCursorBuffer[i*CURSOR_SIZE + j] = *fb; |
|
361 |
*fb = aColour; |
|
362 |
} |
|
363 |
||
364 |
++fb; |
|
365 |
} |
|
366 |
fb += iScreenWidth - CURSOR_SIZE; |
|
367 |
} |
|
368 |
||
369 |
/*TUint8* fb = iVideoAddress; |
|
370 |
fb += ( (y * iScreenWidth) + x ) * 2; |
|
371 |
||
372 |
TBuf8<256> cur; |
|
373 |
cur.FillZ(); |
|
374 |
TUint8* cursor = &cur[0]; |
|
375 |
||
376 |
for (TInt i = 0; i<cursorSize; ++i) |
|
377 |
{ |
|
378 |
||
379 |
if ( (y + i) >= iScreenHeight) break; |
|
380 |
||
381 |
TInt bytes_to_copy = Min( cursorSize, iScreenWidth*2 - x*2 ); |
|
382 |
||
383 |
Mem::Copy(fb, cursor, bytes_to_copy ); |
|
384 |
||
385 |
cursor += cursorSize; |
|
386 |
||
387 |
}*/ |
|
388 |
||
389 |
} |
|
390 |
||
391 |
void TSerialMouse::DrawCursor(TInt x, TInt y) |
|
392 |
{ |
|
393 |
TUint16 cursorColour = iLastLeftButtonDown ? 0x1F : 0x00; |
|
394 |
Blit(x, y, cursorColour); |
|
395 |
} |
|
396 |
#endif |
|
397 |
||
398 |
||
399 |
TInt TSerialMouse::HalFunction(TInt aFunction, TAny* a1, TAny* /*a2*/) |
|
400 |
{ |
|
401 |
TInt r=KErrNone; |
|
402 |
switch(aFunction) |
|
403 |
{ |
|
404 |
case EMouseHalMouseInfo: |
|
405 |
{ |
|
406 |
TPckgBuf<TMouseInfoV01> vPckg; |
|
407 |
TMouseInfoV01& xyinfo=vPckg(); |
|
408 |
xyinfo.iMouseButtons=2; |
|
409 |
xyinfo.iMouseAreaSize.iWidth=iScreenWidth; |
|
410 |
xyinfo.iMouseAreaSize.iHeight=iScreenHeight; |
|
411 |
xyinfo.iOffsetToDisplay.iX=0; |
|
412 |
xyinfo.iOffsetToDisplay.iY=0; |
|
413 |
Kern::InfoCopy(*(TDes8*)a1,vPckg); |
|
414 |
break; |
|
415 |
} |
|
416 |
default: |
|
417 |
r=KErrNotSupported; |
|
418 |
break; |
|
419 |
} |
|
420 |
return r; |
|
421 |
} |
|
422 |
||
423 |
void DoCreate( TAny* aParam ) |
|
424 |
{ |
|
425 |
TInt r = reinterpret_cast< TSerialMouse* >( aParam )->Create(); |
|
426 |
__ASSERT_ALWAYS( r == KErrNone, Kern::Fault( "SERKEY-Cr", r ) ); |
|
427 |
} |
|
428 |
||
21
524118fd998f
Fixes for the Keyboard mapping , serial Mouse and the LCD drivers
arunabha
parents:
0
diff
changeset
|
429 |
// AndyS support for sending keypresses |
524118fd998f
Fixes for the Keyboard mapping , serial Mouse and the LCD drivers
arunabha
parents:
0
diff
changeset
|
430 |
void TSerialMouse::AddKey( TUint aKey ) |
524118fd998f
Fixes for the Keyboard mapping , serial Mouse and the LCD drivers
arunabha
parents:
0
diff
changeset
|
431 |
{ |
524118fd998f
Fixes for the Keyboard mapping , serial Mouse and the LCD drivers
arunabha
parents:
0
diff
changeset
|
432 |
const TUint8 stdKey = STDKEY(aKey); |
524118fd998f
Fixes for the Keyboard mapping , serial Mouse and the LCD drivers
arunabha
parents:
0
diff
changeset
|
433 |
|
524118fd998f
Fixes for the Keyboard mapping , serial Mouse and the LCD drivers
arunabha
parents:
0
diff
changeset
|
434 |
TRawEvent e; |
524118fd998f
Fixes for the Keyboard mapping , serial Mouse and the LCD drivers
arunabha
parents:
0
diff
changeset
|
435 |
|
524118fd998f
Fixes for the Keyboard mapping , serial Mouse and the LCD drivers
arunabha
parents:
0
diff
changeset
|
436 |
Kern::Printf("AddKey %d", stdKey); |
524118fd998f
Fixes for the Keyboard mapping , serial Mouse and the LCD drivers
arunabha
parents:
0
diff
changeset
|
437 |
|
524118fd998f
Fixes for the Keyboard mapping , serial Mouse and the LCD drivers
arunabha
parents:
0
diff
changeset
|
438 |
e.Set( TRawEvent::EKeyDown, stdKey, 0 ); |
524118fd998f
Fixes for the Keyboard mapping , serial Mouse and the LCD drivers
arunabha
parents:
0
diff
changeset
|
439 |
Kern::AddEvent( e ); |
524118fd998f
Fixes for the Keyboard mapping , serial Mouse and the LCD drivers
arunabha
parents:
0
diff
changeset
|
440 |
e.Set( TRawEvent::EKeyUp, stdKey, 0 ); |
524118fd998f
Fixes for the Keyboard mapping , serial Mouse and the LCD drivers
arunabha
parents:
0
diff
changeset
|
441 |
Kern::AddEvent( e ); |
524118fd998f
Fixes for the Keyboard mapping , serial Mouse and the LCD drivers
arunabha
parents:
0
diff
changeset
|
442 |
} |
524118fd998f
Fixes for the Keyboard mapping , serial Mouse and the LCD drivers
arunabha
parents:
0
diff
changeset
|
443 |
|
0 | 444 |
|
445 |
// |
|
446 |
// Kernel Extension entry point |
|
447 |
// |
|
448 |
DECLARE_STANDARD_EXTENSION() |
|
449 |
{ |
|
450 |
__KTRACE_OPT(KBOOT,Kern::Printf("Starting mouse driver")); |
|
451 |
||
452 |
// create mouse driver |
|
453 |
TInt r=KErrNoMemory; |
|
454 |
TSerialMouse* mouse = new TSerialMouse; |
|
455 |
if ( mouse ) |
|
456 |
{ |
|
457 |
// Because the Power Resource Manager doesn't finish initializing until after it |
|
458 |
// has run a DFC on SvMsgQue, we need to defer our initialization until after that |
|
459 |
// so we know that the PRM is ready for us to use it |
|
460 |
static TDfc createDfc( &DoCreate, NULL ); |
|
461 |
new( &createDfc ) TDfc( &DoCreate, mouse, Kern::SvMsgQue(), KMaxDfcPriority-2 ); |
|
462 |
createDfc.Enque(); |
|
463 |
r = KErrNone; |
|
464 |
} |
|
465 |
__KTRACE_OPT(KEXTENSION,Kern::Printf("Returns %d",r)); |
|
466 |
return r; |
|
467 |
} |