如何知道在linux特定引脚中断/ GPIO号 [英] how to know the Interrupt/GPIO number for a specific pin in linux
问题描述
我做的一个项目中,我需要处理在Linux中的中断。
i'm doing a project in which i need to handle an interrupt in Linux.
我使用的板是 ARM9Board 由三星(臂11处理器)的基础上S3C6410微控制器,它具有以下的I / O接口
the board i'm using is an ARM9Board based on the s3c6410 MCU by Samsung (arm 11 processor) and it has the following I/O interface :
作为图像显示我有一个外部中断和GPxx引脚作为GPIO引脚EINTx引脚,我不介意使用任何人,但我没有自己的数字!
as the image shows i have EINTx pins for external interrupts and GPxx pins as GPIO pins and i don't mind using any of them but i don't have their numbers !
对于EINTx引脚:
当我打电话
int request_irq(unsigned int irq, void (*handler)(int, struct pt_regs *),
unsigned long flags, const char *device);
我需要的中断号将它传递作为函数的第一个放慢参数,所以,我怎么能得到例如IRQ号的EINT16针?
i need the interrupt number to pass it as the first paramter of the function , so how can i get the irq number for example the EINT16 pin ?
对于GPxx引脚:
同样的故事,因为我需要的GPIO引脚nuumber将它传递给那些功能
For GPxx pins : the same story as i need the GPIO pin nuumber to pass it to those functions
int gpio_request(unsigned gpio, const char *label);
int gpio_direction_input(unsigned gpio);
int gpio_to_irq(unsigned gpio);
即我怎么知道该GPP8引脚的GPIO多少?
i.e how do i know the GPIO number for the GPP8 pin ?
我搜索董事会文件,数据表,但不包含有关如何获取这些数字,任何想法或帮助在哪里看什么?
i searched the board documents and datasheet but it doesn't contain anything about how to get those numbers , any idea or help on where to look ?
推荐答案
嵌入式Linux平台使用的是应该有对GPIO引脚的#define
语句的GPIO驱动程序。然后,您可以使用类似获得特定GPIO的IRQ号:
The Embedded Linux you are using should have a GPIO driver that has #define
statements for the GPIO pins. You can then get the IRQ number of the specific GPIO using something like:
irq_num = gpio_to_irq(S3C64XX_GPP(8));
针对特定芯片Linux的GPIO LIB的支持是在以下文件可用:
The Linux GPIO lib support for that particular chip is available in the the following file:
Linux的/弓/ ARM /马赫S3C6400 /有/马赫/ gpio.h
linux/arch/arm/mach-s3c6400/include/mach/gpio.h
有你会发现不同的GPIO所有的的#define
语句。
There you will find all the #define
statements for the various GPIO.
请参阅GPIO上约定的部分在其文档中:
See the section on GPIO Conventions in their documentation:
http://www.kernel.org/doc/Documentation/gpio/ gpio.txt
这篇关于如何知道在linux特定引脚中断/ GPIO号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!