


下載本文檔
版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領
文檔簡介
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的下降沿觸發(fā)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中斷配置中斷源和中斷觸發(fā)類型,并綁定到客戶自己定義的中斷處理函數,并使能中斷。 使用示例: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. 未經權益所有人同意不得將文件中的內容挪作商業(yè)或盈利用途。
- 5. 人人文庫網僅提供信息存儲空間,僅對用戶上傳內容的表現方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
- 6. 下載文件中如有侵權或不適當內容,請與我們聯系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 2024-2025學年六年級下學期數學三 《反比例》教案
- 2025年婚前協議書正確模板
- 人教版八年級上冊 歷史與社會 教學設計 1.2中華早期國家與社會變革
- (高清版)DB45∕T 566-2020 汽車旅游營地星級劃分
- 2025年衡水健康科技職業(yè)學院單招職業(yè)適應性測試題庫審定版
- 2025年河南工業(yè)貿易職業(yè)學院單招職業(yè)技能測試題庫1套
- 期中綜合練習-三年級數學下冊(含答案)北師大版
- 2024年多媒體電腦超聲診斷儀項目資金籌措計劃書代可行性研究報告
- 2025年黑龍江省伊春市單招職業(yè)傾向性測試題庫1套
- 語文-四川省金太陽2025屆高三2月開學考試試題和答案
- 【道 法】學會自我保護+課件-2024-2025學年統(tǒng)編版道德與法治七年級下冊
- 2025屆高考英語讀后續(xù)寫提分技巧+講義
- 買房協議書樣板電子版
- 河南航空港發(fā)展投資集團有限公司2025年社會招聘題庫
- 綿陽市高中2022級(2025屆)高三第二次診斷性考試(二診)語文試卷(含答案)
- 常州初三強基數學試卷
- 《吞咽障礙膳食營養(yǎng)管理規(guī)范》(T-CNSS 013-2021)
- 《經濟學的研究方法》課件
- 2024年青海省中考生物地理合卷試題(含答案解析)
- 2019譯林版高中英語全七冊單詞總表
- 2024年中鐵集裝箱運輸有限責任公司招聘筆試參考題庫附帶答案詳解
評論
0/150
提交評論