/* ********************************************************************************************************* * 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; /* Initialize BSP functions */ BSPOS_Init(); /* 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(); /* Initialize LCD */ SegmentLCD_Init(true); /* Turn gecko symbol ON */ SegmentLCD_Symbol(LCD_SYMBOL_GECKO, 1); /* Turn EFM32 symbol ON */ SegmentLCD_Symbol(LCD_SYMBOL_EFM32, 1); /* Write welcome message on LCD */ SegmentLCD_Write("uC/OS-2"); /* As USART connectors are not available on the STK by default, * therefore printf() functions are turned off. * Uncomment the macro definition in includes.h if serial * is connected to your STK board (USART1 or LEUART0)! */ #ifdef USART_CONNECTED /* Initialize serial port */ RETARGET_SerialInit(); RETARGET_SerialCrLf(1); osVersion3 = OSVersion(); osVersion1 = osVersion3 / 10000; osVersion3 -= osVersion1 * 10000; osVersion2 = osVersion3 / 100; osVersion3 -= osVersion2 * 100; osVersion3 %= 100; /* Write welcome message on serial */ printf("\n*****************************************************************************"); printf("\n uC/OS-II v%d.%02d.%02d on Silicon Labs EFM32WG STK ", 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\n is running on "); printf("\n\n Silicon Labs EFM32 "); printf("\n \"The world's most energy friendly microcontrollers\" "); printf("\n www.silabs.com \n"); printf("\nDescription:"); printf("\nTask1: LED blink task"); printf("\nTask2: Receives characters from serial and posts message to Task3"); printf("\nTask3: Receives message from Task2 and writes it on LCD and serial"); printf("\n*****************************************************************************\n"); printf("\nStart typing...\n"); #endif /* end of #ifndef USART_CONNECTED */ /* 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) */ /* Initialize BSP functions */ BSPOS_Init(); /* Initialize the uC/OS-III ticker */ OS_CPU_SysTickInit(OS_CPU_SysTickClkFreq() / 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(); /* Enable RS232A peripheral */ BSP_PeripheralAccess(BSP_RS232A, true); /* Initialize Serial */ RETARGET_SerialInit(); /* Map LF to CRLF */ RETARGET_SerialCrLf(1); /* Initialize LCD */ SegmentLCD_Init(true); /* Turn gecko symbol ON */ SegmentLCD_Symbol(LCD_SYMBOL_GECKO, 1); /* Turn EFM32 symbol ON */ SegmentLCD_Symbol(LCD_SYMBOL_EFM32, 1); /* Write welcome message on LCD */ SegmentLCD_Write("uC/OS-3"); osVersion3 = OSVersion( &err ); osVersion1 = osVersion3 / 10000; osVersion3 -= osVersion1 * 10000; osVersion2 = osVersion3 / 100; osVersion3 -= osVersion2 * 100; osVersion3 %= 100; /* Write welcome message on serial */ printf("\n*****************************************************************************"); printf("\n uC/OS-III v%d.%02d.%02d on Energy Micro EFM32 DVK ", 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\n is running on "); printf("\n\n Energy Micro EFM32 "); printf("\n \"The world's most energy friendly microcontrollers\" "); printf("\n www.energymicro.com \n"); printf("\nDescription:"); printf("\nTask1: LED blink task"); printf("\nTask2: Receives characters from serial and posts message to Task3"); printf("\nTask3: Receives message from Task2 and writes it on LCD and serial "); printf("\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) ; }
/* ********************************************************************************************************* * 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. ********************************************************************************************************* */ int main(void) { uint16_t osVersion1, osVersion2, osVersion3; #if (OS_TASK_NAME_EN > 0) CPU_INT08U err; #endif /* Disable all interrupts until we are ready to accept * them. */ CPU_IntDis(); /* Chip errata */ CHIP_Init(); /* setup SW0 for energyAware Profiler */ setupSWO(); /* Initialize BSP functions */ BSPOS_Init(); /* Initialize "uC/OS-II, The Real-Time Kernel". */ OSInit(); /* 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(); /* Initialize LCD */ SegmentLCD_Init(true); /* Turn gecko symbol ON */ SegmentLCD_Symbol(LCD_SYMBOL_GECKO, 1); /* Turn EFM32 symbol ON */ SegmentLCD_Symbol(LCD_SYMBOL_EFM32, 1); /* Write welcome message on LCD */ SegmentLCD_Write("uC/OS-2"); /* As USART connectors are not available on the STK by default, * therefore printf() functions are turned off. * Uncomment the macro definition in includes.h if serial * is connected to your STK board (USART1 or LEUART0)! */ #ifdef USART_CONNECTED /* Initialize */ RETARGET_SerialInit(); RETARGET_SerialCrLf(1); osVersion3 = OSVersion(); osVersion1 = osVersion3 / 10000; osVersion3 -= osVersion1 * 10000; osVersion2 = osVersion3 / 100; osVersion3 -= osVersion2 * 100; osVersion3 %= 100; /* Write welcome message on serial */ printf("\n*****************************************************************************"); printf("\n uC/OS-II v%d.%02d.%02d on Silicon Labs EFM32TG STK ", 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\n is running on "); printf("\n\n Silicon Labs EFM32 "); printf("\n \"The world's most energy friendly microcontrollers\" "); printf("\n www.silabs.com \n"); printf("\nDescription:"); printf("\nTask1: LED blink task"); printf("\nTask2: Receives characters from serial and posts message to Task3"); printf("\nTask3: Receives message from Task2 and writes it on LCD and serial "); printf("\n*****************************************************************************\n"); printf("\nStart typing...\n"); #endif /* end of #ifndef USART_CONNECTED */ /* Start multitasking (i.e. give control to uC/OS-II). */ OSStart(); /* OSStart() never returns, serious error had occured if * code execution reached this point */ while(1) ; }
/* ********************************************************************************************************* * 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) */ /* Initialize BSP functions */ BSPOS_Init(); /* Initialize the uC/OS-III ticker */ OS_CPU_SysTickInit(OS_CPU_SysTickClkFreq() / 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(); /* Initialize LCD */ SegmentLCD_Init(true); /* Turn gecko symbol ON */ SegmentLCD_Symbol(LCD_SYMBOL_GECKO, 1); /* Turn EFM32 symbol ON */ SegmentLCD_Symbol(LCD_SYMBOL_EFM32, 1); /* Write welcome message on LCD */ SegmentLCD_Write("uC/OS-3"); /* As USART connectors are not available on the STK by default, * therefore printf() functions are turned off. * Uncomment the macro definition in includes.h if serial * is connected to your STK board (USART1 or LEUART0)! */ #ifdef USART_CONNECTED /* Initialize serial port */ RETARGET_SerialInit(); RETARGET_SerialCrLf(1); osVersion3 = OSVersion( &err ); osVersion1 = osVersion3 / 10000; osVersion3 -= osVersion1 * 10000; osVersion2 = osVersion3 / 100; osVersion3 -= osVersion2 * 100; osVersion3 %= 100; /* Write welcome message on serial */ printf("\n*****************************************************************************"); printf("\n uC/OS-III v%d.%02d.%02d on Energy Micro EFM32 STK ", 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\n is running on "); printf("\n\n Energy Micro EFM32 "); printf("\n \"The world's most energy friendly microcontrollers\" "); printf("\n www.energymicro.com \n"); printf("\nDescription:"); printf("\nTask1: LED blink task"); printf("\nTask2: Receives characters from serial and posts message to Task3"); printf("\nTask3: Receives message from Task2 and writes it on LCD and serial."); printf("\n*****************************************************************************\n"); printf("\nStart typing...\n"); #endif /* end of #ifndef USART_CONNECTED */ /* 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) ; }
/* ********************************************************************************************************* * 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-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; /* Initialize BSP functions */ BSPOS_Init(); /* 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 mailboxes */ App_MailboxCreate(); /* Enable RS232A peripheral */ BSP_PeripheralAccess(BSP_RS232_UART, true); /* Initialize LCD */ SegmentLCD_Init(true); /* Turn gecko symbol ON */ SegmentLCD_Symbol(LCD_SYMBOL_GECKO, 1); /* Turn EFM32 symbol ON */ SegmentLCD_Symbol(LCD_SYMBOL_EFM32, 1); /* Write welcome message on LCD */ SegmentLCD_Write("uC/OS-2"); osVersion3 = OSVersion(); osVersion1 = osVersion3 / 10000; osVersion3 -= osVersion1 * 10000; osVersion2 = osVersion3 / 100; osVersion3 -= osVersion2 * 100; osVersion3 %= 100; /* Write welcome message on serial */ printf("\n*****************************************************************************"); printf("\n uC/OS-II v%d.%02d.%02d on Silicon Labs EFM32G_DK3550 ", 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\n is running on "); printf("\n\n Silicon Labs EFM32 "); printf("\n \"The world's most energy friendly microcontrollers\" "); printf("\n www.silabs.com \n"); printf("\nDescription:"); printf("\nTask1: LED blink task"); printf("\nTask2: Receives characters from serial and posts message to Task3"); printf("\nTask3: Receives message from Task2 and writes it on LCD and serial."); printf("\n*****************************************************************************\n"); printf("\nStart typing...\n"); /* Create application tasks */ App_TaskCreate(); /* 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) ; }