Re: READ_PORT_UCHAR and COM2
From: Wally (Wally_at_Dilbert.what)
Date: 03/01/05
- Next message: Aaron Lawrence: "Re: DCOM settings"
- Previous message: kanel: "coprocess and link option problem?"
- In reply to: ksmith: "READ_PORT_UCHAR and COM2"
- Next in thread: ksmith: "Re: READ_PORT_UCHAR and COM2"
- Reply: ksmith: "Re: READ_PORT_UCHAR and COM2"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 1 Mar 2005 07:44:43 -0000
Do you already have a COM2 driver?
If so could it be reading the data (on interrupt) before you read it.
"ksmith" <ksmith@discussions.microsoft.com> wrote in message
news:9B3BB788-AB7A-49F6-A4E9-820C31115DEA@microsoft.com...
> 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: Aaron Lawrence: "Re: DCOM settings"
- Previous message: kanel: "coprocess and link option problem?"
- In reply to: ksmith: "READ_PORT_UCHAR and COM2"
- Next in thread: ksmith: "Re: READ_PORT_UCHAR and COM2"
- Reply: ksmith: "Re: READ_PORT_UCHAR and COM2"
- Messages sorted by: [ date ] [ thread ]