genode/os/include/regulator/driver.h
2013-06-24 11:48:36 +02:00

51 lines
1.1 KiB
C++

/*
* \brief Regulator-driver interface
* \author Stefan Kalkowski
* \date 2013-06-13
*/
/*
* 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.
*/
#ifndef _INCLUDE__REGULATOR__DRIVER_H_
#define _INCLUDE__REGULATOR__DRIVER_H_
#include <regulator/consts.h>
namespace Regulator {
/**
* Interface to be implemented by the device-specific driver code
*/
struct Driver
{
virtual void set_level(Regulator_id id, unsigned long level) = 0;
virtual unsigned long level(Regulator_id id) = 0;
virtual void set_state(Regulator_id id, bool enable) = 0;
virtual bool state(Regulator_id id) = 0;
};
/**
* Interface for constructing the driver object
*/
struct Driver_factory
{
/**
* Construct new driver
*/
virtual Driver &create(Regulator_id regulator) = 0;
/**
* Destroy driver
*/
virtual void destroy(Driver &driver) = 0;
};
}
#endif /* _REGULATOR__DRIVER_H_ */