# HG changeset patch # User arunabha # Date 1265742837 0 # Node ID 524118fd998f9fc44126e80a246f19f42b7fdc37 # Parent 3999188eafd0cdb89324a1afcd5be045b065fecc Fixes for the Keyboard mapping , serial Mouse and the LCD drivers diff -r 3999188eafd0 -r 524118fd998f omap3530/beagle_drivers/keytran/keymap.cpp --- a/omap3530/beagle_drivers/keytran/keymap.cpp Tue Feb 02 21:04:35 2010 +0000 +++ b/omap3530/beagle_drivers/keytran/keymap.cpp Tue Feb 09 19:13:57 2010 +0000 @@ -143,6 +143,7 @@ {'0', '9'}, // scancode range 2 {'A', 'Z'}, // scancode range 3 {EStdKeyF1, EStdKeyDictaphoneRecord}, // scancode range 4 + {EStdKeyDevice0,EStdKeyDeviceF}, }; LOCAL_D const TUint16 convKeyCodes_base[]= @@ -263,7 +264,47 @@ EKeySliderUp, EKeyDictaphonePlay, EKeyDictaphoneStop, - EKeyDictaphoneRecord + EKeyDictaphoneRecord, + + + EKeyDevice0, + EKeyDevice1, + EKeyDevice2, + EKeyDevice3, + EKeyDevice4, + EKeyDevice5, + EKeyDevice6, + EKeyDevice7, + EKeyDevice8, + EKeyDevice9, + EKeyDeviceA, + EKeyDeviceB, + EKeyDeviceC, + EKeyDeviceE, + EKeyDeviceE, + EKeyDeviceF, + + + EKeyApplication0, + EKeyApplication1, + EKeyApplication2, + EKeyApplication3, + EKeyApplication4, + EKeyApplication5, + EKeyApplication6, + EKeyApplication7, + EKeyApplication8, + EKeyApplication9, + EKeyApplicationA, + EKeyApplicationB, + EKeyApplicationC, + EKeyApplicationD, + EKeyApplicationE, + EKeyApplicationF, + + EKeyYes, + EKeyNo, + }; diff -r 3999188eafd0 -r 524118fd998f omap3530/beagle_drivers/lcd/lcd.cpp --- a/omap3530/beagle_drivers/lcd/lcd.cpp Tue Feb 02 21:04:35 2010 +0000 +++ b/omap3530/beagle_drivers/lcd/lcd.cpp Tue Feb 09 19:13:57 2010 +0000 @@ -138,8 +138,19 @@ // TO DO: (mandatory) // define the physical screen dimensions // This is only example code... you need to modify it for your hardware + + +/* +Modified to scale up the display size to a 640x640 , which could be used for VGA layouts as well + const TUint KConfigLcdWidth = 360;//640; // 640 pixels per line const TUint KConfigLcdHeight = 640;//480; // 480 lines per panel +*/ + +const TUint KConfigLcdWidth = 640; // 640 pixels per line +const TUint KConfigLcdHeight = 640; // 640 lines per panel + + // TO DO: (mandatory) // define the characteristics of the LCD display @@ -155,8 +166,13 @@ // A TWIP is a 20th of a point. A point is a 72nd of an inch // Therefore a TWIP is a 1440th of an inch // This is only example code... you need to modify it for your hardware -const TInt KConfigLcdWidthInTwips = 9638;//10800; // = 6.69 inches //15*1440; -const TInt KConfigLcdHeightInTwips = 7370;//11232;//5616; // = 5.11 inches //12*1440; +//const TInt KConfigLcdWidthInTwips = 9638;//10800; // = 6.69 inches //15*1440; +//const TInt KConfigLcdHeightInTwips = 7370;//11232;//5616; // = 5.11 inches //12*1440; + +// Modified Twips in accordance with VGA changes - Not sure if it helps or is needed + +const TInt KConfigLcdWidthInTwips = 2670; // = 6.69 inches //15*1440; +const TInt KConfigLcdHeightInTwips = 3550; //5616; // = 5.11 inches //12*1440; // TO DO: (mandatory) // define the available display modes diff -r 3999188eafd0 -r 524118fd998f omap3530/beagle_drivers/serialmouse/serialmouse.cpp --- a/omap3530/beagle_drivers/serialmouse/serialmouse.cpp Tue Feb 02 21:04:35 2010 +0000 +++ b/omap3530/beagle_drivers/serialmouse/serialmouse.cpp Tue Feb 09 19:13:57 2010 +0000 @@ -40,6 +40,8 @@ # define CURSOR_SIZE 5 #endif +// AndyS Add support for sending keyboard events +#define STDKEY(x) (0x1FFF&(x)) LOCAL_C TInt halFunction(TAny* aPtr, TInt aFunction, TAny* a1, TAny* a2) { @@ -75,10 +77,13 @@ if (r!=KErrNone) return r; + Kern::Printf("TSerialMouse initialising"); __KTRACE_OPT(KBOOT,Kern::Printf("+TSerialMouse::Init")) ; - +/* iDebugPort = Kern::SuperPage().iDebugPort; // Get the debug port number + Kern::Printf("Debugport=%d", iDebugPort); + if( Arm::EDebugPortJTAG == iDebugPort ) { __KTRACE_OPT(KBOOT,Kern::Printf("-TSerialMouse::Init: JTAG not supported")); @@ -91,7 +96,7 @@ // We don't want to return an error here, just don't bother to initialize return KErrNone; } - +*/ // Register with the power resource manager //r = PowerResourceManager::RegisterClient( iPrmClientId, KName ); @@ -102,6 +107,9 @@ //__KTRACE_OPT(KBOOT,Kern::Printf("+TSerialMouse::Init:PRM client ID=%x", iPrmClientId )) ; + Prcm::SetClockState(iUart.PrcmInterfaceClk(), Prcm::EClkOn); + Prcm::SetClockState(iUart.PrcmFunctionClk(), Prcm::EClkOn); + r =Interrupt::Bind( iUart.InterruptId(),Isr,this); if ( r < 0 ) { @@ -132,7 +140,9 @@ iUart.Enable(); Interrupt::Enable(iUart.InterruptId()); - + + Kern::Printf("TSerialMouse initialised ID=%d", iUart.InterruptId()); + return KErrNone; } @@ -180,7 +190,6 @@ { const TUint8 b = iKey; - if ( b & 1<<6 ) { // Beginning of a new frame @@ -202,6 +211,8 @@ const TBool isLeftButtonDown = iB0& 1<<5; const TBool isRightButtonDown = iB0& 1<<4; + Kern::Printf("Mouse dx=%d dy=%d lmb=%d", x_increment, y_increment, isLeftButtonDown); + # ifdef _FRAME_BUFFER_CURSOR_ iLastX = iX; iLastY = iY; @@ -223,8 +234,15 @@ if ( rightButtonEvent ) { - e.Set( isRightButtonDown ? TRawEvent::EButton2Down : TRawEvent::EButton2Up, iX, iY ); - Kern::AddEvent(e); + if(isRightButtonDown) + { + e.Set( isRightButtonDown ? TRawEvent::EButton2Down : TRawEvent::EButton2Up, iX, iY ); + Kern::AddEvent(e); + } + else + { + AddKey(EStdKeyApplication0); + } //DBG_PRINT1(_L(" right:%S"), isRightButtonDown?&_L("down"):&_L("up") ); } @@ -408,6 +426,21 @@ __ASSERT_ALWAYS( r == KErrNone, Kern::Fault( "SERKEY-Cr", r ) ); } +// AndyS support for sending keypresses +void TSerialMouse::AddKey( TUint aKey ) + { + const TUint8 stdKey = STDKEY(aKey); + + TRawEvent e; + + Kern::Printf("AddKey %d", stdKey); + + e.Set( TRawEvent::EKeyDown, stdKey, 0 ); + Kern::AddEvent( e ); + e.Set( TRawEvent::EKeyUp, stdKey, 0 ); + Kern::AddEvent( e ); +} + // // Kernel Extension entry point diff -r 3999188eafd0 -r 524118fd998f omap3530/beagle_drivers/serialmouse/serialmouse.h --- a/omap3530/beagle_drivers/serialmouse/serialmouse.h Tue Feb 02 21:04:35 2010 +0000 +++ b/omap3530/beagle_drivers/serialmouse/serialmouse.h Tue Feb 09 19:13:57 2010 +0000 @@ -39,6 +39,9 @@ void Clip(TInt& aX, TInt& aY); void GetScreenInfo(); + // AndyS support for sending keyboard events + void AddKey( TUint aKey ); + enum TState { ENormal, EEscapingStart, EEscapingType1, EEscapingType2 }; private: TDfc iKeyDfc; @@ -61,7 +64,7 @@ TInt iLastY; TBool iLastLeftButtonDown; TBool iLastRightButtonDown; - + #ifdef _FRAME_BUFFER_CURSOR_ void DrawCursor(TInt x, TInt y); void Blit(TInt x, TInt y, TUint16 aColour); diff -r 3999188eafd0 -r 524118fd998f omap3530/shared/serialkeyb/serialkeyboard.cpp --- a/omap3530/shared/serialkeyb/serialkeyboard.cpp Tue Feb 02 21:04:35 2010 +0000 +++ b/omap3530/shared/serialkeyb/serialkeyboard.cpp Tue Feb 09 19:13:57 2010 +0000 @@ -99,10 +99,10 @@ /*3e*/ SHIFTED(EStdKeyFullStop), // > /*3f*/ SHIFTED(EStdKeyForwardSlash), // ? /*40*/ SHIFTED(EStdKeySingleQuote), // @ - /*41*/ SHIFTED('A'), - /*42*/ SHIFTED('B'), - /*43*/ SHIFTED('C'), - /*44*/ SHIFTED('D'), + /*41*/ EStdKeyUpArrow, + /*42*/ EStdKeyDownArrow, + /*43*/ EStdKeyRightArrow, + /*44*/ EStdKeyLeftArrow, /*45*/ SHIFTED('E'), /*46*/ SHIFTED('F'), /*47*/ SHIFTED('G'), @@ -131,11 +131,11 @@ /*5e*/ SHIFTED('6'), // ^ /*5f*/ SHIFTED(EStdKeyMinus), // _ /*60*/ EStdKeyBacklightToggle, // Actually ` - /*61*/ 'A', + /*61*/ EStdKeyYes, /*62*/ 'B', /*63*/ 'C', - /*64*/ 'D', - /*65*/ 'E', + /*64*/ EStdKeyNo, + /*65*/ EStdKeyDevice1, /*66*/ 'F', /*67*/ 'G', /*68*/ 'H', @@ -147,13 +147,13 @@ /*6e*/ 'N', /*6f*/ 'O', /*70*/ 'P', - /*71*/ 'Q', + /*71*/ EStdKeyDevice0, /*72*/ 'R', - /*73*/ 'S', + /*73*/ EStdKeyApplication0, /*74*/ 'T', /*75*/ 'U', /*76*/ 'V', - /*77*/ 'W', + /*77*/ EStdKeyDevice3, /*78*/ 'X', /*79*/ 'Y', /*7a*/ 'Z', @@ -231,12 +231,18 @@ __KTRACE_OPT(KBOOT,Kern::Printf("+TSerialKeyboardl::Create:PRM client ID=%x", iPrmClientId )) ; Kern::Printf("+TSerialKeyboardl::Create:PRM client ID=%x", iPrmClientId ); + Prcm::SetClockState(iUart.PrcmInterfaceClk(), Prcm::EClkOn); + Prcm::SetClockState(iUart.PrcmFunctionClk(), Prcm::EClkOn); + r = Interrupt::Bind( iUart.InterruptId(), UartIsr, this ); if ( r < 0 ) { + Kern::Printf("TSerialKeyboard Bind r=%d", r); return r; } + Kern::Printf("+TSerialKeyboard::Create bound to interrupt" ); + // Ask power resource manager to turn on clocks to the UART // (this could take some time but we're not in any hurry) /*r = PowerResourceManager::ChangeResourceState( iPrmClientId, iUart.PrmFunctionClk(), Prcm::EClkOn ); @@ -304,6 +310,7 @@ } else { + Kern::Printf("Key received: %d %d", self->iKey, KScanCode[self->iKey]); self->AddKey( KScanCode[ self->iKey ] ); } break; @@ -355,6 +362,8 @@ TRawEvent e; + Kern::Printf("AddKey %d %d %d %d", shifted, ctrl, func, stdKey); + if ( func ) { e.Set( TRawEvent::EKeyDown, EStdKeyRightFunc, 0 );