XenevaOS
Loading...
Searching...
No Matches
Macros | Functions | Variables
rtcmmio.c File Reference
#include <Drivers/rtcmmio.h>
#include <Hal/AA64/gic.h>
#include <aucon.h>
#include <Drivers/rtc.h>
#include <string.h>
#include <Hal/AA64/aa64lowlevel.h>
Include dependency graph for rtcmmio.c:

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
 

Detailed Description

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:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

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.

Macro Definition Documentation

◆ PL031_RTC_CR

#define PL031_RTC_CR   0x0C

◆ PL031_RTC_CR_EN_BIT

#define PL031_RTC_CR_EN_BIT   (1<<0)

◆ PL031_RTC_CR_IE_BIT

#define PL031_RTC_CR_IE_BIT   (1<<1)

◆ PL031_RTC_LR

#define PL031_RTC_LR   0x08

◆ PL031_RTC_MR

#define PL031_RTC_MR   0x04

◆ QEMU_VIRT_RTCIRQ

#define QEMU_VIRT_RTCIRQ   2

◆ rtc_read32

#define rtc_read32 (   addr)    (*(volatile uint32_t*)(addr))

◆ rtc_write32

#define rtc_write32 (   addr,
  value 
)    (*(volatile uint32_t*)(addr) = (value))

Function Documentation

◆ AuPL031RTCInit()

void AuPL031RTCInit ( )

AuPL031RTCInit – initialize pl031 rtc [NOT USED].

◆ AuPL031RTCIRQHandle()

void AuPL031RTCIRQHandle ( )

AuPL031RTCIRQHandler – irq handler of PL031 RTC.

◆ AuRTCClearInterrupt()

void AuRTCClearInterrupt ( )

AuRTCClearInterrupt – clear pending rtc interrupt.

◆ AuRTCEnableInterrupt()

void AuRTCEnableInterrupt ( )

AuRTCEnableInterrupt – enable pl031 rtc.

◆ AuRTCGetCentury()

uint8_t AuRTCGetCentury ( )

AuRTCGetCentury – returns the current century.

Returns
return century value

◆ AuRTCGetCurrentTime()

uint32_t AuRTCGetCurrentTime ( )

AuRTCGetCurrentTime – returns thr current time value.

Returns
return current time value

◆ AuRTCGetDay()

uint8_t AuRTCGetDay ( )

AuRTCGetDay – returns the current day.

Returns
return current day value

◆ AuRTCGetHour()

uint8_t AuRTCGetHour ( )

◆ AuRTCGetMinutes()

uint8_t AuRTCGetMinutes ( )

AuRTCGetMinutes – returns the current minutes.

Returns
return minute value

◆ AuRTCGetMonth()

uint8_t AuRTCGetMonth ( )

AuRTCGetMonth – returns the current month.

◆ AuRTCGetSecond()

uint8_t AuRTCGetSecond ( )

AuRTCGetSecond – returns the current second.

Returns
return current second value

◆ AuRTCGetYear()

uint8_t AuRTCGetYear ( )

AuRTCGetYear – returns the current year.

Returns
return year value

◆ epoch_to_tm()

void epoch_to_tm ( uint32_t  epoch)

epoch_to_tm – convert unix epoch value to time

Parameters
epoch– unix epoch value

◆ is_leap()

int is_leap ( int  year)

Variable Documentation

◆ __rtc

AuRTC __rtc