]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - processor-sdk/performance-audio-sr.git/blob - pasdk/test_dsp/framework/audioStreamInpProc.h
Merge remote-tracking branch 'origin/dev_pasdk_frank_pasdk538UpdateIpcMessaging'...
[processor-sdk/performance-audio-sr.git] / pasdk / test_dsp / framework / audioStreamInpProc.h
2 /*
3 Copyright (c) 2017, Texas Instruments Incorporated - http://www.ti.com/
4 All rights reserved.
6 * Redistribution and use in source and binary forms, with or without 
7 * modification, are permitted provided that the following conditions
8 * are met:
9 *
10 * Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 *
13 * Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the
16 * distribution.
17 *
18 * Neither the name of Texas Instruments Incorporated nor the names of
19 * its contributors may be used to endorse or promote products derived
20 * from this software without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 *
34 */
36 /*
37  *  ======== audioStreamInpProc.h ========
38  */
40 #ifndef _ASIP_H_
41 #define _ASIP_H_
42  
43 #include <xdc/std.h>
44 #include <ti/sysbios/knl/Event.h>
45 #include <ti/sysbios/knl/Task.h>
47 #include "aspMsg_master.h"
48 #include "audioStreamProc_params.h"
49 #include "audioStreamProc_patchs.h"
50 #include "audioStreamProc_config.h"
51 #include "audioStreamProc_master.h"
52 #include "statusOp_common.h"
53 #include "ioPhy.h"
54 #include "ioBuff.h"
55 #include "ioData.h"
57 struct PAF_ASIT_Params;
58 struct PAF_ASIT_Patchs;
59 struct PAF_ASIT_Config;
61 // Audio Stream Input Task (ASIT) parameters, functions
62 typedef struct PAF_ASIT_Fxns {
63     Int (*initPhase[8]) (const struct PAF_ASIT_Params *, const struct PAF_ASIT_Patchs *, struct PAF_ASIT_Config *);
64     //Int (*initFrame0) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, Int);
65     //Int (*initFrame1) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, Int, Int);
66     Int (*passProcessing) (const struct PAF_ASIT_Params *, const struct PAF_ASIT_Patchs *, struct PAF_ASIT_Config *, Int);
67     //Int (*passProcessingCopy) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *);
68     Int (*autoProcessing) (const struct PAF_ASIT_Params *, const struct PAF_ASIT_Patchs *, struct PAF_ASIT_Config *, Int, ALG_Handle);
69     Int (*decodeProcessing) (const struct PAF_ASIT_Params *, const struct PAF_ASIT_Patchs *, struct PAF_ASIT_Config *, Int);    
70     Int (*decodeCommand) (const struct PAF_ASIT_Params *, const struct PAF_ASIT_Patchs *, struct PAF_ASIT_Config *);
71     Int (*decodeInit) (const struct PAF_ASIT_Params *, const struct PAF_ASIT_Patchs *, struct PAF_ASIT_Config *, Int);
72     Int (*decodeInfo) (const struct PAF_ASIT_Params *, const struct PAF_ASIT_Patchs *, struct PAF_ASIT_Config *, Int, Int);
73     Int (*decodeInfo1) (const struct PAF_ASIT_Params *, const struct PAF_ASIT_Patchs *, struct PAF_ASIT_Config *, Int, Int);
74     Int (*decodeInfo2) (const struct PAF_ASIT_Params *, const struct PAF_ASIT_Patchs *, struct PAF_ASIT_Config *, Int, Int);
75     //Int (*decodeCont) (const struct PAF_AST_Params *, const struct PAF_AST_Patchs *, struct PAF_AST_Config *, ALG_Handle *, Int, Int);
76     Int (*decodeDecode) (const struct PAF_ASIT_Params *, const struct PAF_ASIT_Patchs *, struct PAF_ASIT_Config *, Int, Int, Int);
77     Int (*decodeFinalTest) (const struct PAF_ASIT_Params *, const struct PAF_ASIT_Patchs *, struct PAF_ASIT_Config *, Int, Int);    
78     Int (*decodeComplete) (const struct PAF_ASIT_Params *, const struct PAF_ASIT_Patchs *, struct PAF_ASIT_Config *, ALG_Handle *, Int, Int);
79     Int (*selectDevices) (const struct PAF_ASIT_Params *, const struct PAF_ASIT_Patchs *, struct PAF_ASIT_Config *);
80     Int (*sourceDecode) (const struct PAF_ASIT_Params *, const struct PAF_ASIT_Patchs *, struct PAF_ASIT_Config *, Int);    
81     Int (*deviceAllocate) (SIO_Handle *, int, int, int, Ptr);
82     Int (*deviceSelect) (SIO_Handle *, int, int, Ptr);
83     Int (*computeFrameLength) (Int, Int, Int);
84     Int (*updateInputStatus) (SIO_Handle, PAF_InpBufStatus *, PAF_InpBufConfig *);
85     //Int (*copy) (Uns, PAF_InpBufConfig *, Uns, PAF_OutBufConfig *);
87     // For RAM_report
88     Void (*headerPrint)();
89     Int  (*allocPrint)(const PAF_ALG_AllocInit *pInit, Int sizeofInit, PAF_IALG_Config *p);
90     Void (*commonPrint)(IALG_MemRec common[], PAF_IALG_Config *p);
91     Void (*bufMemPrint)(Int z, Int size, Int heapId, Int bufType);
92     Void (*memStatusPrint)(
93         CString header, 
94         HeapMem_Handle hInternalHeap, 
95         HeapMem_Handle hInternal1Heap, 
96         HeapMem_Handle hExternalHeap, 
97         HeapMem_Handle hInternal1HeapShm, 
98         HeapMem_Handle hExternalHeapShm, 
99         HeapMem_Handle hExternalNoncachedHeapShm);
100 } PAF_ASIT_Fxns;
102 // Audio Stream Input Task (ASIT) parameters
103 typedef struct PAF_ASIT_Params {
104     const PAF_ASIT_Fxns *fxns;
105     struct {
106         SmInt master;
107         SmInt inputs;
108         SmInt input1;
109         SmInt inputN;
110         SmInt decodes;
111         SmInt decode1;
112         SmInt decodeN;
113         SmInt streams;
114         SmInt stream1; /* unused */
115         SmInt streamN; /* unused */
116         SmInt encodes;
117         SmInt encode1;
118         SmInt encodeN;
119         SmInt outputs;
120         SmInt output1;
121         SmInt outputN;
122     } zone;
123     const SmInt *inputsFromDecodes;
124     const SmInt *outputsFromEncodes;
125     struct {
126         int *pHeapIdIntern;             // INT memory heap ID
127         int *pHeapIdExtern;             // EXT memory heap ID
128         int *pHeapIdInpbuf;             // IB buffer heap ID
129         int *pHeapIdOutbuf;             // OB buffer heap ID
130         int *pHeapIdFrmbuf;             // Frame buffer heap ID
131         int *pHeapIdIntern1;            // INT1 memory heap ID
132         int *pHeapIdInt1Shm;            // INT1 SHared Memory heap ID
133         int *pHeapIdExtShm;             // EXT SHared Memory heap ID
134         int *pHeapIdExtNonCachedShm;    // EXT Non-Cached SHared Memory heap ID
135         int clear; 
136     } heap;
137     struct {
138         const IALG_MemSpace *space;
139     } common;
140     const LgInt *z_rx_bufsiz;
141     const LgInt *z_tx_bufsiz;
142     const SmInt *z_numchan;
143     MdInt framelength;
144     const PAF_AudioFunctions *pAudioFrameFunctions;
145     const struct PAF_ASP_ChainFxns *pChainFxns;
146     const PAF_InpBufStatus *pInpBufStatus;
147     const PAF_DecodeStatus * const *z_pDecodeStatus;
148     const PAF_OutBufStatus *pOutBufStatus;
149     const PAF_EncodeStatus * const *z_pEncodeStatus;
150     const PAF_VolumeStatus *pVolumeStatus;
151     const PAF_ASP_AlgKey *pDecAlgKey;
152     const PAF_ASP_AlgKey *pEncAlgKey;
153     const PAF_ASP_SioMap *pDecSioMap;
154     const SmInt *streamsFromDecodes;
155     const SmInt *streamsFromEncodes;
156     const MdInt maxFramelength;
157     const SmInt *streamOrder;
158     const PAF_ASP_LinkInit * const (*i_inpLinkInit);
159     const PAF_ASP_LinkInit * const (*i_outLinkInit);
160     const PAF_ASP_outNumBufMap *  const (*poutNumBufMap);
161     const PAF_MetadataBufStatus *pMetadataBufStatus;
162     const PAF_AudioFrameBufStatus *pAudioFrameBufStatus;
163     const PAF_AST_DecOpCircBufStatus * const *z_pDecOpCircBufStatus;    
164 } PAF_ASIT_Params;
166 // Audio Stream Input Task (ASIT) patchs
167 typedef struct PAF_ASIT_Patchs {
168     const PAF_SIO_ParamsN * devinp;
169     //const PAF_SIO_ParamsN * devout;
170     //const PAF_ASP_LinkInit * const (*i_decLinkInit);
171     //const PAF_ASP_LinkInit * const (*i_aspLinkInit)[GEARS];
172     //const PAF_ASP_LinkInit * const (*i_encLinkInit);
173 } PAF_ASIT_Patchs;
175 enum {
176     ASIP_NO_ERR,
177     ASIP_ERR_AUTO_DETECION,
178     ASIP_ERR_NO_MATCHING_SOURCE,
179     ASIP_ERR_SWITCH_TO_PCM,
180     ASIP_ERR_D10_CFG,
181     ASIP_ERR_MCASP_CFG,
182     ASIP_ERR_INPUT_CFG,
183     ASIP_ERR_DECODE_INIT,
184     ASIP_ERR_DECODE_COMMAND,
185     ASIP_ERR_DECODE_INFO1,
186     ASIP_ERR_DECODE_INFO2,
187     ASIP_ERR_DECODE_DATA,
188     ASIP_ERR_DECODE_FINAL,
189     ASIP_ERR_DECODE_COMPLETE,
190     ASIP_ERR_DECODE_MSG,
191     ASIP_ERR_DECODE_QUIT,
192     ASIP_ERR_ABORT
193 };
196 enum {
197     ASIT_RESET,
198     ASIT_SOURCE_DETECTION,
199     ASIT_PCM_TRANSITION,
200     ASIT_DECODE_PROCESSING
201 };
203 enum {
204     ASIT_NO_ERR,
205     ASIT_ERR_IOBUFF_INIT,
206     ASIT_ERR_IODATA_INIT,
207     ASIT_ERR_IOPYH_INIT,
208     ASIT_ERR_INPDATA_PROC,
209     ASIT_ERR_INPBUF_UNDERFLOW,
210     ASIT_ERR_AUTO_DETECION,
211     ASIT_ERR_NO_MATCHING_SOURCE,
212     ASIT_ERR_SWITCH_TO_PCM,
213     ASIT_ERR_D10_CFG,
214     ASIT_ERR_MCASP_CFG,
215     ASIT_ERR_INPUT_CFG,
216     ASIT_ERR_DECODE_INIT,
217     ASIT_ERR_DECODE,
218     ASIT_ERR_DECODE_COMMAND,
219     ASIT_ERR_DECODE_INFO1,
220     ASIT_ERR_DECODE_INFO2,
221     ASIT_ERR_DECODE_DATA,
222     ASIT_ERR_DECODE_FINAL,
223     ASIT_ERR_DECODE_COMPLETE,
224     ASIT_ERR_DECODE_MSG,
225     ASIT_ERR_DECODE_QUIT,
226     ASIP_ERR_DECODE_ABORT,
227     ASIT_ERR_EVENTS,
228     ASIT_ERR_ABORT
229 };
231 enum {
232     DEC_NO_ERR,
233     DEC_ERR_SOURCE_NONE,
234     DEC_ERR_ASPERR_ABORT,
235     DEC_ERR_ASPERR_QUIT,
236     DEC_ERR_WRONG_MSG,
237     DEC_ERR_INFO_SNDMSG,
238     DEC_ERR_INFO_ACKMSG,
239     DEC_ERR_DECODE_SNDMSG,
240     DEC_ERR_DECODE_ACKMSG,
241     DEC_ERR_DECODE_FINAL,
242     DEC_ERR_COMPLETE_MSG
243 };
246 #define DEC_MSGMSK_INPDATA   0x1 // Input data message
247 #define DEC_MSGMSK_RXACK     0x2 // Receive acknowledge message
248 #define DEC_MSGMSK_INFOACK   0x4 // temp, will be removed
249 #define DEC_MSGMSK_DECACK    0x8 // temp, will be removed
252 // Input I/O structure
253 typedef struct PAF_AST_InpIO {
254     ioPhyHandle_t        hIoPhy;     /* handle to I/O physical layer */
255     ioBuffHandle_t       hIoBuff;    /* handle to I/O buffer management */
256     ioDataHandle_t       hIoData;    /* handle to I/O data processing */
257     Ptr                  hMcaspChan; /* handle to McASP LLD channel */
258     const void           *pRxParams; /* pointer to D10 Rx Params */
260     Int sourceSelect;
261     Int sourceProgram;
263     Int       preSyncState;
264     Int       numPrimeXfers;
265     Int       mcaspXferErr;
266 /*
267     void     *mcaspRxBuf1;
268     void     *mcaspRxBuf2;
269     uint32_t  mcaspRxSize1;
270     uint32_t  mcaspRxSize2;
271     Int       mcaspRxtwoXfers;
272 */
273     // debugging counters
274     //uint32_t numXferStart;
275     //uint32_t numXferFinish;
276     //uint32_t numXferInterm;
277     uint32_t numInputOverrun;
278     uint32_t numUnderflow;
279     uint32_t numAsitRestart;
280     uint32_t numAsitDecodeQuit;
281     uint32_t numFrameReceived;
282     uint32_t numPcmFrameReceived;
284     size_t         phyXferSize;
285     int_fast32_t   pcmSwitchHangOver;
286     uint_least16_t asipState;
287     //uint_least16_t asipProcState;
288     bool           buffReadComplete;
289     bool           swapData;
290     bool           firstTimeInit;
291 } PAF_AST_IoInp;
293 // Decoder structure
294 typedef struct asipDecProc_s {
295     Int state;
296     Int frame;
297     Int block;
299     Int majorAuFound;
300     Int initDone;
301     Int decodeAckDelayed;
302 } asipDecProc_t;
304 // Audio Stream Input Task (ASIT) configuration
305 typedef struct PAF_ASIT_Config {
306     Task_Handle taskHandle;             // ASIT handle
307     ACP_Handle acp;                     // ASIT local ACP handle
308     AspMsgMaster_Handle hAspMsgMaster;  // ASIT message master handle
309     PAF_ASPM_Config *pAspmCfg;          // ASIT/ASOT shared configuration
310     PAF_AST_Config *pAstCfg;            // ASIT/ASOT/ASDT shared configuration
311     PAF_AST_IoInp *pIoInp;              // ASIT IO configuration
312     asipDecProc_t inpDec;
313 } PAF_ASIT_Config;
316 // ASIT event IDs
317 #define ASIT_EVTMSK_NONE        0x0
318 #define ASIT_EVTMSK_INPDATA     0x1 // Input data (Rx McASP EDMA) event
319 #define ASIT_EVTMSK_RXACK       0x2 // Receive acknowledge (IPC MessageQ) message event
320 #define ASIT_EVTMSK_INFOACK     0x4 // temp, will be removed
321 #define ASIT_EVTMSK_DECACK      0x8 // temp, will be removed
323 // ASIT event handle
324 extern Event_Handle gAsitEvtHandle;
326 // ASIT Sync event handle
327 extern SyncEvent_Handle gAsitSyncEvtHandle;
329 // ASIT ASP messaging
330 #define ASIT_ASP_MSG_HEAP_ID        ( 0 )                           // ASIT message master heap Id
331 #define ASIT_ASP_MSG_MASTER_NUMSGS  ( ASP_MSG_MASTER_DEF_NUMMSGS )  // ASIT message master number of messages
333 // ASIT configuration
334 extern PAF_ASIT_Config gPAF_ASIT_config;
337 //   Purpose:   Audio Stream Input Task Function for initialization of data pointers
338 //              by allocation of memory.
339 Int 
340 PAF_ASIT_initPhaseMalloc(
341     const PAF_ASIT_Params *pP, 
342     const PAF_ASIT_Patchs *pQ, 
343     PAF_ASIT_Config *pAsitCfg
344 );
346 //   Purpose:   Audio Stream Input Task Function for initialization of data values
347 //              from parameters.
348 Int
349 PAF_ASIT_initPhaseConfig(
350     const PAF_ASIT_Params *pP, 
351     const PAF_ASIT_Patchs *pQ, 
352     PAF_ASIT_Config *pAsitCfg
353 );
355 //   Purpose:   Audio Stream Input Task Function for initialization of ACP by
356 //              instantiation of the algorithm.
357 Int
358 PAF_ASIT_initPhaseAcpAlg(
359     const PAF_ASIT_Params *pP, 
360     const PAF_ASIT_Patchs *pQ, 
361     PAF_ASIT_Config *pAsitCfg
362 );
364 //   Purpose:   Audio Stream Input Task Function for allocation of common memory.
365 Int
366 PAF_ASIT_initPhaseCommon(
367     const PAF_ASIT_Params *pP, 
368     const PAF_ASIT_Patchs *pQ, 
369     PAF_ASIT_Config *pAsitCfg
370 );
372 //   Purpose:   Audio Stream Input Task Function for initialization of ASP algorithms.
373 Int
374 PAF_ASIT_initPhaseAspAlg(
375     const PAF_ASIT_Params *pP, 
376     const PAF_ASIT_Patchs *pQ, 
377     PAF_ASIT_Config *pAsitCfg
378 );
380 //   Purpose:   Audio Stream Input Task Function for initialization of data values
381 //              from parameters for Algorithm Keys.
382 Int
383 PAF_ASIT_initPhaseAlgKey(
384     const PAF_ASIT_Params *pP, 
385     const PAF_ASIT_Patchs *pQ, 
386     PAF_ASIT_Config *pAsitCfg
387 );
389 //   Purpose:   Audio Stream Input Task Function for initialization of Decoder Output Circular Buffer.
390 Int
391 PAF_ASIT_initPhaseDecOpCircBuf(
392     const PAF_ASIT_Params *pP, 
393     const PAF_ASIT_Patchs *pQ, 
394     PAF_ASIT_Config *pAsitCfg
395 );
397 //   Purpose:   Audio Stream Input Task Function for initialization of Input Devices.
398 Int
399 PAF_ASIT_initPhaseDevice(
400     const PAF_ASIT_Params *pP, 
401     const PAF_ASIT_Patchs *pQ, 
402     PAF_ASIT_Config *pAsitCfg
403 );
405 //   Purpose:   Audio Stream Input Task Function for initialization of Output Init-Sync.
406 Int
407 PAF_ASIT_initPhaseOutIS(
408     const PAF_ASIT_Params *pP, 
409     const PAF_ASIT_Patchs *pQ, 
410     PAF_ASIT_Config *pAsdtCfg
411 );
414 #if 0
415 //   Purpose:   Audio Stream Task Function for initialization or reinitiali-
416 //              zation of the Audio Frame(s) by loading of data values of a
417 //              time-varying nature.
418 Int
419 PAF_AST_initFrame1(
420     const PAF_ASIT_Params *pP, 
421     const PAF_ASIT_Patchs *pQ, 
422     PAF_AST_Config *pAsitCfg, 
423     Int z, 
424     Int apply
425 );
426 #endif
428 //   Purpose:   Audio Stream Task Function for processing audio data to
429 //              determine the input type without output.
430 Int
431 PAF_ASIT_autoProcessing(
432     const PAF_ASIT_Params *pP, 
433     const PAF_ASIT_Patchs *pQ, 
434     PAF_ASIT_Config *pAsitCfg, 
435     Int inputTypeSelect, 
436     ALG_Handle pcmAlgMaster);
438 //   Purpose:   Audio Stream Input Task Function for processing audio data.
439 //
440 Int
441 PAF_ASIT_decodeProcessing(
442     const PAF_ASIT_Params *pP, 
443     const PAF_ASIT_Patchs *pQ, 
444     PAF_ASIT_Config *pAsitCfg, 
445     Int sourceSelect
446 );
448 //   Purpose:   Decoding Function for processing Decode Commands.
449 Int
450 PAF_ASIT_decodeCommand(
451     const PAF_ASIT_Params *pP, 
452     const PAF_ASIT_Patchs *pQ, 
453     PAF_ASIT_Config *pAsitCfg
454 );
456 //   Purpose:   Decoding Function for reinitializing the decoding process.
457 Int
458 PAF_ASIT_decodeInit(
459     const PAF_ASIT_Params *pP, 
460     const PAF_ASIT_Patchs *pQ, 
461     PAF_ASIT_Config *pAsitCfg, 
462     Int sourceSelect
463 );
465 //   Purpose:   Decoding Function for processing information in a manner that
466 //              is common for both initial and subsequent frames of input data.
467 Int
468 PAF_ASIT_decodeInfo(
469     const PAF_ASIT_Params *pP, 
470     const PAF_ASIT_Patchs *pQ, 
471     PAF_ASIT_Config *pAsitCfg, 
472     Int frame, 
473     Int block
474 );
476 //   Purpose:   Decoding Function for processing information in a manner that
477 //              is unique to initial frames of input data.
478 Int
479 PAF_ASIT_decodeInfo1(
480     const PAF_ASIT_Params *pP, 
481     const PAF_ASIT_Patchs *pQ, 
482     PAF_ASIT_Config *pAsitCfg, 
483     Int frame, 
484     Int block
485 );
487 //   Purpose:   Decoding Function for processing information in a manner that
488 //              is unique to frames of input data other than the initial one.
489 Int
490 PAF_ASIT_decodeInfo2(
491     const PAF_ASIT_Params *pP, 
492     const PAF_ASIT_Patchs *pQ, 
493     PAF_ASIT_Config *pAsitCfg, 
494     Int frame, 
495     Int block
496 );
498 #if 0
499 //   Purpose:   Decoding Function for processing that occurs subsequent to
500 //              information processing but antecedent to timing processing
501 //              for frames of input data other than the initial one.
502 Int
503 PAF_AST_decodeCont(
504     const PAF_ASIT_Params *pP, 
505     const PAF_ASIT_Patchs *pQ, 
506     PAF_ASIT_Config *pAsitCfg, 
507     ALG_Handle decAlg[], 
508     Int frame, 
509     Int block
510 );
511 #endif
513 //   Purpose:   Decoding Function for processing of input data by the
514 //              Decode Algorithm.
515 Int
516 PAF_ASIT_decodeDecode(
517     const PAF_ASIT_Params *pP, 
518     const PAF_ASIT_Patchs *pQ, 
519     PAF_ASIT_Config *pAsitCfg, 
520     Int sourceSelect, 
521     Int frame, 
522     Int block
523 );
525 //   Purpose:   Decoding Function for determining whether processing of the
526 //              current frame is complete.
527 Int
528 PAF_ASIT_decodeFinalTest(
529     const PAF_ASIT_Params *pP, 
530     const PAF_ASIT_Patchs *pQ, 
531     PAF_ASIT_Config *pAsitCfg, 
532     Int frame, 
533     Int block
534 );
536 //   Purpose:   Decoding Function for terminating the decoding process.
537 Int
538 PAF_ASIT_decodeComplete(
539     const PAF_ASIT_Params *pP, 
540     const PAF_ASIT_Patchs *pQ, 
541     PAF_ASIT_Config *pAsitCfg, 
542     ALG_Handle decAlg[], 
543     Int frame, 
544     Int block
545 );
547 //   Purpose:   Audio Stream Input Task Function for selecting the devices used
548 //              for input.
549 Int
550 PAF_ASIT_selectDevices(
551     const PAF_ASIT_Params *pP, 
552     const PAF_ASIT_Patchs *pQ, 
553     PAF_ASIT_Config *pAsitCfg
554 );
556 //   Purpose:   Audio Stream Input Task Function for selecting the sources used
557 //              for decoding of input to output.
558 Int
559 PAF_ASIT_sourceDecode(
560     const PAF_ASIT_Params *pP, 
561     const PAF_ASIT_Patchs *pQ, 
562     PAF_ASIT_Config *pAsitCfg, 
563     Int x
564 );
566 //   Purpose:   Common Function for processing algorithm chains.
567 Int
568 PAF_AST_streamChainFunction(
569     const PAF_ASIT_Params *pP, 
570     const PAF_ASIT_Patchs *pQ, 
571     PAF_ASIT_Config *pAsitCfg, 
572     Int iChainFrameFxns, 
573     Int abortOnError, 
574     Int logArg
575 );
577 //   Purpose:   writing 8-bit integer to shared memeory
578 static inline
579 sharedMemWriteInt8(
580         volatile XDAS_Int8 *address, /* address to write to */
581         Int8 value,                  /* value to write to the adddress */
582         Int gateIdx)                 /* GateMP Index, defined in statusOp_common.h */
584 #ifdef NON_CACHE_STATUS
585         statusOp_write((void *)address, (void *)&value, sizeof(Int8), gateIdx);
586 #else
587         *address = value;
588 #endif
591 //   Purpose:   read 8-bit integer from shared memeory
592 static inline Int8               /* return the value read in the shared memory */
593 sharedMemReadInt8(
594         volatile XDAS_Int8 *address, /* address to read from */
595         Int gateIdx)                 /* GateMP Index, defined in statusOp_common.h */
597 #ifdef NON_CACHE_STATUS
598         Int8 tempVar;
599         statusOp_read((void *)&tempVar, (void *)address, sizeof(Int8), gateIdx);
601         return tempVar;
602 #else
603         return(*address);
604 #endif
607 //   Purpose:   writing 32-bit integer to shared memeory
608 static inline sharedMemWriteInt(volatile XDAS_Int32 *address, Int value, Int gateIdx)
610 #ifdef NON_CACHE_STATUS
611         statusOp_write((void *)address, (void *)&value, sizeof(Int), gateIdx);
612 #else
613         *address = value;
614 #endif
617 //   Purpose:   read 32-bit integer from shared memeory
618 static inline Int sharedMemReadInt(volatile XDAS_Int32 *address, Int gateIdx)
620 #ifdef NON_CACHE_STATUS
621         Int tempVar;
622         statusOp_read((void *)&tempVar, (void *)address, sizeof(Int), gateIdx);
624         return tempVar;
625 #else
626         return(*address);
627 #endif
630 Int asitUpdateInputStatus(const void *pRxParams, PAF_InpBufStatus *pStatus,
631                           PAF_InpBufConfig *pInpBuf);
632 /*
633 Int asipDecodeInit(
634         const PAF_ASIT_Params *pP,
635         PAF_ASIT_Config *pAsitCfg,
636         Int sourceSelect);
637 */
638 /*Int asipDecodeProcessing(
639         const PAF_ASIT_Params *pP,
640         const PAF_ASIT_Patchs *pQ,
641         PAF_ASIT_Config *pAsitCfg,
642         Int sourceSelect);*/
643 Int asitDecodeProcessing(const PAF_ASIT_Params *pP,
644                          const PAF_ASIT_Patchs *pQ,
645                          PAF_ASIT_Config       *pAsitCfg,
646                          UInt asitEvents);
648 Int decDecodeInit(
649         const PAF_ASIT_Params *pP,
650         PAF_ASIT_Config *pAsitCfg,
651         Int sourceSelect);
653 Int decDecodeFsm(
654         const PAF_ASIT_Params *pP,
655         const PAF_ASIT_Patchs *pQ,
656         PAF_ASIT_Config *pAsitCfg,
657         Int sourceSelect,
658         UInt decMsg);
660 Int getFrameLengthSourceSel(
661         const PAF_ASIT_Params *pP,
662         Int8 sourceSelect);
664 Int rxDecodePcm(PAF_AST_IoInp  *pInp);
666 Int rxDecodeBitStream(PAF_AST_IoInp  *pInp);
668 Int rxDecodePlayZero(PAF_AST_IoInp  *pInp);
671 #endif /* _ASIP_H_ */