summaryrefslogtreecommitdiff
path: root/components/drivers/rtc
diff options
context:
space:
mode:
authorBernard Xiong <[email protected]>2018-06-10 17:59:17 +0800
committerBernard Xiong <[email protected]>2018-06-10 17:59:17 +0800
commit884fb70fe9973eaf01a7df04941cbcb0475ba8d5 (patch)
tree7c8e3f42629e46b3d7ecb0c8507f67934d9fae47 /components/drivers/rtc
parentbca65f30a90857287dc1371ddbc8d5f165691c7f (diff)
[Kernel] Add device ops feature.
Diffstat (limited to 'components/drivers/rtc')
-rw-r--r--components/drivers/rtc/soft_rtc.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/components/drivers/rtc/soft_rtc.c b/components/drivers/rtc/soft_rtc.c
index 6db2136ad4..c828e43ebc 100644
--- a/components/drivers/rtc/soft_rtc.c
+++ b/components/drivers/rtc/soft_rtc.c
@@ -68,6 +68,18 @@ static rt_err_t soft_rtc_control(rt_device_t dev, int cmd, void *args)
return RT_EOK;
}
+#ifdef RT_USING_DEVICE_OPS
+const static struct rt_device_ops soft_rtc_ops =
+{
+ RT_NULL,
+ RT_NULL,
+ RT_NULL,
+ RT_NULL,
+ RT_NULL,
+ soft_rtc_control
+};
+#endif
+
int rt_soft_rtc_init(void)
{
static rt_bool_t init_ok = RT_FALSE;
@@ -86,12 +98,16 @@ int rt_soft_rtc_init(void)
soft_rtc_dev.type = RT_Device_Class_RTC;
/* register rtc device */
+#ifdef RT_USING_DEVICE_OPS
+ soft_rtc_dev.ops = &soft_rtc_ops;
+#else
soft_rtc_dev.init = RT_NULL;
soft_rtc_dev.open = RT_NULL;
soft_rtc_dev.close = RT_NULL;
soft_rtc_dev.read = RT_NULL;
soft_rtc_dev.write = RT_NULL;
soft_rtc_dev.control = soft_rtc_control;
+#endif
/* no private */
soft_rtc_dev.user_data = RT_NULL;