[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"
50 const PAFHJT_t *pafhjt;
52 #define RAM_REPORT
53 #ifdef RAM_REPORT
54 #include <audioStreamProc_params.h>
55 #include <paf_alg_print.h>
56 extern PAF_AST_Fxns PAF_ASDT_params_fxns;
57 #endif
59 #include "aspMsg_common.h"
60 #include "aspMsg_slave.h"
62 #define TASK_ASDP_PRI ( 3 )
64 #define __TASK_NAME__ "TaskSysInit"
66 /*
67 * ======== taskSysInitFxn ========
68 * System Initializations task function
69 */
70 Void taskSysInitFxn(Void)
71 {
72 UInt16 remoteProcId;
73 Int status;
76 Log_info0("Enter taskSysInitFxn()");
78 /* Attach IPC */
79 Log_info0("taskSysInitFxn:Ipc_attach()");
80 remoteProcId = MultiProc_getId(MASTER_NAME);
81 if (remoteProcId == MultiProc_INVALIDID) {
82 System_abort("Improper MultiProc ID\n");
83 }
84 do {
85 status = Ipc_attach(remoteProcId);
86 //} while ((status < 0) && (status == Ipc_E_NOTREADY));
87 } while (status != Ipc_S_SUCCESS);
89 /* Initialize (IPC) ASP slave messaging */
90 Log_info0("taskSysInitFxn:AspMsgSlave_init()");
91 status = AspMsgSlave_init(
92 hAspMsgSlave,
93 remoteProcId);
94 if (status < 0)
95 {
96 Log_info1("%s: Unable to initialize ASP messaging. Exiting.", (IArg)__TASK_NAME__);
97 return;
98 }
100 /* Initialize PAF heap manager */
101 Log_info0("taskSysInitFxn:pafHeapMgr_init()");
102 pafHeapMgr_init((IHeap_Handle)heapMemL2Sram,
103 (IHeap_Handle)heapMemMsmcSram,
104 (IHeap_Handle)heapMemDdr3,
105 NULL,
106 NULL);
108 /* Initialize HJT */
109 pafhjt = &PAFHJT_RAM;
111 #ifdef RAM_REPORT
112 PAF_ASDT_params_fxns.headerPrint = PAF_ALG_headerPrint;
113 PAF_ASDT_params_fxns.allocPrint = PAF_ALG_allocPrint;
114 PAF_ASDT_params_fxns.commonPrint = PAF_ALG_commonPrint;
115 PAF_ASDT_params_fxns.bufMemPrint = PAF_ALG_bufMemPrint;
116 PAF_ASDT_params_fxns.memStatusPrint = PAF_ALG_memStatusPrint;
117 #endif
119 Task_setPri(TaskAsdp, TASK_ASDP_PRI);
121 Log_info0("Exit taskSysInitFxn()");
122 }