Altera_Forum
Honored Contributor
16 years agomemory-to-memory sgdma problem
Hello,
I am testing the sgdma core by copy data from one on-chip-memory buffer to the other. However, I met a confusing problem that the actual_transfered_bytes is always zero. Can anybody help? the sopc-builder system i used is as follows: cpu -----instruction_master -----data_master on-chip memory -----s1 sgdma_0 -----csr -----descriptor_read -----descriptor_write -----m_read -----m_write descriptor_read, descriptor_read, m_read and m_write are connected to s1 of on-chip memory. csr is connected to data_master of cpu. the c code is as follows: alt_u32 tx_buf[10], rx_buf[10]; alt_sgdma_descriptor desc, next; int main() { alt_u32 i; alt_sgdma_dev *sgdma_m2m; alt_u8 status; for(i=0;i<10;i++){ tx_buf = i+0x11111111;rx_buf = 0; } sgdma_m2m = alt_avalon_sgdma_open ("/dev/sgdma_0"); /* This will create a descriptor that is capable of transmitting data from an Avalon-MM buffer * to a packet enabled Avalon-ST FIFO component */ alt_avalon_sgdma_construct_mem_to_mem_desc( &desc, // descriptor &next, // next descriptor tx_buf, // read buffer location rx_buf, // write buffer location (alt_u16) 10, // length of the buffer 0, // reads are not from a fixed location 0); // writes are not from a fixed location /* Prime the SGDMA engines with the descriptor lists (first one, it's a linked list) */ status = alt_avalon_sgdma_do_sync_transfer(sgdma_m2m, &desc); return 0; } After alt_avalon_sgdma_do_sync_transfer() is called, status is 0x0C which is as supposed, but desc.actual_transfered_bytes is zero! The values in rx_buf[] remains the original values, all zeros. Any comments will be appreciated.