mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-29 18:18:54 +00:00
85599c072f
Use the new asynchronous IRQ interface in the mostly used drivers, e.g.: * ahci_drv: x86/exynos5 * gpio_drv: imx53/omap4 * input_drv: imx53/dummy * ps2_drv: x86/pl050 * timer_drv Now, the Irq_session is requested from Gpio::Session: From now on we use an asynchronous IRQ interface. To prevent triggering another GPIO IRQ while currently handling the former one, IRQs must now by acknowledged explicitly. While here, we also changed the GPIO session interface regarding IRQ management. The generic GPIO component now wraps the Irq_session managed by the backend instead of using the GPIO backend methods directly. A client using the GPIO session may request the Irq_session_capability by calling 'Gpio::Session::irq_session()' and can use this capability when using a local Irq_session_client. Issue #1456.
89 lines
2.1 KiB
C++
89 lines
2.1 KiB
C++
/*
|
|
* \brief Gpio session interface
|
|
* \author Ivan Loskutov <ivan.loskutov@ksyslabs.org>
|
|
* \author Stefan Kalkowski <stefan.kalkowski@genode-labs.com>
|
|
* \date 2012-06-23
|
|
*/
|
|
|
|
/*
|
|
* Copyright (C) 2012 Ksys Labs LLC
|
|
* Copyright (C) 2012-2015 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__GPIO_SESSION__GPIO_SESSION_H_
|
|
#define _INCLUDE__GPIO_SESSION__GPIO_SESSION_H_
|
|
|
|
#include <base/signal.h>
|
|
#include <dataspace/capability.h>
|
|
#include <session/session.h>
|
|
#include <irq_session/capability.h>
|
|
|
|
namespace Gpio { struct Session; }
|
|
|
|
|
|
struct Gpio::Session : Genode::Session
|
|
{
|
|
static const char *service_name() { return "Gpio"; }
|
|
|
|
enum Direction { IN, OUT };
|
|
|
|
enum Irq_type { LOW_LEVEL, HIGH_LEVEL, FALLING_EDGE, RISING_EDGE };
|
|
|
|
virtual ~Session() { }
|
|
|
|
/**
|
|
* Configure direction of the GPIO pin
|
|
*
|
|
* \param d direction of the pin
|
|
*/
|
|
virtual void direction(Direction d) = 0;
|
|
|
|
/**
|
|
* Write the logic level of the GPIO pin
|
|
*
|
|
* \param enable logic level on the pin
|
|
*/
|
|
virtual void write(bool enable) = 0;
|
|
|
|
/**
|
|
* Read the logic level on a specified GPIO pin
|
|
*
|
|
* \return level on specified GPIO pin
|
|
*/
|
|
virtual bool read() = 0;
|
|
|
|
/**
|
|
* Set the debouncing time
|
|
*
|
|
* \param us debouncing time in microseconds, zero means no debouncing
|
|
*/
|
|
virtual void debouncing(unsigned int us) = 0;
|
|
|
|
/**
|
|
* Rquest IRQ session
|
|
*
|
|
* \param type type of IRQ
|
|
*/
|
|
virtual Genode::Irq_session_capability irq_session(Irq_type type) = 0;
|
|
|
|
|
|
/*******************
|
|
** RPC interface **
|
|
*******************/
|
|
|
|
GENODE_RPC(Rpc_direction, void, direction, Direction);
|
|
GENODE_RPC(Rpc_write, void, write, bool);
|
|
GENODE_RPC(Rpc_read, bool, read);
|
|
GENODE_RPC(Rpc_debouncing, void, debouncing, unsigned int);
|
|
GENODE_RPC(Rpc_irq_session, Genode::Irq_session_capability,
|
|
irq_session, Irq_type);
|
|
|
|
GENODE_RPC_INTERFACE(Rpc_direction, Rpc_write, Rpc_read,
|
|
Rpc_debouncing, Rpc_irq_session);
|
|
};
|
|
|
|
#endif /* _INCLUDE__GPIO_SESSION__GPIO_SESSION_H_ */
|