Re: Help in getting application to access I/O space



OK, I will look into using the CEDDK functions. I assume you are talking
about

READ_PORT_ULONG()
WRITE_PORT_ULONG()

Can these be used by an app or do I need to write a driver that calls these?



"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam DOT
com> wrote in message news:u8dg3JatGHA.2260@xxxxxxxxxxxxxxxxxxxxxxx
No, it can't be because the I/O bus is only 16 bits wide, at most. You
could write functions which send a 32-bit value in two 16-bit pieces or
four 8-bit pieces to the right consecutive addresses, but there's no
32-bit out instruction.

Since it seems that you are pretty inexperienced at doing things at this
level, I think you'll be better off using the CEDDK functions, as Dean
pointed out. Before you can know how to do this 32-bit I/O, you need to
understand how the hardware works, too, so you need help at a level that
we can't really give, since we don't have that hardware.

Paul T.

"Andy Purcell" <Andy_Purcell@xxxxxxxxxxx> wrote in message
news:etnvsCatGHA.3264@xxxxxxxxxxxxxxxxxxxxxxx
Paul,

You talked about this code working for 16-bit quantities instead of
8-bit.
I need to do 32-bit.
Can this same technique be extended to 32-bits?
I am not an x86 assembly language expert, so if you could provide some
more pointers for how to do 32-bit I/O space accesses, that would be
great.



"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam
DOT com> wrote in message news:%239IPKsZtGHA.4748@xxxxxxxxxxxxxxxxxxxxxxx
You can do it with some simple inline assembly. Again, remember the
restrictions on this and its lack of portability. No one is later going
to look at this code and think how smart you are...

BYTE inpb( USHORT addr )
{
BYTE val;
__asm
{
xor eax, eax
mov dx, addr
in al, dx
mov val, al
}

return val;
}

void outpb( USHORT addr, BYTE val )
{
__asm
{
mov dx, addr
mov al, val
out dx, al
}
}

Similar things would be done to do word-wide, rather than byte-wide,
outputs, if that's what your hardware requires.

Paul T.

"Andy Purcell" <Andy_Purcell@xxxxxxxxxxx> wrote in message
news:uCwISlZtGHA.4748@xxxxxxxxxxxxxxxxxxxxxxx
The processor is x86.
What code would I start to modify to create my own _inp() and _outp()
for r/w?




"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam
DOT com> wrote in message news:OrOFFnYtGHA.1504@xxxxxxxxxxxxxxxxxxxxxxx
What sort of a processor is it? If it's x86, there's a separate set
of instructions that access it and you could write your own versions
of _inp() and _outp() to read and write. If it's not an x86, then I/O
= memory, so you'll want to use MmMapIoSpace() with appropriate
parameters. Based on that address, I'm guessing x86.

A twist is that it's also possible that your platform uses
bus-relative addresses, in which case BusTransBusAddrToVirtual() would
be more appropriate. Are you sure you shouldn't be doing this in a
driver and not the application?

Paul T.

"Andy Purcell" <Andy_Purcell@xxxxxxxxxxx> wrote in message
news:%23dbEJiYtGHA.1512@xxxxxxxxxxxxxxxxxxxxxxx
I need to write CE app to manipulate my CPU GPIO outputs. The
documentation for the CPU registers that control GPIO signals says
that the registers are mapped as offsets into "I/O Space". The base
address is 0xF0.

So the question is - how can my application access these registers?
- can I use WRITE_PORT_ULONG()?
- must I map this space using some API?















.



Relevant Pages