Forum Discussion
Altera_Forum
Honored Contributor
11 years agoI've attached the Nios code I was using.
In your main c file,# include "ScatterGatherController.h", then declare a global variable as: PSGC_CONTROLREGS const dma_csr_base = (PSGC_CONTROLREGS)(<Base address of the CSR, e.g. from system.h>) PSGC_DESCRIPTOR_FORMAT const dma_descriptor_base = (PSGC_DESCRIPTOR_FORMAT)(<Base address of the descriptors, e.g. from system.h>) You can then pass those pointers to the functions in the .h/.c files as the 'base' variable. You'll need to initialise the controller. This can be done using sgc_initialiser(), sgc_enabler(), and sgc_enableDispatcher(). See the .h file for the function declarations. If you want to send a descriptor, you can create the following: SGC_DESCRIPTOR_FORMAT descriptor; descriptor.write_address = ...; descriptor.read_address = ...; descriptor.transfer_length = ...; descriptor.control.bits.<some field, see .h> = ...; sgc_issue_descriptor(dma_descriptor_base, &descriptor) Hope the SGDMA controller proves more reliable for you than it did for me.