linux设备驱动开发硬件平台LDD6410用户手册

更新时间:2023-06-02 06:48:01 阅读量: 实用文档 文档下载

说明:文章内容仅供预览,部分内容可能不全。下载后的文档,内容与下面显示的完全一致。下载之前请确认下面内容是否您想要的,是否完整无缺。

Linux设备驱动开发网

LDD6410开发板用户手册QQ:1275822672

Email:book@

目录1. LDD6410硬软件特性 ...............................................................................................................................................2 1.1 LDD6410的电路板组成和结构 .....................................................................................................................2 1.2 LDD6410的启动跳线设置 .............................................................................................................................6 1.3 LDD6410的软件特性 .....................................................................................................................................6 2. LDD6410 Linux开发完全剖析.................................................................................................................................7 2.1建立工具链和开发环境 .................................................................................................................................7 2.1.1 S3C6410X-ToolChain4.2.2-EABI .........................................................................................................7 2.1.2 strace、gdbserver和 arm-linux-gdb ....................................................................................................8 2.1.3 gdb调试器的用法 ................................................................................................................................8 2.1.4主机端 tftp和 nfs服务安装 ..............................................................................................................10 2.2 U-BOOT .........................................................................................................................................................10 2.2.1 U-BOOT的移植 .................................................................................................................................10 2.2.2 NAND版 U-BOOT........................................................................................................................... 11 2.2.3 SD卡版 U-BOOT ...........................................................................................................................12 2.2.4从 tftp服务器引导 Linux ...................................................................................................................12 2.3 Linux内核和驱动........................................................................................................................................13 2.3.1 LDD6410内核和 BSP ........................................................................................................................13 2.3.2按键驱动 ............................................................................................................................................15 2.3.3 LED驱动 ...........

.................................................................................................................................16 2.3.4 LCD和 VGA驱动..............................................................................................................................17 2.3.5 WM9714声卡 ASoC驱动 ..........................................................................................................22 2.3.6 DM9000网卡驱动 .......................................................................................................................22 2.3.7 USB驱动 ............................................................................................................................................23 2.3.8驱动学习实例:helloworld、globalmem、globalfifo......................................................................25 2.4根文件系统 ...................................................................................................................................................26 2.4.1根文件系统的组成 .............................................................................................................................26 2.4.2使用 nfs作为根文件系统..................................................................................................................31 2.5应用程序 .......................................................................................................................................................31 2.5.1按键测试程序 ....................................................................................................................................31 2.5.2 USB鼠标测试程序.............................................................................................................................35 2.5.3触摸屏测试程序 ................................................................................................................................37 2.5.4 framebuffer测试程序 ..................................................................................................................40 2.5.5 jpegview图片浏览器..........................................................................................................................41 2.5.6 mplayer媒体播放器 ...........................................................................................................................42 2.5.7 appweb服务器 ...............................................................................................................................43 2.6 Android ...........................................................................................................................................................43 2.6.1内核 Android补丁 .............................................................................................................................43 2.6.2 Android文件系统 ..........................

.....................................................................................................45 2.7 Qt Embedded ..................................................................................................................................................47 2.7.1 Tslib和 ts_calibration ..........................................................................................................................47 2.7.2 Qt .........................................................................................................................................................49 3. LDD6410 Linux软件包的烧录与更新...................................................................................................................50 3.1 SD卡烧录 ......................................................................................................................................................50 3.2 NAND烧录....................................................................................................................................................52 3.2.1更新 NAND版 U-BOOT...................................................................................................................52 3.2.2更新 NAND分区中的 Linux内核 ...................................................................................................52 3.2.3更新 NAND分区中的文件系统 .......................................................................................................52

Linux设备驱动开发网

LDD6410开发板用户手册QQ:1275822672

Email:book@

LDD6410开发板用户手册 1. LDD6410硬软件特性1.1 LDD6410的电路板组成和结构LDD6410是一款高端 ARM11处理器开发板,采用三星公司最新推出 S3C6410处理器,芯片拥有强大的内部资源和视频处理能力,板上集成了丰富的外围接口,其主要特点如下: 1.运行于 533MHz的 ARM11处理器(最高主频可达到 667MHz) 2.运行于 266MHz的 DDR内存,128MB 3. 1MB NOR FLASH 4. 256MB NAND FLASH 5. WM9714 AC97声卡 6. VGA输出接口(可达 1024*768@60Hz) 7. TV输出接口 8. USB 2.0 OTG接口及 USB 1.1 host接口 9. SD/SDIO接口,支持 SD卡和 SDIO设备 9. DM9000百兆网卡 10. LCD、触摸屏 11. S3C6410芯片内嵌图形加速,JPEG、多媒体编解码 12. 6个 GPIO按键 13.可扩展 Camera、WiFi、3G modem等模块 14.可扩张外部矩阵键盘 LDD6410电路板的结构如下图:

Linux设备驱动开发网其实物图如下:

LDD6410开发板用户手册QQ:1275822672

Email:book@

LDD6410的 LCD输出显示效果如下图:

Linux设备驱动开发网

LDD6410开发板用户手册QQ:1275822672

Email:book@

LDD6410的 VGA输出显示效果如下图:

Linux设备驱动开发网

LDD6410开发板用户手册QQ:12758226

72

Email:book@

Linux设备驱动开发网

LDD6410开发板用户手册QQ:1275822672

Email:book@

1.2 LDD6410的启动跳线设置通过电路板上的 SW1可设置 LDD6410的启动模式,从 SD卡启动设备为全 ON,从 NAND启动时,将 1、2设置为 ON,3、4设置为 OFF。

1.3 LDD6410的软件特性arm-linux-gcc arm-linux-gdb gdbserver strace

源代码包含独立的 LDD6410板文件支持从 SD卡、NAND启动支持 DM9000网卡引导 Linux 2.6.28内核独立源代码包含独立的 LDD6410 BSP完整的设备驱动

最新版 Busybox 1.15.1文件系统集成 jpegview, mplayer, appweb等大量集成 key-test, lcd-test, mice-test, ts-test等大量开发案例

Android 1.6内核 power management补丁源代码内核 android驱动源代码 Android 1.6 SDK和文件系统支持按键、触摸屏、鼠标支持外接 VGA显示器 Qt Embedded 4.5.3 Tslib, ts_calibration

Linux设备驱动开发网

LDD6410开发板用户手册QQ:1275822672

Email:book@

配套教材与大量 Linux设备驱动开发案例 * 2008年度 china-pub 10大畅销经典 * 2008年度 51cto、china-pub、中华读书报 10大原创精品 *畅销我国台湾地区

u-boot、内核、文件系统对 skyeye模拟器进行完整支持可模拟 CPU、内存、LCD等支持内核、内核模块、应用程序 gdb调试

2. LDD6410 Linux开发完全剖析2.1建立工具链和开发环境2.1.1 S3C6410X-ToolChain4.2.2-EABIS3C6410处理器最常使用的交叉编译工具链为 S3C6410X-ToolChain4.2.2-EABI-V0.0-cross-4.2.2-eabi.tar。下载地址: /files/cross-4.2.2-eabi.tar.bz2光盘目录: toolchains/cross-4.2.2-eabi.tar.bz2安装步骤: 1.解压上述工具链获得文件夹:4.2.2-eabi/ 2.在/usr/local/下面创建目录 arm/ (注意,最好是放到这个目录,不然在以后的编译过程中可能出现一些错误) 3.将目录 4.2.2-eabi/移动到/usr/local/arm/下面 4.设置环境变量:编辑/etc/profile文件,在文件末尾添加:PATH="$ PAT H:/ u s r/ l oca l/ a r m/ 4 . 2. 2 -e a b i/u s r/ b i n" e x p or t PATH

使环境变量生效,在终端输入命令:s ou r ce/ e t c/ p r ofi l e

另外,也可以通过修改 home目录的.bashrc来将/usr/local/arm/4.2.2-eabi/usr/bin添加到 PATH:e x p or t PATH=/ u s r/ l oca l/ a r m/ 4. 2 . 2 -e a bi/ u sr/ bi n/:$ PAT H

5.测试环境变量是否设置成功:在终端输入:echo$PATH,如果输出的路径中包含了/usr/local/arm/4.2.2-eabi/usr/bin则说明环境变量设置成功。 6.测试交叉编译工具链在终端输入 arm-linux-gcc -v显示如下:Us i n g b u i l t -i n s p e cs . Ta rge t: a r m-u n k n own -l i n u x - gn u e a b i Con fi gu r e d wi t h:/ h ome/ s cs u h/ wor k p l a ce/ c o ffe e/ b u i ld r oot -2 0 0 7 1 0 1

1/ t ool ch a i n _ b u i l d _ ar m/ gc c -4 . 2 . 2/ con fi gu r e --p r e fi x=/ u s r --b u i l d=i 3 8 6 -p c-l i n u x -gn u - -h os t=i 3 8 6 -p c -l i n u x -gn u

Linux设备驱动开发网

LDD6410开发板用户手册QQ:1275822672

Email:book@

--t a r ge t=a r m-u n k n o wn -l i n u x - gn u e a b i --e n a b l e -l a n gu a ge s= c, c++ -- wi t h -s ys r o ot=/ u s r/ l oca l/ a r m/ 4. 2 . 2 -e a b i/ --wi t h -b u i l d -t i me -t ool s=/ u s r/ l oca l/ a rm/ 4 . 2 . 2 -e a b i// us r/a r m-u n k n own -l i n u x gn u e a b i/ b i n --d i s a b l e cx a _ a t e xi t --e n a b l e -t a rge t - op t s p a ce --wi t h - gn u -l d - -e n a b l e -s h a r e d

-- wi t h -g mp=/ u s r/ l oca l/ a r m/ 4. 2 . 2 -e a b i// gmp --wi t h -mp fr=/ u s r/ l oca l/ a r m/ 4. 2 . 2 -e a bi// mp fr --d i s a b l e -n l s --e n a b l e -t h r e a ds --d i s a b l e -mu l ti li b --d i sa b l e -l a rge fi l e --wi t h -a r ch=a r m v4 t -- wi t h -fl oa t=s oft - -e n a b l e -cx x -fl a gs=- ms o ft - fl oa t Th r e a d mod e l: p os i x g c c ve r s i on 4 . 2 . 2

说明交叉编译工具链已经安装成功。

2.1.2 strace、gdbserver和 arm­linux­gdbLinux设备驱动开发网为 S3C6410整合了 ldd6410­debug­tools.tar.gz调试工具包,包含 strace、 gdbserver和 arm­linux­gdb,其中 strace、gdbserver用于目标板文件系统,arm­ linux­gdb运行于主机端对目标板上的内核、内核模块应用程序进行调试。下载地址:/files/ldd6410­debug­tools.tar.gz光盘目录:toolchains/ ldd6410­debug­tools.tar.gz解压 ldd6410­debug­tools.tar.gz,将其中的 arm­linux­gdb放入主机上 arm­linux­gcc所在的目录:/usr/local/arm/4.2.2­eabi/usr/bin/。而 strace、gdbserver则可根据需要放入目标机根文件系统的/usr/sbin目录。在目标板上运行“strace应用程序”可以跟踪应用程序所进行的所有系统调用,譬如我们 strace一下 echo命令:# s tr a ce e ch o"h e l l o, l i n u x" e x e cve ("/ b i n/ e ch o",["e ch o","h e l l o, li n u x"],[/ * 7 var s */])= 0 u n a me ({s ys=" Li n u x", n od e="l i h a ck e r", . ..})= 0 b rk (0 )= 0 x 1 4 5 0 0 0 br k ( 0 x 14 5 d 0 2 )= 0 x 1 4 5 d 0 2 s e t _t l s( 0 x 1 4 5 4 a 0, 0x 1 3 f4 c4, 0, 0x 1, 0 x 14 5 4 a 0 )= 0 b rk ( 0 x 1 6 6 d0 2 ) 0 x 1 6 6 d 0 2 br k ( 0 x 1 6 70 0 0 )= 0 x 1 6 7 0 0 0 ge t u id 3 2 ( )= 0 fcn t l 6 4 ( 1, F _ GETF L)= 0 x 2 ( fl a gs O_ RDWR) fs t a t 6 4 ( 1,{st _ mod e=S _ IF C HR| 0 6 4 4, st _ r d e v=ma k e d e v( 2 0 4, 6 4 ), . . .})= 0 i oct l ( 1, S NDCTL_ TM R_ T IM EB AS E or TCGETS,{B11 5 2 0 0 op os t i s i g i ca n on e ch o . . .})= 0 mma p 2 ( NU LL, 4 0 9 6, P ROT_ READ| P ROT_ WR ITE, M AP _ P R IVATE| M AP _ AN ONYM OUS, -1, 0 )= 0 x 4 0 00 0 0 0 0 wr i t e (1,"h el l o, l i n u x\n". .., 1 3 h

e ll o, li n u x ) e x i t _ gr ou p ( 0 )=?= 13

=

2.1.3 gdb调试器的用法GDB是 GNU开源组织发布的一个强大的 UNIX下的程序调试工具,GDB主要可帮助工程师完成下面 4个方面的功能: *启动程序,可以按照工程师自定义的要求随心所欲的运行程序。 *让被调试的程序在工程师指定的断点处停住,断点可以是条件表达式。 *当程序被停住时,可以检查此时程序中所发生的事,并追索上文。 *动态地改变程序的执行环境。为了调试 LDD6410上的应用程序,可以在目标板上开启 gdbserver,在主机端使用 arm­linux­gdb对其进行调试。下面我们编写一个简单的应用程序并演示如何通过 gdbserver和 arm­linux­gdb调试之。程序源代码如下:/* * gd b _ e x a mp l e . c: p r o gr a m t o s h ow h ow t o u s e a r m-l in u x -gd b * Cop yr i gh t 2 0 0 9 Li Ha ck e r Comp u t e r Te ch n ol o g y In c .

Linux设备驱动开发网*/ v oi d i n cr e a s e _ on e ( i nt * da t a ){ * d a t a= * d a ta+ 1;} i n t mai n ( in t a rgc, ch a r * a rgv[]){ i n t da t= 0; i n t *p= 0; i n cr e a s e _ on e (&d a t );/ * p r ogr a m wi l l cr a s h h er e */ i n cr e a s e _ on e ( p ); return 0;}

LDD6410开发板用户手册QQ:1275822672

Email:book@

通过 debug方式编译它:a r m-l i n u x -g c c - g - o gd b _ e x a mp l e gd b _ e x a mp l e . c

将程序下载到目标板后,在目标板上运行:# gd b s e r ve r 1 9 2 . 16 8 . 1. 2 0:1 2 3 4 gd b _ e x a mp l e P r oce s s gd b _ e x a mp l e cr e a t e d; p i d= 1 0 9 6 Li s t e n i n g on p or t 1 2 3 4

其中 192.168.1.20为目标板的 IP,1234为 gdbserver的侦听端口。在主机上运行:l i h a ck e r@l i h a ck e r -l a pt op:~/ l d d 6 4 1 0/t e st s/ gd b -e x a mp l e$ ar m-l i n u x -gd b gd b _ e x a mp l e GNU gd b 6 . 6 Cop yr i gh t ( C) 2 0 0 6 F r e e S oft wa r e F ou n d a t i on, In c. GDB i s fr e e s oft wa r e, co ve r e d b y t h e GNU Ge n e r a l Pu b l i c Li ce n s e, a n d you a r e we l come t o ch a n ge i t a n d/ or d i st ri b u t e cop i e s of i t u n d e r ce r t ai n con d i t i on s . Typ e"s h ow c op yi n g" t o s e e t h e con d i t i on s . Th e r e i s a b s ol u t e l y n o wa r r a n t y f or GDB. Typ e"s h ow wa r r a n t y" f or d e t a il s . Th i s GDB wa s con fi gu r e d a s"--h os t=/ u s r/l oca l/ a r m/ 4. 2 . 2 -e a b i/ u s r/ b i n/ --t a rge t=a r m-l i n u x". .. ( gd b )

主机的 arm­linux­gdb中运行如下命令连接目标板:( gd b ) t a rge t r e mot e 1 9 2 . 1 68 . 1. 2 0:1 2 3 4 Re mot e d e b u g gi n g u s i n g 1 9 2 . 1 6 8 . 1. 2 0:1 2 3 4 ... 0 x 4 0 0 0 0 7 b 0 i n?? ( )

运行如下命令将断点设置在 increase_one(&dat);这一行:( gd b ) b gd b _ e x a mp l e. c:1 6 Br e a k p oi n t 1 a t 0 x 8 3 9 0: fi l e gd b _ e x a mp

l e. c, li n e 1 6.

通过“c”命令继续运行目标板上的程序,发生断点:( gd b ) c Con t i n u i n g. ... Br e a k p oi n t 1, ma in (a rgc=1, a rg v=0 x b e a d 4 e b 4 ) a t gd b _ e x a mp l e . c:1 6 1 6 i n cr e a s e _ on e (&d a t );

运行“n”命令执行完 increase_one(&dat);再查看 dat的值:( gd b ) n 1 9 i n cr e a s e _ on e ( p ); ( gd b ) p d at$1= 1

Linux设备驱动开发网

LDD6410开发板用户手册QQ:1275822672

Email:book@

发现 dat变成 1。继续运行“c”命令,由于即将访问空指针,gdb_example将崩溃:( gd b ) c Con t i n u i n g. P r ogr a m r e ce i ve d s i gn a l S IGS EGV, S e g me n t a t i on fa u l t . 0 x 0 0 0 0 8 3 4 c i n i n cr e a s e _ on e (d a t a=0 x 0) at gd b _ e x a mp l e . c:8 8 * d a t a= * d a ta+ 1;我们通过“ b t”命令可以拿到 b a ck t r a ce: ( gd b ) b t#0 0 x 0 0 00 8 3 4 c i n i n cr e a s e _ on e ( d a t a=0 x 0) at gd b _e x a mp l e . c:8#1 0 x 0 0 00 8 3 a 4 i n mai n ( a rgc=1, a rg v=0 x b e a d 4 e b 4 ) a t gd b _ e x a mp l e . c:1 9

通过“info reg”命令可以查看当时的寄存器值:( gd b ) i n fo r e g r0 0x0 0 r1 0xbead4eb4 r2 0x1 1 r3 0x0 0 r4 0x4001e5e0 r5 0x0 0 r6 0x826c 33388 r7 0x0 0 r8 0x0 0 r9 0x0 0 r 1 0 0 x 4 0 02 5 0 0 0 r 11 0 x b ea d 4 d 4 4 r 1 2 0 x b ea d 4 d 4 8 sp 0xbead4d30 lr 0x83a4 33700 pc 0x834c 0x834c fp s 0 x 0 0 cp s r 0 x 6 0 0 0 0 0 1 0 3199028916

1073866208

1073893376 3199028548 3199028552 0xbead4d30<i n cr e a s e _ on e+2 4> 1610612752

2.1.4主机端 tftp和 nfs服务安装LDD6410可使用 tftp或 nfs文件系统与主机通过网口交互。对于 Ubuntu或 Debian用户而言,在主机端可通过如下方法安装 tftp服务:在主机端执行:s u d o a p t­ ge t i ns t al l t ft p d­ h p a s u d o mk d i r/h ome/ t ft p s u d o ch m od 7 7 7/ h ome/ t ft p

运行“sudo vim/etc/default/tftpd­hpa”或“sudo gedit/etc/default/tftpd­hpa”修改文件内容为: RUN_DAEMON="yes OPTIONS="-l -c -s/home/tftp"开启 tftp服务:s u d o/ e t c/ i n it . d/ t ft p d -h p a s t ar t St a r t in g HPA's t ft p d: i n . t ft p d .

对于 Ubuntu或 Debian用户而言,在主机端可通过如下方法安装 nfs服务:在主机端执行:a p t -ge t i n s ta l l n fs -k e r n e l -s e r ve r s u d o mk d i r/h ome/ n fs s u d o ch m od 7 7 7/ h ome/ n fs

运行“sudo vim/etc/exports”或“sudo gedit/etc/exports”修改该文件内容为:/home/nfs *(sync,rw)运行 exportfs­rv开启 NFS服务:/ e t c/ i ni t . d/ n fs -k e r n e l -s e r ve r r e st a rt

2.2 U­BOOT2.2.1 U-BOOT的移植Linux设备驱动开发网为 LDD6410开发板建立了完整独立的 U­BOOT板级支持,而不是去破坏公共代码或者对 SMDK6410进行修改。这些工作包括: (1)新的 s3c-u-boot-1.1.6\board\samsung\ldd6410板文件目录

及其下的 ldd6410.c、flash.c、lowlevel_init.S、uboot.lds等文件;

Linux设备驱动开发网

LDD6410开发板用户手册QQ:1275822672

Email:book@

(2)新的 s3c-u-boot-1.1.6\include\configs\ldd6410.h板配置文件; (3)s3c-u-boot-1.1.6\Makefile中针对 LDD6410的配置选项: ldd6410_config: unconfig@$(MKCONFIG)$(@:_config=) arm s3c64xx ldd6410 samsung s3c6410 (4)针对 LDD6410的宏定义。编译 LDD6410 U-BOOT的方法是首先运行 make ldd6410_config,在运行 make。 LDD6410的 U­BOOT可存放于 SD卡或 NAND Flash中,支持从 SD卡、NAND或网络 tftp服务器引导 Linux内核映像。编译 NAND版本的 U-BOOT时需要修改 include\configs\ldd6410.h,定义 CONFIG_BOOT_NAND而不定义 CONFIG_BOOT_MOVINAND:# d e fi n e CONF IG_ BOOT_ N AND/ *# d e fi n e CONF IG_ BOOT_ M OV IN AND */

反之对于 SD卡版 U-BOOT则需要定义 define CONFIG_BOOT_MOVINAND而不定义 CONFIG_BOOT_NAND:/ *# d e fi n e CONF IG_ BOOT_ N AND */# d e fi n e CONF IG_ BOOT_ M OV IN AND

在编译出 SD卡版本的 U-BOOT后,需要用 mkmovi这个脚本对目标代码进行处理,这个脚本的内容为:# !/ b i n/ b a s h## Th i s s cr i p t wi ll cr e a t e a u -b o ot b i n a r y f or mo vi n a n d/ mmc b o ot## p a d d i n g t o 2 5 6 k u -b oot ca t u -b o ot . b i n>> u -b o ot -2 x . b i n ca t u -b o ot . b i n>> u -b o ot -2 x . b i n s p l it -d -a 1 -b 25 6 k u -b oot -2 x . b i n u -b o ot -2 5 6 k . b i n# ma k e BL1 u -b o ot ( 8 k b ) s p l it -d -a 2 -b 8k u -b oot . b i n u -b o ot -8 k . b i n# con ca t t h e BL1 b e h i nd of p a d d e d 2 5 6 k b i na r y ca t u -b o ot -8 k . b i n 0 0>> u -b o ot -2 5 6 k . b i n 0# r e n a me a n d ch mod mv u -b o ot -2 5 6 k . b i n 0 u -b o ot -m o vi . b i n ch m od 7 7 7 u -b o ot - mo vi . b i n# r e move t e mp fi l e s r m -f u -b o ot -8 k * r m -f u -b o ot -2 5 6 k * r m -f u -b o ot -2 x . b i n

2.2.2 NAND版 U­BOOTNAND板 U­BOOT的启动信息为:U-B o ot 1 . 1 . 6 ( J a n 2 2 0 1 0 - 0 9:4 3:1 7 ) f or LD D6 4 1 0 * * * * * * * * * * * * * * * * ** * * * * * * * * * ** * * * * * * * * * * * ** LDD- S 3 C6 4 1 0 Na n d b oot v0 . 1 ** ** S h a n gHa i Li h a ck e r Comp u t e r Te c ** ** h tt p:// www. l i h a ck e r. com ** * * * * * * * * * * * * * * * * ** * * * * * * * * * ** * * * * * * * * * * * CP U: S 3 C6 4 1 0@ 5 3 2 M Hz F cl k= 5 3 2 M Hz, Hcl k= 1 3 3M Hz, P cl k= 6 6M Hz, S e ri a l= CLKU ART ( S YNC M od e ) Boa r d: DR AM: 128 MB Flash: 2 0 4 8 k B NAND: 2 5 6 M B In: s e r i al Ou t: s e r i al Er r: s e r i al Hi t a n y k e y t o s t op a u t ob o ot: 0 LD D6 4 1 0# p ri n t e n v b o ot a rgs=r o ot=/ d e v/ mt d b l ock 2 r o ot fs t yp e= ya ffs 2 c on s ol e=t t yS AC0, 11 5 2 0 0 b oot cmd=n a n d r e a d 0 x c0 0 0 8 0 0 0 0 x 0 0 0 8 0 0 0 0 0 x 0 0 8 0 0 00 0;b o ot m 0 x c0 0 0 8 0 0 0 b oot

d e l a y=3

LDD6 4 1 0

我们在 U-BOOT中通过 printenv命令可以查看 NAND情况下默认的 U­BOOT环境变量设置:

Linux设备驱动开发网

LDD6410开发板用户手册QQ:1275822672

Email:book@

b a u d r a te=11 5 2 0 0 e t ha d d r=0 0:4 0:5 c:2 6:0 a:5 b i p a d d r=1 9 2 . 1 6 8 .1 . 2 0 s e r ve r ip=1 9 2 . 1 6 8. 1 .111 ga t e wa yi p=1 9 2 . 1 6 8 . 1 . 1 n e t ma sk=2 5 5 . 2 5 5. 2 5 5 . 0 st d i n=s e r i a l s t d ou t=s e r i al s t d e rr=s e ri a l En vi r on me n t s i ze: 3 2 0/ 1 6 3 8 0 b yt e s

2.2.3 SD卡版 U­BOOT2 2 0 1 0­ 0 9:4 3:1 7 ) f or LDD6 4 1 0

U­ Bo ot 1 . 1 . 6 ( J a n

* * * * * * * * * * * * * * * * ** * * * * * * * * * ** * * * * * * * * * * * ** LDD- S 3 C6 4 1 0 S D b oot v0 . 1 ** ** S h a n gHa i Li h a ck e r Comp u t e r Te c ** ** h tt p:// www. l i h a ck e r. com ** * * * * * * * * * * * * * * * * ** * * * * * * * * * ** * * * * * * * * * * * CP U: S 3 C6 4 1 0@ 5 3 2 M Hz F cl k= 5 3 2 M Hz, Hcl k= 1 3 3M Hz, P cl k= 6 6M Hz, S e ri a l= CLKU ART ( S YNC M od e ) Boa r d: DR AM: 128 MB Flash: 2 0 4 8 k B NAND: 2 5 6 M B In: s e r i al Ou t: s e r i al Er r: s e r i al Hi t a n y k e y t o s t op a u t ob o ot: 0

LDD6 4 1 0

我们在 U-BOOT中通过 printenv命令可以查看 SD情况下默认的 U­BOOT环境变量设置:LD D6 4 1 0# p ri n t e n v b o ot a rgs=r o ot=/ d e v/ mm cb l k 0 p 2 r oot fs t yp e=e x t 3 r o ot wa i t con s ol e=t t yS AC0, 11 5 2 0 0 b o ot cmd=m o vi r e a d 3 2 0 x 0 0 8 00 0 0 0 0 x c0 0 0 8 0 0 0;b oot m 0 x c0 0 0 8 0 0 0 b o ot d e l a y=3 b a u d r a t e=11 5 2 0 0 e t h a dd r=0 0:4 0:5 c:2 6:0 a:5 b i p a d d r=1 9 2 . 1 6 8. 1 . 2 0 s er ve r i p=1 9 2 . 1 6 8. 1 .111 ga t e wa yi p=1 9 2 . 1 6 8 . 1 . 1 n e t ma sk=2 5 5 . 2 5 5. 2 5 5 . 0 st d i n=s e r i a l s t d ou t=s e r i al s t d e rr=s e ri a l En vi r on me n t s i ze: 3 3 3/ 1 6 3 8 0 b yt e s

我们可以看到 NAND和 SD版 U­BOOT的 BOOTCMD命令分别为“nand read 0xc0008000 0x00080000 0x00800000;bootm 0xc0008000”和“movi read 32 0x00800000 0xc0008000;bootm 0xc0008000”,前者通过“nand read”指令从 NAND读取 Linux内核,后者通过“movi read”指令从 SD卡读取内核。

2.2.4从 tftp服务器引导 LinuxLDD6410开发板 SD卡和 NAND版的 U­BOOT都直接支持 DM9000,U­BOOT中可以直接使用 DM9000,如运行 ping命令:LD D6 4 1 0# p i n g 1 9 2. 1 6 8 . 1. 111 d m9 0 0 0 i/ o: 0 x 1 8 0 0 0 3 0 0, i d: 0 x 9 0 0 0 0 a 4 6 M AC: 0 0:4 0:5 c:2 6:0 a:5 b op e r a t i n g a t 10 0 M fu l l du p l e x mod e h os t 1 9 2 . 1 68 . 1. 111 is al i ve LD D6 4 1 0#

可从主机的 tftp服务上直接下载 Linux内核,其操作步骤如下: 1.下载 zImage:LD D6 4 1 0# t ft p 0 x c0 0 0 8 0 0 0 z Ima ge d m9 0 0 0 i/ o: 0 x 1 8 0 0 0 3 0 0, i d: 0 x 9 0 0 0 0 a 4 6 M AC: 0 0:4 0:5

c:2 6:0 a:5 b op e r a t i n g a t 10 0 M fu l l du p l e x mod e TF TP fr om s e r ve r 1 9 2 . 1 6 8. 1 .111; ou r IP a d d r es s i s 1 92 . 1 6 8 . 1. 2 0 F i l e n a me 'z Ima ge '. Loa d a d d r e s s: 0 x c0 0 0 8 0 0 0 Loa d i n g:############################################################################################################################################################################################################################################################################################################################################################################################################################################################## d on e B yt e s t r a ns fe r r e d= 2 2 7 9 9 1 6 ( 2 2 c9 e c h e x )

2.启动内核:LD D6 4 1 0# b oot m 0 x c0 0 0 8 0 0 0

Linux设备驱动开发网Bo ot wi t h zIma ge St a r t in g k e r n e l .. .

LDD6410开发板用户手册QQ:1275822672

Email:book@

2.3 Linux内核和驱动2.3.1 LDD6410内核和 BSP力核计算机技术有限公司为 LDD6410开发板整合了唯一的内核版本,该内核版本直接为板上所有外设和 S3C6410内部各个控制器提供了驱动支持,内核启动过程如下:St a r t in g k e r n e l .. . Un c omp r e s s i n g Li n u x . . . .. .. .. .. .. .. . .. .. .. .. .. . .. .. .. .. .. .. . .. .. .. .. .. .. . .. .. .. .. .. .. . .. . .. .. .. .. .. . .. .. .. .. .. .. . .. .. .. .. .. . .. .. .. .. .. .. . .. .. .. .. .. .. . .. .. .. .. .. ... . . d on e, b oot i n g t h e k e r n el . Li n u x ve r s i on 2 . 6 . 2 8. 6­ s vn 2­ d i rt y ( r o ot@ l i h a ck e r­ l ap t op ) ( gc c ve r s i on 4 . 2 . 2 )# 4 1 Fr i J a n 1 2 1:0 4:4 8 CS T 2 0 1 0 CP U: ARM v6­ c omp a t i b l e p r oce s s or[4 1 0 fb 7 6 6] r e vi s i on 6 ( ARM v7 ), cr=0 0 c5 3 8 7 f CP U: V IP T n on a l i a s i n g d at a ca ch e, VIP T n on a l i a s i n g i n st r u ct i on ca ch e M a ch i n e: S M DK6 4 1 0 M e mor y p ol i c y: ECC d i s a b l e d, Dat a ca ch e wr i te b a ck CP U S 3 C6 4 1 0 (i d 0 x 3 6 41 0 1 0 1 ) S 3 C2 4 XX Cl ock s, ( c) 2 0 0 4 S i mte c El e ct r on i cs S 3 C6 4 XX: P LL s e t t i n gs, A=5 3 2 0 0 0 0 0 0, M=5 3 2 0 0 0 0 00, E=2 4 0 0 0 0 0 0 S 3 C6 4 XX: HC LKx 2=2 6 6 0 0 0 0 0 0, HCLK=1 3 3 0 0 0 0 0 0, P CLK=6 6 5 0 0 0 0 0 mou t _ a p l l: s ou r ce i s fou t _ a p l l ( 1 ), r a t e is 5 3 2 0 00 0 0 0 mou t _ e p l l: s ou r ce i s fou t _ e p l l (1 ), r at e i s 2 4 0 0 0 0 0 0 mou t _ mp l l: s ou r

ce i s mp l l ( 1 ), r a t e i s 5 3 2 0 0 00 0 0 mmc_ b u s: s ou r ce i s d ou t _ mp l l (1 ), r at e i s 2 6 6 0 0 0 0 0 0 mmc_ b u s: s ou r ce i s d ou t _ mp l l ( 1 ), ra t e i s 2 6 6 0 0 0 00 0 mmc_ b u s: s ou r ce i s d ou t _ mp l l ( 1), r at e i s 2 66 0 0 0 0 00 u s b­ h os t­ b u s: s ou r ce i s mou t _ e p l l ( 0), r at e i s 24 0 0 0 0 0 0 u cl k 1: s ou r ce i s d ou t _ mp l l ( 1 ), r at e i s 6 6 5 0 0 0 0 0 s p i _ e pl l: s ou r ce i s mou t _ e p l l ( 0 ), ra t e i s 2 4 0 0 0 0 00 s p i _ e pl l: s ou r ce i s mou t _ e p l l ( 0 ), ra t e i s 2 4 0 0 0 0 00 s cl k _ a u d i o0: s ou r ce i s mou t _ e p ll ( 0), r at e i s 2 4 0 0 0 0 0 0 s cl k _ a u d i o1: s ou r ce i s mou t _ e p l l ( 0 ), r a t e i s 2 4 0 0 0 0 00 s cl k _ a u d i o2: s ou r ce i s mou t _ e p ll ( 0), r at e i s 2 4 0 0 00 0 0 i r d a­ b us: s ou r ce i s mou t _ e p ll ( 0), r at e i s 2 4 0 0 0 0 0 0 Bu i l t 1 zon e l i s t s i n Zon e or d e r, mob i l it y gr ou p i n g on . Tot a l pa ge s: 3 2 5 1 2 Ke r n e l comma n d l i n e: s e t b oot a rgs r o ot=/ d e v/ mt d b l o ck 2 r o ot fs t yp e= ya ffs 2 c on s ol e=t t yS AC0, 11 5 2 0 0 P ID h a s h t a bl e e n t ri e s: 5 1 2 ( or d e r: 9, 2 0 4 8 b yt e s ) Con s ol e: c ol ou r d u mm y d e vi ce 8 0 x 3 0 c on s ol e[t t yS AC0] e n a b l e d De n t r y ca ch e h a s h t a bl e e n t ri e s: 1 6 3 8 4 ( or d er: 4, 6 5 53 6 b yt e s ) In od e­ ca ch e h a s h t a bl e e n t ri e s: 8 1 9 2 ( or d e r: 3, 3 2 7 6 8 b yt e s ) M e mor y: 1 2 8 M B= 1 2 8 M B t ot a l M e mor y: 1 2 4 9 5 6 KB a va i l a b l e ( 3 79 6 K cod e, 4 6 1 K d a ta, 5 2 4 K i ni t ) S LUB: Ge n s l a b s=1 2, HWa li gn=3 2, Or d e r=0­ 3, M i n Ob j e ct s=0, CP Us=1, Nod e s=1 Ca l i b r at i n g d el a y l o op . . . 5 3 0. 8 4 Bog oM IP S ( l p j=1 3 27 1 0 4 ) M ou n t­ ca ch e h a s h t a bl e e n tr i e s: 5 1 2 CP U: Te s t i n g wr i t e b u ffe r coh e r e n c y: ok n e t _ n a me s pa ce: 3 1 6 b yt e s NET: Re gi s t e r e d p r ot oc ol fa mi l y 1 6 S 3 C6 4 1 0: In i t i a l i s in g a r ch i t e ct u r e S 3 C DM A­ p l 0 8 0 Con t r ol l e r Dri ve r, ( c) 2 00 6­ 2 0 0 7 Sa ms u n g El e ct r on i cs Tot a l 3 2 DM A ch a n n e l s wil l b e i n it i al i ze d . S CS I s u b s ys t e m i n i ti a li ze d u s b cor e: r e gi s t e r e d n e w i n te r fa ce d r i ve r us b fs u s b cor e: r e gi s t e r e d n e w i n te r fa ce d r i ve r h ub u s b cor e: r e gi s t e r ed n e w d e vi ce d r i ve r u s b NET: Re gi s t e r e d p r ot oc ol fa mi l y 2 IP r ou t e ca ch e h a s h t a b l e e nt r ie s: 1 0 2 4 ( or d e r: 0, 4 0 96 b yt e s ) TCP e s ta b li s h e d h a s h t a bl e e n t ri e s: 4 0 9 6 ( or d e r: 3, 32 7 6 8 b yt e s ) TCP b i nd h as h t a b l e e nt r i es: 4 0 9 6 ( or d e r: 4, 8 1 9 2 0 b yt e s ) TCP: Ha s h t a b le s con fi gu r e d ( e s t a bl i s he d 4 0 9 6 b i nd 4 0 9 6

) TCP r e n o r e gi s te r e d NET: Re gi s t e r e d p r ot oc ol fa mi l y 1 Ne t Wi n d e r F l oa t i n g P oi n t Emul a t or V0 . 9 7 ( d ou b l e p re ci s i on ) J F F S 2 ve r s i on 2. 2 . ( NAND)© 2 0 0 1­ 2 0 0 6 Re d Ha t, In c. ya ffs De c 1 2 2 0 0 9 12:3 0:5 6 In s t a l l i n g. a l g: N o t e s t for s t d r n g ( k r n g) i o s ch e d u l e r n oop r e gi s t e r ed i o s ch e d u l e r an t i ci p at or y r e gi s t e r e d i o s ch e d u l e r d e ad l i n e r e gi s te r e d i o s ch e d u l e r cfq r e gi s t er e d ( d e fa u l t) S 3 C_ LCD cl o ck got e n a b l e d:: 1 3 3 . 0 0 0 M h z VG A Di s p l a y wi l l b e i ni t ia l i ze d Wi n d o w[0]­ F B1: ma p _ vi d e o_ me m or y: cl e a r ff0 0 0 0 0 0:0 0 3 0 0 0 0 0 F B1: ma p _ vi d e o_ me m or y: d ma=5 7 4 0 0 0 0 0 cp u=ff0 0 0 0 0 0 s i ze=0 0 3 0 0 0 0 0 Wi n d o w[0]­ F B2: ma p _ vi d e o_ me m or y: cl e a r ff1 8 0 0 0 0:0 0 1 8 0 0 0 0

Linux设备驱动开发网

LDD6410开发板用户手册QQ:1275822672

Email:book@

F B2: ma p _ vi d e o_ me m or y: d ma=5 7 5 8 0 0 0 0 cp u=ff1 8 0 0 0 0 s i ze=0 0 1 8 0 0 0 0 Con s ol e: s wi t ch i n g t o c ol ou r fr a me b u ffe r d e vi ce 1 2 8 x 4 8 fb 0: s 3 c fb fr a me b u ffe r d e vi ce S e r i al: 8 2 5 0/ 1 6 5 5 0 d ri ve r 4 p or t s, IRQ s h a r i n g d i s ab le d s 3 c6 4 0 0­ u a r t .0: s 3 c2 4 1 0 _ s e r i a l 0 a t MM IO 0 x 7 f0 0 5 0 0 0 ( ir q= 16 ) i s a S 3 C6 4 0 0/ 1 0 s 3 c6 4 0 0­ u a r t. 1: s 3 c2 4 1 0 _ s e r i al 1 at M M IO 0 x 7 f0 0 5 4 0 0 ( ir q= 20 ) i s a S 3 C6 4 0 0/ 1 0 s 3 c6 4 0 0­ u a r t. 2: s 3 c2 4 1 0 _ s e r i a l2 at M M IO 0 x 7 f0 0 5 8 0 0 ( ir q= 24 ) i s a S 3 C6 4 0 0/ 1 0 s 3 c6 4 0 0­ u a r t. 3: s 3 c2 4 1 0 _ s e r i a l 3 a t MM IO 0 x 7 f0 0 5 c0 0 ( i r q= 2 8 ) is a S 3 C6 4 0 0/ 1 0 br d: m od u l e l oa d e d l oop: m od u l e l oa d e d P P P ge n e r i c d ri ve r ve r s i on 2 . 4. 2 d m9 0 0 0 Et h er n e t Dr i ve r, V1 . 3 1 e t h 0: d m9 0 0 0 a a t c8 8 7 a 0 0 0, c8 8 7 e 0 0 4 IRQ 1 0 8 M AC: 0 0:1 6:d 4:9 f:e d:a 4 ( p l a t for m d a t a ) Li n u x vi d e o ca p t u r e i nt e r fa ce: v2 . 0 0 Dr i ve r 's d ' n e e d s u p d a t i n g­ pl e a se u s e b u s _t yp e me t h od s S CS I M e d i a Cha n ge r d ri ve r v0 . 2 5 Dr i ve r 'ch ' n e e d s u p d a t i n g­ pl e a s e u s e b u s _t yp e me t h od s S 3 C NAN D Dr i ve r, ( c) 2 0 0 8 S a ms u n g El e ct r on i cs S 3 C NAN D Dr i ve r i s u s i n g h ar d wa r e ECC. NAND d e vi ce: M a n u fa ct u r e r ID: 0 x e c, Ch i p ID: 0 x d a ( S a ms u n g NAND 2 5 6 M i B 3, 3 V 8­ bi t) Cr ea t i n g 3 M TD p a rt it i on s on"NAND 2 5 6 M i B 3,3 V 8­ b it": 0 x 0 0 0 0 0 0 0 0­ 0 x 0 0 0 80 0 0 0:"Bo ot l oa d e r" 0 x 0 0 0 8 0 0 0 0­ 0 x 0 0 4 00 0 0 0:"Ke r n e l" 0 x 0 0 4 0 0 0 0 0­ 0 x 1 0 0 00 0 0 0:"F i l e S ys t e m" u s b mon: d e b u

g fs i s n ot a va i l a bl e oh ci _ h cd: US B 1 . 1 'Op e n ' H os t Con t r ol l e r ( OHCI) Dr i ve r s 3 c2 4 1 0­ oh ci s 3 c2 4 1 0­ oh ci: S 3 C2 4 XX OHC I s 3 c2 4 1 0­ oh ci s 3 c2 4 1 0­ oh ci: n e w US B b u s r e gi s t e re d, a ss i gn e d b u s n u mb e r 1 s 3 c2 4 1 0­ oh ci s 3 c2 4 1 0­ oh ci: i r q 7 9, i o me m 0 x 7 4 3 0 00 0 0 u s b u s b 1: con fi gu r a t i on# 1 ch os e n fr om 1 ch oi ce h u b 1­ 0:1 . 0: US B h u b fou n d h u b 1­ 0:1 . 0: 2 p or t s d et e ct e d In i t i a li zi n g US B M a s s St or a ge d r i ve r. .. u s b cor e: r e gi s t e r e d n e w i n te r fa ce d r i ve r us b­ s t or a ge US B M a s s St or a ge s u p p or t r e gi st e r e d. s 3 c­ u d c: S 3 C HS US B OTG De vi ce Dr i ve r, ( c) 2 0 0 8­ 2 0 0 9 S a ms u n g El e ct r on i cs s 3 c­ u d c: ve r s i on 1 5 M a r ch 2 0 0 9 ( DM A M od e ) mi ce: P S/ 2 mou s e d e vi ce c om m on f or a l l mi ce i n p ut: gp i o­ k e ys a s/ cl a s s/ i n pu t/i n p u t 0 S 3 C Tou ch s cr e e n d ri ve r, ( c) 2 0 0 8 S a ms u n g El e ct r on ics S 3 C Tou ch S cr e e n got l oa d e d s u cce s s fu l l y: 1 2 b i t s i np u t: S 3 C Tou ch S cr e e n a s/ cl a ss/ i np u t/i n p ut 1 S 3 C2 4 XX RTC, ( c) 2 0 04, 2 0 0 6 S i mt e c Ele ct r on i cs s 3 c2 4 1 0 _ r t c: t i ck i r q 3 4, a la r m ir q 9 2 s 3 c2 4 1 0­ r t c s 3 c2 4 1 0­ r t c: r t c d i s a b l e d, r e­ e n a bl i n g s3 c2 4 1 0­ r t c s 3 c2 4 1 0­ r t c: r t c cor e: r e gi s t e r e d s 3 c a s r t c0 i 2 c/ d e v e nt r ie s dr i ve r s 3 c2 4 4 0­ i 2 c s 3 c2 4 4 0­ i 2 c. 0: i 2 c­ 0: S 3 C I2 C a d a p t e r s 3 c2 4 4 0­ i 2 c s 3 c2 4 4 0­ i 2 c. 1: i 2 c­ 1: S 3 C I2 C a d a p t e r a t 2 4 0­ 00 5 0: 1 0 2 4 b yt e 2 4 c0 8 EEP ROM ( wr i ta b l e) at2 4 1­ 0 0 5 7: 1 6 3 8 4 b yt e 2 4 c1 2 8 EEP ROM ( wri t a bl e ) S 3 C2 4 1 0 Wa t ch d o g Ti me r, ( c) 2 0 0 4 S i mt e c El e ct r on ics s 3 c2 4 1 0­ wd t s 3 c2 4 1 0­ wd t: wa t ch d o g i n a ct i ve, r e s e t d i s a b le d, i r q e n a bl e d s d h ci: S e cu r e Di gi t a l Hos t Con t r ol l e r In t e r fa ce d r i ve r s d h ci: Cop yr i gh t ( c) P i e r r e Os s ma n s 3 c­ s d h ci s 3 c­ s d h ci . 0: cl o ck s ou r ce 0: h s mm c ( 1 3 3 0 0 0 0 0 0 Hz) s 3 c­ s d h ci s 3 c­ s d h ci . 0: cl ock s ou r ce 1: h s mmc ( 1 3 3 0 0 0 0 0 0 Hz) s 3 c­ s d h ci s 3 c­ s d h ci . 0: cl ock s ou r ce 2: m mc_ b u s ( 5 3 2 0 0 0 0 0 Hz) mmc0: S DHC I c on t r ol l e r on s a ms u n g­ h s mmc[s 3 c­ s d h ci . 0] u s i n g ADM A u s b cor e: r e gi s t e r e d n e w i n te r fa ce d r i ve r us b h i d u s b hid: v2 . 6:US B H ID c or e d r i ve r Ad va n ce d Li n u x S ou n d Ar ch i t e ct u r e Dri ve r Ve r si on 1 . 0 . 1 8r c3 . AS o C ve r s i on 0 . 1 3 . 2 s md k 6 4 0 0 _ i n it:6 7 WM 9 7 1 3/ WM 9 7 1 4 S oC Au d i o Cod e c 0 . 1 5 a s oc: AC9 7 Hi F i<­> s 3 c6 4 x

x­ a c9 7 ma p p i n g ok u s b 1­ 1: n e w l ow s p e e d US B d e vi ce u s i n g s 3 c2 4 1 0­ oh ci a n d a d dr e s s 2 ALS A d e vi ce l i s t:# 0: S M DK6 4 1 0 ( WM 9 7 1 3 ) TCP cu b i c r e gi s t e r ed RP C: Re gi s t e r e d u d p t ra n s p or t mod u l e . RP C: Re gi s t e r e d t cp t r a n s p or t mod u l e . VF P s u p p or t v0 . 3: i mp l e me n t or 4 1 a r ch i t e ct u re 1 p a rt 2 0 va r i a nt b r e v 5 s 3 c2 4 1 0­ r t c s 3 c2 4 1 0­ r t c: s e t t i n g s ys t e m cl ock t o 2 0 0 0­ 0 2­ 2 5 2 0:0 2:3 0 UTC ( 9 5 1 5 0 8 9 5 0 ) ya ffs: d e v i s 3 2 5 0 5 8 5 8 n a me i s"mt d b l ock 2" ya ffs: p a s s e d fl a gs"" ya ffs: At t e mp t i n g M TD mou n t on 3 1 . 2,"mt d b l ock 2" s 3 c­ n a n d: ECC u n c or r e ct a b l e er r or d et e ct e d ya ffs: r e s t or e d fr om ch e ck p oi n t ya ffs _ r e a d _ s u p e r: i s Ch e ck p oi n t e d 1 VF S: M ou n t e d r oot ( ya ffs 2 fi l e s ys t e m) .

Linux设备驱动开发网

LDD6410开发板用户手册QQ:1275822672

Email:book@

F r e e i n g i ni t me mor y: 5 2 4 K mmc0: n e w h i gh s p e e d S D ca r d a t a d dr e s s 1 d 1 d mmc b l k 0: mm c0:1 d 1 d S D0 2 G 1 . 8 3 Gi B mmcb l k 0: p 1 p 2 u s b 1­ 1: c on fi gu r a t i on# 1 ch os e n fr om 1 ch oi ce i n p u t: US B M ou s e a s/ cl a s s/i n p ut/ i np u t 2 ge n e r i c­ u s b 0 0 0 3:1 5 D9:0 A3 3 . 0 0 0 1: i n p u t: US B H ID v1 . 1 0 M ou s e[US B M ou s e] on u s b­ s 3 c2 4 x x­ 1/ input0 e t h 0: l i n k d own We l c ome t o ARM Li n u x for Li h a ck e r LDD6 4 1 0 F or fu r t h e r i n for ma t i on p l e a s e ch e ck: h t t p:// www. l i h a ck e r. co m/ h t t p:// www. li n u x d ri ve r. cn/ F or t e ch n i ca l s u p p or t, p l ea s e s u b s cr i b e ma il li st li n ux d r i ve r@ go o gl e gr ou p s . c om a n d p os t t h er e . Th e ur l i s h t t p:// gr ou p s . g o o gl e . c om/ gr ou p/ l i n u x d r i ve r. g_ fi l e _ s t or a ge ga d ge t: F i l e­ b a ck e d St or a ge Ga d ge t, ve r s i on: 7 Au gu s t 2 0 0 7 g_ fi l e _ s t or a ge ga d ge t: Nu mb e r of LUNs=1 g_ fi l e _ s t o r a ge ga d ge t­ l u n 0: r o=0, fi l e:/ d e mo/ vfa t . i mg Re gi s t e r e d ga d ge t d ri ve r 'g_ fi l e _ s t or a ge '# e t h 0: l i n k u p, 1 0 0M b p s, fu l l­ d u pl e x, lp a 0 x 45 E1#

在 BSP方面,力核建立了独立的 LDD6410板文件,位于内核源代码的 arch/arm/mach­s3c6410/mach­ ldd6410.c,该板文件对 LDD6410开发板板上设备、资源进行了整合。因此,在为 LDD6410开发板编译内核的时候,在“system type”下面应选择的“LDD6410”。

这里要强调一点的是,很多人在进行 Linux移植时候,喜欢直接修改参考电路板的板文件,比如 arch/arm/mach­s3c6410/mach­smdk6410.c,这种做法是错误的。其原因在于,板文件就是对自

身电路板设备和资源的描述,自身设计的电路板与 smdk板并不相同,直接修改 smdk既破坏了对方的 BSP,也没有体现自己的特点。

2.3.2按键驱动Linux内核下的 drivers/input/keyboard/gpio_keys.c实现了一个体系结构无关的 GPIO按键驱动,使用此按键驱动,开发者不需要修改一行代码,只需要在 BSP的板文件(对于 LDD6410为 arch/arm/mach­ s3c6410/mach­ldd6410.c)中定义相关的 platform设备和数据。在 LDD6410开发板上,用 GPN0~GPN5实现了 DOWN、ENTER、HOME、UP、TAB、END六个按键,因此其对应的 platform信息如下:s t a ti c s t r u ct gp i o_ k e ys _ b u t t on l d d 6 4 1 0 _ b u tt on s[]={{ . gp i o= S 3 C6 4 XX_ GP N( 0 ), . cod e= KEY_ DOW N, .desc="Do wn", . a ct i ve _ l ow= 1,},{ . gp i o= S 3 C6 4 XX_ GP N( 1 ),

Linux设备驱动开发网. cod e .desc . a ct i ve _ l ow . wa k e u p},{ . gp i o . cod e .desc . a ct i ve _ l ow},{ . gp i o . cod e .desc . a ct i ve _ l ow . wa k e u p},{ . gp i o . cod e .desc . a ct i ve _ l ow},{ . gp i o . cod e .desc . a ct i ve _ l ow},};============

LDD6410开发板用户手册QQ:1275822672= KEY_ ENTER,="En t e r",= 1,= 1,

Email:book@

S 3 C6 4 XX_ GP N( 2 ), KEY_ HOM E,"Ho me", 1,

= S 3 C6 4 XX_ GP N( 3 ),= KEY_ P OWER,="P owe r",= 1,= 1,

S 3 C6 4 XX_ GP N( 4 ), KEY_ TAB,"Ta b", 1,

S 3 C6 4 XX_ GP N( 5 ), KEY_ M ENU,"M e n u", 1,

s t a ti c s t r u ct gp i o_ k e ys _ p l a t f or m_ d a t a l d d6 4 1 0 _ b u tt on _ d a t a={ . b u t t on s= l d d 6 4 1 0 _ b ut t on s, . n b u tt on s= ARR AY_ S IZE( l d d 6 4 1 0 _ b u t t on s ),}; s t a ti c s t r u ct p l at for m_ d e vi ce l d d 6 4 1 0 _ d e vi ce _ b u t t on={ . n a me="gp i o-k e ys", .id= -1, .dev={ . p l at for m_ d a t a=&l d d 6 4 1 0 _ b u tt on _ d a t a,}};

并将“&ldd6410_device_button,”语句填入 struct platform_device *ldd6410_devices[]数组,作为该数组的一个成员。编译内核时选择:De vi ce Dr i ve r s­­­> In p u t d e vi ce s u p p or t­­­>[*] Ke yb oa r d s­­­><*> GP IO Bu t t on s

如果要修改按键对应的 GPIO和键值,只需要简单的修改 ldd6410_buttons[]数组中的内容。

2.3.3 LED驱动Linux内核下的 drivers/leds/leds­gpio.c实现了一个体系结构无关的 GPIO LED驱动,使用此 LED驱动,开发者不需要修改一行代码,只需要在 BSP的板文件(对于 LDD6410为 arch/arm/mach­s3c6410/mach­ ldd6410.c)中定义相关的 platform设备和数据。在 LDD6410开发板上,用 GPM0~GPM3实现了四个 LED,因此其对应的 platform信息如下:s t a ti c s t r u ct gp i o_ l e d l d d 6 4 1 0 _l e d s[]={[0]={ . n a me="LED1", . gp i o= S 3 C6 4 XX_ GP M ( 0 ),},[1]={ . n a me="LED2", . gp i o= S 3 C6 4 XX_ GP M ( 1 ),

Linux设备驱动开发网},[2]={ . n a me="LED3", . gp i o= S 3 C6 4 XX_ GP M ( 2 ),},[3]={ . n a me="LED4", . gp i o= S 3 C6 4 XX_ GP M ( 3 ),},};

LDD6410开发板用户手册QQ:1275822672

Email:book@

s t a ti c s t r u ct gp i o_ l e d _ p la t for m_ d a t a l dd 6 4 1 0 _ gp i o_ l e d _ p d a t a={ . n u m_ l e d s= ARRAY_ S IZE( l d d 6 4 1 0 _ l e d s ), . l e d s= ld d 6 4 1 0 _ le d s,}; s t a ti c s t r u ct p l at for m_ d e vi ce l d d 6 4 1 0 _ d e vi ce _ l e d={ . n a me="l e d s­ gp i o", .id=­1, .dev={ . p l at for m_ d a t a=&l d d 6 4 1 0 _ gp i o_ l e d _ p d at a,},};

并将“&ldd6410_device_led,”语句填入 struct platform_device *ldd6410_devices[]数组,作为该数组的一个成员。编译内核时选择:De vi ce Dr i ve r s­­­>[*] LED S u p p or t­­­><*> LED Cl a s s S u p p or t<*> LED S u p p or t for GP IO c on n e ct e d LEDs

内核启动时会打印:Re gi s t e r e d Re gi s t e r e d Re gi s t e r e d Re gi s t e r e d led led led led d e vi ce: d e vi ce: d e vi ce: d e vi ce: LED1 LED2 LED3 LED4

LED1、LED2、LED3、LED4分别对应板子右下角的 D2、D3、D4、D5。通过如下命令可以开亮 D2:# e ch o 1>/ s ys/ cl a s s/ l e d s/ LED1/ b r i gh t n e s s

通过如下命令可以熄灭 D2:# e ch o 0>/ s ys/ cl a s s/ l e d s/ LED1/ b r i gh t n e s s

与按键类似,如果要修改 LED对应的 GPIO和极性,只需要简单的修改 ldd6410_buttons[]数组中的内容即可。

2.3.4 LCD和 VGA驱动LDD6410支持 LCD和 VGA两种输出方式,默认的内核支持 LCD。为编译支持 VGA的内核,运行 make menuconfig,进入如下菜单项,并选择“VGA”。De vi ce Dr i ve r s­­­> Gr a p h i cs s u p p or t­­­> S u p p or t for fr a me b u ffe r d e vi ce s S 3 C F r a me b u ffe r S u p p or t­­­>

Linux设备驱动开发网

LDD6410开发板用户手册QQ:1275822672

Email:book@

也可运行 make menuconfig设置 VGA的分辨率,若要设置为 1024*768@60HZ,进入如下菜单项,并选择“1024*768@60HZ”。De vi ce Dr i ve r s­­­> Gr a p h i cs s u p p or t­­­> S e l e ct VGA Re s ol u t i on f or S 3 C F r a me b u ffe r ( 1 0 2 4 * 76 8@ 6 0 HZ)

LCD方面,Linux设备驱动开发网开发了独立的集成 LCD和触摸屏的电路板,采用 WANXIN IMAGE的 WXCAT43­TG3,其分辨率为 480*272。其配置选项如图:

Linux设备驱动开发网

LDD6410开发板用户手册QQ:1275822672

Email:book@

linux内核下的 drivers/video/samsung/实现了 S3C6410内部 framebuffer控制器的绝大多数工作,对于新的 LCD移植,主体工作是根据 LCD数据手册获取时序参数,并填充入驱动。譬如我们从 WANXIN IMAGE的 WXCAT43­TG3数据手册可获得如下表:

Lin

ux设备驱动开发网

LDD6410开发板用户手册QQ:1275822672

Email:book@

据此可以得到如下的驱动 drivers/video/samsung/s3cfb_wanxin.c:# i n cl u d e .. .# i n cl u d e"s 3 cfb . h"/ * 4 8 0 * 2 72 */# d e fi n e S 3 CF B_ HF P# d e fi n e S 3 CF B_ HS W# d e fi n e S 3 CF B_ HBP# d e fi n e S 3 CF B_ VF P# d e fi n e S 3 CF B_ VS W# d e fi n e S 3 CF B_ VBP# d e fi n e S 3 CF B_ HRES# d e fi n e S 3 CF B_ VRES

2/ * fr on t p or ch */ 4 1/ * h s yn c wi d t h */ 2/ * b a ck p or ch */ 2 10 2/ * fr on t p or ch *// * vs yn c wi d t h *// * b a ck p or ch */

480/ * h or i zon p i x e l x re s ol i ti on */ 2 7 2/ * l i ne cn t y r e s ol u t i on */ x re s ol i ti on */ y r e s ol u t i on */

# d e fi n e S 3 CF B_ HRES _ V IRTU AL 4 8 0/ * h or i zon p i x el# d e fi n e S 3 CF B_ VRES _ V IRTU AL ( 2 7 2 * 2 )/ * l in e cn t# d e fi n e S 3 CF B_ HRES _ OS D# d e fi n e S 3 CF B_ VRES _ OS D# d e fi n e S 3 CF B_ VF RAM E_ F REQ

48 0/ * h or i zo n p i x el x re s ol i ti on */ 27 2/* li n e cn t y r e s ol u t i on */ 60/ * fr a me r a t e fr e q */

# d e fi n e S 3 CF B_ P IXE L_ C LOCK ( S 3 CF B_ VF R AM E_ F REQ * ( S 3 CF B_ HF P+ S 3 CF B_HS W+ S 3 CF B_ HBP+ S 3 CF B_ HRES ) * ( S 3 CF B_ VF P+ S 3 CF B_ VS W+ S 3 CF B_ VBP+ S 3 CF B_ VRES ) ) s t a ti c v oi d s 3 cfb _ s e t _ fi md _ i n fo( v oi d ){ s 3 cfb _ fi md . vi d c on 1= S 3 C_ V ID CON1 _ IHS YNC_ IN V ERT| S 3 C_ VIDC ON1 _ IVS YNC_ INVERT|

S3C_VIDCON1_IVDEN_NORMAL;s 3 cfb _ fi md . vi d t c on 0= S 3 C_ V IDTC ON0 _ VBP D( S 3 CF B_ VBP - 1 )| S 3 C_ V IDTC ON0 _ VF P D( S 3 CF B_ VF P - 1 )| S 3 C_ VID TCON0 _ VS P W( S 3 CF B_ VS W - 1 ); s 3 cfb _ fi md . vi d t c on 1= S 3 C_ V IDTC ON1 _ HBP D( S 3 CF B_ HBP - 1 )| S 3 C_ V IDTC ON1 _ HF P D( S 3 CF B_ HF P - 1 )| S 3 C_ VID TCON1 _ HS P W( S 3 CF B_ HS W - 1 ); s 3 cfb _ fi md . vi d t c on 2= S 3 C_ V IDTC ON2 _ LINEVAL( S 3 CF B_ VRES - 1 )| S 3 C_ V IDTC ON2 _ HOZ VAL( S 3 CF B_ HRES - 1 ); s 3 cfb _ fi md . vi d os d 0 a= S 3 C_ V IDOS Dx A_ OS D_ LTX_ F ( 0 )| S 3 C_ VIDOS Dx A_ OS D_ LTY_ F ( 0 ); s 3 cfb _ fi md . vi d os d 0 b= S 3 C_ V ID OS Dx B_ OS D_ R BX_ F ( S 3 CF B_ HRES - 1 )| S 3 C_ V IDOS Dx B_ OS D_ RB Y_ F ( S 3 CF B_ VRES - 1 ); s 3 cfb _ fi md . vi d os d 1 a= S 3 C_ V IDOS Dx A_ OS D_ LTX_ F ( 0 )| S 3 C_ VIDOS Dx A_ OS D_ LTY_ F ( 0 ); s 3 cfb _ fi md . vi d os d 1 b= S 3 C_ V ID OS Dx B_ OS D_ R BX_ F ( S 3 CF B_ HRES _ OS D - 1 )| S 3 C_ V IDOS Dx B_ OS D_ RB Y_ F ( S 3 CF B_ VRES _ OS D - 1 ); s 3 cfb _ fi md . wi d t h= S 3 CF B_ HRES; s 3 cfb _ fi md . h e i gh t= S 3 CF B_ VRES; s 3 cfb _ fi md . x r e s= S3 CF B_ HRES; s 3 cfb _ fi md . yr e s= S 3 CF B_ VRES;# i f d e fi n e d ( CONF IG_ F B_ S 3 C_ V IRT U AL_ S CREE N) s 3 cfb _ fi md . x r e s _ vi r t ua l= S 3 CF B_ HRES _ V IRTU AL; s 3 cfb _ fi md . yr e s _ vi r t u a l= S 3 CF

B_ VRES _ V IRTU AL;#else s 3 cfb _ fi md . x r e s _ vi r t ua l= S 3 CF B_ HRES; s 3 cfb _ fi md . yr e s _ vi r t u a l= S 3 CF B_ VRES;#endif s 3 cfb _ fi md . os d _ wi d t h= S 3 CF B_ HRES _ OS D; s 3 cfb _ fi md . os d _ h e i gh t= S 3 CF B_ VRES _ OS D; s 3 cfb _ fi md . os d _ x r e s= S 3 CF B_ HRES _ OS D; s 3 cfb _ fi md . os d _ yr e s= S 3 CF B_ VRES _ OS D; s 3 cfb _ fi md . os d _ x r e s _ vi r t u a l= S 3 CF B_ HRES _ OS D; s 3 cfb _ fi md . os d _ yr e s _ vi r t u a l= S 3 CF B_ VRES _ OS D;

Linux设备驱动开发网

LDD6410开发板用户手册QQ:1275822672

Email:book@

s 3 cfb _ fi md . p i x cl o ck= S 3 CF B_ P IXE L_ C LO CK; s 3 cfb _ fi md . h s yn c_ l e n= S 3 CF B_ HS W; s 3 cfb _ fi md . vs yn c_ l e n= S 3 CF B_ VS W; s 3 cfb _ fi md . l e ft _ ma rgi n= S 3 CF B_ HF P; s 3 cfb _ fi md . u p p e r _ ma rgi n= S 3 CF B_ VF P; s 3 cfb _ fi md . r i gh t _ ma rgi n= S 3 CF B_ HBP; s 3 cfb _ fi md . l owe r _ ma rgi n= S 3 CF B_ VBP;} i n t s 3 cfb _ wa n x i n _ s e t _ gp i o( v oi d ){ u n s i gn e d l on g va l; int i;/ * Mu s t b e '0 ' for N or ma l -p a t h i n st e a d of B y-p a s s */ wr i t el ( 0 x 0, S 3 C_ HOS TIF B_ M IF P CON);/ * e n ab l e cl o ck t o LC D */ va l= r e a dl ( S 3 C_ HCLK_ G ATE); va l|= S 3 C_ CLKCO N_ HC LK_ LC D; wr i t el ( va l, S3 C_ HCLK_ G ATE);/ * s el e ct TF T LCD t yp e ( RGB I/ F ) */ va l= r e a dl ( S 3 C6 4 XX_ S P C_ BAS E); va l&=~ 0 x 3; va l|= ( 1<< 0 ); wr i t el ( va l, S3 C6 4 XX_ S P C_ BAS E);/ * VD */ f or ( i= 0; i< 1 6; i++) s 3 c_ gp i o_ c f gp i n ( S 3 C6 4 XX_ GP I( i ), S 3 C_ GP IO_ S F N( 2 ) ); f or ( i= 0; i< 1 2; i++) s 3 c_ gp i o_ c f gp i n ( S 3 C6 4 XX_ GP J ( i ), S 3 C_ GP IO_ S F N( 2 ) ); md e l a y( 1 0 0 ); return 0;} v oi d s 3 cfb _ i n i t _ h w( voi d ){ p r i n t k( KERN_ INF O"WANX IN LCD wi l l b e i ni t ia l i zed\n"); s 3 cfb _ s e t _ fi md _ i n fo( ); s 3 cfb _ wa n x i n _ s e t _ gp i o( );}

其中的 S3CFB_HFP、S3CFB_HSW、S3CFB_HBP、S3CFB_VFP、S3CFB_VSW、S3CFB_VBP均直接取材于表中的数据。而对于 VGA驱动 drivers/video/samsung/s3cfb_vga.c而言,这些参数直接取自 VESA工业标准:# i fd e f CONF IG_ F B_ S 3 C_ VG A_ 1 0 2 4 _ 7 6 8/ * 1 0 2 4 * 76 8 */# d e fi n e S 3 CF B_ HF P 24/* fr on t p or ch */# d e fi n e S 3 CF B_ HS W 1 3 6/ * h s yn c wi d t h */# d e fi n e S 3 CF B_ HBP 1 6 0/ * b a ck p or ch */# d e fi n e S 3 CF B_ VF P 3/ * fr on t p or ch */# d e fi n e S 3 CF B_ VS W 6/ * vs yn c wi d t h */# d e fi n e S 3 CF B_ VBP 29/* b a ck p or ch */# d e fi n e S 3 CF B_ HRES 1024/ * h or i zon p i x e l x r e s ol i ti on */# d e fi n e S 3 CF B_ VRES 7 6 8/ * li n e cn t y r e s ol u t i on */

# d e fi n e# d e fi n e# d e fi n e# d e fi n e

S 3 CF B_ HRES _ V IRTU AL S 3 CF B_ VRES _ V IRTU AL S 3 CF B_ HRES _ OS D S 3 CF

B_ VRES _ OS D

1024/ * h or i zon p i x e l x r e s ol i ti on */ ( 7 6 8 * 2 )/ * li n e cn t y r e s ol u t i on */ 1024/ * h or i zon p i x e l x r e s ol i ti on */ 7 6 8/ * li n e cn t y r e s ol u t i on */

本文来源:https://www.bwwdw.com/article/ljz1.html

Top