diff options
| author | Bernard Xiong <[email protected]> | 2018-06-10 17:59:17 +0800 |
|---|---|---|
| committer | Bernard Xiong <[email protected]> | 2018-06-10 17:59:17 +0800 |
| commit | 884fb70fe9973eaf01a7df04941cbcb0475ba8d5 (patch) | |
| tree | 7c8e3f42629e46b3d7ecb0c8507f67934d9fae47 /components/drivers/rtc | |
| parent | bca65f30a90857287dc1371ddbc8d5f165691c7f (diff) | |
[Kernel] Add device ops feature.
Diffstat (limited to 'components/drivers/rtc')
| -rw-r--r-- | components/drivers/rtc/soft_rtc.c | 16 |
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; |
