Visible to Intel only — GUID: ijm1642636262029
Ixiasoft
Visible to Intel only — GUID: ijm1642636262029
Ixiasoft
6.9.1. DMA Transmit Channels
Obtaining a File Handle for a DMA Transmit Device dma_0
#include <stddef.h>
#include "sys/alt_dma.h"
int main(void) {
alt_dma_txchan tx;
tx = alt_dma_txchan_open("/dev/dma_0");
if (tx == NULL) {
/* Error */
} else {
/* Success */
}
return 0;
}
You can use this handle to post a transmit request using alt_dma_txchan_send(). The prototype is:
typedef void(alt_txchan_done)(void * handle);
int alt_dma_txchan_send(alt_dma_txchan dma,
const void * from,
alt_u32 length,
alt_txchan_done * done,
void * handle);
Calling alt_dma_txchan_send() posts a transmit request to channel dma. Argument length specifies the number of bytes of data to transmit, and argument from specifies the source address. The function returns before the full DMA transaction completes. The return value indicates whether the request is successfully queued. A negative return value indicates that the request failed. When the transaction completes, the user-supplied function done is called with argument handle to provide notification.
Two additional functions are provided for manipulating DMA transmit channels: alt_dma_txchan_space(), and alt_dma_txchan_ioctl(). The alt_dma_txchan_space() function returns the number of additional transmit requests that can be queued to the device. The alt_dma_txchan_ioctl()function performs device-specific manipulation of the transmit device.