2 /*
3 Copyright (c) 2018, 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 DEC_ERR_COMPLETE_RESET_ACKMSG
248 };
251 #define DEC_MSGMSK_INPDATA 0x1 // Input data message
252 #define DEC_MSGMSK_RXACK 0x2 // Receive acknowledge message
253 #define DEC_MSGMSK_INFOACK 0x4 // temp, will be removed
254 #define DEC_MSGMSK_DECACK 0x8 // temp, will be removed
257 // Input I/O structure
258 typedef struct PAF_AST_InpIO {
259 ioPhyHandle_t hIoPhy; /* handle to I/O physical layer */
260 ioBuffHandle_t hIoBuff; /* handle to I/O buffer management */
261 ioDataHandle_t hIoData; /* handle to I/O data processing */
262 Ptr hMcaspChan; /* handle to McASP LLD channel */
263 const void *pRxParams; /* pointer to D10 Rx Params */
265 Int sourceSelect;
266 Int sourceProgram;
268 Int stride;
269 Int preSyncState;
270 Int numPrimeXfers;
271 Int mcaspXferErr;
272 /*
273 void *mcaspRxBuf1;
274 void *mcaspRxBuf2;
275 uint32_t mcaspRxSize1;
276 uint32_t mcaspRxSize2;
277 Int mcaspRxtwoXfers;
278 */
279 // debugging counters
280 //uint32_t numXferStart;
281 //uint32_t numXferFinish;
282 //uint32_t numXferInterm;
283 uint32_t numInputOverrun;
284 uint32_t numUnderflow;
285 uint32_t numAsitRestart;
286 uint32_t numAsitDecodeQuit;
287 uint32_t numFrameReceived;
288 uint32_t numPcmFrameReceived;
290 size_t phyXferSize;
291 int_fast32_t pcmSwitchHangOver;
292 uint_least16_t asipState;
293 //uint_least16_t asipProcState;
294 bool buffReadComplete;
295 bool swapData;
296 bool firstTimeInit;
297 } PAF_AST_IoInp;
299 #define DEC_INPBUF_CONFIG_QUEUE_SIZE 8
300 // Decoder structure
301 typedef struct asipDecProc_s {
302 Int state;
303 Int frame;
304 Int block;
306 Int majorAuFound;
307 Int initDone;
308 Int decodeAckDelayed;
310 PAF_InpBufConfig inpBufConfigQueue[DEC_INPBUF_CONFIG_QUEUE_SIZE];
311 Int rdidx;
312 Int wridx;
313 } asipDecProc_t;
315 // Audio Stream Input Task (ASIT) configuration
316 typedef struct PAF_ASIT_Config {
317 Task_Handle taskHandle; // ASIT handle
318 ACP_Handle acp; // ASIT local ACP handle
319 AspMsgMaster_Handle hAspMsgMaster; // ASIT message master handle
320 PAF_ASPM_Config *pAspmCfg; // ASIT/ASOT shared configuration
321 PAF_AST_Config *pAstCfg; // ASIT/ASOT/ASDT shared configuration
322 PAF_AST_IoInp *pIoInp; // ASIT IO configuration
323 asipDecProc_t inpDec;
324 } PAF_ASIT_Config;
327 // ASIT event IDs
328 #define ASIT_EVTMSK_NONE 0x0
329 #define ASIT_EVTMSK_INPDATA 0x1 // Input data (Rx McASP EDMA) event
330 #define ASIT_EVTMSK_RXACK 0x2 // Receive acknowledge (IPC MessageQ) message event
331 #define ASIT_EVTMSK_INFOACK 0x4 // temp, will be removed
332 #define ASIT_EVTMSK_DECACK 0x8 // temp, will be removed
334 // ASIT event handle
335 extern Event_Handle gAsitEvtHandle;
337 // ASIT Sync event handle
338 extern SyncEvent_Handle gAsitSyncEvtHandle;
340 // ASIT ASP messaging
341 #define ASIT_ASP_MSG_HEAP_ID ( 0 ) // ASIT message master heap Id
342 #define ASIT_ASP_MSG_MASTER_NUMSGS ( ASP_MSG_MASTER_DEF_NUMMSGS ) // ASIT message master number of messages
344 // ASIT configuration
345 extern PAF_ASIT_Config gPAF_ASIT_config;
348 // Purpose: Audio Stream Input Task Function for initialization of data pointers
349 // by allocation of memory.
350 Int
351 PAF_ASIT_initPhaseMalloc(
352 const PAF_ASIT_Params *pP,
353 const PAF_ASIT_Patchs *pQ,
354 PAF_ASIT_Config *pAsitCfg
355 );
357 // Purpose: Audio Stream Input Task Function for initialization of data values
358 // from parameters.
359 Int
360 PAF_ASIT_initPhaseConfig(
361 const PAF_ASIT_Params *pP,
362 const PAF_ASIT_Patchs *pQ,
363 PAF_ASIT_Config *pAsitCfg
364 );
366 // Purpose: Audio Stream Input Task Function for initialization of ACP by
367 // instantiation of the algorithm.
368 Int
369 PAF_ASIT_initPhaseAcpAlg(
370 const PAF_ASIT_Params *pP,
371 const PAF_ASIT_Patchs *pQ,
372 PAF_ASIT_Config *pAsitCfg
373 );
375 // Purpose: Audio Stream Input Task Function for allocation of common memory.
376 Int
377 PAF_ASIT_initPhaseCommon(
378 const PAF_ASIT_Params *pP,
379 const PAF_ASIT_Patchs *pQ,
380 PAF_ASIT_Config *pAsitCfg
381 );
383 // Purpose: Audio Stream Input Task Function for initialization of ASP algorithms.
384 Int
385 PAF_ASIT_initPhaseAspAlg(
386 const PAF_ASIT_Params *pP,
387 const PAF_ASIT_Patchs *pQ,
388 PAF_ASIT_Config *pAsitCfg
389 );
391 // Purpose: Audio Stream Input Task Function for initialization of data values
392 // from parameters for Algorithm Keys.
393 Int
394 PAF_ASIT_initPhaseAlgKey(
395 const PAF_ASIT_Params *pP,
396 const PAF_ASIT_Patchs *pQ,
397 PAF_ASIT_Config *pAsitCfg
398 );
400 // Purpose: Audio Stream Input Task Function for initialization of Decoder Output Circular Buffer.
401 Int
402 PAF_ASIT_initPhaseDecOpCircBuf(
403 const PAF_ASIT_Params *pP,
404 const PAF_ASIT_Patchs *pQ,
405 PAF_ASIT_Config *pAsitCfg
406 );
408 // Purpose: Audio Stream Input Task Function for initialization of Input Devices.
409 Int
410 PAF_ASIT_initPhaseDevice(
411 const PAF_ASIT_Params *pP,
412 const PAF_ASIT_Patchs *pQ,
413 PAF_ASIT_Config *pAsitCfg
414 );
416 // Purpose: Audio Stream Input Task Function for initialization of Output Init-Sync.
417 Int
418 PAF_ASIT_initPhaseOutIS(
419 const PAF_ASIT_Params *pP,
420 const PAF_ASIT_Patchs *pQ,
421 PAF_ASIT_Config *pAsdtCfg
422 );
425 #if 0
426 // Purpose: Audio Stream Task Function for initialization or reinitiali-
427 // zation of the Audio Frame(s) by loading of data values of a
428 // time-varying nature.
429 Int
430 PAF_AST_initFrame1(
431 const PAF_ASIT_Params *pP,
432 const PAF_ASIT_Patchs *pQ,
433 PAF_AST_Config *pAsitCfg,
434 Int z,
435 Int apply
436 );
437 #endif
439 // Purpose: Audio Stream Task Function for processing audio data to
440 // determine the input type without output.
441 Int
442 PAF_ASIT_autoProcessing(
443 const PAF_ASIT_Params *pP,
444 const PAF_ASIT_Patchs *pQ,
445 PAF_ASIT_Config *pAsitCfg,
446 Int inputTypeSelect,
447 ALG_Handle pcmAlgMaster);
449 // Purpose: Audio Stream Input Task Function for processing audio data.
450 //
451 Int
452 PAF_ASIT_decodeProcessing(
453 const PAF_ASIT_Params *pP,
454 const PAF_ASIT_Patchs *pQ,
455 PAF_ASIT_Config *pAsitCfg,
456 Int sourceSelect
457 );
459 // Purpose: Decoding Function for processing Decode Commands.
460 Int
461 PAF_ASIT_decodeCommand(
462 const PAF_ASIT_Params *pP,
463 const PAF_ASIT_Patchs *pQ,
464 PAF_ASIT_Config *pAsitCfg
465 );
467 // Purpose: Decoding Function for reinitializing the decoding process.
468 Int
469 PAF_ASIT_decodeInit(
470 const PAF_ASIT_Params *pP,
471 const PAF_ASIT_Patchs *pQ,
472 PAF_ASIT_Config *pAsitCfg,
473 Int sourceSelect
474 );
476 // Purpose: Decoding Function for processing information in a manner that
477 // is common for both initial and subsequent frames of input data.
478 Int
479 PAF_ASIT_decodeInfo(
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 initial frames of input data.
489 Int
490 PAF_ASIT_decodeInfo1(
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 // Purpose: Decoding Function for processing information in a manner that
499 // is unique to frames of input data other than the initial one.
500 Int
501 PAF_ASIT_decodeInfo2(
502 const PAF_ASIT_Params *pP,
503 const PAF_ASIT_Patchs *pQ,
504 PAF_ASIT_Config *pAsitCfg,
505 Int frame,
506 Int block
507 );
509 #if 0
510 // Purpose: Decoding Function for processing that occurs subsequent to
511 // information processing but antecedent to timing processing
512 // for frames of input data other than the initial one.
513 Int
514 PAF_AST_decodeCont(
515 const PAF_ASIT_Params *pP,
516 const PAF_ASIT_Patchs *pQ,
517 PAF_ASIT_Config *pAsitCfg,
518 ALG_Handle decAlg[],
519 Int frame,
520 Int block
521 );
522 #endif
524 // Purpose: Decoding Function for processing of input data by the
525 // Decode Algorithm.
526 Int
527 PAF_ASIT_decodeDecode(
528 const PAF_ASIT_Params *pP,
529 const PAF_ASIT_Patchs *pQ,
530 PAF_ASIT_Config *pAsitCfg,
531 Int sourceSelect,
532 Int frame,
533 Int block
534 );
536 // Purpose: Decoding Function for determining whether processing of the
537 // current frame is complete.
538 Int
539 PAF_ASIT_decodeFinalTest(
540 const PAF_ASIT_Params *pP,
541 const PAF_ASIT_Patchs *pQ,
542 PAF_ASIT_Config *pAsitCfg,
543 Int frame,
544 Int block
545 );
547 // Purpose: Decoding Function for terminating the decoding process.
548 Int
549 PAF_ASIT_decodeComplete(
550 const PAF_ASIT_Params *pP,
551 const PAF_ASIT_Patchs *pQ,
552 PAF_ASIT_Config *pAsitCfg,
553 ALG_Handle decAlg[],
554 Int frame,
555 Int block
556 );
558 // Purpose: Audio Stream Input Task Function for selecting the devices used
559 // for input.
560 Int
561 PAF_ASIT_selectDevices(
562 const PAF_ASIT_Params *pP,
563 const PAF_ASIT_Patchs *pQ,
564 PAF_ASIT_Config *pAsitCfg
565 );
567 // Purpose: Audio Stream Input Task Function for selecting the sources used
568 // for decoding of input to output.
569 Int
570 PAF_ASIT_sourceDecode(
571 const PAF_ASIT_Params *pP,
572 const PAF_ASIT_Patchs *pQ,
573 PAF_ASIT_Config *pAsitCfg,
574 Int x
575 );
577 // Purpose: Common Function for processing algorithm chains.
578 Int
579 PAF_AST_streamChainFunction(
580 const PAF_ASIT_Params *pP,
581 const PAF_ASIT_Patchs *pQ,
582 PAF_ASIT_Config *pAsitCfg,
583 Int iChainFrameFxns,
584 Int abortOnError,
585 Int logArg
586 );
588 // Purpose: writing 8-bit integer to shared memeory
589 static inline
590 sharedMemWriteInt8(
591 volatile XDAS_Int8 *address, /* address to write to */
592 Int8 value, /* value to write to the adddress */
593 Int gateIdx) /* GateMP Index, defined in statusOp_common.h */
594 {
595 #ifdef NON_CACHE_STATUS
596 statusOp_write((void *)address, (void *)&value, sizeof(Int8), gateIdx);
597 #else
598 *address = value;
599 #endif
600 }
602 // Purpose: read 8-bit integer from shared memeory
603 static inline Int8 /* return the value read in the shared memory */
604 sharedMemReadInt8(
605 volatile XDAS_Int8 *address, /* address to read from */
606 Int gateIdx) /* GateMP Index, defined in statusOp_common.h */
607 {
608 #ifdef NON_CACHE_STATUS
609 Int8 tempVar;
610 statusOp_read((void *)&tempVar, (void *)address, sizeof(Int8), gateIdx);
612 return tempVar;
613 #else
614 return(*address);
615 #endif
616 }
618 // Purpose: writing 32-bit integer to shared memeory
619 static inline sharedMemWriteInt(volatile XDAS_Int32 *address, Int value, Int gateIdx)
620 {
621 #ifdef NON_CACHE_STATUS
622 statusOp_write((void *)address, (void *)&value, sizeof(Int), gateIdx);
623 #else
624 *address = value;
625 #endif
626 }
628 // Purpose: read 32-bit integer from shared memeory
629 static inline Int sharedMemReadInt(volatile XDAS_Int32 *address, Int gateIdx)
630 {
631 #ifdef NON_CACHE_STATUS
632 Int tempVar;
633 statusOp_read((void *)&tempVar, (void *)address, sizeof(Int), gateIdx);
635 return tempVar;
636 #else
637 return(*address);
638 #endif
639 }
641 Int asitUpdateInputStatus(const void *pRxParams, PAF_InpBufStatus *pStatus,
642 PAF_InpBufConfig *pInpBuf);
643 /*
644 Int asipDecodeInit(
645 const PAF_ASIT_Params *pP,
646 PAF_ASIT_Config *pAsitCfg,
647 Int sourceSelect);
648 */
649 /*Int asipDecodeProcessing(
650 const PAF_ASIT_Params *pP,
651 const PAF_ASIT_Patchs *pQ,
652 PAF_ASIT_Config *pAsitCfg,
653 Int sourceSelect);*/
654 Int asitDecodeProcessing(const PAF_ASIT_Params *pP,
655 const PAF_ASIT_Patchs *pQ,
656 PAF_ASIT_Config *pAsitCfg,
657 UInt asitEvents);
659 Int decDecodeInit(
660 const PAF_ASIT_Params *pP,
661 PAF_ASIT_Config *pAsitCfg,
662 Int sourceSelect);
664 Int decDecodeFsm(
665 const PAF_ASIT_Params *pP,
666 const PAF_ASIT_Patchs *pQ,
667 PAF_ASIT_Config *pAsitCfg,
668 Int sourceSelect,
669 UInt decMsg);
671 Int getFrameLengthSourceSel(
672 const PAF_ASIT_Params *pP,
673 Int8 sourceSelect);
675 Int rxDecodePcm(PAF_AST_IoInp *pInp);
677 Int rxDecodeBitStream(PAF_AST_IoInp *pInp);
679 Int rxDecodePlayZero(PAF_AST_IoInp *pInp);
682 #endif /* _ASIP_H_ */