38 |
38 |
39 #ifdef _FRAME_BUFFER_CURSOR_ |
39 #ifdef _FRAME_BUFFER_CURSOR_ |
40 # define CURSOR_SIZE 5 |
40 # define CURSOR_SIZE 5 |
41 #endif |
41 #endif |
42 |
42 |
|
43 // AndyS Add support for sending keyboard events |
|
44 #define STDKEY(x) (0x1FFF&(x)) |
43 |
45 |
44 LOCAL_C TInt halFunction(TAny* aPtr, TInt aFunction, TAny* a1, TAny* a2) |
46 LOCAL_C TInt halFunction(TAny* aPtr, TInt aFunction, TAny* a1, TAny* a2) |
45 { |
47 { |
46 TSerialMouse* pH=(TSerialMouse*)aPtr; |
48 TSerialMouse* pH=(TSerialMouse*)aPtr; |
47 return pH->HalFunction(aFunction,a1,a2); |
49 return pH->HalFunction(aFunction,a1,a2); |
73 |
75 |
74 TInt r=Kern::AddHalEntry(EHalGroupMouse, halFunction, this); |
76 TInt r=Kern::AddHalEntry(EHalGroupMouse, halFunction, this); |
75 if (r!=KErrNone) |
77 if (r!=KErrNone) |
76 return r; |
78 return r; |
77 |
79 |
|
80 Kern::Printf("TSerialMouse initialising"); |
78 |
81 |
79 __KTRACE_OPT(KBOOT,Kern::Printf("+TSerialMouse::Init")) ; |
82 __KTRACE_OPT(KBOOT,Kern::Printf("+TSerialMouse::Init")) ; |
80 |
83 /* |
81 iDebugPort = Kern::SuperPage().iDebugPort; // Get the debug port number |
84 iDebugPort = Kern::SuperPage().iDebugPort; // Get the debug port number |
|
85 Kern::Printf("Debugport=%d", iDebugPort); |
|
86 |
82 if( Arm::EDebugPortJTAG == iDebugPort ) |
87 if( Arm::EDebugPortJTAG == iDebugPort ) |
83 { |
88 { |
84 __KTRACE_OPT(KBOOT,Kern::Printf("-TSerialMouse::Init: JTAG not supported")); |
89 __KTRACE_OPT(KBOOT,Kern::Printf("-TSerialMouse::Init: JTAG not supported")); |
85 // We don't want to return an error here, just don't bother to initialize |
90 // We don't want to return an error here, just don't bother to initialize |
86 return KErrNone; |
91 return KErrNone; |
89 { |
94 { |
90 __KTRACE_OPT(KBOOT,Kern::Printf("-TSerialMouse::Init: Only UART3 supported")); |
95 __KTRACE_OPT(KBOOT,Kern::Printf("-TSerialMouse::Init: Only UART3 supported")); |
91 // We don't want to return an error here, just don't bother to initialize |
96 // We don't want to return an error here, just don't bother to initialize |
92 return KErrNone; |
97 return KErrNone; |
93 } |
98 } |
94 |
99 */ |
95 |
100 |
96 // Register with the power resource manager |
101 // Register with the power resource manager |
97 //r = PowerResourceManager::RegisterClient( iPrmClientId, KName ); |
102 //r = PowerResourceManager::RegisterClient( iPrmClientId, KName ); |
98 //if( r != KErrNone ) |
103 //if( r != KErrNone ) |
99 // { |
104 // { |
100 // return r; |
105 // return r; |
101 // } |
106 // } |
102 |
107 |
103 //__KTRACE_OPT(KBOOT,Kern::Printf("+TSerialMouse::Init:PRM client ID=%x", iPrmClientId )) ; |
108 //__KTRACE_OPT(KBOOT,Kern::Printf("+TSerialMouse::Init:PRM client ID=%x", iPrmClientId )) ; |
104 |
109 |
|
110 Prcm::SetClockState(iUart.PrcmInterfaceClk(), Prcm::EClkOn); |
|
111 Prcm::SetClockState(iUart.PrcmFunctionClk(), Prcm::EClkOn); |
|
112 |
105 r =Interrupt::Bind( iUart.InterruptId(),Isr,this); |
113 r =Interrupt::Bind( iUart.InterruptId(),Isr,this); |
106 if ( r < 0 ) |
114 if ( r < 0 ) |
107 { |
115 { |
108 Kern::Printf("TSerialMouse::Create Cant Bind to Interrupt %d ret %d",iUart.InterruptId(), r ); |
116 Kern::Printf("TSerialMouse::Create Cant Bind to Interrupt %d ret %d",iUart.InterruptId(), r ); |
109 return r; |
117 return r; |
130 iUart.EnableFifo( Omap3530Uart::TUart::EEnabled, Omap3530Uart::TUart::ETriggerUnchanged, Omap3530Uart::TUart::ETrigger8 ); |
138 iUart.EnableFifo( Omap3530Uart::TUart::EEnabled, Omap3530Uart::TUart::ETriggerUnchanged, Omap3530Uart::TUart::ETrigger8 ); |
131 iUart.EnableInterrupt( Omap3530Uart::TUart::EIntRhr ); |
139 iUart.EnableInterrupt( Omap3530Uart::TUart::EIntRhr ); |
132 iUart.Enable(); |
140 iUart.Enable(); |
133 |
141 |
134 Interrupt::Enable(iUart.InterruptId()); |
142 Interrupt::Enable(iUart.InterruptId()); |
135 |
143 |
|
144 Kern::Printf("TSerialMouse initialised ID=%d", iUart.InterruptId()); |
|
145 |
136 return KErrNone; |
146 return KErrNone; |
137 } |
147 } |
138 |
148 |
139 |
149 |
140 void TSerialMouse::Isr( TAny* aPtr ) |
150 void TSerialMouse::Isr( TAny* aPtr ) |
200 const TInt8 x_increment = (iB0 & 0x3)<<6 | (iB1 & 0x3f); |
209 const TInt8 x_increment = (iB0 & 0x3)<<6 | (iB1 & 0x3f); |
201 const TInt8 y_increment = (iB0 & 0xC)<<4 | (iB2 & 0x3f); |
210 const TInt8 y_increment = (iB0 & 0xC)<<4 | (iB2 & 0x3f); |
202 const TBool isLeftButtonDown = iB0& 1<<5; |
211 const TBool isLeftButtonDown = iB0& 1<<5; |
203 const TBool isRightButtonDown = iB0& 1<<4; |
212 const TBool isRightButtonDown = iB0& 1<<4; |
204 |
213 |
|
214 Kern::Printf("Mouse dx=%d dy=%d lmb=%d", x_increment, y_increment, isLeftButtonDown); |
|
215 |
205 # ifdef _FRAME_BUFFER_CURSOR_ |
216 # ifdef _FRAME_BUFFER_CURSOR_ |
206 iLastX = iX; |
217 iLastX = iX; |
207 iLastY = iY; |
218 iLastY = iY; |
208 # endif |
219 # endif |
209 |
220 |
221 |
232 |
222 TRawEvent e; |
233 TRawEvent e; |
223 |
234 |
224 if ( rightButtonEvent ) |
235 if ( rightButtonEvent ) |
225 { |
236 { |
226 e.Set( isRightButtonDown ? TRawEvent::EButton2Down : TRawEvent::EButton2Up, iX, iY ); |
237 if(isRightButtonDown) |
227 Kern::AddEvent(e); |
238 { |
|
239 e.Set( isRightButtonDown ? TRawEvent::EButton2Down : TRawEvent::EButton2Up, iX, iY ); |
|
240 Kern::AddEvent(e); |
|
241 } |
|
242 else |
|
243 { |
|
244 AddKey(EStdKeyApplication0); |
|
245 } |
228 //DBG_PRINT1(_L(" right:%S"), isRightButtonDown?&_L("down"):&_L("up") ); |
246 //DBG_PRINT1(_L(" right:%S"), isRightButtonDown?&_L("down"):&_L("up") ); |
229 } |
247 } |
230 |
248 |
231 if ( leftButtonEvent ) |
249 if ( leftButtonEvent ) |
232 { |
250 { |
406 { |
424 { |
407 TInt r = reinterpret_cast< TSerialMouse* >( aParam )->Create(); |
425 TInt r = reinterpret_cast< TSerialMouse* >( aParam )->Create(); |
408 __ASSERT_ALWAYS( r == KErrNone, Kern::Fault( "SERKEY-Cr", r ) ); |
426 __ASSERT_ALWAYS( r == KErrNone, Kern::Fault( "SERKEY-Cr", r ) ); |
409 } |
427 } |
410 |
428 |
|
429 // AndyS support for sending keypresses |
|
430 void TSerialMouse::AddKey( TUint aKey ) |
|
431 { |
|
432 const TUint8 stdKey = STDKEY(aKey); |
|
433 |
|
434 TRawEvent e; |
|
435 |
|
436 Kern::Printf("AddKey %d", stdKey); |
|
437 |
|
438 e.Set( TRawEvent::EKeyDown, stdKey, 0 ); |
|
439 Kern::AddEvent( e ); |
|
440 e.Set( TRawEvent::EKeyUp, stdKey, 0 ); |
|
441 Kern::AddEvent( e ); |
|
442 } |
|
443 |
411 |
444 |
412 // |
445 // |
413 // Kernel Extension entry point |
446 // Kernel Extension entry point |
414 // |
447 // |
415 DECLARE_STANDARD_EXTENSION() |
448 DECLARE_STANDARD_EXTENSION() |