Both CPUs and external devices, memory connections, and data exchange need to be implemented by interface devices, the former is referred to as an I / O interface, and the latter is called a memory interface. The memory is typically working in synchronous control of the CPU, and the interface circuit is relatively simple; and there is a wide variety of I / O devices, and the corresponding interface circuits are different, so it is accustomed to the interface only means I / O interface.
First, the concept of I / 0 interface
1. The function of the interface classification I / O interface is responsible for implementing the CPU through the system bus to link the I / O circuit and the peripheral device, according to the complexity of the circuit and the device, the hardware of the I / O interface is mainly divided into two categories. : 1) I / O Interface Chip These chips are mostly integrated circuits, entered different commands and parameters through the CPU, and control the relevant I / O circuits and simple peripherals to operate accordingly, common interface chips such as timing / counters , Interrupt controller, DMA controller, parallel interface, etc. 2) I / O Interface Control Card There are several integrated circuits to be a component, or directly on the motherboard directly with the CPU, or one plug-in is inserted on the system bus slot. According to the connection object of the interface, they can be divided into serial interfaces, parallel interfaces, keyboard interfaces, and disk interfaces. 2. The function of the interface is due to a wide variety of peripherals of the computer, and almost all the electromechanical transmission equipment is used. Therefore, the CPU has the following problems when data exchange with the I / O device: speed mismatch: I / O device's working speed Slowly more than CPU, and because of the different types, the speed difference between them is also very large. For example, the transmission speed of the hard disk is much faster than the printer. Timing mismatch: Each I / O device has its own timing control circuit, transmitting data with its own speed, and cannot be unified with the timing of the CPU. Information format does not match: different I / O devices store and process information differently, for example, two types of serial and parallel; can also be divided into binary format, ACSII coding, and BCD coding. The information type does not match: the signal types employed by different I / O devices are different, and some are digital signals, and some are analog signals, so the processing methods employed are also different. Based on the above reasons, data exchange between CPUs and peripherals must be completed by an interface. The usual interface has the following functions: 1) Set the data of the data, buffer logic to accommodate the speed difference between the CPU and the peripheral, the interface is usually Composed of some registers or RAM chips, if the chip is large enough to implement the transmission of bulk data; 2) The conversion of information format, such as serial and parallel conversion; 3) can coordinate the CPU and the outside in information Differences of type and level, such as level conversion drivers, digital / mode or mode / digital converters, etc .; 4) Coordination timing differences; 5) Address decoding and device selection function; 6) Set interrupt and DMA control logic, The interrupt and DMA request signals are guaranteed in the event of interrupt and DMA, and the interrupt processing and DMA transmission are completed after accepting an interrupt and DMA response. 3. Control mode of the interface The CPU has the following ways to control the external settings: 1) Program Query mode In this way, the CPU is inquiry to specify the current state of the peripheral through the I / O instruction, if the peripheral is ready, Then, the input or output of the data, otherwise the CPU waits, the loop query. The advantage of this way is that the structure is simple, only a small amount of hardware circuitry can, and the disadvantage is that the CPU is much higher than the peripheral, and is usually in the waiting state, the working efficiency is very low. 2) In this way, the CPU is no longer passive, but can perform other programs. Once the peripheral is ready to be used, the service request can be filed to the CPU, if the CPU should be temporarily stopped The execution of the program is turned to execute the service program corresponding to the request, and then proceeds to the procedure that is interrupted.
The advantage of interrupt treatment is obvious. It not only saves the CPU to query peripheral status and waiting for peripherals, improve the work efficiency of the CPU, but also meets the real-time requirements of peripherals. However, it is necessary to assign an interrupt request number and a corresponding interrupt service program for each I / O device. In addition, an interrupt controller (I / O interface chip) manages the interrupt request proposed by the I / O device, such as setting interrupt mask, Interrupt request priority, etc. In addition, the disadvantage of the interrupt processing method is that every time it is interrupted, start the interrupt controller, but also retains and restores the site to continue the execution of the original program, the amount of work takes a lot, so if you need a lot of data exchange, The performance of the system will be low. 3) DMA (Direct Memory Access) Transfer mode DMA is most obvious that it is not using software but uses a specialized controller to control data exchange between memory and peripherals, no need to intervene, greatly improve CPU Work efficiency. Prior to the DMA data transfer, the DMA controller will apply to the CPU to apply for bus control. If the CPU is allowed, the control is handed over, and therefore, when the data exchange, the bus control is grasped by the DMA controller, after the transmission ends, The DMA controller returns the bus to the CPU. Second, the common interface 1. Currently, the parallel interface in the computer mainly acts as a printer port, and the interface is no longer a 36-pin connector but a 25-pin D couple. The "parallel" means that 8-bit data is transmitted simultaneously through a parallel line, so that the data transfer speed is greatly improved, but the length of the line transmitted in parallel is limited, since the length increases, the interference will increase, it is easy to errone. There are now five common parallel ports: 4-bit, 8-bit, half 8, EPP, and ECP, most PCs are equipped with 4 or 8-bit parallel ports, many portable ports with Intel386 chipset with EPP port, support All IEEE1284 Parallel Specifications Computers are equipped with ECP parallel ports. Standard parallel port 4, 8-bit, half 8 bits: 4 bits can only be input at a time, but 8-bit data can be output; 8-bit port can be input and output at one time; half 8 bits can also be. EPP port (enhanced parallel port): Developed by companies such as Intel, allowing 8 bidirectional data transfer, which can be connected to various non-printer devices such as scanners, LAN adapters, disk drives, and CDROM drives. ECP port (extended parallel port): Developed by Microsoft, HP, support command cycle, data cycle, and multiple logical devices, which can be used in multi-task environments (direct storage access). At present, almost all 586 machines have integrated parallel port sockets, labeled paralle1 or lpt1, is a 26-pin double-pin socket. 2. Another standard interface of a serial interface computer is a serial port, and now the PC generally has at least two serial ports COM1 and COM2. The serial port is different from the parallel port in that its data and control information are transmitted in a bit. In this way, although the speed is slow, the transfer distance is longer than in parallel, so the long-distance communication should use serial ports. Typically COM1 uses a 9-pin D-shaped connector, while COM2 uses a vintage DB25 pin connector. 3. Disk interface 1) IDE interface IDE interface is also called ATA ports, only two hard drives that do not exceed 528m, and the cost is very low, so it is very popular at 386,486. However, most IDE interfaces do not support DMA data transmission, and only standard PCI / O port instructions can be used to transmit all commands, status, and data.
Almost all 586 motherboards have integrated two 40-pin two-pin pin ID interface socket, respectively, respectively, IDE1 and IDE2, respectively. 2) The EIDE interface EIDE interface has great improvements compared with the IDE interface, which is the most popular interface. First, the periphery it supports no longer two but 4, the supported device except the hard disk, and also includes a CD-ROM drive disk backup device. Second, the EIDE standard cancels 528MB restrictions, and in order to limit 8GP. Third, EIDE has a higher data transfer rate, supports PIO mode 3 and mode 4 standards. 4. SCSI Interface SCSI (SmallComputersystemInterface Small Computer System Interface, the hard disk of the SCSI interface is widely used in a computer that makes graphics processing and network services. In addition to the hard disk, the SCSI interface can also connect to the CD-ROM drive, scanner, and printer, etc., which have the following features: * Can connect to 7 peripherals simultaneously; * The bus is configured to parallel 8 bits, 16-bit or 32 bits; * Allow The maximum hard disk space is 8.4GB (some have reached 9.09GB); * Higher data transfer rate, IDE is 2MB per second, SCSI usually reaches 5MB per second, FastScsi (SCSI-2) can reach 10MB per second, the latest SCSI-3 can even reach 40MB per second, and EIDE can only reach 16.6MB per second; * cost is much higher than IDE and EIDE interface, and the SCSI interface hard disk must be used in conjunction with the SCSI interface card, SCSI interface card is more than IED And the EIDE interface is much more expensive. * The SCSI interface is intelligent, can communicate with each other without increasing the burden of the CPU. When transmitting data between IDE and EIDE devices, the CPU must be intervened, while the SCSI device actively acts in the data transfer process, and can be implemented in the SCSI bus until the CPU is notified. 5. The latest USB serial interface standard forUSB interface is jointly launched by major companies such as Microsoft, Intel, Compaq, IBM. It provides hot plug-and-play connection outside the chassis. Users do not have to open the chassis when connecting peripherals. The power supply, but uses a "cascaded" mode, each USB device is connected to a USB plug to a peripheral USB outlet, and itself provides a USB socket to the next USB device, through this way A USB controller can be connected to 127 peripherals, while the distance between each peripheral is 5 meters. The USB unified 4-pin round plug will replace a plurality of string / parallel (mouse, modem) keyboard after the chassis. USB can intelligently identify insertion or removal of peripheral devices on the USB chain. In addition to enabling keyboards, mice, etc., USB can also connect to low-speed peripherals such as ISDN, telephone system, digital audio, printer, and scanner. Third, I / O expansion slot I / O expansion slot, the path to I / O signal transmission, is the extension of the system bus, can insert any standard option, such as display card, decompression card, MODEM card, and sound card, etc.. With the I / O expansion slot, the CPU can be read and written for all I / O interface chips connected to the channel. Depending on the type of bus, the expansion slots on the motherboard can be divided into several ISA, EISA, MAC, VESA and PCI. 1) ISA slot black, divided into 8 bits, 16 bits. The 16-bit expansion slot can insert an 8-bit and 16-bit control card, but the 8-bit expansion slot can only pop up 8 digits.