zynq Linux软件中断,Linux Zynq GPIO中断
注册中断:对每一个pin进行循环遍历for (pin_num = 0; pin_num < min_t(int, ZYNQ_GPIO_NR_GPIOS, (int)chip->ngpio); pin_num++)node
gpio_irq = irq_find_mapping(irq_domain, pin_num); 将GPIO号映射为Linux系统中断号。app
在Linux中断系统中,一个irq_domain表示一个中断控制器,其内中断由0开始编号(尚存在疑问)dom
unsigned int irq_find_mapping(struct irq_domain *domain, irq_hw_number_t hwirq)函数
将一个中断控制器上的某个硬件中断映射为某个Linux系统中断。this
/**
* struct irq_domain - Hardware interrupt number translation object
* @link: Element in global irq_domain list.
* @name: Name of interrupt domain
* @ops: pointer to irq_domain methods
* @host_data: private data pointer for use by owner. Not touched by irq_domain
* core code.
*
* Optional elements
* @of_node: Pointer to device tree nodes associated with the irq_domain. Used
* when decoding device tree interrupt specifiers.
* @gc: Pointer to a list of generic chips. There is a helper function for
* setting up one or more generic chips for interrupt controllers
* drivers using the generic chip library which uses this pointer.
*
* Revmap data, used internally by irq_domain
* @revmap_direct_max_irq: The largest hwirq that can be set for controllers that
* support direct mapping
* @revmap_size: Size of the linear map table @linear_revmap[]
* @revmap_tree: Radix map tree for hwirqs that don't fit in the linear map
* @linear_revmap: Linear table of hwirq->virq reverse mappings
*/
struct irq_domain {
struct list_head link;
const char *name;
const struct irq_domain_ops *ops;
void *host_data;
/* Optional data */
struct device_node *of_node;
struct irq_domain_chip_generic *gc;
/* reverse map data. The linear map gets appended to the irq_domain */
irq_hw_number_t hwirq_max;
unsigned int revmap_direct_max_irq;
unsigned int revmap_size;
struct radix_tree_root revmap_tree;
unsigned int linear_revmap[];
};
revmap_direct_max_irq: 小于该值的中断,Linux中断号和硬件中断号相同,直接返回。spa
revmap_size: 线性反向映射(彷佛要求域内IRQ从零开始,有点矛盾),小于该值的hwirq直接利用linear_revmap作查找。code
不然用radix tree来查找映射。orm
irq_set_chip_and_handler(gpio_irq, &zynq_gpio_irqchip, handle_simple_irq);
ip
调用irq_get_desc_lock(irq, &flags, 0);,获取irq对应的irq_desc。并设定irq_desc的chip:desc->irq_data.chip = chip;ci
调用irq_reserve_irq(irq);,将allocated_irqs中断位图中相应的中断标识为已占用。
调用__irq_set_handler,将irq_desc中的handle_irq设定:desc->handle_irq = handle;
irq_set_chip_data(gpio_irq, (void *)gpio);
这个比较简单,将要用私有的变量关联到irq,desc->irq_data.chip_data = data;
set_irq_flags(gpio_irq, IRQF_VALID);
整体调用:
irq_set_handler_data(irq_num, (void *)gpio);
这里的irq_num是经过irq_num = platform_get_irq(pdev, 0);获取的系统配置文件里面的irq配置。这个函数也简单,实质为:desc->irq_data.handler_data = data;
irq_set_chained_handler(irq_num, zynq_gpio_irqhandler);
这个函数实质为:desc->handle_irq = handle;
最终调用关系为:调用zynq_gpio_irqhandler,而后在该函数中经过调用generic_handle_irq来调用最终的handle_simple_irq。
zynq Linux软件中断,Linux Zynq GPIO中断相关推荐
- linux用户态使用gpio中断方法
一.用户空间gpio的调用文件 用户空间访问gpio,即通过sysfs接口访问gpio,下面是/sys/class/gpio目录下的三种文件: –export/unexport文件 –gpioN指代具 ...
- linux 应用层gpio中断_linux gpio中断
最近用到gpio中断,gpio中断也是嵌入式系统用的比较多的. 对于GPIO操作 linux 有一套标准的 API,set value.get value之类的,当然也有关于中断的. 关于中断的就是: ...
- xilinx zynq 7010/7020 中断/中断向量/GIC向量/GPIO中断
上图所示GIC左边的称为中断请求源,它们产生中断请求.所有的中断请求都可以发送到GIC通用中断控制器,所以它是一个集中式的中断请求中心.GIC根据请求源的属性(enables, disables, m ...
- 【正点原子Linux连载】第十七章GPIO中断试验-摘自【正点原子】I.MX6U嵌入式Linux驱动开发指南V1.0
1)实验平台:正点原子阿尔法Linux开发板 2)平台购买地址:https://item.taobao.com/item.htm?id=603672744434 2)全套实验源码+手册+视频下载地址: ...
- linux 查看设备 中断号,查看powerpc linux 软件中断号 硬件中断号映射关系
在基于powerpc的linux中,request_irq里填的是软件中断号,也就是/proc/interrupts 里的编号 很不幸的是他们不是一一对应,也没有线性规律 做移植的时候对着dts和手册 ...
- zynq阅读文档之通过中断读GPIO输入的编程指导
ug585的14.3.4中给了从GPIO输入引脚读数据的第二种方法--中断 把MIO引脚12配置成上升沿中断 把触发类型设置为上升沿 向中断类型寄存器写1设置为边沿触发,INT_TYPE_0 [12] ...
- Xilinx Zynq 7000 安装Linux 系统
Xilinx Zynq 7000 安装Linux 系统 介绍 1 准备工作 2 工具的安装 2.1 支持库的安装 2.2 PetaLinux的安装 3 搭建硬件系统 3.1 建立工程 3.2 添加IP ...
- ZYNQ AXI GPIO中断实验——FPGA Vitis篇
文章目录 1. 前言 2. Vivado工程的编写 2.1 Block Design工程设计 2.2 创建XDC管脚约束 3. Vitis工程的编写 4. 实验小结 5. 工程源码下载 1. 前言 使 ...
- ZYNQ 7020 XME0724 linux 系统没有 hit any key to stop autoboot
ZYNQ 7020 XME0724 linux 系统没有 hit any key to stop autoboot,出现的现象如下: 设置命令为:setenv bootcmd run default_ ...
最新文章
- Oracle数据库相关命令
- linux下安装cmake
- Informix存储过程
- python opencv SIFT,获取特征点的坐标位置
- Boost:python与宏BOOST_TEST_EQ相关的实例
- 使用Mockito测试Spring组件
- 159挑战 | 1:59:40,基普乔格打开人类新时代!
- 机器学习实战(二)决策树DT(Decision Tree、ID3算法)
- docker执行容器内的shell_为什么不建议把数据库部署在docker容器内?
- 人群与网络:关系的平衡
- RESTful WebServices Cookbook中文版
- 为什么C语言执行后不会出现小数点,C语言教材第2章要点S.doc
- 计算机桌面图标变小了,电脑桌面图标变小了怎么办
- matlab工具箱参数修改,使用matlab工具箱标定摄像头(内参数)
- 数据库时间相减_sql中两个时间类型相减得到的值
- java 动态表单设计
- Android 隐藏虚拟按键,并且全屏
- linux下磁盘检查修复命令e2fsck
- 思科模拟器8.1版本身份验证失败禁用网络解决
- ObjectiveC, Xcode, iOS开篇导言