AnsweredAssumed Answered

BF525 Sport Driver Flush DMA (Renable Dataflow)

Question asked by dmann on Jan 6, 2012
Latest reply on Feb 8, 2012 by mmurali

I am using the SPORT TX to deliver decoded mp3 audio data to a DAC. From my GUI i need to be able to pause and resume playback to the DAC. I am using the SSL Sport Driver with a circular outbound buffer. All things are working as expected, but I suspect that there the DMA channel that is being used for the sport TX is not be properly flushed. I disable the data flow, but don't know how to access the commands to flush the appropriate DMA channel. Within the sport driver I have the following potentially useful commands:

adi_dev_Control(Mp3DriverHandle,ADI_DEV_CMD_GET_OUTBOUND_DMA_PMAP_ID,&pmap_id);
adi_dev_Control(Mp3DriverHandle,ADI_DEV_CMD_GET_OUTBOUND_DMA_CHANNEL_ID,&channel_id);

 

From this, i've determined that the channel id is 4;

 

 

but don't know how get the relevant information to tell the dma system service to flush particular buffers. I read a post:

http://ez.analog.com/message/30073#30073

that said you can just resubmit a circular buffer and it will get cleared, but that doesn't seem to be the case. I still have junk in the buffers which causes misaligned data to the DAC. I've even tried to manually clear the DMA channel using:

*pDMA4_CURR_ADDR = *pDMA0_START_ADDR;
*pDMA4_X_COUNT = 0;
*pDMA4_Y_COUNT = 0;

 

which didn't work. Can someone offer some advice on how to clear the SPORT TX DMA (either through SSL or manually)?

 

//Here's some of my setup code

 

 

static ADI_DEV_DEVICE_HANDLE      Mp3DriverHandle;
static     ADI_DEV_CIRCULAR_BUFFER OutboundPlaybackBuffer;
ADI_DEV_CMD_VALUE_PAIR SPORTTXConfigurationTable [] = {
        { ADI_DEV_CMD_SET_DATAFLOW_METHOD,         (void *)ADI_DEV_MODE_CIRCULAR            },
        { ADI_SPORT_CMD_SET_TX_CLOCK_SOURCE,    (void *)0                                },
        { ADI_SPORT_CMD_SET_TX_FS_SOURCE    ,    (void *)0                                },
        { ADI_SPORT_CMD_SET_TX_WORD_LENGTH,        (void *)15                                },
        { ADI_SPORT_CMD_SET_TX_FS_REQUIREMENT,    (void *)1                                },        
        { ADI_SPORT_CMD_SET_TX_STEREO_FS_ENABLE,(void *)true                            },        
        { ADI_SPORT_CMD_SET_TX_BIT_ORDER    ,    (void *)0                                },
        { ADI_SPORT_CMD_SET_TX_FS_POLARITY    ,    (void *)1                                },
        { ADI_SPORT_CMD_SET_TX_FS_TIMING    ,    (void *)1                                },
        { ADI_SPORT_CMD_SET_TX_EDGE_SELECT    ,     (void *)0                                },
        { ADI_DEV_CMD_END,                        NULL                                    },
    };  

void mp3DriverInit(void)
{
         // init circ buffer        OutboundPlaybackBuffer.Data = mp3PlaybackData;
        OutboundPlaybackBuffer.ElementWidth = 2;
        OutboundPlaybackBuffer.SubBufferCount = PLAYBACK_SUB_BUFFERS;
        OutboundPlaybackBuffer.SubBufferElementCount = PLAYBACK_SUB_BUFFER_SIZE;
        OutboundPlaybackBuffer.CallbackType = ADI_DEV_CIRC_SUB_BUFFER;

     adi_dev_Open(adi_dev_ManagerHandle,  &ADISPORTEntryPoint, 0, NULL, &Mp3DriverHandle,  ADI_DEV_DIRECTION_OUTBOUND,                                                       adi_dma_ManagerHandle, adi_dcb_QueueHandle,  mp3PlaybackCallback);
     adi_dev_Control(Mp3DriverHandle, ADI_DEV_CMD_TABLE, SPORTTXConfigurationTable);
     adi_dev_Write(Mp3DriverHandle, ADI_DEV_CIRC, (ADI_DEV_BUFFER*)&OutboundPlaybackBuffer);
}
void mp3DriverPause(void)
{
    adi_dev_Control(Mp3DriverHandle,ADI_DEV_CMD_SET_DATAFLOW,(void *)FALSE);
    *pDMA4_CURR_ADDR = *pDMA0_START_ADDR;
    *pDMA4_X_COUNT = 0;
    *pDMA4_Y_COUNT = 0;
    adi_dev_Write(Mp3DriverHandle, ADI_DEV_CIRC, (ADI_DEV_BUFFER*)&OutboundPlaybackBuffer);    
}
void mp3DriverResume(void)
{
     adi_dev_Control(Mp3DriverHandle,ADI_DEV_CMD_SET_DATAFLOW,(void *)FALSE);
}

Outcomes