Peripherals and busses

 

Peripherals and busses

Peripherals are any of the many external devices that connect to your computer. Obviously, the processor must have some way of talking to the peripherals to make them useful.

The communication channel between the processor and the peripherals is called a bus. The devices directly connected to the processor use a type of bus called Peripheral Component Interconnect, commonly referred to as PCI.

PCI Bus

PCI transfers data between the device and memory, but importantly allows for the automatic configuration of attached peripherals. The configuration broadly falls into two categories

Interrupts

An interrupt allows the device to literally interrupt the processor to flag some information. For example, when a key is pressed, an interrupt is generated and delivered to the CPU. An interrupt (called the IRQ) is assigned to the device on system boot by the system BIOS.

When the device wants to interrupt, it will signal to the processor via raising the voltage of interrupt pins. The processor will acknowledge the interrupt, and pass the IRQ onto the operating system. This part of the operating system code is called the interrupt handler.

The interrupt handler knows what to do with the interrupt as when each device driver initialises it will register its self with the kernel to accept the interrupt from the peripheral it is written for. So as the interrupt arrives it is passed to the driver which can deal with the information from the device correctly.

Most drivers will spilt up handling of interrupts into bottom and top halves. The bottom half will acknowledge the interrupt and return the processor to what it was doing quickly. The top half will then run later when the CPU is free and do the more intensive processing. This is to stop an interrupt hogging the entire CPU.

IO Space

Obviously the processor will need to communicate with the peripheral device, and it does this via IO operations. The most common form of IO is so called memory mapped IO where registers on the device are mapped into memory.

This means that to communicate with the device, you need simply read or write to a specific address in memory. TODO: expand

DMA

Since the speed of devices is far below the speed of processors, there needs to be some way to avoid making the CPU wait around for data from devices.

Direct Memory Access (DMA) is a method of transferring data directly between an peripheral and system RAM.

The driver can setup a device to do a DMA transfer by giving it the area of RAM to put it's data into. It can then start the DMA transfer and allow the CPU to continue with other tasks.

Once the device is finished, it will raise an interrupt and signal to the driver the transfer is complete. From this time the data from the device (say a file from a disk, or frames from a video capture card) is in memory and ready to be used.

Other Busses

Other busses connect between the PCI bus and external devices. Some you will have heard of

  • USB/Firewire for small external data devices.

  • IDE/SCSI for disk drives.


 

 

the oringinal link: http://bottomupcs.sourceforge.net/csbu/x1645.htm

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值