genode/repos/base-hw/src/bootstrap/log.cc
Stefan Kalkowski 6106e64aac base: remove include/spec/* other than ISA
This commit moves the headers residing in `repos/base/include/spec/*/drivers`
to `repos/base/include/drivers/defs` or repos/base/include/drivers/uart`
respectively. The first one contains definitions about board-specific MMIO
iand RAM addresses, or IRQ lines. While the latter contains device driver
code for UART devices. Those definitions are used by driver implementations
in `repos/base-hw`, `repos/os`, and `repos/dde-linux`, which now need to
include them more explicitely.

This work is a step in the direction of reducing 'SPEC' identifiers overall.

Ref #2403
2017-05-31 13:16:01 +02:00

61 lines
1.3 KiB
C++

/*
* \brief Access to the log facility
* \author Norman Feske
* \author Stefan Kalkowski
* \date 2016-05-03
*/
/*
* Copyright (C) 2016 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.
*/
/* Genode includes */
#include <base/log.h>
/* base-internal includes */
#include <base/internal/globals.h>
#include <base/internal/output.h>
#include <base/internal/unmanaged_singleton.h>
#include <board.h>
using namespace Board;
using namespace Genode;
struct Buffer
{
struct Write_fn
{
Serial & serial;
Write_fn(Serial & serial) : serial(serial) {}
void operator () (char const *s)
{
enum { LINE_FEED = 10, CARRIAGE_RETURN = 13 };
for (unsigned i = 0; i < Genode::strlen(s); i++) {
if (s[i] == LINE_FEED) serial.put_char(CARRIAGE_RETURN);
serial.put_char(s[i]);
}
}
};
enum { BAUD_RATE = 115200 };
Serial serial { UART_BASE, UART_CLOCK, BAUD_RATE };
Write_fn function { serial };
Buffered_output<512, Write_fn> buffer { function };
Log log { buffer };
};
Genode::Log &Genode::Log::log() {
return unmanaged_singleton<Buffer>()->log; }
void Genode::init_log() { };