aboutsummaryrefslogtreecommitdiffstats
path: root/boards/base/RaspberryPi/FreeRTOS/freertos_main.c
diff options
context:
space:
mode:
authorinmarket <andrewh@inmarket.com.au>2014-10-06 17:05:16 +1000
committerinmarket <andrewh@inmarket.com.au>2014-10-06 17:05:16 +1000
commit5a3f22617b02ec366461be21765e636e6bdd0222 (patch)
tree853945ab638d80f7d027bd08231f18ea94b4b4e9 /boards/base/RaspberryPi/FreeRTOS/freertos_main.c
parent50dfad6f038ed5d20a357f634a70b23c570b26ed (diff)
downloaduGFX-5a3f22617b02ec366461be21765e636e6bdd0222.tar.gz
uGFX-5a3f22617b02ec366461be21765e636e6bdd0222.tar.bz2
uGFX-5a3f22617b02ec366461be21765e636e6bdd0222.zip
Add support for FreeRTOS into make system
Diffstat (limited to 'boards/base/RaspberryPi/FreeRTOS/freertos_main.c')
-rw-r--r--boards/base/RaspberryPi/FreeRTOS/freertos_main.c62
1 files changed, 62 insertions, 0 deletions
diff --git a/boards/base/RaspberryPi/FreeRTOS/freertos_main.c b/boards/base/RaspberryPi/FreeRTOS/freertos_main.c
new file mode 100644
index 00000000..821a679b
--- /dev/null
+++ b/boards/base/RaspberryPi/FreeRTOS/freertos_main.c
@@ -0,0 +1,62 @@
+#include <FreeRTOS.h>
+#include <task.h>
+
+#include "Drivers/interrupts.h"
+
+extern int main(void);
+
+static void mainTask(void *pvParameters) {
+ (void) pvParameters;
+ main();
+}
+
+/**
+ * This is the systems main entry, some call it a boot thread.
+ **/
+int FreeRTOS_Main(void) {
+
+ DisableInterrupts();
+ InitInterruptController();
+
+ xTaskCreate(mainTask,
+ (portCHAR *)"Main Task",
+ 128,
+ NULL,
+ 0,
+ NULL);
+
+ vTaskStartScheduler();
+
+ /*
+ * We should never get here, but just in case something goes wrong,
+ * we'll place the CPU into a safe loop.
+ */
+ while(1) {
+ ;
+ }
+
+ return 0;
+}
+
+void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName )
+{
+ ( void ) pcTaskName;
+ ( void ) pxTask;
+
+ /* Run time task stack overflow checking is performed if
+ configCHECK_FOR_STACK_OVERFLOW is defined to 1 or 2. This hook function is
+ called if a task stack overflow is detected. Note the system/interrupt
+ stack is not checked. */
+ taskDISABLE_INTERRUPTS();
+ for( ;; );
+}
+/*-----------------------------------------------------------*/
+
+void vApplicationTickHook( void )
+{
+ /* This function will be called by each tick interrupt if
+ configUSE_TICK_HOOK is set to 1 in FreeRTOSConfig.h. User code can be
+ added here, but the tick hook is called from an interrupt context, so
+ code must not attempt to block, and only the interrupt safe FreeRTOS API
+ functions can be used (those that end in FromISR()). */
+}