前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >【分享】通过MIO接入外设中断.md

【分享】通过MIO接入外设中断.md

作者头像
hankfu
发布2020-12-01 10:32:03
5900
发布2020-12-01 10:32:03
举报
文章被收录于专栏:hankhankhank

Zynq-7000和MPSoC有很多MIO管脚。如果外设有中断,也可以通过MIO驱动。

GPIO中断控制器

按下列模式,在GPIO的设备树里声明为中断控制器

&gpio0 {
        #interrupt-cells = <2>;
        interrupt-controller;
};

外设使用GPIO中断控制器

外设的设备树里,添加下列行,声明gpio0为自己的中断控制器,并声明对应的MIO引脚和中断内心。

touchscreen@0 {
    interrupt-parent = <&gpio0>;
    interrupts = <52 2>;          /* MIO 52, falling edge */
};

检查结果

单板启动后,可以检查启动信息和中断信息。

# dmesg | grep ads
ads7846 spi32766.0: touchscreen, irq 148
 
# cat /proc/interrupts
CPU0 CPU1
148: 21 1 zynq-gpio 52 ads7846

文档

GPIO的中断说明,在Linux的文件Documentation/devicetree/bindings/gpio/gpio-zynq.txt里。

中断的相关信息如下:

- interrupt-controller   : Marks the device node as an interrupt controller.
- #interrupt-cells : Should be 2.  The first cell is the GPIO number.
                       The second cell bits[3:0] is used to specify trigger type and level flags:
                           1 = low-to-high edge triggered.
                           2 = high-to-low edge triggered.
                           4 = active high level-sensitive.
                           8 = active low level-sensitive.

参考文档

https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/18842482/Device+Tree+Tips

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2020-11-27 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • GPIO中断控制器
  • 外设使用GPIO中断控制器
  • 检查结果
  • 文档
  • 参考文档
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档