📄 gpio.h
字号:
/* * linux/include/asm-arm/arch-omap2/gpio.h * * OMAP2 GPIO handling defines and functions * * Copyright (C) 2003 Nokia Corporation * Written by Juha Yrjölä <juha.yrjola@nokia.com>m> * * Copyright (C) 2004 Texas Instruments, Inc. * * This package is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. * * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. */#ifndef __ASM_ARM_ARCH_OMAP2_GPIO_H#define __ASM_ARM_ARCH_OMAP2_GPIO_H#include <asm/arch/irqs.h>/* * OMAP-2420 specific GPIO registers */#define OMAP2420_GPIO1_BASE IO_ADDRESS(0x48018000)#define OMAP2420_GPIO2_BASE IO_ADDRESS(0x4801a000)#define OMAP2420_GPIO3_BASE IO_ADDRESS(0x4801c000)#define OMAP2420_GPIO4_BASE IO_ADDRESS(0x4801e000)#define OMAP2420_GPIO_REVISION 0x0000#define OMAP2420_GPIO_SYSCONFIG 0x0010#define OMAP2420_GPIO_SYSSTATUS 0x0014#define OMAP2420_GPIO_IRQSTATUS1 0x0018#define OMAP2420_GPIO_IRQENABLE1 0x001c#define OMAP2420_GPIO_WAKE_EN 0x0020#define OMAP2420_GPIO_DIRECTION 0x0034 /* Output Enable */#define OMAP2420_GPIO_DATAIN 0x0038#define OMAP2420_GPIO_DATAOUT 0x003c#define OMAP2420_GPIO_LOW_LEVEL 0x0040#define OMAP2420_GPIO_HIGH_LEVEL 0x0044#define OMAP2420_GPIO_RISING_EDGE 0x0048#define OMAP2420_GPIO_FALLING_EDGE 0x004c#define OMAP2420_GPIO_DEBOUNCE_EN 0x0050#define OMAP2420_GPIO_DEBOUNCE_VAL 0x0054#define OMAP2420_GPIO_CLEAR_IRQENABLE1 0x0060#define OMAP2420_GPIO_SET_IRQENABLE1 0x0064#define OMAP2420_GPIO_CLEAR_DATAOUT 0x0090#define OMAP2420_GPIO_SET_DATAOUT 0x0094#define OMAP2420_DIR_INPUT 1#define OMAP2420_DIR_OUTPUT 0#define OMAP_GPIO_BASE_REG(nr) ((nr) >= 96 ? OMAP2420_GPIO4_BASE : \ (nr) >= 64 ? OMAP2420_GPIO3_BASE : \ (nr) >= 32 ? OMAP2420_GPIO2_BASE : \ OMAP2420_GPIO1_BASE)#define OMAP_GPIO_INDEX(nr) ((nr) & 0x1f)#define OMAP_GPIO_BIT(nr) (1 << OMAP_GPIO_INDEX(nr))#define OMAP_GPIO_IRQ_NO(n) (IH_GPIO_BASE+n)/* ISR Polarity defines */#define OMAP_GPIO_NO_EDGE 0x00#define OMAP_GPIO_FALLING_EDGE 0x01#define OMAP_GPIO_RISING_EDGE 0x02#define OMAP_GPIO_BOTH_EDGES 0x03#define OMAP_GPIO_LEVEL_HIGH 0x04#define OMAP_GPIO_LEVEL_LOW 0x08#define OMAP_GPIO_HIGH_LOW 0x0cextern int omap_request_gpio(int gpio);extern void omap_free_gpio(int gpio);extern void omap_set_gpio_direction(int gpio, int is_input);extern void omap_set_gpio_dataout(int gpio, int enable);extern int omap_get_gpio_datain(int gpio);extern void omap_set_gpio_edge_ctrl(int gpio, int edge);extern void omap_set_gpio_debounce_time(int gpio, int enc_time);extern void omap_set_gpio_debounce(int gpio, int enable);extern void gpio_unmask_irq(unsigned int irq);#endif /* __ASM_ARM_ARCH_OMAP2_GPIO_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -