天嵌 ARM开发社区

 找回密码
 注册
查看: 5469|回复: 13

linux内核配置问题----完善串口驱动

[复制链接]
vanlos 发表于 2010-10-23 01:13:07 | 显示全部楼层 |阅读模式
linux内核配置问题----完善串口驱动中,在drivers/serial/samsung.c中第53行添加以下内容:
#include<mach/rehs-gpio.h>
其中rehs-gpio.h是内核原有的还是天嵌编写的?
我按照做了,但是编译时出现:
CC      drivers/serial/serial_core.o
  CC      drivers/serial/samsung.o
drivers/serial/samsung.c: In function 's3c24xx_serial_startup':
drivers/serial/samsung.c:434: error: implicit declaration of function 's3c2410_gpio_cfgpin'
drivers/serial/samsung.c:434: error: 'S3C2410_GPH6' undeclared (first use in this function)
drivers/serial/samsung.c:434: error: (Each undeclared identifier is reported only once
drivers/serial/samsung.c:434: error: for each function it appears in.)
drivers/serial/samsun
g.c:435: error: implicit declaration of function 's3c2410_gpio_pullup'
drivers/serial/samsung.c:436: error: 'S3C2410_GPH7' undeclared (first use in this function)
make[2]: *** [drivers/serial/samsung.o] Error 1
make[1]: *** [drivers/serial] Error 2
make: *** [drivers] Error 2


请问下是什么原因,需要重新定义'S3C2410_GPH7' 'S3C2410_GPH6'吗????
machoe 发表于 2010-10-23 08:20:03 | 显示全部楼层
哪个内核版本?肯定是因为忘记添加头文件了。
天嵌_support1 发表于 2010-10-23 11:01:04 | 显示全部楼层
1# vanlos


#include<mach/rehs-gpio.h>
不知道是你copy贴上来的还是手写输入有误。
我只知道有 regs-gpio.h 而不是 rehs-gpio.h
 楼主| vanlos 发表于 2010-10-23 11:35:54 | 显示全部楼层
3# embedsky_lxt


手写错误,是regs-gpio.h,你知道在2.6.30.4中在那个文件夹中吗?!
 楼主| vanlos 发表于 2010-10-23 11:38:00 | 显示全部楼层
2# machoe


内核版本为2.6.35.7,应该是没有这个头文件,不知道在天嵌的2.6.30.4内核中在那个文件夹下?
天嵌_support1 发表于 2010-10-23 11:57:38 | 显示全部楼层
5# vanlos


这些IO定义确实是在 mach/regs-gpio.h 中的。
而这些引脚设置IO函数是在
arch/arm/plat-s3c24xx/gpio.c
 楼主| vanlos 发表于 2010-10-23 12:40:52 | 显示全部楼层
6# embedsky_lxt


发现问题了,在2.6.35.7中regs-gpio.h定义如下:
#define S3C2410_GPH6_TXD2   (0x02 << 12)
#define S3C2416_GPH6_TXD3   (0x02 << 12)
#define S3C2410_GPH6_nRTS1  (0x03 << 12)
#define S3C2416_GPH6_nRTS2  (0x03 << 12)

#define S3C2410_GPH7_RXD2   (0x02 << 14)
#define S3C2416_GPH7_RXD3   (0x02 << 14)
#define S3C2410_GPH7_nCTS1  (0x03 << 14)
#define S3C2416_GPH7_nCTS2  (0x03 << 14)
而在2.6.30.4中regs-gpio.h定义如下:
#define S3C2410_GPH6        S3C2410_GPIONO(S3C2410_GPIO_BANKH, 6)
#define S3C2410_GPH6_INP    (0x00 << 12)
#define S3C2410_GPH6_OUTP   (0x01 << 12)
#define S3C2410_GPH6_TXD2   (0x02 << 12)
#define S3C2410_GPH6_nRTS1  (0x03 << 12)

#define S3C2410_GPH7        S3C2410_GPIONO(S3C2410_GPIO_BANKH, 7)
#define S3C2410_GPH7_INP    (0x00 << 14)
#define S3C2410_GPH7_OUTP   (0x01 << 14)
#define S3C2410_GPH7_RXD2   (0x02 << 14)
#define S3C2410_GPH7_nCTS1  (0x03 << 14)  
请问下,这是版本不同定义方式不同的问题,还是天嵌修改过的??
 楼主| vanlos 发表于 2010-10-23 13:03:08 | 显示全部楼层
6# embedsky_lxt


并且在2.6.35.7中 s3c2410_gpio_cfgpin函数,那么我在设置TXD2和RXD2时就只需要:
if (port->line == 2) {
            s3c2410_gpio_pullup(S3C2410_GPH6_TXD2, 1);
            s3c2410_gpio_pullup(S3C2410_GPH7_RXD2, 1);
        }  

不需要再使用s3c2410_gpio_cfgpin函数让S3C2410_GPH6指向S3C2410_GPH6_TXD2了吧?
 楼主| vanlos 发表于 2010-10-23 13:45:57 | 显示全部楼层
6# embedsky_lxt


按照以上想法改过来之后,出现drivers/serial/samsung.c:434: error: implicit declaration of function 's3c2410_gpio_pullup'
 楼主| vanlos 发表于 2010-10-23 15:37:05 | 显示全部楼层
问题已成功解决,感谢两位版主!
machoe 发表于 2010-10-23 21:50:28 | 显示全部楼层
其实这个问题我已经在我写的移植教程中2.6.35中写过了,可能你没看到
abc532201460 发表于 2010-11-8 22:17:52 | 显示全部楼层
楼主 请教这part如何修改
abc532201460 发表于 2010-11-8 22:19:28 | 显示全部楼层
是2.6.30.4的 根据手册上做 也是这个错误 请教
SiJianH 发表于 2012-7-25 11:36:20 | 显示全部楼层
我也是这个问题!请教管理员!
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

i.MX8系列ARM cortex A53 M4 工控板上一条 /1 下一条

Archiver|手机版|小黑屋|天嵌 嵌入式开发社区 ( 粤ICP备11094220号-2 )

GMT+8, 2024-6-15 23:50 , Processed in 1.062500 second(s), 18 queries .

Powered by Discuz! X3.4 Licensed

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表