[go: nahoru, domu]

Jump to content

Programmed input–output: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
BG19bot (talk | contribs)
m →‎top: WP:CHECKWIKI error fix for #61. Punctuation goes before References. Do general fixes if a problem exists. -
 
(34 intermediate revisions by 28 users not shown)
Line 1: Line 1:
{{Short description|Method of CPU communication with peripheral devices}}
{{Refimprove|date=June 2013}}
{{Refimprove|date=June 2013}}
'''Programmed input–output''' (also '''programmable input/output''', '''programmed input/output''', '''programmed I/O''', '''PIO''') is a method of [[data transmission]], via [[input/output]] (I/O), between a [[central processing unit]] (CPU) and a [[peripheral]] device,<ref name="CompArchOrg">{{cite book |title=Computer Architecture and Organization |last=Hayes |first=John P. |isbn=0-07-027363-4 |date=1978 |publisher=McGraw-Hill International Book Company |pages=419}}</ref> such as a [[Parallel ATA]] storage device. Each data item transfer is initiated by an instruction in the program, involving the CPU for every transaction. In contrast, in [[direct memory access]] (DMA) operations, the CPU is uninvolved in the data transfer.
'''Programmed input/output''' ('''PIO''') is a method of transferring data between the [[Central processing unit|CPU]] and a peripheral, such as a network adapter or an [[AT Attachment|ATA]] storage device.


The term can refer to either [[memory-mapped I/O]] (MMIO) or port-mapped I/O (PMIO). PMIO refers to transfers using a special [[address space]] outside of normal memory, usually accessed with dedicated instructions, such as <samp>IN</samp> and <samp>OUT</samp> in [[x86]] architectures. MMIO<ref>{{cite book |last=Stallings |first=William |date=2012 |title=Computer Organization and Architecture |edition=9th |publisher=Pearson}}</ref> refers to transfers to I/O devices that are mapped into the normal address space available to the program. PMIO was very useful for early microprocessors with small address spaces, since the valuable resource was not consumed by the I/O devices.
For programmed I/O, the software that is running on the CPU uses instructions that access I/O address space to perform data transfers to or from an I/O device ([[Memory-Mapped I/O]]).<ref>Computer Organization and Architecture 9th Edition. Stallings, William. Pearson, 2012</ref>
This is in contrast to [[Direct Memory Access]] (DMA) transfers.


The best known example of a PC device that uses programmed I/O is the [[AT Attachment|ATA]] interface;
The best known example of a PC device that uses programmed I/O is the Parallel AT Attachment (PATA) interface; however, the AT Attachment interface can also be operated in any of several DMA modes. Many older devices in a PC also use PIO, including legacy serial ports, legacy parallel ports when not in ECP mode, keyboard and mouse [[PS/2 port]]s, legacy [[MIDI]] and [[joystick]] ports, the interval timer, and older network interfaces.
however, this interface can also be operated in any of several [[Direct Memory Access|DMA]] modes.
Many older devices in a PC also use PIO, including legacy serial ports,
legacy parallel ports when not in ECP mode,
the PS/2 keyboard and mouse ports,
legacy MIDI and joystick ports,
the interval timer, and older network interfaces.


== PIO mode in the ATA interface ==
== PIO mode in the ATA interface ==
The PIO interface is grouped into different modes that correspond to different [[transfer rate]]s. The [[electrical signal]]ing among the different modes is similar — only the cycle time between transactions is reduced in order to achieve a higher transfer rate. All ATA devices support the slowest mode — Mode 0. By accessing the information registers (using Mode 0) on an ATA drive, the CPU is able to determine the maximum transfer rate for the device and configure the ATA controller for optimal performance.


The PIO modes require a great deal of CPU overhead to configure a data transaction and transfer the data. Because of this inefficiency, the DMA (and eventually Ultra Direct Memory Access ([[UDMA]]) interface was created to increase performance. The simple digital logic needed to implement a PIO transfer still makes this transfer method useful today, especially if high transfer rates are unneeded as in [[embedded system]]s, or with [[field-programmable gate array]] (FPGA) chips, where PIO mode can be used with no significant performance loss.
Until the introduction of [[Direct memory access|DMA]], PIO was the only available method.


Two additional advanced timing modes have been defined in the [[CompactFlash]] specification 2.0. Those are PIO modes 5 and 6. They are specific to CompactFlash.
The PIO interface is grouped into different modes that correspond to different [[transfer rate]]s. The [[electrical signal]]ing among the different modes is similar — only the cycle time between transactions is reduced in order to achieve a higher transfer rate. All ATA devices support the slowest mode — Mode 0. By accessing the information registers (using Mode 0) on an ATA drive, the CPU is able to determine the maximum transfer rate for the device and configure the ATA controller for optimal performance.

The PIO modes require a great deal of CPU overhead to configure a data transaction and transfer the data. Because of this inefficiency, the [[Direct memory access|DMA]] (and eventually [[AT Attachment|UDMA]]) interface was created to increase performance. The simple digital logic required to implement a PIO transfer still makes this transfer method useful today, especially if high transfer rates are not required like in embedded systems, or with [[Field-programmable gate array|FPGA]] chips where PIO mode can be used without significant performance loss.

Two additional Advanced Timing modes have been defined in the [[CompactFlash]] specification 2.0. Those are PIO mode 5 and PIO mode 6. They are specific to CompactFlash.


{| class="wikitable" style="text-align:center"
{| class="wikitable" style="text-align:center"
Line 64: Line 55:


=== PIO Mode 5 ===
=== PIO Mode 5 ===
A PIO Mode 5 was proposed<ref name="ATA Timing Extension For ATA-3">''Proposed 22 MByte/Sec ATA Timing Extension For ATA-3, January 1995, [ftp://ftp.t10.org/t10/document.95/95-122r0.pdf ATA-3 Extension Proposal]</ref> with operation at 22 MB/s, but was never implemented on hard disks because CPUs of the time would have been crippled waiting for the hard disk at the proposed PIO 5 timings, and the [[Direct memory access|DMA]] standard ultimately obviated it. While no [[Hard disk|hard drives]] were ever manufactured to support this mode, some [[motherboard]] manufacturers preemptively provided [[BIOS]] support for it. PIO Mode 5 can be used with CompactFlash cards connected to IDE via CF-to-IDE adapters.
A PIO Mode 5 was proposed<ref name="ATA Timing Extension For ATA-3">{{cite web |url=https://www.t10.org/ftp/t10/document.95/95-122r0.pdf |title=Proposed 22 MByte/Sec ATA Timing Extension for ATA-3 |first=Joseph |last=Chen |date=January 10, 1995 |publisher=Technical Committee T10 (X3T10) |work=T10.org |archive-url= https://web.archive.org/web/20100620052300/https://www.t10.org/ftp/t10/document.95/95-122r0.pdf |archive-date=June 20, 2010 |url-status=live |access-date=February 19, 2020}}</ref> with operation at 22&nbsp;MB/s, but was never implemented on hard disks because CPUs of the time would have been crippled waiting for the hard disk at the proposed PIO 5 timings, and the [[Direct memory access|DMA]] standard ultimately obviated it. While no [[hard disk drive]] was ever manufactured to support this mode, some [[motherboard]] manufacturers preemptively provided [[BIOS]] support for it. PIO Mode 5 can be used with CompactFlash cards connected to ATA via CF-to-ATA adapters.

=== Device compatibility ===
Not all devices are compatible with the official PIO timings. An example is the Sandisk SDDR-89 ImageMate 12-in-1 card reader which uses the GL819 chip from [[Genesys Logic, Inc.]] That chip has slightly different timings for most of its PIO Modes.

{| class="wikitable" style="text-align:center"
|PIO Mode || 1 || 2 || 3 || 4 || 6
|-
| GL819 timings
| 399 [[1 E-9 s|ns]]
| 249 [[1 E-9 s|ns]]
| 183 [[1 E-9 s|ns]]
| 133 [[1 E-9 s|ns]]
| 83 [[1 E-9 s|ns]]
|-
| ATA & CF spec timings
| 383 [[1 E-9 s|ns]]
| 240 [[1 E-9 s|ns]]
| 180 [[1 E-9 s|ns]]
| 120 [[1 E-9 s|ns]]
| 80 [[1 E-9 s|ns]]
|}


== See also ==
== See also ==
* [[WDMA (computer)|WDMA]] - Single/Multiword DMA
* [[WDMA (computer)]] single/multi-word DMA
* [[AT Attachment|ATA]] - ATA specification
* [[AT Attachment]] ATA specification
* [[Input/output]]
* [[Input/output]]
* [[Interrupt]]
* [[Interrupt]]
Line 100: Line 70:
{{DEFAULTSORT:Programmed input output}}
{{DEFAULTSORT:Programmed input output}}
[[Category:Input/output]]
[[Category:Input/output]]
[[Category:AT Attachment]]

Latest revision as of 16:20, 31 January 2024

Programmed input–output (also programmable input/output, programmed input/output, programmed I/O, PIO) is a method of data transmission, via input/output (I/O), between a central processing unit (CPU) and a peripheral device,[1] such as a Parallel ATA storage device. Each data item transfer is initiated by an instruction in the program, involving the CPU for every transaction. In contrast, in direct memory access (DMA) operations, the CPU is uninvolved in the data transfer.

The term can refer to either memory-mapped I/O (MMIO) or port-mapped I/O (PMIO). PMIO refers to transfers using a special address space outside of normal memory, usually accessed with dedicated instructions, such as IN and OUT in x86 architectures. MMIO[2] refers to transfers to I/O devices that are mapped into the normal address space available to the program. PMIO was very useful for early microprocessors with small address spaces, since the valuable resource was not consumed by the I/O devices.

The best known example of a PC device that uses programmed I/O is the Parallel AT Attachment (PATA) interface; however, the AT Attachment interface can also be operated in any of several DMA modes. Many older devices in a PC also use PIO, including legacy serial ports, legacy parallel ports when not in ECP mode, keyboard and mouse PS/2 ports, legacy MIDI and joystick ports, the interval timer, and older network interfaces.

PIO mode in the ATA interface[edit]

The PIO interface is grouped into different modes that correspond to different transfer rates. The electrical signaling among the different modes is similar — only the cycle time between transactions is reduced in order to achieve a higher transfer rate. All ATA devices support the slowest mode — Mode 0. By accessing the information registers (using Mode 0) on an ATA drive, the CPU is able to determine the maximum transfer rate for the device and configure the ATA controller for optimal performance.

The PIO modes require a great deal of CPU overhead to configure a data transaction and transfer the data. Because of this inefficiency, the DMA (and eventually Ultra Direct Memory Access (UDMA) interface was created to increase performance. The simple digital logic needed to implement a PIO transfer still makes this transfer method useful today, especially if high transfer rates are unneeded as in embedded systems, or with field-programmable gate array (FPGA) chips, where PIO mode can be used with no significant performance loss.

Two additional advanced timing modes have been defined in the CompactFlash specification 2.0. Those are PIO modes 5 and 6. They are specific to CompactFlash.

PIO modes
Mode Maximum transfer rate (MB/s) Minimum cycle time Standard where spec is defined
Mode 0 3.3 600 ns ATA-1
Mode 1 5.2 383 ns ATA-1
Mode 2 8.3 240 ns ATA-1
Mode 3 11.1 180 ns ATA-2
Mode 4 16.7 120 ns ATA-2
Mode 5 20 100 ns CompactFlash 2.0
Mode 6 25 80 ns CompactFlash 2.0

PIO Mode 5[edit]

A PIO Mode 5 was proposed[3] with operation at 22 MB/s, but was never implemented on hard disks because CPUs of the time would have been crippled waiting for the hard disk at the proposed PIO 5 timings, and the DMA standard ultimately obviated it. While no hard disk drive was ever manufactured to support this mode, some motherboard manufacturers preemptively provided BIOS support for it. PIO Mode 5 can be used with CompactFlash cards connected to ATA via CF-to-ATA adapters.

See also[edit]

References[edit]

  1. ^ Hayes, John P. (1978). Computer Architecture and Organization. McGraw-Hill International Book Company. p. 419. ISBN 0-07-027363-4.
  2. ^ Stallings, William (2012). Computer Organization and Architecture (9th ed.). Pearson.
  3. ^ Chen, Joseph (January 10, 1995). "Proposed 22 MByte/Sec ATA Timing Extension for ATA-3" (PDF). T10.org. Technical Committee T10 (X3T10). Archived (PDF) from the original on June 20, 2010. Retrieved February 19, 2020.