From e1515c755c551fac1d218be112df745b4a15db16 Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Wed, 11 Nov 2020 14:28:02 +0100 Subject: types: Add mm_iface structs This adds two structs (mm32_iface and mm32_iface_timed) which are a container for peek/poke interfaces. --- host/include/uhd/types/CMakeLists.txt | 1 + host/include/uhd/types/memmap_iface.hpp | 42 +++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 host/include/uhd/types/memmap_iface.hpp (limited to 'host/include') diff --git a/host/include/uhd/types/CMakeLists.txt b/host/include/uhd/types/CMakeLists.txt index 108a37da4..730ee0e65 100644 --- a/host/include/uhd/types/CMakeLists.txt +++ b/host/include/uhd/types/CMakeLists.txt @@ -15,6 +15,7 @@ UHD_INSTALL(FILES eeprom.hpp endianness.hpp mac_addr.hpp + memmap_iface.hpp metadata.hpp ranges.hpp ref_vector.hpp diff --git a/host/include/uhd/types/memmap_iface.hpp b/host/include/uhd/types/memmap_iface.hpp new file mode 100644 index 000000000..fa6c18d4a --- /dev/null +++ b/host/include/uhd/types/memmap_iface.hpp @@ -0,0 +1,42 @@ +// +// Copyright 2020 Ettus Research, a National Instruments Brand +// +// SPDX-License-Identifier: GPL-3.0-or-later +// + +#pragma once + +#include +#include +#include +#include + +namespace uhd { + +//! Represents a 32-bit, memory-mapped interface (peek/poke). +// This is a simplified version of wb_iface, useful for those cases when we use +// closures to provide bespoke peek/poke interfaces to objects. +struct UHD_API memmap32_iface +{ + using poke32_fn_t = std::function; + using peek32_fn_t = std::function; + + poke32_fn_t poke32; + peek32_fn_t peek32; +}; + +//! Represents a 32-bit, memory-mapped interface (peek/poke). +// +// The difference to memmap32_iface is that the poke command will require a command +// time. +struct UHD_API memmap32_iface_timed +{ + using poke32_fn_t = std::function; + using peek32_fn_t = std::function; + + poke32_fn_t poke32; + peek32_fn_t peek32; +}; + +} // namespace uhd -- cgit v1.2.3