/* ********************************************************************************************************* * AppTaskStart() * * Description : The startup task. The uC/OS-II ticker should only be initialize once multitasking starts. * * Argument(s) : p_arg Argument passed to 'AppTaskStart()' by 'OSTaskCreate()'. * * Return(s) : none. * * Note(s) : (1) The first line of code is used to prevent a compiler warning because 'p_arg' is not * used. The compiler should not generate any code for this statement. * * (2) Interrupts are enabled once the task starts because the I-bit of the CCR register was * set to 0 by 'OSTaskCreate()'. ********************************************************************************************************* */ static void App_TaskStart(void *p_arg) { (void)p_arg; /* Note(1) */ uint16_t osVersion1, osVersion2, osVersion3; /* Use 48MHZ HFXO as core clock frequency */ CMU_ClockSelectSet(cmuClock_HF, cmuSelect_HFXO); /* Initialize DK board register access */ /* This demo currently only works in EBI mode */ BSP_Init(BSP_INIT_DEFAULT); /* If first word of user data page is non-zero, enable eA Profiler trace */ BSP_TraceProfilerSetup(); /* Setup SysTick Timer for 10 msec interrupts */ if (SysTick_Config(CMU_ClockFreqGet(cmuClock_CORE) / 1000)) { while (1) ; } /* Initialize the uC/OS-II ticker */ OS_CPU_SysTickInit(CMU_ClockFreqGet(cmuClock_HFPER)/OS_TICKS_PER_SEC); #if (OS_TASK_STAT_EN > 0) /* Determine CPU capacity */ OSStatInit(); #endif /* Create application tasks */ App_TaskCreate(); /* Create application mailboxes */ App_MailboxCreate(); /* Enable EFM32LG_DK3650 RS232/UART switch */ BSP_PeripheralAccess(BSP_RS232_UART, true); UART1_SerialInit(); UART1_SerialCrLf(1); /* Initialize the TFT stdio retarget module. */ RETARGET_TftInit(); RETARGET_TftCrLf(0); osVersion3 = OSVersion(); osVersion1 = osVersion3 / 10000; osVersion3 -= osVersion1 * 10000; osVersion2 = osVersion3 / 100; osVersion3 -= osVersion2 * 100; osVersion3 %= 100; printf("\n*************************************"); printf("\n uC/OS-II v%d.%02d.%02d on EFM32 DK ", osVersion1, osVersion2, osVersion3 ); printf("\n Demo Application \n"); printf("\n uC/OS-II "); printf("\n \"The real time kernel\" "); printf("\n www.micrium.com "); printf("\n is running on "); printf("\n Silicon Labs EFM32 "); printf("\n www.silabs.com \n"); printf("\nDescription:"); printf("\n\nTask1: LED blink task"); printf("\n\nTask2: Receives characters from serial and posts message to Task3"); printf("\n\nTask3: Receives message from Task2 and writes it on screen"); printf("\n\n**************************************\n"); printf("\nStart typing...\n"); /* Suspend this task as it is only used once in one Reset cycle */ OSTaskSuspend(APP_CFG_TASK_START_PRIO); while (1) {/* endless loop of Start task */ ; } }
/* ********************************************************************************************************* * AppTaskStart() * * Description : The startup task. The uC/OS-III ticker should only be initialize once multitasking starts. * * Argument(s) : p_arg Argument passed to 'AppTaskStart()' by 'OSTaskCreate()'. * * Return(s) : none. * * Note(s) : (1) The first line of code is used to prevent a compiler warning because 'p_arg' is not * used. The compiler should not generate any code for this statement. * * (2) Interrupts are enabled once the task starts because the I-bit of the CCR register was * set to 0 by 'OSTaskCreate()'. ********************************************************************************************************* */ static void App_TaskStart(void *p_arg) { uint16_t osVersion1, osVersion2, osVersion3; OS_ERR err = OS_ERR_NONE; (void)p_arg; /* Note(1) */ /* Use 48MHZ HFXO as core clock frequency */ CMU_ClockSelectSet(cmuClock_HF, cmuSelect_HFXO); /* Initialize DK board register access */ /* This demo currently only works in EBI mode */ BSP_Init(BSP_INIT_DEFAULT); /* If first word of user data page is non-zero, enable eA Profiler trace */ BSP_TraceProfilerSetup(); /* Initialize the uC/OS-III ticker */ OS_CPU_SysTickInit(CMU_ClockFreqGet(cmuClock_CORE) / OS_CFG_TICK_RATE_HZ); #if (OS_TASK_STAT_EN > 0U) /* Determine CPU capacity */ OSStatInit(); #endif /* Create application tasks */ App_TaskCreate(); /* Create application mailboxes */ App_MailboxCreate(); UART1_SerialInit(); UART1_SerialCrLf(1); /* Initialize tft serial */ RETARGET_SerialInit(); osVersion3 = OSVersion( &err ); osVersion1 = osVersion3 / 10000; osVersion3 -= osVersion1 * 10000; osVersion2 = osVersion3 / 100; osVersion3 -= osVersion2 * 100; osVersion3 %= 100; printf("\n*************************************"); printf("\n uC/OS-III v%d.%02d.%02d on EFM32 DK ", osVersion1, osVersion2, osVersion3 ); printf("\n Demo Application \n"); printf("\n uC/OS-III "); printf("\n \"The real time kernel\" "); printf("\n www.micrium.com "); printf("\n is running on "); printf("\n Energy Micro EFM32 "); printf("\n www.energymicro.com \n"); printf("\nDescription:"); printf("\n\nTask1: LED blink task"); printf("\n\nTask2: Receives characters from serial and posts message to Task3"); printf("\n\nTask3: Receives message from Task2 and writes it on screen"); printf("\n\n**************************************\n"); printf("\nStart typing...\n"); /* Suspend this task as it is only used once in one Reset cycle */ OSTaskSuspend(&AppTaskStartTCB, &err); /* Error had occured if code execution reached this point as suspend calls the scheduler * that performs a context switch */ while (1U) ; }