/** ============================================================================ * @func pool_notify_Main * * @desc Entry point for the application * * @modif None * ============================================================================ */ NORMAL_API Void pool_notify_Main (IN Char8 * dspExecutable, IN Char8 * strBufferSize, IN Char8 * strFeatures, IN Char8 * strFrames) { DSP_STATUS status = DSP_SOK ; Uint8 processorId = 0 ; #ifdef DEBUG printf ("========== Incoorporating KLT in pool_notify ==========\n") ; #endif if ( (dspExecutable != NULL) && (strBufferSize != NULL)) { /* * Validate the buffer size and number of iterations specified. */ pool_notify_BufferSize = DSPLINK_ALIGN ( atoi (strBufferSize), DSPLINK_BUF_ALIGN) ; #ifdef DEBUG printf(" Allocated a buffer of %d bytes\n",(int)pool_notify_BufferSize ); #endif processorId = 0 ; if (pool_notify_BufferSize == 0) { status = DSP_EINVALIDARG ; printf ("ERROR! Invalid arguments specified for "); printf (" Buffer size = %d\n", (int)pool_notify_BufferSize) ; } /* * Specify the dsp executable file name and the buffer size for * pool_notify creation phase. */ status = pool_notify_Create (dspExecutable, strBufferSize, 0) ; if (DSP_SUCCEEDED (status)) { status = pool_notify_Execute (pool_notify_NumIterations, 0, strFeatures, strFrames) ; } pool_notify_Delete (processorId) ; } else { status = DSP_EINVALIDARG ; printf ("ERROR! Invalid arguments specified for " "pool_notify application\n") ; } printf ("====================================================\n") ; }
* by the device/platform. */ #define APP_BUFFER_SIZE DSPLINK_ALIGN (sizeof (ControlMsg), DSPLINK_BUF_ALIGN) /* Definitions required for the sample Message queue. * Using a Zero-copy based transport on the shared memory physical link. */ #if defined ZCPY_LINK #define SAMPLEMQT_CTRLMSG_SIZE ZCPYMQT_CTRLMSG_SIZE STATIC ZCPYMQT_Attrs mqtAttrs; #endif /* Message sizes managed by the pool */ STATIC Uint32 SampleBufSizes[NUMMSGPOOLS] = { APP_BUFFER_SIZE, SAMPLEMQT_CTRLMSG_SIZE, DSPLINK_ALIGN (sizeof(MSGQ_AsyncLocateMsg), DSPLINK_BUF_ALIGN), DSPLINK_ALIGN (sizeof(MSGQ_AsyncErrorMsg), DSPLINK_BUF_ALIGN) }; /* Number of messages in each pool */ STATIC Uint32 SampleNumBuffers[NUMMSGPOOLS] = { NUMMSGINPOOL0, NUMMSGINPOOL1, NUMMSGINPOOL2, NUMMSGINPOOL3 }; /* Definition of attributes for the pool based on physical link used by the transport */ #if defined ZCPY_LINK STATIC SMAPOOL_Attrs SamplePoolAttrs =
/** ============================================================================ * @func LOOP_Main * * @desc Entry point for the application * * @modif None * ============================================================================ */ NORMAL_API Void LOOP_Main (IN Char8 * dspExecutable, IN Char8 * strBufferSize, IN Char8 * strNumIterations, IN Char8 * strProcessorId) { DSP_STATUS status = DSP_SOK ; Uint8 processorId = 0 ; LOOP_0Print ("=============== Sample Application : LOOP ==========\n") ; memset (&source_data[0], 0, sizeof(source_data)); memset (&result_data[0], 0, sizeof(result_data)); memset (&expect_data[0], 0, sizeof(expect_data)); if ( (dspExecutable != NULL) && (strBufferSize != NULL) && (strNumIterations != NULL)) { /* * Validate the buffer size and number of iterations specified. */ LOOP_BufferSize = DSPLINK_ALIGN (MAX_XFER_SIZE, DSPLINK_BUF_ALIGN) ; if (LOOP_BufferSize == 0) { status = DSP_ESIZE ; } LOOP_NumIterations = LOOP_Atoi (strNumIterations) ; /* execute only once */ LOOP_NumIterations = 1 ; /* Find out the processor id to work with */ processorId = LOOP_Atoi (strProcessorId) ; if (processorId >= MAX_DSPS) { LOOP_1Print ("==Error: Invalid processor id specified %d ==\n", processorId) ; status = DSP_EFAIL ; } /* * Specify the dsp executable file name and the buffer size for * loop creation phase. */ if (DSP_SUCCEEDED (status)) { LOOP_1Print ("==== Executing sample for DSP processor Id %d ====\n", processorId) ; status = LOOP_Create (dspExecutable, strBufferSize, strNumIterations, processorId) ; /* * Execute the data transfer loop. */ if (DSP_SUCCEEDED (status)) { status = LOOP_Execute (LOOP_NumIterations, processorId) ; } /* * Perform cleanup operation. */ LOOP_Delete (processorId) ; } } else { status = DSP_EINVALIDARG ; LOOP_0Print ("ERROR! Invalid arguments specified for while executing " "loop application\n") ; } LOOP_0Print ("====================================================\n") ; }
/** ============================================================================ * @func main * * @desc Entry function. * * @modif None * ============================================================================ */ Void main(Int argc, Char *argv[]) { #if defined (SWI_MODE) /* SWI based loopback */ SWILOOP_TransferInfo * info; #else /* if defined (SWI_MODE) */ /* TSK based loopback */ TSK_Handle tskLoopTask; #endif /* if defined (SWI_MODE) */ #if defined (SWI_MODE) || defined (CHNL_PCPY_LINK) Int status ; #endif /* if defined (SWI_MODE) || defined (CHNL_PCPY_LINK) */ #if defined (DSP_BOOTMODE_NOBOOT) /* register the init ISR */ HAL_intRegister (DSPLINK_INT_ID, DSPLINK_INT_VEC_ID, (Fxn) &HAL_initIsr, 0) ; #endif #if !defined (DSP_BOOTMODE_NOBOOT) /* Initialize DSP/BIOS LINK. */ DSPLINK_init () ; /* Get the number of transfers to be done by the application */ numTransfers = atoi (argv[1]) ; /* Transfer size for loopback given by GPP side */ xferBufSize = DSPLINK_ALIGN ((atoi (argv[0]) / DSP_MAUSIZE), DSPLINK_BUF_ALIGN) ; #else /* Get the number of transfers to be done by the application */ numTransfers = 10000 ; /* Transfer size for loopback given by GPP side */ xferBufSize = 1024 ; #endif #if defined (SWI_MODE) /* Create phase of SWILOOP application */ status = SWILOOP_create(&info); if (status == SYS_OK) { /* Execute phase of SWILOOP application */ status = SWILOOP_execute(info); if (status != SYS_OK) { SET_FAILURE_REASON (status); } } else { SET_FAILURE_REASON (status); } /* Delete phase of SWILOOP application: This is not called right now * because SWI application runs forever */ /* deleteStatus = SWILOOP_delete(info); if (deleteStatus != SYS_OK) { SET_FAILURE_REASON (deleteStatus); } */ #else /* if defined (SWI_MODE) */ /* Creating task for TSKLOOP application */ tskLoopTask = TSK_create(tskLoop, NULL, 0); if (tskLoopTask != NULL) { LOG_printf(&trace, "Create TSKLOOP: Success\n"); } else { LOG_printf(&trace, "Create TSKLOOP: Failed.\n"); return; } #endif /* if defined (SWI_MODE) */ return; }
/* Messaging buffer used by the application. * Note: This buffer must be aligned according to the alignment expected * by the device/platform. */ #define APP_BUFFER_SIZE DSPLINK_ALIGN (sizeof (ControlMsg), DSPLINK_BUF_ALIGN) /* Definitions required for the sample Message queue. * Using a Zero-copy based transport on the shared memory physical link. */ #if defined ZCPY_LINK #define SAMPLEMQT_CTRLMSG_SIZE ZCPYMQT_CTRLMSG_SIZE STATIC ZCPYMQT_Attrs mqtAttrs; #endif /* Message sizes managed by the pool */ STATIC Uint32 SampleBufSizes[NUMMSGPOOLS] = { APP_BUFFER_SIZE, SAMPLEMQT_CTRLMSG_SIZE, DSPLINK_ALIGN(sizeof(MSGQ_AsyncLocateMsg), DSPLINK_BUF_ALIGN), DSPLINK_ALIGN( sizeof(MSGQ_AsyncErrorMsg), DSPLINK_BUF_ALIGN) }; /* Number of messages in each pool */ STATIC Uint32 SampleNumBuffers[NUMMSGPOOLS] = { NUMMSGINPOOL0, NUMMSGINPOOL1, NUMMSGINPOOL2, NUMMSGINPOOL3 }; /* Definition of attributes for the pool based on physical link used by the transport */ #if defined ZCPY_LINK STATIC SMAPOOL_Attrs SamplePoolAttrs = { NUMMSGPOOLS, SampleBufSizes,
/** ============================================================================ * @func DSP_Create * * @desc This function allocates and initializes resources used by * this application. * * @modif LOOP_Buffers * ============================================================================ */ NORMAL_API DSP_STATUS DSP_Create (IN Char8 * dspExecutable, IN Char8 * strControlArray, Uint8 processorId) { DSP_STATUS status = DSP_SOK ; Uint32 numArgs = 0 ; Uint32 numBufs [1] = {4} ; Char8 * args [1] ; Uint32 size [1] ; #if defined (ZCPY_LINK) SMAPOOL_Attrs poolAttrs ; #endif /* if defined (ZCPY_LINK) */ LOOP_0Print ("Entered DSP_Create ()\n") ; LOOP_BufferSize = DSPLINK_ALIGN (LOOP_Atoi ("1024"), DSPLINK_BUF_ALIGN) ; /* * Create and initialize the proc object. */ status = PROC_setup (NULL) ; /* * Attach the Dsp with which the transfers have to be done. */ if (DSP_SUCCEEDED (status)) { status = PROC_attach (processorId, NULL) ; if (DSP_FAILED (status)) { LOOP_1Print ("PROC_attach failed . Status = [0x%x]\n", status) ; } } else { LOOP_1Print ("PROC_setup failed. Status = [0x%x]\n", status) ; } if (DSP_SUCCEEDED (status)) { size [0] = LOOP_BufferSize ; poolAttrs.bufSizes = (Uint32 *) &size ; poolAttrs.numBuffers = (Uint32 *) &numBufs ; poolAttrs.numBufPools = 1 ; status = POOL_open (POOL_makePoolId(processorId, 0), &poolAttrs) ; if (DSP_FAILED (status)) { LOOP_1Print ("POOL_open () failed. Status = [0x%x]\n", status) ; } } /* * Load the executable on the DSP. */ if (DSP_SUCCEEDED (status)) { numArgs = 1 ; args [0] = strControlArray ; status = PROC_load (processorId, dspExecutable, numArgs, args) ; if (DSP_FAILED (status)) { LOOP_1Print ("PROC_load failed. Status = [0x%x]\n", status) ; } } LOOP_0Print ("Leaving DSP_Create ()\n") ; return status ; }