Ultibo API
C/C++ API for Ultibo Core
Loading...
Searching...
No Matches
pl031.h
Go to the documentation of this file.
1/*
2 * This file is part of the Ultibo project, https://ultibo.org/
3 *
4 * The MIT License (MIT)
5 *
6 * Copyright (c) 2026 Garry Wood <garry@softoz.com.au>
7 *
8 * Permission is hereby granted, free of charge, to any person obtaining a copy
9 * of this software and associated documentation files (the "Software"), to deal
10 * in the Software without restriction, including without limitation the rights
11 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 * copies of the Software, and to permit persons to whom the Software is
13 * furnished to do so, subject to the following conditions:
14 *
15 * The above copyright notice and this permission notice shall be included in
16 * all copies or substantial portions of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 * THE SOFTWARE.
25 */
26#ifndef _ULTIBO_PL031_H
27#define _ULTIBO_PL031_H
28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
33#include "ultibo/rtc.h"
34
36#define PL031_RTC_DESCRIPTION "ARM PrimeCell PL031 Real Time Clock"
37
38#define PL031_MIN_TIME TIME_TICKS_TO_1970
39#define PL031_MAX_TIME 137919572470000000
40
42#define PL031_RTC_CR_EN (1 << 0)
43
45#define PL031_RTC_IMSC_INTR_SET (1 << 0)
46#define PL031_RTC_IMSC_INTR_CLEAR (0 << 0)
47
49#define PL031_RTC_RIS_INTR (1 << 0)
50
52#define PL031_RTC_MIS_INTR (1 << 0)
53
55#define PL031_RTC_ICR_INTR (1 << 0)
56
61{
62 uint32_t dr;
63 uint32_t mr;
64 uint32_t lr;
65 uint32_t cr;
66 uint32_t imsc;
67 uint32_t ris;
68 uint32_t mis;
69 uint32_t icr;
70};
71
72
73typedef struct _PL031_RTC PL031_RTC;
75{
76 // RTC Properties
78 // PL031 Properties
79 uint32_t irq;
81 // Statistics Properties
82 uint32_t interruptcount;
83};
84
86
94RTC_DEVICE * STDCALL pl031_rtc_create(size_t address, char *name, uint32_t irq);
95
102
103#ifdef __cplusplus
104}
105#endif
106
107#endif // _ULTIBO_PL031_H
#define STDCALL
Definition globaltypes.h:45
uint32_t STDCALL pl031_rtc_destroy(RTC_DEVICE *rtc)
Stop, deregister and destroy a PL031 RTC device created by this driver.
struct _PL031_RTC PL031_RTC
Definition pl031.h:73
RTC_DEVICE *STDCALL pl031_rtc_create(size_t address, char *name, uint32_t irq)
Create, register and start a new PL031 RTC device which can be accessed using the RTC API.
struct _PL031_RTC_REGISTERS PL031_RTC_REGISTERS
Definition pl031.h:59
struct _RTC_DEVICE RTC_DEVICE
Definition rtc.h:70
Definition pl031.h:61
uint32_t mr
Match register.
Definition pl031.h:63
uint32_t ris
Raw interrupt status register.
Definition pl031.h:67
uint32_t imsc
Interrupt mask set and clear register.
Definition pl031.h:66
uint32_t lr
Load register.
Definition pl031.h:64
uint32_t cr
Control register.
Definition pl031.h:65
uint32_t icr
Interrupt clear register.
Definition pl031.h:69
uint32_t dr
Data register.
Definition pl031.h:62
uint32_t mis
Masked interrupt status register.
Definition pl031.h:68
Definition pl031.h:75
uint32_t irq
Definition pl031.h:79
uint32_t interruptcount
Number of interrupt requests received by the device.
Definition pl031.h:82
PL031_RTC_REGISTERS * registers
Device registers.
Definition pl031.h:80
RTC_DEVICE rtc
Definition pl031.h:77