]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - processor-sdk/performance-audio-sr.git/blobdiff - pasdk/test_dsp/framework/audioStreamInpProcNewIO.c
PASDK-577:Clear already posted Input events on Input re-select
[processor-sdk/performance-audio-sr.git] / pasdk / test_dsp / framework / audioStreamInpProcNewIO.c
index 61518a499f85d0e00e1da6e970f70e6149913858..84d525c83631c5869794344ccac9edb3121db9df 100644 (file)
@@ -1119,7 +1119,9 @@ void asitPhyTransferStart(PAF_AST_IoInp *pInpIo)
     }
 }
 
+// Indicates whether Input has been selected
 Int d10Initialized = 0;
+
 //extern Aud_STATUS mcaspAudioConfig(void);
 //extern void McaspDevice_init(void);
 
@@ -1140,6 +1142,7 @@ Int asitSelectDevices(
     Int zMD;
     Int interface;
     const PAF_SIO_Params *pD10Params;
+    UInt postedEvents;
 
     zMD = pAstCfg->masterDec;
     
@@ -1176,6 +1179,14 @@ Int asitSelectDevices(
                 return ASIP_ERR_MCASP_CFG;
             }
             
+            // Clear (drop) already posted Input data events
+            postedEvents = Event_getPostedEvents(gAsitEvtHandle);
+            while ((postedEvents & ASIT_EVTMSK_INPDATA) != 0)
+            {
+                Event_pend(gAsitEvtHandle, ASIT_EVTMSK_NONE, ASIT_EVTMSK_INPDATA, 0);
+                postedEvents = Event_getPostedEvents(gAsitEvtHandle);
+            }
+
             pInp->hMcaspChan = NULL;        // reset active McASP LLD handle
             if (pInp->pRxParams != NULL)    // sanity check, pInp->pRxParams should be non NULL if pInp->hMcaspChan is non NULL
             {