- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm using alt_dma_txchan_send () to send data over a DMA channel, unfortunately it fails. I didn't find any error code explanation for this function. The only thing I know is that when it fails a negative number is returned. Please can anyone help me to understand this call failure?
Thanks a lot. Regards, MassiLink Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Can you post your code so that we can see how you are using the driver. As a heads up when you pass flags into the transmit/receive calls only send one flag at a time. For example if you try to enable stop of length and set the transfer width at the same time only one flag will stick. Instead you need to call the function twice sending each flag in individually.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
--- Quote Start --- alt_dma_txchan_ioctl(tx,ALT_DMA_TX_ONLY_ON,0); --- Quote End --- Is the '0' correct? That's your tx address...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yes, it is, I forgot to put a Macro to make the code readable. That's the address for the input/output port. Anyway thatks to pointed out this, I will correct the code.
In the meanwhile I regenerate the system library, built a new application and a new system, now the same code works fine. :confused:- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page