Dec 14

Simple MB Interrupt using GPIO 不指定

RickySu , 11:32 , 技术经验 , 评论(0) , 引用(0) , 阅读(650) , Via 本站原创 | |
目标:GPIO - Button 产生Interrupt。Interrupt处理函数中点亮LED

HW:Spartan 3E BSB + Button + LED + UART
手工添加OPB_INTC 1.00.c
连接Button - Interrupt Port到OPB_INTC - Intr Port
连接OPB_INTC - IRQ Port到 MicroBlaze - Interrupt Port

SW:
引用
Main:
1. Initialize LED, set LED direction
2. Initialize Button, set Button direction
3. Start interrupt controller
4. Enable button interrupt
5. Enable MicroBlaze interrupt
6. Register button ISR handler

button_int_handler:
1. Read GPIO_ISR
2. If GPIO_ISR = 1, read button status and set LED status
3. Clear interrupt


注:
如果在MSS文件中给peripheral driver添加int_handler parameter,就可以不需要在主程序内register ISR handler了。这个过程中要注意int_port的name是peripheral的pin name,不是signal name。
引用
BEGIN DRIVER
PARAMETER DRIVER_NAME = gpio
PARAMETER DRIVER_VER = 2.01.a
PARAMETER HW_INSTANCE = Buttons_4Bit
PARAMETER int_handler = button_int_handler, int_port = IP2INTC_IRPT
END


参考资料:
est_rm.pdf - Appendix B: Interrupt Management
Xapp778
GPIO Datasheet
psf_rm.pdf - Char 6 MSS - INT_HANDLER

附件包含MHS, MSS, BSB,  int1.c, xparameters.h

Tags: ,
发表评论
表情
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
打开HTML
打开UBB
打开表情
隐藏
记住我
昵称   密码   游客无需密码
网址   电邮   [注册]