[processor-sdk/performance-audio-sr.git] / procsdk_audio_x_xx_xx_xx / test_dsp / framework / fwkSim.c
diff --git a/procsdk_audio_x_xx_xx_xx/test_dsp/framework/fwkSim.c b/procsdk_audio_x_xx_xx_xx/test_dsp/framework/fwkSim.c
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * ======== fwkSim.c ========
- */
-
-#include <xdc/std.h>
-#include <xdc/cfg/global.h>
-#include <xdc/runtime/Error.h>
-#include <xdc/runtime/Log.h>
-#include <ti/sysbios/knl/Clock.h>
-#include <ti/sysbios/knl/Semaphore.h>
-#include <ti/sysbios/hal/Hwi.h>
-#include <ti/sysbios/hal/Timer.h>
-#include <ti/sysbios/family/c64p/EventCombiner.h>
-#include <ti/csl/soc/k2g/src/cslr_soc.h>
-
-#include "fwkSim.h"
-
-#ifdef SIMULATE_SIO
-#define SIM_TIMER_HWI ( 7 )
-
-// Global debug counters
-Uint32 gTimerRxCnt=0;
-Uint32 gTimerTxCnt=0;
-#endif // SIMULATE_SIO
-
-#ifdef SIMULATE_RX_ALPHA
-// Global debug counter
-Uint32 gClockRxAlphaCnt=0;
-#endif
-
-#ifdef SIMULATE_SIO
-/*
- * ======== timerRxFxn ========
- */
-Void timerRxFxn(UArg a0)
-{
- gTimerRxCnt++;
-
- /* Post semaphore indicating Rx audio frame */
- Semaphore_post(semaphoreRxAudio);
-}
-
-/*
- * ======== timerTxFxn ========
- */
-Void timerTxFxn(UArg a0)
-{
- gTimerTxCnt++;
-
- /* Post semaphore indicating Tx audio frame */
- Semaphore_post(semaphoreTxAudio);
-}
-
-// Simulation initialization
-Void simInit(Void)
-{
- Hwi_Params hwiParams;
- //Error_Block eb;
-
- // Initialize the error block
- //Error_init(&eb);
-
- // Initialize simulation
- // Plug the function and argument for Timer1L event and enable it
- // Plug the function and argument for Timer2L event and enable it
- EventCombiner_dispatchPlug(CSL_C66X_COREPAC_TIMER_1_INTL, &timerRxFxn, 0, TRUE);
- EventCombiner_dispatchPlug(CSL_C66X_COREPAC_TIMER_2_INTL, &timerTxFxn, 0, TRUE);
-
- // Initialize the Hwi parameters
- Hwi_Params_init(&hwiParams);
- // The eventId must be set to the combined event for Timer1L or Timer2L event.
- // The combined event is event 1 for both. If the combined events are
- // different, then another Hwi must be used for the other combined event.
- hwiParams.eventId = CSL_C66X_COREPAC_EVT1;
- // The arg must be set to hwiParams.eventId
- hwiParams.arg = hwiParams.eventId;
- // Enable the interrupt
- hwiParams.enableInt = FALSE; //TRUE;
- // Events Timer1L and Timer2L are on the same combined event so create a single Hwi.
- // Create the Hwi on interrupt 15 then specify 'EventCombiner_dispatch'
- // as the function.
- //Hwi_create(SIM_TIMER_HWI, &EventCombiner_dispatch, &hwiParams, &eb);
- Hwi_create(SIM_TIMER_HWI, &EventCombiner_dispatch, &hwiParams, NULL);
-}
-
-// Simulation start
-Void simStart(Void)
-{
- UInt32 curTime;
-
- // Start Rx audio clock -- Simulate Rx audio frame time */
- //System_printf("Start Rx audio clock\n");
- Log_info0("Start Rx audio clock");
- Timer_start(timerRxAudio);
-
- // Wait for Rx-Tx delay system ticks before starting Tx audio clock.
- // Control phase difference between Rx and Tx audio clocks.
- curTime = Clock_getTicks();
- while (Clock_getTicks() <= (curTime + RX_TX_AUDIO_DELTA_TICKS))
- {
- ;
- }
-
- // Start Tx audio clock -- Simulate Tx audio frame time
- //System_printf("Start Tx audio clock\n");
- Log_info0("Start Tx audio clock");
- Timer_start(timerTxAudio);
-
- Hwi_enableInterrupt(SIM_TIMER_HWI);
-}
-
-// Simulation stop
-Void simStop(Void)
-{
- Hwi_disableInterrupt(SIM_TIMER_HWI);
- Hwi_clearInterrupt(SIM_TIMER_HWI);
- EventCombiner_disableEvent(CSL_C66X_COREPAC_TIMER_1_INTL);
- EventCombiner_disableEvent(CSL_C66X_COREPAC_TIMER_2_INTL);
-}
-#endif // SIMULATE_SIO
-
-#ifdef SIMULATE_RX_ALPHA
-/*
- * ======== clockRxAlphaFxn ========
- */
-Void clockRxAlphaFxn(UArg a0)
-{
- gClockRxAlphaCnt++;
-
- /* Post semaphore indicating Rx alpha command */
- Semaphore_post(semaphoreRxAlpha);
-}
-#endif
-
-// Simulate load
-Void simLoad(
- Uint32 loadTime // load time in system clock ticks
-)
-{
- UInt32 curTime;
-
- curTime = Clock_getTicks();
- while (Clock_getTicks() <= (curTime + loadTime))
- {
- ;
- }
-}