// DMA ( Direct Memory Access ) implementation requires 4k aligned buffers in the memory.
// we allocate both buffers.
dma_buffer_in = (char *)_aligned_malloc(_MEMORY_SIZE, 4096);
dma_buffer_out = (char *)_aligned_malloc(_MEMORY_SIZE, 4096);
// We initialize the buffer with 0
memset(dma_buffer_out, 0x00, _MEMORY_SIZE);
....
....
// Send the data to the hardware using direct memory address operations
api_status = _4FM_SendData(&dev_ctx, dma_buffer_out, _MEMORY_SIZE);
if(api_status!=_4FM_OK) {
printf("Could not send random data to the hardware device...\n");
exit_handler(dma_buffer_in, dma_buffer_out, &dev_ctx);
}
// Receive the data from the hardware using direct memory address operations
api_status = _4FM_ReceiveData(&dev_ctx, dma_buffer_in, _MEMORY_SIZE);
if(api_status!=_4FM_OK) {
printf("Could not receive random data from the hardware device...\n");
exit_handler(dma_buffer_in, dma_buffer_out, &dev_ctx);
}