READ_PORT_UCHAR and COM2
From: ksmith (ksmith_at_discussions.microsoft.com)
Date: 03/01/05
- Next message: David: "Looking for BSP"
- Previous message: vijayaraju.k_at_gmail.com: "Re: Windows CE 4.2 Evaluation CDs"
- Next in thread: Wally: "Re: READ_PORT_UCHAR and COM2"
- Reply: Wally: "Re: READ_PORT_UCHAR and COM2"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 28 Feb 2005 21:07:02 -0800
Hello,
For something that appears relatively simple I'm having a hell of a time
getting it to work. Basically I'm trying to read in from COM2 (Native IR)
using READ_PORT_UCHAR but so far I've never been able to get any data.
I am attempting to use TransBusAddrToVirtual to map the physical address to
a virtual one; then I use that address with READ_PORT_UCHAR to read the data.
Here's how I am going about this:
** CODE **
PVOID vAddr;
ULONG addressspace = TRUE;
PHYSICAL_ADDRESS temp = {0xAE7, 0}; // See IoBase in Reg below
if(!TransBusAddrToVirtual(Isa, 0, temp, 1, &addressspace, &vAddr))
return NULL;
if (waitRtn = WaitCommEvent(m_hIRPort, &commEvent, NULL))
{
while (bufNdx < 1000)
{
buffer2[bufNdx] = READ_PORT_UCHAR((PUCHAR)vAddr);
QueryPerformanceCounter(&time);
times[bufNdx] = time;
bufNdx++;
}
}
** REG **
[HKEY_LOCAL_MACHINE\Drivers\BuiltIn\Serial_FIR]
"IoBase"=dword:ae700000
"Dll"="Serial_FIR.Dll"
"Tsp"="Unimodem.dll"
"Irq"=dword:00000013
"IoLen"=dword:00000024
"DeviceArrayIndex"=dword:00000000
"Prefix"="COM"
"Order"=dword:00000002
"Index"=dword:00000002
"DeviceType"=dword:00000000
"FriendlyName"=hex(7):\
49,6e,66,72,61,72,65,64,20,50,6f,72,74,00,00,00,00
"DevConfig"=hex:\
10,00,00,00,05,00,00,00,00,01,00,00,00,4b,00,00,00,00,08,00,00,00,00,00,00
Now, I've run the above code using ReadFile and a handle to COM2: created by
CreateFile. This works but it is too slow for my needs. This is why I went
about the READ_PORT_UCHAR method and it is much faster but I haven't been
able to get any data.
I have a few questions for you guys:
1) Is IoBase the physical address of com2? I've tried the above code using
0x2F8, 0x3E8 and 0xAE7 but none of them work.
2) Is IoLen the Length parameter in TransBusAddrToVirtual? Right now I have
Length = 1 since I am only interested in reading in the data a byte at a time.
Any insights as to why this isn't working would be helpful.
Thanks in advance,
Kyle
** Function **
BOOL TransBusAddrToVirtual(
INTERFACE_TYPE InterfaceType,
ULONG BusNumber,
PHYSICAL_ADDRESS BusAddress,
ULONG Length,
PULONG AddressSpace,
PPVOID MappedAddress
);
- Next message: David: "Looking for BSP"
- Previous message: vijayaraju.k_at_gmail.com: "Re: Windows CE 4.2 Evaluation CDs"
- Next in thread: Wally: "Re: READ_PORT_UCHAR and COM2"
- Reply: Wally: "Re: READ_PORT_UCHAR and COM2"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|
|