diff options
| author | Meco Man <[email protected]> | 2021-07-30 02:42:57 +0800 |
|---|---|---|
| committer | Meco Man <[email protected]> | 2021-07-30 03:24:50 +0800 |
| commit | 94a9332915fe971277ed6aa86f544c8dd3f459ea (patch) | |
| tree | 20319b4dca6e655242a8840fc9750c7100015a79 /components/drivers/include | |
| parent | 9e47b95e61b09ddbec2bc9f8a2c2cbb970b1f54e (diff) | |
[rtc] 移除rtc_core.c/.h 将内容转移到rtc.c/.h
Diffstat (limited to 'components/drivers/include')
| -rw-r--r-- | components/drivers/include/drivers/rtc.h | 33 | ||||
| -rw-r--r-- | components/drivers/include/drivers/rtc_core.h | 45 |
2 files changed, 31 insertions, 47 deletions
diff --git a/components/drivers/include/drivers/rtc.h b/components/drivers/include/drivers/rtc.h index 9eddf801b7..ab64dd8ec9 100644 --- a/components/drivers/include/drivers/rtc.h +++ b/components/drivers/include/drivers/rtc.h @@ -6,13 +6,42 @@ * Change Logs: * Date Author Notes * 2012-10-10 aozima first version. + * 2021-06-11 iysheng implement RTC v2.0 */ #ifndef __RTC_H__ #define __RTC_H__ -#include <rtconfig.h> -#include <drivers/rtc_core.h> +#include <rtdef.h> + +#define RT_DEVICE_CTRL_RTC_GET_TIME 0x10 /**< get second time */ +#define RT_DEVICE_CTRL_RTC_SET_TIME 0x11 /**< set second time */ +#define RT_DEVICE_CTRL_RTC_GET_TIME_US 0x12 /**< get microsecond time */ +#define RT_DEVICE_CTRL_RTC_SET_TIME_US 0x13 /**< set microsecond time */ +#define RT_DEVICE_CTRL_RTC_GET_ALARM 0x14 /**< get alarm */ +#define RT_DEVICE_CTRL_RTC_SET_ALARM 0x15 /**< set alarm */ + +struct rt_rtc_ops +{ + rt_err_t (*init)(void); + rt_err_t (*get_secs)(void *arg); + rt_err_t (*set_secs)(void *arg); + rt_err_t (*get_alarm)(void *arg); + rt_err_t (*set_alarm)(void *arg); + rt_err_t (*get_usecs)(void *arg); + rt_err_t (*set_usecs)(void *arg); +}; + +typedef struct rt_rtc_device +{ + struct rt_device parent; + const struct rt_rtc_ops *ops; +} rt_rtc_dev_t; + +rt_err_t rt_hw_rtc_register(rt_rtc_dev_t *rtc, + const char *name, + rt_uint32_t flag, + void *data); rt_err_t set_date(rt_uint32_t year, rt_uint32_t month, rt_uint32_t day); rt_err_t set_time(rt_uint32_t hour, rt_uint32_t minute, rt_uint32_t second); diff --git a/components/drivers/include/drivers/rtc_core.h b/components/drivers/include/drivers/rtc_core.h deleted file mode 100644 index e858e9ee28..0000000000 --- a/components/drivers/include/drivers/rtc_core.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2006-2021, RT-Thread Development Team - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2021-06-11 iysheng first version. - */ - -#ifndef __RTC_CORE_H__ -#define __RTC_CORE_H__ - -#include <rtthread.h> - -#define RT_DEVICE_CTRL_RTC_GET_TIME 0x10 /**< get second time */ -#define RT_DEVICE_CTRL_RTC_SET_TIME 0x11 /**< set second time */ -#define RT_DEVICE_CTRL_RTC_GET_TIME_US 0x12 /**< get microsecond time */ -#define RT_DEVICE_CTRL_RTC_SET_TIME_US 0x13 /**< set microsecond time */ -#define RT_DEVICE_CTRL_RTC_GET_ALARM 0x14 /**< get alarm */ -#define RT_DEVICE_CTRL_RTC_SET_ALARM 0x15 /**< set alarm */ - -struct rt_rtc_ops -{ - rt_err_t (*init)(void); - rt_err_t (*get_secs)(void *arg); - rt_err_t (*set_secs)(void *arg); - rt_err_t (*get_alarm)(void *arg); - rt_err_t (*set_alarm)(void *arg); - rt_err_t (*get_usecs)(void *arg); - rt_err_t (*set_usecs)(void *arg); -}; - -typedef struct rt_rtc_device -{ - struct rt_device parent; - const struct rt_rtc_ops *ops; -} rt_rtc_dev_t; - -rt_err_t rt_hw_rtc_register(rt_rtc_dev_t *rtc, - const char *name, - rt_uint32_t flag, - void *data); - -#endif /* __RTC_CORE_H__ */ |
