PIC 、APIC(IOAPIC LAPIC)

发布者:cloudsousou6最新更新时间:2015-08-21 来源: eefocus关键字:PIC  APIC  IOAPIC  LAPIC 手机看文章 扫描二维码
随时随地手机看文章
1. Overview

 

PIC全称Programmable Interrupt Controller,通常是指Intel 8259A双片级联构成的最多支持15个interrupts的中断控制系统。APIC全称Advanced Programmable Interrupt Controller,APIC是为了多核平台而设计的。它由两个部分组成IOAPIC和LAPIC,其中IOAPIC通常位于南桥中 用于处理桥上的设备所产生的各种中断,LAPIC则是每个CPU都会有一个。IOAPIC通过APICBUS(现在都是通过FSB/QPI)将中断信息分派给每颗CPU的LAPIC,CPU上的LAPIC能够智能的决定是否接受系统总线上传递过来的中断信息,而且它还可以处理Local端中断的pending、nesting、masking,以及IOAPIC于Local CPU的交互处理。

                                                                                              

2. PIC

 

基于Intel 80x86的PC使用两片8259A级联的方式组成了可以管理15级中断向量的一个中断系统,下图是它的一个连接示意图。两片8259A,一片为Master,另一片为Slaver。其中Slaver的INT接到Master的IRQ2上。8259A有两种工作模式分别为编程和操作模式。BIOS初始化的时候会先通过IO port对8259A进行编程配置,在此之后8259A就可以响应来自外部设备的中断请求了。Master的IO address是0x20 0x21; Slaver的IO address是0xA0 0xA1。

 

 

 

为了能够正常的使用PIC来管理系统中断,就需要对它进行初始化。8259A支持两种类型的命令字,一类是初始化命令字ICW1~4,另一类是操作命令字OCW1~3,其中每一个命令字的各个bit都有其代表的特定意义。下述是一个初始化Master的一个sample code:

 

MOV  AL,00010001b       ;级联,边沿触发,需要写ICW4

OUT  20H,AL            ;写ICW1

MOV  AL,01000000B ;中断类型号40H

OUT  21H,AL            ;写ICW2

MOV      AL,00000100B;主片的IR2引脚从片

OUT       21H,AL         ;写ICW3

MOV      AL,00010001B;特殊完全嵌套,非缓冲,自动结束

OUT       21H,AL         ;写ICW4

 

3. APIC

 

Intel APIC由一组中断输入信号,一个24*64bit的Programmable Redirection Table(PRT),一组register和用于从APIC BUS(FSB/QPI)上传送APIC MSG的部件组成,当南桥的IO device通过IOAPIC的interrupt lines产生interrupt,IOAPIC将根据内部的PRT table格式化成中断请求信息,并将该信息发送给目标CPU的LAPIC,再由LAPIC通知CPU进行处理。下图是一个基于Intel APIC的连接示意图,如下图所示IOAPIC上有24个interrupt pin,每一个pin都对应一个RTE,所以针对每一个interrupt pin都可以单独设定它的mask,触发方式(level,edge trigger),中断管脚的极性,传送方式,传送状态,目的地,中断向量等。

 

 

Programmable Redirection Table详细格式如下所示:

 

Bit Description:

[63:56] Destination Field—R/W.  If the Destination Mode of this entry is Physical Mode (bit 11=0), bits

[59:56] contain an APIC ID. If Logical Mode is selected (bit 11=1), the Destination Field

potentially defines a set of processors. Bits [63:56] of the Destination Field specify the logical

destination address.

Destination Mode IOREDTBLx[11] Logical Destination Address

0, Physical Mode IOREDTBLx[59:56] = APIC ID

1, Logical Mode IOREDTBLx[63:56] = Set of processors

[55:17] Reserved.82093AA (IOAPIC)

[16] Interrupt Mask—R/W.  When this bit is 1, the interrupt signal is masked. Edge-sensitive

interrupts signaled on a masked interrupt pin are ignored (i.e., not delivered or held pending).

Level-asserts or negates occurring on a masked level-sensitive pin are also ignored and have no

side effects. Changing the mask bit from unmasked to masked after the interrupt is accepted by

a local APIC has no effect on that interrupt. This behavior is identical to the case where the

device withdraws the interrupt before that interrupt is posted to the processor. It is software's

responsibility to handle the case where the mask bit is set after the interrupt message has been

accepted by a local APIC unit but before the interrupt is dispensed to the processor. When this

bit is 0, the interrupt is not masked. An edge or level on an interrupt pin that is not masked

results in the delivery of the interrupt to the destination.

[15] Trigger Mode—R/W.  The trigger mode field indicates the type of signal on the interrupt pin that triggers an interrupt. 1=Level sensitive, 0=Edge sensitive.

[14] Remote IRR—RO.  This bit is used for level triggered interrupts. Its meaning is undefined for edge triggered interrupts. For level triggered interrupts, this bit is set to 1 when local APIC(s) accept the level interrupt sent by the IOAPIC. The Remote IRR bit is set to 0 when an EOI message with a matching interrupt vector is received from a local APIC.

[13] Interrupt Input Pin Polarity (INTPOL)—R/W.  This bit specifies the polarity of the interrupt

signal. 0=High active, 1=Low active.

[12] Delivery Status (DELIVS)—RO.  The Delivery Status bit contains the current status of the

delivery of this interrupt. Delivery Status is read-only and writes to this bit (as part of a 32 bit

word) do not effect this bit. 0=IDLE (there is currently no activity for this interrupt). 1=Send

Pending (the interrupt has been injected but its delivery is temporarily held up due to the APIC

bus being busy or the inability of the receiving APIC unit to accept that interrupt at that time).

[11] Destination Mode (DESTMOD)—R/W.  This field determines the interpretation of the

Destination field. When DESTMOD=0 (physical mode), a destination APIC is identified by its ID.

Bits 56 through 59 of the Destination field specify the 4 bit APIC ID. When DESTMOD=1 (logical mode), destinations are identified by matching on the logical destination under the control of theDestination Format Register and Logical Destination Register in each Local APIC.

Destination Mode IOREDTBLx[11] Logical Destination Address 0, Physical Mode IOREDTBLx[59:56] = APIC ID1, Logical Mode IOREDTBLx[63:56] = Set of processorsE 82093AA (IOAPIC)

[10:8]Delivery Mode (DELMOD)—R/W.  The Delivery Mode is a 3 bit field that specifies how the APICs listed in the destination field should act upon reception of this signal. Note that certain

Delivery Modes only operate as intended when used in conjunction with a specific trigger Mode.

These restrictions are indicated in the following table for each Delivery Mode.

Mode Description

000       Fixed Deliver the signal on the INTR signal of all processor cores listed in the

destination. Trigger Mode for "fixed" Delivery Mode can be edge or level.

001       Lowest

Priority Deliver the signal on the INTR signal of the processor core that is

executing at the lowest priority among all the processors listed in the

specified destination. Trigger Mode for "lowest priority". Delivery Mode

can be edge or level.

010       SMI System Management Interrupt. A delivery mode equal to SMI requires an

edge trigger mode. The vector information is ignored but must be

programmed to all zeroes for future compatibility.

011       Reserved

100       NMI Deliver the signal on the NMI signal of all processor cores listed in the

destination. Vector information is ignored. NMI is treated as an edge

triggered interrupt, even if it is programmed as a level triggered interrupt.

For proper operation, this redirection table entry must be programmed to

“edge” triggered interrupt.

101       INIT Deliver the signal to all processor cores listed in the destination by

asserting the INIT signal. All addressed local APICs will assume their

INIT state. INIT is always treated as an edge triggered interrupt, even if

programmed otherwise. For proper operation, this redirection table entry

must be programmed to “edge” triggered interrupt.

110       Reserved

111       ExtINT Deliver the signal to the INTR signal of all processor cores listed in the

destination as an interrupt that originated in an externally connected

(8259A-compatible) interrupt controller. The INTA cycle that corresponds

to this ExtINT delivery is routed to the external controller that is expected

to supply the vector. A Delivery Mode of "ExtINT"  requires an edge

trigger mode.

[7:0] Interrupt Vector (INTVEC)—R/W:  The vector field is an 8 bit field containing the interrupt

vector for this interrupt. Vector values range from 10h to FEh.

 

REFF:

 

1.  《82093AA I/O ADVANCED PROGRAMMABLE INTERRUPT CONTROLLER (IOAPIC)》

2.  《8259A PROGRAMMABLE INTERRUPT CONTROLLER(8259A/8259A-2)》

3.  《Undocumented PC》

4.   8259A初始化编程

 

That’s all!

关键字:PIC  APIC  IOAPIC  LAPIC 引用地址:PIC 、APIC(IOAPIC LAPIC)

上一篇:PCI-X总线简介
下一篇:DDR,DDR2,DDR3,FSB总线,HT总线的频率图

推荐阅读最新更新时间:2024-05-02 23:54

【视频】8位PIC® MCU简介
介绍Microchip 8位PIC MCU
[单片机]
PIC16F877A流水灯Proteus仿真程序
单片机源程序如下: //流水灯 #include pic.h //头文件 __CONFIG(0xff32); //配置熔丝位 //延时函数 void delay(unsigned int x) { unsigned int i,j; for(i=0;i x;i++) for(j=0;j 100;j++); } //主函数 void main() { unsigned char i,a; //设置变量 TRISB=0; //设置端口B为输出 PORTB=0;
[单片机]
<font color='red'>PIC</font>16F877A流水灯Proteus仿真程序
PIC24 通过USB在线升级 -- USB HID bootloader
开发环境 1. IDE: MPLABX v4.01 2. Compiler: XC16, v1.11 3. Library & Example: c:/microchip_solutions_v2013-06-15/USB/Device - Bootloaders/HID/Firmware - PIC24FJ256GB110 Family/MPLAB.X 这个PIC24 HID bootloader 是在MLA_v2013-06-15的Device Bootloader的基础上修改而成的。 bootloader和应用程序的空间分配以及Linker Script的修改是参考以下帖子http://www.microchip.c
[单片机]
<font color='red'>PIC</font>24 通过USB在线升级 -- USB HID bootloader
PIC中使用常数指针
在PIC中使用常数指针 常数指针使用非常灵活,可以给编程带来很多便利。 我测试过,PICC也支持常数指针,并且也会自动分页,实在是一大喜事。 定义一个指向8位RAM数据的常数指针(起始为0x00): #define DBYTE ((unsigned char volatile *) 0) 定义一个指向16位RAM数据的常数指针(起始为0x00): #define CWORD ((unsigned int volatile *) 0) ((unsigned char volatile *) 0)中的0表示指向RAM区域的起始地址,可以灵活修改它。 DBYTE 中的x表示偏移量。 下面是一段代码1: char
[单片机]
PIC单片机的多机无线通信系统设计
现代通信技术的迅速发展使得许多应用领域都采用无线的通信方式进行数据传输。编解码芯片PT2262、PT2272组成的电路,由于具有体积小、功耗低、功能强、成本低等特点,广泛应用于各类的无线遥控器、无线报警器以及玩具等其他小型电器装置。但是,这种电路极少用在多个字节数据的通信方面,具有一定的局限性。本文主要介绍利用433 MHz高频发射模块和接收模块来制作多机无线ASCII码格式的短信通信。该通信方式是在433MHz高频发射模块和接收模块的基础上自己定义无线传输协议,实现任意两机之间的多个字节数据通信。 1 硬件系统设计 本系统主要由PIC16F877A单片机构成控制系统,周围4个模块分别是:按键输入模块、显示输出模块、接
[单片机]
<font color='red'>PIC</font>单片机的多机无线通信系统设计
PIC单片机在神经刺激器中的应用
一、概述 生命系统中的神经、肌肉都是可兴奋组织,对于外界一定的刺激会发生反应,这种反应表现为神经冲动、肌肉收缩、血管张弛等等。 外周神经刺激器就是用于外科手术麻醉过程中,通过刺激外周神经引起病人的肌肉颤搐来观察肌松药效的一种仪器。如果麻醉不深,用刺激器刺激前臂的尺神经,会引起姆指的内收动作;如果麻醉进入深度,则姆指的内收动作就会消失。 外周神经刺激器的刺激脉搏宽是200us,电流强度在10mA--60mA分六档可调,它具有四种不同的工作方式: (1)单刺激(TWH)。刺激周期为1秒, (2)四次成串刺激(TOF)。刺激周期为15秒, (3)双重强直刺激(DBS)。刺激周期为15秒,(4)强直刺激后计数(PTC)。频
[单片机]
<font color='red'>PIC</font>单片机在神经刺激器中的应用
讨论PIC单片机软件异步串行口实现方法
  在用单片机开发各种嵌入式应用系统时,异步串行通信是经常要用到的一种通信模式,很多应用中还要求实现多路异步串行通信。大家平时熟悉的各种厂家的单片机,绝大部分片上只提供一个硬件UART模块,利用它可以方便实现一路串行通讯。PIC系列单片机也不例外,在其丰富的产品家族成员中,除高端系列(PIC17/18)一些型号片上带有两路硬件UART模块外,其它大部分型号片上只有一路UART,一些低端廉价的PIC单片机甚至还不带硬件UART。为了提高系统的性能价格比,就要求设计工程师用软件增加实现一路或多路异步串行通信。很多工程师对用软件实现的UART在可靠性和效率方面持怀疑态度,其实关键问题是看软件采用何种方式来实现可靠的UART功能。   
[单片机]
讨论<font color='red'>PIC</font>单片机软件异步串行口实现方法
基于PIC的FSK/ASK超外差收发机的设计
  基于FSK/ASK的超外差收发机在远程无线进入、汽车胎压检测、无线传感器等方面都有很广泛的应用。本文以PICl6F819和MAXl471、MAXl479为基本部件,设计并实现FSK/ASK超外差射频收发机的过程。 1 元器件的选择 (1)控制器的选择   在本系统设计中,需要涉及到以下几个方面:处理器性能、所支持的开发工具、处理器的成本和功耗.综合以上几个方面考虑,微控制器选择Microchip公司的一款高性价比的8位微控制器PICl6F819。PICl6FSl9采用20脚贴片封装,在线方式进行程序调试和烧写;可采用内部晶振,工作频率可选31 kHz~8 MHz;工作电压从2~5.5V;正常工作时使用2V电压供电、使用内部晶
[网络通信]
小广播
最新嵌入式文章
何立民专栏 单片机及嵌入式宝典

北京航空航天大学教授,20余年来致力于单片机与嵌入式系统推广工作。

换一换 更多 相关热搜器件
随便看看
电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号 Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved