Hi, here's the code segment I'm using dma cnnected to an hardware peripheral 32 bit wide:
//call back function
void dma_txdone (void* handle,void *data)
{
dma_txcomplete = 1;
}# define TXFRAME_LENGTH 1024// dma_32_bit_tx_a has 15 bit address //counter
int main(){
alt_dma_txchan tx;
....
if ((tx = alt_dma_txchan_open ("/dev/dma_32bit_tx_a")) == NULL)
{
printf ("Error: failed to open device DMA_1\n");
exit (1);
}
alt_dma_txchan_reg (tx);
alt_dma_txchan_ioctl(tx,ALT_DMA_TX_ONLY_ON,0);
alt_dma_txchan_ioctl(tx,ALT_DMA_SET_MODE_32,0);
if (alt_dma_txchan_send (tx,(constvoid*)buffer_tx,TXFRAME_LENGTH,dma_txdone,NULL) < 0)
{
printf ("\n\rError: failed to post transmit request\n");
sprintf(message,"Err: tx failed");
lcd_sprint_line(message,4,SOPC_GRAPHIC_LCD_A_BASE);
exit (1);
}
....
}
and the program exits here printing"\n\rError: failed to post transmit request\n"
I would like to have much control on this failure, wich could be the causes that make alt_dma_txchan_send fail? FOr sure I know that the lenght transfer you can ask for is limited by the hardware, i mean the dma counter width. I this case I'm asking for a transfer much shorter than the dma capabillities(15 bit counter) but anything changes with other values.
Thanks a lot for your help.
Massi