dmae: Add DMAECopyMem, DMAEFillMem and DMAEWaitDone (#102)

* dmae: Add DMAECopyMem, DMAEFillMem and DMAEWaitDone

* tests: Add dmae to header compile test list
This commit is contained in:
rw-r-r-0644 2019-02-28 07:10:10 +01:00 committed by Ash
parent 6ea6625b78
commit 34bfddb581
4 changed files with 115 additions and 0 deletions

4
include/dmae/dmae.dox Normal file
View File

@ -0,0 +1,4 @@
/**
* \defgroup dmae dmae
* DMA Engine.
*/

76
include/dmae/mem.h Normal file
View File

@ -0,0 +1,76 @@
#pragma once
#include <wut.h>
#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
/** @} */

33
include/dmae/sync.h Normal file
View File

@ -0,0 +1,33 @@
#pragma once
#include <wut.h>
/**
* \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
/** @} */

View File

@ -42,6 +42,8 @@
#include <coreinit/threadqueue.h>
#include <coreinit/time.h>
#include <coreinit/title.h>
#include <dmae/mem.h>
#include <dmae/sync.h>
#include <gx2/clear.h>
#include <gx2/context.h>
#include <gx2/debug.h>