FreeNOS
ARM64Timer.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2025 Ivan Tan
3 * Copyright (C) 2019 Niek Linnenbank
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19#ifndef __LIBARCH_ARM64_TIMER_H
20#define __LIBARCH_ARM64_TIMER_H
21
22#include <Types.h>
23#include <Macros.h>
24#include <Timer.h>
25
40class ARM64Timer : public Timer
41{
42 private:
43
45 static const u32 TimerControlEnable = 1;
46
47 public:
48
52 ARM64Timer();
53
61 virtual Result setFrequency(const Size hertz);
62
71 virtual Result tick();
72
73 private:
74
80 u32 getSystemFrequency(void) const;
81
87 void setPL1PhysicalTimerValue(const u32 value);
88
94 void setPL1PhysicalTimerControl(const u32 value);
95
96 private:
97
100};
101
108#endif /* __LIBARCH_ARM64_ARM64TIMER_H */
ARM64 Generic Timer.
Definition ARM64Timer.h:41
virtual Result setFrequency(const Size hertz)
Set timer frequency.
void setPL1PhysicalTimerValue(const u32 value)
Set Physical Timer 1 value.
void setPL1PhysicalTimerControl(const u32 value)
Set Physical Timer 1 control value.
virtual Result tick()
Process timer tick.
static const u32 TimerControlEnable
Set this bit in the PL1 control register to enable it.
Definition ARM64Timer.h:45
ARM64Timer()
Constructor.
u32 getSystemFrequency(void) const
Retrieve system timer frequency.
Size m_initialTimerCounter
Currently configured initial timer counter.
Definition ARM64Timer.h:99
Represents a configurable timer device.
Definition Timer.h:36
Result
Result codes.
Definition Timer.h:53
unsigned int u32
Unsigned 32-bit number.
Definition Types.h:53
unsigned int Size
Any sane size indicator cannot go negative.
Definition Types.h:128