44 lines
1.4 KiB
C
44 lines
1.4 KiB
C
/*----------------------------------------------------------------------------
|
|
* Copyright (c) TJD Technologies Co., Ltd. 2024. All rights reserved.
|
|
*
|
|
* Description: rtc_port.h
|
|
*
|
|
* Author: luziquan@ss-tjd.com
|
|
*
|
|
* Create: 2024-07-12
|
|
*--------------------------------------------------------------------------*/
|
|
|
|
#ifndef RTC_PORT_H
|
|
#define RTC_PORT_H
|
|
|
|
#include <stdint.h>
|
|
#include <time.h>
|
|
|
|
#define RTC_SUCC 0UL
|
|
#define RTC_FAIL 0xFFFFFFFF
|
|
#define RTC_INVALID_PARAM 0x80000001
|
|
#define RTC_INVALID_PARAM_YEAR 0x80000002
|
|
#define RTC_INVALID_PARAM_MONTH 0x80000003
|
|
#define RTC_INVALID_PARAM_DAY 0x80000004
|
|
#define RTC_INVALID_PARAM_HOUR 0x80000005
|
|
#define RTC_INVALID_PARAM_MIN 0x80000006
|
|
#define RTC_INVALID_PARAM_SEC 0x80000007
|
|
|
|
typedef uint32_t (*rtc_alarm_callback)(void *);
|
|
|
|
uint32_t rtc_host_peripheral_init(uint64_t *timestamp);
|
|
uint32_t rtc_host_peripheral_deinit(void);
|
|
uint32_t rtc_set_timestamp(const uint64_t timestamp);
|
|
uint32_t rtc_set_ms_timestamp(const uint64_t timestamp_ms);
|
|
uint32_t rtc_get_timestamp(uint64_t *timestamp);
|
|
uint32_t rtc_get_ms_timestamp(uint64_t *timestamp_ms);
|
|
uint32_t rtc_set_diff_time_of_sec(const int64_t secs);
|
|
int32_t rtc_get_diff(void);
|
|
uint32_t rtc_save_time_of_sql(uint64_t timestamp);
|
|
|
|
uint32_t rtc_alarm_init(void);
|
|
uint32_t rtc_alarm_deinit(void);
|
|
uint32_t ret_alarm_start(void);
|
|
uint32_t register_rtc_alarm_callback(rtc_alarm_callback callback);
|
|
|
|
#endif |