43 lines
968 B
C++
43 lines
968 B
C++
|
/*
|
||
|
* \brief Test for changing the CPU frequency
|
||
|
* \author Stefan Kalkowski
|
||
|
* \date 2013-06-14
|
||
|
*/
|
||
|
|
||
|
/*
|
||
|
* Copyright (C) 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.
|
||
|
*/
|
||
|
|
||
|
/* Genode includes */
|
||
|
#include <base/printf.h>
|
||
|
#include <base/env.h>
|
||
|
#include <base/sleep.h>
|
||
|
|
||
|
#include <regulator/consts.h>
|
||
|
#include <regulator_session/connection.h>
|
||
|
#include <timer_session/connection.h>
|
||
|
|
||
|
int main(int argc, char **argv)
|
||
|
{
|
||
|
using namespace Genode;
|
||
|
|
||
|
printf("--- test-cpufreq started ---\n");
|
||
|
|
||
|
static Timer::Connection timer;
|
||
|
static Regulator::Connection cpu_regulator(Regulator::CLK_CPU);
|
||
|
bool high = true;
|
||
|
|
||
|
while (true) {
|
||
|
timer.msleep(10000);
|
||
|
PINF("Setting CPU frequency %s", high ? "low" : "high");
|
||
|
cpu_regulator.set_level(high ? Regulator::CPU_FREQ_200
|
||
|
: Regulator::CPU_FREQ_1600);
|
||
|
high = !high;
|
||
|
}
|
||
|
|
||
|
return 1;
|
||
|
}
|