static void AppTaskFirst (void *p_arg) { if (DEBUG) xil_printf("DEBUG: INSIDE AppTaskFirst\n\r"); p_arg = p_arg; /* Prevent compiler warning by doing something with argument */ BSP_InitIO(); /* Initialize the I/Os */ #if OS_TASK_STAT_EN > 0 OSStatInit(); /* Initialize uC/OS-II's statistics */ #endif AppTaskCreate(); /* La resta de tasques de l'aplicació es crean normalment */ /* dins d'una altra funció per tal de mantenir neta la secció */ /* de codi corresponent a la funció m */ int led = 0; // S3A400 - initialize LED selector while (1) { if (DEBUG) xil_printf("DEBUG: INSIDE AppTaskFirst while\n\r"); //BSP_LEDToggle(led + 1); // S3A400 - Light selected LED, all others off OSTimeDlyHMSM(0,0,5,0); // Release the CPU (every 5 second) //led = (led + 1) % LEDS; // S3A400 - Select next LED } }
static void AppTaskStart (void *p_arg) { #if CPU_CFG_CRITICAL_METHOD == CPU_CRITICAL_METHOD_STATUS_LOCAL CPU_SR cpu_sr; #endif CPU_INT08U i; CPU_INT08U j; (void)p_arg; BSP_InitIO(); /* Initialize BSP functions */ #if PROBE_COM_METHOD_RS232 == DEF_FALSE UART_Init(); /* Initialize serial port */ #endif #if (OS_TASK_STAT_EN > 0) OSStatInit(); /* Determine CPU capacity */ #endif #if (uC_PROBE_OS_PLUGIN > 0) || (uC_PROBE_COM_MODULE > 0) AppProbeInit(); /* Initialize uC/Probe modules */ #endif AppTaskCreate(); /* Create application tasks */ while (OS_TRUE) { /* Task body, always written as an infinite loop. */ for (j = 0; j < 2; j++) { for (i = 1; i < 9; i++) { LED_Toggle(i); OSTimeDlyHMSM(0, 0, 0, ADC_GetVal() + 10); } for (i = 0; i < 8; i++) { LED_Toggle(0); OSTimeDlyHMSM(0, 0, 0, ADC_GetVal() + 10); } } for ( ; j > 0; j--) { for (i = 9; i > 0; --i) { LED_Toggle(i); OSTimeDlyHMSM(0, 0, 0, ADC_GetVal() + 10); } for (i = 0; i < 8; i++) { LED_Toggle(0); OSTimeDlyHMSM(0, 0, 0, ADC_GetVal() + 10); } } } }
static void FirstTask (void *p_arg) { p_arg = p_arg; BSP_InitIO(); #if OS_TASK_STAT_EN > 0 OSStatInit(); #endif AppTaskCreate(); /* The other tasks in the application are generally */ /* created in a separate function to reduce clutter */ /* in main */ while (1) { xil_printf("First task says Hello World\n"); //printf("First task says Hello World\n"); OSTimeDlyHMSM(0,0,3,0); } }
void AppTaskStart() { CPU_INT08U err; // -------------------------------------------------------------------------------------------- // Init BSP and FPGA module BSP_Dly(10000); // to wait FPGA to be loaded (time in us) BSP_InitIO(); // Initialize BSP functions BSPFPGA_Reset(); #ifdef AX12_REG_PROGRAMMING ARMS_InitReg(); // Register configuration - Comment for match AppDebugMsg("AX12_REG_PROGRAMMING ok\n"); while(1) { OSTimeDlyHMSM(0, 0, 1, 0); } #endif #if (OS_TASK_STAT_EN > 0) OSStatInit(); // Determine CPU capacity #endif #ifdef APP_TASK_ODO_ENABLED // -------------------------------------------------------------------------------------------- // Starts TaskOdo OSTaskCreateExt( TaskOdo_Main, (void *)0, (OS_STK *)&AppTaskOdoStk[APP_TASK_ODO_STK_SIZE - 1], APP_TASK_ODO_PRIO, APP_TASK_ODO_PRIO, (OS_STK *)&AppTaskOdoStk[0], APP_TASK_ODO_STK_SIZE, (void *)0, OS_TASK_OPT_STK_CHK | OS_TASK_OPT_STK_CLR); #if OS_TASK_NAME_SIZE > 13 OSTaskNameSet(APP_TASK_ODO_PRIO, "TaskOdo", &err); #endif #endif #ifdef APP_TASK_ASSER_ENABLED // -------------------------------------------------------------------------------------------- // Starts TaskAsser OSTaskCreateExt( TaskAsser_Main, (void *)0, (OS_STK *)&AppTaskAsserStk[APP_TASK_ASSER_STK_SIZE - 1], APP_TASK_ASSER_PRIO, APP_TASK_ASSER_PRIO, (OS_STK *)&AppTaskAsserStk[0], APP_TASK_ASSER_STK_SIZE, (void *)0, OS_TASK_OPT_STK_CHK | OS_TASK_OPT_STK_CLR); #if OS_TASK_NAME_SIZE > 13 OSTaskNameSet(APP_TASK_ASSER_PRIO, "TaskAsser", &err); #endif #endif #ifdef APP_TASK_MVT_ENABLED // -------------------------------------------------------------------------------------------- // Starts Mvt OSTaskCreateExt( TaskMvt_Main, (void *)0, (OS_STK *)&AppTaskMvtStk[APP_TASK_MVT_STK_SIZE - 1], APP_TASK_MVT_PRIO, APP_TASK_MVT_PRIO, (OS_STK *)&AppTaskMvtStk[0], APP_TASK_MVT_STK_SIZE, (void *)0, OS_TASK_OPT_STK_CHK | OS_TASK_OPT_STK_CLR); #if OS_TASK_NAME_SIZE > 13 OSTaskNameSet(APP_TASK_ASSER_PRIO, "TaskMvt", &err); #endif #endif #ifdef APP_TASK_SENSORS_ENABLED // -------------------------------------------------------------------------------------------- // Starts TaskSensors OSTaskCreateExt( TaskSensors_Main, (void *)0, (OS_STK *)&AppTaskSensorsStk[APP_TASK_SENSORS_STK_SIZE - 1], APP_TASK_SENSORS_PRIO, APP_TASK_SENSORS_PRIO, (OS_STK *)&AppTaskSensorsStk[0], APP_TASK_SENSORS_STK_SIZE, (void *)0, OS_TASK_OPT_STK_CHK | OS_TASK_OPT_STK_CLR); #if OS_TASK_NAME_SIZE > 13 OSTaskNameSet(APP_TASK_SENSORS_PRIO, "TaskSensors", &err); #endif #endif #ifdef APP_TASK_MAIN_ENABLED // -------------------------------------------------------------------------------------------- // Starts TaskMain OSTaskCreateExt( TaskMain_Main, (void *)0, (OS_STK *)&AppTaskMainStk[APP_TASK_MAIN_STK_SIZE - 1], APP_TASK_MAIN_PRIO, APP_TASK_MAIN_PRIO, (OS_STK *)&AppTaskMainStk[0], APP_TASK_MAIN_STK_SIZE, (void *)0, OS_TASK_OPT_STK_CHK | OS_TASK_OPT_STK_CLR); #if OS_TASK_NAME_SIZE > 13 OSTaskNameSet(APP_TASK_MAIN_PRIO, "TaskMain", &err); #endif #endif #ifdef APP_TASK_TEMPO_ENABLED // -------------------------------------------------------------------------------------------- // Starts TaskTempo OSTaskCreateExt( TaskTempo_Main, (void *)0, (OS_STK *)&AppTaskTempoStk[APP_TASK_TEMPO_STK_SIZE - 1], APP_TASK_TEMPO_PRIO, APP_TASK_TEMPO_PRIO, (OS_STK *)&AppTaskTempoStk[0], APP_TASK_TEMPO_STK_SIZE, (void *)0, OS_TASK_OPT_STK_CHK | OS_TASK_OPT_STK_CLR); #if OS_TASK_NAME_SIZE > 13 OSTaskNameSet(APP_TASK_MAIN_PRIO, "TaskTempo", &err); #endif #endif // All tasks are started return; }