Ejemplo n.º 1
0
void main(void)
{
    OS_ERR error;

    HAL_Init();

    TP_USART1.init(0);
    Debug_Init( (struct TRANSPORT_IF*)&TP_USART1 );

    CPU_IntDis();

    OSInit(&error);

    Launcher_Exec();

    /////////////////////////////////////////////////////////////////
    RCC_ClocksTypeDef RCC_Clocks;
    RCC_GetClocksFreq(&RCC_Clocks);

    OS_CPU_SysTickInit( (RCC_Clocks.HCLK_Frequency/OSCfg_TickRate_Hz) - 1 );
    /////////////////////////////////////////////////////////////////

    OSStart(&error);

}
Ejemplo n.º 2
0
int  main (void)
{
    OS_ERR  err;


    BSP_IntDisAll();                                            /* Disable all interrupts.                              */

    OSInit(&err);                                               /* Init uC/OS-III.                                      */

    OSTaskCreate((OS_TCB     *)&AppTaskStartTCB,                /* Create the start task                                */
                 (CPU_CHAR   *)"App Task Start",
                 (OS_TASK_PTR )AppTaskStart, 
                 (void       *)0,
                 (OS_PRIO     )APP_TASK_START_PRIO,
                 (CPU_STK    *)&AppTaskStartStk[0],
                 (CPU_STK_SIZE)APP_TASK_START_STK_SIZE / 10,
                 (CPU_STK_SIZE)APP_TASK_START_STK_SIZE,
                 (OS_MSG_QTY  )0,
                 (OS_TICK     )0,
                 (void       *)0,
                 (OS_OPT      )(OS_OPT_TASK_STK_CHK | OS_OPT_TASK_STK_CLR),
                 (OS_ERR     *)&err);

    OSStart(&err);                                              /* Start multitasking (i.e. give control to uC/OS-III). */
}
Ejemplo n.º 3
0
int main() {

  /* Initialise the GPIO pins */
	gpioPinInit(&pin[LED1], 1, 18, OUTPUT_PIN);
	gpioPinInit(&pin[LED2], 0, 13, OUTPUT_PIN);

  /* Initialise the OS */
  OSInit();                                                   

  /* Create the tasks */
  OSTaskCreate(appTaskLED1,                               
               (void *)0,
               (OS_STK *)&appTaskLED1Stk[APP_TASK_LED1_STK_SIZE - 1],
               APP_TASK_LED1_PRIO);
  
  OSTaskCreate(appTaskLED2,                               
               (void *)0,
               (OS_STK *)&appTaskLED2Stk[APP_TASK_LED2_STK_SIZE - 1],
               APP_TASK_LED2_PRIO);

  
  /* Start the OS */
  OSStart();                                                  
  
  /* Should never arrive here */ 
  return 0;      
}
Ejemplo n.º 4
0
int main(void)
{
    OS_ERR  err;

    BSP_IntDisAll();                                            /* Disable all interrupts.                              */
    
    CPU_Init();                                                 /* Initialize the uC/CPU Services                       */
    Mem_Init();                                                 /* Initialize Memory Management Module                  */
    Math_Init();                                                /* Initialize Mathematical Module                       */

    OSInit(&err);                                               /* Init uC/OS-III.                                      */

    OSTaskCreate((OS_TCB       *)&AppTaskStartTCB,              /* Create the start task                                */
                 (CPU_CHAR     *)"App Task Start",
                 (OS_TASK_PTR   )AppTaskStart,
                 (void         *)0u,
                 (OS_PRIO       )APP_CFG_TASK_START_PRIO,
                 (CPU_STK      *)&AppTaskStartStk[0u],
                 (CPU_STK_SIZE  )AppTaskStartStk[APP_CFG_TASK_START_STK_SIZE / 10u],
                 (CPU_STK_SIZE  )APP_CFG_TASK_START_STK_SIZE,
                 (OS_MSG_QTY    )0u,
                 (OS_TICK       )0u,
                 (void         *)0u,
                 (OS_OPT        )(OS_OPT_TASK_STK_CHK | OS_OPT_TASK_STK_CLR),
                 (OS_ERR       *)&err);

    OSStart(&err);                                              /* Start multitasking (i.e. give control to uC/OS-III). */

    (void)&err;

    return (0u);
}
Ejemplo n.º 5
0
int main() {
    /* Initialise the hardware */
    bspInit();
    robotInit();

    /* Initialise the OS */
    OSInit();


    /* Create emergency stop task */
    OSTaskCreate(appTaskEmergencyStop,
                 (void *)0,
                 (OS_STK *)&appTaskEmergencyStopStk[APP_TASK_EMERGENCY_STOP_STK_SIZE - 1],
                 APP_TASK_EMERGENCY_STOP_PRIO);

    /* Create buttons task, used when testing to get robot positions */
    OSTaskCreate(appTaskButtons,
                 (void *)0,
                 (OS_STK *)&appTaskButtonsStk[APP_TASK_BUTTONS_STK_SIZE - 1],
                 APP_TASK_BUTTONS_PRIO);

    /* Create move block task for the moving of the block from conveyor to pad 2 */
    OSTaskCreate(appTaskMoveBlock,
                 (void *)0,
                 (OS_STK *)&appTaskMoveBlockStk[APP_TASK_MOVE_BLOCK_STK_SIZE - 1],
                 APP_TASK_MOVE_BLOCK_PRIO);

    /* Start the OS */
    OSStart();

    /* Should never arrive here */
    return 0;
}
Ejemplo n.º 6
0
                            void main(void)
{
    OSInit();

	TMOD = (TMOD & 0XF0) | 0X01;
	TL0 = 0x0;
	TH0 = 0x0;
	TR0 = 1;
	ET0 = 1;
	TF0 = 0;

	PC_DispClrScr(DISP_FGND_WHITE + DISP_BGND_BLACK); 
    PC_DispStr(15,  0, "Small RTOS(51), the Real-Time Kernel(For Keil c51)", DISP_FGND_WHITE + DISP_BGND_RED + DISP_BLINK);
    PC_DispStr(35,  1, "ChenMingJi", DISP_FGND_WHITE);
    PC_DispStr(35,  3, "EXAMPLE #2", DISP_FGND_WHITE);

    OSTaskCreate(TaskA, NULL, 0);
    OSTaskCreate(TaskB, NULL, 1);
    OSTaskCreate(TaskC, NULL, 2);
    OSTaskCreate(TaskD, NULL, 3);
    OSTaskCreate(TaskE, NULL, 4);

    while(1)
    {
        PCON = PCON | 0x01;                     /* CPU进入休眠状态 */
    }
}
Ejemplo n.º 7
0
int main(void)
{
	CPU_INT08U os_err;
	
	//禁止CPU中断
	CPU_IntDis();
	
	//UCOS 初始化
	OSInit();                                                   /* Initialize "uC/OS-II, The Real-Time Kernel".         */
	
	//硬件平台初始化
	BSP_Init();                                                 /* Initialize BSP functions.  */
	/* Configure FSMC Bank1 NOR/PSRAM */

	I2C_Ini();
    HMC5883L_Init();
	HMC5883L_Start();
	MPU6050_Init();	 

		
   //建立主任务, 优先级最高  建立这个任务另外一个用途是为了以后使用统计任务
   os_err = OSTaskCreate((void (*) (void *)) App_TaskStart,	  		  		//指向任务代码的指针
                          (void *) 0,								  		//任务开始执行时,传递给任务的参数的指针
               (OS_STK *) &App_TaskStartStk[APP_TASK_START_STK_SIZE - 1],	//分配给任务的堆栈的栈顶指针   从顶向下递减
               (INT8U) APP_TASK_START_PRIO);								//分配给任务的优先级
   os_err =os_err;
   //ucos的节拍计数器清0    节拍计数器是0-4294967295    对于节拍频率100hz时, 每隔497天就重新计数 
   OSTimeSet(0);
   OSStart();                                                  /* Start multitasking (i.e. give control to uC/OS-II).  */
                                                 /* Start multitasking (i.e. give control to uC/OS-II).  */
 
   return (0);
}
Ejemplo n.º 8
0
Archivo: main.c Proyecto: rcacho/book
void main (void) 
{
	OSInit();    
    InitTimer2();
    OSTaskCreate(sys_init, (void *)0, &sys_init_Stk[0],1);
    OSStart();
}
Ejemplo n.º 9
0
void ucos_test(void)
{
	char *str1 = "!";
	char *str2 = "?";

	
   OSInit();
	//mbox = OSQCreate (queue, sizeof(queue)/sizeof(queue[0]));
	//dprintf("OSQCreate return:0x%8x\r\n",mbox);
	
	/*install os timer*/	
	//sys_timer_start();
    //OSTaskCreate(task1,(void *)str1,&task1_stk[1024],11);
    //OSTaskCreate(task2,(void *)str2,&task2_stk[1024],10);
    //OSTaskCreate(task3,(void *)"*",&task3_stk[1024],11);
    //debug_enable = 1;
	sys_thread_new("thread1", task1, str1, 1024, 8);
	sys_thread_new("thread2", task2, str2, 1024, 9);
	sys_thread_new("thread3", task3, str2, 1024, 10);
	sys_mbox_new(&sys_mbox, 30);
	//sys_sem_new(&sys_sem, 0);
	sys_mutex_new(&sys_mutex);
    OSStart();
	
    while(1)
    {
        dprintf("os runtime error");
    }
}
Ejemplo n.º 10
0
int main() {
  /* Initialise the hardware */
  bspInit();
  conveyorInit();
 
  /* Initialise the OS */
  OSInit();                                                   

  /* Create Tasks */
  OSTaskCreate(appTaskEmergencyStop,                               
               (void *)0,
               (OS_STK *)&appTaskEmergencyStopStk[APP_TASK_EMERGENCY_STOP_STK_SIZE - 1],
               APP_TASK_EMERGENCY_STOP_PRIO);
  OSTaskCreate(appTaskMonitorSens1,                               
               (void *)0,
               (OS_STK *)&appTaskMonitorSens1Stk[APP_TASK_MONITOR_SENS1_STK_SIZE - 1],
               APP_TASK_MONITOR_SENS1_PRIO);
  OSTaskCreate(appTaskMonitorSens2,                               
               (void *)0,
               (OS_STK *)&appTaskMonitorSens2Stk[APP_TASK_MONITOR_SENS2_STK_SIZE - 1],
               APP_TASK_MONITOR_SENS2_PRIO);
 
   
  /* Start the OS */
  OSStart();                                                  
  
  /* Should never arrive here */ 
  return 0;      
}
Ejemplo n.º 11
0
int  main (void)
{
#if (OS_TASK_NAME_SIZE > 7) && (OS_TASK_STAT_EN > 0)
    CPU_INT08U  err;
#endif


    CPU_IntDis();                                                       /* Disable all interrupts until we are ready to accept them */
    OSInit();  	
	BSP_Init();          
	
	init_err_printf();                                           

    OSTaskCreateExt(AppTaskStart,                                      
                    (void *)0,
                    (OS_STK *)&AppTaskStartStk[APP_TASK_START_STK_SIZE - 1],
                    APP_TASK_START_PRIO,
                    APP_TASK_START_PRIO,
                    (OS_STK *)&AppTaskStartStk[0],
                    APP_TASK_START_STK_SIZE,
                    (void *)0,
                    OS_TASK_OPT_STK_CHK | OS_TASK_OPT_STK_CLR);

#if (OS_TASK_NAME_SIZE > 7) && (OS_TASK_STAT_EN > 0)
    OSTaskNameSet(APP_TASK_START_PRIO, (CPU_CHAR *)"Startup", &err);
#endif

    OSStart();     
	                                                   
	info_printf("EVK1100_Interface to cyclone-III rustlight fpga starting\n");

    return (0);                                                        
}
Ejemplo n.º 12
0
int  main (void)
{
    OS_ERR  err;


    CPU_IntDis();                                               /* Disable all interrupts.                              */

    OSInit(&err);                                               /* Init uC/OS-III.                                      */

    OSTaskCreate((OS_TCB     *)&StartUp_TCB,                /* Create the start task                                */
                 (CPU_CHAR   *)"StartUp",
                 (OS_TASK_PTR ) Task_Start,
                 (void       *) 0,
                 (OS_PRIO     ) STARTUP_TASK_PRIO,
                 (CPU_STK    *)&StartUp_Stk[0],
                 (CPU_STK_SIZE) STARTUP_TASK_STK_SIZE / 10u,
                 (CPU_STK_SIZE) STARTUP_TASK_STK_SIZE,
                 (OS_MSG_QTY  ) 0u,
                 (OS_TICK     ) 0u,
                 (void       *) 0,
                 (OS_OPT      )(OS_OPT_TASK_STK_CHK | OS_OPT_TASK_STK_CLR),
                 (OS_ERR     *)&err);

    OSStart(&err);                                              /* Start multitasking (i.e. give control to uC/OS-III). */

    while (1) {
        ;
    }
}
Ejemplo n.º 13
0
Archivo: TEST.C Proyecto: yylea/UCOS2
void  main (void)
{
    PC_DispClrScr(DISP_BGND_BLACK);                        /* Clear the screen                         */

    OSInit();                                              /* Initialize uC/OS-II                      */

    PC_DOSSaveReturn();                                    /* Save environment to return to DOS        */

    PC_VectSet(uCOS, OSCtxSw);                             /* Install uC/OS-II's context switch vector */

    //Initialized elapsed time measurement function that is used to
    //measure the execution time of OSTaskStkChk()
    PC_ElapsedInit();                                      /* Initialized elapsed time measurement     */

    strcpy(TaskUserData[TASK_START_ID].TaskName, "StartTask");
    OSTaskCreateExt(TaskStart,                             //pointer to task's function
                    (void *)0,                             //the parameter to the task's function
                    &TaskStartStk[TASK_STK_SIZE - 1],      //top of the stack
                    TASK_START_PRIO,                       //priority
                    TASK_START_ID,                         //task ID
                    &TaskStartStk[0],                      //bottom of the stack
                    TASK_STK_SIZE,                         //stack size
                    &TaskUserData[TASK_START_ID],          //Task Control Block TCB can store a pointer to a user-provided data structure
                                                           //this allows to extend the functionality of UCOSII
                    0);                                    //a set of additional options
    OSStart();                                             /* Start multitasking                       */
}
Ejemplo n.º 14
0
int main(void)
{
#if (OS_TASK_NAME_EN > 0)
    CPU_INT08U  err;
#endif   


    BSP_IntDisAll();                                            /* Disable all interrupts.                              */
    
    OSInit();                                                   /* Initialize "uC/OS-II, The Real-Time Kernel"          */

    OSTaskCreateExt((void (*)(void *)) AppTaskStart,           /* Create the start task                                */
                    (void           *) 0,
                    (OS_STK         *)&AppTaskStartStk[APP_CFG_TASK_START_STK_SIZE - 1],
                    (INT8U           ) APP_CFG_TASK_START_PRIO,
                    (INT16U          ) APP_CFG_TASK_START_PRIO,
                    (OS_STK         *)&AppTaskStartStk[0],
                    (INT32U          ) APP_CFG_TASK_START_STK_SIZE,
                    (void           *) 0,
                    (INT16U          )(OS_TASK_OPT_STK_CHK | OS_TASK_OPT_STK_CLR));

#if (OS_TASK_NAME_EN > 0)
    OSTaskNameSet(APP_CFG_TASK_START_PRIO, "Start", &err);
#endif

    OSStart();                                                  /* Start multitasking (i.e. give control to uC/OS-II)   */
    
    return (1);
}
Ejemplo n.º 15
0
//主函数
int main(void)
{
	OS_ERR err;
	CPU_SR_ALLOC();
	
	delay_init(168);  //时钟初始化
	NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);//中断分组配置
	uart_init(115200);   //串口初始化
	LED_Init();         //LED初始化	
	LCD_Init();			//LCD初始化	
	KEY_Init();			//按键初始化
	BEEP_Init();		//初始化蜂鸣器
	FSMC_SRAM_Init();	//初始化SRAM
	my_mem_init(SRAMIN);//初始化内部RAM
	ucos_load_main_ui();//加载主UI
	
	OSInit(&err);		    //初始化UCOSIII
	OS_CRITICAL_ENTER();	//进入临界区			 
	//创建开始任务
	OSTaskCreate((OS_TCB 	* )&StartTaskTCB,		//任务控制块
				 (CPU_CHAR	* )"start task", 		//任务名字
                 (OS_TASK_PTR )start_task, 			//任务函数
                 (void		* )0,					//传递给任务函数的参数
                 (OS_PRIO	  )START_TASK_PRIO,     //任务优先级
                 (CPU_STK   * )&START_TASK_STK[0],	//任务堆栈基地址
                 (CPU_STK_SIZE)START_STK_SIZE/10,	//任务堆栈深度限位
                 (CPU_STK_SIZE)START_STK_SIZE,		//任务堆栈大小
                 (OS_MSG_QTY  )0,					//任务内部消息队列能够接收的最大消息数目,为0时禁止接收消息
                 (OS_TICK	  )0,					//当使能时间片轮转时的时间片长度,为0时为默认长度,
                 (void   	* )0,					//用户补充的存储区
                 (OS_OPT      )OS_OPT_TASK_STK_CHK|OS_OPT_TASK_STK_CLR, //任务选项
                 (OS_ERR 	* )&err);				//存放该函数错误时的返回值
	OS_CRITICAL_EXIT();	//退出临界区	 
	OSStart(&err);      //开启UCOSIII
}
Ejemplo n.º 16
0
int main() {

  /* Initialise the board support package */
  bspInit();

  /* Initialise the OS */
  OSInit();                                                   

  /* Create the tasks */
  OSTaskCreate(appTaskLink,                               
               (void *)0,
               (OS_STK *)&appTaskLinkStk[APP_TASK_LINK_STK_SIZE - 1],
               APP_TASK_LINK_PRIO);

  OSTaskCreate(appTaskConnect,                               
               (void *)0,
               (OS_STK *)&appTaskConnectStk[APP_TASK_CONNECT_STK_SIZE - 1],
               APP_TASK_CONNECT_PRIO);

  OSTaskCreate(appTaskCANWrite,                               
               (void *)0,
               (OS_STK *)&appTaskCANWriteStk[APP_TASK_CAN_WRITE_STK_SIZE - 1],
               APP_TASK_CAN_WRITE_PRIO);

  OSTaskCreate(appTaskCANRead,                               
               (void *)0,
               (OS_STK *)&appTaskCANReadStk[APP_TASK_CAN_READ_STK_SIZE - 1],
               APP_TASK_CAN_READ_PRIO);
  
  /* Start the OS */
  OSStart();                                                  
  
  /* Should never arrive here */ 
  return 0;      
}
Ejemplo n.º 17
0
/*
*********************************************************************************************************
*                                                main()
*
* Description : This is the standard entry point for C code.  It is assumed that your code will call
*               main() once you have performed all necessary initialization.
*
* Argument(s) : none.
*
* Return(s)   : none.
*
* Caller(s)   : This the main standard entry point.
*
* Note(s)     : none.
*********************************************************************************************************
*/
int  main(void)
{   
    INT8U err;
    

    BSP_IntDisAll();                                            /* Disable all interrupts until we are ready to accept them */
    
    App_MemAlloc();
    
    OSInit();                                                   /* Initialize "uC/OS-II, The Real-Time Kernel"              */

    OSTaskCreateExt((void (*)(void *)) App_TaskStart,           /* Create the start task                                    */
                    (void           *) 0,
                    (OS_STK         *)&App_TaskStartStk[APP_CFG_TASK_START_STK_SIZE - 1],
                    (INT8U           ) APP_CFG_TASK_START_PRIO,
                    (INT16U          ) APP_CFG_TASK_START_PRIO,
                    (OS_STK         *)&App_TaskStartStk[0],
                    (INT32U          ) APP_CFG_TASK_START_STK_SIZE,
                    (void           *) 0,
                    (INT16U          )(OS_TASK_OPT_STK_CHK | OS_TASK_OPT_STK_CLR));

    OSTaskNameSet(APP_CFG_TASK_START_PRIO, "Start", &err);

    OSStart();                                                  /* Start multitasking (i.e. give control to uC/OS-II)       */
}
Ejemplo n.º 18
0
void main(void)
{
	//UBYTE err;
	OSInit();
	if (OSTaskCreate(Task1, NULL, &Task1Stk[TASK_STK_SIZE-1], TASK1_PRIO) != OS_ERR_NONE)
	{
		printf("erreur");
	}
	if (OSTaskCreate(Task2, NULL, &Task2Stk[TASK_STK_SIZE - 1], TASK2_PRIO) != OS_ERR_NONE)
	{
		printf("erreur");
	}
	if (OSTaskCreate(Task3, NULL, &Task3Stk[TASK_STK_SIZE - 1], TASK3_PRIO) != OS_ERR_NONE)
	{
		printf("erreur");
	}
	if (OSTaskCreate(Task4, NULL, &Task4Stk[TASK_STK_SIZE - 1], TASK4_PRIO) != OS_ERR_NONE)
	{
		printf("erreur");
	}
	if (OSTaskCreate(Task5, NULL, &Task5Stk[TASK_STK_SIZE - 1], TASK5_PRIO) != OS_ERR_NONE)
	{
		printf("erreur");
	}
	printf("End of Task creation\n");
	OSStart();



	// à compléter
	
    return;
}
Ejemplo n.º 19
0
int  main (void)
{
    CPU_INT08U  os_err;
    /* Disable all ints until we are ready to accept them. */
    BSP_IntDisAll();                                            
    /* Initialize "uC/OS-II, The Real-Time Kernel".*/
    OSInit();                                                   
    /* Create the start task.*/
    os_err = OSTaskCreateExt((void (*)(void *)) App_TaskStart,  
                             (void          * ) 0,
                             (OS_STK        * )&App_TaskStartStk[APP_TASK_START_STK_SIZE - 1],
                             (INT8U           ) APP_TASK_START_PRIO,
                             (INT16U          ) APP_TASK_START_PRIO,
                             (OS_STK        * )&App_TaskStartStk[0],
                             (INT32U          ) APP_TASK_START_STK_SIZE,
                             (void          * )0,
                             (INT16U          )(OS_TASK_OPT_STK_CLR | OS_TASK_OPT_STK_CHK));

#if (OS_TASK_NAME_SIZE >= 11)
    OSTaskNameSet(APP_TASK_START_PRIO, (CPU_INT08U *)"Start Task", &os_err);
#endif
    /* Start multitasking (i.e. give control to uC/OS-II).*/
    OSStart();                                                  

    return (0);
}
Ejemplo n.º 20
0
int  main (void)
{
    CPU_INT08U    err;

	//printf("Stack addr is 0x%x - 0x%x", &FirstTaskStk[0], &FirstTaskStk[TASK_STK_SIZE - 1] );


    BSP_IntDisAll();
    OSInit();                                   /* Initialize uC/OS-II                                 */

    /* Initialize RS232_Uart_1 - Set baudrate and number of stop bits */
    XUartNs550_SetBaud(XPAR_RS232_UART_1_BASEADDR, XPAR_XUARTNS550_CLOCK_HZ, 9600);
    XUartNs550_SetLineControlReg(XPAR_RS232_UART_1_BASEADDR, XUN_LCR_8_DATA_BITS);
    //err = printf("Hello World\n");
    OSTaskCreateExt(FirstTask,
                   (void *)0,
                   &FirstTaskStk[TASK_STK_SIZE - 1],
                   TASK1_ID,                    
                   TASK1_PRIO,
                   &FirstTaskStk[0],
                   TASK_STK_SIZE,
                   (void *)0,
                   OS_TASK_OPT_STK_CHK | OS_TASK_OPT_STK_CLR); 

    OSTaskNameSet(TASK1_PRIO, (CPU_INT08U *)"FirstTask", &err);

    OSStart();                                  /* Start Multitasking                                  */

    return 0;                                   /* Process should never reach this point               */
}
Ejemplo n.º 21
0
Archivo: main.c Proyecto: Mazetti/asf
int  main (void)
{
#if (OS_TASK_NAME_SIZE > 7) && (OS_TASK_STAT_EN > 0)
    CPU_INT08U  err;
#endif

	// Add delay to ensure EXTBT module is correctly reset.
#if UC3C
	cpu_delay_ms(AVR32_SCIF_RCOSC_FREQUENCY, 1000);
#else
        cpu_delay_ms(AVR32_PM_RCOSC_FREQUENCY, 1000);
#endif

	CPU_IntDis(); /*Disable all interrupts */

  	sysclk_init();

	OSInit();

	OSTaskCreateExt(app_task,(void *)0,
		(OS_STK *)&AppTaskStk[APP_TASK_STK_SIZE-1], APP_TASK_START_PRIO,
		APP_TASK_START_PRIO,(OS_STK *)&AppTaskStk[0], APP_TASK_STK_SIZE,
		(void *)0, OS_TASK_OPT_STK_CHK | OS_TASK_OPT_STK_CLR);

#if (OS_TASK_NAME_SIZE > 7) && (OS_TASK_STAT_EN > 0)
    OSTaskNameSet(APP_TASK_START_PRIO, (CPU_CHAR *)"Startup", &err);
#endif

	OSStart();

	return (0);
}
Ejemplo n.º 22
0
int main(void)
{
	GPIO_InitTypeDef GPIO_InitStructure;
	 CPU_INT08U os_err;
	 //BSP_Init();			
	 //BSP_IntDisAll();																						/* Disable all ints until we are ready to accept them.	*/
	 CPU_IntDis();
	 
	 OSInit();																									 /* Initialize "uC/OS-II, The Real-Time Kernel".				 */

	 BSP_Init();																								 /* Initialize BSP functions.	*/
	GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0;
	GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_OD;
	GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
	GPIO_Init(GPIOC, &GPIO_InitStructure);
	GPIOC->BSRR = 1<<0;

	 os_err = OSTaskCreate((void (*) (void *)) App_TaskStart,
							 /* Create the start task.															 */
													(void *) 0,
							 (OS_STK *) &App_TaskStartStk[APP_TASK_START_STK_SIZE - 1],
							 (INT8U) APP_TASK_START_PRIO);
	 
#if (OS_TASK_NAME_SIZE >= 11)
	 OSTaskNameSet(APP_TASK_START_PRIO, (CPU_INT08U *) "Start Task", &os_err);
#endif

//	 InfoSem = OSSemCreate(0); 
//	 Disp_Box = OSMboxCreate((void *) 0);							 
	 OSTimeSet(0);
	 OSStart();																									/* Start multitasking (i.e. give control to uC/OS-II).	*/

	 return (0);
}
Ejemplo n.º 23
0
/*
*********************************************************************************************************
*                                                  MAIN
*********************************************************************************************************
*/
int main (void)
{   
	
    OSInit();                                   /* Initialize uC/OS-II                      */
    OSTaskCreateExt(Task_Start,
                    (void *)0,
                    &TASK_START_STK[127],
                    TASK_START_PRIO,
                    TASK_START_ID,
                    &TASK_START_STK[0],
                    300,
                    (void *)0,//&TaskUserData[TASK_4_ID]
                    0);
        
  	RecPackedFlag=		OSSemCreate(0);
	RecBufOverFlowFlag=	OSSemCreate(0);
	RecTcpPackedFlag=	OSSemCreate(0);
	RecPingPackedFlag=	OSSemCreate(0);
	SendFlag=		    OSSemCreate(1);

	RecIcmpQFlag=		OSQCreate(&RecIcmpQ[0],Q_Max_Size);
	RecTcpQFlag=		OSQCreate(&RecTcpQ[0],Q_Max_Size);
	RecUdpQFlag=		OSQCreate(&RecUdpQ[0],Q_Max_Size);

    OSStart();                                  /* Start multitasking                       */
}
Ejemplo n.º 24
0
//*****************************************************************************
//** Main Function
//*****************************************************************************
void main(void)
{
	OS_STATUS OSStatus;
	
#if defined(GK6105S)
	*(volatile U32*)(0x81c2080) = 0x00000001;
#endif

    SystemInit();
    
    GM_Printf("\033[2J"); /* clear screen */
    GM_Printf("-------------------------------------------------\n");
    GM_Printf(" GK6105S KERNEL/UCOS Test Application\n");
    GM_Printf(" (C) Guoke Microelectronics 2012 - 2014\n");
    
#if defined(MY_UCOS)
    RTOS_Initialize(NULL);
    OSTaskCreate((void (*)(void *))KernelTest, 0, MainTaskStack, MainTaskPriority);
#else
    OSSysInit();
  	OSInit();
  	// OSStatus = OSAddTask((void (*)(void *))IdleTask, IdlePriority, IdleStack, IdleStackSize);
    OSStatus = OSAddTask((void (*)(void *))KernelTest, MainTaskPriority, MainTaskStack, MainTaskStackSize);
#endif
  	OSStart();
}
Ejemplo n.º 25
0
int main(void)
{
    DelayInit();
    SYSTICK_Init((1000*1000)/OS_TICKS_PER_SEC);
    SYSTICK_ITConfig(true);

    UART_QuickInit(UART0_RX_PD06_TX_PD07, 115200);

    printf("uCOSII test\r\n");

    OSInit();  //OS初始化
    OSTaskCreate(AppLED1Task,(void *)0,
                 &APP_LED1_STK[TASK_STK_SIZE-1],
                 APP_LED1_TASK_PRIO); //建立LED1 任务
    OSTaskCreate(AppLED0Task,(void *)0,
                 &APP_LED0_STK[TASK_STK_SIZE-1],
                 APP_LED0_TASK_PRIO); //建立LED0 任务

    SYSTICK_Cmd(true);

    /* 控制权交给操作系统 */
    OSStart();
    /* 程序永远不会运行到这 */
    while(1);
}
Ejemplo n.º 26
0
int main(void)
{
   CPU_INT08U os_err;

   //禁止CPU中断
   CPU_IntDis();
   
   //UCOS 初始化
   OSInit();                                                   /* Initialize "uC/OS-II, The Real-Time Kernel".         */
   
   //硬件平台初始化
	SystemInit();
   BSP_Init();                                                 /* Initialize BSP functions.  */
   
   //默认LED闪烁间隔500ms
   milsec1=1000;   
   //建立主任务, 优先级最高  建立这个任务另外一个用途是为了以后使用统计任务
   os_err = OSTaskCreate((void (*) (void *)) App_TaskStart,	  		  		//指向任务代码的指针
                          (void *) 0,								  		//任务开始执行时,传递给任务的参数的指针
               (OS_STK *) &App_TaskStartStk[APP_TASK_START_STK_SIZE - 1],	//分配给任务的堆栈的栈顶指针   从顶向下递减
               (INT8U) APP_TASK_START_PRIO);								//分配给任务的优先级
   
   //ucos的节拍计数器清0    节拍计数器是0-4294967295    对于节拍频率100hz时, 每隔497天就重新计数 
   OSTimeSet(0);
   OSStart();                                                  /* Start multitasking (i.e. give control to uC/OS-II).  */
                                                 /* Start multitasking (i.e. give control to uC/OS-II).  */
 
   return (os_err);
}
Ejemplo n.º 27
0
int  main (void)
{
    CPU_INT08U  err;


    BSP_IntDisAll();                                                    /* Disable all interrupts until we are ready to accept them */

    OSInit();                                                           /* Initialize "uC/OS-II, The Real-Time Kernel"              */

    OSTaskCreateExt(AppTaskStart,                                       /* Create the start task                                    */
                    (void *)0,
                    (OS_STK *)&AppTaskStartStk[APP_TASK_START_STK_SIZE - 1],
                    APP_TASK_START_PRIO,
                    APP_TASK_START_PRIO,
                    (OS_STK *)&AppTaskStartStk[0],
                    APP_TASK_START_STK_SIZE,
                    (void *)0,
                    OS_TASK_OPT_STK_CHK | OS_TASK_OPT_STK_CLR);

#if OS_TASK_NAME_SIZE > 13
    OSTaskNameSet(APP_TASK_START_PRIO, "Startup", &err);
#endif

    OSStart();                                                          /* Start multitasking (i.e. give control to uC/OS-II)       */
}
Ejemplo n.º 28
0
int main()
{
    __disable_interrupt();
    //InitQueue(&uart_rx_cirqueue);
    //InitQueue(&uart_tx_cirqueue);

    CLK_SYSCLKConfig(CLK_PRESCALER_HSIDIV1);
    //GPIO_Init(GPIOD, GPIO_PIN_3|GPIO_PIN_2|GPIO_PIN_0, GPIO_MODE_OUT_PP_LOW_SLOW);
    GPIO_INIT();//led
    GPIO_Init(GPIOD, GPIO_PIN_2,GPIO_MODE_OUT_PP_HIGH_FAST);//开启U10的控制引脚
    pir_RI_io_init();//pir中断
    T4_Init();
    //Uart_Init();

    CommInit();
    /*AWU configuration --------------------------------------------*/
    AWU_Config();


    OSInit();
    CommBufInit();//创建信号量的操作不能再OSInit();之前,也就是不能在OS_InitEventList();之前


    OSTaskCreate( task0, (void *)OS_TASK_0_STK_SIZE, &Task0Stack[OS_TASK_0_STK_SIZE-1], OS_TASK_0_PRIO );
    OSTaskCreate( task1, (void *)OS_TASK_1_STK_SIZE, &Task1Stack[OS_TASK_1_STK_SIZE-1], OS_TASK_1_PRIO );
    //OSTaskCreate( task2, (void *)OS_TASK_2_STK_SIZE, &Task2Stack[OS_TASK_2_STK_SIZE-1], OS_TASK_2_PRIO );

    OSStart();
    return	0;
}
Ejemplo n.º 29
0
int main(void) 
{
	char *utemp1, *ptemp1;
	unsigned char ret1;	
	Serial_Init(); 
	print_string("\t Welcome to uNiBash enviroment");  	
	print_string("\r Username:"******"\r Password:"******"\rInvalid username or password");
	return 0;
	}
	else
	
	OSInit(); //required for generating the idle task and statistic task
	//Creating tasks
	OSTaskCreate( Task1, (void *)0, &Task1Stack[ TASK_STACK - 1 ], 0 );
	OSTaskCreate( Task2, (void *)0, &Task2Stack[ TASK_STACK - 1 ], 1 );
	
	OSStart(); //Start multi-tasking

	return 0;
}
Ejemplo n.º 30
0
int main(void)
{
    OS_ERR  err;
    OSInit(&err);                                               /* Init uC/OS-III.                                      */
	/* 使能轮转调度 设置默认的全局时间片是8 */
    OSSchedRoundRobinCfg(DEF_ENABLED,
						 8,
						 &err);	

	OSTaskCreate((OS_TCB       *)&AppTaskStartTCB,              /* Create the start task                                */
                 (CPU_CHAR     *)"App Task Start",
                 (OS_TASK_PTR   )AppTaskStart, 
                 (void         *)0,
                 (OS_PRIO       )APP_CFG_TASK_START_PRIO,
                 (CPU_STK      *)&AppTaskStartStk[0],
                 (CPU_STK_SIZE  )APP_CFG_TASK_START_STK_SIZE / 10,
                 (CPU_STK_SIZE  )APP_CFG_TASK_START_STK_SIZE,
                 (OS_MSG_QTY    )0,
                 (OS_TICK       )0,
                 (void         *)0,
                 (OS_OPT        )(OS_OPT_TASK_STK_CHK | OS_OPT_TASK_STK_CLR),
                 (OS_ERR       *)&err);

    OSStart(&err);                                              /* Start multitasking (i.e. give control to uC/OS-III). */
    
    (void)&err;
    
    return (0);
}