摘要
设备驱动是嵌入式操作系统中的重要组成部分,其中块设备驱动又是嵌入式设备驱动的重要组成,因为系统程序通常存放在块设备中,其运行效率对系统的整体性能有着很大的影响。
本文介绍了嵌入式Linux中块设备的基本概念,设计并实现了以Intel XScale系列处理器PXA255为核心,采用嵌入式Linux操作系统的个人移动终端产品中的几类通用块设备驱动,包括RAM设备、基于Flash memory的MTD(Memory Technology Device)设备以及MMC(MultiMediaCard)存储设备等驱动。本文首先介绍了RAM作为块设备在系统中的实现过程以及其挂接EXT2文件系统的方法。接着详细分析了一种新的基于Flash memory而设计的块设备- MTD设备的实现原理,通过为Flash设备抽象定义共同的属性和操作接口函数实现了Flash设备更高效的读写特性和更好的支持。当前的Flash memory主要有两种形式:NOR Flash和NAND Flash,其中NAND Flash有高容量、低成本的特点,但其相对复杂的接口给其应用带来了很大难度。本文结合业界不同方案,设计并实现了不增加任何硬件成本,使用GPIO来控制NAND Flash的方法,并在其上加载了目前非常流行的JFFS2文件系统。同时,为了提高系统工作效率,本文设计并实现了在NAND Flash上同时挂接JFFS2文件系统和最新的YAFFS文件系统的方案,并且进行了数据测量和功能验证。最后,针对于目前个人移动终端产品通常支持移动存储设备的现状,本文介绍了在系统中实现MMC设备功能的软件方案。
目前,本文所描述的各项实现工作都已经完成,并且已经在系统上稳定运行。基于本课题的个人移动终端产品也已经上市,用户反应良好。
In embedded system, the driver is very important. In the period of porting system, the main task is programming the drivers. In kinds of drivers, the block driver is an important type of driver which affects the system’s performance.
In kinds of memory used in embedded system, Flash is the most popular device. Many handhelds such as Phone, PDA, MP3 player, USB storage and so on, use Flash as their storage. At present in the market, there are mainly two types of Flash: one is NOR Flash which is used widely, the other is NAND Flash. NOR Flash is excellent for XIP (eXecute In Place). And its speed of random reading is fast. However, NAND Flash which is favored by the industry at present has very high packing density, and the production flow is very simple. NOR Flash has the high bit-cost and the lower capacity. Howerever, NAND Flash with high capacity and low price appears the strong market competitive power, its emergence provide the very good solution for reducing the storage cost.
The aim of the research is to implement and optimize the block device drivers in embedded Linux based on the XScale framework. include RAM device, MTD device and MMC card driver. Among them, MTD device is a special device which supports better manager to devices based on Flash. And now MTD device’s usage in embedded system is increasing quickly.
All the work described in the paper has been finished now and has succeeded in running stably on the development platform. Meanwhile, the product based on the platform described in the paper has come into the market successfully.
引文
[1] 吕京建、肖海桥,面向二十一世纪的嵌入式系统综述:中国单片机公共实验室(BOL)北京诺浩数字基因研究所, http://www.bol-system.com
[2] Intel? XScale? Core Developer's Manual:Intel Corporation, http://www.intel.com
[3] 吴朝晖,移动“嵌”入佳境——吴朝晖教授纵谈嵌入式技术. 微电脑世界,2001 年第 7期
[4] 赵海,嵌入式 Internet,清华大学出版社 2001
[5] 红旗嵌入式系统白皮书,2002.12
[6] 李方军、徐永红,嵌入式操作系统的发展和应用,中国工程物理研究院职工工学院
[7] 郭玉东,Linux 操作系统结构分析,西安电子科技大学出版社,2002.1, 406-407,413-414
[8] 毛德操、胡希明著,Linux 内核源代码情景分析(下册),浙江大学出版社 2002.4,119-119
[9] (美)Alessandro Rubini, Jonathan Corbet 著,魏永明、骆刚、姜君译,LINUX 设备驱动程序(第二版),中国电力出版社 2002.11,16-17
[10] (美)Robert Love 著,陈莉君、康华、张波译, Linux 内核设计与实现,机械工业出版社 2004.11,179-182
[11] Cliff Brake & Jeff Sutherland ,Flash Filesystems for Embedded Linux Systems, http://www.linuxdevices.com/
[12] 李善平、郑扣根编著,Linux 操作系统及试验教程,第一版,机械工业出版社,1999.10,140-162
[13] 陈莉君编著,Linux 操作系统内核分析,第一版,人民邮电出版社,2000.3,233-280
[14] 郑良辰,日志文件系统在嵌入式存储设备上的设计和实现,中国科学院硕士学位研究生学位论文,2001,10-15,33-34,10-11
[15] Intel? PXA255 Processor Developer’s Manual:Intel Corporation,March 2003
[16] Intel? PXA250 and PXA210 Application Processors Developer's Manual Intel Corporation ,February 2002
[17] Intel? PXA255 Design Guide,Intel Corporation,March 2003
[18] 王集森,基于 INTEL XSCALE 体系的掌上电脑系统电源管理的研究与实现,东南大学论文,2004.3,18-19
[19] Jim Zeus,Linux MTD 源代码分析, 2002.4
[20] The Linux MTD, JFFS HOWTO :http://ftp.linux.org.uk/
[21] Common Flash Memory Interface Specification Release 2.0,AMD Corporation,December 2001
[22] http://www.m-sys.com
[23] Greg Ungerer ,Snap Gear ,Using Flash Memory with uClinux [DB/ OL ] ,http:/ / docs.Linux.com/article.pl?sid = 02/ 02/ 10/1912218 ,2003 - 03 - 23 .
[24] Andrew S.Tranenbaum 著,陈向阳等译,《现代操作系统》(第一版),机械工业出版社,1999.11,104-140
[25] Uresh Vahalia 著,聊鸿斌等译,Unix 高级教程-系统技术内幕(第一版),清华大学出版社, 1999.5,192-233
[26] David Woodhouse ,JFFS : The Journalling Flash File System , http://sources.redhat.com/jffs2/
[27] 张翔、刘鹏、戴国骏,嵌入式 Linux 闪存文件系统-JFFS2 的研究,杭州电子工业学院学报[3],2003.6
[28] 吴明晖主编,基于 ARM 的嵌入式系统开发与应用,人民邮电出版社,2004.6,270-275,275-278
[29] S3C2410X 32-Bit RISC Microprocessor USER'S MANUAL Revision 1.2,Samsung Electronics Co., LTD,April 2003
[30] TC58DVM82A1FTI0 User Manual,Toshiba America Electronic Components INC.
[31] Charles Manning 、Wookey,YAFFS (yet another Flash File System),Version 0.3,, December 2001
[32] By N C Bane ,Brief HOWTO on incorporating yaffs as a root fs
[33] MultiMediaCard Product Manual,http://www.sandisk.com/
[34] MultiMediaCard User’s Manual,http://www.hitachi.com/semiconductor/