Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
13 years ago

Stopping SGDMA Transfer

Implementing NDIS 5.1 driver for WinXPe on triple speed ethernet product. Windows likes to reset the NIC when it loses patience with something, but there appears to be no way to stop an SGDMA rx transfer. Assuming a single descriptor, once you set RUN in the SGDMA control register, it appears the only way to stop the transfer is to use software reset, which the Altera documentation warns is a "last resort". Is there a way to stop and then restart an SGDMA rx transfer? Thanks.

3 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    I'm fairly certain there is no way to stop it while it's performing a block transfer. Also triggering a reset might be problematic if the SGDMA is in the middle of a data read/write (especially if it's in the middle of a burst). Avalon doesn't allow a master to early terminate so resetting the SGDMA in the middle of a transfer potentially can cause the fabric to enter an unknown state.

    I guess a workaround would be to insert a little widget into the streaming data path that you can use to inject EOP into the data stream to get the SGDMA to stop working on the descriptor (after you wrote to the stop register). That way you don't have to trigger a soft reset and cross your fingers there were no MM transactions in flight.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    But a receive DMA has to be started before any data is available, right? Thus the receive DMA will sit, moving no data, until a packet arrives, right? What if, while the receive DMA is sitting there doing nothing, I want to abort the transfer? It doesn't appear sufficient to simply turn off the RUN bit in the DMA control register, because according to the documentation that only affects descriptors down chain. If, for simplicity sake, I only have one descriptor, turning off RUN doesn't appear to change anything.

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Usually that is the case but it's not necessary. Receive data can be arriving before the SGDMA is started. If that happens then the data should remain buffered in the TSE or any streaming cores between the SGDMA and TSE.

    If SGDMA is sitting idle but started and you want to stop it your little widget core just pokes EOP into the data stream and asserts valid to basically stop the DMA (it'll transfer one word of garbage data and complete because end of packet arrived). Turning off the run bit (accidentally called that the stop bit earlier) will prevent the SGDMA from moving onto the next descriptor but it doesn't stop the work on the current descriptor (unfortunately). So that's what my suggestion of the widget works around, the ability to poke a garbage beat of data that terminates the packet early.

    I would also look around the TSE documentation, perhaps there is a control register you can write to that will do the same sort of thing I'm suggesting with the widget core.