zynq: add gpio, i2c and vdma drivers

This commit is contained in:
Mark
2016-03-24 17:03:20 +01:00
committed by Norman Feske
parent 2e7bb650dc
commit 6418f34082
24 changed files with 1734 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
/*
* \brief I2C bus driver session capability type
* \author Mark Albers
* \date 2015-04-13
* \author Alexander Tarasikov <alexander.tarasikov@gmail.com>
* \date 2012-09-18
*/
/*
* 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__I2C_SESSION__CAPABILITY_H_
#define _INCLUDE__I2C_SESSION__CAPABILITY_H_
#include <base/capability.h>
#include <i2c_session/zynq/i2c_session.h>
namespace I2C { typedef Genode::Capability<Session> Session_capability; }
#endif /* _INCLUDE__I2C_SESSION__CAPABILITY_H_ */

View File

@@ -0,0 +1,43 @@
/*
* \brief Client-side i2c interface
* \author Mark Albers
* \date 2015-04-13
* \author Alexander Tarasikov <alexander.tarasikov@gmail.com>
* \date 2012-09-18
*/
/*
* 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__I2C_SESSION__CLIENT_H_
#define _INCLUDE__I2C_SESSION__CLIENT_H_
#include <i2c_session/zynq/capability.h>
#include <base/rpc_client.h>
namespace I2C {
struct Session_client : Genode::Rpc_client<Session>
{
explicit Session_client(Session_capability session)
: Genode::Rpc_client<Session>(session) { }
bool read_byte_16bit_reg(Genode::uint8_t adr, Genode::uint16_t reg, Genode::uint8_t *data)
{
return call<Rpc_read_byte_16bit_reg>(adr, reg, data);
}
bool write_16bit_reg(Genode::uint8_t adr, Genode::uint16_t reg,
Genode::uint8_t data)
{
return call<Rpc_write_16bit_reg>(adr, reg, data);
}
};
}
#endif /* _INCLUDE__I2C_SESSION__CLIENT_H_ */

View File

@@ -0,0 +1,34 @@
/*
* \brief Connection to i2c service
* \author Mark Albers
* \author Alexander Tarasikov <alexander.tarasikov@gmail.com>
* \date 2012-09-18
*/
/*
* Copyright (C) 2012 Ksys Labs LLC
* Copyright (C) 2012 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__I2C_SESSION__CONNECTION_H_
#define _INCLUDE__I2C_SESSION__CONNECTION_H_
#include <i2c_session/zynq/client.h>
#include <base/connection.h>
namespace I2C {
class Connection : public Genode::Connection<Session>,
public Session_client
{
public:
Connection(unsigned int bus_num) :
Genode::Connection<Session>(session("ram_quota=4K, bus=%zd", bus_num)),
Session_client(cap()) { }
};
}
#endif /* _INCLUDE__I2C_SESSION__CONNECTION_H_ */

View File

@@ -0,0 +1,69 @@
/*
* \brief I2C session interface
* \author Mark Albers
* \date 2015-04-13
* \author Alexander Tarasikov <alexander.tarasikov@gmail.com>
* \date 2012-09-18
*/
/*
* 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__I2C_SESSION__I2C_SESSION_H_
#define _INCLUDE__I2C_SESSION__I2C_SESSION_H_
#include <base/signal.h>
#include <session/session.h>
namespace I2C {
struct Session : Genode::Session
{
static const char *service_name() { return "I2C"; }
virtual ~Session() { }
/**
* Read a single byte from a 16 bit register of the device
*
* \param adr the address of the device on the bus
* \param reg the register to read
* \param data the read value
*
*/
virtual bool read_byte_16bit_reg(Genode::uint8_t adr, Genode::uint16_t reg, Genode::uint8_t *data) = 0;
/**
* Write a single data byte to a 16 bit register
*
* \param adr the address of the device on the bus
* \param reg the register to write
* \param data the value to write
*
*/
virtual bool write_16bit_reg(Genode::uint8_t adr, Genode::uint16_t reg,
Genode::uint8_t data) = 0;
/*********************
** RPC declaration **
*********************/
GENODE_RPC(Rpc_read_byte_16bit_reg, bool, read_byte_16bit_reg,
Genode::uint8_t, Genode::uint16_t, Genode::uint8_t*);
GENODE_RPC(Rpc_write_16bit_reg, bool, write_16bit_reg,
Genode::uint8_t, Genode::uint16_t, Genode::uint8_t);
GENODE_RPC_INTERFACE(
Rpc_read_byte_16bit_reg,
Rpc_write_16bit_reg
);
};
}
#endif /* _INCLUDE__I2C_SESSION__I2C_SESSION_H_ */