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) */ }
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); }
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). */ }
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); }
void BSP_Init (void) { BSP_IntDisAll(); /* Disable all interrupts. */ /* M4F FPU settings --------------------------------------------------------*/ #ifdef __TARGET_FPU_VFP SCB->CPACR |= ((3UL << 10*2) | /* set CP10 Full Access */ (3UL << 11*2) ); /* set CP11 Full Access */ //FPU->FPCCR &= ~(3 << 30); /* Disable automatic FP register content (bit 31) */ // /* Disable Lazy context switch (bit 30) */ #endif /* Enable external crystal and PLL -----------------------------------------*/ BSP_Enable_Clock(CLK_XTL_12M); /* Enable external external 4 ~ 22M input */ // Enable UART0 clock CLK->APBCLK0 |= CLK_APBCLK0_UART0CKEN_Msk; // Select external 12 MHz as UART clock source CLK->CLKSEL1 &= ~CLK_CLKSEL1_UARTSEL_Msk; /* Set GPG multi-function pins for UART0 RXD and TXD */ SYS->GPG_MFPL = SYS_GPG_MFPL_PG1MFP_UART0_RXD | SYS_GPG_MFPL_PG2MFP_UART0_TXD ; UART0->LINE |= 0x07; UART0->BAUD = 0x30000066; /* 12MHz reference clock input, for 115200 */ BSP_IntInit(); BSP_Tick_Init(); /* Start Tick Initialization */ }
/* ********************************************************************************************************* * 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) */ }
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 */ }
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); }
void main(int argc, char *argv[]) { INT8U err; #if 0 BSP_IntDisAll(); /* For an embedded target, disable all interrupts until we are ready to accept them */ #endif OSInit(); /* Initialize "uC/OS-II, The Real-Time Kernel" */ sysinit(); OSTaskCreate(AppStartTask,(void *)0,(OS_STK *)&AppStartTaskStk[0][TASK_STK_SIZE-1],2); OSTaskCreate(test2, (void *)0,(OS_STK *)&AppStartTaskStk[1][TASK_STK_SIZE-1],3); OSTaskCreate(test3, (void *)0,(OS_STK *)&AppStartTaskStk[2][TASK_STK_SIZE-1],4); OSTaskCreate(getStr, (void *)0,(OS_STK *)&AppStartTaskStk[3][TASK_STK_SIZE-1],5); #if OS_TASK_NAME_SIZE > 11 OSTaskNameSet(APP_TASK_START_PRIO, (INT8U *)"Start Task", &err); #endif #if OS_TASK_NAME_SIZE > 14 OSTaskNameSet(OS_IDLE_PRIO, (INT8U *)"uC/OS-II Idle", &err); #endif #if (OS_TASK_NAME_SIZE > 14) && (OS_TASK_STAT_EN > 0) OSTaskNameSet(OS_STAT_PRIO, "uC/OS-II Stat", &err); #endif OSStart(); /* Start multitasking (i.e. give control to uC/OS-II) */ }
int main(void) { OS_ERR err; int i; HAL_Init(); /* See Note 1. */ Mem_Init(); /* Initialize Memory Managment Module */ Math_Init(); /* Initialize Mathematical Module */ BSP_IntDisAll(); /* Disable all Interrupts. */ App_OS_SetAllHooks(); OSInit(&err); /* Init uC/OS-III. */ for(i = 0; i < APP_THREAD_COUNT-1; i++) sem_init(&g_thread_startup[i], 0, 0); sem_init(&g_sem_debug, 0, 1); g_debug_tx_buffer = mq_open(0, 512); pthread_attr_setstacksize(&g_thread_attr[0], 1024*2); pthread_create(&g_thread[0], &g_thread_attr[0], Thread_Startup, 0); pthread_setschedprio(&g_thread[0], 1); DEFINE_THREAD(Thread_DebugTX, 1024, 1); DEFINE_THREAD(Thread_DebugRx, 1024, 1); DEFINE_THREAD(Thread_RFIntr, 1024, 3); DEFINE_THREAD(Thread_MiwiTask,1024*5, 4); OSStart(&err); /* Start multitasking (i.e. give control to uC/OS-III). */ while (1) {} }
int main (void) { OS_ERR err; #if (CPU_CFG_NAME_EN == DEF_ENABLED) CPU_ERR cpu_err; #endif CPU_Init(); /* Initialize the CPU abstraction layer. */ Mem_Init(); /* Initialize the Memory Management Module. */ Math_Init(); /* Initialize the Mathematical Module. */ #if (CPU_CFG_NAME_EN == DEF_ENABLED) CPU_NameSet((CPU_CHAR *)"MKL46Z256VLL4", (CPU_ERR *)&cpu_err); #endif BSP_IntDisAll(); /* Disable all interrupts. */ #if (defined(TRACE_CFG_EN) && (TRACE_CFG_EN > 0u)) TRACE_INIT(); /* Initialize the µC/Trace recorder. */ TRACE_START(); /* Start recording. */ #endif OSInit(&err); /* Initialize "uC/OS-III, The Real-Time Kernel". */ OSMutexCreate((OS_MUTEX *)&AppMutex, (CPU_CHAR *)"My App. Mutex", (OS_ERR *)&err); OSQCreate ((OS_Q *)&AppQ, (CPU_CHAR *)"My App Queue", (OS_MSG_QTY )10, (OS_ERR *)&err); OSTaskCreate((OS_TCB *)&App_TaskStartTCB, /* Create the startup task. */ (CPU_CHAR *)"Startup Task", (OS_TASK_PTR ) App_TaskStart, (void *) 0, (OS_PRIO ) APP_CFG_TASK_START_PRIO, (CPU_STK *)&App_TaskStartStk[0], (CPU_STK )(APP_CFG_TASK_START_STK_SIZE / 10u), (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). */ while(DEF_ON) { /* Should Never Get Here */ }; }
//--------------------------------------------------------------------------------------------------- // Main //--------------------------------------------------------------------------------------------------- int main (void) { OS_ERR aErr; SCB_SHPR2=(3<<30); #if (CPU_CFG_NAME_EN == DEF_ENABLED) CPU_ERR aCpuErr; #endif // Initialize the CPU abstraction layer CPU_Init(); //Initialize the Memory Management Module Mem_Init(); // Initialize the Mathematical Module Math_Init(); #if (CPU_CFG_NAME_EN == DEF_ENABLED) CPU_NameSet((CPU_CHAR *)"MKL46Z256VLL4",(CPU_ERR *)&aCpuErr); #endif // Disable all interrupts BSP_IntDisAll(); #if (defined(TRACE_CFG_EN) && (TRACE_CFG_EN > 0u)) TRACE_INIT(); // Initialize the µC/Trace recorder TRACE_START(); // Start recording #endif // Initialize "uC/OS-III, The Real-Time Kernel" OSInit(&aErr); // Création de la tâche de démarrage OSTaskCreate((OS_TCB *)&sAppTaskStartTCB, (CPU_CHAR *)"Startup Task", (OS_TASK_PTR ) AppTaskStart, (void *) 0, (OS_PRIO ) kStartTaskPr, (CPU_STK *)&sAppTaskStartStk[0], (CPU_STK )(kStackSize / 10u), (CPU_STK_SIZE) kStackSize, (OS_MSG_QTY ) 0, (OS_TICK ) 0, (void *) 0, (OS_OPT )(OS_OPT_TASK_STK_CHK | OS_OPT_TASK_STK_CLR), (OS_ERR *)&aErr); // Démarrage du multitâche OSStart(&aErr); // On ne doit jamais se trouver ici... while(1); }
int main(void) { NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2); BSP_IntDisAll(); //关闭所有中断 OSInit(); OSTaskCreate(startup_task, (void *)0, &startup_task_stk[STARTUP_TASK_STK_SIZE - 1], STARTUP_TASK_PRIO); OSStart(); return 0; }
int main (void) { if (DEBUG) xil_printf("DEBUG: INSIDE main\n\r"); CPU_INT08U err; // inicialització de la variable que conté el caràcter rebut //caracter = 0; tecla = 0; // S'inhabiliten les interrupcions fins que el sistema operatiu no estigui inicialitzat if (DEBUG) xil_printf("DEBUG: GOING BSP_IntDisAll\n\r"); BSP_IntDisAll(); if (DEBUG) xil_printf("DEBUG: GOING OSInit\n\r"); OSInit(); // Inicialitza el sistema operatiu OSTaskCreateExt(AppTaskFirst, (void *)0, &AppTaskFirstStk[APP_TASK_FIRST_STK_SIZE - 1], APP_TASK_FIRST_PRIO, APP_TASK_FIRST_ID, &AppTaskFirstStk[0], APP_TASK_FIRST_STK_SIZE, (void *)0, OS_TASK_OPT_STK_CHK | OS_TASK_OPT_STK_CLR); OSTaskNameSet(APP_TASK_FIRST_PRIO, (CPU_INT08U *)"App Task First", &err); // Aquesta funció proporciona un nom a la tasca dins del sistema operatiu // Només s'utilitza a efectes de depuració //OSTaskNameSet(TASK1_PRIO, (CPU_INT08U *)"InterficieControl", &err); if (DEBUG) { xil_printf("DEBUG: GOING OSStart\n\r"); } OSStart(); //Inicia el sistema operatiu return 0; }
int main(void) { OS_ERR err; #if (CPU_CFG_NAME_EN == DEF_ENABLED) CPU_ERR cpu_err; #endif HAL_Init(); /* See Note 1. */ Mem_Init(); /* Initialize Memory Managment Module */ Math_Init(); /* Initialize Mathematical Module */ #if (CPU_CFG_NAME_EN == DEF_ENABLED) CPU_NameSet((CPU_CHAR *)"STM32F407VG", (CPU_ERR *)&cpu_err); #endif BSP_IntDisAll(); /* Disable all Interrupts. */ OSInit(&err); /* Init uC/OS-III. */ App_OS_SetAllHooks(); OSTaskCreate(&AppTaskStartTCB, /* Create the start task */ "App Task Start", AppTaskStart, 0u, APP_CFG_TASK_START_PRIO, &AppTaskStartStk[0u], AppTaskStartStk[APP_CFG_TASK_START_STK_SIZE / 10u], APP_CFG_TASK_START_STK_SIZE, 0u, 0u, 0u, (OS_OPT_TASK_STK_CHK | OS_OPT_TASK_STK_CLR), &err); OSStart(&err); /* Start multitasking (i.e. give control to uC/OS-III). */ while (DEF_ON) { /* Should Never Get Here. */ ; } }
int main (void) { unsigned char test_color = 1; char uart_buffer[13]; char *buffer_ptr; CPU_INT08U err; BSP_IntDisAll(); /* Disable all interrupts until we are ready to accept them */ OSInit(); /* Initialize "uC/OS-II, The Real-Time Kernel" */ AppInitVar(); /* Initialize globale vars */ AppCreateIPCS(); /* Create IPCS objects */ AppTaskStart(); /* Start all tasks */ AppDebugMsg("-----------------------------------\r\n"); #ifdef _TARGET_440H Set_Line_Information( 1, 0, " OUFFF TEAM ", 16); Set_Line_Information( 2, 0, " Coupe 2012 ", 16); #endif OSStart(); /* Start multitasking (i.e. give control to uC/OS-II) */ /* This part would be never executed */ }