mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-18 21:27:56 +00:00
parent
969a0583ee
commit
462718bcf0
@ -35,7 +35,8 @@ etc/board.conf:
|
|||||||
|
|
||||||
content:
|
content:
|
||||||
mv lib/mk/spec/arm/ld-sel4.mk lib/mk/spec/arm/ld.mk;
|
mv lib/mk/spec/arm/ld-sel4.mk lib/mk/spec/arm/ld.mk;
|
||||||
sed -i "s/imx6_timer/timer/" src/timer/epit/imx6/target.inc
|
cp -r $(GENODE_DIR)/repos/imx/src/timer/epit src/timer/epit
|
||||||
|
sed -i "s/imx6_timer/timer/" src/timer/epit/target.mk
|
||||||
find lib/mk/spec -name kernel-sel4-*.mk -o -name syscall-sel4-*.mk |\
|
find lib/mk/spec -name kernel-sel4-*.mk -o -name syscall-sel4-*.mk |\
|
||||||
grep -v "sel4-imx6q_sabrelite.mk" | xargs rm -rf
|
grep -v "sel4-imx6q_sabrelite.mk" | xargs rm -rf
|
||||||
|
|
||||||
|
@ -1 +0,0 @@
|
|||||||
include $(call select_from_repositories,src/timer/epit/imx6/target.inc)
|
|
@ -1,9 +0,0 @@
|
|||||||
TARGET = imx6_timer
|
|
||||||
REQUIRES = arm_v7
|
|
||||||
GEN_DIR := $(dir $(call select_from_repositories,src/timer/main.cc))
|
|
||||||
INC_DIR += $(GEN_DIR)/epit
|
|
||||||
SRC_CC += epit/time_source.cc epit/imx6/timer.cc
|
|
||||||
|
|
||||||
include $(GEN_DIR)/target.inc
|
|
||||||
|
|
||||||
vpath %.cc $(GEN_DIR)
|
|
@ -1,36 +0,0 @@
|
|||||||
/*
|
|
||||||
* \brief Time source for i.MX6 (EPIT2)
|
|
||||||
* \author Norman Feske
|
|
||||||
* \author Martin Stein
|
|
||||||
* \author Stefan Kalkowski
|
|
||||||
* \author Alexander Boettcher
|
|
||||||
* \date 2009-06-16
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Copyright (C) 2009-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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* local include */
|
|
||||||
#include <time_source.h>
|
|
||||||
|
|
||||||
enum {
|
|
||||||
EPIT_2_IRQ = 89,
|
|
||||||
EPIT_2_MMIO_BASE = 0x020d4000,
|
|
||||||
EPIT_2_MMIO_SIZE = 0x00004000
|
|
||||||
};
|
|
||||||
|
|
||||||
using namespace Genode;
|
|
||||||
|
|
||||||
Timer::Time_source::Time_source(Env &env)
|
|
||||||
:
|
|
||||||
Attached_mmio(env, {(char *)EPIT_2_MMIO_BASE, EPIT_2_MMIO_SIZE}),
|
|
||||||
Signalled_time_source(env),
|
|
||||||
_timer_irq(env, unsigned(EPIT_2_IRQ))
|
|
||||||
{
|
|
||||||
_timer_irq.sigh(_signal_handler);
|
|
||||||
while (read<Cr::Swr>()) ;
|
|
||||||
}
|
|
@ -1,55 +0,0 @@
|
|||||||
/*
|
|
||||||
* \brief Time source that uses the Enhanced Periodic Interrupt Timer (Freescale)
|
|
||||||
* \author Norman Feske
|
|
||||||
* \author Martin Stein
|
|
||||||
* \author Stefan Kalkowski
|
|
||||||
* \author Alexander Boettcher
|
|
||||||
* \date 2009-06-16
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Copyright (C) 2009-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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* local includes */
|
|
||||||
#include <time_source.h>
|
|
||||||
|
|
||||||
using namespace Genode;
|
|
||||||
|
|
||||||
|
|
||||||
void Timer::Time_source::set_timeout(Genode::Microseconds duration,
|
|
||||||
Genode::Timeout_handler &handler)
|
|
||||||
{
|
|
||||||
unsigned long const ticks = (unsigned long)((1ULL * duration.value * TICKS_PER_MS) / 1000);
|
|
||||||
_handler = &handler;
|
|
||||||
_timer_irq.ack_irq();
|
|
||||||
_cleared_ticks = 0;
|
|
||||||
|
|
||||||
/* disable timer */
|
|
||||||
write<Cr::En>(0);
|
|
||||||
|
|
||||||
/* clear interrupt and install timeout */
|
|
||||||
write<Sr::Ocif>(1);
|
|
||||||
write<Cr>(Cr::prepare_one_shot());
|
|
||||||
write<Cmpr>(Cnt::MAX - ticks);
|
|
||||||
|
|
||||||
/* start timer */
|
|
||||||
write<Cr::En>(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Duration Timer::Time_source::curr_time()
|
|
||||||
{
|
|
||||||
unsigned long const uncleared_ticks = Cnt::MAX - read<Cnt>() - _cleared_ticks;
|
|
||||||
unsigned long const uncleared_us = timer_ticks_to_us(uncleared_ticks, TICKS_PER_MS);
|
|
||||||
|
|
||||||
/* update time only on IRQs and if rate is under 1000 per second */
|
|
||||||
if (_irq || uncleared_us > 1000) {
|
|
||||||
_curr_time.add(Genode::Microseconds(uncleared_us));
|
|
||||||
_cleared_ticks += uncleared_ticks;
|
|
||||||
}
|
|
||||||
return _curr_time;
|
|
||||||
}
|
|
@ -1,77 +0,0 @@
|
|||||||
/*
|
|
||||||
* \brief Time source that uses the Enhanced Periodic Interrupt Timer (Freescale)
|
|
||||||
* \author Norman Feske
|
|
||||||
* \author Martin Stein
|
|
||||||
* \author Stefan Kalkowski
|
|
||||||
* \date 2009-06-16
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Copyright (C) 2009-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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _TIME_SOURCE_H_
|
|
||||||
#define _TIME_SOURCE_H_
|
|
||||||
|
|
||||||
/* Genode includes */
|
|
||||||
#include <irq_session/connection.h>
|
|
||||||
#include <os/attached_mmio.h>
|
|
||||||
#include <drivers/timer/util.h>
|
|
||||||
|
|
||||||
/* local includes */
|
|
||||||
#include <signalled_time_source.h>
|
|
||||||
|
|
||||||
namespace Timer { class Time_source; }
|
|
||||||
|
|
||||||
class Timer::Time_source : private Genode::Attached_mmio<0x14>,
|
|
||||||
public Genode::Signalled_time_source
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
|
|
||||||
enum { TICKS_PER_MS = 66000 };
|
|
||||||
|
|
||||||
struct Cr : Register<0x0, 32>
|
|
||||||
{
|
|
||||||
struct En : Bitfield<0, 1> { };
|
|
||||||
struct En_mod : Bitfield<1, 1> { enum { RELOAD = 1 }; };
|
|
||||||
struct Oci_en : Bitfield<2, 1> { };
|
|
||||||
struct Swr : Bitfield<16, 1> { };
|
|
||||||
struct Clk_src : Bitfield<24, 2> { enum { HIGH_FREQ_REF_CLK = 2 }; };
|
|
||||||
|
|
||||||
static access_t prepare_one_shot()
|
|
||||||
{
|
|
||||||
access_t cr = 0;
|
|
||||||
En_mod::set(cr, En_mod::RELOAD);
|
|
||||||
Oci_en::set(cr, 1);
|
|
||||||
Clk_src::set(cr, Clk_src::HIGH_FREQ_REF_CLK);
|
|
||||||
return cr;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
struct Sr : Register<0x4, 32> { struct Ocif : Bitfield<0, 1> { }; };
|
|
||||||
struct Cmpr : Register<0xc, 32> { };
|
|
||||||
struct Cnt : Register<0x10, 32> { enum { MAX = ~(access_t)0 }; };
|
|
||||||
|
|
||||||
Genode::Irq_connection _timer_irq;
|
|
||||||
Genode::Duration _curr_time { Genode::Microseconds(0) };
|
|
||||||
Genode::Microseconds const _max_timeout { Genode::timer_ticks_to_us(Cnt::MAX / 2, TICKS_PER_MS) };
|
|
||||||
unsigned long _cleared_ticks { 0 };
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
Time_source(Genode::Env &env);
|
|
||||||
|
|
||||||
|
|
||||||
/*************************
|
|
||||||
** Genode::Time_source **
|
|
||||||
*************************/
|
|
||||||
|
|
||||||
Genode::Duration curr_time() override;
|
|
||||||
void set_timeout(Genode::Microseconds, Genode::Timeout_handler &) override;
|
|
||||||
Genode::Microseconds max_timeout() const override { return _max_timeout; };
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* _TIME_SOURCE_H_ */
|
|
Loading…
Reference in New Issue
Block a user