zynq: remove GPIO driver
This commit is contained in:
committed by
Norman Feske
parent
458c013634
commit
300b0ea022
@@ -1,22 +0,0 @@
|
||||
/*
|
||||
* \brief Zynq Gpio session capability type
|
||||
* \author Mark Albers
|
||||
* \date 2015-04-02
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 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__CAPABILITY_H_
|
||||
#define _INCLUDE__GPIO_SESSION__CAPABILITY_H_
|
||||
|
||||
#include <base/capability.h>
|
||||
#include <gpio_session/zynq/gpio_session.h>
|
||||
|
||||
namespace Gpio { typedef Genode::Capability<Session> Session_capability; }
|
||||
|
||||
#endif /* _INCLUDE__GPIO_SESSION__CAPABILITY_H_ */
|
||||
@@ -1,32 +0,0 @@
|
||||
/*
|
||||
* \brief Client-side Zynq Gpio session interface
|
||||
* \author Mark Albers
|
||||
* \date 2015-04-02
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 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_H__CLIENT_H_
|
||||
#define _INCLUDE__GPIO_SESSION_H__CLIENT_H_
|
||||
|
||||
#include <gpio_session/zynq/capability.h>
|
||||
#include <base/rpc_client.h>
|
||||
|
||||
namespace Gpio {
|
||||
|
||||
struct Session_client : Genode::Rpc_client<Session>
|
||||
{
|
||||
explicit Session_client(Session_capability session)
|
||||
: Genode::Rpc_client<Session>(session) { }
|
||||
|
||||
bool write(Genode::uint32_t data, bool isChannel2 = false) { return call<Rpc_write>(data, isChannel2); }
|
||||
Genode::uint32_t read(bool isChannel2 = false) { return call<Rpc_read>(isChannel2); }
|
||||
};
|
||||
}
|
||||
|
||||
#endif /* _INCLUDE__GPIO_SESSION_H__CLIENT_H_ */
|
||||
@@ -1,30 +0,0 @@
|
||||
/*
|
||||
* \brief Connection to Zynq Gpio session
|
||||
* \author Mark Albers
|
||||
* \date 2015-04-02
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 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__CONNECTION_H_
|
||||
#define _INCLUDE__GPIO_SESSION__CONNECTION_H_
|
||||
|
||||
#include <gpio_session/zynq/client.h>
|
||||
#include <base/connection.h>
|
||||
|
||||
namespace Gpio {
|
||||
|
||||
struct Connection : Genode::Connection<Session>, Session_client
|
||||
{
|
||||
Connection(unsigned gpio_number) __attribute__((deprecated))
|
||||
: Genode::Connection<Session>(session("ram_quota=8K, gpio=%zd", gpio_number)),
|
||||
Session_client(cap()) { }
|
||||
};
|
||||
}
|
||||
|
||||
#endif /* _INCLUDE__GPIO_SESSION__CONNECTION_H_ */
|
||||
@@ -1,54 +0,0 @@
|
||||
/*
|
||||
* \brief Zynq Gpio session interface
|
||||
* \author Mark Albers
|
||||
* \date 2015-04-02
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 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 <session/session.h>
|
||||
|
||||
namespace Gpio {
|
||||
|
||||
struct Session : Genode::Session
|
||||
{
|
||||
static const char *service_name() { return "Gpio"; }
|
||||
|
||||
virtual ~Session() { }
|
||||
|
||||
/**
|
||||
* Write
|
||||
*
|
||||
* \param data
|
||||
*/
|
||||
virtual bool write(Genode::uint32_t data, bool isChannel2) = 0;
|
||||
|
||||
/**
|
||||
* Read
|
||||
*
|
||||
* \return data
|
||||
*/
|
||||
virtual Genode::uint32_t read(bool isChannel2) = 0;
|
||||
|
||||
|
||||
/*******************
|
||||
** RPC interface **
|
||||
*******************/
|
||||
|
||||
GENODE_RPC(Rpc_write, bool, write, Genode::uint32_t, bool);
|
||||
GENODE_RPC(Rpc_read, Genode::uint32_t, read, bool);
|
||||
|
||||
GENODE_RPC_INTERFACE(Rpc_write, Rpc_read);
|
||||
};
|
||||
}
|
||||
|
||||
#endif /* _INCLUDE__GPIO_SESSION__GPIO_SESSION_H_ */
|
||||
98
include/spec/zynq/drivers/gpio.h
Normal file
98
include/spec/zynq/drivers/gpio.h
Normal file
@@ -0,0 +1,98 @@
|
||||
/*
|
||||
* \brief Gpio Driver for Zynq
|
||||
* \author Mark Albers
|
||||
* \date 2015-04-02
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2011-2017 Genode Labs GmbH
|
||||
*
|
||||
* This file is part of the Genode OS framework, which is distributed
|
||||
* under the terms of the GNU Affero General Public License version 3.
|
||||
*/
|
||||
|
||||
#ifndef _GPIO_H_
|
||||
#define _GPIO_H_
|
||||
|
||||
#include <base/attached_io_mem_dataspace.h>
|
||||
#include <util/mmio.h>
|
||||
|
||||
namespace Gpio {
|
||||
using namespace Genode;
|
||||
class Zynq_Gpio;
|
||||
}
|
||||
|
||||
struct Gpio::Zynq_Gpio : Attached_io_mem_dataspace, Mmio
|
||||
{
|
||||
Zynq_Gpio(Genode::Env &env, Genode::addr_t const mmio_base, Genode::size_t const mmio_size) :
|
||||
Genode::Attached_io_mem_dataspace(env, mmio_base, mmio_size),
|
||||
Genode::Mmio((Genode::addr_t)local_addr<void>())
|
||||
{ }
|
||||
|
||||
~Zynq_Gpio()
|
||||
{ }
|
||||
|
||||
/*
|
||||
* Registers
|
||||
*/
|
||||
|
||||
struct GPIO_DATA : Register<0x00, 32> {};
|
||||
|
||||
struct GPIO_TRI : Register<0x04, 32> {};
|
||||
|
||||
struct GPIO2_DATA : Register<0x08, 32> {};
|
||||
|
||||
struct GPIO2_TRI : Register<0x0C, 32> {};
|
||||
|
||||
struct GIER : Register<0x011C, 32>
|
||||
{
|
||||
struct Global_Interrupt_Enable : Bitfield<31,1> {};
|
||||
};
|
||||
|
||||
struct IP_IER : Register<0x0128, 32>
|
||||
{
|
||||
struct Channel_1_Interrupt_Enable : Bitfield<0,1> {};
|
||||
struct Channel_2_Interrupt_Enable : Bitfield<1,1> {};
|
||||
};
|
||||
|
||||
struct IP_ISR : Register<0x120, 32>
|
||||
{
|
||||
struct Channel_1_Interrupt_Status : Bitfield<0,1> {};
|
||||
struct Channel_2_Interrupt_Status : Bitfield<1,1> {};
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Functions
|
||||
*/
|
||||
Genode::uint8_t gpio_read(bool isChannel2)
|
||||
{
|
||||
if (isChannel2)
|
||||
{
|
||||
write<GPIO2_TRI>(0xffffffff);
|
||||
return read<GPIO2_DATA>();
|
||||
}
|
||||
else
|
||||
{
|
||||
write<GPIO_TRI>(0xffffffff);
|
||||
return read<GPIO_DATA>();
|
||||
}
|
||||
}
|
||||
|
||||
bool gpio_write(Genode::uint8_t data, bool isChannel2)
|
||||
{
|
||||
if (isChannel2)
|
||||
{
|
||||
write<GPIO2_TRI>(0);
|
||||
write<GPIO2_DATA>(data);
|
||||
}
|
||||
else
|
||||
{
|
||||
write<GPIO_TRI>(0);
|
||||
write<GPIO_DATA>(data);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
#endif // _GPIO_H_
|
||||
Reference in New Issue
Block a user