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