Files
templates/c/rtc-service/rtc_service_port.h

47 lines
1.7 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/*
* Граница между календарной логикой и аппаратными RTC/backup-регистрами. Порт предоставляет
* операции чтения и записи, благодаря чему ядро сервиса можно использовать с другим
* контроллером без изменения правил проверки времени.
*/
/**
****************************************************************************
* @file rtc_service_port.h
* @brief Адаптерная прослойка для RTC Service.
****************************************************************************
*/
#ifndef __RTC_SERVICE_PORT_H
#define __RTC_SERVICE_PORT_H
#include <stddef.h>
#include <stdint.h>
#include "rtc_service_types.h"
typedef enum {
RTC_SERVICE_PORT_OK = 0,
RTC_SERVICE_PORT_RESULT_UNSUPPORTED_CLOCK,
RTC_SERVICE_PORT_RESULT_HW_ERROR,
RTC_SERVICE_PORT_RESULT_NO_STORAGE,
} RtcService_PortResult;
RtcService_PortResult RtcService_Port_InitClock(RtcService_ClockSource preferred_source,
RtcService_ClockSource* actual_source);
void RtcService_Port_EnableRtcClock(void);
uint8_t RtcService_Port_IsPowerOnReset(void);
RtcService_PortResult RtcService_Port_ReadRtc(RtcService_DateTime* dt);
RtcService_PortResult RtcService_Port_WriteRtc(const RtcService_DateTime* dt);
RtcService_PortResult RtcService_Port_ReadBackup(uint32_t* buffer, size_t words);
RtcService_PortResult RtcService_Port_WriteBackup(const uint32_t* buffer, size_t words);
RtcService_PortResult RtcService_Port_EraseBackup(void);
#endif /* __RTC_SERVICE_PORT_H */