DMACPY

group DMACPY

Memory copy using UDMA.

This API provides support for UDMA memory copy(DMACPY). The DMACPY allows memory copy between FC L1 memory and L2 memory.

Enums

enum pi_dmacpy_dir_e

Memcpy direction.

Values:

enumerator PI_DMACPY_FC_L1_L2 = 0

Memcpy from FC_L1 to L2.

enumerator PI_DMACPY_L2_FC_L1 = 1

Memcpy from L2 to FC_L1.

enumerator PI_DMACPY_L2_L2 = 2

Memcpy from L2 to L2.

Functions

void pi_dmacpy_conf_init(struct pi_dmacpy_conf *conf)

Initialize DMA memcpy config.

This function initializes DMA memcpy configuration struct with default values.

Parameters:
  • conf – Pointer to DMA Memcpy conf struct.

int pi_dmacpy_open(struct pi_device *device)

Open a DMA Memcpy device.

This function opens a DMA Memcpy device. Once it is opened, user can do memory copy between FC memory and L2 memory.

Note

This function must be called before any use of the device.

Parameters:
  • device – Pointer to device structure.

Return values:
  • 0 – If operation is successfull.

  • ERRNO – An error code otherwise.

void pi_dmacpy_close(struct pi_device *device)

Close an opened DMA Memcpy device.

This function closes a DMA Memcpy device.

Parameters:
  • device – Pointer to device structure.

int pi_dmacpy_copy(struct pi_device *device, void *src, void *dst, uint32_t size, pi_dmacpy_dir_e dir)

Synchronous copy.

A memory copy is done from FC l1 memory or L2 memory and L2 memory, depending on memcpy direction.

Note

Both src and dst buffers must be aligned on 4 bytes.

Note

The size must be a multiple of 4 bytes.

Parameters:
  • device – Pointer to device structure.

  • src – Pointer to source buffer.

  • dst – Pointer to dest buffer.

  • size – Size of data to copy.

  • dir – Direction of memcpy.

Return values:
  • 0 – If operation is successfull.

  • ERRNO – An error code otherwise.

int pi_dmacpy_copy_async(struct pi_device *device, void *src, void *dst, uint32_t size, pi_dmacpy_dir_e dir, struct pi_evt *task)

Asynchronous copy.

A memory copy is done from FC l1 memory or L2 memory and L2 memory, depending on memcpy direction.

Note

Both src and dst buffers must be aligned on 4 bytes.

Note

The size must be a multiple of 4 bytes.

Parameters:
  • device – Pointer to device structure.

  • src – Pointer to source buffer.

  • dst – Pointer to dest buffer.

  • size – Size of data to copy.

  • dir – Direction of memcpy.

  • task – Event task used to notify end of copy.

Return values:
  • 0 – If operation is successfull.

  • ERRNO – An error code otherwise.

struct pi_dmacpy_conf
#include <dmacpy.h>

DMA Memcpy configuration options.

Public Members

uint8_t id

DMA memcpy device ID.