1.1 --- a/pkg/devices/lib/rtc/include/rtc-x1600.h Sat May 04 01:30:06 2024 +0200
1.2 +++ b/pkg/devices/lib/rtc/include/rtc-x1600.h Sat May 04 01:31:54 2024 +0200
1.3 @@ -1,7 +1,7 @@
1.4 /*
1.5 * RTC (real-time clock) support for the X1600.
1.6 *
1.7 - * Copyright (C) 2023 Paul Boddie <paul@boddie.org.uk>
1.8 + * Copyright (C) 2023, 2024 Paul Boddie <paul@boddie.org.uk>
1.9 *
1.10 * This program is free software; you can redistribute it and/or
1.11 * modify it under the terms of the GNU General Public License as
1.12 @@ -28,53 +28,18 @@
1.13
1.14 #ifdef __cplusplus
1.15
1.16 -#include <l4/devices/cpm-x1600.h>
1.17 -#include <l4/devices/hw_register_block.h>
1.18 +#include <l4/devices/rtc-generic.h>
1.19
1.20 -class Rtc_x1600_chip
1.21 +class Rtc_x1600_chip : public Rtc_chip
1.22 {
1.23 protected:
1.24 - /* Only use the CPM for the X1600, not other chips. */
1.25 -
1.26 - Cpm_x1600_chip *_cpm;
1.27 - Hw::Register_block<32> _regs;
1.28 -
1.29 - /* Utility methods. */
1.30 -
1.31 - uint32_t read_checked(unsigned reg);
1.32 - void wait();
1.33 - void write_enable();
1.34 - void _power_down();
1.35 + void _pre_power_down();
1.36
1.37 public:
1.38 - explicit Rtc_x1600_chip(l4_addr_t addr, Cpm_x1600_chip *cpm = NULL);
1.39 -
1.40 - void disable();
1.41 -
1.42 - void enable();
1.43 -
1.44 - void alarm_disable();
1.45 -
1.46 - void alarm_enable();
1.47 -
1.48 - void wakeup_alarm_disable();
1.49 -
1.50 - void wakeup_alarm_enable();
1.51 + explicit Rtc_x1600_chip(l4_addr_t addr, Cpm_chip *cpm = NULL);
1.52 +};
1.53
1.54 - uint32_t get_seconds();
1.55 -
1.56 - void set_seconds(uint32_t seconds);
1.57 -
1.58 - uint32_t get_alarm_seconds();
1.59 -
1.60 - void set_alarm_seconds(uint32_t seconds);
1.61 -
1.62 - void set_regulator(uint32_t base, uint32_t adjustment);
1.63 -
1.64 - void hibernate();
1.65 -
1.66 - void power_down();
1.67 -};
1.68 +Rtc_chip *x1600_rtc_chip(l4_addr_t rtc_base, Cpm_chip *cpm);
1.69
1.70 #endif /* __cplusplus */
1.71
1.72 @@ -86,6 +51,8 @@
1.73
1.74 void *x1600_rtc_init(l4_addr_t rtc_base, void *cpm);
1.75
1.76 +enum Clock_identifiers x1600_rtc_get_clock(void *rtc);
1.77 +
1.78 void x1600_rtc_disable(void *rtc);
1.79
1.80 void x1600_rtc_enable(void *rtc);