]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS/Demo/CORTEX_EFM32_Gecko_Starter_Kit_Simplicity_Studio/Source/main.c
Baseline the Giant Gecko demo, which now has the first pass at a low power tickless...
[freertos] / FreeRTOS / Demo / CORTEX_EFM32_Gecko_Starter_Kit_Simplicity_Studio / Source / main.c
index 1f0371876b673ab9643621078a25f6b1aa8eab1e..8bd4c45768c74728478c41e6da7a41cf0e98563a 100644 (file)
 \r
 /******************************************************************************\r
  * This project provides two demo applications.  A simple blinky style project\r
- * that demonstrates tickless low power functionality, and a more comprehensive\r
- * test and demo application.  The mainCREATE_LOW_POWER_DEMO setting (defined in\r
- * this file) is used to select between the two.  The simply blinky low power\r
- * demo is implemented and described in main_low_power.c.  The more\r
- * comprehensive test and demo application is implemented and described in\r
+ * that demonstrates low power tickless functionality, and a more comprehensive\r
+ * test and demo application.  The configCREATE_LOW_POWER_DEMO setting, which is\r
+ * defined in FreeRTOSConfig.h, is used to select between the two.  The simply\r
+ * blinky low power demo is implemented and described in main_low_power.c.  The\r
+ * more comprehensive test and demo application is implemented and described in\r
  * main_full.c.\r
  *\r
  * This file implements the code that is not demo specific, including the\r
@@ -85,8 +85,6 @@
  *\r
  */\r
 \r
-#warning FreeRTOSConfig.h needs formatting.\r
-\r
 /* FreeRTOS includes. */\r
 #include "FreeRTOS.h"\r
 #include "task.h"\r
@@ -109,14 +107,14 @@ run the more comprehensive test and demo application. */
 static void prvSetupHardware( void );\r
 \r
 /*\r
- * main_low_power() is used when mainCREATE_LOW_POWER_DEMO is set to 1.\r
- * main_full() is used when mainCREATE_LOW_POWER_DEMO is set to 0.\r
+ * main_low_power() is used when configCREATE_LOW_POWER_DEMO is set to 1.\r
+ * main_full() is used when configCREATE_LOW_POWER_DEMO is set to 0.\r
  */\r
-#if mainCREATE_LOW_POWER_DEMO == 1\r
+#if( configCREATE_LOW_POWER_DEMO == 1 )\r
        extern void main_low_power( void );\r
 #else\r
        extern void main_full( void );\r
-#endif /* #if mainCREATE_LOW_POWER_DEMO == 1 */\r
+#endif /* #if configCREATE_LOW_POWER_DEMO == 1 */\r
 \r
 /* Prototypes for the standard FreeRTOS callback/hook functions implemented\r
 within this file. */\r
@@ -134,7 +132,7 @@ int main( void )
 \r
        /* The mainCREATE_LOW_POWER_DEMO setting is described at the top\r
        of this file. */\r
-       #if( mainCREATE_LOW_POWER_DEMO == 1 )\r
+       #if( configCREATE_LOW_POWER_DEMO == 1 )\r
        {\r
                main_low_power();\r
        }\r
@@ -144,10 +142,7 @@ int main( void )
        }\r
        #endif\r
 \r
-       /* Start FreeRTOS Scheduler */\r
-       vTaskStartScheduler();\r
-\r
-       /* Cannot get here. */\r
+       /* Should not get here. */\r
        return 0;\r
 }\r
 /*-----------------------------------------------------------*/\r
@@ -160,11 +155,7 @@ static void prvSetupHardware( void )
        SLEEP_Init( NULL, NULL );\r
        BSP_LedsInit();\r
 \r
-       #if (configSLEEP_MODE < 3)\r
-       {\r
-               SLEEP_SleepBlockBegin((SLEEP_EnergyMode_t)(configSLEEP_MODE+1));\r
-       }\r
-       #endif\r
+//_RB_ SLEEP_SleepBlockBegin( ( SLEEP_EnergyMode_t ) ( configSLEEP_MODE+1 ) );\r
 }\r
 /*-----------------------------------------------------------*/\r
 \r
@@ -216,12 +207,41 @@ volatile size_t xFreeHeapSpace;
 void vApplicationTickHook( void )\r
 {\r
        /* The full demo includes tests that run from the tick hook. */\r
-       #if( mainCREATE_LOW_POWER_DEMO == 0 )\r
+       #if( configCREATE_LOW_POWER_DEMO == 0 )\r
        {\r
        extern void vFullDemoTickHook( void );\r
 \r
+               /* Some of the tests and demo tasks executed by the full demo include\r
+               interaction from an interrupt - for which the tick interrupt is used\r
+               via the tick hook function. */\r
                vFullDemoTickHook();\r
        }\r
        #endif\r
 }\r
+/*-----------------------------------------------------------*/\r
+\r
+void vApplicationGetIdleTaskMemory( StaticTask_t **ppxIdleTaskTCBBuffer, StackType_t **ppxIdleTaskStackBuffer, uint16_t *pusIdleTaskStackSize )\r
+{\r
+       /* configUSE_STATIC_ALLOCATION is set to 1, so the application has the\r
+       opportunity to supply the buffers that will be used by the Idle task as its\r
+       stack and to hold its TCB.  If these are set to NULL then the buffers will\r
+       be allocated dynamically, just as if xTaskCreate() had been called. */\r
+       *ppxIdleTaskTCBBuffer = NULL;\r
+       *ppxIdleTaskStackBuffer = NULL;\r
+       *pusIdleTaskStackSize = configMINIMAL_STACK_SIZE; /* In words.  NOT in bytes! */\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+void vApplicationGetTimerTaskMemory( StaticTask_t **ppxTimerTaskTCBBuffer, StackType_t **ppxTimerTaskStackBuffer, uint16_t *pusTimerTaskStackSize )\r
+{\r
+       /* configUSE_STATIC_ALLOCATION is set to 1, so the application has the\r
+       opportunity to supply the buffers that will be used by the Timer/RTOS daemon\r
+       task as its     stack and to hold its TCB.  If these are set to NULL then the\r
+       buffers will be allocated dynamically, just as if xTaskCreate() had been\r
+       called. */\r
+       *ppxTimerTaskTCBBuffer = NULL;\r
+       *ppxTimerTaskStackBuffer = NULL;\r
+       *pusTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH; /* In words.  NOT in bytes! */\r
+}\r
+/*-----------------------------------------------------------*/\r
 \r