Re: PWM Driver
From: David V (davev_at_)
Date: 04/01/04
- Next message: Paul G. Tobey [eMVP]: "Re: PWM Driver"
- Previous message: Paul G. Tobey [eMVP]: "Re: PWM Driver"
- In reply to: Paul G. Tobey [eMVP]: "Re: PWM Driver"
- Next in thread: Paul G. Tobey [eMVP]: "Re: PWM Driver"
- Reply: Paul G. Tobey [eMVP]: "Re: PWM Driver"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 1 Apr 2004 10:29:46 -0600
Here is my complete IOControl function.
I replaced the address with the hardcoded 0x40b00000 and i still get the
error:
4294818200 PID:e3fa52a2 TID:23c97c7e RaiseException: Thread=83d11920
Proc=828d9b88 'device.exe'
4294818202 PID:e3fa52a2 TID:23c97c7e AKY=00000089 PC=00000000 RA=800eb8c8
BVA=828d9e10 FSR=00000000
BOOL PWM_IOControl( DWORD hOpenContext, DWORD dwCode, PBYTE pBufIn, DWORD
dwLenIn, PBYTE pBufOut, DWORD dwLenOut, PDWORD pdwActualOut )
{
UINT32 data;
UINT32 address;
switch (dwCode) {
case IOCTL_DRIVER_PWM_READ:
{
OutputDebugString( TEXT("Read from Reg\r\n") );
address = *((UINT32*)pBufIn);
DBGOut(address); OutputDebugString( TEXT("\n") );
PHYSICAL_ADDRESS phys;
phys.u.LowPart = address;
phys.u.LowPart = 0x40B00000;
phys.u.HighPart = 0;
PVOID v_address = MmMapIoSpace(phys, 400, false);
DBGOut((ULONG)v_address); OutputDebugString( TEXT("\n") );
//<-------------------------This line is never reached.
// data = READ_REGISTER_ULONG((unsigned long *)v_address);
DBGOut(data); OutputDebugString( TEXT("\n") );
}
break;
default:
OutputDebugString(L"Unknown IOCTL\n");
break;
}
----------------------------------
Here is the app code with calls the driver
TCHAR tcBuffer[10];
DWORD dwBytesReturned;
UINT32 address;
address = PWMCTRL1;
BOOL bRet=DeviceIoControl(
hTestDevice,
IOCTL_DRIVER_PWM_READ,
&address,
sizeof(address),
tcBuffer,
lstrlen(tcBuffer)*sizeof(TCHAR),
&dwBytesReturned,
NULL);
-----------
Any Ideas?
David V
"Paul G. Tobey [eMVP]" <ptobey_no_spam@instrument_no_spam.com> wrote in
message news:OaFizRAGEHA.3912@TK2MSFTNGP10.phx.gbl...
> I tried it on our XScale-based device and it works fine (no exceptions, at
> least). Maybe you should explicitly set address to the right value and
try
> it...
>
> Paul T.
>
> "David V" <davev@> wrote in message
> news:%23NkfdAAGEHA.692@TK2MSFTNGP09.phx.gbl...
> > I also tried READ_PORT_ULONG() and still get an exception.
> >
> > This register is the PWM control registers on the PXA255.
> >
> >
> > Any other ideas?
> >
> >
> > David V
> > "Paul G. Tobey [eMVP]" <ptobey_no_spam@instrument_no_spam.com> wrote in
> > message news:OLaHoj3FEHA.1012@TK2MSFTNGP11.phx.gbl...
> > > What are you trying to access? Sorry, I don't recognize 0x40b00000.
> You
> > > might try READ_PORT_ULONG, rather than READ_REGISTER_ULONG, although
> they
> > > are probably the same on XScale.
> > >
> > > Paul T.
> > >
> > > "David V" <davev@> wrote in message
> > > news:egSr6$2FEHA.1240@TK2MSFTNGP10.phx.gbl...
> > > > Thanks for all your help.
> > > >
> > > >
> > > > Now i can getting the error:
> > > >
> > > > 4294814732 PID:3fa62a2 TID:43cc42ea RaiseException: Thread=83c73040
> > > > Proc=828d9b88 'device.exe'
> > > > 4294814734 PID:3fa62a2 TID:43cc42ea AKY=00000089 PC=00000000
> RA=800eb8c8
> > > > BVA=80118278 FSR=8014b224
> > > > 4294814735 PID:3fa62a2 TID:43cc42ea NKDispatchException: returning
> > > failure.
> > > > Flags=1
> > > >
> > > >
> > > > when i call the following code in my DLL.
> > > >
> > > > {
> > > > OutputDebugString( TEXT("Read from Reg\r\n") );
> > > > address = *((UINT32*)pBufIn);
> > > > DBGOut(address); // <- This outputs the address 0x40b0_0000,
> which
> > is
> > > > correct for xscale.
> > > >
> > > > PVOID v_address;
> > > > PHYSICAL_ADDRESS phys = { address, 0 };
> > > > v_address = MmMapIoSpace(phys, 4, false);
> > > > UINT32 reg = (UINT32)v_address;
> > > >
> > > > UINT32 data = READ_REGISTER_ULONG((unsigned long *)reg);
> > > > DBGOut(data);
> > > > }
> > > >
> > > >
> > > > any ideas?
> > > >
> > > >
> > > > David V
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > "David V" <davev@> wrote in message
> > > > news:%23GyDRTpFEHA.3540@TK2MSFTNGP09.phx.gbl...
> > > > > I am trying to write a dll for a PWM driver. I am using Platform
> > Builder
> > > > 4.2
> > > > > for the x-scale.
> > > > >
> > > > > When i try to register the dll I use the code below and get error
> type
> > > 1.
> > > > > dll = RegisterDevice(L"PWM", 1, L"pwm.dll", 0);
> > > > >
> > > > >
> > > > > In my dll project I have a init function, PWM_INIT.
> > > > >
> > > > >
> > > > > What should the signature be for this function? I have seen 3
> > different
> > > > > signatures. One with 2 input parameters, One that returns a BOOL.
> One
> > > that
> > > > > returns a DWORD handle.
> > > > >
> > > > > What should the handle be if all i want to do I use PWM_IOControl?
> > > > >
> > > > > There don't seem to be an good examples on how to write a driver.
> All
> > > the
> > > > > examples are poorly commented and extremely confusing.
> > > > >
> > > > >
> > > > > Dave V.
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>
- Next message: Paul G. Tobey [eMVP]: "Re: PWM Driver"
- Previous message: Paul G. Tobey [eMVP]: "Re: PWM Driver"
- In reply to: Paul G. Tobey [eMVP]: "Re: PWM Driver"
- Next in thread: Paul G. Tobey [eMVP]: "Re: PWM Driver"
- Reply: Paul G. Tobey [eMVP]: "Re: PWM Driver"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|