コード例 #1
0
ファイル: wifimng.c プロジェクト: littlevgl/misc
static void wifimng_netw_con_cb(wifi_state_t state, const char * txt)
{
    if(state == WIFI_STATE_OK) {
        wifimng_timestamp = systick_get();
        wifimng_state = WIFIMNG_STATE_TCP_CON_DELAY;
    } else {
        wifimng_timestamp = systick_get();
        wifimng_state = WIFIMNG_STATE_RETRY;
    }
}
コード例 #2
0
ファイル: schedule.c プロジェクト: tschristensen/EMB
int16_t start_rtcs_scheduler(void)
/*****************************************************************************
*   Input    :	-
*   Output   :	-
*   Function :	The RTCS scheduler 
******************************************************************************/
{
	// contains temp status of semaphores.
	// INT16U semaphores_task = 0;

	ENTER_CRITICAL();
	timer0_systick_init();
	timer0_systick_start();
	task_setup();
	init_tasks();
	EXIT_CRITICAL();

	while(1)
	{
		//Simple and no good implementation of timer incrementation
		//This needs to be changed into a correct interrupt handler.
		if (Xil_In32(XSCUTIMER_0_INT_STATUS_REG) & 0x00000001)
		{
			// Clear SCUtimer interrupt flag
			Xil_Out32(XSCUTIMER_0_INT_STATUS_REG,0x00000001);

			//increment tick
			systick_increment();
			//increment systime
			systime_increment();
		}

		if (systick_get())
		{
			systick_decrement();
			for (rtcs_i = 0; rtcs_i < LAST_TASK+1; rtcs_i++)
			{
				if ((task_state[rtcs_i] == RUNNING) && (task_time[rtcs_i] > 0))
 			  	{
					task_time[rtcs_i]--;
				}	
			}	
			
			for (rtcs_i = 0; rtcs_i < LAST_TASK+1; rtcs_i++)
			{
				if _READY(rtcs_i)
				{
					task_time[rtcs_i] = 0;
					current_task = rtcs_i;
					// Call task.
					(*task[rtcs_i])();
				}
			}

			if(err_overload_hndlr != NULL)
			{
				//call overload error handler
				(*err_overload_hndlr)(systick_get()); //if tick > 0 the cpu is overloaded
			}

		}

	} // while(!)
	return 0;
}