diff options
| author | Bernard Xiong <[email protected]> | 2021-07-31 00:06:38 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2021-07-31 00:06:38 +0800 |
| commit | d57caa7e157dcdfe6fe3fbc238df20889627b503 (patch) | |
| tree | 10d0712c3a935b45c08f82e3ca99cbb0b28a4d20 /bsp | |
| parent | 56d3abe30148a07dd41d78e8aa190f9baa164266 (diff) | |
| parent | a25667a7e5fa449d8554a4589744eeca26a615c0 (diff) | |
Merge pull request #4900 from mysterywolf/rtc
[rtc] 移除rtc_core.c/.h 将内容转移到rtc.c/.h
Diffstat (limited to 'bsp')
| -rw-r--r-- | bsp/efm32/drv_rtc.c | 56 | ||||
| -rw-r--r-- | bsp/stm32/libraries/HAL_Drivers/drv_rtc.c | 6 |
2 files changed, 15 insertions, 47 deletions
diff --git a/bsp/efm32/drv_rtc.c b/bsp/efm32/drv_rtc.c index 9972d3c631..3e842a8e4c 100644 --- a/bsp/efm32/drv_rtc.c +++ b/bsp/efm32/drv_rtc.c @@ -130,49 +130,6 @@ void rt_hw_rtc_isr(rt_device_t device) /***************************************************************************//** * @brief - * Register RTC device - * - * @details - * - * @note - * - * @param[in] device - * Pointer to device descriptor - * - * @param[in] name - * Device name - * - * @param[in] flag - * Configuration flags - * - * @return - * Error code - ******************************************************************************/ -rt_err_t rt_hw_rtc_register( - rt_device_t device, - const char *name, - rt_uint32_t flag) -{ - RT_ASSERT(device != RT_NULL); - - device->type = RT_Device_Class_RTC; - device->rx_indicate = RT_NULL; - device->tx_complete = RT_NULL; - device->init = RT_NULL; - device->open = rt_rtc_open; - device->close = RT_NULL; - device->read = rt_rtc_read; - device->write = RT_NULL; - device->control = rt_rtc_control; - device->user_data = RT_NULL; /* no private */ - - /* register a character device */ - return rt_device_register(device, name, RT_DEVICE_FLAG_RDWR | flag); -} - - -/***************************************************************************//** - * @brief * Initialize all RTC module related hardware and register RTC device to kernel * * @details @@ -224,7 +181,18 @@ void rt_hw_rtc_init(void) } /* register rtc device */ - rt_hw_rtc_register(&rtc, RT_RTC_NAME, EFM32_NO_DATA); + rtc.type = RT_Device_Class_RTC; + rtc.rx_indicate = RT_NULL; + rtc.tx_complete = RT_NULL; + rtc.init = RT_NULL; + rtc.open = rt_rtc_open; + rtc.close = RT_NULL; + rtc.read = rt_rtc_read; + rtc.write = RT_NULL; + rtc.control = rt_rtc_control; + rtc.user_data = RT_NULL; /* no private */ + + rt_device_register(&rtc, RT_RTC_NAME, RT_DEVICE_FLAG_RDWR | EFM32_NO_DATA); } #endif diff --git a/bsp/stm32/libraries/HAL_Drivers/drv_rtc.c b/bsp/stm32/libraries/HAL_Drivers/drv_rtc.c index 15968a178c..278fce140b 100644 --- a/bsp/stm32/libraries/HAL_Drivers/drv_rtc.c +++ b/bsp/stm32/libraries/HAL_Drivers/drv_rtc.c @@ -265,8 +265,8 @@ static rt_err_t stm32_rtc_set_secs(void *args) static const struct rt_rtc_ops stm32_rtc_ops = { stm32_rtc_init, - stm32_rtc_get_secs, /* get_secs */ - stm32_rtc_set_secs, /* set secs */ + stm32_rtc_get_secs, + stm32_rtc_set_secs, RT_NULL, RT_NULL, RT_NULL, @@ -280,7 +280,7 @@ static int rt_hw_rtc_init(void) rt_err_t result; stm32_rtc_dev.ops = &stm32_rtc_ops; - result = rt_rtc_dev_register(&stm32_rtc_dev, "rtc", RT_DEVICE_FLAG_RDWR, RT_NULL); + result = rt_hw_rtc_register(&stm32_rtc_dev, "rtc", RT_DEVICE_FLAG_RDWR, RT_NULL); if (result != RT_EOK) { LOG_E("rtc register err code: %d", result); |
