【实验指导】如何查看SoC FPGA的系统中FPGA侧添加的GPIO的编号

本文由FPGA爱好者小梅哥编写,未经作者许可,本文仅允许网络论坛复制转载,且转载时请标明原作者。

 

Application to register interrupt and write simple interrupt service routine

----------------------------------------------------------------------------
Detect user input from push button / DIP switch:
        modprobe gpio_interrupt gpio_number=<n>

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:<gpio_number>" will be printed on the
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=<n>" again

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.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值