| author | Lukasz Forynski <lukasz.forynski@gmail.com> | 
| Mon, 23 Aug 2010 02:29:41 +0100 | |
| changeset 52 | 254b9435d75e | 
| parent 41 | e73f15023e91 | 
| permissions | -rwxr-xr-x | 
| 0 | 1 | // Copyright (c) 2007-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/shared/serialkeyb/serialkeyboard.mmp | |
| 15 | // Simple serial keyboard implementation for Beagle baseport | |
| 16 | // | |
| 17 | ||
| 18 | #include <platform.h> | |
| 19 | #include <e32keys.h> | |
| 20 | #include <assp/omap3530_assp/omap3530_assp_priv.h> | |
| 21 | #include <assp/omap3530_assp/omap3530_uart.h> | |
| 22 | //#include <drivers/resourceman.h> | |
| 23 | ||
| 24 | const TInt KMagicCrashValue = 15; | |
| 25 | ||
| 26 | ||
| 27 | #define SHIFTED(x) (0x8000|(x)) | |
| 28 | #define ISSHIFTED(x) (0x8000&(x)) | |
| 29 | #define CTRLED(x) (0x2000|(x)) | |
| 30 | #define ISCTRL(x) (0x2000&(x)) | |
| 31 | #define FUNCED(x) (0x4000|(x)) | |
| 32 | #define ISFUNC(x) (0x4000&(x)) | |
| 33 | #define STDKEY(x) (0x1FFF&(x)) | |
| 34 | ||
| 41 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 35 | #if _UI_SOFTKEYS_ENABLED_ | 
| 0 | 36 | static const TUint16 KScanCode[] = | 
| 37 | 	{
 | |
| 38 | /*00*/ EStdKeyNull, | |
| 39 | /*01*/ EStdKeyHome, // ^A | |
| 40 | /*02*/ EStdKeyLeftArrow, // ^B | |
| 41 | /*03*/ EStdKeyEscape, // ^C | |
| 42 | /*04*/ SHIFTED(EStdKeyDownArrow), // ^D - move window down | |
| 43 | /*05*/ EStdKeyEnd, // ^E | |
| 44 | /*06*/ EStdKeyRightArrow, // ^F | |
| 45 | /*07*/ EStdKeyNull, | |
| 46 | /*08*/ EStdKeyBackspace, // ^H - Reserved! | |
| 47 | /*09*/ EStdKeyTab, // ^I - Reserved! | |
| 48 | /*0a*/ EStdKeyNull, | |
| 49 | /*0b*/ EStdKeyIncContrast, // ^K | |
| 50 | /*0c*/ EStdKeyDecContrast, // ^L | |
| 51 | /*0d*/ EStdKeyEnter, // ^M - Reserved! | |
| 52 | /*0e*/ EStdKeyDownArrow, // ^N | |
| 53 | /*0f*/ EStdKeyNull, // ^O = instant death | |
| 54 | /*10*/ EStdKeyUpArrow, // ^P | |
| 55 | /*11*/ CTRLED(EStdKeyLeftArrow), // ^Q - make window narrower | |
| 56 | 	/*12*/	CTRLED(FUNCED('5')),		// ^R - rotate windows in text window server
 | |
| 57 | /*13*/ EStdKeyNull, | |
| 58 | /*14*/ CTRLED(EStdKeyDownArrow), // ^T - make window taller | |
| 59 | /*15*/ SHIFTED(EStdKeyUpArrow), // ^U - move window up | |
| 60 | /*16*/ EStdKeyNull, | |
| 61 | /*17*/ CTRLED(EStdKeyRightArrow), // ^W - make window wider | |
| 62 | /*18*/ SHIFTED(EStdKeyRightArrow), // ^X - move window right | |
| 63 | /*19*/ CTRLED(EStdKeyUpArrow), // ^Y - make window shorter | |
| 64 | /*1a*/ SHIFTED(EStdKeyLeftArrow), // ^Z - move window left | |
| 65 | /*1b*/ EStdKeyEscape, // ^[ - Reserved! | |
| 66 | /*1c*/ EStdKeyNull, | |
| 67 | /*1d*/ EStdKeyNull, | |
| 68 | /*1e*/ EStdKeyNull, | |
| 69 | /*1f*/ EStdKeyNull, | |
| 70 | /*20*/ EStdKeySpace, | |
| 71 | 	/*21*/	SHIFTED('1'),		// !
 | |
| 72 | 	/*22*/	SHIFTED('2'),		// "
 | |
| 73 | /*23*/ EStdKeyHash, // # | |
| 74 | 	/*24*/	SHIFTED('4'),		// $
 | |
| 75 | 	/*25*/	SHIFTED('5'),		// %
 | |
| 76 | 	/*26*/	SHIFTED('7'),		// &
 | |
| 77 | /*27*/ EStdKeySingleQuote, | |
| 78 | 	/*28*/	SHIFTED('9'),		// (
 | |
| 79 | 	/*29*/	SHIFTED('0'),		// )
 | |
| 80 | 	/*2a*/	SHIFTED('8'),		// *
 | |
| 81 | /*2b*/ SHIFTED(EStdKeyEquals), // + | |
| 82 | /*2c*/ EStdKeyComma, | |
| 83 | /*2d*/ EStdKeyMinus, | |
| 84 | /*2e*/ EStdKeyFullStop, | |
| 85 | /*2f*/ EStdKeyForwardSlash, | |
| 86 | /*30*/ '0', | |
| 87 | /*31*/ '1', | |
| 88 | /*32*/ '2', | |
| 89 | /*33*/ '3', | |
| 90 | /*34*/ '4', | |
| 91 | /*35*/ '5', | |
| 92 | /*36*/ '6', | |
| 93 | /*37*/ '7', | |
| 94 | /*38*/ '8', | |
| 95 | /*39*/ '9', | |
| 96 | /*3a*/ SHIFTED(EStdKeySemiColon), // : | |
| 97 | /*3b*/ EStdKeySemiColon, | |
| 98 | /*3c*/ SHIFTED(EStdKeyComma), // < | |
| 99 | /*3d*/ EStdKeyEquals, | |
| 100 | /*3e*/ SHIFTED(EStdKeyFullStop), // > | |
| 101 | /*3f*/ SHIFTED(EStdKeyForwardSlash), // ? | |
| 102 | /*40*/ SHIFTED(EStdKeySingleQuote), // @ | |
| 25 
524118fd998f
Fixes for the Keyboard mapping , serial Mouse and the LCD drivers
 arunabha parents: 
0diff
changeset | 103 | /*41*/ EStdKeyUpArrow, | 
| 
524118fd998f
Fixes for the Keyboard mapping , serial Mouse and the LCD drivers
 arunabha parents: 
0diff
changeset | 104 | /*42*/ EStdKeyDownArrow, | 
| 
524118fd998f
Fixes for the Keyboard mapping , serial Mouse and the LCD drivers
 arunabha parents: 
0diff
changeset | 105 | /*43*/ EStdKeyRightArrow, | 
| 
524118fd998f
Fixes for the Keyboard mapping , serial Mouse and the LCD drivers
 arunabha parents: 
0diff
changeset | 106 | /*44*/ EStdKeyLeftArrow, | 
| 0 | 107 | 	/*45*/	SHIFTED('E'),
 | 
| 108 | 	/*46*/	SHIFTED('F'),
 | |
| 109 | 	/*47*/	SHIFTED('G'),
 | |
| 110 | 	/*48*/	SHIFTED('H'),
 | |
| 111 | 	/*49*/	SHIFTED('I'),
 | |
| 112 | 	/*4a*/	SHIFTED('J'),
 | |
| 113 | 	/*4b*/	SHIFTED('K'),
 | |
| 114 | 	/*4c*/	SHIFTED('L'),
 | |
| 115 | 	/*4d*/	SHIFTED('M'),
 | |
| 116 | 	/*4e*/	SHIFTED('N'),
 | |
| 117 | 	/*4f*/	SHIFTED('O'),
 | |
| 118 | 	/*50*/	SHIFTED('P'),
 | |
| 119 | 	/*51*/	SHIFTED('Q'),
 | |
| 120 | 	/*52*/	SHIFTED('R'),
 | |
| 121 | 	/*53*/	SHIFTED('S'),
 | |
| 122 | 	/*54*/	SHIFTED('T'),
 | |
| 123 | 	/*55*/	SHIFTED('U'),
 | |
| 124 | 	/*56*/	SHIFTED('V'),
 | |
| 125 | 	/*57*/	SHIFTED('W'),
 | |
| 126 | 	/*58*/	SHIFTED('X'),
 | |
| 127 | 	/*59*/	SHIFTED('Y'),
 | |
| 128 | 	/*5a*/	SHIFTED('Z'),
 | |
| 129 | /*5b*/ EStdKeySquareBracketLeft, | |
| 130 | /*5c*/ EStdKeyBackSlash, | |
| 131 | /*5d*/ EStdKeySquareBracketRight, | |
| 132 | 	/*5e*/	SHIFTED('6'),			// ^
 | |
| 133 | /*5f*/ SHIFTED(EStdKeyMinus), // _ | |
| 134 | /*60*/ EStdKeyBacklightToggle, // Actually ` | |
| 25 
524118fd998f
Fixes for the Keyboard mapping , serial Mouse and the LCD drivers
 arunabha parents: 
0diff
changeset | 135 | /*61*/ EStdKeyYes, | 
| 0 | 136 | /*62*/ 'B', | 
| 137 | /*63*/ 'C', | |
| 25 
524118fd998f
Fixes for the Keyboard mapping , serial Mouse and the LCD drivers
 arunabha parents: 
0diff
changeset | 138 | /*64*/ EStdKeyNo, | 
| 
524118fd998f
Fixes for the Keyboard mapping , serial Mouse and the LCD drivers
 arunabha parents: 
0diff
changeset | 139 | /*65*/ EStdKeyDevice1, | 
| 0 | 140 | /*66*/ 'F', | 
| 141 | /*67*/ 'G', | |
| 142 | /*68*/ 'H', | |
| 143 | /*69*/ 'I', | |
| 144 | /*6a*/ 'J', | |
| 145 | /*6b*/ 'K', | |
| 146 | /*6c*/ 'L', | |
| 147 | /*6d*/ 'M', | |
| 148 | /*6e*/ 'N', | |
| 149 | /*6f*/ 'O', | |
| 150 | /*70*/ 'P', | |
| 25 
524118fd998f
Fixes for the Keyboard mapping , serial Mouse and the LCD drivers
 arunabha parents: 
0diff
changeset | 151 | /*71*/ EStdKeyDevice0, | 
| 0 | 152 | /*72*/ 'R', | 
| 25 
524118fd998f
Fixes for the Keyboard mapping , serial Mouse and the LCD drivers
 arunabha parents: 
0diff
changeset | 153 | /*73*/ EStdKeyApplication0, | 
| 0 | 154 | /*74*/ 'T', | 
| 155 | /*75*/ 'U', | |
| 156 | /*76*/ 'V', | |
| 25 
524118fd998f
Fixes for the Keyboard mapping , serial Mouse and the LCD drivers
 arunabha parents: 
0diff
changeset | 157 | /*77*/ EStdKeyDevice3, | 
| 0 | 158 | /*78*/ 'X', | 
| 159 | /*79*/ 'Y', | |
| 160 | /*7a*/ 'Z', | |
| 161 | /*7b*/ SHIFTED(EStdKeySquareBracketLeft), | |
| 162 | /*7c*/ SHIFTED(EStdKeyBackSlash), | |
| 163 | /*7d*/ SHIFTED(EStdKeySquareBracketRight), | |
| 164 | /*7e*/ SHIFTED(EStdKeyHash), | |
| 165 | /*7f*/ EKeyDelete | |
| 166 | }; | |
| 167 | ||
| 41 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 168 | #else | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 169 | static const TUint16 KScanCode[] = | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 170 | 	{
 | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 171 | /*00*/ EStdKeyNull, | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 172 | /*01*/ EStdKeyHome, // ^A | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 173 | /*02*/ EStdKeyLeftArrow, // ^B | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 174 | /*03*/ EStdKeyEscape, // ^C | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 175 | /*04*/ SHIFTED(EStdKeyDownArrow), // ^D - move window down | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 176 | /*05*/ EStdKeyEnd, // ^E | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 177 | /*06*/ EStdKeyRightArrow, // ^F | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 178 | /*07*/ EStdKeyNull, | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 179 | /*08*/ EStdKeyBackspace, // ^H - Reserved! | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 180 | /*09*/ EStdKeyTab, // ^I - Reserved! | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 181 | /*0a*/ EStdKeyNull, | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 182 | /*0b*/ EStdKeyIncContrast, // ^K | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 183 | /*0c*/ EStdKeyDecContrast, // ^L | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 184 | /*0d*/ EStdKeyEnter, // ^M - Reserved! | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 185 | /*0e*/ EStdKeyDownArrow, // ^N | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 186 | /*0f*/ EStdKeyNull, // ^O = instant death | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 187 | /*10*/ EStdKeyUpArrow, // ^P | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 188 | /*11*/ CTRLED(EStdKeyLeftArrow), // ^Q - make window narrower | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 189 | 	/*12*/	CTRLED(FUNCED('5')),		// ^R - rotate windows in text window server
 | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 190 | /*13*/ EStdKeyNull, | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 191 | /*14*/ CTRLED(EStdKeyDownArrow), // ^T - make window taller | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 192 | /*15*/ SHIFTED(EStdKeyUpArrow), // ^U - move window up | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 193 | /*16*/ EStdKeyNull, | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 194 | /*17*/ CTRLED(EStdKeyRightArrow), // ^W - make window wider | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 195 | /*18*/ SHIFTED(EStdKeyRightArrow), // ^X - move window right | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 196 | /*19*/ CTRLED(EStdKeyUpArrow), // ^Y - make window shorter | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 197 | /*1a*/ SHIFTED(EStdKeyLeftArrow), // ^Z - move window left | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 198 | /*1b*/ EStdKeyEscape, // ^[ - Reserved! | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 199 | /*1c*/ EStdKeyNull, | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 200 | /*1d*/ EStdKeyNull, | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 201 | /*1e*/ EStdKeyNull, | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 202 | /*1f*/ EStdKeyNull, | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 203 | /*20*/ EStdKeySpace, | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 204 | 	/*21*/	SHIFTED('1'),		// !
 | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 205 | 	/*22*/	SHIFTED('2'),		// "
 | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 206 | /*23*/ EStdKeyHash, // # | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 207 | 	/*24*/	SHIFTED('4'),		// $
 | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 208 | 	/*25*/	SHIFTED('5'),		// %
 | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 209 | 	/*26*/	SHIFTED('7'),		// &
 | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 210 | /*27*/ EStdKeySingleQuote, | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 211 | 	/*28*/	SHIFTED('9'),		// (
 | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 212 | 	/*29*/	SHIFTED('0'),		// )
 | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 213 | 	/*2a*/	SHIFTED('8'),		// *
 | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 214 | /*2b*/ SHIFTED(EStdKeyEquals), // + | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 215 | /*2c*/ EStdKeyComma, | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 216 | /*2d*/ EStdKeyMinus, | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 217 | /*2e*/ EStdKeyFullStop, | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 218 | /*2f*/ EStdKeyForwardSlash, | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 219 | /*30*/ '0', | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 220 | /*31*/ '1', | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 221 | /*32*/ '2', | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 222 | /*33*/ '3', | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 223 | /*34*/ '4', | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 224 | /*35*/ '5', | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 225 | /*36*/ '6', | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 226 | /*37*/ '7', | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 227 | /*38*/ '8', | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 228 | /*39*/ '9', | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 229 | /*3a*/ SHIFTED(EStdKeySemiColon), // : | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 230 | /*3b*/ EStdKeySemiColon, | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 231 | /*3c*/ SHIFTED(EStdKeyComma), // < | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 232 | /*3d*/ EStdKeyEquals, | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 233 | /*3e*/ SHIFTED(EStdKeyFullStop), // > | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 234 | /*3f*/ SHIFTED(EStdKeyForwardSlash), // ? | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 235 | /*40*/ SHIFTED(EStdKeySingleQuote), // @ | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 236 | 	/*41*/	SHIFTED('A'),
 | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 237 | 	/*42*/	SHIFTED('B'),
 | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 238 | 	/*43*/	SHIFTED('C'),
 | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 239 | 	/*44*/	SHIFTED('D'),
 | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 240 | 	/*45*/	SHIFTED('E'),
 | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 241 | 	/*46*/	SHIFTED('F'),
 | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 242 | 	/*47*/	SHIFTED('G'),
 | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 243 | 	/*48*/	SHIFTED('H'),
 | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 244 | 	/*49*/	SHIFTED('I'),
 | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 245 | 	/*4a*/	SHIFTED('J'),
 | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 246 | 	/*4b*/	SHIFTED('K'),
 | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 247 | 	/*4c*/	SHIFTED('L'),
 | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 248 | 	/*4d*/	SHIFTED('M'),
 | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 249 | 	/*4e*/	SHIFTED('N'),
 | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 250 | 	/*4f*/	SHIFTED('O'),
 | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 251 | 	/*50*/	SHIFTED('P'),
 | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 252 | 	/*51*/	SHIFTED('Q'),
 | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 253 | 	/*52*/	SHIFTED('R'),
 | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 254 | 	/*53*/	SHIFTED('S'),
 | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 255 | 	/*54*/	SHIFTED('T'),
 | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 256 | 	/*55*/	SHIFTED('U'),
 | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 257 | 	/*56*/	SHIFTED('V'),
 | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 258 | 	/*57*/	SHIFTED('W'),
 | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 259 | 	/*58*/	SHIFTED('X'),
 | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 260 | 	/*59*/	SHIFTED('Y'),
 | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 261 | 	/*5a*/	SHIFTED('Z'),
 | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 262 | /*5b*/ EStdKeySquareBracketLeft, | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 263 | /*5c*/ EStdKeyBackSlash, | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 264 | /*5d*/ EStdKeySquareBracketRight, | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 265 | 	/*5e*/	SHIFTED('6'),			// ^
 | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 266 | /*5f*/ SHIFTED(EStdKeyMinus), // _ | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 267 | /*60*/ EStdKeyBacklightToggle, // Actually ` | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 268 | /*61*/ 'A', | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 269 | /*62*/ 'B', | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 270 | /*63*/ 'C', | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 271 | /*64*/ 'D', | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 272 | /*65*/ 'E', | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 273 | /*66*/ 'F', | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 274 | /*67*/ 'G', | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 275 | /*68*/ 'H', | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 276 | /*69*/ 'I', | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 277 | /*6a*/ 'J', | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 278 | /*6b*/ 'K', | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 279 | /*6c*/ 'L', | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 280 | /*6d*/ 'M', | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 281 | /*6e*/ 'N', | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 282 | /*6f*/ 'O', | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 283 | /*70*/ 'P', | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 284 | /*71*/ 'Q', | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 285 | /*72*/ 'R', | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 286 | /*73*/ 'S', | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 287 | /*74*/ 'T', | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 288 | /*75*/ 'U', | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 289 | /*76*/ 'V', | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 290 | /*77*/ 'W', | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 291 | /*78*/ 'X', | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 292 | /*79*/ 'Y', | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 293 | /*7a*/ 'Z', | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 294 | /*7b*/ SHIFTED(EStdKeySquareBracketLeft), | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 295 | /*7c*/ SHIFTED(EStdKeyBackSlash), | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 296 | /*7d*/ SHIFTED(EStdKeySquareBracketRight), | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 297 | /*7e*/ SHIFTED(EStdKeyHash), | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 298 | /*7f*/ EKeyDelete | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 299 | }; | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 300 | |
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 301 | #endif | 
| 
e73f15023e91
Changes in the Serial Keyboard to disable sofy key mappings for texshell roms.
 arunabha parents: 
25diff
changeset | 302 | |
| 0 | 303 | static const TUint16 KEscapedScanCode[] = | 
| 304 | 	{
 | |
| 305 | EStdKeyUpArrow, | |
| 306 | EStdKeyDownArrow, | |
| 307 | EStdKeyRightArrow, | |
| 308 | EStdKeyLeftArrow | |
| 309 | }; | |
| 310 | ||
| 311 | const TUint8 KEscapeChar = 0x1b; | |
| 312 | const TUint8 KEscapeBase = 0x41; | |
| 313 | const TUint8 KEscapeCount = sizeof(KEscapedScanCode) / sizeof(KEscapedScanCode[0]); | |
| 314 | const TUint16 KEscapeScanCode = EStdKeyEscape; | |
| 315 | ||
| 316 | NONSHARABLE_CLASS(TSerialKeyboard) : public DBase | |
| 317 | 	{
 | |
| 318 | public: | |
| 319 | inline TSerialKeyboard(); | |
| 320 | TInt Create(); | |
| 321 | ||
| 322 | private: | |
| 323 | static void UartIsr( TAny* aParam ); | |
| 324 | static void AddKeyDfc( TAny* aParam ); | |
| 325 | void AddKey( TUint aKey ); | |
| 326 | ||
| 327 | ||
| 328 | private: | |
| 329 | enum TState | |
| 330 | 		{
 | |
| 331 | ENormal, | |
| 332 | EEscaping1, | |
| 333 | EEscaping2 | |
| 334 | }; | |
| 335 | ||
| 336 | TDfc iAddKeyDfc; | |
| 337 | Omap3530Uart::TUart iUart; | |
| 338 | TUint iPrmClientId; | |
| 339 | TState iState : 8; | |
| 340 | TUint8 iKey; | |
| 341 | }; | |
| 342 | ||
| 343 | inline TSerialKeyboard::TSerialKeyboard() | |
| 344 | : iAddKeyDfc( AddKeyDfc, this, Kern::DfcQue0(), 1 ), | |
| 345 | iUart( Omap3530Assp::DebugPortNumber() ), | |
| 346 | iState( ENormal ) | |
| 347 | 	{
 | |
| 348 | // Convert the scan rate from milliseconds to nanokernel ticks (normally 1/64 of a second) | |
| 349 | } | |
| 350 | ||
| 351 | TInt TSerialKeyboard::Create() | |
| 352 | 	{
 | |
| 353 | TInt r = KErrNone; | |
| 354 | ||
| 355 | const Omap3530Uart::TUartNumber portNumber( Omap3530Assp::DebugPortNumber() ); | |
| 52 
254b9435d75e
Fixed build warnings
 Lukasz Forynski <lukasz.forynski@gmail.com> parents: 
41diff
changeset | 356 | |
| 0 | 357 | if( portNumber >= 0 ) | 
| 358 | 		{
 | |
| 52 
254b9435d75e
Fixed build warnings
 Lukasz Forynski <lukasz.forynski@gmail.com> parents: 
41diff
changeset | 359 | #ifdef USE_SYMBIAN_PRM | 
| 0 | 360 | // Register with the power resource manager | 
| 361 | _LIT( KName, "serkey" ); | |
| 52 
254b9435d75e
Fixed build warnings
 Lukasz Forynski <lukasz.forynski@gmail.com> parents: 
41diff
changeset | 362 | r = PowerResourceManager::RegisterClient( iPrmClientId, KName ); | 
| 
254b9435d75e
Fixed build warnings
 Lukasz Forynski <lukasz.forynski@gmail.com> parents: 
41diff
changeset | 363 | 		__KTRACE_OPT(KBOOT,Kern::Printf("+TSerialKeyboardl::Create:PRM client ID=%x, err=%d", iPrmClientId, r));
 | 
| 0 | 364 | if( r != KErrNone ) | 
| 365 | 			{
 | |
| 366 | return r; | |
| 52 
254b9435d75e
Fixed build warnings
 Lukasz Forynski <lukasz.forynski@gmail.com> parents: 
41diff
changeset | 367 | } | 
| 
254b9435d75e
Fixed build warnings
 Lukasz Forynski <lukasz.forynski@gmail.com> parents: 
41diff
changeset | 368 | #endif | 
| 0 | 369 | |
| 25 
524118fd998f
Fixes for the Keyboard mapping , serial Mouse and the LCD drivers
 arunabha parents: 
0diff
changeset | 370 | Prcm::SetClockState(iUart.PrcmInterfaceClk(), Prcm::EClkOn); | 
| 
524118fd998f
Fixes for the Keyboard mapping , serial Mouse and the LCD drivers
 arunabha parents: 
0diff
changeset | 371 | Prcm::SetClockState(iUart.PrcmFunctionClk(), Prcm::EClkOn); | 
| 52 
254b9435d75e
Fixed build warnings
 Lukasz Forynski <lukasz.forynski@gmail.com> parents: 
41diff
changeset | 372 | |
| 0 | 373 | r = Interrupt::Bind( iUart.InterruptId(), UartIsr, this ); | 
| 374 | if ( r < 0 ) | |
| 375 |  			{
 | |
| 25 
524118fd998f
Fixes for the Keyboard mapping , serial Mouse and the LCD drivers
 arunabha parents: 
0diff
changeset | 376 |  			Kern::Printf("TSerialKeyboard Bind r=%d", r);
 | 
| 0 | 377 | return r; | 
| 378 | } | |
| 379 | ||
| 25 
524118fd998f
Fixes for the Keyboard mapping , serial Mouse and the LCD drivers
 arunabha parents: 
0diff
changeset | 380 | 		Kern::Printf("+TSerialKeyboard::Create bound to interrupt" );
 | 
| 52 
254b9435d75e
Fixed build warnings
 Lukasz Forynski <lukasz.forynski@gmail.com> parents: 
41diff
changeset | 381 | |
| 
254b9435d75e
Fixed build warnings
 Lukasz Forynski <lukasz.forynski@gmail.com> parents: 
41diff
changeset | 382 | #ifdef USE_SYMBIAN_PRM | 
| 0 | 383 | // Ask power resource manager to turn on clocks to the UART | 
| 384 | // (this could take some time but we're not in any hurry) | |
| 52 
254b9435d75e
Fixed build warnings
 Lukasz Forynski <lukasz.forynski@gmail.com> parents: 
41diff
changeset | 385 | r = PowerResourceManager::ChangeResourceState( iPrmClientId, iUart.PrmFunctionClk(), Prcm::EClkOn ); | 
| 
254b9435d75e
Fixed build warnings
 Lukasz Forynski <lukasz.forynski@gmail.com> parents: 
41diff
changeset | 386 | if( r == KErrNone ) | 
| 0 | 387 | 			{
 | 
| 52 
254b9435d75e
Fixed build warnings
 Lukasz Forynski <lukasz.forynski@gmail.com> parents: 
41diff
changeset | 388 | r = PowerResourceManager::ChangeResourceState( iPrmClientId, iUart.PrmInterfaceClk(), Prcm::EClkOn ); | 
| 
254b9435d75e
Fixed build warnings
 Lukasz Forynski <lukasz.forynski@gmail.com> parents: 
41diff
changeset | 389 | } | 
| 
254b9435d75e
Fixed build warnings
 Lukasz Forynski <lukasz.forynski@gmail.com> parents: 
41diff
changeset | 390 | |
| 
254b9435d75e
Fixed build warnings
 Lukasz Forynski <lukasz.forynski@gmail.com> parents: 
41diff
changeset | 391 | if( r != KErrNone ) | 
| 
254b9435d75e
Fixed build warnings
 Lukasz Forynski <lukasz.forynski@gmail.com> parents: 
41diff
changeset | 392 | 			{
 | 
| 
254b9435d75e
Fixed build warnings
 Lukasz Forynski <lukasz.forynski@gmail.com> parents: 
41diff
changeset | 393 | 			__KTRACE_OPT(KBOOT, Kern::Printf("+TSerialKeyboardl:PRM ChangeResourceState(clock(s)) failed, client ID=%x, err=%d", iPrmClientId, r));
 | 
| 0 | 394 | return r; | 
| 52 
254b9435d75e
Fixed build warnings
 Lukasz Forynski <lukasz.forynski@gmail.com> parents: 
41diff
changeset | 395 | } | 
| 
254b9435d75e
Fixed build warnings
 Lukasz Forynski <lukasz.forynski@gmail.com> parents: 
41diff
changeset | 396 | #endif | 
| 0 | 397 | // We can assume that the debug output code has already initialized the UART, we just need to prepare it for RX | 
| 398 | iUart.EnableFifo( Omap3530Uart::TUart::EEnabled, Omap3530Uart::TUart::ETriggerUnchanged, Omap3530Uart::TUart::ETrigger8 ); | |
| 399 | iUart.EnableInterrupt( Omap3530Uart::TUart::EIntRhr ); | |
| 400 | ||
| 401 | Interrupt::Enable( iUart.InterruptId() ); | |
| 402 | } | |
| 403 | ||
| 404 | return r; | |
| 405 | } | |
| 406 | ||
| 407 | void TSerialKeyboard::UartIsr( TAny* aParam ) | |
| 408 | 	{
 | |
| 409 | TSerialKeyboard* self = reinterpret_cast<TSerialKeyboard*>( aParam ); | |
| 410 | ||
| 411 | const TUint iir = Omap3530Uart::IIR::iMem.Read( self->iUart ); | |
| 412 | ||
| 413 | if ( 0 == (iir bitand Omap3530Uart::IIR::IT_PENDING::KMask) ) | |
| 414 | 		{
 | |
| 415 | const TUint pending = iir bitand Omap3530Uart::IIR::IT_TYPE::KFieldMask; | |
| 416 | ||
| 417 | // Although the TI datasheet descrivwed IT_TYPE as being an enumerated priority-decoded interrupt | |
| 418 | // it appears to actually be a bitmask of active interrupt sources | |
| 419 | if ( (pending bitand Omap3530Uart::IIR::IT_TYPE::ERHR) || (pending bitand Omap3530Uart::IIR::IT_TYPE::ERxLineStatus) ) | |
| 420 | 			{
 | |
| 421 | TUint byte = self->iUart.Read(); | |
| 422 | ||
| 423 | if( KMagicCrashValue == byte ) | |
| 424 | 				{
 | |
| 425 | Kern::Fault( "SERKEY-FORCED", 0 ); | |
| 426 | } | |
| 427 | else | |
| 428 | 				{
 | |
| 429 | self->iKey = byte; | |
| 430 | self->iAddKeyDfc.Add(); | |
| 431 | Interrupt::Disable( self->iUart.InterruptId() ); | |
| 432 | } | |
| 433 | } | |
| 434 | } | |
| 435 | } | |
| 436 | ||
| 437 | void TSerialKeyboard::AddKeyDfc( TAny* aParam ) | |
| 438 | 	{
 | |
| 439 | TSerialKeyboard* self = reinterpret_cast<TSerialKeyboard*>( aParam ); | |
| 440 | ||
| 441 | switch ( self->iState ) | |
| 442 | 		{
 | |
| 443 | case ENormal: | |
| 444 | if ( self->iKey == KEscapeChar ) | |
| 445 | 			{
 | |
| 446 | self->iState = EEscaping1; | |
| 447 | } | |
| 448 | else | |
| 449 | 			{
 | |
| 450 | self->AddKey( KScanCode[ self->iKey ] ); | |
| 451 | } | |
| 452 | break; | |
| 453 | ||
| 454 | case EEscaping1: | |
| 455 | if ( self->iKey == KEscapeChar ) | |
| 456 | 			{
 | |
| 457 | self->iState = EEscaping2; | |
| 458 | } | |
| 459 | else | |
| 460 | 			{
 | |
| 461 | self->AddKey( KEscapeScanCode ); | |
| 462 | self->AddKey( KScanCode[ self->iKey ] ); | |
| 463 | self->iState = ENormal; | |
| 464 | } | |
| 465 | break; | |
| 466 | ||
| 467 | case EEscaping2: | |
| 468 | 		{
 | |
| 469 | TInt index = self->iKey - KEscapeBase; | |
| 470 | ||
| 471 | if ( (index >= 0) && (index < KEscapeCount) ) | |
| 472 | 			{
 | |
| 473 | self->AddKey( KEscapedScanCode[ index ] ); | |
| 474 | } | |
| 475 | else | |
| 476 | 			{
 | |
| 477 | self->AddKey( KEscapeScanCode ); | |
| 478 | self->AddKey( KScanCode[ self->iKey ] ); | |
| 479 | } | |
| 480 | self->iState = ENormal; | |
| 481 | } | |
| 482 | break; | |
| 483 | ||
| 484 | default: | |
| 485 | self->iState = ENormal; | |
| 486 | break; | |
| 487 | }; | |
| 488 | ||
| 489 | Interrupt::Enable( self->iUart.InterruptId() ); | |
| 490 | } | |
| 491 | ||
| 492 | void TSerialKeyboard::AddKey( TUint aKey ) | |
| 493 | 	{
 | |
| 494 | const TBool shifted = ISSHIFTED(aKey); | |
| 495 | const TBool ctrl = ISCTRL(aKey); | |
| 496 | const TBool func = ISFUNC(aKey); | |
| 497 | const TUint8 stdKey = STDKEY(aKey); | |
| 498 | ||
| 499 | TRawEvent e; | |
| 500 | ||
| 25 
524118fd998f
Fixes for the Keyboard mapping , serial Mouse and the LCD drivers
 arunabha parents: 
0diff
changeset | 501 | |
| 0 | 502 | if ( func ) | 
| 503 | 		{
 | |
| 504 | e.Set( TRawEvent::EKeyDown, EStdKeyRightFunc, 0 ); | |
| 505 | Kern::AddEvent( e ); | |
| 506 | } | |
| 507 | ||
| 508 | if ( ctrl ) | |
| 509 | 		{
 | |
| 510 | e.Set( TRawEvent::EKeyDown, EStdKeyRightCtrl, 0 ); | |
| 511 | Kern::AddEvent( e ); | |
| 512 | } | |
| 513 | ||
| 514 | if ( shifted ) | |
| 515 | 		{
 | |
| 516 | e.Set( TRawEvent::EKeyDown, EStdKeyRightShift, 0 ); | |
| 517 | Kern::AddEvent( e ); | |
| 518 | } | |
| 519 | ||
| 520 | e.Set( TRawEvent::EKeyDown, stdKey, 0 ); | |
| 521 | Kern::AddEvent( e ); | |
| 522 | e.Set( TRawEvent::EKeyUp, stdKey, 0 ); | |
| 523 | Kern::AddEvent( e ); | |
| 524 | ||
| 525 | if ( shifted ) | |
| 526 | 		{
 | |
| 527 | e.Set( TRawEvent::EKeyUp, EStdKeyRightShift, 0 ); | |
| 528 | Kern::AddEvent( e ); | |
| 529 | } | |
| 530 | ||
| 531 | if ( ctrl ) | |
| 532 | 		{
 | |
| 533 | e.Set( TRawEvent::EKeyUp, EStdKeyRightCtrl, 0 ); | |
| 534 | Kern::AddEvent( e ); | |
| 535 | } | |
| 536 | ||
| 537 | if ( func ) | |
| 538 | 		{
 | |
| 539 | e.Set( TRawEvent::EKeyUp, EStdKeyRightFunc, 0 ); | |
| 540 | Kern::AddEvent( e ); | |
| 541 | } | |
| 542 | } | |
| 543 | ||
| 544 | ||
| 545 | DECLARE_STANDARD_EXTENSION() | |
| 546 | 	{
 | |
| 547 | 	__KTRACE_OPT(KEXTENSION,Kern::Printf("Starting serial keyboard driver"));
 | |
| 548 | ||
| 549 | TInt r = KErrNoMemory; | |
| 550 | TSerialKeyboard* keyboard = new TSerialKeyboard; | |
| 551 | if ( keyboard ) | |
| 552 | 		{
 | |
| 553 | r = keyboard->Create(); | |
| 554 | } | |
| 555 | ||
| 556 | 	__KTRACE_OPT(KEXTENSION,Kern::Printf("Returns %d",r));
 | |
| 557 | return r; | |
| 558 | } |