/*\r
- FreeRTOS V8.0.1 - Copyright (C) 2014 Real Time Engineers Ltd. \r
+ FreeRTOS V8.2.0rc1 - Copyright (C) 2014 Real Time Engineers Ltd.\r
All rights reserved\r
\r
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
\r
- ***************************************************************************\r
- * *\r
- * FreeRTOS provides completely free yet professionally developed, *\r
- * robust, strictly quality controlled, supported, and cross *\r
- * platform software that has become a de facto standard. *\r
- * *\r
- * Help yourself get started quickly and support the FreeRTOS *\r
- * project by purchasing a FreeRTOS tutorial book, reference *\r
- * manual, or both from: http://www.FreeRTOS.org/Documentation *\r
- * *\r
- * Thank you! *\r
- * *\r
- ***************************************************************************\r
-\r
This file is part of the FreeRTOS distribution.\r
\r
FreeRTOS is free software; you can redistribute it and/or modify it under\r
\r
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY\r
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\r
- FOR A PARTICULAR PURPOSE. Full license text is available from the following\r
+ FOR A PARTICULAR PURPOSE. Full license text is available on the following\r
link: http://www.freertos.org/a00114.html\r
\r
1 tab == 4 spaces!\r
***************************************************************************\r
* *\r
* Having a problem? Start by reading the FAQ "My application does *\r
- * not run, what could be wrong?" *\r
+ * not run, what could be wrong?". Have you defined configASSERT()? *\r
* *\r
* http://www.FreeRTOS.org/FAQHelp.html *\r
* *\r
***************************************************************************\r
\r
+ ***************************************************************************\r
+ * *\r
+ * FreeRTOS provides completely free yet professionally developed, *\r
+ * robust, strictly quality controlled, supported, and cross *\r
+ * platform software that is more than just the market leader, it *\r
+ * is the industry's de facto standard. *\r
+ * *\r
+ * Help yourself get started quickly while simultaneously helping *\r
+ * to support the FreeRTOS project by purchasing a FreeRTOS *\r
+ * tutorial book, reference manual, or both: *\r
+ * http://www.FreeRTOS.org/Documentation *\r
+ * *\r
+ ***************************************************************************\r
+\r
+ ***************************************************************************\r
+ * *\r
+ * Investing in training allows your team to be as productive as *\r
+ * possible as early as possible, lowering your overall development *\r
+ * cost, and enabling you to bring a more robust product to market *\r
+ * earlier than would otherwise be possible. Richard Barry is both *\r
+ * the architect and key author of FreeRTOS, and so also the world's *\r
+ * leading authority on what is the world's most popular real time *\r
+ * kernel for deeply embedded MCU designs. Obtaining your training *\r
+ * from Richard ensures your team will gain directly from his in-depth *\r
+ * product knowledge and years of usage experience. Contact Real Time *\r
+ * Engineers Ltd to enquire about the FreeRTOS Masterclass, presented *\r
+ * by Richard Barry: http://www.FreeRTOS.org/contact\r
+ * *\r
+ ***************************************************************************\r
+\r
+ ***************************************************************************\r
+ * *\r
+ * You are receiving this top quality software for free. Please play *\r
+ * fair and reciprocate by reporting any suspected issues and *\r
+ * participating in the community forum: *\r
+ * http://www.FreeRTOS.org/support *\r
+ * *\r
+ * Thank you! *\r
+ * *\r
+ ***************************************************************************\r
+\r
http://www.FreeRTOS.org - Documentation, books, training, latest versions,\r
license and Real Time Engineers Ltd. contact details.\r
\r
including FreeRTOS+Trace - an indispensable productivity tool, a DOS\r
compatible FAT file system, and our tiny thread aware UDP/IP stack.\r
\r
+ http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.\r
+ Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.\r
+\r
http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High\r
- Integrity Systems to sell under the OpenRTOS brand. Low cost OpenRTOS\r
- licenses offer ticketed support, indemnification and middleware.\r
+ Integrity Systems ltd. to sell under the OpenRTOS brand. Low cost OpenRTOS\r
+ licenses offer ticketed support, indemnification and commercial middleware.\r
\r
http://www.SafeRTOS.com - High Integrity Systems also provide a safety\r
engineered and independently SIL3 certified version for use in safety and\r
* implemented and described in main_full.c.\r
*\r
* This file implements the code that is not demo specific, including the\r
- * hardware setup and FreeRTOS hook functions.\r
+ * hardware setup, standard FreeRTOS hook functions, and the ISR hander called\r
+ * by the RTOS after interrupt entry (including nesting) has been taken care of.\r
*\r
* ENSURE TO READ THE DOCUMENTATION PAGE FOR THIS PORT AND DEMO APPLICATION ON\r
* THE http://www.FreeRTOS.org WEB SITE FOR FULL INFORMATION ON USING THIS DEMO\r
*\r
*/\r
\r
-#warning Remove unused libary files.\r
-\r
/* Scheduler include files. */\r
#include "FreeRTOS.h"\r
#include "task.h"\r
#include "partest.h"\r
#include "TimerDemo.h"\r
#include "QueueOverwrite.h"\r
+#include "EventGroupsDemo.h"\r
\r
/* Library includes. */\r
#include "chip.h"\r
void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName );\r
void vApplicationTickHook( void );\r
\r
+/* Prototype for the IRQ handler called by the generic Cortex-A5 RTOS port\r
+layer. */\r
+void vApplicationIRQHandler( void );\r
+\r
/*-----------------------------------------------------------*/\r
-extern int atmel_main( void );\r
-extern void vConfigureTickInterrupt( void );\r
+\r
int main( void )\r
-{ \r
+{\r
/* Configure the hardware ready to run the demo. */\r
prvSetupHardware();\r
\r
\r
static void prvSetupHardware( void )\r
{\r
+ /* Disable watchdog */\r
+ WDT_Disable( WDT );\r
+\r
/* Set protect mode in the AIC for easier debugging. */\r
- AIC->AIC_DCR != AIC_DCR_PROT;\r
- \r
+ AIC->AIC_DCR |= AIC_DCR_PROT;\r
+\r
/* Configure ports used by LEDs. */\r
vParTestInitialise();\r
+\r
+ #if defined (ddram)\r
+ MMU_Initialize( ( uint32_t * ) 0x30C000 );\r
+ CP15_EnableMMU();\r
+ CP15_EnableDcache();\r
+ CP15_EnableIcache();\r
+ #endif\r
}\r
/*-----------------------------------------------------------*/\r
\r
internally by FreeRTOS API functions that create tasks, queues, software\r
timers, and semaphores. The size of the FreeRTOS heap is set by the\r
configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h. */\r
- taskDISABLE_INTERRUPTS();\r
- for( ;; );\r
+\r
+ /* Force an assert. */\r
+ configASSERT( ( volatile void * ) NULL );\r
}\r
/*-----------------------------------------------------------*/\r
\r
/* Run time stack overflow checking is performed if\r
configCHECK_FOR_STACK_OVERFLOW is defined to 1 or 2. This hook\r
function is called if a stack overflow is detected. */\r
- taskDISABLE_INTERRUPTS();\r
- for( ;; );\r
+\r
+ /* Force an assert. */\r
+ configASSERT( ( volatile void * ) NULL );\r
}\r
/*-----------------------------------------------------------*/\r
\r
\r
/* Call the periodic queue overwrite from ISR demo. */\r
vQueueOverwritePeriodicISRDemo();\r
+\r
+ /* Call the periodic event group from ISR demo. */\r
+ vPeriodicEventGroupsProcessing();\r
}\r
#endif\r
}\r
+/*-----------------------------------------------------------*/\r
\r
+/* The function called by the RTOS port layer after it has managed interrupt\r
+entry. */\r
+void vApplicationIRQHandler( void )\r
+{\r
+typedef void (*ISRFunction_t)( void );\r
+ISRFunction_t pxISRFunction;\r
+volatile uint32_t * pulAIC_IVR = ( uint32_t * ) configINTERRUPT_VECTOR_ADDRESS;\r
+\r
+ /* Obtain the address of the interrupt handler from the AIR. */\r
+ pxISRFunction = ( ISRFunction_t ) *pulAIC_IVR;\r
+\r
+ /* Write back to the SAMA5's interrupt controller's IVR register in case the\r
+ CPU is in protect mode. If the interrupt controller is not in protect mode\r
+ then this write is not necessary. */\r
+ *pulAIC_IVR = ( uint32_t ) pxISRFunction;\r
+\r
+ /* Ensure the write takes before re-enabling interrupts. */\r
+ __DSB();\r
+ __ISB();\r
+ __enable_irq();\r
+\r
+ /* Call the installed ISR. */\r
+ pxISRFunction();\r
+}\r
\r
\r