genode/repos/base-hw/src/core/spec/cortex_a9/kernel/cpu.cc
Martin Stein 4d3d4ecca0 hw core: merge Kernel::Clock and Kernel::Timer
With this, we get rid of platform specific timer interfaces. The new
Timer class does the same as the old Clock class and has a generic
interface. The old Timer class was merely used by the old Clock class.
Also, we get rid of having only one timer instance which we tell with
each method call for which CPU it shall be done. Instead now each Cpu
object has its own Timer member that knows the CPU it works for.

Also, rename all "tics" to "ticks".

Fixes #2347
2017-05-31 13:16:10 +02:00

45 lines
980 B
C++

/*
* \brief Cpu class implementation specific to Cortex A9 SMP
* \author Stefan Kalkowski
* \date 2015-12-09
*/
/*
* Copyright (C) 2015-2017 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU Affero General Public License version 3.
*/
/* core includes */
#include <kernel/perf_counter.h>
#include <kernel/lock.h>
#include <kernel/pd.h>
#include <pic.h>
#include <platform_pd.h>
#include <platform.h>
extern int _mt_begin;
extern int _mt_master_context_begin;
void Kernel::Cpu::init(Kernel::Pic &pic)
{
Cpu_context * c = (Cpu_context*)
(Cpu::exception_entry + ((addr_t)&_mt_master_context_begin -
(addr_t)&_mt_begin));
c->cpu_exception = Genode::Cpu::Ttbr0::read();
_fpu.init();
{
Lock::Guard guard(data_lock());
/* enable performance counter */
perf_counter()->enable();
/* enable timer interrupt */
pic.unmask(_timer.interrupt_id(), id());
}
}