[processor-sdk/performance-audio-sr.git] / procsdk_audio_x_xx_xx_xx / test_arm / framework / systemInit.c
1 /*
2 * ======== systemInit.c ========
3 */
5 #include <xdc/std.h>
6 #include <xdc/cfg/global.h>
7 #include <xdc/runtime/IHeap.h>
8 #include <xdc/runtime/Log.h>
9 #include <xdc/runtime/System.h>
10 #include <ti/ipc/Ipc.h>
12 #include "pafhjt.h"
13 #include "paf_heapMgr.h"
15 const PAFHJT_t *pafhjt;
17 #define RAM_REPORT
18 #ifdef RAM_REPORT
19 #include <audioStreamProc_params.h>
20 #include <paf_alg_print.h>
21 extern PAF_AST_Fxns PAF_ASDT_params_fxns;
22 #endif
24 #include "aspMsg_common.h"
25 #include "aspMsg_slave.h"
27 #define TASK_ASDP_PRI ( 3 )
29 #define __TASK_NAME__ "TaskSysInit"
31 /*
32 * ======== taskSysInitFxn ========
33 * System Initializations task function
34 */
35 Void taskSysInitFxn(Void)
36 {
37 UInt16 remoteProcId;
38 Int status;
41 Log_info0("Enter taskSysInitFxn()");
43 /* Attach IPC */
44 Log_info0("taskSysInitFxn:Ipc_attach()");
45 remoteProcId = MultiProc_getId(MASTER_NAME);
46 if (remoteProcId == MultiProc_INVALIDID) {
47 System_abort("Improper MultiProc ID\n");
48 }
49 do {
50 status = Ipc_attach(remoteProcId);
51 //} while ((status < 0) && (status == Ipc_E_NOTREADY));
52 } while (status != Ipc_S_SUCCESS);
54 /* Initialize (IPC) ASP slave messaging */
55 Log_info0("taskSysInitFxn:AspMsgSlave_init()");
56 status = AspMsgSlave_init(
57 hAspMsgSlave,
58 remoteProcId);
59 if (status < 0)
60 {
61 Log_info1("%s: Unable to initialize ASP messaging. Exiting.", (IArg)__TASK_NAME__);
62 return;
63 }
65 /* Initialize PAF heap manager */
66 Log_info0("taskSysInitFxn:pafHeapMgr_init()");
67 pafHeapMgr_init((IHeap_Handle)heapMemL2Sram,
68 (IHeap_Handle)heapMemMsmcSram,
69 (IHeap_Handle)heapMemDdr3,
70 NULL,
71 NULL);
73 /* Initialize HJT */
74 pafhjt = &PAFHJT_RAM;
76 #ifdef RAM_REPORT
77 PAF_ASDT_params_fxns.headerPrint = PAF_ALG_headerPrint;
78 PAF_ASDT_params_fxns.allocPrint = PAF_ALG_allocPrint;
79 PAF_ASDT_params_fxns.commonPrint = PAF_ALG_commonPrint;
80 PAF_ASDT_params_fxns.bufMemPrint = PAF_ALG_bufMemPrint;
81 PAF_ASDT_params_fxns.memStatusPrint = PAF_ALG_memStatusPrint;
82 #endif
84 Task_setPri(TaskAsdp, TASK_ASDP_PRI);
86 Log_info0("Exit taskSysInitFxn()");
87 }