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.
126 lines
2.7 KiB
C++
126 lines
2.7 KiB
C++
/*
|
|
* \brief GPIO driver interface
|
|
* \author Stefan Kalkowski
|
|
* \date 2013-05-03
|
|
*/
|
|
|
|
/*
|
|
* Copyright (C) 2011-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__DRIVER_H_
|
|
#define _INCLUDE__GPIO__DRIVER_H_
|
|
|
|
/* Genode includes */
|
|
#include <base/signal.h>
|
|
|
|
namespace Gpio { struct Driver; }
|
|
|
|
|
|
struct Gpio::Driver
|
|
{
|
|
/**
|
|
* Set direction of GPIO pin, whether it's an input or output one
|
|
*
|
|
*\param gpio corresponding gpio pin number
|
|
*/
|
|
virtual void direction(unsigned gpio, bool input) = 0;
|
|
|
|
/**
|
|
* Set output level (high or low)
|
|
*
|
|
*\param gpio corresponding gpio pin number
|
|
*/
|
|
virtual void write(unsigned gpio, bool enable) = 0;
|
|
|
|
/**
|
|
* Read input level (high or low)
|
|
*
|
|
*\param gpio corresponding gpio pin number
|
|
*/
|
|
virtual bool read(unsigned gpio) = 0;
|
|
|
|
/**
|
|
* Enable/disable debounce logic for the GPIO pin
|
|
*
|
|
*\param gpio corresponding gpio pin number
|
|
*/
|
|
virtual void debounce_enable(unsigned gpio, bool enable) = 0;
|
|
|
|
/**
|
|
* Set delay for debounce logic for the GPIO pin
|
|
*
|
|
*\param gpio corresponding gpio pin number
|
|
*/
|
|
virtual void debounce_time(unsigned gpio, unsigned long us) = 0;
|
|
|
|
/**
|
|
* Set IRQ trigger state to falling edge-triggered
|
|
*
|
|
*\param gpio corresponding gpio pin number
|
|
*/
|
|
virtual void falling_detect(unsigned gpio) = 0;
|
|
|
|
/**
|
|
* Set IRQ trigger state to rising edge-triggered
|
|
*
|
|
*\param gpio corresponding gpio pin number
|
|
*/
|
|
virtual void rising_detect(unsigned gpio) = 0;
|
|
|
|
/**
|
|
* Set IRQ trigger state to high level-triggered
|
|
*
|
|
*\param gpio corresponding gpio pin number
|
|
*/
|
|
virtual void high_detect(unsigned gpio) = 0;
|
|
|
|
/**
|
|
* Set IRQ trigger state to low level-triggered
|
|
*
|
|
*\param gpio corresponding gpio pin number
|
|
*/
|
|
virtual void low_detect(unsigned gpio) = 0;
|
|
|
|
/**
|
|
* Enable/disable IRQ for specified GPIO pin
|
|
*
|
|
*\param gpio corresponding gpio pin number
|
|
*/
|
|
virtual void irq_enable(unsigned gpio, bool enable) = 0;
|
|
|
|
/**
|
|
* Acknowledge IRQ for specified GPIO pin
|
|
*
|
|
* \param gpio corresponding gpio pin number
|
|
*/
|
|
virtual void ack_irq(unsigned gpio) = 0;
|
|
|
|
/**
|
|
* Register signal handler for interrupts
|
|
*
|
|
*\param gpio corresponding gpio pin number
|
|
*/
|
|
virtual void register_signal(unsigned gpio,
|
|
Genode::Signal_context_capability cap) = 0;
|
|
|
|
/**
|
|
* Unregister signal handler
|
|
*
|
|
*\param gpio corresponding gpio pin number
|
|
*/
|
|
virtual void unregister_signal(unsigned gpio) = 0;
|
|
|
|
/**
|
|
* Check whether GPIO number is valid
|
|
*
|
|
*\param gpio corresponding gpio pin number
|
|
*/
|
|
virtual bool gpio_valid(unsigned gpio) = 0;
|
|
};
|
|
|
|
#endif /* _INCLUDE__GPIO__DRIVER_H_ */
|