• «
  • 1
  • 2
  • »
  • Pages: 1/2     Go
主题 : QQ2440如何控制GPIO啊? 复制链接 | 浏览器收藏 | 打印
级别: 新手上路
UID: 100
精华: 0
发帖: 13
金钱: 115 两
威望: 22 点
综合积分: 26 分
注册时间: 2008-02-15
最后登录: 2011-05-01
楼主  发表于: 2008-03-19 22:54

 QQ2440如何控制GPIO啊?

如题!我弄了好久都没弄出来,查资料也大都是S3C2410的,而且试过也不可行,各位大虾帮帮忙!
I am the best!
*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
1楼  发表于: 2008-03-19 23:46
引用楼主xiaoxiaoant于2008-03-19 22:54发表的 QQ2440如何控制GPIO啊? :
如题!我弄了好久都没弄出来,查资料也大都是S3C2410的,而且试过也不可行,各位大虾帮帮忙!

呵呵,这个问题有点大了,先说说你要在什么环境下控制GPIO吧
"If you have an apple and I have an apple and we exchange apples, then you and I will
still each have one apple. But if you have an idea and I have an idea and we exchange
these ideas, then each of us will have two ideas."
级别: 新手上路
UID: 342
精华: 0
发帖: 1
金钱: 10 两
威望: 1 点
综合积分: 2 分
注册时间: 2008-03-20
最后登录: 2008-05-09
2楼  发表于: 2008-03-21 11:16
2440控制gpio和2410的一样?
都是用了 kernel 里的
S3C2410_GPEDAT这样的宏的

目前我用的都是这么用的,其他人给点意见吧
呵呵
*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
3楼  发表于: 2008-03-21 12:26
从硬件上来讲,控制GPIO就是写GPxCON,GPxDAT, GPxUP这几个寄存器,在不同的环境下,这些操作有不同的实现方法,比如在Linux 环境下,设备驱动程序就可以通过Linux Kernel提供的一系列s3c2410_gpio_xxx()函数接口实现对GPIO的控制。同样的,在vivi环境或者其他环境下,也有相应的实现,只是方式不通而已。
我不推荐在有函数接口的情况下直接操作寄存器,这会造成系统资源管理的混乱。
"If you have an apple and I have an apple and we exchange apples, then you and I will
still each have one apple. But if you have an idea and I have an idea and we exchange
these ideas, then each of us will have two ideas."
级别: 新手上路
UID: 100
精华: 0
发帖: 13
金钱: 115 两
威望: 22 点
综合积分: 26 分
注册时间: 2008-02-15
最后登录: 2011-05-01
4楼  发表于: 2008-03-21 17:57
其实我是想用GPIO来控制几个小电机的正反转的,或者是通过GPIO控制几个继电器来实现

对了,GPIO的设备号是多少啊?
I am the best!
级别: 新手上路
UID: 100
精华: 0
发帖: 13
金钱: 115 两
威望: 22 点
综合积分: 26 分
注册时间: 2008-02-15
最后登录: 2011-05-01
5楼  发表于: 2008-03-21 17:58
我用的是linux系统
I am the best!
*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
6楼  发表于: 2008-03-21 21:28
如果你用的是友善之臂提供的2.6.13的linux kernel,据我所知GPIO没有单独的设备号。你可能需要自己写一个简单的设备驱动程序来控制GPIO,调用Kernel提供的GPIO控制接口,这些接口定义在arch/arm/mach-s3c2410/gpio.c里
"If you have an apple and I have an apple and we exchange apples, then you and I will
still each have one apple. But if you have an idea and I have an idea and we exchange
these ideas, then each of us will have two ideas."
级别: 新手上路
UID: 100
精华: 0
发帖: 13
金钱: 115 两
威望: 22 点
综合积分: 26 分
注册时间: 2008-02-15
最后登录: 2011-05-01
7楼  发表于: 2008-03-21 23:52
谢谢斑竹的提示,我试试看
I am the best!
*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
8楼  发表于: 2008-03-22 10:25
很多人问过类似的问题,如果你实现了,希望你可以和大家分享,谢谢
"If you have an apple and I have an apple and we exchange apples, then you and I will
still each have one apple. But if you have an idea and I have an idea and we exchange
these ideas, then each of us will have two ideas."
*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
9楼  发表于: 2008-03-23 18:41
我刚才重新搜了一下友善之臂提供的kernel,发现还是有一个GPIO控制的LED驱动的,我想你可以参考这个程序
C:\projects\qq2440\kernel-2.6.13\drivers\char\sbc2440_leds.c
不过不要学他们的编程风格:)
"If you have an apple and I have an apple and we exchange apples, then you and I will
still each have one apple. But if you have an idea and I have an idea and we exchange
these ideas, then each of us will have two ideas."
  • «
  • 1
  • 2
  • »
  • Pages: 1/2     Go