]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - processor-sdk/performance-audio-sr.git/blob - pasdk/test_dsp/framework/audioStreamInpProc.h
PASDK 571: DTSX input and output working preliminarily:
[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     DEC_ERR_COMPLETE_ACKMSG, 
244     DEC_ERR_COMPLETE_INFO_ACKMSG,
245     DEC_ERR_COMPLETE_DECODE_ACKMSG
246 };
249 #define DEC_MSGMSK_INPDATA   0x1 // Input data message
250 #define DEC_MSGMSK_RXACK     0x2 // Receive acknowledge message
251 #define DEC_MSGMSK_INFOACK   0x4 // temp, will be removed
252 #define DEC_MSGMSK_DECACK    0x8 // temp, will be removed
255 // Input I/O structure
256 typedef struct PAF_AST_InpIO {
257     ioPhyHandle_t        hIoPhy;     /* handle to I/O physical layer */
258     ioBuffHandle_t       hIoBuff;    /* handle to I/O buffer management */
259     ioDataHandle_t       hIoData;    /* handle to I/O data processing */
260     Ptr                  hMcaspChan; /* handle to McASP LLD channel */
261     const void           *pRxParams; /* pointer to D10 Rx Params */
263     Int sourceSelect;
264     Int sourceProgram;
266     Int stride;
267     Int       preSyncState;
268     Int       numPrimeXfers;
269     Int       mcaspXferErr;
270 /*
271     void     *mcaspRxBuf1;
272     void     *mcaspRxBuf2;
273     uint32_t  mcaspRxSize1;
274     uint32_t  mcaspRxSize2;
275     Int       mcaspRxtwoXfers;
276 */
277     // debugging counters
278     //uint32_t numXferStart;
279     //uint32_t numXferFinish;
280     //uint32_t numXferInterm;
281     uint32_t numInputOverrun;
282     uint32_t numUnderflow;
283     uint32_t numAsitRestart;
284     uint32_t numAsitDecodeQuit;
285     uint32_t numFrameReceived;
286     uint32_t numPcmFrameReceived;
288     size_t         phyXferSize;
289     int_fast32_t   pcmSwitchHangOver;
290     uint_least16_t asipState;
291     //uint_least16_t asipProcState;
292     bool           buffReadComplete;
293     bool           swapData;
294     bool           firstTimeInit;
295 } PAF_AST_IoInp;
297 #define DEC_INPBUF_CONFIG_QUEUE_SIZE 8
298 // Decoder structure
299 typedef struct asipDecProc_s {
300     Int state;
301     Int frame;
302     Int block;
304     Int majorAuFound;
305     Int initDone;
306     Int decodeAckDelayed;
308     PAF_InpBufConfig inpBufConfigQueue[DEC_INPBUF_CONFIG_QUEUE_SIZE];
309     Int rdidx;
310     Int wridx;
311 } asipDecProc_t;
313 // Audio Stream Input Task (ASIT) configuration
314 typedef struct PAF_ASIT_Config {
315     Task_Handle taskHandle;             // ASIT handle
316     ACP_Handle acp;                     // ASIT local ACP handle
317     AspMsgMaster_Handle hAspMsgMaster;  // ASIT message master handle
318     PAF_ASPM_Config *pAspmCfg;          // ASIT/ASOT shared configuration
319     PAF_AST_Config *pAstCfg;            // ASIT/ASOT/ASDT shared configuration
320     PAF_AST_IoInp *pIoInp;              // ASIT IO configuration
321     asipDecProc_t inpDec;
322 } PAF_ASIT_Config;
325 // ASIT event IDs
326 #define ASIT_EVTMSK_NONE        0x0
327 #define ASIT_EVTMSK_INPDATA     0x1 // Input data (Rx McASP EDMA) event
328 #define ASIT_EVTMSK_RXACK       0x2 // Receive acknowledge (IPC MessageQ) message event
329 #define ASIT_EVTMSK_INFOACK     0x4 // temp, will be removed
330 #define ASIT_EVTMSK_DECACK      0x8 // temp, will be removed
332 // ASIT event handle
333 extern Event_Handle gAsitEvtHandle;
335 // ASIT Sync event handle
336 extern SyncEvent_Handle gAsitSyncEvtHandle;
338 // ASIT ASP messaging
339 #define ASIT_ASP_MSG_HEAP_ID        ( 0 )                           // ASIT message master heap Id
340 #define ASIT_ASP_MSG_MASTER_NUMSGS  ( ASP_MSG_MASTER_DEF_NUMMSGS )  // ASIT message master number of messages
342 // ASIT configuration
343 extern PAF_ASIT_Config gPAF_ASIT_config;
346 //   Purpose:   Audio Stream Input Task Function for initialization of data pointers
347 //              by allocation of memory.
348 Int 
349 PAF_ASIT_initPhaseMalloc(
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 data values
356 //              from parameters.
357 Int
358 PAF_ASIT_initPhaseConfig(
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 initialization of ACP by
365 //              instantiation of the algorithm.
366 Int
367 PAF_ASIT_initPhaseAcpAlg(
368     const PAF_ASIT_Params *pP, 
369     const PAF_ASIT_Patchs *pQ, 
370     PAF_ASIT_Config *pAsitCfg
371 );
373 //   Purpose:   Audio Stream Input Task Function for allocation of common memory.
374 Int
375 PAF_ASIT_initPhaseCommon(
376     const PAF_ASIT_Params *pP, 
377     const PAF_ASIT_Patchs *pQ, 
378     PAF_ASIT_Config *pAsitCfg
379 );
381 //   Purpose:   Audio Stream Input Task Function for initialization of ASP algorithms.
382 Int
383 PAF_ASIT_initPhaseAspAlg(
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 data values
390 //              from parameters for Algorithm Keys.
391 Int
392 PAF_ASIT_initPhaseAlgKey(
393     const PAF_ASIT_Params *pP, 
394     const PAF_ASIT_Patchs *pQ, 
395     PAF_ASIT_Config *pAsitCfg
396 );
398 //   Purpose:   Audio Stream Input Task Function for initialization of Decoder Output Circular Buffer.
399 Int
400 PAF_ASIT_initPhaseDecOpCircBuf(
401     const PAF_ASIT_Params *pP, 
402     const PAF_ASIT_Patchs *pQ, 
403     PAF_ASIT_Config *pAsitCfg
404 );
406 //   Purpose:   Audio Stream Input Task Function for initialization of Input Devices.
407 Int
408 PAF_ASIT_initPhaseDevice(
409     const PAF_ASIT_Params *pP, 
410     const PAF_ASIT_Patchs *pQ, 
411     PAF_ASIT_Config *pAsitCfg
412 );
414 //   Purpose:   Audio Stream Input Task Function for initialization of Output Init-Sync.
415 Int
416 PAF_ASIT_initPhaseOutIS(
417     const PAF_ASIT_Params *pP, 
418     const PAF_ASIT_Patchs *pQ, 
419     PAF_ASIT_Config *pAsdtCfg
420 );
423 #if 0
424 //   Purpose:   Audio Stream Task Function for initialization or reinitiali-
425 //              zation of the Audio Frame(s) by loading of data values of a
426 //              time-varying nature.
427 Int
428 PAF_AST_initFrame1(
429     const PAF_ASIT_Params *pP, 
430     const PAF_ASIT_Patchs *pQ, 
431     PAF_AST_Config *pAsitCfg, 
432     Int z, 
433     Int apply
434 );
435 #endif
437 //   Purpose:   Audio Stream Task Function for processing audio data to
438 //              determine the input type without output.
439 Int
440 PAF_ASIT_autoProcessing(
441     const PAF_ASIT_Params *pP, 
442     const PAF_ASIT_Patchs *pQ, 
443     PAF_ASIT_Config *pAsitCfg, 
444     Int inputTypeSelect, 
445     ALG_Handle pcmAlgMaster);
447 //   Purpose:   Audio Stream Input Task Function for processing audio data.
448 //
449 Int
450 PAF_ASIT_decodeProcessing(
451     const PAF_ASIT_Params *pP, 
452     const PAF_ASIT_Patchs *pQ, 
453     PAF_ASIT_Config *pAsitCfg, 
454     Int sourceSelect
455 );
457 //   Purpose:   Decoding Function for processing Decode Commands.
458 Int
459 PAF_ASIT_decodeCommand(
460     const PAF_ASIT_Params *pP, 
461     const PAF_ASIT_Patchs *pQ, 
462     PAF_ASIT_Config *pAsitCfg
463 );
465 //   Purpose:   Decoding Function for reinitializing the decoding process.
466 Int
467 PAF_ASIT_decodeInit(
468     const PAF_ASIT_Params *pP, 
469     const PAF_ASIT_Patchs *pQ, 
470     PAF_ASIT_Config *pAsitCfg, 
471     Int sourceSelect
472 );
474 //   Purpose:   Decoding Function for processing information in a manner that
475 //              is common for both initial and subsequent frames of input data.
476 Int
477 PAF_ASIT_decodeInfo(
478     const PAF_ASIT_Params *pP, 
479     const PAF_ASIT_Patchs *pQ, 
480     PAF_ASIT_Config *pAsitCfg, 
481     Int frame, 
482     Int block
483 );
485 //   Purpose:   Decoding Function for processing information in a manner that
486 //              is unique to initial frames of input data.
487 Int
488 PAF_ASIT_decodeInfo1(
489     const PAF_ASIT_Params *pP, 
490     const PAF_ASIT_Patchs *pQ, 
491     PAF_ASIT_Config *pAsitCfg, 
492     Int frame, 
493     Int block
494 );
496 //   Purpose:   Decoding Function for processing information in a manner that
497 //              is unique to frames of input data other than the initial one.
498 Int
499 PAF_ASIT_decodeInfo2(
500     const PAF_ASIT_Params *pP, 
501     const PAF_ASIT_Patchs *pQ, 
502     PAF_ASIT_Config *pAsitCfg, 
503     Int frame, 
504     Int block
505 );
507 #if 0
508 //   Purpose:   Decoding Function for processing that occurs subsequent to
509 //              information processing but antecedent to timing processing
510 //              for frames of input data other than the initial one.
511 Int
512 PAF_AST_decodeCont(
513     const PAF_ASIT_Params *pP, 
514     const PAF_ASIT_Patchs *pQ, 
515     PAF_ASIT_Config *pAsitCfg, 
516     ALG_Handle decAlg[], 
517     Int frame, 
518     Int block
519 );
520 #endif
522 //   Purpose:   Decoding Function for processing of input data by the
523 //              Decode Algorithm.
524 Int
525 PAF_ASIT_decodeDecode(
526     const PAF_ASIT_Params *pP, 
527     const PAF_ASIT_Patchs *pQ, 
528     PAF_ASIT_Config *pAsitCfg, 
529     Int sourceSelect, 
530     Int frame, 
531     Int block
532 );
534 //   Purpose:   Decoding Function for determining whether processing of the
535 //              current frame is complete.
536 Int
537 PAF_ASIT_decodeFinalTest(
538     const PAF_ASIT_Params *pP, 
539     const PAF_ASIT_Patchs *pQ, 
540     PAF_ASIT_Config *pAsitCfg, 
541     Int frame, 
542     Int block
543 );
545 //   Purpose:   Decoding Function for terminating the decoding process.
546 Int
547 PAF_ASIT_decodeComplete(
548     const PAF_ASIT_Params *pP, 
549     const PAF_ASIT_Patchs *pQ, 
550     PAF_ASIT_Config *pAsitCfg, 
551     ALG_Handle decAlg[], 
552     Int frame, 
553     Int block
554 );
556 //   Purpose:   Audio Stream Input Task Function for selecting the devices used
557 //              for input.
558 Int
559 PAF_ASIT_selectDevices(
560     const PAF_ASIT_Params *pP, 
561     const PAF_ASIT_Patchs *pQ, 
562     PAF_ASIT_Config *pAsitCfg
563 );
565 //   Purpose:   Audio Stream Input Task Function for selecting the sources used
566 //              for decoding of input to output.
567 Int
568 PAF_ASIT_sourceDecode(
569     const PAF_ASIT_Params *pP, 
570     const PAF_ASIT_Patchs *pQ, 
571     PAF_ASIT_Config *pAsitCfg, 
572     Int x
573 );
575 //   Purpose:   Common Function for processing algorithm chains.
576 Int
577 PAF_AST_streamChainFunction(
578     const PAF_ASIT_Params *pP, 
579     const PAF_ASIT_Patchs *pQ, 
580     PAF_ASIT_Config *pAsitCfg, 
581     Int iChainFrameFxns, 
582     Int abortOnError, 
583     Int logArg
584 );
586 //   Purpose:   writing 8-bit integer to shared memeory
587 static inline
588 sharedMemWriteInt8(
589         volatile XDAS_Int8 *address, /* address to write to */
590         Int8 value,                  /* value to write to the adddress */
591         Int gateIdx)                 /* GateMP Index, defined in statusOp_common.h */
593 #ifdef NON_CACHE_STATUS
594         statusOp_write((void *)address, (void *)&value, sizeof(Int8), gateIdx);
595 #else
596         *address = value;
597 #endif
600 //   Purpose:   read 8-bit integer from shared memeory
601 static inline Int8               /* return the value read in the shared memory */
602 sharedMemReadInt8(
603         volatile XDAS_Int8 *address, /* address to read from */
604         Int gateIdx)                 /* GateMP Index, defined in statusOp_common.h */
606 #ifdef NON_CACHE_STATUS
607         Int8 tempVar;
608         statusOp_read((void *)&tempVar, (void *)address, sizeof(Int8), gateIdx);
610         return tempVar;
611 #else
612         return(*address);
613 #endif
616 //   Purpose:   writing 32-bit integer to shared memeory
617 static inline sharedMemWriteInt(volatile XDAS_Int32 *address, Int value, Int gateIdx)
619 #ifdef NON_CACHE_STATUS
620         statusOp_write((void *)address, (void *)&value, sizeof(Int), gateIdx);
621 #else
622         *address = value;
623 #endif
626 //   Purpose:   read 32-bit integer from shared memeory
627 static inline Int sharedMemReadInt(volatile XDAS_Int32 *address, Int gateIdx)
629 #ifdef NON_CACHE_STATUS
630         Int tempVar;
631         statusOp_read((void *)&tempVar, (void *)address, sizeof(Int), gateIdx);
633         return tempVar;
634 #else
635         return(*address);
636 #endif
639 Int asitUpdateInputStatus(const void *pRxParams, PAF_InpBufStatus *pStatus,
640                           PAF_InpBufConfig *pInpBuf);
641 /*
642 Int asipDecodeInit(
643         const PAF_ASIT_Params *pP,
644         PAF_ASIT_Config *pAsitCfg,
645         Int sourceSelect);
646 */
647 /*Int asipDecodeProcessing(
648         const PAF_ASIT_Params *pP,
649         const PAF_ASIT_Patchs *pQ,
650         PAF_ASIT_Config *pAsitCfg,
651         Int sourceSelect);*/
652 Int asitDecodeProcessing(const PAF_ASIT_Params *pP,
653                          const PAF_ASIT_Patchs *pQ,
654                          PAF_ASIT_Config       *pAsitCfg,
655                          UInt asitEvents);
657 Int decDecodeInit(
658         const PAF_ASIT_Params *pP,
659         PAF_ASIT_Config *pAsitCfg,
660         Int sourceSelect);
662 Int decDecodeFsm(
663         const PAF_ASIT_Params *pP,
664         const PAF_ASIT_Patchs *pQ,
665         PAF_ASIT_Config *pAsitCfg,
666         Int sourceSelect,
667         UInt decMsg);
669 Int getFrameLengthSourceSel(
670         const PAF_ASIT_Params *pP,
671         Int8 sourceSelect);
673 Int rxDecodePcm(PAF_AST_IoInp  *pInp);
675 Int rxDecodeBitStream(PAF_AST_IoInp  *pInp);
677 Int rxDecodePlayZero(PAF_AST_IoInp  *pInp);
680 #endif /* _ASIP_H_ */