0d8dbcde7fdff2fbec69b7438b16022ba04bceaf
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_
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_AUTODET_TIME_OUT,
206 ASIT_ERR_IOBUFF_INIT,
207 ASIT_ERR_IODATA_INIT,
208 ASIT_ERR_IOPHY_INIT,
209 ASIT_ERR_INPDATA_PROC,
210 ASIT_ERR_INPBUF_UNDERFLOW,
211 ASIT_ERR_AUTO_DETECION,
212 ASIT_ERR_NO_MATCHING_SOURCE,
213 ASIT_ERR_SWITCH_TO_PCM,
214 ASIT_ERR_D10_CFG,
215 ASIT_ERR_MCASP_CFG,
216 ASIT_ERR_INPUT_CFG,
217 ASIT_ERR_DECODE_INIT,
218 ASIT_ERR_DECODE,
219 ASIT_ERR_DECODE_COMMAND,
220 ASIT_ERR_DECODE_INFO1,
221 ASIT_ERR_DECODE_INFO2,
222 ASIT_ERR_DECODE_DATA,
223 ASIT_ERR_DECODE_FINAL,
224 ASIT_ERR_DECODE_COMPLETE,
225 ASIT_ERR_DECODE_MSG,
226 ASIT_ERR_DECODE_QUIT,
227 ASIP_ERR_DECODE_ABORT,
228 ASIT_ERR_EVENTS,
229 ASIT_ERR_ABORT
230 };
232 enum {
233 DEC_NO_ERR,
234 DEC_ERR_SOURCE_NONE,
235 DEC_ERR_ASPERR_ABORT,
236 DEC_ERR_ASPERR_QUIT,
237 DEC_ERR_WRONG_MSG,
238 DEC_ERR_INFO_SNDMSG,
239 DEC_ERR_INFO_ACKMSG,
240 DEC_ERR_DECODE_SNDMSG,
241 DEC_ERR_DECODE_ACKMSG,
242 DEC_ERR_DECODE_FINAL,
243 DEC_ERR_COMPLETE_MSG,
244 DEC_ERR_COMPLETE_ACKMSG,
245 DEC_ERR_COMPLETE_INFO_ACKMSG,
246 DEC_ERR_COMPLETE_DECODE_ACKMSG
247 };
250 #define DEC_MSGMSK_INPDATA 0x1 // Input data message
251 #define DEC_MSGMSK_RXACK 0x2 // Receive acknowledge message
252 #define DEC_MSGMSK_INFOACK 0x4 // temp, will be removed
253 #define DEC_MSGMSK_DECACK 0x8 // temp, will be removed
256 // Input I/O structure
257 typedef struct PAF_AST_InpIO {
258 ioPhyHandle_t hIoPhy; /* handle to I/O physical layer */
259 ioBuffHandle_t hIoBuff; /* handle to I/O buffer management */
260 ioDataHandle_t hIoData; /* handle to I/O data processing */
261 Ptr hMcaspChan; /* handle to McASP LLD channel */
262 const void *pRxParams; /* pointer to D10 Rx Params */
264 Int sourceSelect;
265 Int sourceProgram;
267 Int stride;
268 Int preSyncState;
269 Int numPrimeXfers;
270 Int mcaspXferErr;
271 /*
272 void *mcaspRxBuf1;
273 void *mcaspRxBuf2;
274 uint32_t mcaspRxSize1;
275 uint32_t mcaspRxSize2;
276 Int mcaspRxtwoXfers;
277 */
278 // debugging counters
279 //uint32_t numXferStart;
280 //uint32_t numXferFinish;
281 //uint32_t numXferInterm;
282 uint32_t numInputOverrun;
283 uint32_t numUnderflow;
284 uint32_t numAsitRestart;
285 uint32_t numAsitDecodeQuit;
286 uint32_t numFrameReceived;
287 uint32_t numPcmFrameReceived;
289 size_t phyXferSize;
290 int_fast32_t pcmSwitchHangOver;
291 uint_least16_t asipState;
292 //uint_least16_t asipProcState;
293 bool buffReadComplete;
294 bool swapData;
295 bool firstTimeInit;
296 } PAF_AST_IoInp;
298 #define DEC_INPBUF_CONFIG_QUEUE_SIZE 8
299 // Decoder structure
300 typedef struct asipDecProc_s {
301 Int state;
302 Int frame;
303 Int block;
305 Int majorAuFound;
306 Int initDone;
307 Int decodeAckDelayed;
309 PAF_InpBufConfig inpBufConfigQueue[DEC_INPBUF_CONFIG_QUEUE_SIZE];
310 Int rdidx;
311 Int wridx;
312 } asipDecProc_t;
314 // Audio Stream Input Task (ASIT) configuration
315 typedef struct PAF_ASIT_Config {
316 Task_Handle taskHandle; // ASIT handle
317 ACP_Handle acp; // ASIT local ACP handle
318 AspMsgMaster_Handle hAspMsgMaster; // ASIT message master handle
319 PAF_ASPM_Config *pAspmCfg; // ASIT/ASOT shared configuration
320 PAF_AST_Config *pAstCfg; // ASIT/ASOT/ASDT shared configuration
321 PAF_AST_IoInp *pIoInp; // ASIT IO configuration
322 asipDecProc_t inpDec;
323 } PAF_ASIT_Config;
326 // ASIT event IDs
327 #define ASIT_EVTMSK_NONE 0x0
328 #define ASIT_EVTMSK_INPDATA 0x1 // Input data (Rx McASP EDMA) event
329 #define ASIT_EVTMSK_RXACK 0x2 // Receive acknowledge (IPC MessageQ) message event
330 #define ASIT_EVTMSK_INFOACK 0x4 // temp, will be removed
331 #define ASIT_EVTMSK_DECACK 0x8 // temp, will be removed
333 // ASIT event handle
334 extern Event_Handle gAsitEvtHandle;
336 // ASIT Sync event handle
337 extern SyncEvent_Handle gAsitSyncEvtHandle;
339 // ASIT ASP messaging
340 #define ASIT_ASP_MSG_HEAP_ID ( 0 ) // ASIT message master heap Id
341 #define ASIT_ASP_MSG_MASTER_NUMSGS ( ASP_MSG_MASTER_DEF_NUMMSGS ) // ASIT message master number of messages
343 // ASIT configuration
344 extern PAF_ASIT_Config gPAF_ASIT_config;
347 // Purpose: Audio Stream Input Task Function for initialization of data pointers
348 // by allocation of memory.
349 Int
350 PAF_ASIT_initPhaseMalloc(
351 const PAF_ASIT_Params *pP,
352 const PAF_ASIT_Patchs *pQ,
353 PAF_ASIT_Config *pAsitCfg
354 );
356 // Purpose: Audio Stream Input Task Function for initialization of data values
357 // from parameters.
358 Int
359 PAF_ASIT_initPhaseConfig(
360 const PAF_ASIT_Params *pP,
361 const PAF_ASIT_Patchs *pQ,
362 PAF_ASIT_Config *pAsitCfg
363 );
365 // Purpose: Audio Stream Input Task Function for initialization of ACP by
366 // instantiation of the algorithm.
367 Int
368 PAF_ASIT_initPhaseAcpAlg(
369 const PAF_ASIT_Params *pP,
370 const PAF_ASIT_Patchs *pQ,
371 PAF_ASIT_Config *pAsitCfg
372 );
374 // Purpose: Audio Stream Input Task Function for allocation of common memory.
375 Int
376 PAF_ASIT_initPhaseCommon(
377 const PAF_ASIT_Params *pP,
378 const PAF_ASIT_Patchs *pQ,
379 PAF_ASIT_Config *pAsitCfg
380 );
382 // Purpose: Audio Stream Input Task Function for initialization of ASP algorithms.
383 Int
384 PAF_ASIT_initPhaseAspAlg(
385 const PAF_ASIT_Params *pP,
386 const PAF_ASIT_Patchs *pQ,
387 PAF_ASIT_Config *pAsitCfg
388 );
390 // Purpose: Audio Stream Input Task Function for initialization of data values
391 // from parameters for Algorithm Keys.
392 Int
393 PAF_ASIT_initPhaseAlgKey(
394 const PAF_ASIT_Params *pP,
395 const PAF_ASIT_Patchs *pQ,
396 PAF_ASIT_Config *pAsitCfg
397 );
399 // Purpose: Audio Stream Input Task Function for initialization of Decoder Output Circular Buffer.
400 Int
401 PAF_ASIT_initPhaseDecOpCircBuf(
402 const PAF_ASIT_Params *pP,
403 const PAF_ASIT_Patchs *pQ,
404 PAF_ASIT_Config *pAsitCfg
405 );
407 // Purpose: Audio Stream Input Task Function for initialization of Input Devices.
408 Int
409 PAF_ASIT_initPhaseDevice(
410 const PAF_ASIT_Params *pP,
411 const PAF_ASIT_Patchs *pQ,
412 PAF_ASIT_Config *pAsitCfg
413 );
415 // Purpose: Audio Stream Input Task Function for initialization of Output Init-Sync.
416 Int
417 PAF_ASIT_initPhaseOutIS(
418 const PAF_ASIT_Params *pP,
419 const PAF_ASIT_Patchs *pQ,
420 PAF_ASIT_Config *pAsdtCfg
421 );
424 #if 0
425 // Purpose: Audio Stream Task Function for initialization or reinitiali-
426 // zation of the Audio Frame(s) by loading of data values of a
427 // time-varying nature.
428 Int
429 PAF_AST_initFrame1(
430 const PAF_ASIT_Params *pP,
431 const PAF_ASIT_Patchs *pQ,
432 PAF_AST_Config *pAsitCfg,
433 Int z,
434 Int apply
435 );
436 #endif
438 // Purpose: Audio Stream Task Function for processing audio data to
439 // determine the input type without output.
440 Int
441 PAF_ASIT_autoProcessing(
442 const PAF_ASIT_Params *pP,
443 const PAF_ASIT_Patchs *pQ,
444 PAF_ASIT_Config *pAsitCfg,
445 Int inputTypeSelect,
446 ALG_Handle pcmAlgMaster);
448 // Purpose: Audio Stream Input Task Function for processing audio data.
449 //
450 Int
451 PAF_ASIT_decodeProcessing(
452 const PAF_ASIT_Params *pP,
453 const PAF_ASIT_Patchs *pQ,
454 PAF_ASIT_Config *pAsitCfg,
455 Int sourceSelect
456 );
458 // Purpose: Decoding Function for processing Decode Commands.
459 Int
460 PAF_ASIT_decodeCommand(
461 const PAF_ASIT_Params *pP,
462 const PAF_ASIT_Patchs *pQ,
463 PAF_ASIT_Config *pAsitCfg
464 );
466 // Purpose: Decoding Function for reinitializing the decoding process.
467 Int
468 PAF_ASIT_decodeInit(
469 const PAF_ASIT_Params *pP,
470 const PAF_ASIT_Patchs *pQ,
471 PAF_ASIT_Config *pAsitCfg,
472 Int sourceSelect
473 );
475 // Purpose: Decoding Function for processing information in a manner that
476 // is common for both initial and subsequent frames of input data.
477 Int
478 PAF_ASIT_decodeInfo(
479 const PAF_ASIT_Params *pP,
480 const PAF_ASIT_Patchs *pQ,
481 PAF_ASIT_Config *pAsitCfg,
482 Int frame,
483 Int block
484 );
486 // Purpose: Decoding Function for processing information in a manner that
487 // is unique to initial frames of input data.
488 Int
489 PAF_ASIT_decodeInfo1(
490 const PAF_ASIT_Params *pP,
491 const PAF_ASIT_Patchs *pQ,
492 PAF_ASIT_Config *pAsitCfg,
493 Int frame,
494 Int block
495 );
497 // Purpose: Decoding Function for processing information in a manner that
498 // is unique to frames of input data other than the initial one.
499 Int
500 PAF_ASIT_decodeInfo2(
501 const PAF_ASIT_Params *pP,
502 const PAF_ASIT_Patchs *pQ,
503 PAF_ASIT_Config *pAsitCfg,
504 Int frame,
505 Int block
506 );
508 #if 0
509 // Purpose: Decoding Function for processing that occurs subsequent to
510 // information processing but antecedent to timing processing
511 // for frames of input data other than the initial one.
512 Int
513 PAF_AST_decodeCont(
514 const PAF_ASIT_Params *pP,
515 const PAF_ASIT_Patchs *pQ,
516 PAF_ASIT_Config *pAsitCfg,
517 ALG_Handle decAlg[],
518 Int frame,
519 Int block
520 );
521 #endif
523 // Purpose: Decoding Function for processing of input data by the
524 // Decode Algorithm.
525 Int
526 PAF_ASIT_decodeDecode(
527 const PAF_ASIT_Params *pP,
528 const PAF_ASIT_Patchs *pQ,
529 PAF_ASIT_Config *pAsitCfg,
530 Int sourceSelect,
531 Int frame,
532 Int block
533 );
535 // Purpose: Decoding Function for determining whether processing of the
536 // current frame is complete.
537 Int
538 PAF_ASIT_decodeFinalTest(
539 const PAF_ASIT_Params *pP,
540 const PAF_ASIT_Patchs *pQ,
541 PAF_ASIT_Config *pAsitCfg,
542 Int frame,
543 Int block
544 );
546 // Purpose: Decoding Function for terminating the decoding process.
547 Int
548 PAF_ASIT_decodeComplete(
549 const PAF_ASIT_Params *pP,
550 const PAF_ASIT_Patchs *pQ,
551 PAF_ASIT_Config *pAsitCfg,
552 ALG_Handle decAlg[],
553 Int frame,
554 Int block
555 );
557 // Purpose: Audio Stream Input Task Function for selecting the devices used
558 // for input.
559 Int
560 PAF_ASIT_selectDevices(
561 const PAF_ASIT_Params *pP,
562 const PAF_ASIT_Patchs *pQ,
563 PAF_ASIT_Config *pAsitCfg
564 );
566 // Purpose: Audio Stream Input Task Function for selecting the sources used
567 // for decoding of input to output.
568 Int
569 PAF_ASIT_sourceDecode(
570 const PAF_ASIT_Params *pP,
571 const PAF_ASIT_Patchs *pQ,
572 PAF_ASIT_Config *pAsitCfg,
573 Int x
574 );
576 // Purpose: Common Function for processing algorithm chains.
577 Int
578 PAF_AST_streamChainFunction(
579 const PAF_ASIT_Params *pP,
580 const PAF_ASIT_Patchs *pQ,
581 PAF_ASIT_Config *pAsitCfg,
582 Int iChainFrameFxns,
583 Int abortOnError,
584 Int logArg
585 );
587 // Purpose: writing 8-bit integer to shared memeory
588 static inline
589 sharedMemWriteInt8(
590 volatile XDAS_Int8 *address, /* address to write to */
591 Int8 value, /* value to write to the adddress */
592 Int gateIdx) /* GateMP Index, defined in statusOp_common.h */
593 {
594 #ifdef NON_CACHE_STATUS
595 statusOp_write((void *)address, (void *)&value, sizeof(Int8), gateIdx);
596 #else
597 *address = value;
598 #endif
599 }
601 // Purpose: read 8-bit integer from shared memeory
602 static inline Int8 /* return the value read in the shared memory */
603 sharedMemReadInt8(
604 volatile XDAS_Int8 *address, /* address to read from */
605 Int gateIdx) /* GateMP Index, defined in statusOp_common.h */
606 {
607 #ifdef NON_CACHE_STATUS
608 Int8 tempVar;
609 statusOp_read((void *)&tempVar, (void *)address, sizeof(Int8), gateIdx);
611 return tempVar;
612 #else
613 return(*address);
614 #endif
615 }
617 // Purpose: writing 32-bit integer to shared memeory
618 static inline sharedMemWriteInt(volatile XDAS_Int32 *address, Int value, Int gateIdx)
619 {
620 #ifdef NON_CACHE_STATUS
621 statusOp_write((void *)address, (void *)&value, sizeof(Int), gateIdx);
622 #else
623 *address = value;
624 #endif
625 }
627 // Purpose: read 32-bit integer from shared memeory
628 static inline Int sharedMemReadInt(volatile XDAS_Int32 *address, Int gateIdx)
629 {
630 #ifdef NON_CACHE_STATUS
631 Int tempVar;
632 statusOp_read((void *)&tempVar, (void *)address, sizeof(Int), gateIdx);
634 return tempVar;
635 #else
636 return(*address);
637 #endif
638 }
640 Int asitUpdateInputStatus(const void *pRxParams, PAF_InpBufStatus *pStatus,
641 PAF_InpBufConfig *pInpBuf);
642 /*
643 Int asipDecodeInit(
644 const PAF_ASIT_Params *pP,
645 PAF_ASIT_Config *pAsitCfg,
646 Int sourceSelect);
647 */
648 /*Int asipDecodeProcessing(
649 const PAF_ASIT_Params *pP,
650 const PAF_ASIT_Patchs *pQ,
651 PAF_ASIT_Config *pAsitCfg,
652 Int sourceSelect);*/
653 Int asitDecodeProcessing(const PAF_ASIT_Params *pP,
654 const PAF_ASIT_Patchs *pQ,
655 PAF_ASIT_Config *pAsitCfg,
656 UInt asitEvents);
658 Int decDecodeInit(
659 const PAF_ASIT_Params *pP,
660 PAF_ASIT_Config *pAsitCfg,
661 Int sourceSelect);
663 Int decDecodeFsm(
664 const PAF_ASIT_Params *pP,
665 const PAF_ASIT_Patchs *pQ,
666 PAF_ASIT_Config *pAsitCfg,
667 Int sourceSelect,
668 UInt decMsg);
670 Int getFrameLengthSourceSel(
671 const PAF_ASIT_Params *pP,
672 Int8 sourceSelect);
674 Int rxDecodePcm(PAF_AST_IoInp *pInp);
676 Int rxDecodeBitStream(PAF_AST_IoInp *pInp);
678 Int rxDecodePlayZero(PAF_AST_IoInp *pInp);
681 #endif /* _ASIP_H_ */