base-hw: Support for Raspberry Pi

This commit is contained in:
Norman Feske
2013-04-08 19:05:44 +02:00
parent 65f20262cb
commit 8ac6d8c96c
15 changed files with 570 additions and 1 deletions

View File

@ -0,0 +1,50 @@
/*
* \brief User-level timer driver for Raspberry Pi
* \author Norman Feske
* \date 2013-04-11
*/
/*
* Copyright (C) 2012-2013 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU General Public License version 2.
*/
#ifndef _HW__RPI__PLATFORM_TIMER_BASE_H_
#define _HW__RPI__PLATFORM_TIMER_BASE_H_
/* Genode includes */
#include <os/attached_io_mem_dataspace.h>
#include <drivers/timer/sp804_base.h>
/*
* On the BCM2835, the timer is driven by the APB clock (250 MHz). The prescale
* register (not present in the normal SP804) has a reset value of 126. Hence,
* the effective timer clock is 1,984 MHz.
*
* The timer device is on the same physical page as the IRQ controller. Hence,
* we open an IO_MEM session with a range smaller than page size as argument.
* The dataspace base address will correspond to 0x2000b000.
*/
enum { TIMER_IRQ = 0,
TIMER_MMIO_BASE = 0x2000b400,
TIMER_MMIO_OFFSET = 0x400,
TIMER_MMIO_SIZE = 0x100,
TIMER_CLOCK = 1984*1000 };
struct Platform_timer_base
:
Genode::Attached_io_mem_dataspace,
Genode::Sp804_base<TIMER_CLOCK>
{
enum { IRQ = TIMER_IRQ };
Platform_timer_base() :
Attached_io_mem_dataspace(TIMER_MMIO_BASE, TIMER_MMIO_SIZE),
Sp804_base((Genode::addr_t)local_addr<void>() + TIMER_MMIO_OFFSET)
{ }
};
#endif /* _HW__RPI__PLATFORM_TIMER_BASE_H_ */