/** * @brief The BIOS main() entry point. * * @remark The purpose of this function is to create a BIOS worker task * to house our example. * * @remark This is called during BIOS_init, but before the scheduler * has begun running. */ Int main(Int argc, String argv[]) { TSK_Attrs attrs = TSK_ATTRS; attrs.stacksize = 6 * 1024; attrs.name = taskName; /* init Codec Engine */ CERuntime_init(); /* init trace */ GT_init(); /* create a mask to allow a trace-print welcome message below */ GT_create(&curMask, MOD_NAME); /* Enable all trace for this module */ GT_set(MOD_NAME "=01234567"); GT_0trace(curMask, GT_2CLASS, "main> " MOD_NAME "\n"); if (TSK_create((Fxn)smain, &attrs, argc, argv) == NULL) { SYS_abort("main: failed to create smain thread."); } return (0); }
/* ARGSUSED */ Int smain(Int argc, Char * argv[]) { TSK_Handle tsk; TSK_Attrs attrs = TSK_ATTRS; Int i; GT_0trace(ti_sdo_fc_rman_examples_hdvicp, GT_ENTER, "_smain> Enter \n"); done = SEM_create(0, NULL); mutex = SEM_create(1, NULL); if ((done == NULL) || (mutex == NULL)) { SYS_abort("Sem create failed \n"); } /* * Do I care about this ? */ attrs.stackseg = EXTMEM_HEAP; /* * Use a bigger stack size when printing out trace */ attrs.stacksize = 0x1000; for (i = 0; i < NUMTASKS; i++) { attrs.priority = attrsTable[i].priority; tsk = TSK_create((Fxn)rmanTask, &attrs, (Arg)(attrsTable[i].scratchId), (Arg)(&(attrsTable[i].id)), (Arg)(attrsTable[i].priority), (Arg)(i +1), (Arg)(attrsTable[i].yieldFlag)); if (tsk == NULL) { GT_1trace(ti_sdo_fc_rman_examples_hdvicp, GT_7CLASS, "_rman> " "Task #%d create failed \n",i); SYS_abort("TSK_create() of task %d failed\n",i+1); } } for (i=0; i < NUMTASKS; i++) { SEM_pend(done, SYS_FOREVER); } GT_0trace(ti_sdo_fc_rman_examples_hdvicp, GT_4CLASS, "_smain> " "TEST PASSED \n"); SEM_delete(mutex); SEM_delete(done); GT_0trace(ti_sdo_fc_rman_examples_hdvicp, GT_ENTER, "_smain> Exit \n"); return 0; }
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 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"); } }