2013-06-13 08:39:59 +00:00
|
|
|
/*
|
|
|
|
* \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
|
|
|
|
{
|
2013-06-24 13:37:28 +00:00
|
|
|
virtual void level(Regulator_id id, unsigned long level) = 0;
|
|
|
|
virtual unsigned long level(Regulator_id id) = 0;
|
|
|
|
virtual void state(Regulator_id id, bool enable) = 0;
|
|
|
|
virtual bool state(Regulator_id id) = 0;
|
2013-06-13 08:39:59 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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_ */
|