SAMV71 XDMAC - multiple peripheral devices

1 post / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm currently using the XDMAC functionality for transferring data to memory from a device connected on SPI0 (channels 0 and 1 on XDMA)

This is working fine but I now need to add a second device on SPI1 (channels 2 and 3)

 

The SPI external device uses an interrupt (on a GPIO pin) to determine when to start the DMA configurations/transfers

The interrupt to the SAMV71 will then result in configuring the DMA for the data transfer and when the data block is transferred the XDMAC_Handler interrupt gets called.

 

If I add a second device can I use the single XDMAC_Handler to check which channel has interrupted and process accordingly? 

 

e.g.

 

dma_status = xdmac_channel_get_interrupt_status(XDMAC, XDMAC_RX_CH1);  // SPI0 received data
    
    if(dma_status & XDMAC_CIS_BIS) {......}

 

and 

 

dma_status = xdmac_channel_get_interrupt_status(XDMAC, XDMAC_RX_CH2); // SPI1 received data
    
    if(dma_status & XDMAC_CIS_BIS) {......}

 

 

Should this type of scheme work OK?  i.e. one handler processing the two SPI devices - do I need to be aware of any issues with handling separate devices in the XDMAC_Handler()?

 

thanks