Visible to Intel only — GUID: mwh1416946785447
Ixiasoft
Visible to Intel only — GUID: mwh1416946785447
Ixiasoft
6.11.1. DMA Transmit Channels
Example 6–12. 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.
For more information, refer to the HAL API Reference section.