Merge pull request #1 in PASDK/pasdk_sr from PASDK-318-input-task-code-repetition...
authorFrank Livingston <a0322553@ti.com>
Fri, 23 Jun 2017 20:25:55 +0000 (15:25 -0500)
committerFrank Livingston <a0322553@ti.com>
Fri, 23 Jun 2017 20:25:55 +0000 (15:25 -0500)
Build #50

* commit '69df39ead18ef6c601c73f5918fb772121df31c9':
  Modified messaging code after code review.
  Cleaned up code repetitions of messaging and shared memory read/write.

1  2 
pasdk/test_dsp/framework/audioStreamInpProc.c
pasdk/test_dsp/framework/audioStreamInpProc.h

index af3fa9ed4df3c525f3423cfddc27305e43bb2362,4b783ce11a840f6ce0166eb25434a6b8f990c5fe..a15feb73041832158099bf58b4169bbef0e49105
@@@ -369,9 -369,8 +369,8 @@@ Void taskAsipFxn
      // Messaging
      ASP_Msg *pAspMsg;              
      Int status;
- #ifdef NON_CACHE_STATUS
      Int8 tempVar8;
- #endif
+     char asipMsgBuf[ASP_MSG_BUF_LEN];
  
      Log_info0("Enter taskAsipFxn()");
  
          // so set to unknown and skip any remaining processing
          if (!pAstCfg->xInp[zMI].hRxSio)
          {
- #ifdef NON_CACHE_STATUS
-             tempVar8 = PAF_SOURCE_UNKNOWN;
-             statusOp_write(&(pAstCfg->xDec[zMD].decodeStatus.sourceProgram),
-                            &tempVar8,
-                            sizeof(tempVar8),
-                            GATEMP_INDEX_DEC);
- #else
-             pAstCfg->xDec[zMD].decodeStatus.sourceProgram = PAF_SOURCE_UNKNOWN;
- #endif
+             sharedMemWriteInt8(&(pAstCfg->xDec[zMD].decodeStatus.sourceProgram), 
+                                (Int8)PAF_SOURCE_UNKNOWN, GATEMP_INDEX_DEC);
              TRACE_VERBOSE1("TaskAsip: AS%d: No input selected...", as+zMS);
              continue;
          }
              TRACE_VERBOSE1("TaskAsip: continue as updateInputStatus returns 0x%x", errno);
              continue;
          }
-         
- #ifdef NON_CACHE_STATUS
-         statusOp_read(&tempVar8,
-                       &(pAstCfg->xDec[zMD].decodeStatus.mode),
-                       sizeof(tempVar8),
-                       GATEMP_INDEX_DEC);
          // If master decoder is not enabled, or the input is unlocked, then do nothing
+         tempVar8 = sharedMemReadInt8(&(pAstCfg->xDec[zMD].decodeStatus.mode), 
+                                      GATEMP_INDEX_DEC);
          if (!tempVar8 || !pAstCfg->xInp[zMI].inpBufStatus.lock)
          {
              TRACE_VERBOSE0("TaskAsip: Not locked, continue");
              continue;
          }
- #else
-         // If master decoder is not enabled, or the input is unlocked, then do nothing
-         if (!pAstCfg->xDec[zMD].decodeStatus.mode || !pAstCfg->xInp[zMI].inpBufStatus.lock)
-         {
-             TRACE_VERBOSE0("TaskAsip: Not locked, continue");
-             continue;
-         }
- #endif
          
- #ifdef NON_CACHE_STATUS
-         statusOp_read(&tempVar8,
-                       &(pAstCfg->xDec[zMD].decodeStatus.sourceSelect),
-                       sizeof(tempVar8),
-                       GATEMP_INDEX_DEC);
          // If no source selected then do nothing
+         tempVar8 = sharedMemReadInt8(&(pAstCfg->xDec[zMD].decodeStatus.sourceSelect), 
+                                      GATEMP_INDEX_DEC);
          if (tempVar8 == PAF_SOURCE_NONE)
          {
-             tempVar8 = PAF_SOURCE_NONE;
-             statusOp_write(&(pAstCfg->xDec[zMD].decodeStatus.sourceProgram),
-                            &tempVar8,
-                            sizeof(tempVar8),
-                            GATEMP_INDEX_DEC);
-             TRACE_VERBOSE1("TaskAsip: AS%d: no source selected, continue", as+zMS);
-             continue;
-         }
- #else
-         // If no source selected then do nothing
-         if (pAstCfg->xDec[zMD].decodeStatus.sourceSelect == PAF_SOURCE_NONE) 
-         {
-             pAstCfg->xDec[zMD].decodeStatus.sourceProgram = PAF_SOURCE_NONE;
+             sharedMemWriteInt8(&(pAstCfg->xDec[zMD].decodeStatus.sourceProgram), 
+                                (Int8)PAF_SOURCE_NONE, GATEMP_INDEX_DEC);
              TRACE_VERBOSE1("TaskAsip: AS%d: no source selected, continue", as+zMS);
              continue;
          }
- #endif
  
- #ifdef NON_CACHE_STATUS
-         statusOp_read(&tempVar8,
-                       &(pAstCfg->xDec[zMD].decodeStatus.sourceSelect),
-                       sizeof(tempVar8),
-                       GATEMP_INDEX_DEC);
          // If we want pass processing then proceed directly
+         tempVar8 = sharedMemReadInt8(&(pAstCfg->xDec[zMD].decodeStatus.sourceSelect), 
+                                      GATEMP_INDEX_DEC);
          if (tempVar8 == PAF_SOURCE_PASS)
          {
              TRACE_VERBOSE1("TaskAsip: AS%d: Pass processing ...", as+zMS);
+             sharedMemWriteInt8(&(pAstCfg->xDec[zMD].decodeStatus.sourceProgram), 
+                                (Int8)PAF_SOURCE_PASS, GATEMP_INDEX_DEC);
  
-             tempVar8 = PAF_SOURCE_PASS;
-             statusOp_write(&(pAstCfg->xDec[zMD].decodeStatus.sourceProgram),
-                            &tempVar8,
-                            sizeof(tempVar8),
-                            GATEMP_INDEX_DEC);
- #else
-         // If we want pass processing then proceed directly
-         if (pAstCfg->xDec[zMD].decodeStatus.sourceSelect == PAF_SOURCE_PASS) 
-         {
-             TRACE_VERBOSE1("TaskAsip: AS%d: Pass processing ...", as+zMS);
-             pAstCfg->xDec[zMD].decodeStatus.sourceProgram = PAF_SOURCE_PASS;
- #endif
              pP->fxns->sourceDecode(pP, pQ, pAsitCfg, PAF_SOURCE_PASS);
              if (pP->fxns->passProcessing)
              {
              continue;
          }
  
- #ifdef NON_CACHE_STATUS
-         statusOp_read(&tempVar8,
-                       &(pAstCfg->xDec[zMD].decodeStatus.sourceSelect),
-                       sizeof(tempVar8),
-                       GATEMP_INDEX_DEC);
          // .....................................................................
          // At this point we have an enabled input and want to decode something.
          // If no decoder selected then do nothing. Need to reset the sourceProgram, since
          // when no decoder is selected there are no calls to IB
          //if (errno = pP->fxns->autoProcessing(pP, pQ, pC, pC->xDec[zMD].decodeStatus.sourceSelect, pC->xDec[zMD].decAlg[PAF_SOURCE_PCM]))
-         
+         tempVar8 = sharedMemReadInt8(&(pAstCfg->xDec[zMD].decodeStatus.sourceSelect), 
+                                      GATEMP_INDEX_DEC);
          pfpBegin(PFP_ID_ASIT_1, pAsitCfg->taskHandle);  // PFP begin
          gNumPfpAsit1++;
          errno = pP->fxns->autoProcessing(pP, pQ, pAsitCfg, tempVar8, NULL);
              TRACE_VERBOSE1("TaskAsip: autoProcessing returns 0x%x, continue", errno);
              continue;
          }
- #else
-         // .....................................................................
-         // At this point we have an enabled input and want to decode something.
-         // If no decoder selected then do nothing. Need to reset the sourceProgram, since
-         // when no decoder is selected there are no calls to IB
-         //if (errno = pP->fxns->autoProcessing(pP, pQ, PC, pC->xDec[zMD].decodeStatus.sourceSelect, pC->xDec[zMD].decAlg[PAF_SOURCE_PCM]))
-         if (errno = pP->fxns->autoProcessing(pP, pQ, pAsitCfg, pAstCfg->xDec[zMD].decodeStatus.sourceSelect, NULL)) // (***) FL: re-visit this, hard-coded to use PCM framelength inside function
-         {
-             TRACE_VERBOSE1("TaskAsip: autoProcessing returns 0x%x, continue", errno);
-             continue;
-         }
- #endif
          
          // query for input type
          errno = SIO_ctrl(pAstCfg->xInp[zMI].hRxSio, PAF_SIO_CONTROL_GET_SOURCEPROGRAM, (Arg )&sourceProgram);
              errno = ASPERR_AUTO_PROGRAM;
              continue;
          }
- #ifdef NON_CACHE_STATUS
-         statusOp_write(&(pAstCfg->xDec[zMD].decodeStatus.sourceProgram),
-                       &(sourceProgram),
-                       sizeof(sourceProgram),
-                       GATEMP_INDEX_DEC);
- #else
-         pAstCfg->xDec[zMD].decodeStatus.sourceProgram = sourceProgram;
- #endif
+         sharedMemWriteInt8(&(pAstCfg->xDec[zMD].decodeStatus.sourceProgram), 
+                            sourceProgram, GATEMP_INDEX_DEC);
  
          // if input is unclassifiable then do nothing
          if (sourceProgram == PAF_SOURCE_UNKNOWN)
          // input frame, we determine whether or not to call decodeProcessing and with
          // what decAlg.
          sourceSelect = PAF_SOURCE_NONE;
- #ifdef NON_CACHE_STATUS
-         statusOp_read(&tempVar8,
-                       &(pAstCfg->xDec[zMD].decodeStatus.sourceSelect),
-                       sizeof(tempVar8),
-                       GATEMP_INDEX_DEC);
+         tempVar8 = sharedMemReadInt8(&(pAstCfg->xDec[zMD].decodeStatus.sourceSelect), 
+                                      GATEMP_INDEX_DEC);
          switch (tempVar8)
          {
- #else
-         switch (pAstCfg->xDec[zMD].decodeStatus.sourceSelect) 
-         {
- #endif
              // If autodetecting, decoding everything, and input is something
              // (i.e. bitstream or PCM) then decode.
              case PAF_SOURCE_AUTO:
              // If user made specific selection then program must match select.
              // (NB: this compare relies on ordering of PAF_SOURCE)
              default:
- #ifdef NON_CACHE_STATUS
-                 sourceSelect = 0; // due to size difference
-                 statusOp_read(&sourceSelect,
-                               &(pAstCfg->xDec[zMD].decodeStatus.sourceSelect),
-                               sizeof(Int8),
-                               GATEMP_INDEX_DEC);
- #else
-                 sourceSelect = pAstCfg->xDec[zMD].decodeStatus.sourceSelect;
- #endif
+                 sourceSelect = (Int)sharedMemReadInt8(&(pAstCfg->xDec[zMD].decodeStatus.sourceSelect),
+                                                             GATEMP_INDEX_DEC);
                  if ((sourceSelect >= PAF_SOURCE_PCM) && (sourceSelect <= PAF_SOURCE_N))
                  {
                      if (sourceProgram != sourceSelect)
          Log_info0("capIbReset()");
  
          // FL: send source select message to slave
-         pAspMsg = (ASP_Msg *)MessageQ_alloc(hAspMsgMaster->heapId, hAspMsgMaster->msgSize); /* allocate message */
-         MessageQ_setReplyQueue(hAspMsgMaster->masterQue, (MessageQ_Msg)pAspMsg);            /* set the return address in the message header */
-         pAspMsg->cmd = ASP_SLAVE_DEC_SOURCE_SELECT;                                         /* fill in message payload */
-         pAspMsg->procId = hAspMsgMaster->masterProcId;
-         pAspMsg->messageId = hAspMsgMaster->messageId & ~(1<<31);
-         pAspMsg->expectResp = TRUE;
-         *(Int32 *)&pAspMsg->buf[0] = sourceSelect;
-         TRACE_MSG3("Tx ASP message: procId=%d, cmd=%d, messageId=0x%04x", pAspMsg->procId, pAspMsg->cmd, pAspMsg->messageId);
-         TRACE_MSG1("sourceSelect=%d", pAspMsg->buf[0]);
-         status = MessageQ_put(hAspMsgMaster->slaveQue, (MessageQ_Msg)pAspMsg);              /* send message */
-         if (status != MessageQ_S_SUCCESS)
-         {
-             SW_BREAKPOINT;
-         }
-         // wait for source select complete message from slave
-         //do {
-         //    status = MessageQ_get(hAspMsgMaster->masterQue, (MessageQ_Msg *)&pAspMsg, MessageQ_FOREVER);
-         //} while (status != MessageQ_S_SUCCESS);
-         status = MessageQ_get(hAspMsgMaster->masterQue, (MessageQ_Msg *)&pAspMsg, MessageQ_FOREVER);
-         if (status != MessageQ_S_SUCCESS)
-         {
-             TRACE_TERSE0("MessageQ_get() failure.");
-             SW_BREAKPOINT; // temporary
-         }
-         if ((pAspMsg->procId != hAspMsgMaster->slaveProcId) ||
-             (pAspMsg->cmd != ASP_MASTER_DEC_SOURCE_SELECT_DONE) ||
-             (pAspMsg->messageId != (hAspMsgMaster->messageId | ((UInt32)1<<31))))
-         {
-             TRACE_TERSE3("ERROR: Rx ASP message: procId=%d, cmd=%d, messageId=0x%04x", pAspMsg->procId, pAspMsg->cmd, pAspMsg->messageId);
-             SW_BREAKPOINT;
-         }
-         hAspMsgMaster->messageId = (hAspMsgMaster->messageId + 1) & ~(1<<31);
-         TRACE_MSG3("Rx ASP message: procId=%d, cmd=%d, messageId=0x%04x", pAspMsg->procId, pAspMsg->cmd, pAspMsg->messageId);
-         status = MessageQ_free((MessageQ_Msg)pAspMsg); /* free the message */
-         if (status != MessageQ_S_SUCCESS)
+         *(Int32 *)&asipMsgBuf[0] = sourceSelect;
+         if(AspMsgSend(ASP_SLAVE_DEC_SOURCE_SELECT, ASP_MASTER_DEC_SOURCE_SELECT_DONE,
+                       asipMsgBuf, NULL) != ASP_MSG_NO_ERR)
          {
+             TRACE_VERBOSE0("TaskAsip: error in sending SOURCE_SELECT message");
              SW_BREAKPOINT;
          }
          
          Task_setPri(pAsitCfg->taskHandle, Task_getPri(pAsitCfg->taskHandle)+1);
  
          // FL: send dec exit message to slave
-         pAspMsg = (ASP_Msg *)MessageQ_alloc(hAspMsgMaster->heapId, hAspMsgMaster->msgSize); /* allocate message */
-         MessageQ_setReplyQueue(hAspMsgMaster->masterQue, (MessageQ_Msg)pAspMsg);            /* set the return address in the message header */
-         pAspMsg->cmd = ASP_SLAVE_DEC_EXIT;                                                  /* fill in message payload */
-         pAspMsg->procId = hAspMsgMaster->masterProcId;
-         pAspMsg->messageId = hAspMsgMaster->messageId & ~(1<<31);
-         pAspMsg->expectResp = TRUE;
-         TRACE_MSG2("Tx ASP message: procId=%d, cmd=%d.", pAspMsg->procId, pAspMsg->cmd);
-         status = MessageQ_put(hAspMsgMaster->slaveQue, (MessageQ_Msg)pAspMsg);              /* send message */
-         if (status != MessageQ_S_SUCCESS)
-         {
-             SW_BREAKPOINT;
-         }
-         // wait for dec exit complete message from slave
-         //do {
-         //    status = MessageQ_get(hAspMsgMaster->masterQue, (MessageQ_Msg *)&pAspMsg, MessageQ_FOREVER);
-         //} while ((status < 0) || (pAspMsg->cmd != ASP_MASTER_DEC_EXIT_DONE));
-         status = MessageQ_get(hAspMsgMaster->masterQue, (MessageQ_Msg *)&pAspMsg, MessageQ_FOREVER);
-         if (status != MessageQ_S_SUCCESS)
-         {
-             TRACE_TERSE0("MessageQ_get() failure.");
-             SW_BREAKPOINT; // temporary
-         }
-         if ((pAspMsg->procId != hAspMsgMaster->slaveProcId) || 
-             (pAspMsg->cmd != ASP_MASTER_DEC_EXIT_DONE) ||
-             (pAspMsg->messageId != (hAspMsgMaster->messageId | ((UInt32)1<<31))))
+         if( AspMsgSend(ASP_SLAVE_DEC_EXIT, ASP_MASTER_DEC_EXIT_DONE, NULL, NULL)
+             != ASP_MSG_NO_ERR)
          {
-             TRACE_TERSE3("ERROR: Rx ASP message: procId=%d, cmd=%d, messageId=0x%04x", pAspMsg->procId, pAspMsg->cmd, pAspMsg->messageId);
-             SW_BREAKPOINT;
-         }
-         hAspMsgMaster->messageId = (hAspMsgMaster->messageId + 1) & ~(1<<31);
-         TRACE_MSG3("Rx ASP message: procId=%d, cmd=%d, messageId=0x%04x", pAspMsg->procId, pAspMsg->cmd, pAspMsg->messageId);
-         // free the message
-         status = MessageQ_free((MessageQ_Msg)pAspMsg); /* free the message */
-         if (status != MessageQ_S_SUCCESS)
-         {
-             SW_BREAKPOINT;
+             TRACE_VERBOSE0("TaskAsip: error in sending DEC_EXIT message");
+             SW_BREAKPOINT;                
          }
      } // End of main processing loop for (;;)
      
      Log_info0("Exit taskAsipFxn()");
@@@ -1051,6 -909,7 +909,7 @@@ PAF_ASIT_initPhaseMalloc
      Int as;                    /* Audio Stream Number (1, 2, etc.) */
      Int zMS;
      Error_Block    eb;
+       IHeap_Handle   decHeapHandle;
  
      pAstCfg = pAsitCfg->pAstCfg; // get pointer to AST common (shared) configuration
      as = pAstCfg->as;
          INPUTN * sizeof (*pAstCfg->xInp),
          HEAP_ID_INTERNAL1_SHM, (IArg)pAstCfg->xInp);
  
- #ifdef NON_CACHE_STATUS
      /* Decode memory */
-     if (!(pAstCfg->xDec = Memory_calloc((IHeap_Handle)HEAP_EXTERNAL_NONCACHED_SHM,
-         DECODEN * sizeof (*pAstCfg->xDec), 4, &eb)))
-     {
-         TRACE_TERSE1("PAF_ASIT_initPhaseMalloc: AS%d: Memory_calloc failed", as+zMS);
-         SW_BREAKPOINT;
-         return __LINE__;
-     }
- #else
-     /* Decode memory */
-     if (!(pAstCfg->xDec = Memory_calloc((IHeap_Handle)HEAP_INTERNAL1_SHM, 
+ #ifdef NON_CACHE_STATUS
+     decHeapHandle = (IHeap_Handle)HEAP_EXTERNAL_NONCACHED_SHM;
+ #else 
+     decHeapHandle = (IHeap_Handle)HEAP_INTERNAL1_SHM;
+ #endif
+     if (!(pAstCfg->xDec = Memory_calloc(decHeapHandle,
          DECODEN * sizeof (*pAstCfg->xDec), 4, &eb)))
      {
          TRACE_TERSE1("PAF_ASIT_initPhaseMalloc: AS%d: Memory_calloc failed", as+zMS);
          SW_BREAKPOINT;
          return __LINE__;
      }
- #endif
      TRACE_TERSE3("PAF_ASIT_initPhaseMalloc. (pAstCfg->xDec) %d bytes from space %d at 0x%x.",
          DECODEN * sizeof (*pAstCfg->xDec),
          HEAP_ID_INTERNAL1_SHM, (IArg)pAstCfg->xDec);
@@@ -1588,51 -1442,13 +1442,51 @@@ PAF_ASIT_initPhaseDecOpCircBuf
              SW_BREAKPOINT;
          }
          pCb->pcmBufEnd = pCb->pcmBuf + ASP_DECOP_CB_PCM_BUF_SZ;
 -        // allocate Metadata buffers //QIN
 +        // allocate Metadata buffers
          if (!(pCb->metaBuf = Memory_calloc((IHeap_Handle)HEAP_EXTERNAL_SHM, ASP_DECOP_CB_MAX_NUM_AF * PAF_MAX_PRIVATE_MD_SZ * PAF_MAX_NUM_PRIVATE_MD * sizeof(Int8), 4, &eb)))
          {
              TRACE_TERSE1("PAF_ASIT_initPhaseDecOpCircBuf: AS%d: Memory_calloc failed", as+zMS);
              SW_BREAKPOINT;
          }
          pCb->metaBufEnd = pCb->metaBuf + (ASP_DECOP_CB_MAX_NUM_AF * PAF_MAX_PRIVATE_MD_SZ * PAF_MAX_NUM_PRIVATE_MD);
 +
 +        #ifdef CB_RW_OP_CAP_PP // debug
 +        // allocate debug buffer
 +        if (!(pCb->cb_samples_op = Memory_calloc((IHeap_Handle)HEAP_EXTERNAL_NONCACHED_SHM, CB_OP_COUNT_MAX * sizeof(UInt32), 4, &eb)))
 +        {
 +            TRACE_TERSE1("PAF_ASIT_initPhaseDecOpCircBuf: AS%d: Memory_calloc failed", as+zMS);
 +            SW_BREAKPOINT;
 +        }
 +
 +        // allocate debug buffer
 +        if (!(pCb->cb_op_owner = Memory_calloc((IHeap_Handle)HEAP_EXTERNAL_NONCACHED_SHM, CB_OP_COUNT_MAX * sizeof(UInt8), 4, &eb)))
 +        {
 +            TRACE_TERSE1("PAF_ASIT_initPhaseDecOpCircBuf: AS%d: Memory_calloc failed", as+zMS);
 +            SW_BREAKPOINT;
 +        }
 +
 +        // allocate debug buffer
 +        if (!(pCb->cb_afRdIdx = Memory_calloc((IHeap_Handle)HEAP_EXTERNAL_NONCACHED_SHM, CB_OP_COUNT_MAX * sizeof(UInt8), 4, &eb)))
 +        {
 +            TRACE_TERSE1("PAF_ASIT_initPhaseDecOpCircBuf: AS%d: Memory_calloc failed", as+zMS);
 +            SW_BREAKPOINT;
 +        }
 +
 +        // allocate debug buffer
 +        if (!(pCb->cb_afWrtIdx = Memory_calloc((IHeap_Handle)HEAP_EXTERNAL_NONCACHED_SHM, CB_OP_COUNT_MAX * sizeof(UInt8), 4, &eb)))
 +        {
 +            TRACE_TERSE1("PAF_ASIT_initPhaseDecOpCircBuf: AS%d: Memory_calloc failed", as+zMS);
 +            SW_BREAKPOINT;
 +        }
 +
 +        // allocate debug buffer
 +        if (!(pCb->cb_numAfCb = Memory_calloc((IHeap_Handle)HEAP_EXTERNAL_NONCACHED_SHM, CB_OP_COUNT_MAX * sizeof(UInt8), 4, &eb)))
 +        {
 +            TRACE_TERSE1("PAF_ASIT_initPhaseDecOpCircBuf: AS%d: Memory_calloc failed", as+zMS);
 +            SW_BREAKPOINT;
 +        }
 +        #endif
 +
          // (***) FL: revisit, here PCM is hard-coded for 256 sample dec op frame length        
          // Initialize decoder output circular buffer for PCM
          errno = cbInit(pCb);
@@@ -1993,7 -1809,7 +1847,7 @@@ PAF_ASIT_autoProcessing
      nbytes = SIO_reclaim(pAstCfg->xInp[zMI].hRxSio, (Ptr)&pAstCfg->xInp[zMI].pInpBuf, NULL);
      if (nbytes == -DIBERR_SYNC)
      {
 -#if 1 // (***) FL: shows timing of autosync restart
 +#if 0 // (***) FL: shows timing of autosync restart
          // (***) debug // B5
          {
              static Uint8 toggleState = 0;
@@@ -2114,9 -1930,7 +1968,7 @@@ PAF_ASIT_decodeProcessing
      //PAF_InpBufConfig *pIpBufConfig;
      Int frame; // decoder input frame count
      Int block; // (***) FL: formerly  -- decoder output block count / input frame
- #ifdef NON_CACHE_STATUS
      Int8 tempVar8, temp2Var8;
- #endif
      
      pAstCfg = pAsitCfg->pAstCfg; // get pointer to AST common (shared) configuration
      zMD = pAstCfg->masterDec;
      state = INIT;
      errno = 0; /* error number */
  
- #ifdef NON_CACHE_STATUS
-     statusOp_read(&tempVar8,
-                   &(pAstCfg->xDec[zMD].decodeStatus.sourceSelect),
-                   sizeof(tempVar8),
-                   GATEMP_INDEX_DEC);
+     tempVar8 = sharedMemReadInt8(&(pAstCfg->xDec[zMD].decodeStatus.sourceSelect), 
+                                  GATEMP_INDEX_DEC);
      TRACE_TERSE1("PAF_ASIT_decodeProcessing: sourceSelect is %d", tempVar8);
  
      for (;;) 
      {
-         statusOp_read(&tempVar8,
-                       &(pAstCfg->xDec[zMD].decodeStatus.sourceSelect),
-                     sizeof(tempVar8),
-                     GATEMP_INDEX_DEC);
+         tempVar8 = sharedMemReadInt8(&(pAstCfg->xDec[zMD].decodeStatus.sourceSelect), 
+                                      GATEMP_INDEX_DEC);
          if (tempVar8 == PAF_SOURCE_NONE)
          {
- #else
-     TRACE_TERSE1("PAF_ASIT_decodeProcessing: sourceSelect is %d", pAstCfg->xDec[zMD].decodeStatus.sourceSelect);
-     for (;;)
-     {
-         if (pAstCfg->xDec[zMD].decodeStatus.sourceSelect == PAF_SOURCE_NONE)
-         {
- #endif
              TRACE_VERBOSE0("PAF_ASIT_decodeProcessing: sourceSelect == PAF_SOURCE_NONE");
              state = QUIT;
          }
                      break;
                  }
                  
- #ifdef NON_CACHE_STATUS
-                 statusOp_read(&tempVar8,
-                               &(pAstCfg->xDec[zMD].decodeStatus.sourceDecode),
-                               sizeof(tempVar8),
-                               GATEMP_INDEX_DEC);
-                 statusOp_read(&temp2Var8,
-                               &(pAstCfg->xDec[zMD].decodeStatus.sampleRate),
-                               sizeof(tempVar8),
-                               GATEMP_INDEX_DEC);
+                 tempVar8  = sharedMemReadInt8(&(pAstCfg->xDec[zMD].decodeStatus.sourceDecode),
+                                               GATEMP_INDEX_DEC);
+                 temp2Var8 = sharedMemReadInt8(&(pAstCfg->xDec[zMD].decodeStatus.sampleRate), 
+                                               GATEMP_INDEX_DEC);
                  // Don't start decode until major access unit is found.
                  if (((tempVar8 == PAF_SOURCE_THD)    ||
                       (tempVar8 == PAF_SOURCE_DXP)    ||
                       (tempVar8 == PAF_SOURCE_DTSHD)) &&
                       (temp2Var8 == PAF_SAMPLERATE_UNKNOWN)) 
- #else
-                 // Don't start decode until major access unit is found.
-                 if (((pAstCfg->xDec[zMD].decodeStatus.sourceDecode == PAF_SOURCE_THD)    ||
-                      (pAstCfg->xDec[zMD].decodeStatus.sourceDecode == PAF_SOURCE_DXP)    ||
-                      (pAstCfg->xDec[zMD].decodeStatus.sourceDecode == PAF_SOURCE_DTSHD)) &&
-                      (pAstCfg->xDec[zMD].decodeStatus.sampleRate == PAF_SAMPLERATE_UNKNOWN))
- #endif
                  {
                      Int z;
                      for (z=DECODE1; z < DECODEN; z++) 
                      {
                          Int zI = pP->inputsFromDecodes[z];
- #ifdef NON_CACHE_STATUS
-                         statusOp_read(&tempVar8,
-                                       &(pAstCfg->xDec[z].decodeStatus.mode),
-                                       sizeof(tempVar8),
-                                       GATEMP_INDEX_DEC);
+                         tempVar8 = sharedMemReadInt8(&(pAstCfg->xDec[z].decodeStatus.mode), 
+                                                      GATEMP_INDEX_DEC);
                          if (pAstCfg->xInp[zI].hRxSio && tempVar8)
                          {
- #else
-                         if (pAstCfg->xInp[zI].hRxSio && pAstCfg->xDec[z].decodeStatus.mode)
-                         {
- #endif
                              TRACE_VERBOSE0("TaskAsip: PAF_ASIT_decodeProcessing: INFO1, SIO_issue");
                              if (SIO_issue(pAstCfg->xInp[zI].hRxSio, &pAstCfg->xInp[zI].inpBufConfig,
                                  sizeof(pAstCfg->xInp[zI].inpBufConfig), PAF_SIO_REQUEST_NEWFRAME))
@@@ -2435,9 -2217,7 +2255,7 @@@ PAF_ASIT_decodeCommand
      Int as;                 /* Audio Stream Number (1, 2, etc.) */
      Int z;                  /* decode counter */
      Int zS;
- #ifdef NON_CACHE_STATUS
      Int8 tempVar8;
- #endif
  
      pAstCfg = pAsitCfg->pAstCfg; // get pointer to AST common (shared) configuration
      as = pAstCfg->as;
      for (z=DECODE1; z < DECODEN; z++) 
      {
          zS = pP->streamsFromDecodes[z];
- #ifdef NON_CACHE_STATUS
-         statusOp_read(&tempVar8,
-                       &(pAstCfg->xDec[z].decodeStatus.command2),
-                       sizeof(tempVar8),
-                       GATEMP_INDEX_DEC);
+         tempVar8 = sharedMemReadInt8(&(pAstCfg->xDec[z].decodeStatus.command2), 
+                                      GATEMP_INDEX_DEC);
          if (!(tempVar8 & 0x80))
          {
              switch (tempVar8)
              {
                  case 0: // command none - process
                      tempVar8 |= 0x80;
-                     statusOp_write(&(pAstCfg->xDec[z].decodeStatus.command2),
-                                    &tempVar8,
-                                    sizeof(tempVar8),
-                                    GATEMP_INDEX_DEC);
+                     sharedMemWriteInt8(&(pAstCfg->xDec[z].decodeStatus.command2),
+                                        tempVar8, GATEMP_INDEX_DEC);
                      break;
                  case 1: // command abort - leave now
                      TRACE_TERSE2("AS%d: PAF_ASIT_decodeCommand: decode command abort (0x%02x)", as+zS, 1);
                      tempVar8 |= 0x80;
-                     statusOp_write(&(pAstCfg->xDec[z].decodeStatus.command2),
-                                    &tempVar8,
-                                    sizeof(tempVar8),
-                                    GATEMP_INDEX_DEC);
+                     sharedMemWriteInt8(&(pAstCfg->xDec[z].decodeStatus.command2),
+                                        tempVar8, GATEMP_INDEX_DEC);
                      return (ASPERR_ABORT);
                  case 2: // command restart - leave later
                      TRACE_TERSE2("AS%d: PAF_ASIT_decodeCommand: decode command quit (0x%02x)", as+zS, 2);
                      tempVar8 |= 0x80;
-                     statusOp_write(&(pAstCfg->xDec[z].decodeStatus.command2),
-                                    &tempVar8,
-                                    sizeof(tempVar8),
-                                    GATEMP_INDEX_DEC);
-                     return (ASPERR_QUIT);
-                 default: // command unknown - ignore
-                     break;
-             }
-         }
- #else
-         if (!(pAstCfg->xDec[z].decodeStatus.command2 & 0x80))
-         {
-             switch (pAstCfg->xDec[z].decodeStatus.command2)
-             {
-                 case 0: // command none - process
-                     pAstCfg->xDec[z].decodeStatus.command2 |= 0x80;
-                     break;
-                 case 1: // command abort - leave now
-                     TRACE_TERSE2("AS%d: PAF_ASIT_decodeCommand: decode command abort (0x%02x)", as+zS, 1);
-                     pAstCfg->xDec[z].decodeStatus.command2 |= 0x80;
-                     return (ASPERR_ABORT);
-                 case 2: // command restart - leave later
-                     TRACE_TERSE2("AS%d: PAF_ASIT_decodeCommand: decode command quit (0x%02x)", as+zS, 2);
-                     pAstCfg->xDec[z].decodeStatus.command2 |= 0x80;
+                     sharedMemWriteInt8(&(pAstCfg->xDec[z].decodeStatus.command2),
+                                        tempVar8, GATEMP_INDEX_DEC);
                      return (ASPERR_QUIT);
                  default: // command unknown - ignore
                      break;
              }
          }
- #endif
      }
  
      return 0;
@@@ -2535,12 -2285,9 +2323,9 @@@ PAF_ASIT_decodeInit
      Int zI, zS;
      Int zMD;
      Int zMI;
-     ASP_Msg* pAspMsg;                   /* Messaging */
      Int argIdx;
-     Int status;
- #ifdef NON_CACHE_STATUS
      Int8 tempVar8;
- #endif
+     char decMsgBuf[ASP_MSG_BUF_LEN];
      
      pAstCfg = pAsitCfg->pAstCfg; // get pointer to AST common (shared) configuration
      as = pAstCfg->as;
      
      pCbCtl = &pAsitCfg->pAspmCfg->decOpCircBufCtl; // get pointer to circular buffer control
  
- #ifdef NON_CACHE_STATUS
      // reset frameCount
      for (z=DECODE1; z < DECODEN; z++)
      {
-         statusOp_read(&tempVar8,
-                       &(pAstCfg->xDec[z].decodeStatus.mode),
-                       sizeof(tempVar8),
-                       GATEMP_INDEX_DEC);
+         tempVar8 = sharedMemReadInt8(&(pAstCfg->xDec[z].decodeStatus.mode),
+                                      GATEMP_INDEX_DEC);
          if (tempVar8)
          {
-             tempVar8 = 0;
-             statusOp_write(&(pAstCfg->xDec[z].decodeStatus.frameCount),
-                           &tempVar8,
-                           sizeof(tempVar8),
-                           GATEMP_INDEX_DEC);
+             sharedMemWriteInt(&(pAstCfg->xDec[z].decodeStatus.frameCount),
+                               (Int)0, GATEMP_INDEX_DEC);
          }
      }
  
          zI = pP->inputsFromDecodes[z];
          zS = pP->streamsFromDecodes[z];
          (void)zS; // clear compiler warning in case not used with tracing disabled
-         statusOp_read(&tempVar8,
-                       &(pAstCfg->xDec[z].decodeStatus.mode),
-                       sizeof(tempVar8),
-                       GATEMP_INDEX_DEC);
+         tempVar8 = sharedMemReadInt8(&(pAstCfg->xDec[z].decodeStatus.mode), 
+                                      GATEMP_INDEX_DEC);
          if (pAstCfg->xInp[zI].hRxSio && tempVar8)
          {
- #else
-     // reset frameCount
-     for (z=DECODE1; z < DECODEN; z++)
-     {
-         if (pAstCfg->xDec[z].decodeStatus.mode)
-         {
-             pAstCfg->xDec[z].decodeStatus.frameCount = 0;
-         }
-     }
  
-     for (z=DECODE1; z < DECODEN; z++)
-     {
-         zI = pP->inputsFromDecodes[z];
-         zS = pP->streamsFromDecodes[z];
-         (void)zS; // clear compiler warning in case not used with tracing disabled
-         if (pAstCfg->xInp[zI].hRxSio && pAstCfg->xDec[z].decodeStatus.mode)
-         {
- #endif
              Uns gear;
              Int frameLength;
              TRACE_VERBOSE1("AS%d: PAF_ASIT_decodeInit: initializing decode", as+zS);
              Cache_wait();
  
              // FL: send dec activate message to slave
-             pAspMsg = (ASP_Msg *)MessageQ_alloc(hAspMsgMaster->heapId, hAspMsgMaster->msgSize);  /* allocate message */
-             if (pAspMsg == NULL)
-             {
-                 TRACE_TERSE0("MessageQ_alloc() failure.");
-                 SW_BREAKPOINT; // temporary
-                 return -1; // temporary
-             }
-             MessageQ_setReplyQueue(hAspMsgMaster->masterQue, (MessageQ_Msg)pAspMsg);            /* set the return address in the message header */
-             pAspMsg->cmd = ASP_SLAVE_DEC_ACTIVATE;                                              /* fill in message payload */
-             pAspMsg->procId = hAspMsgMaster->masterProcId;
-             pAspMsg->expectResp = TRUE;
-             pAspMsg->messageId = hAspMsgMaster->messageId & ~(1<<31);
              argIdx = 0; // set decIdx (zone index)
-             *(Int32 *)&pAspMsg->buf[argIdx] = z;
-             TRACE_MSG3("Tx ASP message: procId=%d, cmd=%d, messageId=0x%04x", pAspMsg->procId, pAspMsg->cmd, pAspMsg->messageId);
-             TRACE_MSG1("decIdx=%d", pAspMsg->buf[0]);
-             status = MessageQ_put(hAspMsgMaster->slaveQue, (MessageQ_Msg)pAspMsg);                       /* send message */
-             if (status != MessageQ_S_SUCCESS)
+             *(Int32 *)&decMsgBuf[argIdx] = z;
+             if(AspMsgSend(ASP_SLAVE_DEC_ACTIVATE, ASP_MASTER_DEC_ACTIVATE_DONE, 
+                           decMsgBuf, NULL) != ASP_MSG_NO_ERR)
              {
-                 SW_BREAKPOINT;
-             }
-             // wait for dec activate complete message from slave
-             status = MessageQ_get(hAspMsgMaster->masterQue, (MessageQ_Msg *)&pAspMsg, MessageQ_FOREVER);
-             if (status != MessageQ_S_SUCCESS)
-             {
-                 TRACE_TERSE0("MessageQ_get() failure.");
+                 TRACE_TERSE0("decodeInit: error in sending DEC_ACTIVATE message ");
                  SW_BREAKPOINT; // temporary
                  return -1; // temporary
-             }
-             if ((pAspMsg->procId != hAspMsgMaster->slaveProcId) || 
-                 (pAspMsg->cmd != ASP_MASTER_DEC_ACTIVATE_DONE) ||
-                 (pAspMsg->messageId != (hAspMsgMaster->messageId | ((UInt32)1<<31))))
-             {
-                 TRACE_TERSE3("ERROR: Rx ASP message: procId=%d, cmd=%d, messageId=0x%04x", pAspMsg->procId, pAspMsg->cmd, pAspMsg->messageId);
-                 SW_BREAKPOINT; // temporary
-                 return -1; // temporary
-             }      
-             hAspMsgMaster->messageId = (hAspMsgMaster->messageId + 1) & ~(1<<31);
-             TRACE_MSG3("Rx ASP message: procId=%d, cmd=%d, messageId=0x%04x", pAspMsg->procId, pAspMsg->cmd, pAspMsg->messageId);
-             // free the message
-             status = MessageQ_free((MessageQ_Msg)pAspMsg); /* free the message */
-             if (status != MessageQ_S_SUCCESS)
-             {
-                 SW_BREAKPOINT;
-             }
-             
+             }           
  #if 0 // FL: decoder activate call, slave
              if (decAlg[z]->fxns->algActivate)
                  decAlg[z]->fxns->algActivate (decAlg[z]);
  #endif
              // FL: send dec reset message to slave
-             pAspMsg = (ASP_Msg *)MessageQ_alloc(hAspMsgMaster->heapId, hAspMsgMaster->msgSize);  /* allocate message */
-             if (pAspMsg == NULL)
-             {
-                 TRACE_TERSE0("MessageQ_alloc() failure.");
-                 SW_BREAKPOINT; // temporary
-                 return -1; // temporary
-             }
-             MessageQ_setReplyQueue(hAspMsgMaster->masterQue, (MessageQ_Msg)pAspMsg);            /* set the return address in the message header */
-             pAspMsg->cmd = ASP_SLAVE_DEC_RESET;                                                 /* fill in message payload */
-             pAspMsg->procId = hAspMsgMaster->masterProcId;
-             pAspMsg->expectResp = TRUE;
-             pAspMsg->messageId = hAspMsgMaster->messageId & ~(1<<31);
              argIdx = 0; // set decIdx
-             *(Int32 *)&pAspMsg->buf[argIdx] = z;
-             TRACE_MSG3("Tx ASP message: procId=%d, cmd=%d, messageId=0x%04x", pAspMsg->procId, pAspMsg->cmd, pAspMsg->messageId);
-             TRACE_MSG1("decIdx=%d", pAspMsg->buf[0]);
-             // wait for dec reset complete message from slave
-             status = MessageQ_put(hAspMsgMaster->slaveQue, (MessageQ_Msg)pAspMsg);              /* send message */
-             if (status != MessageQ_S_SUCCESS)
-             {
-                 SW_BREAKPOINT;
-             }
-             status = MessageQ_get(hAspMsgMaster->masterQue, (MessageQ_Msg *)&pAspMsg, MessageQ_FOREVER);
-             if (status != MessageQ_S_SUCCESS)
+             *(Int32 *)&decMsgBuf[argIdx] = z;
+             if(AspMsgSend(ASP_SLAVE_DEC_RESET, ASP_MASTER_DEC_RESET_DONE, 
+                           decMsgBuf, decMsgBuf) != ASP_MSG_NO_ERR)
              {
-                 TRACE_TERSE0("MessageQ_get() failure.");
+                 TRACE_TERSE0("decodeInit: error in sending DEC_RESET message ");
                  SW_BREAKPOINT; // temporary
                  return -1; // temporary
              }
-             if ((pAspMsg->procId == hAspMsgMaster->slaveProcId) &&
-                 (pAspMsg->cmd == ASP_MASTER_DEC_RESET_DONE) && 
-                 (pAspMsg->messageId == (hAspMsgMaster->messageId | ((UInt32)1<<31))))
-             {
-                 hAspMsgMaster->messageId = (hAspMsgMaster->messageId + 1) & ~(1<<31);
-                 TRACE_MSG3("Rx ASP message: procId=%d, cmd=%d, messageId=0x%04x", pAspMsg->procId, pAspMsg->cmd, pAspMsg->messageId);
-                 TRACE_MSG1("decErrno=%d", pAspMsg->buf[0]);
-                 argIdx = 0; // get decErrno
-                 errno = *(Int32 *)&pAspMsg->buf[argIdx];
-             }
              else
              {
-                 //
-                 // Invalid message received
-                 //
-                 TRACE_TERSE3("ERROR: Rx ASP message: procId=%d, cmd=%d, messageId=0x%04x", pAspMsg->procId, pAspMsg->cmd, pAspMsg->messageId);
-                 SW_BREAKPOINT; // temporary
-                 return -1; // temporary
-             }
-             // free the message
-             status = MessageQ_free((MessageQ_Msg)pAspMsg); /* free the message */
-             if (status != MessageQ_S_SUCCESS)
-             {
-                 SW_BREAKPOINT;
-             }
-             
+                 argIdx = 0; // get decErrno
+                 errno = *(Int32 *)&decMsgBuf[argIdx];                
+             }   
              // (***) FL: revisit
              // invalidate Dec configuration
              Cache_inv(&pAstCfg->xDec[z], sizeof(PAF_AST_Decode), Cache_Type_ALLD, 0);
                  return errno;
              }
              
- #ifdef NON_CACHE_STATUS
-             gear = 0;  // due to size difference
-             statusOp_read(&gear,
-                           &(pAstCfg->xDec[z].decodeStatus.aspGearControl),
-                           sizeof(Int8),
-                           GATEMP_INDEX_DEC);
+             gear = (Uns)sharedMemReadInt8(&(pAstCfg->xDec[z].decodeStatus.aspGearControl),
+                                             GATEMP_INDEX_DEC);
              tempVar8 = gear < GEARS ? gear : 0;
-             statusOp_write(&(pAstCfg->xDec[z].decodeStatus.aspGearStatus),
-                            &tempVar8,
-                            sizeof(tempVar8),
-                            GATEMP_INDEX_DEC);
- #else
-             gear = pAstCfg->xDec[z].decodeStatus.aspGearControl;
-             pAstCfg->xDec[z].decodeStatus.aspGearStatus = gear < GEARS ? gear : 0;
- #endif
+             sharedMemWriteInt8(&(pAstCfg->xDec[z].decodeStatus.aspGearStatus),
+                                  tempVar8, GATEMP_INDEX_DEC);
              
  #if 0 // FL: change handle to decIdx (zone index)
              frameLength = pP->fxns->computeFrameLength(decAlg[z], 
                  }
              }
  
- #ifdef NON_CACHE_STATUS
-             statusOp_read(&tempVar8,
-                           &(pAstCfg->xDec[z].decodeStatus.sourceSelect),
-                           sizeof(Int8),
-                           GATEMP_INDEX_DEC);
+             tempVar8 = sharedMemReadInt8(&(pAstCfg->xDec[z].decodeStatus.sourceSelect),
+                                            GATEMP_INDEX_DEC);
              if (errno = SIO_ctrl(pAstCfg->xInp[zI].hRxSio, PAF_SIO_CONTROL_SET_SOURCESELECT,
                  DECSIOMAP(tempVar8)))
              {
                  return errno;
              }
- #else
-             if (errno = SIO_ctrl(pAstCfg->xInp[zI].hRxSio, PAF_SIO_CONTROL_SET_SOURCESELECT,
-                 DECSIOMAP(pAstCfg->xDec[z].decodeStatus.sourceSelect)))
-             {
-                 return errno;
-             }
- #endif
              if (errno = SIO_ctrl(pAstCfg->xInp[zI].hRxSio, PAF_SIO_CONTROL_SET_PCMFRAMELENGTH, 
                  frameLength))
              {
@@@ -2871,13 -2496,10 +2534,10 @@@ PAF_ASIT_decodeInfo
      Int zMI;
      Int zMS;
      UInt32 curTime;
-     ASP_Msg *pAspMsg;          /* Messaging */
      Int argIdx;
-     Int status;
- #ifdef NON_CACHE_STATUS
      Int8 tempVar8;
      Int tempVar;
- #endif
+     char decMsgBuf[ASP_MSG_BUF_LEN];
      // FL: revisit
      //Int size;
      //PAF_InpBufConfig *pIpBufConfig;
                      // return (ASPERR_INFO_RATECHANGE);
                  }
              }
- #ifdef NON_CACHE_STATUS
-             statusOp_read(&tempVar8,
-                           &(pAstCfg->xDec[zD].decodeStatus.sourceDecode),
-                           sizeof(Int8),
-                           GATEMP_INDEX_DEC);
+             tempVar8 = sharedMemReadInt8(&(pAstCfg->xDec[zD].decodeStatus.sourceDecode),
+                                            GATEMP_INDEX_DEC);
              pAstCfg->xDec[zD].decodeControl.emphasis = 
                  tempVar8 != PAF_SOURCE_PCM
                  ? PAF_IEC_PREEMPHASIS_NO // fix for Mantis ID #119
                  : pAstCfg->xInp[z].inpBufStatus.emphasisStatus;
- #else
-             pAstCfg->xDec[zD].decodeControl.emphasis =
-                 pAstCfg->xDec[zD].decodeStatus.sourceDecode != PAF_SOURCE_PCM
-                 ? PAF_IEC_PREEMPHASIS_NO // fix for Mantis ID #119
-                 : pAstCfg->xInp[z].inpBufStatus.emphasisStatus;
- #endif
          }
          else 
          {
          capIb(pAstCfg->xInp[zMI].pInpBuf);
          gCapIb_cnt++;
          
 -#if 1 // (***) FL: shows timing of Input Rx SIO reclaim after decoding has started (autodet complete)
 +#if 0 // (***) FL: shows timing of Input Rx SIO reclaim after decoding has started (autodet complete)
          // (***) debug // B5
          {
              static Uint8 toggleState = 0;
          zI = pP->inputsFromDecodes[z];
          zS = pP->streamsFromDecodes[z];
          (void)zS; // clear compiler warning in case not used with tracing disabled
- #ifdef NON_CACHE_STATUS
-         statusOp_read(&tempVar8,
-                       &(pAstCfg->xDec[z].decodeStatus.mode),
-                       sizeof(Int8),
-                       GATEMP_INDEX_DEC);
+         tempVar8 = sharedMemReadInt8(&(pAstCfg->xDec[z].decodeStatus.mode),
+                                      GATEMP_INDEX_DEC);
          if (pAstCfg->xInp[zI].hRxSio && tempVar8)
          {
- #else
-         if (pAstCfg->xInp[zI].hRxSio && pAstCfg->xDec[z].decodeStatus.mode) 
-         {
- #endif
              TRACE_GEN2("PAF_ASIT_decodeInfo: AS%d: processing frame %d -- info", as+zS, frame);
  
              if (errno = pP->fxns->updateInputStatus(pAstCfg->xInp[zI].hRxSio,
              // (***) FL: revisit
              // write back Inp configuration
              Cache_wb(&pAstCfg->xInp[zI], sizeof(PAF_AST_InpBuf), Cache_Type_ALLD, 0);
 -            // write back input data //  (***) GJ: don't need this for 1xI2S HDMI/SPDIF. Maybe need this for 4xI2S HDMI.
 -            //pIpBufConfig = &gPAF_AST_config.xInp[zI].inpBufConfig;
 -            //size = pIpBufConfig->frameLength * pIpBufConfig->sizeofElement;
 -            //Cache_wb((Ptr)pIpBufConfig->pntr.pSmInt, size, Cache_Type_ALLD, 0);
              // write back Dec configuration
              Cache_wb(&pAstCfg->xDec[z], sizeof(PAF_AST_Decode), Cache_Type_ALLD, 0);
              Cache_wait();
  #endif
              
              // FL: send info message to slave
-             pAspMsg = (ASP_Msg *)MessageQ_alloc(hAspMsgMaster->heapId, hAspMsgMaster->msgSize); /* allocate message */
-             if (pAspMsg == NULL)
-             {
-                 TRACE_TERSE0("MessageQ_alloc() failure.");
-                 SW_BREAKPOINT; // temporary
-                 return -1;  // temporary
-             }
-             MessageQ_setReplyQueue(hAspMsgMaster->masterQue, (MessageQ_Msg)pAspMsg);            /* set the return address in the message header */
-             pAspMsg->cmd = ASP_SLAVE_DEC_INFO;                                                  /* fill in message payload */
-             pAspMsg->procId = hAspMsgMaster->masterProcId;
-             pAspMsg->expectResp = TRUE;
-             pAspMsg->messageId = hAspMsgMaster->messageId & ~(1<<31);
              argIdx = 0; // set decIdx
-             *(Int32 *)&pAspMsg->buf[argIdx] = z;
-             TRACE_MSG3("Tx ASP message: procId=%d, cmd=%d, messageId=0x%04x", pAspMsg->procId, pAspMsg->cmd, pAspMsg->messageId);
-             TRACE_MSG1("decIdx=%d", pAspMsg->buf[0]);
-             status = MessageQ_put(hAspMsgMaster->slaveQue, (MessageQ_Msg)pAspMsg);              /* send message to slave */
-             if (status != MessageQ_S_SUCCESS)
-             {
-                 SW_BREAKPOINT;
-             }
-             // wait for dec info complete message from slave -- temporary
-             status = MessageQ_get(hAspMsgMaster->masterQue, (MessageQ_Msg *)&pAspMsg, MessageQ_FOREVER);
-             if (status != MessageQ_S_SUCCESS)
+             *(Int32 *)&decMsgBuf[argIdx] = z;
+             if(AspMsgSend(ASP_SLAVE_DEC_INFO, ASP_MASTER_DEC_INFO_DONE, 
+                           decMsgBuf, decMsgBuf) != ASP_MSG_NO_ERR)
              {
-                 TRACE_TERSE0("MessageQ_get() failure.");
-                 SW_BREAKPOINT;
-                 return -1; // temporary
-             }
-             if ((pAspMsg->procId == hAspMsgMaster->slaveProcId) &&
-                 (pAspMsg->cmd == ASP_MASTER_DEC_INFO_DONE) && 
-                 (pAspMsg->messageId == (hAspMsgMaster->messageId | ((UInt32)1<<31))))
-             {
-                 hAspMsgMaster->messageId = (hAspMsgMaster->messageId + 1) & ~(1<<31);
-                 TRACE_TERSE3("Rx ASP message: procId=%d, cmd=%d, messageId=0x%04x", pAspMsg->procId, pAspMsg->cmd, pAspMsg->messageId);
-                 TRACE_MSG1("decErrno=%d", pAspMsg->buf[0]);
-                 
-                 argIdx = 0; // get decErrno
-                 errno = *(Int32 *)&pAspMsg->buf[argIdx];
-             }
-             else
-             {
-                 //
-                 // Invalid message received
-                 //
-                 TRACE_TERSE3("ERROR: Rx ASP message: procId=%d, cmd=%d, messageId=0x%04x", pAspMsg->procId, pAspMsg->cmd, pAspMsg->messageId);
+                 TRACE_TERSE0("decodeInfo: error in sending DEC_INFO message ");
                  SW_BREAKPOINT; // temporary
-                 return -1; // temporary
+                 return -1;     // temporary
              }
-             // free the message
-             status = MessageQ_free((MessageQ_Msg)pAspMsg); /* free the message */
-             if (status != MessageQ_S_SUCCESS)
+             else
              {
-                 SW_BREAKPOINT;
-             }
+                 argIdx = 0; // get decErrno
+                 errno = *(Int32 *)&decMsgBuf[argIdx];                
+             }             
  
  #if 1
              // (***) FL: revisit
                  return errno;
              }
  
- #ifdef NON_CACHE_STATUS
-             statusOp_read(&tempVar,
-                           &(pAstCfg->xDec[z].decodeStatus.frameCount),
-                           sizeof(Int),
-                           GATEMP_INDEX_DEC);
              // increment decoded frame count
+             tempVar = sharedMemReadInt(&(pAstCfg->xDec[z].decodeStatus.frameCount),
+                                        GATEMP_INDEX_DEC);
              tempVar += 1;
-             statusOp_write(&(pAstCfg->xDec[z].decodeStatus.frameCount),
-                            &tempVar,
-                            sizeof(Int),
-                            GATEMP_INDEX_DEC);
- #else
-             // increment decoded frame count
-             pAstCfg->xDec[z].decodeStatus.frameCount += 1;
- #endif
+             sharedMemWriteInt(&(pAstCfg->xDec[z].decodeStatus.frameCount),
+                               tempVar, GATEMP_INDEX_DEC);
          }
      } // z=DECODE1 to DECODEN
  
- #ifdef NON_CACHE_STATUS
-     statusOp_read(&tempVar8,
-                   &(pAstCfg->xDec[zMD].decodeStatus.mode),
-                   sizeof(Int8),
-                   GATEMP_INDEX_DEC);
      // query IB for latest sourceProgram (needed if we started decoding due to a force mode)
+     tempVar8 = sharedMemReadInt8(&(pAstCfg->xDec[zMD].decodeStatus.mode),
+                                  GATEMP_INDEX_DEC);
      if (tempVar8)
      {
          XDAS_Int8 sourceProgram;
              TRACE_TERSE1("return error ASPERR_AUTO_PROGRAM. errno 0x%x.", errno);
              return ASPERR_AUTO_PROGRAM;
          }
-         statusOp_write(&(pAstCfg->xDec[zMD].decodeStatus.sourceProgram),
-                        &(sourceProgram),
-                        sizeof(Int8),
-                        GATEMP_INDEX_DEC);
+         sharedMemWriteInt8(&(pAstCfg->xDec[zMD].decodeStatus.sourceProgram),
+                            sourceProgram, GATEMP_INDEX_DEC);
      }
  
      // since now decoding update decode status for all enabled decoders
      for (z=DECODE1; z < DECODEN; z++)
      {
-         statusOp_read(&tempVar8,
-                       &(pAstCfg->xDec[z].decodeStatus.mode),
-                       sizeof(Int8),
-                       GATEMP_INDEX_DEC);
+         tempVar8 = sharedMemReadInt8(&(pAstCfg->xDec[z].decodeStatus.mode),
+                                      GATEMP_INDEX_DEC);
          if (tempVar8)
          {
-             statusOp_read(&tempVar8,
-                           &(pAstCfg->xDec[z].decodeStatus.sourceProgram),
-                           sizeof(Int8),
-                           GATEMP_INDEX_DEC);
-             statusOp_write(&(pAstCfg->xDec[z].decodeStatus.sourceDecode),
-                            &tempVar8,
-                            sizeof(Int8),
-                            GATEMP_INDEX_DEC);
-             statusOp_read(&tempVar8,
-                           &(pAstCfg->xDec[z].decodeStatus.sourceSelect),
-                           sizeof(Int8),
-                           GATEMP_INDEX_DEC);
+             tempVar8 = sharedMemReadInt8(&(pAstCfg->xDec[z].decodeStatus.sourceProgram),
+                                          GATEMP_INDEX_DEC);
+             sharedMemWriteInt8(&(pAstCfg->xDec[z].decodeStatus.sourceDecode),
+                                tempVar8, GATEMP_INDEX_DEC);
+             tempVar8 = sharedMemReadInt8(&(pAstCfg->xDec[z].decodeStatus.sourceSelect),
+                                          GATEMP_INDEX_DEC);
              if (tempVar8 == PAF_SOURCE_SNG)
              {
                  tempVar8 = PAF_SOURCE_SNG;
-                 statusOp_write(&(pAstCfg->xDec[z].decodeStatus.sourceDecode),
-                                &tempVar8,
-                                sizeof(Int8),
-                                GATEMP_INDEX_DEC);
+                 sharedMemWriteInt8(&(pAstCfg->xDec[z].decodeStatus.sourceDecode),
+                                    tempVar8, GATEMP_INDEX_DEC);
              }
          }
      }
- #else
-     // query IB for latest sourceProgram (needed if we started decoding due to a force mode)
-     if (pAstCfg->xDec[zMD].decodeStatus.mode) 
-     {
-         XDAS_Int8 sourceProgram;
-         if (errno = SIO_ctrl(pAstCfg->xInp[zMI].hRxSio, PAF_SIO_CONTROL_GET_SOURCEPROGRAM,
-             (Arg)&sourceProgram))
-         {
-             TRACE_TERSE1("return error ASPERR_AUTO_PROGRAM. errno 0x%x.", errno);
-             return ASPERR_AUTO_PROGRAM;
-         }
-         pAstCfg->xDec[zMD].decodeStatus.sourceProgram = sourceProgram;
-     }
-     // since now decoding update decode status for all enabled decoders
-     for (z=DECODE1; z < DECODEN; z++) 
-     {
-         if (pAstCfg->xDec[z].decodeStatus.mode) 
-         {
-             pAstCfg->xDec[z].decodeStatus.sourceDecode = pAstCfg->xDec[z].decodeStatus.sourceProgram;
-             if (pAstCfg->xDec[z].decodeStatus.sourceSelect == PAF_SOURCE_SNG)
-             {
-                 pAstCfg->xDec[z].decodeStatus.sourceDecode = PAF_SOURCE_SNG;
-             }
-         }
-     }
- #endif
  
  #if 0 // FL: ASDT (slave)
      // TODO: move this to start of this function so that it doesn't affect IO timing
@@@ -3316,9 -2838,7 +2872,7 @@@ PAF_AST_decodeCont
      Int z;                      /* decode counter */
      Int zI, zS;
      Int zMD;
- #ifdef NON_CACHE_STATUS
      Int8 tempVar8;
- #endif
  
      
      pAstCfg = pAsitCfg->pAstCfg; // get pointer to AST common (shared) configuration
          zI = pP->inputsFromDecodes[z];
          zS = pP->streamsFromDecodes[z];
          (void)zS;
- #ifdef NON_CACHE_STATUS
-         statusOp_read(&tempVar8,
-                       &(pAstCfg->xDec[z].decodeStatus.mode),
-                       sizeof(Int8),
-                       GATEMP_INDEX_DEC);
+         tempVar8 = sharedMemReadInt8(&(pAstCfg->xDec[z].decodeStatus.mode),
+                                      GATEMP_INDEX_DEC);
          if (z == zMD
              || ! pAstCfg->xInp[zI].hRxSio
              || ! tempVar8)
              continue;
- #else
-         if (z == zMD
-             || ! pAstCfg->xInp[zI].hRxSio
-             || ! pAstCfg->xDec[z].decodeStatus.mode)
-             continue;
- #endif
          TRACE_VERBOSE2("PAF_AST_decodeCont: AS%d: awaiting frame %d -- data", as+zS, frame);
          if (SIO_reclaim(pAstCfg->xInp[zI].hRxSio, (Ptr)&pAstCfg->xInp[zI].pInpBuf, NULL)
              != sizeof (pAstCfg->xInp[zI].inpBufConfig))
@@@ -3385,11 -2896,10 +2930,10 @@@ PAF_ASIT_decodeDecode
      Int z;                      /* decode/stream counter */
      Int errno;                  /* error number */
      //Int ch;
-     ASP_Msg *pAspMsg;           /* Messaging */
      Int argIdx;
-     Int status;
      Int cbErrno;
      Int frameLength;    
+     char decMsgBuf[ASP_MSG_BUF_LEN];
  
      pAstCfg = pAsitCfg->pAstCfg; // get pointer to AST common (shared) configuration
      as = pAstCfg->as;
              Cache_wait();                        
  
              // FL: send decode message to slave
-             pAspMsg = (ASP_Msg *)MessageQ_alloc(hAspMsgMaster->heapId, hAspMsgMaster->msgSize);  /* allocate message */
-             if (pAspMsg == NULL)
-             {
-                 TRACE_TERSE0("MessageQ_alloc() failure.");
-                 SW_BREAKPOINT; // temporary
-                 return -1; // temporary
-             }
-             MessageQ_setReplyQueue(hAspMsgMaster->masterQue, (MessageQ_Msg)pAspMsg);            /* set the return address in the message header */
-             pAspMsg->cmd = ASP_SLAVE_DEC_DECODE;                                                /* fill in message payload */
-             pAspMsg->procId = hAspMsgMaster->masterProcId;
-             pAspMsg->expectResp = TRUE;
-             pAspMsg->messageId = hAspMsgMaster->messageId & ~(1<<31);
              argIdx = 0; // set decIdx
-             *(Int32 *)&pAspMsg->buf[argIdx] = z;
-             TRACE_MSG3("Tx ASP message: procId=%d, cmd=%d, messageId=0x%04x", pAspMsg->procId, pAspMsg->cmd, pAspMsg->messageId);
-             TRACE_MSG1("decIdx=%d", pAspMsg->buf[argIdx]);
-             status = MessageQ_put(hAspMsgMaster->slaveQue, (MessageQ_Msg)pAspMsg);              /* send message */
-             if (status != MessageQ_S_SUCCESS)
+             *(Int32 *)&decMsgBuf[argIdx] = z;
+             if(AspMsgSend(ASP_SLAVE_DEC_DECODE, ASP_MASTER_DEC_DECODE_DONE, 
+                           decMsgBuf, decMsgBuf) != ASP_MSG_NO_ERR)
              {
-                 SW_BREAKPOINT;
-             }
-             // wait for decode complete message from slave -- temporary
-             status = MessageQ_get(hAspMsgMaster->masterQue, (MessageQ_Msg *)&pAspMsg, MessageQ_FOREVER);
-             if (status != MessageQ_S_SUCCESS)
-             {
-                 TRACE_TERSE0("MessageQ_get() failure.");
+                 TRACE_TERSE0("decodeDecode: error in sending DEC_DECODE message ");
                  SW_BREAKPOINT; // temporary
-                 return -1; // temporary
+                 return -1;     // temporary
              }
-             if ((pAspMsg->procId == hAspMsgMaster->slaveProcId) && 
-                 (pAspMsg->cmd == ASP_MASTER_DEC_DECODE_DONE) &&
-                 (pAspMsg->messageId == (hAspMsgMaster->messageId | ((UInt32)1<<31))))
+             else 
              {
-                 hAspMsgMaster->messageId = (hAspMsgMaster->messageId + 1) & ~(1<<31);
-                 TRACE_MSG3("Rx ASP message: procId=%d, cmd=%d, messageId=0x%04x", pAspMsg->procId, pAspMsg->cmd, pAspMsg->messageId);
-                 
                  argIdx = 0; // get decErrno
-                 errno = *(Int32 *)&pAspMsg->buf[argIdx];
+                 errno = *(Int32 *)&decMsgBuf[argIdx];
                  argIdx += sizeof(Int32); // get cbErrno
-                 cbErrno = *(Int32 *)&pAspMsg->buf[argIdx];
+                 cbErrno = *(Int32 *)&decMsgBuf[argIdx];
                  if (cbErrno != 0)
                  {
                      gCbWrtAfErrCnt++;
                      TRACE_TERSE1("CB write error=%d", cbErrno);
                      //SW_BREAKPOINT; // temporary
                  }
-             }
-             else
-             {
-                 //
-                 // Invalid message received
-                 //
-                 TRACE_TERSE3("ERROR: Rx ASP message: procId=%d, cmd=%d, messageId=0x%04x", pAspMsg->procId, pAspMsg->cmd, pAspMsg->messageId);
-                 SW_BREAKPOINT; // temporary
-             }
-             // free the message
-             status = MessageQ_free((MessageQ_Msg)pAspMsg); /* free the message */
-             if (status != MessageQ_S_SUCCESS)
-             {
-                 SW_BREAKPOINT;
-             }
+             }           
  
              // (***) FL: revisit
              // invalidate Dec configuration
@@@ -3636,28 -3107,15 +3141,15 @@@ PAF_ASIT_decodeFinalTest
      Int zMD;
      Int sourceSelect;
      Int sourceProgram;
- #ifdef NON_CACHE_STATUS
      Int8 tempVar8, temp2Var8;
- #endif
  
      pAstCfg = pAsitCfg->pAstCfg; // get pointer to AST common (shared) configuration
      zMD = pAstCfg->masterDec;
  
- #ifdef NON_CACHE_STATUS
-     statusOp_read(&tempVar8,
-                   &(pAstCfg->xDec[zMD].decodeStatus.sourceSelect),
-                   sizeof(Int8),
-                   GATEMP_INDEX_DEC);
-     sourceSelect = tempVar8;
-     statusOp_read(&tempVar8,
-                   &(pAstCfg->xDec[zMD].decodeStatus.sourceProgram),
-                   sizeof(Int8),
-                   GATEMP_INDEX_DEC);
-     sourceProgram = tempVar8;
- #else
-     sourceSelect  = pAstCfg->xDec[zMD].decodeStatus.sourceSelect;
-     sourceProgram = pAstCfg->xDec[zMD].decodeStatus.sourceProgram;
- #endif
+     sourceSelect  = (Int)sharedMemReadInt8(&(pAstCfg->xDec[zMD].decodeStatus.sourceSelect),
+                                            GATEMP_INDEX_DEC);
+     sourceProgram = (Int)sharedMemReadInt8(&(pAstCfg->xDec[zMD].decodeStatus.sourceProgram),
+                                            GATEMP_INDEX_DEC);
  
      if ((sourceSelect == PAF_SOURCE_NONE) || (sourceSelect == PAF_SOURCE_PASS))
      {
          }
          else 
          {
- #ifdef NON_CACHE_STATUS
-             statusOp_read(&tempVar8,
-                           &(pAstCfg->xDec[zMD].decodeStatus.sourceDecode),
-                           sizeof(Int8),
-                           GATEMP_INDEX_DEC);
-             statusOp_read(&temp2Var8,
-                           &(pAstCfg->xDec[zMD].decodeStatus.sourceSelect),
-                           sizeof(Int8),
-                           GATEMP_INDEX_DEC);
+             tempVar8  = sharedMemReadInt8(&(pAstCfg->xDec[zMD].decodeStatus.sourceDecode),
+                                           GATEMP_INDEX_DEC);
+             temp2Var8 = sharedMemReadInt8(&(pAstCfg->xDec[zMD].decodeStatus.sourceSelect),
+                                           GATEMP_INDEX_DEC);
              if (temp2Var8 != tempVar8)
              {
                  return 1;
              }
- #else
-             if (pAstCfg->xDec[zMD].decodeStatus.sourceSelect != pAstCfg->xDec[zMD].decodeStatus.sourceDecode)
-             {
-                 return 1;
-             }
- #endif
          }
      }
  
@@@ -3739,14 -3186,10 +3220,10 @@@ PAF_ASIT_decodeComplete
      PAF_AST_Config *pAstCfg;
      Int as;                     /* Audio Stream Number (1, 2, etc.) */
      Int z;                      /* decode/encode counter */
-     ASP_Msg* pAspMsg;
      Int argIdx;
      Int errno;                  /* error number */
-     Int status;
- #ifdef NON_CACHE_STATUS
      Int8 tempVar8;
- #endif
+     char decMsgBuf[ASP_MSG_BUF_LEN];
      
      pAstCfg = pAsitCfg->pAstCfg; // get pointer to AST common (shared) configuration
      as = pAstCfg->as;
          DEC_Handle dec = (DEC_Handle )decAlg[z];
  #endif /* PAF_ASP_FINAL */
          Int zI = pP->inputsFromDecodes[z];
- #ifdef NON_CACHE_STATUS
-         statusOp_read(&tempVar8,
-                       &(pAstCfg->xDec[z].decodeStatus.mode),
-                       sizeof(Int8),
-                       GATEMP_INDEX_DEC);
+         tempVar8 = sharedMemReadInt8(&(pAstCfg->xDec[z].decodeStatus.mode),
+                                      GATEMP_INDEX_DEC);
          if (pAstCfg->xInp[zI].hRxSio && tempVar8)
          {
- #else
-         if (pAstCfg->xInp[zI].hRxSio && pAstCfg->xDec[z].decodeStatus.mode) 
-         {
- #endif
              TRACE_VERBOSE1("PAF_ASIT_decodeComplete: AS%d: finalizing decode", as+z);
  #ifdef PAF_ASP_FINAL
              if (dec->fxns->final)
                  dec->fxns->final(dec, NULL, &pAstCfg->xDec[z].decodeControl,
                                   &pAstCfg->xDec[z].decodeStatus);
  #endif /* PAF_ASP_FINAL */
              // FL: send dec deactivate message to slave
-             pAspMsg = (ASP_Msg *)MessageQ_alloc(hAspMsgMaster->heapId, hAspMsgMaster->msgSize);  /* allocate message */
-             if (pAspMsg == NULL)
-             {
-                 TRACE_TERSE0("MessageQ_alloc() failure.");
-                 errno = -1; // temporary
-                 return errno;
-             }
-             MessageQ_setReplyQueue(hAspMsgMaster->masterQue, (MessageQ_Msg)pAspMsg);              /* set the return address in the message header */
-             pAspMsg->cmd = ASP_SLAVE_DEC_DEACTIVATE;                                              /* fill in message payload */
-             pAspMsg->procId = hAspMsgMaster->masterProcId;
-             pAspMsg->expectResp = TRUE;
-             pAspMsg->messageId = hAspMsgMaster->messageId & ~(1<<31);
              argIdx = 0; // set decIdx
-             *(Int32 *)&pAspMsg->buf[argIdx] = z;
-             TRACE_MSG3("Tx ASP message: procId=%d, cmd=%d, messageId=0x%04x", pAspMsg->procId, pAspMsg->cmd, pAspMsg->messageId);
-             TRACE_MSG1("decIdx=%d", pAspMsg->buf[0]);
-             status = MessageQ_put(hAspMsgMaster->slaveQue, (MessageQ_Msg)pAspMsg);                /* send message */
-             if (status != MessageQ_S_SUCCESS)
-             {
-                 SW_BREAKPOINT;
-             }
-             // wait for dec deactivate complete message from slave
-             status = MessageQ_get(hAspMsgMaster->masterQue, (MessageQ_Msg *)&pAspMsg, MessageQ_FOREVER);
-             if (status != MessageQ_S_SUCCESS)
-             {
-                 TRACE_TERSE0("MessageQ_get() failure.");
-                 return errno;
-             }
-             if ((pAspMsg->procId != hAspMsgMaster->slaveProcId) ||
-                 (pAspMsg->cmd != ASP_MASTER_DEC_DEACTIVATE_DONE) ||
-                 (pAspMsg->messageId != (hAspMsgMaster->messageId | ((UInt32)1<<31))))
-             {
-                 TRACE_MSG3("ERROR: Rx ASP message: procId=%d, cmd=%d, messageId=0x%04x", pAspMsg->procId, pAspMsg->cmd, pAspMsg->messageId);
-                 SW_BREAKPOINT; // temporary
-             }          
-             hAspMsgMaster->messageId = (hAspMsgMaster->messageId + 1) & ~(1<<31);            
-             TRACE_TERSE3("Rx ASP message: procId=%d, cmd=%d, messageId=0x%04x", pAspMsg->procId, pAspMsg->cmd, pAspMsg->messageId);
-             // free the message
-             status = MessageQ_free((MessageQ_Msg)pAspMsg); /* free the message */
-             if (status != MessageQ_S_SUCCESS)
+             *(Int32 *)&decMsgBuf[argIdx] = z;
+             if(AspMsgSend(ASP_SLAVE_DEC_DEACTIVATE, ASP_MASTER_DEC_DEACTIVATE_DONE,
+                           decMsgBuf, NULL) != ASP_MSG_NO_ERR)
              {
+                 TRACE_TERSE0("decodeComplete: error in sending DEC_DEACTIVATE message.");
                  SW_BREAKPOINT;
+                 return -1;
              }
  
  #if 0 // FL: decoder deactivate call, slave
@@@ -3937,33 -3340,20 +3374,20 @@@ PAF_ASIT_sourceDecode
  {
      PAF_AST_Config *pAstCfg;
      Int z;                              /* decode counter */
- #ifdef NON_CACHE_STATUS
      Int8 tempVar8;
- #endif
  
      pAstCfg = pAsitCfg->pAstCfg; // get pointer to AST common (shared) configuration
  
      for (z=DECODE1; z < DECODEN; z++)
      {
- #ifdef NON_CACHE_STATUS
-         statusOp_read(&tempVar8,
-                       &(pAstCfg->xDec[z].decodeStatus.mode),
-                       sizeof(Int8),
-                       GATEMP_INDEX_DEC);
+         tempVar8 = sharedMemReadInt8(&(pAstCfg->xDec[z].decodeStatus.mode),
+                                      GATEMP_INDEX_DEC);
          if (tempVar8)
          {
              tempVar8 = x;
-             statusOp_write(&(pAstCfg->xDec[z].decodeStatus.sourceDecode),
-                            &tempVar8,
-                            sizeof(Int8),
-                            GATEMP_INDEX_DEC);
+             sharedMemWriteInt8(&(pAstCfg->xDec[z].decodeStatus.sourceDecode),
+                                tempVar8, GATEMP_INDEX_DEC);
          }
- #else
-         if (pAstCfg->xDec[z].decodeStatus.mode) 
-         {
-             pAstCfg->xDec[z].decodeStatus.sourceDecode = x;
-         }
- #endif
      }
      
      return 0;
index c29c95f3a17e352f927918dc2a25874fb21e2795,174d57c54c98c50e35c64e7424f7e954f768696f..a34bf55f526005a294639828ae08c102a27ce428
@@@ -1,6 -1,6 +1,6 @@@
  
  /*
 -Copyright (c) 2016, Texas Instruments Incorporated - http://www.ti.com/
 +Copyright (c) 2017, Texas Instruments Incorporated - http://www.ti.com/
  All rights reserved.
  
  * Redistribution and use in source and binary forms, with or without 
@@@ -47,6 -47,7 +47,7 @@@
  #include "audioStreamProc_patchs.h"
  #include "audioStreamProc_config.h"
  #include "audioStreamProc_master.h"
+ #include "statusOp_common.h"
  
  // Global debug counter */
  extern Uint32 gTaskAsipCnt; // debug counter for ASP task
@@@ -425,5 -426,57 +426,57 @@@ PAF_AST_streamChainFunction
      Int logArg
  );
  
+ //   Purpose:   writing 8-bit integer to shared memeory
+ static inline
+ sharedMemWriteInt8(
+       volatile XDAS_Int8 *address, /* address to write to */
+       Int8 value,                  /* value to write to the adddress */
+       Int gateIdx)                 /* GateMP Index, defined in statusOp_common.h */
+ {
+ #ifdef NON_CACHE_STATUS
+       statusOp_write((void *)address, (void *)&value, sizeof(Int8), gateIdx);
+ #else
+       *address = value;
+ #endif
+ }
+ //   Purpose:   read 8-bit integer from shared memeory
+ static inline Int8               /* return the value read in the shared memory */
+ sharedMemReadInt8(
+       volatile XDAS_Int8 *address, /* address to read from */
+       Int gateIdx)                 /* GateMP Index, defined in statusOp_common.h */
+ {
+ #ifdef NON_CACHE_STATUS
+       Int8 tempVar;
+       statusOp_read((void *)&tempVar, (void *)address, sizeof(Int8), gateIdx);
+       return tempVar;
+ #else
+       return(*address);
+ #endif
+ }
+ //   Purpose:   writing 32-bit integer to shared memeory
+ static inline sharedMemWriteInt(volatile XDAS_Int32 *address, Int value, Int gateIdx)
+ {
+ #ifdef NON_CACHE_STATUS
+       statusOp_write((void *)address, (void *)&value, sizeof(Int), gateIdx);
+ #else
+       *address = value;
+ #endif
+ }
+ //   Purpose:   read 32-bit integer from shared memeory
+ static inline Int sharedMemReadInt(volatile XDAS_Int32 *address, Int gateIdx)
+ {
+ #ifdef NON_CACHE_STATUS
+       Int tempVar;
+       statusOp_read((void *)&tempVar, (void *)address, sizeof(Int), gateIdx);
+       return tempVar;
+ #else
+       return(*address);
+ #endif
+ }
  
  #endif /* _ASIP_H_ */