/** ---------------------------------------------------------------------------- * @func tskLoop * * @desc Task for TSK based TSKLOOP application. * * @modif None * ---------------------------------------------------------------------------- */ static Int tskLoop() { Int status = SYS_OK; TSKLOOP_TransferInfo *info; #if defined (DSP_BOOTMODE_NOBOOT) { while (DSPLINK_initFlag != 0xC0C0BABA) ; } /* Initialize DSP/BIOS LINK. */ DSPLINK_init () ; #endif /* Create Phase */ status = TSKLOOP_create (&info); /* Execute Phase */ if (status == SYS_OK) { status = TSKLOOP_execute (info); if (status != SYS_OK) { SET_FAILURE_REASON(status); } } /* Delete Phase */ status = TSKLOOP_delete (info); if (status != SYS_OK) { SET_FAILURE_REASON(status); } return status ; }
Void main(Int argc, Char *argv[]) { // create the semaphore dprint_sema = SEM_create (0, NULL); // connect with gpp: DSPLINK_init (); // register callback from the gpp side: NOTIFY_register (ID_GPP, 0, 6, dprint_callback, 0); // start task: TSK_create(TaskMain, NULL, &0); // task will start as soon as main ends! // don't call dprintf from here! }
/** ============================================================================ * @func main * * @desc Entry function. * * @modif None * ============================================================================ */ Void main(Int argc, Char* argv []) { /* Task handler for TSK_create */ TSK_Handle tskMessageTask; #if !defined (DSP_BOOTMODE_NOBOOT) /* Get the number of transfers to be done by the application */ numTransfers = atoi(argv [0]); /* Initialize DSP/BIOS LINK. */ DSPLINK_init(); #endif /* Creating task for TSKMESSAGE application */ tskMessageTask = TSK_create(tskMessage, NULL, 0); if (tskMessageTask == NULL) { SET_FAILURE_REASON(SYS_EALLOC); LOG_printf(&trace, "Create TSKMESSAGE: Failed.\n"); } }
/** ============================================================================ * @func SWIRGB2YCBCR_DSP_create * * @desc Create phase of SWISWIRGB2YCBCR_DSP application. It allocates * SWISWIRGB2YCBCR_DSP_TransferInfo structure and intializes it with configured * values. * * @modif None. * ============================================================================ */ Int SWIRGB2YCBCR_DSP_create (SWIRGB2YCBCR_DSP_TransferInfo ** infoPtr) { Int status = SYS_OK ; SWI_Attrs swiAttrs = SWI_ATTRS ; SWIRGB2YCBCR_DSP_TransferInfo * info; #if defined (DSP_BOOTMODE_NOBOOT) POOL_Obj poolObj ; { while (DSPLINK_initFlag != 0xC0C0BABA) ; } /* Initialize DSP/BIOS LINK. */ DSPLINK_init () ; smaPoolObj.poolId = 0; smaPoolObj.exactMatchReq = TRUE ; poolObj.initFxn = SMAPOOL_init ; poolObj.fxns = (POOL_Fxns *) &SMAPOOL_FXNS ; poolObj.params = &(smaPoolObj) ; poolObj.object = NULL ; status = POOL_open (0, &poolObj) ; /* Create IOM driver dynamically */ status = DEV_createDevice("/dsplink", &ZCPYDATA_FXNS, (Fxn) &ZCPYDATA_init, &devAttrs) ; /* Create DIO adapter dynamically */ status = DEV_createDevice("/dio_dsplink", &DIO_tskDynamicFxns, NULL, &dioDevAttrs); #endif /* Allocate SWIRGB2YCBCR_DSP_TransferInfo structure */ *infoPtr = MEM_calloc (DSPLINK_SEGID, sizeof (SWIRGB2YCBCR_DSP_TransferInfo), DSPLINK_BUF_ALIGN) ; if (*infoPtr == NULL) { status = SYS_EALLOC ; SET_FAILURE_REASON (status) ; } else { info = *infoPtr ; } /* Initialize SWIRGB2YCBCR_DSP_TransferInfo structure */ if (status == SYS_OK) { info->bufferSize = xferBufSize ; (info->appReadCb).fxn = readFinishCb ; (info->appReadCb).arg = (Ptr) info ; (info->appWriteCb).fxn = writeFinishCb ; (info->appWriteCb).arg = (Ptr) info ; } /* Create channel handles */ if (status == SYS_OK) { GIO_Attrs gioAttrs = GIO_ATTRS ; info->gioInputChan = GIO_create (INPUT_CHANNEL, IOM_INPUT, NULL, NULL, &gioAttrs) ; info->gioOutputChan = GIO_create (OUTPUT_CHANNEL, IOM_OUTPUT, NULL, NULL, &gioAttrs) ; if ( (info->gioInputChan == NULL) || (info->gioOutputChan == NULL)) { status = SYS_EALLOC ; SET_FAILURE_REASON (status) ; } } /* Create SWI for sending and receiving data */ if (status == SYS_OK) { swiAttrs.fxn = rgb2ycbcr_dspSWI ; swiAttrs.arg0 = (Arg) info ; swiAttrs.mailbox = INITIAL_MAILBOX_VAL ; info->swi = SWI_create (&swiAttrs) ; if (info->swi == NULL) { status = SYS_EALLOC ; SET_FAILURE_REASON (status) ; } } /* Allocate input and output buffers */ if (status == SYS_OK) { status = POOL_alloc (SAMPLE_POOL_ID, (Ptr *) &(info->inputBuffer), info->bufferSize) ; if (status == SYS_OK) { status = POOL_alloc (SAMPLE_POOL_ID, (Ptr *) &(info->outputBuffer), info->bufferSize) ; if (status != SYS_OK) { SET_FAILURE_REASON (status) ; } } else { SET_FAILURE_REASON (status) ; } } return status ; }
/** ============================================================================ * @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; }
/** ============================================================================ * @func main * * @desc Entry function. * * @modif None * ============================================================================ */ Void main(Int argc, Char *argv[]) { /* TSK based ring_io application */ TSK_Handle tskRingIoTask1; //for sending TSK_Handle tskRingIoTask2; // for receiving TSK_Attrs attrs = TSK_ATTRS; #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 size of the data buffer to be allocated for the RingIO. */ RING_IO_dataBufSize1 = atoi(argv[0]); RING_IO_dataBufSize2 = atoi(argv[1]); /* Get the size of the attribute buffer to be allocated for the RingIO.*/ RING_IO_attrBufSize = atoi(argv[2]); /* Get the size of the footbuffer to be allocated for the RingIO. */ RING_IO_footBufSize = atoi(argv[3]); #else /* Get the size of the data buffer to be allocated for the RingIO. */ RING_IO_dataBufSize1 = 10240; RING_IO_dataBufSize2 = 10240; /* Get the size of the attribute buffer to be allocated for the RingIO.*/ RING_IO_attrBufSize = 2048; /* Get the size of the footbuffer to be allocated for the RingIO. */ RING_IO_footBufSize = 0; #endif /* Create Phase */ TSKRING_IO_create1(&info1); /* Create Phase */ TSKRING_IO_create2(&info2); attrs.stacksize = 16384; /* Creating task for RING_IO application */ //tskRingIoTask1 = TSK_create(tskRingIo1, NULL, 0); tskRingIoTask1 = TSK_create(tskRingIo1, &attrs, 0); if (tskRingIoTask1 != NULL) { LOG_printf(&trace, "Create RING_IO TSK1: Success\n"); } else { LOG_printf(&trace, "Create RING_IO TSK1: Failed.\n"); } /* Creating task for RING_IO application */ //tskRingIoTask2 = TSK_create(tskRingIo2, NULL, 0); tskRingIoTask2 = TSK_create(tskRingIo2, &attrs, 0); if (tskRingIoTask2 != NULL) { LOG_printf(&trace, "Create RING_IO TSK2: Success\n"); } else { LOG_printf(&trace, "Create RING_IO TSK2: Failed.\n"); } }