index b9a9512be66c7fed8b908187fb0fd2b3d904f288..e69296dd17c2249fa57fc06240504ef7b56ef9b4 100644 (file)
#include <ti/ipc/Ipc.h>
#include <ti/sysbios/family/c66/Cache.h>
+#include "params.h"
#include "pafhjt.h"
#include "paf_heapMgr.h"
#include "aspMsg_common.h"
#include "audioStreamProc_common.h" // ASIT/ASOT/ASDT config
#include "audioStreamInpProc.h"
#include "audioStreamOutProc.h"
+#include "systemInit.h"
-extern Void ACP_main_cus(Void); // (*** ?) FL: revisit -- check method of patching alpha codes
-extern Void taskSystemStreamFxn(Void); // (*** ?) FL: revisit -- shouldn't need to call this from system init
-
-const PAFHJT_t *pafhjt;
+// debug
+#include "evmc66x_pinmux.h"
+#include "evmc66x_gpio_dbg.h"
-#define RAM_REPORT
-#ifdef RAM_REPORT
-#include <audioStreamProc_params.h>
-#include <paf_alg_print.h>
-extern PAF_ASIT_Fxns PAF_ASIT_params_fxns;
-extern PAF_ASOT_Fxns PAF_ASOT_params_fxns;
-#endif
-Int gSysInit=0;
+#define __TASK_NAME__ "TaskSysInit"
#define TASK_AFP_PRI ( 2 )
#define TASK_AIP_PRI ( 3 )
#define TASK_SSP_PRI ( 1 )
-#define TASK_ASIP_PRI ( 5 ) //( 4 )
+#define TASK_ASIP_PRI ( 4 ) //( 4 )
#define TASK_ASOP_PRI ( 4 )
-#define __TASK_NAME__ "TaskSysInit"
+#define SYS_INIT_SLEEP ( 100 )
-#define SYS_INIT_SLEEP 100
-// FL: debug
-#include "evmc66x_pinmux.h"
-#include "evmc66x_gpio_dbg.h"
+extern Void ACP_main_cus(Void); // (*** ?) FL: revisit -- check method of patching alpha codes
+//extern Void taskSystemStreamFxn(Void); // (*** ?) FL: revisit -- shouldn't need to call this from system init
+
+//#define MEMSTAT_REPORT
+#ifdef MEMSTAT_REPORT
+#include "paf_alg_print.h"
+#endif
+
+#define RAM_REPORT
+#ifdef RAM_REPORT
+#include "audioStreamProc_params.h"
+#include "paf_alg_print.h"
+extern PAF_ASIT_Fxns PAF_ASIT_params_fxns;
+extern PAF_ASOT_Fxns PAF_ASOT_params_fxns;
+#endif
+
+// Task initialization flag array.
+// Each flag indicates whether Task has been initialized.
+// 0: uninitialized
+// 1: initialized
+Int gTaskInitFlag[NUM_SYS_TASKS];
+
+// PAF Hidden Jump Table (HJT) pointer
+const PAFHJT_t *pafhjt;
+/* Semaphore handles for Tx and Rx - to put in structures */
+Semaphore_Handle asipSemRx;
+Semaphore_Handle asopSemTx;
+void sysCreateSemaphores(void);
/*
* ======== taskSysInitFxn ========
// Create Shared DDR region as non-Cacheable, Before IPC attach
// TODO: remove hardcoded address and get correct values from .bld
{ // base: 0x81000000, len: 0x01000000,
- UInt Common2_DDR3_MAR_base = 0x01848204;
+ //UInt Common2_DDR3_MAR_base = 0x01848204;
UInt Common2_DDR3_base = 0x81000000;
UInt Common2_DDR3_len = 0x01000000;
// disable cache for common2 DDR3
- Cache_setMar(Common2_DDR3_base, Common2_DDR3_len, Cache_Mar_DISABLE);
+ Cache_setMar((xdc_Ptr)Common2_DDR3_base, Common2_DDR3_len, Cache_Mar_DISABLE);
}
//taskPriAfp = Task_setPri(TaskAfp, -1);
/* Initialize decoder output circular buffer control */
Log_info0("taskSysInitFxn:cbCtlInit()");
- status = cbCtlInit(&gPAF_ASPM_config.decOpCircBufCtl, &gPAF_AST_config.xDecOpCb);
+ status = cbCtlInit(&gPAF_ASPM_config.decOpCircBufCtl, asip_params.zone.decodeN, &gPAF_AST_config.xDecOpCb);
if (status < 0)
{
Log_info0("TaskSysInit: unable to initialize Decoder Output Circular Buffer Control. Exiting.");
return;
}
+ /* Initialize Output Processing Init-Sync control */
+ Log_info0("taskSysInitFxn:outIsCtlInit()");
+ status = outIsCtlInit(&gPAF_ASPM_config.outIsCtl, &gPAF_AST_config.xOutIsi);
+ if (status < 0)
+ {
+ Log_info0("TaskSysInit: unable to initialize Output Init-Sync Control. Exiting.");
+ return;
+ }
/* Initialize PAF heap manager */
Log_info0("taskSysInitFxn:pafHeapMgr_init()");
srHeapMsmc,
srHeapDdr3,
srHeapNonCacheDdr3);
+
+#ifdef MEMSTAT_REPORT
+ // Output current heap memory usage
+ PAF_ALG_memStatusPrint("System Initialization, Initial MEMSTAT REPORT",
+ PAF_HEAP_INT, PAF_HEAP_INT1, PAF_HEAP_EXT,
+ PAF_HEAP_INT1_SHM, PAF_HEAP_EXT_SHM, PAF_HEAP_EXT_NONCACHED_SHM);
+#endif
/* Initialize HJT */
pafhjt = &PAFHJT_RAM;
PAF_ASOT_params_fxns.memStatusPrint = PAF_ALG_memStatusPrint;
#endif
- // FL: debug
+#if 0 // debug
// Any of these can be used on ARM, but DSP must configure the GPIO since pinMuxSetMode() is only available on DSP
- pinMuxSetMode(101,PADCONFIG_MUX_MODE_QUATERNARY); // PAD101 to QUATERNARY, GPIO (B5 on AudioDaughterCard J12)
+ audk2g_pinMuxSetMode(101,AUDK2G_PADCONFIG_MUX_MODE_QUATERNARY); // PAD101 to QUATERNARY, GPIO (B5 on AudioDaughterCard J12)
GPIOSetDirection(GPIO_PORT_0, GPIO_PIN_99, GPIO_OUT); // GPIO0,pin99 output
GPIOSetOutput(GPIO_PORT_0, GPIO_PIN_99);
GPIOClearOutput(GPIO_PORT_0, GPIO_PIN_99);
- pinMuxSetMode(117,PADCONFIG_MUX_MODE_QUATERNARY); // PAD117 to QUATERNARY, GPIO (B8 on AudioDaughterCard J12)
- GPIOSetDirection(GPIO_PORT_0, GPIO_PIN_106, GPIO_OUT); // GPIO0,pin99 output
+ audk2g_pinMuxSetMode(117,AUDK2G_PADCONFIG_MUX_MODE_QUATERNARY); // PAD117 to QUATERNARY, GPIO (B8 on AudioDaughterCard J12)
+ GPIOSetDirection(GPIO_PORT_0, GPIO_PIN_106, GPIO_OUT); // GPIO0,pin106 output
GPIOSetOutput(GPIO_PORT_0, GPIO_PIN_106);
GPIOClearOutput(GPIO_PORT_0, GPIO_PIN_106);
- pinMuxSetMode(118,PADCONFIG_MUX_MODE_QUATERNARY); // PAD118 to QUATERNARY, GPIO (B9 on AudioDaughterCard J12)
+ audk2g_pinMuxSetMode(118,AUDK2G_PADCONFIG_MUX_MODE_QUATERNARY); // PAD118 to QUATERNARY, GPIO (B9 on AudioDaughterCard J12)
GPIOSetDirection(GPIO_PORT_0, GPIO_PIN_107, GPIO_OUT); // GPIO0,pin107 output
GPIOSetOutput(GPIO_PORT_0, GPIO_PIN_107);
GPIOClearOutput(GPIO_PORT_0, GPIO_PIN_107);
+#endif
/* This is required to use SYS alpha codes in atboot? */
Log_info0("taskSysInitFxn:TaskSystemStream resume");
- gSysInit = 0;
+ gTaskInitFlag[TASK_SSP_INIT_FLAG_IDX] = 0;
Task_setPri(TaskSystemStream, TASK_SSP_PRI);
// Wait until Execution of TaskSystemStream is complete
// once.
- while (gSysInit == 0) // gSysInit is set to 1 in TaskSystemStream
+ while (gTaskInitFlag[TASK_SSP_INIT_FLAG_IDX] == 0) // System Stream initialization flag is set to 1 in TaskSystemStream
{
- Task_sleep(SYS_INIT_SLEEP);
+ Task_sleep(SYS_INIT_SLEEP);
}
-
Task_setPri(TaskAfp, TASK_AFP_PRI);
Task_setPri(TaskAip, TASK_AIP_PRI);
Task_setPri(TaskAsip, TASK_ASIP_PRI);
Task_setPri(TaskAsop, TASK_ASOP_PRI);
+ // Create ASIT/ASOT semaphores
+ sysCreateSemaphores();
+
+#ifdef MEMSTAT_REPORT
+ // Output current heap memory usage
+ PAF_ALG_memStatusPrint("System Initialization, Final MEMSTAT REPORT",
+ PAF_HEAP_INT, PAF_HEAP_INT1, PAF_HEAP_EXT,
+ PAF_HEAP_INT1_SHM, PAF_HEAP_EXT_SHM, PAF_HEAP_EXT_NONCACHED_SHM);
+#endif
+
Log_info0("Exit taskSysInitFxn()");
}
+
+// Create ASIT/ASOT events
+void sysCreateSemaphores(void)
+{
+ Semaphore_Params SemParams;
+
+ Semaphore_Params_init(&SemParams);
+
+ asipSemRx = Semaphore_create(0, &SemParams, NULL);
+ //asopSemTx = Semaphore_create(0, &SemParams, NULL);
+}