]> git.proxmox.com Git - mirror_edk2.git/blob - ArmPlatformPkg/Include/Drivers/PL031RealTimeClock.h
8c26d6605348d0879581ab0d7d5949137887af32
[mirror_edk2.git] / ArmPlatformPkg / Include / Drivers / PL031RealTimeClock.h
1 /** @file
2 *
3 * Copyright (c) 2011, ARM Limited. All rights reserved.
4 *
5 * This program and the accompanying materials
6 * are licensed and made available under the terms and conditions of the BSD License
7 * which accompanies this distribution. The full text of the license may be found at
8 * http://opensource.org/licenses/bsd-license.php
9 *
10 * THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12 *
13 **/
14
15
16 #ifndef __PL031_REAL_TIME_CLOCK_H__
17 #define __PL031_REAL_TIME_CLOCK_H__
18
19 #include <Base.h>
20 #include <ArmPlatform.h>
21
22 // PL031 Registers
23 #define PL031_RTC_DR_DATA_REGISTER (PL031_RTC_BASE + 0x000)
24 #define PL031_RTC_MR_MATCH_REGISTER (PL031_RTC_BASE + 0x004)
25 #define PL031_RTC_LR_LOAD_REGISTER (PL031_RTC_BASE + 0x008)
26 #define PL031_RTC_CR_CONTROL_REGISTER (PL031_RTC_BASE + 0x00C)
27 #define PL031_RTC_IMSC_IRQ_MASK_SET_CLEAR_REGISTER (PL031_RTC_BASE + 0x010)
28 #define PL031_RTC_RIS_RAW_IRQ_STATUS_REGISTER (PL031_RTC_BASE + 0x014)
29 #define PL031_RTC_MIS_MASKED_IRQ_STATUS_REGISTER (PL031_RTC_BASE + 0x018)
30 #define PL031_RTC_ICR_IRQ_CLEAR_REGISTER (PL031_RTC_BASE + 0x01C)
31 #define PL031_RTC_PERIPH_ID0 (PL031_RTC_BASE + 0xFE0)
32 #define PL031_RTC_PERIPH_ID1 (PL031_RTC_BASE + 0xFE4)
33 #define PL031_RTC_PERIPH_ID2 (PL031_RTC_BASE + 0xFE8)
34 #define PL031_RTC_PERIPH_ID3 (PL031_RTC_BASE + 0xFEC)
35 #define PL031_RTC_PCELL_ID0 (PL031_RTC_BASE + 0xFF0)
36 #define PL031_RTC_PCELL_ID1 (PL031_RTC_BASE + 0xFF4)
37 #define PL031_RTC_PCELL_ID2 (PL031_RTC_BASE + 0xFF8)
38 #define PL031_RTC_PCELL_ID3 (PL031_RTC_BASE + 0xFFC)
39
40 // PL031 Values
41 #define PL031_RTC_ENABLED 0x00000001
42 #define PL031_SET_IRQ_MASK 0x00000001
43 #define PL031_IRQ_TRIGGERED 0x00000001
44 #define PL031_CLEAR_IRQ 0x00000001
45
46 #define PL031_COUNTS_PER_SECOND 1
47
48 // Define EPOCH (1970-JANUARY-01) in the Julian Date representation
49 #define EPOCH_JULIAN_DATE 2440588
50
51 // Seconds per unit
52 #define SEC_PER_MIN ((UINTN) 60)
53 #define SEC_PER_HOUR ((UINTN) 3600)
54 #define SEC_PER_DAY ((UINTN) 86400)
55
56 #define SEC_PER_MONTH ((UINTN) 2,592,000)
57 #define SEC_PER_YEAR ((UINTN) 31,536,000)
58
59 #endif