芯路恒电子技术论坛

 找回密码
 立即注册
热搜: 合集
查看: 6442|回复: 1

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

[复制链接]
  • TA的每日心情
    慵懒
    2021-2-24 10:16
  • 422

    主题

    780

    帖子

    1万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    积分
    15846
    QQ
    发表于 2019-1-17 15:05:59 | 显示全部楼层 |阅读模式
    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.

    回复

    使用道具 举报

  • TA的每日心情
    慵懒
    2021-2-24 10:16
  • 422

    主题

    780

    帖子

    1万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    积分
    15846
    QQ
     楼主| 发表于 2019-1-17 21:33:51 | 显示全部楼层
    纯英文的,翻译过来就懂了,是的,你没猜错,这是我复制粘贴的,不是我写的
    回复 支持 反对

    使用道具 举报

    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    QQ|小黑屋|Archiver|芯路恒电子技术论坛 |鄂ICP备2021003648号

    GMT+8, 2024-4-19 01:27 , Processed in 0.123111 second(s), 32 queries .

    Powered by Discuz! X3.4

    © 2001-2017 Comsenz Inc. Template By 【未来科技】【 www.wekei.cn 】

    快速回复 返回顶部 返回列表