diff --git a/include/spec/zynq/drivers/vdma.h b/include/spec/zynq/drivers/vdma.h new file mode 100644 index 0000000..f600334 --- /dev/null +++ b/include/spec/zynq/drivers/vdma.h @@ -0,0 +1,152 @@ +/* + * \brief VDMA Driver for Zynq + * \author Mark Albers + * \date 2015-04-13 + */ + +/* + * 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 _VDMA_H_ +#define _VDMA_H_ + +#include +#include + +namespace Vdma { + using namespace Genode; + class Zynq_Vdma; +} + +struct Vdma::Zynq_Vdma : Attached_io_mem_dataspace, Mmio +{ + Zynq_Vdma(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()) + { } + + ~Zynq_Vdma() + { } + + /* + * Registers + */ + + struct MM2S_VDMACR : Register<0x00, 32> + { + struct Repeat_En : Bitfield<15,1> {}; + struct Err_IrqEn : Bitfield<14,1> {}; + struct RdPntrNum : Bitfield<8,4> {}; + struct GenlockSrc : Bitfield<7,1> {}; + struct GenlockEn : Bitfield<3,1> {}; + struct Reset : Bitfield<2,1> {}; + struct Circular_Park : Bitfield<1,1> {}; + struct RS : Bitfield<0,1> {}; + }; + + struct MM2S_VDMASR : Register<0x04, 32> + { + struct Err_Irq : Bitfield<14,1> {}; + struct SOFEarlyErr : Bitfield<7,1> {}; + struct VDMADecErr : Bitfield<6,1> {}; + struct VDMASlvErr : Bitfield<5,1> {}; + struct VDMAIntErr : Bitfield<4,1> {}; + struct Halted : Bitfield<0,1> {}; + }; + + struct MM2S_REG_INDEX : Register<0x14, 32> + { + struct MM2S_Reg_Index : Bitfield<0,1> {}; + }; + + struct PARK_PTR_REG : Register<0x28, 32> + { + struct WrFrmStore : Bitfield<24,5> {}; + struct RdFrmStore : Bitfield<16,5> {}; + struct WrFrmPtrRef : Bitfield<8,5> {}; + struct RdFrmPtrRef : Bitfield<0,5> {}; + }; + + struct VDMA_VERSION : Register<0x2c, 32> + { + struct Major_Version : Bitfield<28,4> {}; + struct Minor_Version : Bitfield<20,8> {}; + struct Revision : Bitfield<16,4> {}; + struct Xilinx_Internal : Bitfield<0,16> {}; + }; + + struct S2MM_VDMACR : Register<0x30, 32> + { + struct Repeat_En : Bitfield<15,1> {}; + struct Err_IrqEn : Bitfield<14,1> {}; + struct WrPntrNum : Bitfield<8,4> {}; + struct GenlockSrc : Bitfield<7,1> {}; + struct GenlockEn : Bitfield<3,1> {}; + struct Reset : Bitfield<2,1> {}; + }; + + struct S2MM_VDMASR : Register<0x34, 32> + { + struct EOLLateErr : Bitfield<15,1> {}; + struct Err_Irq : Bitfield<14,1> {}; + struct SOFLateErr : Bitfield<11,1> {}; + struct EOLEarlyErr : Bitfield<8,1> {}; + struct SOFEarlyErr : Bitfield<7,1> {}; + struct VDMADecErr : Bitfield<6,1> {}; + struct DMASlvErr : Bitfield<5,1> {}; + struct DMAIntErr : Bitfield<4,1> {}; + struct Halted : Bitfield<0,1> {}; + }; + + struct S2MM_REG_INDEX : Register<0x44, 32> + { + struct S2MM_Reg_Index : Bitfield<0,1> {}; + }; + + struct MM2S_VSIZE : Register<0x50, 32> + { + struct Vertical_Size : Bitfield<0,13> {}; + }; + + struct MM2S_HSIZE : Register<0x54, 32> + { + struct Horizontal_Size : Bitfield<0,16> {}; + }; + + struct MM2S_FRMDLY_STRIDE : Register<0x58, 32> + { + struct Frame_Delay : Bitfield<24,5> {}; + struct Stride : Bitfield<0,16> {}; + }; + + struct Framebuffer : Register_array<0x5c, 32, 4, 32> { + struct START_ADDRESS : Bitfield<0x0, 32> {}; + }; + + struct MM2S_START_ADDRESS : Register<0x5c, 32> {}; + + struct S2MM_VSIZE : Register<0xa0, 32> + { + struct Vertical_Size : Bitfield<0,13> {}; + }; + + struct S2MM_HSIZE : Register<0xa4, 32> + { + struct Horizontal_Size : Bitfield<0,16> {}; + }; + + struct S2MM_FRMDLY_STRIDE : Register<0xa8, 32> + { + struct Frame_Delay : Bitfield<24,5> {}; + struct Stride : Bitfield<0,16> {}; + }; + + struct S2MM_START_ADDRESS : Register<0xac, 32> {}; + +}; + +#endif // _VDMA_H_ diff --git a/include/vdma_session/capability.h b/include/vdma_session/capability.h deleted file mode 100644 index 17610b8..0000000 --- a/include/vdma_session/capability.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * \brief Zynq VDMA session capability type - * \author Mark Albers - * \date 2015-04-13 - */ - -/* - * 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__VDMA_SESSION__CAPABILITY_H_ -#define _INCLUDE__VDMA_SESSION__CAPABILITY_H_ - -#include -#include - -namespace Vdma { typedef Genode::Capability Session_capability; } - -#endif /* _INCLUDE__VDMA_SESSION__CAPABILITY_H_ */ diff --git a/include/vdma_session/client.h b/include/vdma_session/client.h deleted file mode 100644 index d94cdfd..0000000 --- a/include/vdma_session/client.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * \brief Client-side Zynq VDMA session interface - * \author Mark Albers - * \date 2015-04-13 - */ - -/* - * 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__VDMA_SESSION_H__CLIENT_H_ -#define _INCLUDE__VDMA_SESSION_H__CLIENT_H_ - -#include -#include - -#define S2MM false -#define MM2S true - -namespace Vdma { - - struct Session_client : Genode::Rpc_client - { - explicit Session_client(Session_capability session) - : Genode::Rpc_client(session) { } - - bool setConfig(Genode::uint32_t data, bool isMM2S) { return call(data, isMM2S); } - - bool setStride(Genode::uint16_t data, bool isMM2S) { return call(data, isMM2S); } - - bool setWidth(Genode::uint16_t data, bool isMM2S) { return call(data, isMM2S); } - - bool setHeight(Genode::uint16_t data, bool isMM2S) { return call(data, isMM2S); } - - bool setAddr(Genode::uint32_t data, bool isMM2S) { return call(data, isMM2S); } - }; -} - -#endif /* _INCLUDE__VDMA_SESSION_H__CLIENT_H_ */ diff --git a/include/vdma_session/connection.h b/include/vdma_session/connection.h deleted file mode 100644 index 6a93dd5..0000000 --- a/include/vdma_session/connection.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * \brief Connection to Zynq VDMA session - * \author Mark Albers - * \date 2015-04-13 - */ - -/* - * 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__VDMA_SESSION__CONNECTION_H_ -#define _INCLUDE__VDMA_SESSION__CONNECTION_H_ - -#include -#include - -namespace Vdma { - - struct Connection : Genode::Connection, Session_client - { - Connection(unsigned vdma_number) __attribute__((deprecated)) - : Genode::Connection(session("ram_quota=8K, vdma=%zd", vdma_number)), - Session_client(cap()) { } - }; -} - -#endif /* _INCLUDE__VDMA_SESSION__CONNECTION_H_ */ diff --git a/include/vdma_session/vdma_session.h b/include/vdma_session/vdma_session.h deleted file mode 100644 index 280b4c0..0000000 --- a/include/vdma_session/vdma_session.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * \brief Zynq VDMA session interface - * \author Mark Albers - * \date 2015-04-13 - */ - -/* - * 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__VDMA_SESSION__VDMA_SESSION_H_ -#define _INCLUDE__VDMA_SESSION__VDMA_SESSION_H_ - -#include -#include - -namespace Vdma { - - struct Session : Genode::Session - { - static const char *service_name() { return "Vdma"; } - - virtual ~Session() { } - - virtual bool setConfig(Genode::uint32_t data, bool isMM2S) = 0; - - virtual bool setStride(Genode::uint16_t data, bool isMM2S) = 0; - - virtual bool setWidth(Genode::uint16_t data, bool isMM2S) = 0; - - virtual bool setHeight(Genode::uint16_t data, bool isMM2S) = 0; - - virtual bool setAddr(Genode::uint32_t data, bool isMM2S) = 0; - - - /******************* - ** RPC interface ** - *******************/ - - GENODE_RPC(Rpc_setConfig, bool, setConfig, Genode::uint32_t, bool); - GENODE_RPC(Rpc_setStride, bool, setStride, Genode::uint16_t, bool); - GENODE_RPC(Rpc_setWidth, bool, setWidth, Genode::uint16_t, bool); - GENODE_RPC(Rpc_setHeight, bool, setHeight, Genode::uint16_t, bool); - GENODE_RPC(Rpc_setAddr, bool, setAddr, Genode::uint32_t, bool); - - GENODE_RPC_INTERFACE(Rpc_setConfig, Rpc_setStride, Rpc_setWidth, - Rpc_setHeight, Rpc_setAddr); - }; -} - -#endif /* _INCLUDE__VDMA_SESSION__VDMA_SESSION_H_ */ diff --git a/src/drivers/vdma/spec/zynq/driver.h b/src/drivers/vdma/spec/zynq/driver.h deleted file mode 100644 index fae6967..0000000 --- a/src/drivers/vdma/spec/zynq/driver.h +++ /dev/null @@ -1,105 +0,0 @@ -/* - * \brief VDMA Driver for Zynq - * \author Mark Albers - * \date 2015-04-13 - */ - -/* - * 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 _DRIVER_H_ -#define _DRIVER_H_ - -#include -#include -#include -#include -#include -#include -#include "vdma.h" - -namespace Vdma { - using namespace Genode; - class Driver; -} - -class Vdma::Driver -{ - private: - - std::vector _vdma_bank; - - Driver(std::vector addr) - { - for (unsigned i = 0; i < addr.size(); i++) - { - _vdma_bank.push_back(new Zynq_Vdma(addr[i], Board_base::VDMA_MMIO_SIZE)); - } - } - - ~Driver() - { - for (std::vector::iterator it = _vdma_bank.begin() ; it != _vdma_bank.end(); ++it) - { - delete (*it); - } - _vdma_bank.clear(); - } - - public: - - static Driver& factory(std::vector addr); - - bool setConfig(unsigned vdma, Genode::uint32_t data, bool isMM2S) - { - Zynq_Vdma *vdma_reg = _vdma_bank[vdma]; - if (isMM2S) vdma_reg->write(data); - else vdma_reg->write(data); - return true; - } - - bool setStride(unsigned vdma, Genode::uint16_t data, bool isMM2S) - { - Zynq_Vdma *vdma_reg = _vdma_bank[vdma]; - if (isMM2S) vdma_reg->write(data); - else vdma_reg->write(data); - return true; - } - - bool setWidth(unsigned vdma, Genode::uint16_t data, bool isMM2S) - { - Zynq_Vdma *vdma_reg = _vdma_bank[vdma]; - if (isMM2S) vdma_reg->write(data); - else vdma_reg->write(data); - return true; - } - - bool setHeight(unsigned vdma, Genode::uint16_t data, bool isMM2S) - { - Zynq_Vdma *vdma_reg = _vdma_bank[vdma]; - if (isMM2S) vdma_reg->write(data); - else vdma_reg->write(data); - return true; - } - - - bool setAddr(unsigned vdma, Genode::uint32_t data, bool isMM2S) - { - Zynq_Vdma *vdma_reg = _vdma_bank[vdma]; - if (isMM2S) vdma_reg->write(data); - else vdma_reg->write(data); - return true; - } -}; - -Vdma::Driver& Vdma::Driver::factory(std::vector addr) -{ - static Vdma::Driver driver(addr); - return driver; -} - -#endif /* _DRIVER_H_ */ diff --git a/src/drivers/vdma/spec/zynq/main.cc b/src/drivers/vdma/spec/zynq/main.cc deleted file mode 100644 index f0bbb8c..0000000 --- a/src/drivers/vdma/spec/zynq/main.cc +++ /dev/null @@ -1,152 +0,0 @@ -/* - * \brief VDMA Driver for Zynq - * \author Mark Albers - * \date 2015-04-13 - */ - -/* - * 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. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "driver.h" - -namespace Vdma { - using namespace Genode; - class Session_component; - class Root; -}; - - -class Vdma::Session_component : public Genode::Rpc_object -{ - private: - - Driver &_driver; - unsigned _number; - - public: - - Session_component(Driver &driver, unsigned vdma_number) - : _driver(driver), _number(vdma_number) {} - - virtual bool setConfig(Genode::uint32_t data, bool isMM2S) - { - return _driver.setConfig(_number, data, isMM2S); - } - - virtual bool setStride(Genode::uint16_t data, bool isMM2S) - { - return _driver.setStride(_number, data, isMM2S); - } - - virtual bool setWidth(Genode::uint16_t data, bool isMM2S) - { - return _driver.setWidth(_number, data, isMM2S); - } - - virtual bool setHeight(Genode::uint16_t data, bool isMM2S) - { - return _driver.setHeight(_number, data, isMM2S); - } - - virtual bool setAddr(Genode::uint32_t data, bool isMM2S) - { - return _driver.setAddr(_number, data, isMM2S); - } -}; - - -class Vdma::Root : public Genode::Root_component -{ - private: - - Driver &_driver; - - protected: - - Session_component *_create_session(const char *args) - { - unsigned number = Genode::Arg_string::find_arg(args, "vdma").ulong_value(0); - Genode::size_t ram_quota = Genode::Arg_string::find_arg(args, "ram_quota").ulong_value(0); - - if (ram_quota < sizeof(Session_component)) { - warning("Insufficient dontated ram_quota (", ram_quota, " bytes), " - "require ", sizeof(Session_component), " bytes"); - throw Genode::Root::Quota_exceeded(); - } - - return new (md_alloc()) Session_component(_driver, number); - } - - public: - - Root(Genode::Rpc_entrypoint *session_ep, - Genode::Allocator *md_alloc, Driver &driver) - : Genode::Root_component(session_ep, md_alloc), - _driver(driver) { } -}; - - -int main(int, char **) -{ - using namespace Vdma; - - Genode::log("Zynq VDMA driver"); - - /* - * Read config - */ - std::vector addr; - - try { - Genode::Xml_node vdma_node = Genode::config()->xml_node().sub_node("vdma"); - - for (unsigned i = 0; ;i++, vdma_node = vdma_node.next("vdma")) - { - addr.push_back(0); - vdma_node.attribute("addr").value(&addr[i]); - Genode::log("VDMA with mio address ", Genode::Hex(addr[i]), " added."); - - if (vdma_node.is_last("vdma")) break; - } - } - catch (Genode::Xml_node::Nonexistent_sub_node) { - Genode::warning("No VDMA config"); - } - - /* - * Create Driver - */ - Driver &driver = Driver::factory(addr); - addr.clear(); - - /* - * Initialize server entry point - */ - enum { STACK_SIZE = 4096 }; - static Cap_connection cap; - Sliced_heap sliced_heap(env()->ram_session(), env()->rm_session()); - static Rpc_entrypoint ep(&cap, STACK_SIZE, "vdma_ep"); - static Vdma::Root vdma_root(&ep, &sliced_heap, driver); - - /* - * Announce service - */ - env()->parent()->announce(ep.manage(&vdma_root)); - - Genode::sleep_forever(); - return 0; -} diff --git a/src/drivers/vdma/spec/zynq/target.mk b/src/drivers/vdma/spec/zynq/target.mk deleted file mode 100644 index 158d9a2..0000000 --- a/src/drivers/vdma/spec/zynq/target.mk +++ /dev/null @@ -1,12 +0,0 @@ -# \brief VDMA specific for zynq systems -# \author Mark Albers -# \date 2015-04-13 - -TARGET = zynq_vdma_drv - -SRC_CC = main.cc -LIBS = base config posix stdcxx -INC_DIR += $(PRG_DIR) - -vpath main.cc $(PRG_DIR) - diff --git a/src/drivers/vdma/spec/zynq/vdma.h b/src/drivers/vdma/spec/zynq/vdma.h deleted file mode 100644 index c6a34ef..0000000 --- a/src/drivers/vdma/spec/zynq/vdma.h +++ /dev/null @@ -1,148 +0,0 @@ -/* - * \brief VDMA Driver for Zynq - * \author Mark Albers - * \date 2015-04-13 - */ - -/* - * 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 _VDMA_H_ -#define _VDMA_H_ - -#include -#include - -namespace Vdma { - using namespace Genode; - class Zynq_Vdma; -} - -struct Vdma::Zynq_Vdma : Attached_io_mem_dataspace, Mmio -{ - Zynq_Vdma(Genode::addr_t const mmio_base, Genode::size_t const mmio_size) : - Genode::Attached_io_mem_dataspace(mmio_base, mmio_size), - Genode::Mmio((Genode::addr_t)local_addr()) - { } - - ~Zynq_Vdma() - { } - - /* - * Registers - */ - - struct MM2S_VDMACR : Register<0x00, 32> - { - struct Repeat_En : Bitfield<15,1> {}; - struct Err_IrqEn : Bitfield<14,1> {}; - struct RdPntrNum : Bitfield<8,4> {}; - struct GenlockSrc : Bitfield<7,1> {}; - struct GenlockEn : Bitfield<3,1> {}; - struct Reset : Bitfield<2,1> {}; - struct Circular_Park : Bitfield<1,1> {}; - struct RS : Bitfield<0,1> {}; - }; - - struct MM2S_VDMASR : Register<0x04, 32> - { - struct Err_Irq : Bitfield<14,1> {}; - struct SOFEarlyErr : Bitfield<7,1> {}; - struct VDMADecErr : Bitfield<6,1> {}; - struct VDMASlvErr : Bitfield<5,1> {}; - struct VDMAIntErr : Bitfield<4,1> {}; - struct Halted : Bitfield<0,1> {}; - }; - - struct MM2S_REG_INDEX : Register<0x14, 32> - { - struct MM2S_Reg_Index : Bitfield<0,1> {}; - }; - - struct PARK_PTR_REG : Register<0x28, 32> - { - struct WrFrmStore : Bitfield<24,5> {}; - struct RdFrmStore : Bitfield<16,5> {}; - struct WrFrmPtrRef : Bitfield<8,5> {}; - struct RdFrmPtrRef : Bitfield<0,5> {}; - }; - - struct VDMA_VERSION : Register<0x2c, 32> - { - struct Major_Version : Bitfield<28,4> {}; - struct Minor_Version : Bitfield<20,8> {}; - struct Revision : Bitfield<16,4> {}; - struct Xilinx_Internal : Bitfield<0,16> {}; - }; - - struct S2MM_VDMACR : Register<0x30, 32> - { - struct Repeat_En : Bitfield<15,1> {}; - struct Err_IrqEn : Bitfield<14,1> {}; - struct WrPntrNum : Bitfield<8,4> {}; - struct GenlockSrc : Bitfield<7,1> {}; - struct GenlockEn : Bitfield<3,1> {}; - struct Reset : Bitfield<2,1> {}; - }; - - struct S2MM_VDMASR : Register<0x34, 32> - { - struct EOLLateErr : Bitfield<15,1> {}; - struct Err_Irq : Bitfield<14,1> {}; - struct SOFLateErr : Bitfield<11,1> {}; - struct EOLEarlyErr : Bitfield<8,1> {}; - struct SOFEarlyErr : Bitfield<7,1> {}; - struct VDMADecErr : Bitfield<6,1> {}; - struct DMASlvErr : Bitfield<5,1> {}; - struct DMAIntErr : Bitfield<4,1> {}; - struct Halted : Bitfield<0,1> {}; - }; - - struct S2MM_REG_INDEX : Register<0x44, 32> - { - struct S2MM_Reg_Index : Bitfield<0,1> {}; - }; - - struct MM2S_VSIZE : Register<0x50, 32> - { - struct Vertical_Size : Bitfield<0,13> {}; - }; - - struct MM2S_HSIZE : Register<0x54, 32> - { - struct Horizontal_Size : Bitfield<0,16> {}; - }; - - struct MM2S_FRMDLY_STRIDE : Register<0x58, 32> - { - struct Frame_Delay : Bitfield<24,5> {}; - struct Stride : Bitfield<0,16> {}; - }; - - struct MM2S_START_ADDRESS : Register<0x5c, 32> {}; - - struct S2MM_VSIZE : Register<0xa0, 32> - { - struct Vertical_Size : Bitfield<0,13> {}; - }; - - struct S2MM_HSIZE : Register<0xa4, 32> - { - struct Horizontal_Size : Bitfield<0,16> {}; - }; - - struct S2MM_FRMDLY_STRIDE : Register<0xa8, 32> - { - struct Frame_Delay : Bitfield<24,5> {}; - struct Stride : Bitfield<0,16> {}; - }; - - struct S2MM_START_ADDRESS : Register<0xac, 32> {}; - -}; - -#endif // _VDMA_H_