完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
本文由FPGA爱好者小梅哥编写,未经作者许可,本文仅允许网络论坛复制转载,且转载时请标明原作者。
Application to register interrupt and write simple interrupt service routine ---------------------------------------------------------------------------- Detect user input from push button / DIP switch: modprobe gpio_interrupt gpio_number= When user presses the button or flips the dip switch, a message will be printed to kernel console. 1. If the user connects to the console on board using serial connection, the message "Interrupt happened at gpio: console. 2. If the user connects to the console on board using ssh, the message can be viewed from kernel log via "dmesg" command. Note: User will need to do "rmmod gpio_interrupt" prior in order to change gpio_number by calling "modprobe gpio_interrupt gpio_number= User will need to get the GPIO number from /sys/class/gpio/ by using command 'ls'. E.g. root@socfpga~:# ls /sys/class/gpio/ gpiochip150 gpiochip152 gpiochip156 gpiochip160 gpiochip192 gpiochip224 From the listing, n can be obtained. The GPIO number may vary for different design with different device tree entries; this is due to the GPIO numbers are auto-assign by the kernel. To confirm the n is associated to which peripheral, user needs to match the label of the GPIO chip to the address of push button and DIP switch in device tree. e.g. root@socfpga~:# cat /sys/class/gpio/gpiochip150/label /sopc@0/bridge@0xc0000000/gpio@0x1000100C0 In this reference design, DIP switch is at address 0x10080 while the push button is at address 0x100c0. So in this case GPIO number 150 - 151 are allocated to push button 0 - 1. |
|
相关推荐
|
|
463 浏览 0 评论
312 浏览 0 评论
1039 浏览 0 评论
354 浏览 0 评论
FPGA零基础学习系列精选:半导体存储器和可编程逻辑器件简介
990 浏览 0 评论
1376 浏览 33 评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-4-20 11:34 , Processed in 0.555368 second(s), Total 55, Slave 44 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号