Nios® V Processor Software Developer Handbook

ID 743810
Date 10/12/2024
Public
Document Table of Contents

8.7.5.2. DMA Receive Channel

alt_dma_rxchan Structure

typedef struct alt_dma_txchan_dev_s alt_dma_txchan_dev;
struct alt_dma_txchan_dev_s {
  alt_llist llist;
  const char * name;
  int( * space)(alt_dma_txchan dma);
  int( * send)(alt_dma_txchan dma,
    const void * from,
      alt_u32 len,
      alt_txchan_done * done,
      void * handle);
  int( * ioctl)(alt_dma_txchan dma, int req, void * arg);
};

The prepare() function must be defined. If the ioctl field is set to null, calls to alt_dma_rxchan_ioctl() return -ENOTTY for this device.

After creating an instance of the alt_dma_rxchan structure, you must register the device driver with the HAL system to make it available by calling the following function:

int alt_dma_rxchan_reg (alt_dma_rxchan_dev* dev)

The input argument dev is the device to register. The return value is zero on success, or negative if the device cannot be registered.

Table 34.  Fields in the alt_dma_rxchan Structure
Field Function
llist This function is for internal use and must always be set to the value ALT_LLIST_ENTRY.
name The name that refers to this channel in calls to alt_dma_rxchan_open(). name is the name of the device as defined in system.h.
depth The total number of receive requests that can be outstanding at any given time.
prepare A pointer to a function that is called as a result of a call to the application API function alt_dma_rxchan_prepare(). This function posts a receive request to the DMA device. The parameters passed to alt_dma_rxchan_prepare() are passed directly to prepare(). For a description of parameters and return values, refer to the HAL API Reference" section.
ioctl This is a function that provides device specific I/O control. Refer to sys/alt_dma_dev.h for a list of the generic options that a device might wish to support.