From dbf616f8b33d53419b03d95197c5ceec0c3f0351 Mon Sep 17 00:00:00 2001 From: Giovanni Di Sirio Date: Sun, 14 Oct 2018 12:31:41 +0000 Subject: Changes to the RTC driver to use the persistent storage interface, git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@12366 110e8d01-0319-4d1e-a829-52ad28d1bb01 --- os/hal/ports/STM32/LLD/RTCv2/hal_rtc_lld.c | 71 +++++------------------------- 1 file changed, 11 insertions(+), 60 deletions(-) (limited to 'os/hal/ports/STM32/LLD/RTCv2/hal_rtc_lld.c') diff --git a/os/hal/ports/STM32/LLD/RTCv2/hal_rtc_lld.c b/os/hal/ports/STM32/LLD/RTCv2/hal_rtc_lld.c index 547b9e98c..19ed93e14 100644 --- a/os/hal/ports/STM32/LLD/RTCv2/hal_rtc_lld.c +++ b/os/hal/ports/STM32/LLD/RTCv2/hal_rtc_lld.c @@ -199,86 +199,37 @@ static uint32_t rtc_encode_date(const RTCDateTime *timespec) { return dr; } -#if RTC_HAS_STORAGE +#if RTC_HAS_STORAGE == TRUE /* TODO: Map on the backup SRAM on devices that have it.*/ -static size_t _write(void *instance, const uint8_t *bp, size_t n) { +static size_t _read(void *instance, ps_offset_t offset, + size_t n, uint8_t *rp) { (void)instance; - (void)bp; + (void)offset; (void)n; + (void)rp; return 0; } -static size_t _read(void *instance, uint8_t *bp, size_t n) { +static ps_error_t _write(void *instance, ps_offset_t offset, + size_t n, const uint8_t *wp) { (void)instance; - (void)bp; + (void)offset; (void)n; + (void)wp; return 0; } -static msg_t _put(void *instance, uint8_t b) { - - (void)instance; - (void)b; - - return FILE_OK; -} - -static msg_t _get(void *instance) { - - (void)instance; - - return FILE_OK; -} - -static msg_t _close(void *instance) { - - /* Close is not supported.*/ - (void)instance; - - return FILE_OK; -} - -static msg_t _geterror(void *instance) { - - (void)instance; - - return (msg_t)0; -} - -static msg_t _getsize(void *instance) { - - (void)instance; - - return 0; -} - -static msg_t _getposition(void *instance) { - - (void)instance; - - return 0; -} - -static msg_t _lseek(void *instance, fileoffset_t offset) { - - (void)instance; - (void)offset; - - return FILE_OK; -} - /** * @brief VMT for the RTC storage file interface. */ struct RTCDriverVMT _rtc_lld_vmt = { - _write, _read, _put, _get, - _close, _geterror, _getsize, _getposition, _lseek + _getsize, _read, _write }; -#endif /* RTC_HAS_STORAGE */ +#endif /* RTC_HAS_STORAGE == TRUE */ /*===========================================================================*/ /* Driver interrupt handlers. */ -- cgit v1.2.3