47990f37d7
In addition to updating the contrib sources the driver now uses the new Component API and will report the internal mixer state. Reporting of the mixer state is enabled by adding the 'report_mixer' attribute to the drivers configuration and setting its value to 'yes'. The following snippets illustrates the format of the report: !<mixer_state> ! <mixer field="inputs.beep" value="108"/> ! <mixer field="outputs.hp_sense" value="plugged"/> ! <mixer field="outputs.master" value="128,128"/> ! <mixer field="outputs.mic_sense" value="unplugged"/> ! <mixer field="outputs.spkr_muters" value="hp,mic"/> !</mixer_state> The mixer state may expose other mixer fields as well, depending on the used sound card. The naming scheme of the attributes intentionally matches the naming scheme of OpenBSD's mixerctl(1) program. Each 'mixer' node can be used to configure the audio driver by using it in its configuration, e.g.: !<config report_mixer="yes"> ! <mixer field="outputs.master" value="255,255"/> !</config> This configuration will set the output volume to the highest possible value. Although it is now also possible to update the configuration at run-time it should not be done while the driver is currently playing or recording because it may provoke the generation of artefacts. Fixes #1973.
133 lines
2.2 KiB
C++
133 lines
2.2 KiB
C++
/*
|
|
* \brief Signal context for timer events
|
|
* \author Josef Soentgen
|
|
* \date 2014-10-10
|
|
*/
|
|
|
|
/*
|
|
* Copyright (C) 2014-2016 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.
|
|
*/
|
|
|
|
/* Genode includes */
|
|
#include <base/env.h>
|
|
#include <base/heap.h>
|
|
#include <base/log.h>
|
|
#include <base/sleep.h>
|
|
#include <base/tslab.h>
|
|
#include <timer_session/connection.h>
|
|
|
|
/* local includes */
|
|
#include <list.h>
|
|
#include <bsd.h>
|
|
#include <bsd_emul.h>
|
|
|
|
|
|
static unsigned long millisecs;
|
|
|
|
|
|
namespace Bsd {
|
|
class Timer;
|
|
}
|
|
|
|
/**
|
|
* Bsd::Timer
|
|
*/
|
|
class Bsd::Timer
|
|
{
|
|
private:
|
|
|
|
::Timer::Connection _timer_conn;
|
|
Genode::Signal_handler<Bsd::Timer> _dispatcher;
|
|
|
|
/**
|
|
* Handle trigger_once signal
|
|
*/
|
|
void _handle()
|
|
{
|
|
Bsd::scheduler().schedule();
|
|
}
|
|
|
|
public:
|
|
|
|
/**
|
|
* Constructor
|
|
*/
|
|
Timer(Genode::Entrypoint &ep)
|
|
:
|
|
_dispatcher(ep, *this, &Bsd::Timer::_handle)
|
|
{
|
|
_timer_conn.sigh(_dispatcher);
|
|
}
|
|
|
|
/**
|
|
* Update time counter
|
|
*/
|
|
void update_millisecs()
|
|
{
|
|
millisecs = _timer_conn.elapsed_ms();
|
|
}
|
|
};
|
|
|
|
|
|
static Bsd::Timer *_bsd_timer;
|
|
|
|
|
|
void Bsd::timer_init(Genode::Entrypoint &ep)
|
|
{
|
|
/* XXX safer way preventing possible nullptr access? */
|
|
static Bsd::Timer bsd_timer(ep);
|
|
_bsd_timer = &bsd_timer;
|
|
|
|
/* initialize value explicitly */
|
|
millisecs = 0UL;
|
|
}
|
|
|
|
|
|
void Bsd::update_time() {
|
|
_bsd_timer->update_millisecs(); }
|
|
|
|
|
|
static Timer::Connection _timer;
|
|
|
|
|
|
static Bsd::Task *_sleep_task;
|
|
|
|
|
|
/*****************
|
|
** sys/systm.h **
|
|
*****************/
|
|
|
|
extern "C" int msleep(const volatile void *ident, struct mutex *mtx,
|
|
int priority, const char *wmesg, int timo)
|
|
{
|
|
if (_sleep_task) {
|
|
Genode::error("_sleep_task is not null, current task: ",
|
|
Bsd::scheduler().current()->name());
|
|
Genode::sleep_forever();
|
|
}
|
|
|
|
_sleep_task = Bsd::scheduler().current();
|
|
_sleep_task->block_and_schedule();
|
|
|
|
return 0;
|
|
}
|
|
|
|
extern "C" void wakeup(const volatile void *ident)
|
|
{
|
|
_sleep_task->unblock();
|
|
_sleep_task = nullptr;
|
|
}
|
|
|
|
|
|
/*********************
|
|
** machine/param.h **
|
|
*********************/
|
|
|
|
extern "C" void delay(int delay)
|
|
{
|
|
_timer.msleep(delay);
|
|
}
|