} static int s3c_rtc_ioctl(struct device *dev, unsigned int cmd, unsigned long arg) {
} static int s3c_rtc_gettime(struct device *dev, struct rtc_time
*rtc_tm) {
} static int s3c_rtc_settime(struct device *dev, struct rtc_time *tm) {
} static int s3c_rtc_getalarm(struct device *dev, struct rtc_wkalrm
*alrm) {
} static int s3c_rtc_setalarm(struct device *dev, struct rtc_wkalrm
*alrm) {
} static const struct rtc_class_ops s3c_rtcops = { .open = s3c_rtc_open, .release = s3c_rtc_release, .ioctl = s3c_rtc_ioctl, .read_time = s3c_rtc_gettime, .set_time = s3c_rtc_settime, .read_alarm = s3c_rtc_getalarm, .set_alarm = s3c_rtc_setalarm, .proc = s3c_rtc_proc, }; ------------------------------------------------ static int s3c_rtc_remove(struct platform_device *dev) { ............... } static int s3c_rtc_probe(struct platform_device *pdev) { ............... } #ifdef CONFIG_PM static int s3c_rtc_suspend(struct platform_device *pdev,
pm_message_t state) { ................. } static int s3c_rtc_resume(struct platform_device *pdev) { ................... } #else #define s3c_rtc_suspend NULL #define s3c_rtc_resume NULL #endif static struct platform_driver s3c2410_rtcdrv = { .probe = s3c_rtc_probe, .remove = s3c_rtc_remove, .suspend = s3c_rtc_suspend, .resume = s3c_rtc_resume, .driver = { .name = "s3c2410-rtc", .owner = THIS_MODULE, }, }; static char __initdata banner[] = "S3C24XX RTC, (c) 2004,2006
Simtec Electronics\n"; static int __init s3c_rtc_init(void) { printk(banner); return platform_driver_register(&s3c2410_rtcdrv); } static void __exit s3c_rtc_exit(void) { platform_driver_unregister(&s3c2410_rtcdrv); } module_init(s3c_rtc_init); module_exit(s3c_rtc_exit); MODULE_DESCRIPTION("Samsung S3C RTC Driver"); MODULE_AUTHOR("YX "); MODULE_LICENSE("GPL"); ================================================ 3。Makefile的结构如下: Debug Config====必须的Config(这类驱动核心程序)====各类开发板及相应芯片的驱动配置 # # Makefile for RTC class/drivers. # ifeq ($(CONFIG_RTC_DEBUG),y) EXTRA_CFLAGS += -DDEBUG endif obj-$(CONFIG_RTC_LIB) += rtc-lib.o obj-$(CONFIG_RTC_HCTOSYS) += hctosys.o obj-$(CONFIG_RTC_CLASS) += rtc-core.o rtc-core-y := class.o interface.o obj-$(CONFIG_RTC_INTF_SYSFS) += rtc-sysfs.o obj-$(CONFIG_RTC_INTF_PROC) += rtc-proc.o obj-$(CONFIG_RTC_INTF_DEV) += rtc-dev.o obj-$(CONFIG_RTC_DRV_DS1307) += rtc-ds1307.o obj-$(CONFIG_RTC_DRV_DS1672) += rtc-ds1672.o obj-$(CONFIG_RTC_DRV_DS1742) += rtc-ds1742.o obj-$(CONFIG_RTC_DRV_OMAP) += rtc-omap.o obj-$(CONFIG_RTC_DRV_PCF8563) += rtc-pcf8563.o obj-$(CONFIG_RTC_DRV_PCF8583) += rtc-pcf8583.o obj-$(CONFIG_RTC_DRV_S3C) += rtc-s3c.o ================================================= Kconfig: menu "Real Time Clock" config RTC_LIB tristate config RTC_CLASS tristate "RTC class" depends on EXPERIMENTAL default n select RTC_LIB help Generic RTC class support. If you say yes here, you will be allowed to plug one or more RTCs to your system. You will probably want to enable one or more of the interfaces below. This driver can also be built as a module. If so, the module will be called rtc-class. config RTC_HCTOSYS bool "Set system time from RTC on startup" depends on RTC_CLASS = y default y help If you say yes here, the system time will be set using the value read from the specified RTC device. This is useful in order to avoid unnecessary fsck runs. config RTC_HCTOSYS_DEVICE string "The RTC to read the time from" depends on RTC_HCTOSYS = y default "rtc0" help The RTC device that will be used as the source for the system time, usually rtc0. config RTC_DEBUG bool "RTC debug support" depends on RTC_CLASS = y help Say yes here to enable debugging support in the RTC framework and individual RTC drivers. comment "RTC interfaces" depends on RTC_CLASS config RTC_INTF_SYSFS tristate "sysfs" depends on RTC_CLASS && SYSFS default RTC_CLASS help Say yes here if you want to use your RTCs using sysfs interfaces, /sys/class/rtc/rtc0 through /sys/.../rtcN. This driver can also be built as a module. If so, the module will be called rtc-sysfs. config RTC_INTF_PROC tristate "proc" depends on RTC_CLASS && PROC_FS default RTC_CLASS help Say yes here if you want to use your first RTC through the proc interface, /proc/driver/rtc. Other RTCs will not be available through that API. This driver can also be built as a module. If so, the module will be called rtc-proc. config RTC_INTF_DEV tristate "dev" depends on RTC_CLASS default RTC_CLASS help Say yes here if you want to use your RTCs using the /dev interfaces, which "udev" sets up as /dev/rtc0 through /dev/rtcN. You may want to set up a symbolic link so one of these can be accessed as /dev/rtc, which is a name expected by "hwclock" and some other programs. This driver can also be built as a module. If so, the module will be called rtc-dev. config RTC_INTF_DEV_UIE_EMUL bool "RTC UIE emulation on dev interface" depends on RTC_INTF_DEV help Provides an emulation for RTC_UIE if the underlaying rtc chip driver does not expose RTC_UIE ioctls. Those requests generate once-per-second update interrupts, used for synchronization. comment "RTC drivers" depends on RTC_CLASS config RTC_DRV_DS1672 tristate "Dallas/Maxim DS1672" depends on RTC_CLASS && I2C help If you say yes here you get support for the Dallas/Maxim DS1672 timekeeping chip. This driver can also be built as a module. If so, the module will be called rtc-ds1672. config RTC_DRV_DS1742 tristate "Dallas DS1742/1743" depends on RTC_CLASS help If you say yes here you get support for the Dallas DS1742/1743 timekeeping chip. This driver can also be built as a module. If so, the module will be called rtc-ds1742. config RTC_DRV_OMAP tristate "TI OMAP1" depends on RTC_CLASS && ( \ ARCH_OMAP15XX || ARCH_OMAP16XX || ARCH_OMAP730 ) help Say "yes" here to support the real time clock on TI OMAP1 chips. This driver can also be built as a module called rtc-omap. config RTC_DRV_PCF8563 tristate "Philips PCF8563/Epson RTC8564" depends on RTC_CLASS && I2C help If you say yes here you get support for the Philips PCF8563 RTC chip. The Epson RTC8564 should work as well. This driver can also be built as a module. If so, the module will be called rtc-pcf8563. config RTC_DRV_PCF8583 tristate "Philips PCF8583" depends on RTC_CLASS && I2C help If you say yes here you get support for the Philips PCF8583 RTC chip. This driver can also be built as a module. If so, the module will be called rtc-pcf8583. config RTC_DRV_S3C tristate "Samsung S3C series SoC RTC" depends on RTC_CLASS && ARCH_S3C2410 help RTC (Realtime Clock) driver for the clock inbuilt into the Samsung S3C24XX series of SoCs. This can provide periodic interrupt rates from 1Hz to 64Hz for user programs, and wakeup from Alarm. The driver currently supports the common features on all the S3C24XX range, such as the S3C2410, S3C2412, S3C2413, S3C2440 and S3C2442. This driver can also be build as a module. If so, the module will be called rtc-s3c. =================================================== =================================================== =================================================== =================================================== =================================================== =================================================== =================================================== =================================================== =================================================== =================================================== =================================================== =================================================== =================================================== =================================================== =================================================== 核心框架结构已完 =================================================== =================================================== =================================================== =================================================== =================================================== =================================================== =================================================== =================================================== 核心框架结构已完,下面是具体的功能实现代码一些指导提示: 1。Ioctl: Documentation: ioctl-number.txt,ioctl-decoding.txt ioctl.h 2.Documetation: Rtc.txt 3.rtc.h 4.rtc-s3c.c