RTC驱动模型分析

①RTC设备层:
设备资源的定义:arch/arm/plat-s3c24xx/devs.c
static struct resource s3c_rtc_resource[] = {
	[0] = {
		.start = S3C24XX_PA_RTC,
		.end   = S3C24XX_PA_RTC + 0xff,
		.flags = IORESOURCE_MEM,
	},
	[1] = {
		.start = IRQ_RTC,
		.end   = IRQ_RTC,
		.flags = IORESOURCE_IRQ,
	},
	[2] = {
		.start = IRQ_TICK,
		.end   = IRQ_TICK,
		.flags = IORESOURCE_IRQ
	}
};
struct platform_device s3c_device_rtc = {
	.name		  = "s3c2410-rtc",
	.id		  = -1,
	.num_resources	  = ARRAY_SIZE(s3c_rtc_resource),
	.resource	  = s3c_rtc_resource,  //##
};
arch/arm/mach-s3c2440/mach-tq2440.c
static struct platform_device *tq2440_devices[] __initdata = {
	......,
	&s3c_device_rtc, //##
	......,
};
tq2440_devices[]这个数组在哪里被使用?这意味着RTC设备在哪里被注册。它是个静态数组,就在该文件找就行了。
tq2440_machine_init(void)
platform_add_devices(tq2440_devices, ARRAY_SIZE(tq2440_devices));//注意:是platform_add_devices是通过for循环调用platform_devices_add()函数
//通过这个函数就把这个数组里边所有的设备资源都注册到了platform设备总线下
根据宏的展开:
MACHINE_START(S3C2440, "TQ2440")
......
.init_machine = tq2440_machine_init,  //这个函数是被放在“.arch.info.init”段,在加载内核时会被自动调用
......
MACHINE_END

--------------------------------------------------------------------------------------------------------------------------------------------------------------
②RTC驱动层
drivers/rtc/rtc-s3c.c
static struct platform_driver s3c2410_rtc_driver = {
	.probe		= s3c_rtc_probe,
	......
	.driver		&#
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值