Re: [ILUG] linux device drivers: port or memory mapped i/o?

From: Padraig Brady (padraig at domain antefacto.com)
Date: Tue 16 Oct 2001 - 16:39:26 IST


What this has to do with Linux I don't know, but:
It depends on your platform, some CPUs don't support
io instructions.

Advantages of MM io is you don't need special instructions and so can use
all the powerful addressing modes for IO. For e.g. you can define a
structure
that corresponds to the IO space of the device and just read/write the
members
to control the device. Also for I/O mapped I/O you need extra pins in
the system
that are driven by the I/O instruction.

The disadvantages are that the memory space is depleted.
Also it's harder to debug since any memory issues in your program (or others
on non MMU hardware) could be interacting with your device. Also the full
address size of the machine must be used for each instruction
interacting with
the device and so is slower in this respect.

Note most of the modern RISC and all 68K CPUs have no I/O instructions.

Personally I like working with MM I/O hardware as it allows for
elegant programs IMHO.

Padraig.

Stephen Shirley wrote:

>Mornin,
> I have to write a device driver for a chip which allows both port
>mapped and memory mapped i/o. Now I know that memory mapped is easier for
>the programmer (can use any instruction that can access memory, don't need
>to copy out data to look at it etc), but i was wondering was there any
>particular reasons why people would choose one over the other.
>
>TIA,
>Steve
>



This archive was generated by hypermail 2.1.6 : Thu 06 Feb 2003 - 13:12:46 GMT