- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Problems solved- needed some code clean up...
// Modular Scatter-Gather DMA ST-to-MM with callback function # include <stdio.h> // DMA transfer# include <altera_msgdma_descriptor_regs.h># include <altera_msgdma_csr_regs.h># include <altera_msgdma.h> // Parallel I/O# include <altera_avalon_pio_regs.h># include <sys/alt_irq.h> # define DMA_LEN_BYTES 1600000 // Size of each DMA transfer in bytes# define BUFFER_A 0x40000000 // SDRAM Buffer A address // Modular Scatter-Gather DMA Globals alt_msgdma_dev *DATA_DMA_A; alt_msgdma_standard_descriptor DATA_DMA_A_desc; // DMA variables alt_u32 *DMA_write_addr_ptr_A; // Pointer for DMA A transfer write address alt_u32 DMA_write_addr_A; // DMA A transfer write address // Declare callback function void DATA_DMA_A_callback_function(void* context); void DATA_DMA_A_callback_function(void* context) { alt_msgdma_standard_descriptor_async_transfer(DATA_DMA_A, &DATA_DMA_A_desc); // Toggle PIO IOWR_ALTERA_AVALON_PIO_DATA(NIOS_DATA1_READY_BASE, 1); IOWR_ALTERA_AVALON_PIO_DATA(NIOS_DATA1_READY_BASE, 0); } int main() { // Open the streaming modular scatter-gather DMA controllers DATA_DMA_A = alt_msgdma_open("/dev/data1_msgdma_csr"); if(DATA_DMA_A == NULL) printf("Could not open the mSG-DMA1\n"); // Configure DMA callback functions alt_msgdma_register_callback(DATA_DMA_A, DATA_DMA_A_callback_function, 0, NULL); // Configure the DMA write address DMA_write_addr_A = (alt_u32) BUFFER_A ; DMA_write_addr_ptr_A = (alt_u32*)(DMA_write_addr_A); dma_len_bytes = (alt_u32) DMA_LEN_BYTES; // Construct the DMA descriptors alt_msgdma_construct_standard_st_to_mm_descriptor ( DATA_DMA_A, &DATA_DMA_A_desc, DMA_write_addr_ptr_A, dma_len_bytes, ALTERA_MSGDMA_DESCRIPTOR_CONTROL_TRANSFER_COMPLETE_IRQ_MASK ); // Start DMA transfers alt_msgdma_standard_descriptor_async_transfer(DATA_DMA_A, &DATA_DMA_A_desc); return 0; }Link Copied
0 Replies
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page