aboutsummaryrefslogtreecommitdiff
path: root/include/rtc_.h
diff options
context:
space:
mode:
authorAndrej Picej <andrej.picej@norik.com>2023-07-11 10:42:49 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2023-07-12 16:27:49 +0200
commitd70256a5c719439cc6fab6a4571c1bb46178e4c7 (patch)
tree6c7598e59501250805a3cc9b04ce21ba7026a128 /include/rtc_.h
parent9fc5933b100694174071c7c4697c70095799bfd0 (diff)
downloadbusybox-w32-d70256a5c719439cc6fab6a4571c1bb46178e4c7.tar.gz
busybox-w32-d70256a5c719439cc6fab6a4571c1bb46178e4c7.tar.bz2
busybox-w32-d70256a5c719439cc6fab6a4571c1bb46178e4c7.zip
hwclock: add get/set parameters option
In kernel 5.16 special ioctls were introduced to get/set RTC parameters. Add option to get/set parameters into busybox version of hwclock. Implementation is similar to the one already used in linux-utils hwclock tool. Example of parameter get use: $ hwclock -g 2 The RTC parameter 0x2 is set to 0x2. $ hwclock --param-get bsm The RTC parameter 0x2 is set to 0x2. Example of parameter set use: $ hwclock -p 2=1 The RTC parameter 0x2 will be set to 0x1. $ hwclock -p bsm=2 The RTC parameter 0x2 will be set to 0x2. function old new delta hwclock_main 298 576 +278 .rodata 105231 105400 +169 packed_usage 34541 34576 +35 static.hwclock_longopts 60 84 +24 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 4/0 up/down: 506/0) Total: 506 bytes Signed-off-by: Andrej Picej <andrej.picej@norik.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'include/rtc_.h')
-rw-r--r--include/rtc_.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/include/rtc_.h b/include/rtc_.h
index 24ff5363f..782966090 100644
--- a/include/rtc_.h
+++ b/include/rtc_.h
@@ -46,6 +46,17 @@ struct linux_rtc_wkalrm {
46 struct linux_rtc_time time; /* time the alarm is set to */ 46 struct linux_rtc_time time; /* time the alarm is set to */
47}; 47};
48 48
49struct rtc_param {
50 uint64_t param;
51 union {
52 uint64_t uvalue;
53 int64_t svalue;
54 uint64_t ptr;
55 };
56 uint32_t index;
57 uint32_t __pad;
58};
59
49/* 60/*
50 * ioctl calls that are permitted to the /dev/rtc interface, if 61 * ioctl calls that are permitted to the /dev/rtc interface, if
51 * any of the RTC drivers are enabled. 62 * any of the RTC drivers are enabled.
@@ -71,12 +82,19 @@ struct linux_rtc_wkalrm {
71#define RTC_WKALM_SET _IOW('p', 0x0f, struct linux_rtc_wkalrm)/* Set wakeup alarm*/ 82#define RTC_WKALM_SET _IOW('p', 0x0f, struct linux_rtc_wkalrm)/* Set wakeup alarm*/
72#define RTC_WKALM_RD _IOR('p', 0x10, struct linux_rtc_wkalrm)/* Get wakeup alarm*/ 83#define RTC_WKALM_RD _IOR('p', 0x10, struct linux_rtc_wkalrm)/* Get wakeup alarm*/
73 84
85#define RTC_PARAM_GET _IOW('p', 0x13, struct rtc_param) /* Get parameter */
86#define RTC_PARAM_SET _IOW('p', 0x14, struct rtc_param) /* Set parameter */
87
74/* interrupt flags */ 88/* interrupt flags */
75#define RTC_IRQF 0x80 /* any of the following is active */ 89#define RTC_IRQF 0x80 /* any of the following is active */
76#define RTC_PF 0x40 90#define RTC_PF 0x40
77#define RTC_AF 0x20 91#define RTC_AF 0x20
78#define RTC_UF 0x10 92#define RTC_UF 0x10
79 93
94#define RTC_PARAM_FEATURES 0
95#define RTC_PARAM_CORRECTION 1
96#define RTC_PARAM_BACKUP_SWITCH_MODE 2
97
80POP_SAVED_FUNCTION_VISIBILITY 98POP_SAVED_FUNCTION_VISIBILITY
81 99
82#endif 100#endif