Esempio n. 1
0
__task void initTask(void){
	
	
	//sem init
	os_sem_init(&semIncMin, 0);
	os_sem_init(&semKeyPress, 0);
	os_sem_init(&semIncHour, 0);
	os_sem_init(&semIncSec, 0);
	
	
	initTexts();
		
	//mutex init
	os_mut_init(&mutTime);
	os_mut_init(&mut_msg_ptr);
	os_mut_init(&mut_msg_offset);
	
	
	//task init
	os_tsk_create(taskSerial, 0x82);
	os_tsk_create(clock_task, 0x90);
	os_tsk_create(taskIncHour, 0x7F);
	os_tsk_create(taskIncMin, 0x80);
	os_tsk_create(taskIncSec, 0x81);
	disTaskId = os_tsk_create(updateDisplay, 0x10);
	keyTaskId = os_tsk_create(key_task, 0x7E);
	joyTaskId = os_tsk_create(joy_task, 0x7D);
	
	//display stuff...
	os_evt_set(DIS_EVT_MSG_PTR, disTaskId);
	
	//end
	os_tsk_delete_self();
}
Esempio n. 2
0
Chip_INIT_RESULT ChipE1Port16Logic::ChipInit(void) {
    Chip_INIT_RESULT rtn = updataFPGA();
    if( rtn == succeed ) {
        uint16 value = regAccess->readReg(LED);//temp test
        value |= 2;
        regAccess->writeReg(LED, value);
        os_mut_init(mut_dcn_rcv);
    }
    else if( rtn == donothing ) {
        os_mut_init(mut_dcn_rcv);
    }
    return rtn;
}
__task void init(void)
{
	os_mut_init(&g_mut_uart);
	os_mut_init(&procon);
	
	for( task_creator_ctr = 0; task_creator_ctr < P; task_creator_ctr++ )
	{
		os_tsk_create(producer_task, 0);
	}
	
	task_creator_ctr = 0;
	
	for( task_creator_ctr = 0; task_creator_ctr < C; task_creator_ctr++ )
	{
		os_tsk_create(consumer_task, 0);
	}
	
	// os_tsk_create(updater_task, 10);
	
	os_tsk_delete_self();
}
Esempio n. 4
0
/*----------------------------------------------------------------------------
 *        Task 7 'init': Initialize
 *---------------------------------------------------------------------------*/
__task void init (void) {

  os_mut_init(mut_GLCD);

  t_phaseA = os_tsk_create (phaseA, 0);  /* start task phaseA                */
  t_phaseB = os_tsk_create (phaseB, 0);  /* start task phaseB                */
  t_phaseC = os_tsk_create (phaseC, 0);  /* start task phaseC                */
  t_phaseD = os_tsk_create (phaseD, 0);  /* start task phaseD                */
  t_clock  = os_tsk_create (clock, 0);   /* start task clock                 */
  t_lcd    = os_tsk_create (lcd, 0);     /* start task lcd                   */
  os_evt_set (0x0001, t_phaseA);         /* send signal event to task phaseA */
  os_tsk_delete_self ();
}
Esempio n. 5
0
__task void init (void) {

   os_mut_init(mut_GLCD);
	 
	 os_mut_init(mut_Gclock);
	
   GUI_UC_SetEncodeUTF8();  

  if(HAL_RTCEx_BKUPRead(&RtcHandle, RTC_BKP_DR6) !=1)
	{
		 
		 zhuantskid = os_tsk_create (zhuan1, 0);
	   maintskid  = os_tsk_create (Main_Task, 0);  
     keytskid   = os_tsk_create (phase_KEY, 0);    
	   servertskid = os_tsk_create (Server_Task, 0);  		
	}else
	{
		                                   Time3Disable();																			                              												 
																			 HAL_GPIO_WritePin(GPIOE,GPIO_PIN_3,GPIO_PIN_SET);  
																			 HAL_GPIO_WritePin(GPIOE,GPIO_PIN_2,GPIO_PIN_RESET);  
                                   
                                       HAL_GPIO_WritePin(GPIOG,GPIO_PIN_3,GPIO_PIN_RESET);  
																			 HAL_GPIO_WritePin(GPIOG,GPIO_PIN_2,GPIO_PIN_SET);  
		
	}	
  	
	 
	
	 
	 os_tsk_create (power, 0);  
   
 
  // os_tmr_create(500,2);     

  os_tsk_delete_self ();
}
/*---------------------------------------------------------------------*/
__task void init(void)
{
	//Initialize the memory pool
	_init_box(box_mem, sizeof(box_mem), 4);
	
  os_mut_init(&g_mut_uart);
  
  os_mut_wait(g_mut_uart, 0xFFFF);
  printf("init: TID = %d\n", os_tsk_self());
  os_mut_release(g_mut_uart);
  
	g_tid = os_tsk_create(task1, 1);  /* task 1 at priority 1 */
	os_mut_wait(g_mut_uart, 0xFFFF);
  printf("init: created task1 with TID %d\n", g_tid);
  os_mut_release(g_mut_uart);
  
  g_tid = os_tsk_create(task2, 4);  /* task 2 at priority 2 */
  os_mut_wait(g_mut_uart, 0xFFFF);
  printf("init: created task2 with TID %d\n", g_tid);
	os_mut_release(g_mut_uart);
	
	g_tid = os_tsk_create(task3, 3);  /* task 3 at priority 3 */
  os_mut_wait(g_mut_uart, 0xFFFF);
  printf("init: created task3 with TID %d\n", g_tid);
	os_mut_release(g_mut_uart);
	
	g_tid = os_tsk_create(task4, 4);  /* task 4 at priority 4 */
  os_mut_wait(g_mut_uart, 0xFFFF);
  printf("init: created task4 with TID %d\n", g_tid);
	os_mut_release(g_mut_uart);
	
	g_tid = os_tsk_create(task5, 1);  /* task 5 at priority 1 */
  os_mut_wait(g_mut_uart, 0xFFFF);
  printf("init: created task5 with TID %d\n", g_tid);
	os_mut_release(g_mut_uart);
	
  os_tsk_delete_self();     /* task MUST delete itself before exiting */
}
Esempio n. 7
0
 int InitMutex(wolfSSL_Mutex* m)
 {
     os_mut_init (m); 
     return 0;
 }
Esempio n. 8
0
 int InitMutex(CyaSSL_Mutex* m)
 {
     os_mut_init (m); 
     return 0;
 }
Esempio n. 9
0
static void sync_init(void)
{
    sync_thread = os_tsk_self();
    os_mut_init(&sync_mutex);
}
Esempio n. 10
0
osMutexId_t osMutexNew(const osMutexAttr_t *attr)
{
    os_mut_init(onlyMutex);
    return (osMutexId_t)onlyMutex;
}
Esempio n. 11
0
__task void power (void)
 {
   unsigned int count =0;
   unsigned int temp;
	 static GPIO_InitTypeDef  GPIO_InitStruct;
	 GPIO_PinState bitstatus;
  
   while(1)
     {
	      GPIO_InitStruct.Pin = GPIO_PIN_2;
        GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
        GPIO_InitStruct.Pull = GPIO_PULLUP;
        GPIO_InitStruct.Speed = GPIO_SPEED_FAST;  
        HAL_GPIO_Init(GPIOC, &GPIO_InitStruct); 	  
	      bitstatus   =   HAL_GPIO_ReadPin(GPIOC,GPIO_PIN_2);	      
        if(bitstatus==GPIO_PIN_RESET)
				{			
             os_dly_wait (200);
             bitstatus   =   HAL_GPIO_ReadPin(GPIOC,GPIO_PIN_2);
					   if(bitstatus==GPIO_PIN_RESET)
						 {	 
							 
							   if(HAL_RTCEx_BKUPRead(&RtcHandle, RTC_BKP_DR6)==0)
								 {
												count =0;
											 do{
															 bitstatus   =   HAL_GPIO_ReadPin(GPIOC,GPIO_PIN_2);
															 count++;
															 if(count>5000000)
															 {       
																			 Time3Disable();
																			 GUI_Clear();                                 												 
																			 HAL_GPIO_WritePin(GPIOE,GPIO_PIN_3,GPIO_PIN_SET);  
																			 HAL_GPIO_WritePin(GPIOE,GPIO_PIN_2,GPIO_PIN_RESET);  
																			 if(zhuantskid  !=NULL)  os_tsk_delete(zhuantskid);   
																			 if(maintskid   !=NULL)  os_tsk_delete(maintskid);   
																			 if(keytskid    !=NULL)  os_tsk_delete(keytskid);  
																			 if(servertskid !=NULL)  os_tsk_delete(servertskid);  
																			 if(meuntskid !=NULL)  os_tsk_delete(meuntskid);  
																			 if(setsystemtimetskid !=NULL)  os_tsk_delete(setsystemtimetskid);  
																			 if(setledlighttskid !=NULL)  os_tsk_delete(setledlighttskid);  
																			 if(setledtimetskid !=NULL)  os_tsk_delete(setledtimetskid);  
																			 if(setsoundtskid !=NULL)  os_tsk_delete(setsoundtskid);   													 
																			 if(setworkmodetskid !=NULL)  os_tsk_delete(setworkmodetskid);  
																			 if(yushentskid !=NULL)  os_tsk_delete(yushentskid);

                                       HAL_RTCEx_BKUPWrite(&RtcHandle,RTC_BKP_DR6,1);  		// 说明是正常关机状态;

                                       														 
                                       HAL_GPIO_WritePin(GPIOG,GPIO_PIN_3,GPIO_PIN_RESET);  
																			 HAL_GPIO_WritePin(GPIOG,GPIO_PIN_2,GPIO_PIN_SET);  
                                     											 
																	 
															 } 	 
													 
												 }while(bitstatus==GPIO_PIN_RESET); 	
									}else
                  {
                         os_mut_init(mut_GLCD);
	 
												 os_mut_init(mut_Gclock);
												
												 GUI_UC_SetEncodeUTF8();   
												 
												 zhuantskid = os_tsk_create (zhuan1, 0);
												 maintskid  = os_tsk_create (Main_Task, 0);  
												 keytskid   = os_tsk_create (phase_KEY, 0);    
												 servertskid = os_tsk_create (Server_Task, 0);   
                         Time3Enable(HAL_RTCEx_BKUPRead(&RtcHandle, RTC_BKP_DR1));
                        
										     HAL_GPIO_WritePin(GPIOE,GPIO_PIN_3,GPIO_PIN_RESET);  
												 HAL_GPIO_WritePin(GPIOE,GPIO_PIN_2,GPIO_PIN_SET);  
										
                         HAL_RTCEx_BKUPWrite(&RtcHandle,RTC_BKP_DR6,0);  // 清楚掉关机状态 	
                  }										
					
	           }
	  
	      }
     
	    }    
   
 }