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