77范文网 - 专业文章范例文档资料分享平台

数码相框毕业设计论文 - 图文(7)

来源:网络收集 时间:2019-04-02 下载这篇文档 手机版
说明:文章内容仅供预览,部分内容可能不全,需要完整文档或者需要复制内容,请下载word后使用。下载word有问题请添加微信号:或QQ: 处理(尽可能给您提供完整文档),感谢您的支持与谅解。点击这里给我发消息

第六章 驱动的移植

6.1关于USB驱动移植

(1)修改arch/arm/mach-s3c2410/mach-smdk2410.c文件

#include #include #include #include

static struct s3c2410_hcd_info usb_gec2410_info = { .port[0]={

.flags = S3C2410_HCDFLG_USED, };

int usb_gec2410_init(void) {

unsigned long upllvalue = (0x78<<12)|(0x02<<4)|(0x03); printk(“USB Control,(c)gec2410\\n”);

s3c_device_usb.dev.platform_data = &usb_gec2410_info; while(upllvalue!=_raw_readl(S3C2410_UPLLCON)) {

_raw_write(upllvalue,S3C2410_UPLLCON); mdelay(1); }

return 0; }

(2)在static void_init smdk2410_map_io()函数中添加usb_sbc2410_init()函数usb_gec2410_init(); (3)内核配置

支持热插拔

General setup—>

[*]Configure standard kernel features(for small systems)-> <*>Support for hot-pluggable devices 让内核支持USB设备 Device drivers

Block devices --->

< * >Low Performance USB Block driver SCSI device support --->

< * >SCSI generic support

< * >Probe all LUNs on each SCSI device USB support --->

< * >Support for Host-side USB [ * ] USB device filesystem < * >USB Mass Storage support < * >USB Monitor

加入 MSDOS 文件系统和 VFAT 文件系统支持(为适应挂载 U 盘) File systems --->

DOS/FAT/NT Filesystems ---> <*> MSDOS fs support

<*>VFAT (Windows-95) fs support

( 936 ) Default codepage for FAT // 更改默认值为 936

( cp936 ) Default iocharset for FAT // 更改默认值为 cp936 使能( DOS 分区) CONFIG_MSDOS_PARTITION File systems ---> Partition Types --->

[ * ] PC BIOS (MSDOS partition tables) support 添加对中文字体库的支持

File systems --->

-*- Native language support --->

< * >Simplified Chinese charset (CP936, GB2312) < * > NLS UTF8 编译#make

6.2 关于LCD驱动移植

(1)关于LCD的配置文件源码:

在Linux-2.6.30.4/arch/arm/mach-s3c2410/mach-smdk2410.c中添加如下 #vim /arm/mach-s3c2410/mach-smdk2410.c #include//添加头文件

static sturc s3c2410fb_display smdk2410_lcd_cfg__initdata={ .lcdcon5 = S3C2410_LCDCON5_FRM565|

S3C2410_LCDCON5_INVVLINE| S3C2410_LCDCON5_INVVFRAME| S3C2410_LCDCON5_PWREN| S3C2410_LCDCON5_HWSWP, .type = S3C2410_LCDCON1_TFT, .width =320, .height =240,

.pixclock = 170000,/*HCLK 60 MHz,divisor10*/ .xres = 320, .yres = 240, .bpp = 16,

.left_margin =21, .right_margin =39, .hsync_len = 31, .upper_margin =16, .lower_margin = 13, .vsync_len = 4, };

static struct s3c2410fb_mach_info smdk2410_fb_info__initdata ={

32

.displays = &smdk2410_lcd_cfg, .num_displays = 1, .default_display = 0, };

(2)初始化函数中添加LCD初始化功能

Static void__init smdk2410_init(void) {

S3c24xx_fb_set_platdata(&smdk2410_fb_info);//添加部分 }

(3)删除arch/arm/mach-s3c2440/mach-smdk2440.c中的部分内容如下:

Static struct s3c2410fb_display smdk2440_kd_cfg__initdata={ .lcdcon5 = S3C2410_LCDCON5_FRM565|

S3C2410_LCDCON5_INVVLINE| S3C2410_LCDCON5_INVVFRAME| S3C2410_LCDCON5_PWREN| S3C2410_LCDCON5_HWSWP, .type = S3C2410_LCDCON1_TFT, .width = 240, .height = 320, .pixlock =166667, .xres =240, .yres = 320, bpp = 16,

.left_margin =20, .right_margin = 8, .hsync_len = 4, .upper_margin = 8, .lower_margin =7, .vsync_len = 4, };

(4)自定义logo

(1)进入Linux 的Ked图形面,使用图像编辑器打开图像文件,选择图像-》模式->索引颜色,将颜色改为224,大小不大于显示器分辨率,最后文件另存为ppm格式(ASCII码),文件名为:logo_linux_clut224.ppm

(2)把logo_linux_clut224.ppm拷贝到drivers/video/logo下替换相应用ppm图片,并删除所生成代码。

#rm –rf drivers/video/logo/logo_linux_clut224.*

#cp –r /mnt/hgfs/share/logo_linux_clut22.ppm driviers/video/logo 重新配置内核:

在make menuconfig Device Drivers-> Graphics support->

<*>Support for frame buffer devices [*]Bootup logo?

[*]Standard 224-color Linux logo 然后编译#make

33

6.3关于触摸板驱动移植

(1)添加代码:

将touchscreen驱动源码gec2440_ts.c添加到linux-2.6.30源码目录drivers/input/touchscreen中。

将ADC驱动源码gec2440_adc.c及头文件s3c24xx-adc.h添加到linux-2.6.30源码目录drivers/char中。

(2)修改drivers/input/touchscreen/Makefile文件。

#vim drivers/input/touchscreen/Makefile

obj-$(CONFIG_TOUCHSCREEN_GEC2440) += gec2440_ts. (3)修改drivers/input/touchscreen/Kconfig文件

#vim drivers/input/touchscreen/Kconfig添加 config TOUCHSCREEN_GEC2440

tristate \ help

Say Y here if you have the s3c2440 touchscreen. (4)修改drivers/char/Makefile文件

#vim drivers/char/Makefile添加

obj-$(CONFIG_GEC2440_ADC) += gec2440_adc.o (5)修改drivers/char/Kconfig文件

#vi drivers/char/Kconfig 添加config GEC2440_ADC

tristate\ ---help---

Say Y here if you have the s3c2440 ADC. (6)修改arch/arm/mach-s3c2410/mach-smdk2410.c文件

#vim arch/arm/mach-s3c2410/mach-smdk2410.c 添加

static struct s3c2410_ts_mach_info gec2410_ts_cfg __initdata = { .delay = 10000, .presc = 49,

.oversampling_shift = 2, };

在static void __init smdk2410_map_io(void)函数中添加: s3c24xx_init_touchscreen(&gec2410_ts_cfg);

(7)修改arch/arm/mach-s3c2440/mach-smdk2440.c文件

#vim arch/arm/mach-s3c2440/mach-smdk2440.c

在static struct platform_device *smdk2440_devices[] __initdata 结构体中添加:&s3c_device_ts,

(8)修改arch/arm/plat-s3c/include/plat/devs.h文件

#vim arch/arm/plat-s3c/include/plat/devs.h 添加:

struct s3c2410_ts_mach_info { int delay;

34

int presc;

int oversampling_shift; };

void __init s3c24xx_init_touchscreen(struct s3c2410_ts_mach_info *hard_s3c2410_ts_info);

extern struct platform_device s3c_device_ts; (9)修改arch/arm/plat-s3c24xx/devs.c文件

#vim arch/arm/plat-s3c24xx/devs.c 在文件后面添加 /* Touchscreen */

static struct s3c2410_ts_mach_info s3c2410_ts_info;

void __init s3c24xx_init_touchscreen(struct s3c2410_ts_mach_info *hard_s3c2410_ts_info)

{

memcpy(&s3c2410_ts_info,hard_s3c2410_ts_info,sizeof(struct s3c2410_ts_mach_info));

}

EXPORT_SYMBOL(s3c24xx_init_touchscreen);

struct platform_device s3c_device_ts = { .name = \ .id = -1,

.num_resources = ARRAY_SIZE(s3c_adc_resource), .resource = s3c_adc_resource, .dev = {

.platform_data = &s3c2410_ts_info, } };

EXPORT_SYMBOL(s3c_device_ts); (10)编译配置内核

#make menuconfig

配置菜单添加驱动到内核: Device Drivers --->

Input device support ---> [*] Touchscreens --->

<*> GEC2440 touchscreen input driver Character devices --->

<*> GEC2440_ADC 编译内核生成静态驱动模块 #make

(11)在内核启动中可以看到

s3c2410 TouchScreen successfully loaded

input: s3c2410 TouchScreen as /class/input/input0 注册信息为:(开发板启动后,在dnw窗口或者超级终端中输入下列指令)

35

百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说综合文库数码相框毕业设计论文 - 图文(7)在线全文阅读。

数码相框毕业设计论文 - 图文(7).doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印 下载失败或者文档不完整,请联系客服人员解决!
本文链接:https://www.77cn.com.cn/wenku/zonghe/569546.html(转载请注明文章来源)
Copyright © 2008-2022 免费范文网 版权所有
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ: 邮箱:tiandhx2@hotmail.com
苏ICP备16052595号-18
× 注册会员免费下载(下载后可以自由复制和排版)
注册会员下载
全站内容免费自由复制
注册会员下载
全站内容免费自由复制
注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: