--- a/baseport/syborg/pointer/syborg_pointer.cpp Thu Oct 15 17:58:46 2009 +0100
+++ b/baseport/syborg/pointer/syborg_pointer.cpp Wed Oct 21 10:29:21 2009 +0100
@@ -20,10 +20,29 @@
#include <syborg_priv.h>
#include "syborg_pointer.h"
-TPointerRv::TPointerRv():
- iRxDfc(RxDfc,this,Kern::DfcQue0(),1)
+
+_LIT(KPointerDfcQNamePre,"PointDFC");
+const TInt KDfcQuePriority = 27;
+
+
+
+TPointerRv::TPointerRv() //sosco :
+// iRxDfc(RxDfc,this,Kern::DfcQue0(),1)
+
{
__DEBUG_PRINT("TPointerRv::TPointerRv()");
+
+
+ TInt err = Kern::DfcQInit(&iDfcQue, KDfcQuePriority, &KPointerDfcQNamePre);
+ if (err)
+ {
+ __KTRACE_OPT(KPANIC, Kern::Printf("TPointerRv::TPointerRv() Error creating dfcq (%d)", err));
+ }
+
+ iRxDfc = new TDfc(RxDfc,this,&iDfcQue,1);
+ __ASSERT_ALWAYS(iRxDfc!=NULL,Kern::Printf("Failed to create DFC"));
+
+
TInt r = Interrupt::Bind(EIntPointer,Isr,this);
if(r != KErrNone)
__KTRACE_OPT(KPANIC, Kern::Printf("TPointerRv::TPointerRv() Interrupt::Bind(%d)=%d",
@@ -43,7 +62,7 @@
struct TPointerRv::PData* val = &iPDataFifo[iFifoPos];
iFifoPos++;
iFifoCount--;
-
+
if (iFifoPos == FIFO_SIZE)
iFifoPos = 0;
@@ -53,10 +72,10 @@
void TPointerRv::FifoPush(struct TPointerRv::PData* val)
{
TInt slot;
-
+
if (iFifoCount == FIFO_SIZE)
return;
-
+
slot = iFifoPos + iFifoCount;
if (slot >= FIFO_SIZE)
slot -= FIFO_SIZE;
@@ -74,7 +93,7 @@
TInt reg = ReadReg(KHwBaseKmiPointer,POINTER_ID);
WriteReg(KHwBaseKmiPointer,POINTER_INT_ENABLE,1);
-
+
TInt r = Kern::AddHalEntry(EHalGroupMouse,DoPointerHalFunction,this);
if(r != KErrNone)
__KTRACE_OPT(KPANIC, Kern::Printf("TPointerRv::Init3(): Kern::AddHalEntry()=%d", r));
@@ -86,16 +105,24 @@
r = Kern::HalFunction(EHalGroupDisplay, EDisplayHalCurrentModeInfo, (TAny*)&buf, NULL);
if(r != KErrNone)
__KTRACE_OPT(KPANIC, Kern::Printf("TPointerRv::Init3(): Kern::HalFunction(EDisplayHalCurrentModeInfo)=%d", r));
-
+
iScreenWidth = videoInfo.iSizeInPixels.iWidth;
iScreenHeight = videoInfo.iSizeInPixels.iHeight;
iDisplayMode = videoInfo.iDisplayMode;
+
+ iVideoMem = videoInfo.iVideoAddress + videoInfo.iOffsetToFirstPixel;
+ iOffSetBetweenEachLine = 640;
+
ix = iy = 0;
iXFactor = Fixed(iScreenWidth) / Fixed(0x8000);
iYFactor = Fixed(iScreenHeight) / Fixed(0x8000);
-
+
iFifoPos = iFifoCount = 0;
+
+
+ iFirstTime= ETrue;
+
}
@@ -108,7 +135,7 @@
// i->ix += pd->x;
// i->iy += pd->y;
-
+
i->ix = int(Fixed(pd->x) * i->iXFactor);
i->iy = int(Fixed(pd->y) * i->iYFactor);
@@ -155,15 +182,98 @@
}
fin:
+
+
+// i->DisplayPointer();
+
+
Kern::AddEvent(e);
i->iLastBut = pd->but;
}
+
+void TPointerRv::DisplayPointer()
+{
+
+TUint32 *pMem =0;
+TInt k=0;
+
+ if(!iFirstTime)
+ {
+
+ //restore old pointer position
+ pMem = (TUint32 *)iVideoMem;
+
+ pMem+= iYtop* iOffSetBetweenEachLine;
+ pMem+= iXleft;
+
+
+
+ for(TInt i=0;i<(iYbottom-iYtop);i++)
+ {
+ for(TInt j=0;j<(iXright-iXleft);j++)
+ {
+ *pMem = iImageStore[k];
+ pMem++;
+ k++;
+
+ }
+
+ pMem+= (iOffSetBetweenEachLine - iXright) + iXleft;
+ }
+ }
+
+ iFirstTime = EFalse;
+
+ //10*10 pixel pointer centered around position and check are within allowed bounds of screen
+ iXleft = ix - 5;
+
+ if(iXleft<0)
+ iXleft=0;
+
+ iXright = ix + 5;
+
+ if(iXright>iScreenWidth)
+ iXright = iScreenWidth;
+
+ iYtop = iy - 5;
+
+ if(iYtop<0)
+ iYtop=0;
+
+ iYbottom = iy +5;
+
+ if(iYbottom> iScreenHeight)
+ iYbottom=iScreenHeight;
+
+ pMem = (TUint32 *)iVideoMem;
+ k=0;
+
+ pMem+= iYtop* iOffSetBetweenEachLine;
+ pMem+= iXleft;
+
+ for(TInt i=0;i<(iYbottom-iYtop);i++)
+ {
+ for(TInt j=0;j<(iXright-iXleft);j++)
+ {
+ iImageStore[k] = *pMem;
+ *pMem = 0;
+ pMem++;
+ k++;
+
+ }
+
+ pMem+= (iOffSetBetweenEachLine - iXright) + iXleft;
+ }
+
+}
+
+
void TPointerRv::RxDfc(TAny* aPtr)
{
__DEBUG_PRINT("TPointerRv::RxDfc");
- TPointerRv* i = static_cast<TPointerRv*>(aPtr);
+ TPointerRv* i = static_cast<TPointerRv*>(aPtr);
while(i->iFifoCount>0) {
struct TPointerRv::PData *pd= i->FifoPop();
@@ -178,19 +288,30 @@
TPointerRv& k = *(TPointerRv*)aPtr;
// interrupts are now auto clear
- while(ReadReg(KHwBaseKmiPointer, POINTER_FIFO_COUNT)!=0) {
+
+ while(ReadReg(KHwBaseKmiPointer, POINTER_FIFO_COUNT)!=0)
+ {
+
+ WriteReg(KHwBaseKmiPointer,POINTER_LATCH,1);
+ // SOSCO: moved to here, as the buffer seems to be running one notch out,
+ // writing to the pointer latch first seems to return the correct FIFO entry.
+
struct TPointerRv::PData pd;
pd.x = ReadReg(KHwBaseKmiPointer,POINTER_X);
pd.y = ReadReg(KHwBaseKmiPointer,POINTER_Y);
pd.z = ReadReg(KHwBaseKmiPointer,POINTER_Z);
- pd.but = ReadReg(KHwBaseKmiPointer,POINTER_BUTTONS);
+ pd.but = ReadReg(KHwBaseKmiPointer,POINTER_BUTTONS);
k.FifoPush(&pd);
- WriteReg(KHwBaseKmiPointer,POINTER_LATCH,0);
+
+// SOSCO - moved WriteReg(KHwBaseKmiPointer,POINTER_LATCH,1);
+
}
-
+
// WriteReg(KHwBaseKmiPointer,POINTER_CLEAR_INT,0);
- Interrupt::Clear(EIntPointer);
- k.iRxDfc.Add();
+ Interrupt::Clear(EIntPointer);
+
+ k.iRxDfc->Add();
+
}
TInt TPointerRv::DoPointerHalFunction(TAny* aThis, TInt aFunction, TAny* a1, TAny* a2)
@@ -210,24 +331,28 @@
{
kumemput32(a1, (TBool*)&iPointerOn, sizeof(TBool));
break;
- }
+ }
case EMouseHalSetMouseState:
{
+
+ /* SOSCO - removed, causes platsec error
__SECURE_KERNEL(
if(!Kern::CurrentThreadHasCapability(ECapabilityMultimediaDD,
__PLATSEC_DIAGNOSTIC_STRING("Checked by Hal function EMouseHalSetMouseState")))
return KErrPermissionDenied;
);
+ */
+
if(((TBool)a1 == HAL::EMouseState_Visible) && (iPointerOn == (TBool)EFalse))
{
iPointerOn=(TBool)ETrue;
- }
- else if(((TBool)a1 == HAL::EMouseState_Invisible) && (iPointerOn==(TBool)ETrue))
+ }
+ else if(((TBool)a1 == HAL::EMouseState_Invisible) && (iPointerOn==(TBool)ETrue))
{
iPointerOn=(TBool)EFalse;
- }
+ }
break;
- }
+ }
case EMouseHalMouseInfo:
{
TPckgBuf<TMouseInfoV01> vPckg;
@@ -239,30 +364,38 @@
xyinfo.iOffsetToDisplay.iY = 0;
Kern::InfoCopy(*(TDes8*)a1,vPckg);
break;
- }
+ }
case EMouseHalSetMouseSpeed:
{
+
+ /* SOSCO - removed, causes platsec error
__SECURE_KERNEL(
if(!Kern::CurrentThreadHasCapability(ECapabilityMultimediaDD,
__PLATSEC_DIAGNOSTIC_STRING("Checked by Hal function EMouseHalSetMouseSpeed")))
return KErrPermissionDenied;
);
+ */
+
// fall thru to NotSupported
}
case EMouseHalSetMouseAcceleration:
{
+
+ /* SOSCO - removed, causes platsec error
__SECURE_KERNEL(
if(!Kern::CurrentThreadHasCapability(ECapabilityMultimediaDD,
__PLATSEC_DIAGNOSTIC_STRING("Checked by Hal function EMouseHalSetMouseAcceleration")))
return KErrPermissionDenied;
);
+ */
+
// fall thru to NotSupported
}
default:
{
r = KErrNotSupported;
break;
- }
+ }
}
return r;
}