* one queue, and one timer. It also demonstrates how Cortex-M3 interrupts can\r
* interact with FreeRTOS tasks/timers.\r
*\r
- * This simple demo project runs on the SK-FM3-100PMC evaluation board, which\r
- * is populated with an MB9B500 microcontroller.\r
+ * This simple demo project runs 'stand alone' (without the rest of the tower\r
+ * system) on the TWR-K60N512 tower module, which is populated with a K60N512\r
+ * Cortex-M4 microcontroller.\r
*\r
* The idle hook function:\r
* The idle hook function demonstrates how to query the amount of FreeRTOS heap\r
* in this file. prvQueueReceiveTask() sits in a loop that causes it to\r
* repeatedly attempt to read data from the queue that was created within\r
* main(). When data is received, the task checks the value of the data, and\r
- * if the value equals the expected 100, toggles an LED on the 7 segment\r
- * display. The 'block time' parameter passed to the queue receive function\r
- * specifies that the task should be held in the Blocked state indefinitely to\r
- * wait for data to be available on the queue. The queue receive task will only\r
- * leave the Blocked state when the queue send task writes to the queue. As the\r
- * queue send task writes to the queue every 200 milliseconds, the queue receive\r
- * task leaves the Blocked state every 200 milliseconds, and therefore toggles\r
- * the LED every 200 milliseconds.\r
+ * if the value equals the expected 100, toggles the blue LED. The 'block \r
+ * time' parameter passed to the queue receive function specifies that the task \r
+ * should be held in the Blocked state indefinitely to wait for data to be \r
+ * available on the queue. The queue receive task will only leave the Blocked \r
+ * state when the queue send task writes to the queue. As the queue send task \r
+ * writes to the queue every 200 milliseconds, the queue receive task leaves the \r
+ * Blocked state every 200 milliseconds, and therefore toggles the blue LED \r
+ * every 200 milliseconds.\r
*\r
* The LED Software Timer and the Button Interrupt:\r
* The user button SW2 is configured to generate an interrupt each time it is\r
- * pressed. The interrupt service routine switches an LED in the 7 segment\r
- * display on, and resets the LED software timer. The LED timer has a 5000\r
- * millisecond (5 second) period, and uses a callback function that is defined\r
- * to just turn the LED off again. Therefore, pressing the user button will\r
- * turn the LED on, and the LED will remain on until a full five seconds pass\r
- * without the button being pressed.\r
+ * pressed. The interrupt service routine switches the green LED on, and \r
+ * resets the LED software timer. The LED timer has a 5000 millisecond (5 \r
+ * second) period, and uses a callback function that is defined to just turn the \r
+ * LED off again. Therefore, pressing the user button will turn the LED on, and \r
+ * the LED will remain on until a full five seconds pass without the button \r
+ * being pressed.\r
*/\r
\r
/* Kernel includes. */\r
/* The LED toggle by the queue receive task (blue). */\r
#define mainTASK_CONTROLLED_LED ( 1UL << 10UL )\r
\r
-/* The LED turned on by the button interrupt, and turned off by the LED timer. */\r
+/* The LED turned on by the button interrupt, and turned off by the LED timer\r
+(green). */\r
#define mainTIMER_CONTROLLED_LED ( 1UL << 29UL )\r
\r
/* The vector used by the GPIO port E. Button SW2 is configured to generate\r
-an interrput on this port. */\r
-#define mainGPIO_E_VECTOR ( 107 - 16 )\r
+an interrupt on this port. */\r
+#define mainGPIO_E_VECTOR ( 91 )\r
\r
/* A block time of zero simply means "don't block". */\r
#define mainDONT_BLOCK ( 0UL )\r
static void prvButtonLEDTimerCallback( xTimerHandle xTimer )\r
{\r
/* The timer has expired - so no button pushes have occurred in the last\r
- five seconds - turn the LED off. NOTE - accessing the LED port should use\r
- a critical section because it is accessed from multiple tasks, and the\r
- button interrupt - in this trivial case, for simplicity, the critical\r
- section is omitted. */\r
+ five seconds - turn the LED off. */\r
GPIOA_PSOR = mainTIMER_CONTROLLED_LED;\r
}\r
/*-----------------------------------------------------------*/\r
\r
/* This interrupt safe FreeRTOS function can be called from this interrupt\r
because the interrupt priority is below the\r
- configMAX_SYSCALL_INTERRUPT_PRIORITY setting in FreeRTOSConfig.h. */\r
+ configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY setting in FreeRTOSConfig.h. */\r
xTimerResetFromISR( xButtonLEDTimer, &xHigherPriorityTaskWoken );\r
\r
- /* Clear the interrupt before leaving. This just clears all the interrupts\r
- for simplicity, as only one is actually used in this simple demo anyway. */\r
+ /* Clear the interrupt before leaving. */\r
PORTE_ISFR = 0xFFFFFFFFUL;\r
\r
/* If calling xTimerResetFromISR() caused a task (in this case the timer\r
{\r
/* Enable the interrupt on SW1. */\r
PORTE_PCR26 = PORT_PCR_MUX( 1 ) | PORT_PCR_IRQC( 0xA ) | PORT_PCR_PE_MASK | PORT_PCR_PS_MASK;\r
-\r
enable_irq( mainGPIO_E_VECTOR );\r
+ \r
+ /* The interrupt calls an interrupt safe API function - so its priority must\r
+ be equal to or lower than configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY. */\r
set_irq_priority( mainGPIO_E_VECTOR, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY );\r
\r
/* Set PTA10, PTA11, PTA28, and PTA29 (connected to LED's) for GPIO\r
( void ) pxTask;\r
\r
/* Run time stack overflow checking is performed if\r
- configconfigCHECK_FOR_STACK_OVERFLOW is defined to 1 or 2. This hook\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
/*-----------------------------------------------------------*/\r
\r
-void vApplicationTickHook( void )\r
-{\r
- /* A tick hook is used by the "Full" build configuration. The Full and\r
- blinky build configurations share a FreeRTOSConfig.h header file, so this\r
- simple build configuration also has to define a tick hook - even though it\r
- does not actually use it for anything. */\r
-}\r
-/*-----------------------------------------------------------*/\r
-\r
void vApplicationIdleHook( void )\r
{\r
volatile size_t xFreeHeapSpace;\r
void vMainConfigureTimerForRunTimeStats( void ) {}\r
unsigned long ulMainGetRunTimeCounterValue( void ) { return 0UL; }\r
\r
+/* A tick hook is used by the "Full" build configuration. The Full and blinky \r
+build configurations share a FreeRTOSConfig.h header file, so this simple build \r
+configuration also has to define a tick hook - even though it does not actually \r
+use it for anything. */\r
+void vApplicationTickHook( void ) {}\r
+\r
+\r
+\r
\r
\r
\r