|
XenevaOS
|
#include <Drivers/rtcmmio.h>#include <Hal/AA64/gic.h>#include <aucon.h>#include <Drivers/rtc.h>#include <string.h>#include <Hal/AA64/aa64lowlevel.h>
Macros | |
| #define | QEMU_VIRT_RTCIRQ 2 |
| #define | PL031_RTC_MR 0x04 |
| #define | PL031_RTC_LR 0x08 |
| #define | PL031_RTC_CR 0x0C |
| #define | PL031_RTC_CR_EN_BIT (1<<0) |
| #define | PL031_RTC_CR_IE_BIT (1<<1) |
| #define | rtc_write32(addr, value) (*(volatile uint32_t*)(addr) = (value)) |
| #define | rtc_read32(addr) (*(volatile uint32_t*)(addr)) |
Functions | |
| void | AuRTCEnableInterrupt () |
| AuRTCEnableInterrupt – enable pl031 rtc. | |
| uint32_t | AuRTCGetCurrentTime () |
| AuRTCGetCurrentTime – returns thr current time value. | |
| void | AuRTCClearInterrupt () |
| AuRTCClearInterrupt – clear pending rtc interrupt. | |
| int | is_leap (int year) |
| void | epoch_to_tm (uint32_t epoch) |
| epoch_to_tm – convert unix epoch value to time | |
| void | AuPL031RTCIRQHandle () |
| AuPL031RTCIRQHandler – irq handler of PL031 RTC. | |
| void | AuPL031RTCInit () |
| AuPL031RTCInit – initialize pl031 rtc [NOT USED]. | |
| uint8_t | AuRTCGetYear () |
| AuRTCGetYear – returns the current year. | |
| uint8_t | AuRTCGetCentury () |
| AuRTCGetCentury – returns the current century. | |
| uint8_t | AuRTCGetMinutes () |
| AuRTCGetMinutes – returns the current minutes. | |
| uint8_t | AuRTCGetSecond () |
| AuRTCGetSecond – returns the current second. | |
| uint8_t | AuRTCGetDay () |
| AuRTCGetDay – returns the current day. | |
| uint8_t | AuRTCGetHour () |
| uint8_t | AuRTCGetMonth () |
| AuRTCGetMonth – returns the current month. | |
Variables | |
| AuRTC | __rtc |
BSD 2-Clause License
Copyright (c) 2022-2025, Manas Kamal Choudhury All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
| #define PL031_RTC_CR 0x0C |
| #define PL031_RTC_CR_EN_BIT (1<<0) |
| #define PL031_RTC_CR_IE_BIT (1<<1) |
| #define PL031_RTC_LR 0x08 |
| #define PL031_RTC_MR 0x04 |
| #define QEMU_VIRT_RTCIRQ 2 |
| #define rtc_read32 | ( | addr | ) | (*(volatile uint32_t*)(addr)) |
| #define rtc_write32 | ( | addr, | |
| value | |||
| ) | (*(volatile uint32_t*)(addr) = (value)) |
| void AuPL031RTCInit | ( | ) |
AuPL031RTCInit – initialize pl031 rtc [NOT USED].
| void AuPL031RTCIRQHandle | ( | ) |
AuPL031RTCIRQHandler – irq handler of PL031 RTC.
| void AuRTCClearInterrupt | ( | ) |
AuRTCClearInterrupt – clear pending rtc interrupt.
| void AuRTCEnableInterrupt | ( | ) |
AuRTCEnableInterrupt – enable pl031 rtc.
| uint8_t AuRTCGetCentury | ( | ) |
AuRTCGetCentury – returns the current century.
| uint32_t AuRTCGetCurrentTime | ( | ) |
AuRTCGetCurrentTime – returns thr current time value.
| uint8_t AuRTCGetDay | ( | ) |
AuRTCGetDay – returns the current day.
| uint8_t AuRTCGetHour | ( | ) |
| uint8_t AuRTCGetMinutes | ( | ) |
AuRTCGetMinutes – returns the current minutes.
| uint8_t AuRTCGetMonth | ( | ) |
AuRTCGetMonth – returns the current month.
| uint8_t AuRTCGetSecond | ( | ) |
AuRTCGetSecond – returns the current second.
| uint8_t AuRTCGetYear | ( | ) |
AuRTCGetYear – returns the current year.
| void epoch_to_tm | ( | uint32_t | epoch | ) |
epoch_to_tm – convert unix epoch value to time
| epoch | – unix epoch value |
| int is_leap | ( | int | year | ) |
| AuRTC __rtc |