47 lines
1.7 KiB
C
47 lines
1.7 KiB
C
/*
|
||
* Граница между календарной логикой и аппаратными 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 */
|