1 /* 2 * RTC (real-time clock) support for the JZ4780. 3 * 4 * Copyright (C) 2023, 2024 Paul Boddie <paul@boddie.org.uk> 5 * 6 * This program is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU General Public License as 8 * published by the Free Software Foundation; either version 2 of 9 * the License, or (at your option) any later version. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, 19 * Boston, MA 02110-1301, USA 20 */ 21 22 #pragma once 23 24 #include <l4/sys/types.h> 25 #include <stdint.h> 26 27 28 29 #ifdef __cplusplus 30 31 #include <l4/devices/rtc-generic.h> 32 33 class Rtc_jz4780_chip : public Rtc_chip 34 { 35 public: 36 explicit Rtc_jz4780_chip(l4_addr_t addr, Cpm_chip *cpm); 37 }; 38 39 Rtc_chip *jz4780_rtc_chip(l4_addr_t rtc_base, Cpm_chip *cpm); 40 41 #endif /* __cplusplus */ 42 43 44 45 /* C language interface. */ 46 47 EXTERN_C_BEGIN 48 49 void *jz4780_rtc_init(l4_addr_t rtc_base, void *cpm); 50 51 enum Clock_identifiers jz4780_rtc_get_clock(void *rtc); 52 53 void jz4780_rtc_disable(void *rtc); 54 55 void jz4780_rtc_enable(void *rtc); 56 57 void jz4780_rtc_alarm_disable(void *rtc); 58 59 void jz4780_rtc_alarm_enable(void *rtc); 60 61 void jz4780_rtc_wakeup_alarm_disable(void *rtc); 62 63 void jz4780_rtc_wakeup_alarm_enable(void *rtc); 64 65 uint32_t jz4780_rtc_get_seconds(void *rtc); 66 67 void jz4780_rtc_set_seconds(void *rtc, uint32_t seconds); 68 69 uint32_t jz4780_rtc_get_alarm_seconds(void *rtc); 70 71 void jz4780_rtc_set_alarm_seconds(void *rtc, uint32_t seconds); 72 73 void jz4780_rtc_set_regulator(void *rtc, uint32_t base, uint32_t adjustment); 74 75 void jz4780_rtc_hibernate(void *rtc); 76 77 void jz4780_rtc_power_down(void *rtc); 78 79 EXTERN_C_END