FreeNOS
BroadcomTimer.cpp
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#include "BroadcomInterrupt.h"
19#include "BroadcomTimer.h"
20
22{
24 m_frequency = hertz;
26
27 // Use timer slot 1. Enable.
30
31 // Done
32 return Success;
33}
34
36{
37 // Clear+acknowledge the timer interrupt
40
41 // Done
42 return Timer::tick();;
43}
void write(u32 reg, u32 data)
write to memory mapped I/O register
Definition ARMIO.h:46
u32 read(u32 reg) const
read from memory mapped I/O register
Definition ARMIO.h:62
virtual Result tick()
Process timer tick.
u32 m_cycles
Number of internal cycles needed to provide the current timer frequency.
ARMIO m_io
I/O instance.
virtual Result setFrequency(Size hertz)
Set timer frequency.
virtual Result tick()
Process timer tick.
Definition Timer.cpp:74
Size m_int
Timer interrupt number.
Definition Timer.h:165
Result
Result codes.
Definition Timer.h:53
@ Success
Definition Timer.h:54
Size m_frequency
Frequency of the Timer.
Definition Timer.h:162
#define SYSTIMER_CLO
#define SYSTIMER_C1
#define SYSTIMER_CS
#define BCM_IRQ_SYSTIMERM1
Triggered when the system timer matches the C1 register.
#define M1
#define BCM_SYSTIMER_FREQ
BCM Sys Timer runs at 1Mhz.
unsigned int Size
Any sane size indicator cannot go negative.
Definition Types.h:128