下載本文檔
版權(quán)說(shuō)明:本文檔由用戶(hù)提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、GPIO中斷使用說(shuō)明1. GPIO的配置一共有四組GPIO基址寄存器:Base Address: GPIO 0: 0 xD401_9000 (對(duì)應(yīng)GPIO0_31)Base Address: GPIO 1: 0 xD401_9004 (對(duì)應(yīng)GPIO32_63)Base Address: GPIO 2: 0 xD401_9008 (對(duì)應(yīng)GPIO64_95)Base Address: GPIO 3: 0 xD401_9100 (對(duì)應(yīng)GPIO96_127) 需要配置GPIO的三個(gè)寄存器: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設(shè)置對(duì)應(yīng)GPIO的方向?yàn)檩斎耄籊PIO 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使能對(duì)應(yīng)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打開(kāi)對(duì)應(yīng)GPIO的邊沿探測(cè)使用示例(GPIO23,對(duì)應(yīng)的基址寄存器是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(中斷控制器)的配置使能中斷控制器組中對(duì)應(yīng)于GPIO的中斷源寄存器(GPIO是中斷控制器中第55個(gè)中斷 源,地址是中斷控制器的基址+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ā)類(lèi)型,并綁定到客戶(hù)自己定義的中斷處理函數(shù),并使能中斷。 使用示例: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. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶(hù)所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶(hù)上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶(hù)上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶(hù)因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 留置導(dǎo)尿管產(chǎn)品原材料供應(yīng)與需求分析
- 生化分析儀器商業(yè)機(jī)會(huì)挖掘與戰(zhàn)略布局策略研究報(bào)告
- 音視頻測(cè)試儀產(chǎn)品市場(chǎng)需求分析報(bào)告
- 觸變劑產(chǎn)品市場(chǎng)需求分析報(bào)告
- 豪華游輪產(chǎn)品營(yíng)銷(xiāo)計(jì)劃書(shū)
- 香薰市場(chǎng)需求與消費(fèi)特點(diǎn)分析
- 高職高專(zhuān)高等數(shù)學(xué)教案設(shè)計(jì)
- 超聲外科手術(shù)儀產(chǎn)品營(yíng)銷(xiāo)計(jì)劃書(shū)
- 直鍍紙市場(chǎng)需求與消費(fèi)特點(diǎn)分析
- 玻璃溫度計(jì)市場(chǎng)發(fā)展預(yù)測(cè)和趨勢(shì)分析
- 人力資源許可證制度(服務(wù)流程、服務(wù)協(xié)議、收費(fèi)標(biāo)準(zhǔn)、信息發(fā)布審查和投訴處理)
- 開(kāi)具保函委托協(xié)議書(shū)范本
- 養(yǎng)成良好的飲食習(xí)慣教案 - 初中體育與健康教育賽課教學(xué)設(shè)計(jì)
- 第14課 絲綢之路的開(kāi)通與經(jīng)營(yíng)西域-2024-2025學(xué)年初中歷史七年級(jí)上冊(cè)同步課件
- DZ/T 0430-2023 固體礦產(chǎn)資源儲(chǔ)量核實(shí)報(bào)告編寫(xiě)規(guī)范(正式版)
- 中國(guó)神話(huà)故事繪本神農(nóng)嘗百草
- 2024春形勢(shì)與政策課件當(dāng)前國(guó)際形勢(shì)與中國(guó)原則立場(chǎng)
- GB/T 3565.6-2022自行車(chē)安全要求第6部分:車(chē)架與前叉試驗(yàn)方法
- 自然辯證法概論-北京化工大學(xué)中國(guó)大學(xué)mooc課后章節(jié)答案期末考試題庫(kù)2023年
- 《旅游學(xué)概論》教案
- DBJ∕T 15-60-2019 建筑地基基礎(chǔ)檢測(cè)規(guī)范
評(píng)論
0/150
提交評(píng)論