- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Have anyone a good sample how works with DMA in HAL mode? I need something
like to project Streaming with irq and streaming transfer. Thank you so much for any help http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/smile.gifLink Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I've made it next:
unsigned int *p = (unsigned int*)(SDRAM_BASE + 0xF4240); void *pdma = (void*) SD_DMA_BASE; void isr_dma(void* context, alt_u32 id) { if ((IORD_ALTERA_AVALON_DMA_STATUS(SD_DMA_BASE))&&0x01) { IOWR_ALTERA_AVALON_DMA_STATUS(SD_DMA_BASE, 0); IOWR_ALTERA_AVALON_DMA_RADDRESS(SD_DMA_BASE, (int)p); IOWR_ALTERA_AVALON_DMA_WADDRESS(SD_DMA_BASE, SD_BASE); IOWR_ALTERA_AVALON_DMA_LENGTH(SD_DMA_BASE, 40); IOWR_ALTERA_AVALON_DMA_CONTROL(SD_DMA_BASE, 0x02DC); } } int main(void) { unsigned int *p = (unsigned int*)(SDRAM_BASE + 0xF4240); ............. //Write to memory something (in this case 10 words) for (i=0, pattern=0xFFAAFFAA; i<10; i++) { IOWR_32DIRECT(p+i, 0, pattern); } alt_irq_register(SD_DMA_IRQ, pdma, isr_dma); //Send to some device 10 words IOWR_ALTERA_AVALON_DMA_STATUS(SD_DMA_BASE, 0); IOWR_ALTERA_AVALON_DMA_RADDRESS(SD_DMA_BASE, (int)p); IOWR_ALTERA_AVALON_DMA_WADDRESS(SD_DMA_BASE, SD_BASE); IOWR_ALTERA_AVALON_DMA_LENGTH(SD_DMA_BASE, 40); IOWR_ALTERA_AVALON_DMA_CONTROL(SD_DMA_BASE, 0x02DC); ............... }- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Just to clarify, that's _not_ an example of the use of the DMA HAL - it's a demonstration of how to do a DMA transaction with direct register reads and writes.
By the way, instead of if ((IORD_ALTERA_AVALON_DMA_STATUS(SD_DMA_BASE)) && 0x01) you want: if ((IORD_ALTERA_AVALON_DMA_STATUS(SD_DMA_BASE)) & 0x01) even better: if ((IORD_ALTERA_AVALON_DMA_STATUS(SD_DMA_BASE))& ALTERA_AVALON_DMA_STATUS_DONE_MSK)
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