下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、GPIO中断使用说明1. GPIO的配置一共有四组GPIO基址寄存器:Base Address: GPIO 0: 0 xD401_9000 (对应GPIO0_31)Base Address: GPIO 1: 0 xD401_9004 (对应GPIO32_63)Base Address: GPIO 2: 0 xD401_9008 (对应GPIO64_95)Base Address: GPIO 3: 0 xD401_9100 (对应GPIO96_127) 需要配置GPIO的三个寄存器:GPIO Direction Register (GPIO_CDR, offset 0 x60)BitsNameT
2、ypeResetDescription31:0PDxw0 x0PDnSet GPIO port direction n (where n = 0 through 31)0 二 GPIO Pin Direction Register bit not affected1 二 GPIO Pin Direction Register bit is cleared and GPIIO n function is set to INPUT设置对应GPIO的方向为输入;GPIO Falling-Edge Detect Enable Register (GPIO_FERx, offset 0 x3C)Bits
3、NameTypeResetDescription31:0FexR.W0 x0FEnGPIO port falllling-edge detect enable n (where n = 0 through 31)0 二 Disable falling-edge detect enable1 = Set corresponding GPIO Edge Detect Status Register status bit when a falling edge is detected on the GPIO port使能对应GPIO的下降沿触发Modem ARM*(Seagull) Core Bit
4、-wise Mask of GPIO Edge Detect Register (CPMASK_REG, offset 0 xA8)BitsNameTypeReetDescription31:0PDxRnv0 x0PDnMask GPIO Edge detect n (where n = 0 through 31) 0 = GPIO Edge detects are masked1 = GPIO Edge detects are not masked打开对应GPIO的边沿探测使用示例(GPIO23,对应的基址寄存器是GPIO 0: 0 xD401_9000): volatile unsigne
5、d long * r;/set GPIO_CDR, set GPIO23 direction as inputr = (volatile unsigned long*)(0 xD4019000 + 0 x60);*r = (1 23);/set GPIO_FERx, set GPIO23 Falling-Edge enable r = (volatile unsigned long*)(0 xD4019000 + 0 x3C);/set CPMASK_REG, set GPIO23 Edge detects are not masked r = (volatile unsigned long*
6、)(0 xD4019000 + 0 xA8);*r |= (123);2. ICU(中断控制器)的配置使能中断控制器组中对应于GPIO的中断源寄存器(GPIO是中断控制器中第55个中断 源,地址是中断控制器的基址+55*4)BitsNameTypeResetDescription317ReservedRSVDReserved. Always write 0. Ignore read value.6MOHAWKJNTR/W0 x1Mohawk PJ1 Core InterruptMohawk PJ1 Core Interrupt1 = Route to Mo hawk PJ1 Core Inte
7、rrupt5SEAGULL_INTR/W0 x1Modem ARM* (Seagull) Core InterruptModem ARM* (Seagull) Core Interrupt1 = Route to Modem ARM* (Seagull) Core InterruptIRQ_FIQR/W0 x0IRQ/FIQIRQ/FIQ1 二 Route to IRQ0 二 Route to FIQ3:0PRIORITY_MASKINR/W0 x0Priority/M askingPriority/Mias kingOxF to 0 x1 二 Interrupt arbitration pr
8、iority0 x0 = Interrupt is masked使用示例:/enable icu gpio intr = (volatile unsigned long*)(0 xD4282000 + 55*4);*r = 0 x3F;3.配置并使能GPIO中断配置中断源和中断触发类型,并绑定到客户自己定义的中断处理函数,并使能中断。 使用示例:INTCConfigure(INTC_SRC_GPIO_COMBINED_CP, INTC_IRQ, INTC_FALLING_EDGE);/user defined ISR: gpio_test_isrINTCBind(INTC_SRC_GPIO_C
9、OMBINED_CP, gpio_test_isr);INTCEnable(INTC_SRC_GPIO_COMBINED_CP);4. GPIO Edge Detect Status Register The GPIO Edge Detect Status Registers (GPIO_EDRO, GPIO_EDR1, GPIO_EDR2, and GPIO_ EDR3) contain a total of 128 status bits that correspond to the 128 GPIO ports.These registers contain one edge detec
10、t status bit for each of the 128 ports. GPIO_EDRO31:0 correspond to GPIO31:0. GPI0_EDR1 31:0 correspond to GPIO63:32.GPIO_EDR231:0 correspond to GPIO95:64.GPIO_EDR331:0 correspond to GPIO127:96When an edge-detect occurs on a port that matches the type of edge programmed in the GPIO Rising-Edge Detec
11、t Enable and/or GPIO Falling-Edge Detect Enable Registers, the corresponding status bit is set in this register. Once a bit is set in this register the CPU must clear it. Status bits in this register are cleared by writing a 11 to them. Writing a 0 has no effect.Each edge-detect that sets the corres
12、ponding status bit in this register for GPIO ports 0 - 127 can trigger an interrupt request, ports 2-127 together form a group that can cause one interrupt request to be triggered when any one of the status bits 2 -127 in this register is set. GPIO ports 0 and 1 each cause their own, independent fir
13、st-level interrupt. This register shows the GPIO_EDRO bit locations.Table 668: GPIO Edge Detect Status Register (GPIO_EDR) Offset: 0 x0048BitsField(Short)TypeI nit VaiDescription31:0EDn(Edx)RW1C 0 x0GPIO edge detect status n (where n = 0 through 31)0 = No edge detect has occurred on the port as specified in GPIO Rising-Edge Detect Enable and/or GPIO FallingEdge Detect Enable Registers1 = Edge detect has occurred on the port as specified in the GPIO Rising-Edge Detect Enable and/or GPIO FallingEdge Detect Enable Registersvoid * GPIO_MylSR (void) 一if (Platfonn
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2021年银行从业资格(中级)《银行管理》考试题库及解析
- 重庆三峡学院《沙盘实训》2022-2023学年第一学期期末试卷
- 重庆人文科技学院《中小学美术教材研究》2022-2023学年第一学期期末试卷
- 《合肥商业租售价》课件
- 2024北京日坛中学高二(上)期中数学(教师版)
- 重庆三峡学院《工程力学》2022-2023学年第一学期期末试卷
- 重庆人文科技学院《教育学基础》2022-2023学年第一学期期末试卷
- 重庆人文科技学院《建模软件》2022-2023学年期末试卷
- 重庆财经学院《市场调查与预测》2022-2023学年第一学期期末试卷
- 重庆财经学院《进出口业务全流程对抗赛》2022-2023学年第一学期期末试卷
- 《检验检测机构资质认定评审准则》一般程序审查表
- 隧道的衬砌计算(85页清楚明了)
- 人教版八年级(初二)数学上册全册课件PPT
- Q∕GDW 10202-2021 国家电网有限公司应急指挥中心建设规范
- CNAS-CL01:2018(ISO17025:2017)改版后实验室首次内审及管理评审资料汇总
- 护理不良事件-PPT课件
- 必看励志电影介绍当幸福来敲门(影评)通用PPT课件
- 商业银行两地三中心数据容灾备份方案建议书
- 审核评估报告(课堂PPT)
- 体育运动中的二次函数
- 烹饪烹饪营养与卫生教案
评论
0/150
提交评论