kernel\arch\arm\mach-s5pv210\include\mach\目录下:/* linux/arch/arm/mach-s5pv210/include/mach/gpio.h * * Copyright (c) 2010 Samsung Electronics Co., Ltd. * http://www.samsung.com/ * * S5PV210 - GPIO lib support * * This program 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.*/#ifndef __ASM_ARCH_GPIO_H#define __ASM_ARCH_GPIO_H __FILE__#define gpio_get_value __gpio_get_value#define gpio_set_value __gpio_set_value#define gpio_cansleep __gpio_cansleep#define gpio_to_irq __gpio_to_irq/* Practically, GPIO banks upto MP03 are the configurable gpio banks *//* GPIO bank sizes */#define S5PV210_GPIO_A0_NR (8) // 0+8+1 = 9#define S5PV210_GPIO_A1_NR (4) // 9+4+1 = 14#define S5PV210_GPIO_B_NR (8) // 14+8+1 =23#define S5PV210_GPIO_C0_NR (5) // 23+5+1 =29#define S5PV210_GPIO_C1_NR (5) // 29+5+1 =35#define S5PV210_GPIO_D0_NR (4) // 35+4+1 =40#define S5PV210_GPIO_D1_NR (6) // 40+6+1 =47#define S5PV210_GPIO_E0_NR (8) // 47+8+1 =56 #define S5PV210_GPIO_E1_NR (5) //56+5+1 =62 #define S5PV210_GPIO_F0_NR (8) //62+8+1 =71#define S5PV210_GPIO_F1_NR (8) //71+8+1 =80 #define S5PV210_GPIO_F2_NR (8) //80+8+1 =89 #define S5PV210_GPIO_F3_NR (6) //89+6+1 =96 #define S5PV210_GPIO_G0_NR (7) //96+7+1 =104#define S5PV210_GPIO_G1_NR (7) //104+7+1 =112#define S5PV210_GPIO_G2_NR (7) //112+7+1 =120#define S5PV210_GPIO_G3_NR (7) //120+7+1 =128#define S5PV210_GPIO_H0_NR (8) //128+8+1 =137#define S5PV210_GPIO_H1_NR (8) //137+8+1 =146#define S5PV210_GPIO_H2_NR (8) //146+8+1 =155#define S5PV210_GPIO_H3_NR (8) //155+8+1 =164 //如果我们需要操作GPH3_5 即 160 #define S5PV210_GPIO_I_NR (7)#define S5PV210_GPIO_J0_NR (8)#define S5PV210_GPIO_J1_NR (6)#define S5PV210_GPIO_J2_NR (8)#define S5PV210_GPIO_J3_NR (8)#define S5PV210_GPIO_J4_NR (5)#define S5PV210_GPIO_MP01_NR (8)#define S5PV210_GPIO_MP02_NR (4)#define S5PV210_GPIO_MP03_NR (8)#define S5PV210_GPIO_MP04_NR (8)#define S5PV210_GPIO_MP05_NR (8)#define S5PV210_GPIO_MP06_NR (8)#define S5PV210_GPIO_MP07_NR (8)#define S5PV210_GPIO_MP10_NR (8)#define S5PV210_GPIO_MP11_NR (8)#define S5PV210_GPIO_MP12_NR (8)#define S5PV210_GPIO_MP13_NR (8)#define S5PV210_GPIO_MP14_NR (8)#define S5PV210_GPIO_MP15_NR (8)#define S5PV210_GPIO_MP16_NR (8)#define S5PV210_GPIO_MP17_NR (8)#define S5PV210_GPIO_MP18_NR (7)#define S5PV210_GPIO_MP20_NR (8)#define S5PV210_GPIO_MP21_NR (8)#define S5PV210_GPIO_MP22_NR (8)#define S5PV210_GPIO_MP23_NR (8)#define S5PV210_GPIO_MP24_NR (8)#define S5PV210_GPIO_MP25_NR (8)#define S5PV210_GPIO_MP26_NR (8)#define S5PV210_GPIO_MP27_NR (8)#define S5PV210_GPIO_MP28_NR (7)#define S5PV210_GPIO_ETC0_NR (6)#define S5PV210_GPIO_ETC1_NR (8)#define S5PV210_GPIO_ETC2_NR (8)#define S5PV210_GPIO_ETC4_NR (6)/* GPIO bank numbers *//* CONFIG_S3C_GPIO_SPACE allows the user to select extra * space for debugging purposes so that any accidental * change from one gpio bank to another can be caught.*/#define S5PV210_GPIO_NEXT(__gpio) \((__gpio##_START) + (__gpio##_NR) + CONFIG_S3C_GPIO_SPACE + 1)enum s5p_gpio_number {S5PV210_GPIO_A0_START = 0,S5PV210_GPIO_A1_START = S5PV210_GPIO_NEXT(S5PV210_GPIO_A0),S5PV210_GPIO_B_START = S5PV210_GPIO_NEXT(S5PV210_GPIO_A1),S5PV210_GPIO_C0_START = S5PV210_GPIO_NEXT(S5PV210_GPIO_B),S5PV210_GPIO_C1_START = S5PV210_GPIO_NEXT(S5PV210_GPIO_C0),S5PV210_GPIO_D0_START = S5PV210_GPIO_NEXT(S5PV210_GPIO_C1),S5PV210_GPIO_D1_START = S5PV210_GPIO_NEXT(S5PV210_GPIO_D0),S5PV210_GPIO_E0_START = S5PV210_GPIO_NEXT(S5PV210_GPIO_D1),S5PV210_GPIO_E1_START = S5PV210_GPIO_NEXT(S5PV210_GPIO_E0),S5PV210_GPIO_F0_START = S5PV210_GPIO_NEXT(S5PV210_GPIO_E1),S5PV210_GPIO_F1_START = S5PV210_GPIO_NEXT(S5PV210_GPIO_F0),S5PV210_GPIO_F2_START = S5PV210_GPIO_NEXT(S5PV210_GPIO_F1),S5PV210_GPIO_F3_START = S5PV210_GPIO_NEXT(S5PV210_GPIO_F2),S5PV210_GPIO_G0_START = S5PV210_GPIO_NEXT(S5PV210_GPIO_F3),S5PV210_GPIO_G1_START = S5PV210_GPIO_NEXT(S5PV210_GPIO_G0),S5PV210_GPIO_G2_START = S5PV210_GPIO_NEXT(S5PV210_GPIO_G1),S5PV210_GPIO_G3_START = S5PV210_GPIO_NEXT(S5PV210_GPIO_G2),S5PV210_GPIO_H0_START = S5PV210_GPIO_NEXT(S5PV210_GPIO_G3),S5PV210_GPIO_H1_START = S5PV210_GPIO_NEXT(S5PV210_GPIO_H0),S5PV210_GPIO_H2_START = S5PV210_GPIO_NEXT(S5PV210_GPIO_H1),S5PV210_GPIO_H3_START = S5PV210_GPIO_NEXT(S5PV210_GPIO_H2),S5PV210_GPIO_I_START = S5PV210_GPIO_NEXT(S5PV210_GPIO_H3),S5PV210_GPIO_J0_START = S5PV210_GPIO_NEXT(S5PV210_GPIO_I),S5PV210_GPIO_J1_START = S5PV210_GPIO_NEXT(S5PV210_GPIO_J0),S5PV210_GPIO_J2_START = S5PV210_GPIO_NEXT(S5PV210_GPIO_J1),S5PV210_GPIO_J3_START = S5PV210_GPIO_NEXT(S5PV210_GPIO_J2),S5PV210_GPIO_J4_START = S5PV210_GPIO_NEXT(S5PV210_GPIO_J3),S5PV210_GPIO_MP01_START = S5PV210_GPIO_NEXT(S5PV210_GPIO_J4),S5PV210_GPIO_MP02_START = S5PV210_GPIO_NEXT(S5PV210_GPIO_MP01),S5PV210_GPIO_MP03_START = S5PV210_GPIO_NEXT(S5PV210_GPIO_MP02),S5PV210_GPIO_MP04_START = S5PV210_GPIO_NEXT(S5PV210_GPIO_MP03),S5PV210_GPIO_MP05_START = S5PV210_GPIO_NEXT(S5PV210_GPIO_MP04),S5PV210_GPIO_MP06_START = S5PV210_GPIO_NEXT(S5PV210_GPIO_MP05),S5PV210_GPIO_MP07_START = S5PV210_GPIO_NEXT(S5PV210_GPIO_MP06),S5PV210_GPIO_MP10_START = S5PV210_GPIO_NEXT(S5PV210_GPIO_MP07),S5PV210_GPIO_MP11_START = S5PV210_GPIO_NEXT(S5PV210_GPIO_MP10),S5PV210_GPIO_MP12_START = S5PV210_GPIO_NEXT(S5PV210_GPIO_MP11),S5PV210_GPIO_MP13_START = S5PV210_GPIO_NEXT(S5PV210_GPIO_MP12),S5PV210_GPIO_MP14_START = S5PV210_GPIO_NEXT(S5PV210_GPIO_MP13),S5PV210_GPIO_MP15_START = S5PV210_GPIO_NEXT(S5PV210_GPIO_MP14),S5PV210_GPIO_MP16_START = S5PV210_GPIO_NEXT(S5PV210_GPIO_MP15),S5PV210_GPIO_MP17_START = S5PV210_GPIO_NEXT(S5PV210_GPIO_MP16),S5PV210_GPIO_MP18_START = S5PV210_GPIO_NEXT(S5PV210_GPIO_MP17),S5PV210_GPIO_MP20_START = S5PV210_GPIO_NEXT(S5PV210_GPIO_MP18),S5PV210_GPIO_MP21_START = S5PV210_GPIO_NEXT(S5PV210_GPIO_MP20),S5PV210_GPIO_MP22_START = S5PV210_GPIO_NEXT(S5PV210_GPIO_MP21),S5PV210_GPIO_MP23_START = S5PV210_GPIO_NEXT(S5PV210_GPIO_MP22),S5PV210_GPIO_MP24_START = S5PV210_GPIO_NEXT(S5PV210_GPIO_MP23),S5PV210_GPIO_MP25_START = S5PV210_GPIO_NEXT(S5PV210_GPIO_MP24),S5PV210_GPIO_MP26_START = S5PV210_GPIO_NEXT(S5PV210_GPIO_MP25),S5PV210_GPIO_MP27_START = S5PV210_GPIO_NEXT(S5PV210_GPIO_MP26),S5PV210_GPIO_MP28_START = S5PV210_GPIO_NEXT(S5PV210_GPIO_MP27),S5PV210_GPIO_ETC0_START = S5PV210_GPIO_NEXT(S5PV210_GPIO_MP28),S5PV210_GPIO_ETC1_START = S5PV210_GPIO_NEXT(S5PV210_GPIO_ETC0),S5PV210_GPIO_ETC2_START = S5PV210_GPIO_NEXT(S5PV210_GPIO_ETC1),S5PV210_GPIO_ETC4_START = S5PV210_GPIO_NEXT(S5PV210_GPIO_ETC2),};/* S5PV210 GPIO number definitions */#define S5PV210_GPA0(_nr) (S5PV210_GPIO_A0_START + (_nr))#define S5PV210_GPA1(_nr) (S5PV210_GPIO_A1_START + (_nr))#define S5PV210_GPB(_nr) (S5PV210_GPIO_B_START + (_nr))#define S5PV210_GPC0(_nr) (S5PV210_GPIO_C0_START + (_nr))#define S5PV210_GPC1(_nr) (S5PV210_GPIO_C1_START + (_nr))#define S5PV210_GPD0(_nr) (S5PV210_GPIO_D0_START + (_nr))#define S5PV210_GPD1(_nr) (S5PV210_GPIO_D1_START + (_nr))#define S5PV210_GPE0(_nr) (S5PV210_GPIO_E0_START + (_nr))#define S5PV210_GPE1(_nr) (S5PV210_GPIO_E1_START + (_nr))#define S5PV210_GPF0(_nr) (S5PV210_GPIO_F0_START + (_nr))#define S5PV210_GPF1(_nr) (S5PV210_GPIO_F1_START + (_nr))#define S5PV210_GPF2(_nr) (S5PV210_GPIO_F2_START + (_nr))#define S5PV210_GPF3(_nr) (S5PV210_GPIO_F3_START + (_nr))#define S5PV210_GPG0(_nr) (S5PV210_GPIO_G0_START + (_nr))#define S5PV210_GPG1(_nr) (S5PV210_GPIO_G1_START + (_nr))#define S5PV210_GPG2(_nr) (S5PV210_GPIO_G2_START + (_nr))#define S5PV210_GPG3(_nr) (S5PV210_GPIO_G3_START + (_nr))#define S5PV210_GPH0(_nr) (S5PV210_GPIO_H0_START + (_nr))#define S5PV210_GPH1(_nr) (S5PV210_GPIO_H1_START + (_nr))#define S5PV210_GPH2(_nr) (S5PV210_GPIO_H2_START + (_nr))#define S5PV210_GPH3(_nr) (S5PV210_GPIO_H3_START + (_nr))#define S5PV210_GPI(_nr) (S5PV210_GPIO_I_START + (_nr))#define S5PV210_GPJ0(_nr) (S5PV210_GPIO_J0_START + (_nr))#define S5PV210_GPJ1(_nr) (S5PV210_GPIO_J1_START + (_nr))#define S5PV210_GPJ2(_nr) (S5PV210_GPIO_J2_START + (_nr))#define S5PV210_GPJ3(_nr) (S5PV210_GPIO_J3_START + (_nr))#define S5PV210_GPJ4(_nr) (S5PV210_GPIO_J4_START + (_nr))#define S5PV210_MP01(_nr) (S5PV210_GPIO_MP01_START + (_nr))#define S5PV210_MP02(_nr) (S5PV210_GPIO_MP02_START + (_nr))#define S5PV210_MP03(_nr) (S5PV210_GPIO_MP03_START + (_nr))#define S5PV210_MP04(_nr) (S5PV210_GPIO_MP04_START + (_nr))#define S5PV210_MP05(_nr) (S5PV210_GPIO_MP05_START + (_nr))#define S5PV210_MP06(_nr) (S5PV210_GPIO_MP06_START + (_nr))#define S5PV210_MP07(_nr) (S5PV210_GPIO_MP07_START + (_nr))#define S5PV210_MP10(_nr) (S5PV210_GPIO_MP10_START + (_nr))#define S5PV210_MP11(_nr) (S5PV210_GPIO_MP11_START + (_nr))#define S5PV210_MP12(_nr) (S5PV210_GPIO_MP12_START + (_nr))#define S5PV210_MP13(_nr) (S5PV210_GPIO_MP13_START + (_nr))#define S5PV210_MP14(_nr) (S5PV210_GPIO_MP14_START + (_nr))#define S5PV210_MP15(_nr) (S5PV210_GPIO_MP15_START + (_nr))#define S5PV210_MP16(_nr) (S5PV210_GPIO_MP16_START + (_nr))#define S5PV210_MP17(_nr) (S5PV210_GPIO_MP17_START + (_nr))#define S5PV210_MP18(_nr) (S5PV210_GPIO_MP18_START + (_nr))#define S5PV210_MP20(_nr) (S5PV210_GPIO_MP20_START + (_nr))#define S5PV210_MP21(_nr) (S5PV210_GPIO_MP21_START + (_nr))#define S5PV210_MP22(_nr) (S5PV210_GPIO_MP22_START + (_nr))#define S5PV210_MP23(_nr) (S5PV210_GPIO_MP23_START + (_nr))#define S5PV210_MP24(_nr) (S5PV210_GPIO_MP24_START + (_nr))#define S5PV210_MP25(_nr) (S5PV210_GPIO_MP25_START + (_nr))#define S5PV210_MP26(_nr) (S5PV210_GPIO_MP26_START + (_nr))#define S5PV210_MP27(_nr) (S5PV210_GPIO_MP27_START + (_nr))#define S5PV210_MP28(_nr) (S5PV210_GPIO_MP28_START + (_nr))#define S5PV210_ETC0(_nr) (S5PV210_GPIO_ETC0_START + (_nr))#define S5PV210_ETC1(_nr) (S5PV210_GPIO_ETC1_START + (_nr))#define S5PV210_ETC2(_nr) (S5PV210_GPIO_ETC2_START + (_nr))#define S5PV210_ETC4(_nr) (S5PV210_GPIO_ETC4_START + (_nr))/* Define EXT INT GPIO */#define S5P_EXT_INT0(x) S5PV210_GPH0(x)#define S5P_EXT_INT1(x) S5PV210_GPH1(x)#define S5P_EXT_INT2(x) S5PV210_GPH2(x)#define S5P_EXT_INT3(x) S5PV210_GPH3(x)/* the end of the S5PV210 specific gpios */#define S5PV210_GPIO_END (S5PV210_ETC4(S5PV210_GPIO_ETC4_NR) + 1)#define S3C_GPIO_END S5PV210_GPIO_END/* define the number of gpios we need to the one after the GPJ4() range */#define ARCH_NR_GPIOS (S5PV210_ETC4(S5PV210_GPIO_ETC4_NR) + \ CONFIG_SAMSUNG_GPIO_EXTRA + 1)#include #include extern int s3c_gpio_slp_cfgpin(unsigned int pin, unsigned int to);extern s3c_gpio_pull_t s3c_gpio_get_slp_cfgpin(unsigned int pin);#define S3C_GPIO_SLP_OUT0 ((__force s3c_gpio_pull_t)0x00)#define S3C_GPIO_SLP_OUT1 ((__force s3c_gpio_pull_t)0x01)#define S3C_GPIO_SLP_INPUT ((__force s3c_gpio_pull_t)0x02)#define S3C_GPIO_SLP_PREV ((__force s3c_gpio_pull_t)0x03)extern int s3c_gpio_set_drvstrength(unsigned int pin, unsigned int config);extern int s3c_gpio_set_slewrate(unsigned int pin, unsigned int config);#define S3C_GPIO_DRVSTR_1X (0)#define S3C_GPIO_DRVSTR_2X (1)#define S3C_GPIO_DRVSTR_3X (2)#define S3C_GPIO_DRVSTR_4X (3)#define S3C_GPIO_SLEWRATE_FAST (0)#define S3C_GPIO_SLEWRATE_SLOW (1)extern int s3c_gpio_slp_setpull_updown(unsigned int pin, s3c_gpio_pull_t pull);extern int s5pv210_gpiolib_init(void);#endif /* __ASM_ARCH_GPIO_H */在这段有对GPIO脚的编号注释了其中一部分。接下来操作具体GPIO脚kernel\drivers\gpio\gpiolib.c修改权限,将里面所有文件的权限全部改为 0777然后到内核根目录make menuconfig Device Drivers ---> -*- GPIO Support ---> [*] /sys/class/gpio/... (sysfs interface) 选上,然后退出 重新编译内核就可以对S5PV210的GPIO脚进行操作了假如GPH3-5管脚外接LED灯进行控制:1.进入GPIO操作目录cd /sys/class/gpio/2.导入160即GPH3-5echo 160 > export3.cd gpio1604.查看输入输出方向(output或input)cat direction5.查看值 (0或1)cat value 6.设置方式为管脚输入 echo in > direction 写入值 0 echo 0 >value看到效果:灯灭7.设置管脚为输出echo out > direction写入值1 echo 1 >value看到效果:灯亮

S5PV210 GPIO 操作相关推荐

  1. Linux下给arm的引脚电平,ARM-Linux GPIO操作事宜

    原标题:ARM-Linux GPIO操作事宜 1.在 Linux 表示为"S3C2410_GPx(n)",其中x的取值为"A,B,C,D,E,F,G,H.....&quo ...

  2. RT-Thread对GPIO操作两种方式的区别:1)通过设备操作接口2)直接通过通用GPIO设备驱动

    在学习RT-Thread设备驱动框架时,看到潘多拉开发板的RT-Thread例程资料中的文档<AN0002-RT-Thread-通用 GPIO 设备应用笔记>有如下描述,因此产生使用文档中 ...

  3. esp32的GPIO操作

    对于任何一款芯片,GPIO接口是其最基本的组成部分,也是一款芯片入门的最基本操作,下面论述下 关于esp32开发版的GPIO操作,本文中重点讲解下 关于如何创建eclipse工程,并通过eclipse ...

  4. linux 标准 GPIO 操作

    Linux 提供了GPIO 操作的 API,具体初始化及注册函数在 driver/gpio/lib_gpio.c 中实现. #include    int gpio_request(unsigned ...

  5. 驱动GPIO操作归纳

    IO内存操作可以使用ioremap映射再使用指针操作对应的寄存器,但是比较少使用,一般使用内核提供GPIO操作函数. 一.内核提供的通用GPIO操作的API接口,其文件是gpio.h (include ...

  6. linux蜂鸣器控制实验,【Linux公开课】蜂鸣器使用、LCD背光控制、触摸屏校准、GPIO操作...

    摘要为方便使用蜂鸣器,系统为蜂鸣器提供类似LED的操作接口,对应的操作文件是/sys/class/leds/beep/brightness.写入1使蜂鸣器鸣叫,写入0停止鸣叫- 8.12 蜂鸣器使用 ...

  7. W806 基于Arduino开发的GPIO操作示例,勇于尝新

    W806 基于Arduino的点灯实验的 一.写在前面 1. W806芯片参数: 2. MCU 特性: 3. 供电: 二.环境准备,添加支持包 三.打开永恒的LED测试 四.总结 一.写在前面 w80 ...

  8. HI3516DV300 GPIO操作

    前言 本次实验根据ProYuan28博主写的博客GPIO文档进行适配调试,特此记录GPIO操作. 正文 GPIO分为三个步骤: 1 设置gpio端口复用寄存器: 2 设置GPIO口的方向寄存器(GPI ...

  9. 51单片机手把手教学(二)—— 点亮 LED 灯(GPIO 操作)

    本文章 来自原创专栏<51单片机手把手教学>,讲解如何使用 Keil uVision 构建 51单片机 程序,发布文章并 会持续为已发布文章添加新内容! 每篇文章都经过了精打细磨! ↓↓↓ ...

最新文章

  1. linux shell面试题(一)
  2. ​一文读懂EfficientDet
  3. RAC测试及命令示例
  4. Java线程池如何合理配置核心线程数
  5. C# 发出异步的Get请求
  6. using namespace cv
  7. 可逆加密,支持中文,支持密钥,加密后的密文每次都不同,且可随意改变算法 组件之Vb.Net版本...
  8. 绝对路径、相对路径详解
  9. en55032最新标准下载_关于欧盟新版EMC标准EN55032的解析精编版
  10. HTC手机如何进行官方解锁Unlock
  11. android sqlite数据库 emoji表情,Android的Emoji表情
  12. 怎样取消QQ的热键(快捷键)
  13. stata01 - stata基础
  14. 设计模式——软件设计的太极剑法
  15. linux挂载VMFS硬盘,挂载ESXi服务器VMFS存储卷
  16. 《转》关于ath5k网卡驱动中beacon的发送过程(特别是timestamp字段)
  17. 如何下载企业微信上课直播回放
  18. Git 修改已提交的 commit 信息
  19. ABAP 关键字(1)
  20. 若快打码平台python开发文档修改版

热门文章

  1. Java程序包system不存在I_急急急!!java 软件包 system不存在
  2. nike air max polska 2016 ważne jest
  3. view \function\行转列的方法。
  4. [转贴]迅雷十年反思
  5. python子进程kerberos_Python实现Kerberos用户的增删改查操作
  6. 北斗系统基础知识1(北斗系统定位原理说明“图文详述”)
  7. EfficientDet:可扩展的高效目标检测
  8. K8S太火了!花10分钟玩转它不香么?
  9. effective morden c++1
  10. VS源文件提取工具vsjuicer 实现细节