feat(rtc-service): служба RTC с резервированным backup-томом
Перенесена из k1921vk028/1921vk028/lib/rtc_service. Ядро rtc_service_core.c зависит только от stddef, string и собственных заголовков; доступ к часам и backup-памяти вынесен в rtc_service_port.h. Порт для K1921VK028 идёт в комплекте и служит образцом для следующего МК.
This commit is contained in:
40
c/rtc-service/rtc_service_port.h
Normal file
40
c/rtc-service/rtc_service_port.h
Normal file
@@ -0,0 +1,40 @@
|
||||
/**
|
||||
****************************************************************************
|
||||
* @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 */
|
||||
Reference in New Issue
Block a user