低级别的I / O访问使用OUTB和INB [英] Low level I/O access using outb and inb

查看:574
本文介绍了低级别的I / O访问使用OUTB和INB的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到困难时期试图了解如何中断的工作。

i'm having hard time trying to understand how interrupts work.

低于code初始化可编程中断控制器

the code below initialize the Programmable Interrupt Controller

  #define PIC0_CTRL 0x20    /* Master PIC control register address. */
  #define PIC0_DATA 0x21    /* Master PIC data register address. */

  /* Mask all interrupts*/
  outb (PIC0_DATA, 0xff);

  /* Initialize master. */
  outb (PIC0_CTRL, 0x11); /* ICW1: single mode, edge triggered, expect ICW4. */
  outb (PIC0_DATA, 0x20); /* ICW2: line IR0...7 -> irq 0x20...0x27. */
  outb (PIC0_DATA, 0x04); /* ICW3: slave PIC on line IR2. */
  outb (PIC0_DATA, 0x01); /* ICW4: 8086 mode, normal EOI, non-buffered. */

  /* Unmask all interrupts. */
  outb (PIC0_DATA, 0x00);

有人可以给我解释一下它是如何工作:

can someone explain to me how it works:

OUTB的-the作用(我不明白Linux手册)

-the role of outb (i didn't understand the linux man)

-the地址和它们的意思

-the addresses and their meaning

另一个不相关的问题,我读到OUTB和INB是端口映射I / O,我们可以使用内存映射I / O做输入/输出通讯?

another unrelated question,i read that outb and inb are for port-mapped I/O, can we use memory-mapped I/o for doing Input/output communication?

感谢。

推荐答案

OUTB()写它的第二个参数所指定的I / O端口指定的字节其第一个参数。在这种情况下,一个端口是CPU通信与另一芯片的装置。

outb() writes the byte specified by its second argument to the I/O port specified by its first argument. In this context, a "port" is a means for the CPU to communication with another chip.

在特定的C code,你present涉及8259A可编程中断控制器(PIC)。

The specific C code that you present relates to the 8259A Programmable Interrupt Controller (PIC).

您可以阅读有关PIC 这里和的这里

You can read about the PIC here and here.

如果没有提供足够的细节来理解的命令和位掩码,你总是可以参考芯片的数据表

If that doesn't provide enough details to understand the commands and the bit masks, you could always refer to the chip's datasheet.

这篇关于低级别的I / O访问使用OUTB和INB的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆