Forum Discussion
Altera_Forum
Honored Contributor
22 years agoNIOS II DMA HAL
Anybody use the DMA HAL driver? I need correct example for stream device and memory. I want receive from steram device through DMA(using HAL) and save stream data to memory. I have written ...
Altera_Forum
Honored Contributor
22 years ago<div class='quotetop'>QUOTE </div>
--- Quote Start --- However I do notice that in your test code you use a transfer size of DMA_BUFF_SIZE*2 and in your HAL example you use a size of 1024.[/b] --- Quote End --- Excuse me. In my case it is bad style. For dirrect DMA registers acsess: For DMA_BUFF_SIZE*2:# define DMA_BUFF_SIZE (1024*1024+1) // transaction word 16-bit alt_u16 *buffer=NULL; buffer = (alt_u16 *)memalign(2, DMA_BUFF_SIZE*2); // allocate memory for DMA_BUFF_SIZE 16-bit words ............... ............... IOWR_ALTERA_AVALON_DMA_LENGTH(DMA_SPI_REC_BASE, DMA_BUFF_SIZE*2); For HAL example:# define DMA_BUFF_BYTESIZE 1024 alt_u16 buffer[DMA_BUFF_BYTESIZE]; alt_dma_rxchan_prepare (rx, &buffer[0], 1024, NULL, NULL); Memory overwritenn cann't occur, becouse: 1. In prepare call I request less bytes then allocated for buffer. 2. DMA HAL passed to infinite ISR cycle before call of function Send2Sharc(0xA5); This function initiate the transfer process.