`

关于IO ports和IO memory

阅读更多

在IA32 Manuals-Basic Architecture中, 对于IO有二种寻址方式:1, IO Port(IO Address Space); 2,
Memory-Mapped IO.

        1) IO Port方式.
        使用体系结构相关的in/out指令来访问IO端口,并且能够保证每一条指令都在下一条之前完成,也就是in/out
指令是自然有序的。 一共有2^16(64K)个单独的8-bit端口,编号从0到FFFFH(其中从0F8H到0FFH被保留),任意两个连续
的8bit端口可以被看做是一个16bit端口,同样,任意4个连续的8bit端口可以被看做是一个32bit端口。

        2) IO Address Space方式.
        可以使用任意的mov、and、or等指令来访问,就象访问主存一样。

        对于Linux内核来说,若想访问io ports,需要request_region来分配io ports, 返回之后的struct resource
就包含了start和end,在此之间的区域可以用in/out指令来访问。 /proc/ioports记录了目前已分配的所有IO端口。
        对memory-mapped io来说,需要request_mem_region来分配IO内存(也就是外设的寄存器或者存储体),它也是
返回一个struct resource结构,其中有start和end字段,可以用来作为ioremap函数的参数。 对request_mem_region分配
的IO内存进行了ioremap之后,就可以在程序中象访问普通内存区那样来访问它们了。
        IO Ports和IO Momory之间的转换,可以用ioport_map/ioport_unmap来实现。

 

Quote : http://linux.chinaunix.net/bbs/viewthread.php?tid=890288&page=1#pid6311319

分享到:
评论

相关推荐

    RAD5545 SpaceVPX_SBC.pdf

    RapidIO ports at 10 Gbits/second each and 12 SpaceWire links at 320 Mbits/second each are provided to the SpaceVPX backplane. An optional daughter card with PCI, RapidIO, and/ or SpaceWire interfaces ...

    C事件驱动循环的网络IO编程框架的源码.rar

    基于事件驱动循环的网络IO编程框架,小编英语学的不好,直接把英原文复制出来,如下: Some of the specialties of libev not commonly found elsewhere are: - extensive and detailed, readable documentation ...

    C5416 寄存器头文件

    Function: ** 1. Memory–Maped Registers (MMR) are mapped to data–page memory ** (Address: 0x0000 to 0x005F). Note that the assembly tool ... Addresses for C5402 DSK on–board IO ports are defined.

    基于Infineon XMC4800 EtherCAT Slave Digital I/O模组之工业自动化通讯控制方案-电路方案

    2. XMC4800 integrated Beckhoff ET1100 EtherCAT ASIC, interface capable of 100 Mbit/s transfer rates with 2 MII ports. 3. 通讯单元:Ethernet, USB, CAN bus, UART, SPI, IIC, IIS, external memory, SD/MMC ...

    mini2440 beer(pwm) 驱动

    hub 1-0:1.0: 2 ports detected usbcore: registered new interface driver libusual s3c2440-usbgadget s3c2440-usbgadget: S3C2440: increasing FIFO to 128 bytes mousedev: PS/2 mouse device common for all ...

    XDA成员开发出Carrier IQ检测程序(Android)

    Screenshots of a "fail condition" Shows on stock rom regardless of tell HTC or location setting logging is enabled and running, proving HTCs statement wrong, wasting resources, io, memory, bandwidth ...

    BURNINTEST--硬件检测工具

    - Enhanced the mechanism to report memory hardware errors in the Memory torture test. Release 5.3 build 1033 WIN32 release 1 October 2008 - Changes to correct a BurnInTest crash problem on some ...

    tomcat-5.5.23

    temp - Directory used by the JVM for temporary files (java.io.tmpdir) <br>If you do not pass the "-Dcatalina.base=$CATALINA_BASE" argument to the startup command, $CATALINA_BASE will default to ...

    javacv-platform-1.3.3-src

    The class definitions are basically ports to Java of the original header files in C/C++, and I deliberately decided to keep as much of the original syntax as possible. For example, here is a method ...

    SystemVerilog Reference Manual 3.1a(中英文版)+最新SV IEEE 标准

    Table of Contents Section 1 Introduction to SystemVerilog ...................................................................................................... 1 Section 2 Literal Values................

Global site tag (gtag.js) - Google Analytics