S3C2440 上RTC 时钟驱动开发实例讲解 一、开发环境 主 机:VMWare—ubuntu10
10 开发板:Mini2440--64MB Nand, Kernel:2
4 编译器:arm-linux-gcc-4
2 二、相关概念 1、平台设备: 通常在 Linux中,把 SoC系统中集成的独立外设单元(如:I2C、IIS、RTC、看门狗等)都被当作平台设备来处理
在 Linux中用 platform_device结构体来描述一个平台设备,在 2
4内核中定义在:include/linux/platform_device
h中,如下: struct platform_device { const char * name; //设备名称 int id; struct device dev; u32 num_resources; //设备使用各类资源的数量 struct resource * resource; //设备使用的资源 struct platform_device_id *id_entry; }; 现在你不必深入理解这个结构体,只要知道在 Linux 中是用这个结构体来定义一些平台设备的
比如在:arch/arm/plat-s3c24xx/devs
c中就定义了很多平台设备,下面我就只贴出 RTC 这一种的: * RTC */ static struct resource s3c_rtc_resource[] = { //定义了 RTC 平台设备使用的资源,这些资源在驱动中都会用到 [0] = { //IO 端口资源范围
start = S3C24XX_PA_RTC,
end = S3C24XX_PA_RTC + 0xff,
flags = IORESOURCE_MEM, }, [1] = { //RTC 报警中断资源