本文整理汇总了C++中OSInit函数的典型用法代码示例。如果您正苦于以下问题:C++ OSInit函数的具体用法?C++ OSInit怎么用?C++ OSInit使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了OSInit函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
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);
}
示例2: main
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). */
}
示例3: main
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;
}
示例4: main
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);
}
示例5: main
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;
}
示例6: main
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进入休眠状态 */
}
}
示例7: main
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);
}
示例8: main
void main (void)
{
OSInit();
InitTimer2();
OSTaskCreate(sys_init, (void *)0, &sys_init_Stk[0],1);
OSStart();
}
示例9: ucos_test
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");
}
}
示例10: main
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;
}
示例11: main
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);
}
示例12: main
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) {
;
}
}
示例13: main
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 */
}
示例14: main
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);
}
示例15: main
//主函数
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
}