From 34bfddb581fdb576192d7c2e5f151a0a7f137a20 Mon Sep 17 00:00:00 2001 From: rw-r-r-0644 Date: Thu, 28 Feb 2019 07:10:10 +0100 Subject: [PATCH] dmae: Add DMAECopyMem, DMAEFillMem and DMAEWaitDone (#102) * dmae: Add DMAECopyMem, DMAEFillMem and DMAEWaitDone * tests: Add dmae to header compile test list --- include/dmae/dmae.dox | 4 + include/dmae/mem.h | 76 +++++++++++++++++++ include/dmae/sync.h | 33 ++++++++ .../test_compile_headers_list.h | 2 + 4 files changed, 115 insertions(+) create mode 100644 include/dmae/dmae.dox create mode 100644 include/dmae/mem.h create mode 100644 include/dmae/sync.h diff --git a/include/dmae/dmae.dox b/include/dmae/dmae.dox new file mode 100644 index 00000000..547426ab --- /dev/null +++ b/include/dmae/dmae.dox @@ -0,0 +1,4 @@ +/** + * \defgroup dmae dmae + * DMA Engine. +*/ diff --git a/include/dmae/mem.h b/include/dmae/mem.h new file mode 100644 index 00000000..c976dca9 --- /dev/null +++ b/include/dmae/mem.h @@ -0,0 +1,76 @@ +#pragma once +#include +#include "sync.h" + +/** + * \defgroup dmae_mem Memory Operations + * \ingroup dmae + * @{ + */ + +#ifdef __cplusplus +extern "C" { +#endif + +//! DMAE Memory endian swappng mode. +typedef enum +{ + //! No memory swapping. + DMAE_SWAP_NONE = 0, + //! 16 bit memory swapping. + DMAE_SWAP_16 = 1, + //! 32 bit memory swapping. + DMAE_SWAP_32 = 2, + //! 64 bit memory swapping. + DMAE_SWAP_64 = 3, +} DMAESwapMode; + +/** + * Starts a DMAE copy operation. + * + * \param dst + * Pointer to the destination buffer. + * + * \param src + * Pointer to the source buffer. + * + * \param wordCount + * Number of 32 bit words to copy. + * + * \param swap + * Memory endian swapping mode. + * + * \return + * DMAE operations queue timestamp. + */ +DMAETimeStamp +DMAECopyMem(void *dst, + const void *src, + uint32_t wordCount, + DMAESwapMode swap); + +/** + * Starts a DMAE fill operation. + * + * \param dst + * Pointer to the destination buffer. + * + * \param val + * The value to fill the destination buffer. + * + * \param wordCount + * Number of 32 bit words to fill. + * + * \return + * DMAE operations queue timestamp. + */ +DMAETimeStamp +DMAEFillMem(void *dst, + uint32_t val, + uint32_t wordCount); + +#ifdef __cplusplus +} +#endif + +/** @} */ diff --git a/include/dmae/sync.h b/include/dmae/sync.h new file mode 100644 index 00000000..50de52b2 --- /dev/null +++ b/include/dmae/sync.h @@ -0,0 +1,33 @@ +#pragma once +#include + +/** + * \defgroup dmae_sync Synchronization + * \ingroup dmae + * @{ + */ + +#ifdef __cplusplus +extern "C" { +#endif + +//! Timestamp for a DMAE operation. +typedef uint64_t DMAETimeStamp; + +/** + * Waits for a DMAE operation to complete. + * + * \param timestamp + * Timestamp of the operation to wait for. + * + * \return + * TRUE when successful. + */ +BOOL +DMAEWaitDone(DMAETimeStamp timestamp); + +#ifdef __cplusplus +} +#endif + +/** @} */ diff --git a/tests/test_compile_headers_common/test_compile_headers_list.h b/tests/test_compile_headers_common/test_compile_headers_list.h index 2ce5be0e..ef9ffcdd 100644 --- a/tests/test_compile_headers_common/test_compile_headers_list.h +++ b/tests/test_compile_headers_common/test_compile_headers_list.h @@ -42,6 +42,8 @@ #include #include #include +#include +#include #include #include #include