FreeNOS
Broadcom2836.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 "Broadcom2836.h"
19
25
30
32 bool enable)
33{
34 u32 reg = CoreTimerRegister + (m_coreId * sizeof(u32));
35
36 switch (timer)
37 {
38 case PhysicalTimer1:
39 if (enable)
40 m_io.set(reg, (1 << 0));
41 else
42 m_io.unset(reg, (1 << 0));
43
44 return Success;
45
46 default:
47 break;
48 }
49 return NotFound;
50}
51
53{
54 if (timer == PhysicalTimer1)
55 return (m_io.read(CoreIrqRegister + (m_coreId * sizeof(u32))) & (1 << 0)) > 0;
56 else
57 return false;
58}
u8 coreId
Definition IntelACPI.h:1
void set(Address addr, u32 data)
Set bits in memory mapped register.
Definition ARMIO.h:109
void unset(Address addr, u32 data)
Unset bits in memory mapped register.
Definition ARMIO.h:122
u32 read(u32 reg) const
read from memory mapped I/O register
Definition ARMIO.h:62
Result setCoreTimerIrq(Timer timer, bool enable)
Set Core Timer interrupt.
static const Address IOBase
Base address for the BCM2836 I/O configuration.
Result initialize()
Initialize the Controller.
bool getCoreTimerIrqStatus(Timer timer) const
Get core timer interrupt status.
Result
Result code.
ARMIO m_io
I/O instance.
Size m_coreId
Core identifier.
Broadcom2836(Size coreId)
Constructor.
Timer
Hardware timers available in BCM 2836.
void setBase(const Address base)
Set memory I/O base offset.
Definition IO.cpp:33
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