author | William Roberts <williamr@symbian.org> |
Thu, 08 Oct 2009 20:49:04 +0100 | |
changeset 10 | 1cf69c2c2bbd |
parent 2 | d55eb581a87c |
child 15 | 5fca9e46c6fa |
permissions | -rw-r--r-- |
0
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
1 |
/* |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
2 |
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
3 |
* All rights reserved. |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
4 |
* This component and the accompanying materials are made available |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
5 |
* under the terms of the License "Eclipse Public License v1.0" |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
6 |
* which accompanies this distribution, and is available |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
8 |
* |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
9 |
* Initial Contributors: |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
10 |
* Nokia Corporation - initial contribution. |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
11 |
* |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
12 |
* Contributors: |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
13 |
* |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
14 |
* Description: Minimalistic pointer driver |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
15 |
* |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
16 |
*/ |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
17 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
18 |
//#define DEBUG |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
19 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
20 |
#include <syborg_priv.h> |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
21 |
#include "syborg_pointer.h" |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
22 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
23 |
TPointerRv::TPointerRv(): |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
24 |
iRxDfc(RxDfc,this,Kern::DfcQue0(),1) |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
25 |
{ |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
26 |
__DEBUG_PRINT("TPointerRv::TPointerRv()"); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
27 |
TInt r = Interrupt::Bind(EIntPointer,Isr,this); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
28 |
if(r != KErrNone) |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
29 |
__KTRACE_OPT(KPANIC, Kern::Printf("TPointerRv::TPointerRv() Interrupt::Bind(%d)=%d", |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
30 |
EIntPointer, r)); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
31 |
iPointerOn = ETrue; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
32 |
iLastBut = 0; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
33 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
34 |
Interrupt::Enable(EIntPointer); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
35 |
} |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
36 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
37 |
TPointerRv::~TPointerRv() |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
38 |
{ |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
39 |
} |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
40 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
41 |
struct TPointerRv::PData* TPointerRv::FifoPop(void) |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
42 |
{ |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
43 |
struct TPointerRv::PData* val = &iPDataFifo[iFifoPos]; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
44 |
iFifoPos++; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
45 |
iFifoCount--; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
46 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
47 |
if (iFifoPos == FIFO_SIZE) |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
48 |
iFifoPos = 0; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
49 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
50 |
return val; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
51 |
} |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
52 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
53 |
void TPointerRv::FifoPush(struct TPointerRv::PData* val) |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
54 |
{ |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
55 |
TInt slot; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
56 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
57 |
if (iFifoCount == FIFO_SIZE) |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
58 |
return; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
59 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
60 |
slot = iFifoPos + iFifoCount; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
61 |
if (slot >= FIFO_SIZE) |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
62 |
slot -= FIFO_SIZE; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
63 |
iPDataFifo[slot] = *val; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
64 |
iFifoCount++; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
65 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
66 |
// __DEBUG_PRINT("TPointerRv::FifoPush %d %d %d %d",val->x, val->y, val->z, val->but); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
67 |
// __DEBUG_PRINT("TPointerRv::FifoPush %d %d %d %d",iPDataFifo[slot].x, iPDataFifo[slot].y, iPDataFifo[slot].z, iPDataFifo[slot].but); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
68 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
69 |
} |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
70 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
71 |
void TPointerRv::Init3() |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
72 |
{ |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
73 |
__DEBUG_PRINT("TPointerRv::Init3"); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
74 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
75 |
TInt reg = ReadReg(KHwBaseKmiPointer,POINTER_ID); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
76 |
WriteReg(KHwBaseKmiPointer,POINTER_INT_ENABLE,1); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
77 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
78 |
TInt r = Kern::AddHalEntry(EHalGroupMouse,DoPointerHalFunction,this); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
79 |
if(r != KErrNone) |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
80 |
__KTRACE_OPT(KPANIC, Kern::Printf("TPointerRv::Init3(): Kern::AddHalEntry()=%d", r)); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
81 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
82 |
// Get information about the screen display mode |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
83 |
TPckgBuf<TVideoInfoV01> buf; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
84 |
TVideoInfoV01& videoInfo = buf(); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
85 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
86 |
r = Kern::HalFunction(EHalGroupDisplay, EDisplayHalCurrentModeInfo, (TAny*)&buf, NULL); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
87 |
if(r != KErrNone) |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
88 |
__KTRACE_OPT(KPANIC, Kern::Printf("TPointerRv::Init3(): Kern::HalFunction(EDisplayHalCurrentModeInfo)=%d", r)); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
89 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
90 |
iScreenWidth = videoInfo.iSizeInPixels.iWidth; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
91 |
iScreenHeight = videoInfo.iSizeInPixels.iHeight; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
92 |
iDisplayMode = videoInfo.iDisplayMode; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
93 |
ix = iy = 0; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
94 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
95 |
iXFactor = Fixed(iScreenWidth) / Fixed(0x8000); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
96 |
iYFactor = Fixed(iScreenHeight) / Fixed(0x8000); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
97 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
98 |
iFifoPos = iFifoCount = 0; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
99 |
} |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
100 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
101 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
102 |
void TPointerRv::Process(TPointerRv *i, struct TPointerRv::PData *pd) |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
103 |
{ |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
104 |
TRawEvent e; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
105 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
106 |
// __DEBUG_PRINT("Event: X=%d Y=%d Point %d", pd->x, pd->y, pd->but); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
107 |
// __DEBUG_PRINT(" Last X=%d Y=%d Point %d", i->ix, i->iy, i->iLastBut); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
108 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
109 |
// i->ix += pd->x; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
110 |
// i->iy += pd->y; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
111 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
112 |
i->ix = int(Fixed(pd->x) * i->iXFactor); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
113 |
i->iy = int(Fixed(pd->y) * i->iYFactor); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
114 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
115 |
switch(pd->but) |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
116 |
{ |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
117 |
case 0: // Button released |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
118 |
switch(i->iLastBut) |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
119 |
{ |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
120 |
case 0: |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
121 |
if( (pd->x!=0) || (pd->y!=0) ) { |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
122 |
e.Set(TRawEvent::EPointerMove, i->ix, i->iy); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
123 |
__DEBUG_PRINT("1 EPointerMove (x:%d y:%d)", i->ix, i->iy); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
124 |
} |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
125 |
goto fin; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
126 |
case 1: // Left |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
127 |
e.Set(TRawEvent::EButton1Up, i->ix, i->iy); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
128 |
__DEBUG_PRINT("2 EButton1UP (x:%d y:%d)", i->ix, i->iy); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
129 |
goto fin; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
130 |
case 2: // Right |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
131 |
e.Set(TRawEvent::EButton2Up, i->ix, i->iy); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
132 |
__DEBUG_PRINT("3 EButton2UP (x:%d y:%d)", i->ix, i->iy); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
133 |
goto fin; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
134 |
} |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
135 |
case 1: // Left |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
136 |
if (i->iLastBut == 0) { |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
137 |
e.Set(TRawEvent::EButton1Down, i->ix, i->iy); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
138 |
__DEBUG_PRINT("4 EButton1Down (x:%d y:%d)", i->ix, i->iy); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
139 |
} |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
140 |
else if( (pd->x!=0) || (pd->y!=0) ) { |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
141 |
e.Set(TRawEvent::EPointerMove, i->ix, i->iy); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
142 |
__DEBUG_PRINT("5 EPointerMove (x:%d y:%d)", i->ix, i->iy); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
143 |
} |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
144 |
break; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
145 |
case 2: // Right |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
146 |
if (i->iLastBut == 0) { |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
147 |
e.Set(TRawEvent::EButton2Down, i->ix, i->iy); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
148 |
__DEBUG_PRINT("6 EButton2Down (x:%d y:%d)", i->ix, i->iy); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
149 |
} |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
150 |
else if( (pd->x!=0) || (pd->y!=0) ) { |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
151 |
e.Set(TRawEvent::EPointerMove, i->ix, i->iy); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
152 |
__DEBUG_PRINT("7 EPointerMove (x:%d y:%d)", i->ix, i->iy); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
153 |
} |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
154 |
break; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
155 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
156 |
} |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
157 |
fin: |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
158 |
Kern::AddEvent(e); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
159 |
i->iLastBut = pd->but; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
160 |
} |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
161 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
162 |
void TPointerRv::RxDfc(TAny* aPtr) |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
163 |
{ |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
164 |
__DEBUG_PRINT("TPointerRv::RxDfc"); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
165 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
166 |
TPointerRv* i = static_cast<TPointerRv*>(aPtr); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
167 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
168 |
while(i->iFifoCount>0) { |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
169 |
struct TPointerRv::PData *pd= i->FifoPop(); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
170 |
Process(i,pd); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
171 |
} |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
172 |
} |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
173 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
174 |
void TPointerRv::Isr(TAny* aPtr) |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
175 |
{ |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
176 |
__DEBUG_PRINT("TPointerRv::Isr"); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
177 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
178 |
TPointerRv& k = *(TPointerRv*)aPtr; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
179 |
// interrupts are now auto clear |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
180 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
181 |
while(ReadReg(KHwBaseKmiPointer, POINTER_FIFO_COUNT)!=0) { |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
182 |
struct TPointerRv::PData pd; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
183 |
pd.x = ReadReg(KHwBaseKmiPointer,POINTER_X); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
184 |
pd.y = ReadReg(KHwBaseKmiPointer,POINTER_Y); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
185 |
pd.z = ReadReg(KHwBaseKmiPointer,POINTER_Z); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
186 |
pd.but = ReadReg(KHwBaseKmiPointer,POINTER_BUTTONS); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
187 |
k.FifoPush(&pd); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
188 |
WriteReg(KHwBaseKmiPointer,POINTER_LATCH,0); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
189 |
} |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
190 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
191 |
// WriteReg(KHwBaseKmiPointer,POINTER_CLEAR_INT,0); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
192 |
Interrupt::Clear(EIntPointer); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
193 |
k.iRxDfc.Add(); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
194 |
} |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
195 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
196 |
TInt TPointerRv::DoPointerHalFunction(TAny* aThis, TInt aFunction, TAny* a1, TAny* a2) |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
197 |
{ |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
198 |
return static_cast<TPointerRv*>(aThis)->PointerHalFunction(aFunction,a1,a2); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
199 |
} |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
200 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
201 |
TInt TPointerRv::PointerHalFunction(TInt aFunction, TAny* a1, TAny* /*a2*/) |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
202 |
{ |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
203 |
__DEBUG_PRINT("TPointerRv::PointerHalFunction"); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
204 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
205 |
TInt r=KErrNone; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
206 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
207 |
switch(aFunction) |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
208 |
{ |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
209 |
case EMouseHalMouseState: |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
210 |
{ |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
211 |
kumemput32(a1, (TBool*)&iPointerOn, sizeof(TBool)); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
212 |
break; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
213 |
} |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
214 |
case EMouseHalSetMouseState: |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
215 |
{ |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
216 |
__SECURE_KERNEL( |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
217 |
if(!Kern::CurrentThreadHasCapability(ECapabilityMultimediaDD, |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
218 |
__PLATSEC_DIAGNOSTIC_STRING("Checked by Hal function EMouseHalSetMouseState"))) |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
219 |
return KErrPermissionDenied; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
220 |
); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
221 |
if(((TBool)a1 == HAL::EMouseState_Visible) && (iPointerOn == (TBool)EFalse)) |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
222 |
{ |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
223 |
iPointerOn=(TBool)ETrue; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
224 |
} |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
225 |
else if(((TBool)a1 == HAL::EMouseState_Invisible) && (iPointerOn==(TBool)ETrue)) |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
226 |
{ |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
227 |
iPointerOn=(TBool)EFalse; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
228 |
} |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
229 |
break; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
230 |
} |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
231 |
case EMouseHalMouseInfo: |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
232 |
{ |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
233 |
TPckgBuf<TMouseInfoV01> vPckg; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
234 |
TMouseInfoV01& xyinfo = vPckg(); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
235 |
xyinfo.iMouseButtons = 2; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
236 |
xyinfo.iMouseAreaSize.iWidth = iScreenWidth; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
237 |
xyinfo.iMouseAreaSize.iHeight = iScreenHeight; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
238 |
xyinfo.iOffsetToDisplay.iX = 0; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
239 |
xyinfo.iOffsetToDisplay.iY = 0; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
240 |
Kern::InfoCopy(*(TDes8*)a1,vPckg); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
241 |
break; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
242 |
} |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
243 |
case EMouseHalSetMouseSpeed: |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
244 |
{ |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
245 |
__SECURE_KERNEL( |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
246 |
if(!Kern::CurrentThreadHasCapability(ECapabilityMultimediaDD, |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
247 |
__PLATSEC_DIAGNOSTIC_STRING("Checked by Hal function EMouseHalSetMouseSpeed"))) |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
248 |
return KErrPermissionDenied; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
249 |
); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
250 |
// fall thru to NotSupported |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
251 |
} |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
252 |
case EMouseHalSetMouseAcceleration: |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
253 |
{ |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
254 |
__SECURE_KERNEL( |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
255 |
if(!Kern::CurrentThreadHasCapability(ECapabilityMultimediaDD, |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
256 |
__PLATSEC_DIAGNOSTIC_STRING("Checked by Hal function EMouseHalSetMouseAcceleration"))) |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
257 |
return KErrPermissionDenied; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
258 |
); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
259 |
// fall thru to NotSupported |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
260 |
} |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
261 |
default: |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
262 |
{ |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
263 |
r = KErrNotSupported; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
264 |
break; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
265 |
} |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
266 |
} |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
267 |
return r; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
268 |
} |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
269 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
270 |
DECLARE_STANDARD_EXTENSION() |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
271 |
{ |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
272 |
__DEBUG_PRINT("DECLARE_STANDARD_EXTENSION"); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
273 |
TPointerRv *d = new TPointerRv; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
274 |
d->Init3(); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
275 |
return KErrNone; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
276 |
} |