]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - processor-sdk/performance-audio-sr.git/blobdiff - pasdk/test_dsp/framework/audioStreamOutIo.c
PASDK-577:Clear already posted Output events on Output re-select
[processor-sdk/performance-audio-sr.git] / pasdk / test_dsp / framework / audioStreamOutIo.c
index 9562fed315c93cb63067ceb924c3a1dca2053584..ccf3fd84f0fc93d67619094f1a090169c09251e3 100644 (file)
@@ -73,6 +73,7 @@ Int asopSelectDevices(
     mcaspLLDconfig *pReqLldCfg;
     Ptr mcaspChanHandle;
     Aud_STATUS status;
+    UInt postedEvents;    
 
     if ((pOut->hIoBuff == NULL) || (pOut->hIoPhy == NULL) || (!d10Initialized)) 
     {
@@ -82,7 +83,6 @@ Int asopSelectDevices(
     // Deactivate currently active Output device
     if (pOut->hMcaspChan != NULL)
     {
-        
         // check McASP LLD control API
         mcaspControlChan(pOut->hMcaspChan, MCASP_CHAN_RESET, NULL);
         // Delete McASP LLD channel
@@ -93,6 +93,14 @@ Int asopSelectDevices(
             return ASOP_IO_ERR_MCASP_CFG;
         }
         
+        // Clear (drop) already posted Output data events
+        postedEvents = Event_getPostedEvents(gAsotEvtHandle);
+        while ((postedEvents & Evt_Id_AsotTxMcaspEdma) != 0)
+        {
+            Event_pend(gAsotEvtHandle, Event_Id_NONE, Evt_Id_AsotTxMcaspEdma, 0);
+            postedEvents = Event_getPostedEvents(gAsotEvtHandle);
+        }        
+        
         pOut->hMcaspChan = NULL;            // reset active McASP LLD handle
         pOut->pLldCfg->hMcaspChan = NULL;   // reset McASP LLD handle for active McASP LLD configuration
         pOut->pLldCfg = NULL;               // reset pointer to active McASP LLD configuration