FreeNOS
lib
libarch
arm
broadcom
BroadcomTimer.h
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2015 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_BROADCOMTIMER_H
19
#define __LIBARCH_ARM_BROADCOMTIMER_H
20
21
#include <
Types.h
>
22
#include <
Macros.h
>
23
#include <
Timer.h
>
24
#include <
arm/ARMIO.h
>
25
37
#define SYSTIMER_BASE 0x3000
38
39
#define SYSTIMER_CS (SYSTIMER_BASE + 0x0)
40
#define SYSTIMER_CLO (SYSTIMER_BASE + 0x4)
41
43
#define SYSTIMER_C0 (SYSTIMER_BASE + 0xC)
44
#define SYSTIMER_C1 (SYSTIMER_BASE + 0x10)
45
47
#define SYSTIMER_C2 (SYSTIMER_BASE + 0x14)
48
#define SYSTIMER_C3 (SYSTIMER_BASE + 0x18)
49
#define M3 3
50
#define M2 2
51
#define M1 1
52
#define M0 0
53
55
#define BCM_SYSTIMER_FREQ 1000000
56
60
class
BroadcomTimer
:
public
Timer
61
{
62
public
:
63
71
virtual
Result
setFrequency
(
Size
hertz);
72
82
virtual
Result
tick
();
83
84
private
:
85
87
u32
m_cycles
;
88
90
ARMIO
m_io
;
91
};
92
99
#endif
/* __LIBARCH_ARM_BROADCOMTIMER_H */
Macros.h
Types.h
ARMIO
Input/Output operations specific to the ARM architecture.
Definition:
ARMIO.h:39
Timer
Represents a configurable timer device.
Definition:
Timer.h:35
BroadcomTimer::setFrequency
virtual Result setFrequency(Size hertz)
Set timer frequency.
Definition:
BroadcomTimer.cpp:21
BroadcomTimer
Broadcom System-on-Chip system timer.
Definition:
BroadcomTimer.h:60
Timer.h
u32
unsigned int u32
Unsigned 32-bit number.
Definition:
Types.h:53
Size
unsigned int Size
Any sane size indicator cannot go negative.
Definition:
Types.h:128
BroadcomTimer::m_io
ARMIO m_io
I/O instance.
Definition:
BroadcomTimer.h:90
Timer::Result
Result
Result codes.
Definition:
Timer.h:52
ARMIO.h
BroadcomTimer::tick
virtual Result tick()
Process timer tick.
Definition:
BroadcomTimer.cpp:35
BroadcomTimer::m_cycles
u32 m_cycles
Number of internal cycles needed to provide the current timer frequency.
Definition:
BroadcomTimer.h:87
Generated by
1.8.17