]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - processor-sdk/performance-audio-sr.git/blob - processor_audio_sdk_1_00_00_00/pasdk/test_arm/framework/systemInit.c
Add GateMP for Decoder Output Circular Buffer
[processor-sdk/performance-audio-sr.git] / processor_audio_sdk_1_00_00_00 / pasdk / test_arm / framework / systemInit.c
2 /*
3 Copyright (c) 2016, 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  *  ======== systemInit.c ========
38  */
40 #include <xdc/std.h>
41 #include <xdc/cfg/global.h>
42 #include <xdc/runtime/IHeap.h>
43 #include <xdc/runtime/Log.h>
44 #include <xdc/runtime/System.h>
45 #include <ti/ipc/Ipc.h>
47 #include "pafhjt.h"
48 #include "paf_heapMgr.h"
49 #include "aspDecOpCircBuf_slave.h"
50 #include "audioStreamProc_common.h"
51 #include "audioStreamDecodeProc.h"
53 const PAFHJT_t *pafhjt;
55 #define RAM_REPORT
56 #ifdef RAM_REPORT
57 #include <audioStreamProc_params.h>
58 #include <paf_alg_print.h>
59 extern PAF_AST_Fxns PAF_ASDT_params_fxns;
60 #endif
62 #include "aspMsg_common.h"
63 #include "aspMsg_slave.h"
65 #define TASK_ASDP_PRI    ( 3 )
67 #define __TASK_NAME__  "TaskSysInit"
69 /*
70  *  ======== taskSysInitFxn ========
71  *  System Initializations task function
72  */
73 Void taskSysInitFxn(Void)
74 {
75     UInt16 remoteProcId;    
76     Int status;
78     
79     Log_info0("Enter taskSysInitFxn()");
81     /* Attach IPC */
82     Log_info0("taskSysInitFxn:Ipc_attach()");    
83     remoteProcId = MultiProc_getId(MASTER_NAME);
84     if (remoteProcId == MultiProc_INVALIDID) {
85         System_abort("Improper MultiProc ID\n");
86     }
87     do {
88         status = Ipc_attach(remoteProcId);
89     //} while ((status < 0) && (status == Ipc_E_NOTREADY));
90     } while (status != Ipc_S_SUCCESS);
92     /* Initialize (IPC) ASP slave messaging */
93     Log_info0("taskSysInitFxn:AspMsgSlave_init()");
94     status = AspMsgSlave_init(
95         hAspMsgSlave, 
96         remoteProcId);
97     if (status < 0)
98     {
99         Log_info1("%s: Unable to initialize ASP messaging. Exiting.", (IArg)__TASK_NAME__);
100         return;
101     }
103     /* Initialize decoder output circular buffer control */
104     status = cbCtlInit(&gPAF_ASDT_config.decOpCircBufCtl, gPAF_AST_config.xDecOpCb);
105     if (status < 0)
106     {
107         Log_info1("%s: unable to initialize Decoder Output Circular Buffer Control. Exiting.", (IArg)__TASK_NAME__);
108         return;
109     }
111     /* Initialize PAF heap manager */
112     Log_info0("taskSysInitFxn:pafHeapMgr_init()");
113     pafHeapMgr_init((IHeap_Handle)heapMemL2Sram,
114         (IHeap_Handle)heapMemMsmcSram,
115         (IHeap_Handle)heapMemDdr3,
116         NULL,
117         NULL);
118     
119     /* Initialize HJT */
120     pafhjt = &PAFHJT_RAM;
121     
122 #ifdef RAM_REPORT
123     PAF_ASDT_params_fxns.headerPrint = PAF_ALG_headerPrint;
124     PAF_ASDT_params_fxns.allocPrint = PAF_ALG_allocPrint;
125     PAF_ASDT_params_fxns.commonPrint = PAF_ALG_commonPrint;
126     PAF_ASDT_params_fxns.bufMemPrint = PAF_ALG_bufMemPrint;
127     PAF_ASDT_params_fxns.memStatusPrint = PAF_ALG_memStatusPrint;
128 #endif
130     Task_setPri(TaskAsdp, TASK_ASDP_PRI);
132     Log_info0("Exit taskSysInitFxn()");