搜档网
当前位置:搜档网 › IDE驱动程序分析及SATA驱动程序移植

IDE驱动程序分析及SATA驱动程序移植

计 算 机 系 统 应 用 https://www.sodocs.net/doc/792428144.html, 2014 年 第23卷 第 1 期

140软件技术·算法 Software Technique ·Algorithm

IDE 驱动程序分析及SATA 驱动程序移植①

洪承煜, 杨尚琴

(中国石化石油物探技术研究院, 南京 211103)

摘 要: SATA 硬盘已经是目前多媒体应用中被广泛使用的存储介质, 而有些多媒体产品的Linux 版本中, 并不支持SATA 驱动框架. 本文通过对Linux 下IDE 驱动框架及其相关的Linux 驱动代码的分析, 提供了一种在IDE 驱动程序框架下移植SATA 驱动程序的方法. 最后以SiI3512为例, 介绍了SATA 驱动程序的移植过程. 对于其它此类系统的移植具有很好的借鉴作用. 关键词: Linux 驱动; IDE; SATA 驱动移植

Analysis of IDE Driver and Migration of SATA Driver

HONG Cheng-Yu, YANG Shang-Qin

(SINOPEC Geophysical Research Institute, Nanjing 211103, China)

Abstract : SATA disk is Storage Media that has already been widely used in a multimedia applications currently, while many versions of Linux in Multimedia products that its driver framework does not support SATA drives. By analysing the driver framework in linux and its associated code analysis, this paper provides a way for porting SATA drives in IDE driver framework. Finally to SiI3512 example, the paper describes the porting process of SATA driver. This has a good reference for migration of other similar systems.

Key words : Linux Driver; IDE; Migration of SATA Driver

在很多嵌入式多媒体产品开发中, 目前广泛使用的SATA 硬盘存储是一个很好的解决方案, 但是由于有些嵌入式多媒体产品受制于BSP(板级支持包)等与Linux 版本的相关性, 使得必须为不支持SATA 驱动程序框架的Linux 版本开发新的SATA 驱动程序. 本文通过分析Linux 2.4.15内核的IDE 驱动程序框架, 并从Linux 2.4.23内核中获取SiI3512驱动程序, 从而借助ATA 转SATA 接口芯片SiI3512[3]来达到访问SATA 硬盘的目的.

1 IDE 驱动程序框架分析[1]

在Linux 2.4.15内核中, 不同的体系结构(如x86、mips 、arm 等)有着不同的IDE 最大接口数, 一般情况下有主、次两个IDE 接口, 而每个IDE 接口又可以接主、从共两个IDE 设备(如硬盘、软盘、光盘等), 即最多可以有4个IDE 设备.

① 收稿时间:2013-06-18;收到修改稿时间:2013-07-22

在Linux 2.4.15内核中, 用ide_hwifs[]数组记录所有的IDE 接口, 而数组的每个元素都是一个ide_hwif_t 类型的结构体, 代表一个IDE 接口. Linux2.4.15系统初始化时如果检测到一个IDE 接口, 就把相应表项中的present 属性设成1; 同时, 初始化时如果检测到某个接口上有IDE 设备相连, 也将ide_hwif_t 结构体内相应的类型为ide_drive_t 的drives[]中的present 属性也设成1, 并根据从系统的CMOS 芯片中读到或检测到的各项参数设置到ide_hwif_t 结构体中. 其中ide_hwif_t 数据类型是对IDE 接口的描述, 而ide_drive_t 数据类型是对连接在具体IDE 接口上的“IDE 设备”的描述. 比如, 如果在系统的主IDE 接口上检测到有主、从两个IDE 设备相连, 就把这两个IDE 设备的参数分别填入ide_hwifs[0]中的drives[0]和drives[1]中, 并把它们的present 属性设置成1. 又如, 如果在次IDE 接口上连接着一个MA TSUSHITA CDROM,

相关主题