/**************************************************************************** * * Copyright(c) 2019 by Aerospace C.Power (Chongqing) Microelectronics. ALL RIGHTS RESERVED. * * This Information is proprietary to Aerospace C.Power (Chongqing) Microelectronics and MAY NOT * be copied by any method or incorporated into another program without * the express written consent of Aerospace C.Power. This Information or any portion * thereof remains the property of Aerospace C.Power. The Information contained herein * is believed to be accurate and Aerospace C.Power assumes no responsibility or * liability for its use in any way and conveys no license or title under * any patent or copyright and makes no representation or warranty that this * Information is free from patent or copyright infringement. * * ****************************************************************************/ /* os_ship header files */ #include "os_timer_api.h" /* iot common header files */ #include "iot_config_api.h" #include "iot_rtc_api.h" #include "iot_errno_api.h" #include "iot_config.h" #include "iot_rtc_ext.h" #if (IOT_RTC_EXT_ENABLE && HW_PLATFORM == HW_PLATFORM_SIMU) #include static uint32_t simu_rtc_get_time(iot_time_tm_t *tm) { SYSTEMTIME win_time; GetLocalTime(&win_time); tm->tm_sec = (uint8_t)win_time.wSecond; tm->tm_min = (uint8_t)win_time.wMinute; tm->tm_hour = (uint8_t)win_time.wHour; tm->tm_mday = (uint8_t)win_time.wDay; tm->tm_mon = (uint8_t)win_time.wMonth; tm->tm_year = (uint16_t)win_time.wYear; return ERR_OK; } static uint32_t simu_rtc_set_time(iot_time_tm_t *tm, uint8_t week) { (void)tm; (void)week; return ERR_OK; } static uint32_t simu_rtc_is_startup(iot_time_tm_t *tm) { (void)tm; return 1; } static uint32_t simu_rtc_init(iot_time_tm_t *tm, uint32_t *done) { SYSTEMTIME win_time; GetLocalTime(&win_time); tm->tm_sec = (uint8_t)win_time.wSecond; tm->tm_min = (uint8_t)win_time.wMinute; tm->tm_hour = (uint8_t)win_time.wHour; tm->tm_mday = (uint8_t)win_time.wDay; tm->tm_mon = (uint8_t)win_time.wMonth; tm->tm_year = (uint16_t)win_time.wYear; *done = 1; return ERR_OK; } static void simu_rtc_deinit(void) { } static uint32_t simu_rtc_probe(void) { return ERR_OK; } /* define simu_rtc device */ const iot_ext_rtc_drv_t g_simu_rtc_drv = { .drv_prode = simu_rtc_probe, .drv_init = simu_rtc_init, .drv_deinit = simu_rtc_deinit, .drv_get_time = simu_rtc_get_time, .drv_set_time = simu_rtc_set_time, .drv_is_startup = simu_rtc_is_startup, }; #endif /* IOT_RTC_EXT_ENABLE && HW_PLATFORM == HW_PLATFORM_SIMU */