FPGA Intellectual Property
PCI Express*, Networking and Connectivity, Memory Interfaces, DSP IP, and Video IP
Announcements
Intel Support hours are Monday-Fridays, 8am-5pm PST, except Holidays. Thanks to our community members who provide support during our down time or before we get to your questions. We appreciate you!

Need Forum Guidance? Click here
Search our FPGA Knowledge Articles here.

SGDMA HAL driver

Altera_Forum
Honored Contributor II
849 Views

Hi, 

 

I am not sure if this is strictly IP related, sorry if posting at wrong forum. 

 

The altera_avalon_sgdma.c HAL driver has function: 

alt_avalon_sgdma_check_descriptor_status 

which should check if hw is ready on processing dma descriptor. 

 

The problem I see in the code is that desc->status is checked before owned_by_hw flag is checked. 

If the HAL driver checks the status while DMA is still running, the status is zero, and if the DMA finishes the descriptor before SW control reaches checking owned_by_hw flag, then the function would return a value not based on the status after the DMA is ready (it would miss an error). 

 

Do I interpret the sequence correctly? 

Should the owned_by_hw be checked before status? 

 

BR, -Topi 

 

*********** 

 

int alt_avalon_sgdma_check_descriptor_status(alt_sgdma_descriptor *desc) 

/* Errors take precedence */ 

if( IORD_8DIRECT(&desc->status, 0) & 

( ALTERA_AVALON_SGDMA_DESCRIPTOR_STATUS_E_CRC_MSK | 

ALTERA_AVALON_SGDMA_DESCRIPTOR_STATUS_E_PARITY_MSK | 

ALTERA_AVALON_SGDMA_DESCRIPTOR_STATUS_E_OVERFLOW_MSK | 

ALTERA_AVALON_SGDMA_DESCRIPTOR_STATUS_E_SYNC_MSK | 

ALTERA_AVALON_SGDMA_DESCRIPTOR_STATUS_E_UEOP_MSK | 

ALTERA_AVALON_SGDMA_DESCRIPTOR_STATUS_E_MEOP_MSK | 

ALTERA_AVALON_SGDMA_DESCRIPTOR_STATUS_E_MSOP_MSK ) ) { 

return -EIO; 

 

if( IORD_8DIRECT(&desc->control, 0) & 

ALTERA_AVALON_SGDMA_DESCRIPTOR_CONTROL_OWNED_BY_HW_MSK) { 

return -EINPROGRESS; 

 

return 0; 

}
0 Kudos
0 Replies
Reply