Dec 14
目标: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: ,
分页: 1/1 第一页 1 最后页 [ 显示模式: 摘要 | 列表 ]