define symbol __ICFEDIT_region_RAM_end__ = 0x31FFFF;\r
/*-Sizes-*/\r
define symbol __ICFEDIT_size_vectors__ = 0x100;\r
-define symbol __ICFEDIT_size_cstack__ = 0x400; \r
-define symbol __ICFEDIT_size_sysstack__ = 0x600;\r
+define symbol __ICFEDIT_size_cstack__ = 0x400;\r
+/*define symbol __ICFEDIT_size_sysstack__ = 0x600; Not used. */\r
define symbol __ICFEDIT_size_irqstack__ = 0x600;\r
define symbol __ICFEDIT_size_heap__ = 0x0;\r
/*-Exports-*/\r
export symbol __ICFEDIT_region_RAM_end__;\r
export symbol __ICFEDIT_size_vectors__;\r
export symbol __ICFEDIT_size_cstack__;\r
-export symbol __ICFEDIT_size_sysstack__;\r
+/*export symbol __ICFEDIT_size_sysstack__; Not used. */\r
export symbol __ICFEDIT_size_irqstack__;\r
export symbol __ICFEDIT_size_heap__;\r
/**** End of ICF editor section. ###ICF###*/\r
define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__+__ICFEDIT_size_vectors__ to __ICFEDIT_region_RAM_end__];\r
\r
define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { };\r
-define block SYS_STACK with alignment = 8, size = __ICFEDIT_size_sysstack__ { };\r
+/* define block SYS_STACK with alignment = 8, size = __ICFEDIT_size_sysstack__ { }; not used. */\r
define block IRQ_STACK with alignment = 8, size = __ICFEDIT_size_irqstack__ { };\r
define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { };\r
\r
-initialize by copy with packing=none { readwrite }; \r
+initialize by copy with packing=none { readwrite };\r
do not initialize { readonly section .noinit };\r
\r
place in VEC_region { section .vectors };\r
place in RAM_region { readonly };\r
place in RAM_region { section .cstartup };\r
-place in RAM_region { readwrite, block IRQ_STACK, block SYS_STACK, block CSTACK, block HEAP };\r
+place in RAM_region { readwrite, block IRQ_STACK, /* block SYS_STACK not used, */ block CSTACK, block HEAP };\r
/* Wait for the PCKRDY1 bit to be set in the PMC_SR register*/\r
while ((REG_PMC_SR & PMC_SR_PCKRDY1) == 0);\r
#endif\r
+\r
/* select FIQ */\r
AIC->AIC_SSR = 0;\r
AIC->AIC_SVR = (unsigned int) defaultFiqHandler;\r
usTemp = ( ( *pc2 ) << 8 ) | *pc1;\r
\r
return usTemp;\r
-#warning The original code below crashes when build for A5 as endpoint can be misaligned.\r
- //_RB_return endpoint->wMaxPacketSize;\r
+#warning The above code replaces the line below to ensure aborts are not received due to unaligned accesses. Alternatively use the --no_unaligned_access compiler option.\r
+ //return endpoint->wMaxPacketSize;\r
}\r
\r
/**\r
/*\r
* The function that creates the CLI task.\r
*/\r
-void vUARTCommandConsoleStart( uint16_t usStackSize, UBaseType_t uxPriority );\r
+void vUSBCommandConsoleStart( uint16_t usStackSize, UBaseType_t uxPriority );\r
\r
/*\r
* Send xDataLength bytes from pcData to the CDC port.\r
\r
/*-----------------------------------------------------------*/\r
\r
-void vUARTCommandConsoleStart( uint16_t usStackSize, UBaseType_t uxPriority )\r
+void vUSBCommandConsoleStart( uint16_t usStackSize, UBaseType_t uxPriority )\r
{\r
/* Event group used to indicate that bytes are available in the Rx buffer\r
or that bytes have finished sending. */\r
#define configUSE_IDLE_HOOK 1\r
#define configUSE_TICK_HOOK 1\r
#define configMAX_PRIORITIES ( 5 )\r
-#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 160 )\r
-#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 45 * 1024 ) )\r
+#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 150 )\r
+#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 42 * 1024 ) )\r
#define configMAX_TASK_NAME_LEN ( 10 )\r
#define configUSE_TRACE_FACILITY 1\r
#define configUSE_16_BIT_TICKS 0\r
and one on TCP/IP). This is done to prevent an output buffer being defined by\r
each implementation - which would waste RAM. In this case, there is only one\r
command interpreter running. */\r
- #define configCOMMAND_INT_MAX_OUTPUT_SIZE 2096\r
+ #define configCOMMAND_INT_MAX_OUTPUT_SIZE 3000\r
\r
/* Normal assert() semantics without relying on the provision of an assert.h\r
header file. */\r
\r
static void System_Handler( void )\r
{\r
- __enable_interrupt();\r
-\r
/* See the comments above the function prototype in this file. */\r
FreeRTOS_Tick_Handler();\r
}\r
* interrupts. As the interrupt is shared the nesting achieved is not as deep\r
* as normal when this test is executed, but still worth while.\r
*\r
- * TC2 channel 0 provides a much higher frequency timer that tests the nesting of\r
- * interrupts that execute above the maximum syscall interrupt priority.\r
+ * TC2 channel 0 provides a much higher frequency timer that tests the nesting\r
+ * of interrupts that don't use the FreeRTOS API. For convenience, the high\r
+ * frequency timer also keeps a count of the number of time it executes, and the\r
+ * count is used as the time base for the run time stats (which can be viewed\r
+ * through the CLI).\r
*\r
* All the timers can nest with the tick interrupt - creating a maximum\r
* interrupt nesting depth of 3 (normally 4, if the first two timers used\r
* separate interrupts).\r
*\r
- * For convenience, the high frequency timer is also used to provide the time\r
- * base for the run time stats.\r
*/\r
\r
/* Scheduler includes. */\r
ensure they don't remain synchronised. The frequency of the highest priority\r
interrupt is 20 times faster so really hammers the interrupt entry and exit\r
code. */\r
-#define tmrTIMERS_USED 3\r
#define tmrTIMER_0_FREQUENCY ( 2000UL )\r
#define tmrTIMER_1_FREQUENCY ( 2003UL )\r
#define tmrTIMER_2_FREQUENCY ( 20000UL )\r
#define tmrHIGHER_PRIORITY 5\r
/*-----------------------------------------------------------*/\r
\r
-/* Handlers for the three timer channels. */\r
+/* Handlers for the two timer peripherals - two channels are used in the TC0\r
+timer. */\r
static void prvTC0_Handler( void );\r
static void prvTC1_Handler( void );\r
\r
\r
static void prvTC0_Handler( void )\r
{\r
-#warning Why can interrupts only be enabled inside the C function?\r
- __enable_interrupt();\r
-\r
/* Read will clear the status bit. */\r
if( ( TC0->TC_CHANNEL[ tmrTC0_CHANNEL_0 ].TC_SR & tmrRC_COMPARE ) != 0 )\r
{\r
{\r
volatile uint32_t ulDummy;\r
\r
- __enable_interrupt();\r
-\r
/* Dummy read to clear status bit. */\r
ulDummy = TC1->TC_CHANNEL[ tmrTC1_CHANNEL_0 ].TC_SR;\r
\r
* In addition to the standard demo tasks, the following tasks and tests are\r
* defined and/or created within this file:\r
*\r
- * FreeRTOS+CLI command console. The command console is access through the\r
- * UART to USB connector on the _RB_. For\r
- * reasons of robustness testing the UART driver is deliberately written to be\r
- * inefficient and should not be used as a template for a production driver.\r
- * Type "help" to see a list of registered commands. The FreeRTOS+CLI license\r
- * is different to the FreeRTOS license, see http://www.FreeRTOS.org/cli for\r
- * license and usage details. The default baud rate is 115200.\r
+ * "FreeRTOS+CLI command console" - The command console is access using the USB\r
+ * CDC driver provided by Atmel. It is accessed through the USB connector\r
+ * marked J6 SAMA5D3 Xplained board. Type "help" to see a list of registered\r
+ * commands. The FreeRTOS+CLI license is different to the FreeRTOS license, see\r
+ * http://www.FreeRTOS.org/cli for license and usage details. The default baud\r
+ * rate is 115200.\r
*\r
* "Reg test" tasks - These fill both the core and floating point registers with\r
* known values, then check that each register maintains its expected value for\r
#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2UL )\r
#define mainCREATOR_TASK_PRIORITY ( tskIDLE_PRIORITY + 3UL )\r
#define mainFLOP_TASK_PRIORITY ( tskIDLE_PRIORITY )\r
-#define mainUART_COMMAND_CONSOLE_STACK_SIZE ( configMINIMAL_STACK_SIZE * 3UL )\r
+#define mainCDC_COMMAND_CONSOLE_STACK_SIZE ( configMINIMAL_STACK_SIZE * 2UL )\r
#define mainCOM_TEST_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 )\r
#define mainCHECK_TASK_PRIORITY ( configMAX_PRIORITIES - 1 )\r
#define mainQUEUE_OVERWRITE_PRIORITY ( tskIDLE_PRIORITY )\r
\r
-/* The priority used by the UART command console task. */\r
+/* The initial priority used by the UART command console task. */\r
#define mainUART_COMMAND_CONSOLE_TASK_PRIORITY ( configMAX_PRIORITIES - 2 )\r
\r
/* The LED used by the check timer. */\r
/*\r
* The task that manages the FreeRTOS+CLI input and output.\r
*/\r
-extern void vUARTCommandConsoleStart( uint16_t usStackSize, UBaseType_t uxPriority );\r
+extern void vUSBCommandConsoleStart( uint16_t usStackSize, UBaseType_t uxPriority );\r
\r
/*\r
* A high priority task that does nothing other than execute at a pseudo random\r
volatile unsigned long ulRegTest1LoopCounter = 0UL, ulRegTest2LoopCounter = 0UL;\r
\r
/*-----------------------------------------------------------*/\r
-#warning Check demo and source folders for _RB_\r
+\r
void main_full( void )\r
{\r
/* Start all the other standard demo/test tasks. They have not particular\r
\r
/* Start the tasks that implements the command console on the UART, as\r
described above. */\r
- vUARTCommandConsoleStart( mainUART_COMMAND_CONSOLE_STACK_SIZE, mainUART_COMMAND_CONSOLE_TASK_PRIORITY );\r
+ vUSBCommandConsoleStart( mainCDC_COMMAND_CONSOLE_STACK_SIZE, mainUART_COMMAND_CONSOLE_TASK_PRIORITY );\r
\r
/* Register the standard CLI commands. */\r
vRegisterSampleCLICommands();\r
</option>\r
<option>\r
<name>MemFile</name>\r
- <state></state>\r
+ <state>$TOOLKIT_DIR$\CONFIG\debugger\Atmel\ATSAMA5D35.ddf</state>\r
</option>\r
<option>\r
<name>RunToEnable</name>\r
</plugin>\r
<plugin>\r
<file>$TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin</file>\r
- <loadFlag>0</loadFlag>\r
+ <loadFlag>1</loadFlag>\r
</plugin>\r
<plugin>\r
<file>$TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin</file>\r
<option>\r
<name>Input variant</name>\r
<version>3</version>\r
- <state>6</state>\r
+ <state>7</state>\r
</option>\r
<option>\r
<name>Input description</name>\r
- <state>No specifier n, no float nor long long, no scan set, no assignment suppressing.</state>\r
+ <state>No specifier n, no float nor long long, no scan set, no assignment suppressing, without multibyte support.</state>\r
</option>\r
<option>\r
<name>Output variant</name>\r
<version>2</version>\r
- <state>5</state>\r
+ <state>7</state>\r
</option>\r
<option>\r
<name>Output description</name>\r
- <state>No specifier a, A, no specifier n, no float nor long long.</state>\r
+ <state>No specifier a, A, no specifier n, no float nor long long, no flags.</state>\r
</option>\r
<option>\r
<name>GOutputBinary</name>\r
<name>$PROJ_DIR$\..\..\..\FreeRTOS-Plus\Demo\Common\FreeRTOS_Plus_CLI_Demos\Sample-CLI-commands.c</name>\r
</file>\r
</group>\r
- <file>\r
- <name>$PROJ_DIR$\atmel_main.c</name>\r
- </file>\r
<file>\r
<name>$PROJ_DIR$\cstartup_with_FreeRTOS_vectors.s</name>\r
</file>\r
+++ /dev/null
-/* ----------------------------------------------------------------------------\r
- * SAM Software Package License\r
- * ----------------------------------------------------------------------------\r
- * Copyright (c) 2014, Atmel Corporation\r
- *\r
- * All rights reserved.\r
- *\r
- * Redistribution and use in source and binary forms, with or without\r
- * modification, are permitted provided that the following conditions are met:\r
- *\r
- * - Redistributions of source code must retain the above copyright notice,\r
- * this list of conditions and the disclaimer below.\r
- *\r
- * Atmel's name may not be used to endorse or promote products derived from\r
- * this software without specific prior written permission.\r
- *\r
- * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR\r
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\r
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE\r
- * DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,\r
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\r
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,\r
- * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\r
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\r
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,\r
- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
- * ----------------------------------------------------------------------------\r
- */\r
-\r
-\r
-/**\r
- * \page getting-started Getting Started with sama5d3 Microcontrollers\r
- *\r
- * \section Purpose\r
- *\r
- * The Getting Started example will help new users get familiar with Atmel's\r
- * sama5d3x microcontroller. This basic application shows the startup\r
- * sequence of a chip and how to use its core peripherals.\r
- *\r
- * \section Requirements\r
- *\r
- * This package can be used with sama5d3 xplained board.\r
- *\r
- * \section Description\r
- *\r
- * The demonstration program makes two LEDs on the board blink at a fixed rate.\r
- * This rate is generated by using Time tick timer. The blinking can be stopped\r
- * using two buttons (one for each LED). If there is no enough buttons on board, please\r
- * type "1" or "2" in the terminal application on PC to control the LEDs\r
- * instead.\r
- *\r
- * \section Usage\r
- *\r
- * -# Build the program and download it inside the xplained board. Please\r
- * refer to the\r
- * <a href="http://www.atmel.com/dyn/resources/prod_documents/6421B.pdf">\r
- * SAM-BA User Guide</a>, the\r
- * <a href="http://www.atmel.com/dyn/resources/prod_documents/doc6310.pdf">\r
- * GNU-Based Software Development</a>\r
- * application note or to the\r
- * <a href="ftp://ftp.iar.se/WWWfiles/arm/Guides/EWARM_UserGuide.ENU.pdf">\r
- * IAR EWARM User Guide</a>,\r
- * depending on your chosen solution.\r
- * -# On the computer, open and configure a terminal application\r
- * (e.g. HyperTerminal on Microsoft Windows) with these settings:\r
- * - 115200 bauds\r
- * - 8 bits of data\r
- * - No parity\r
- * - 1 stop bit\r
- * - No flow control\r
- * -# Start the application.\r
- * -# Two LEDs should start blinking on the board. In the terminal window, the\r
- * following text should appear (values depend on the board and chip used):\r
- * \code\r
- * -- Getting Started Example xxx --\r
- * -- SAMxxxxx-xx\r
- * -- Compiled: xxx xx xxxx xx:xx:xx --\r
- * \endcode\r
- * -# Pressing and release button 1 or type "1" in the terminal application on\r
- * PC should make the first LED stop & restart blinking.\r
- * Pressing and release button 2 or type "1" in the terminal application on\r
- * PC should make the other LED stop & restart blinking.\r
- *\r
- * \section References\r
- * - getting-started/main.c\r
- * - pio.h\r
- * - pio_it.h\r
- * - led.h\r
- * - trace.h\r
- */\r
-\r
-/** \file\r
- *\r
- * This file contains all the specific code for the getting-started example.\r
- *\r
- */\r
-\r
-/*----------------------------------------------------------------------------\r
- * Headers\r
- *----------------------------------------------------------------------------*/\r
-\r
-#include "board.h"\r
-\r
-#include <stdbool.h>\r
-#include <stdio.h>\r
-\r
-/*----------------------------------------------------------------------------\r
- * Local definitions\r
- *----------------------------------------------------------------------------*/\r
-\r
-#define NO_PUSHBUTTON\r
-\r
-/** IRQ priority for PIO (The lower the value, the greater the priority) */\r
-#define IRQ_PRIOR_PIO 0\r
-\r
-/** LED0 blink time, LED1 blink half this time, in ms */\r
-#define BLINK_PERIOD 1000\r
-\r
-/** Delay for pushbutton debouncing (in milliseconds). */\r
-#define DEBOUNCE_TIME 500\r
-\r
-/*----------------------------------------------------------------------------\r
- * Local variables\r
- *----------------------------------------------------------------------------*/\r
-\r
-#ifndef NO_PUSHBUTTON\r
-/** Pushbutton \#1 pin instance. */\r
-const Pin pinPB1 = PIN_PUSHBUTTON_1 ;\r
-/** Pushbutton \#1 pin instance. */\r
-const Pin pinPB2 = PIN_PUSHBUTTON_2 ;\r
-#endif\r
-\r
-/** LED0 blinking control. */\r
-volatile bool bLed0Active = true ;\r
-\r
-/** LED1 blinking control. */\r
-volatile bool bLed1Active = true ;\r
-\r
-/** Global timestamp in milliseconds since start of application */\r
-volatile uint32_t dwTimeStamp = 0;\r
-\r
-/*----------------------------------------------------------------------------\r
- * Local functions\r
- *----------------------------------------------------------------------------*/\r
-\r
-/**\r
- * \brief Process Buttons Events\r
- *\r
- * Change active states of LEDs when corresponding button events happened.\r
- */\r
-static void ProcessButtonEvt( uint8_t ucButton )\r
-{\r
- if ( ucButton == 0 )\r
- {\r
- bLed0Active = !bLed0Active ;\r
- if ( !bLed0Active )\r
- {\r
- LED_Clear( 0 );\r
- }\r
- }\r
- else\r
- {\r
- bLed1Active = !bLed1Active ;\r
-\r
- /* Enable LED#2 and TC if they were disabled */\r
- if ( bLed1Active )\r
- {\r
- LED_Set( 1 );\r
- TC_Start( TC0, 0 );\r
- }\r
- /* Disable LED#2 and TC if they were enabled */\r
- else\r
- {\r
- LED_Clear( 1 );\r
- TC_Stop( TC0, 0 );\r
- }\r
- }\r
-}\r
-\r
-#ifndef NO_PUSHBUTTON\r
-/**\r
- * \brief Handler for Button 1 rising edge interrupt.\r
- *\r
- * Handle process led1 status change.\r
- */\r
-static void _Button1_Handler( const Pin* pin )\r
-{\r
- pin = pin;\r
- ProcessButtonEvt( 0 ) ;\r
-}\r
-\r
-/**\r
- * \brief Handler for Button 2 falling edge interrupt.\r
- *\r
- * Handle process led2 status change.\r
- */\r
-static void _Button2_Handler( const Pin* pin )\r
-{\r
- pin = pin;\r
- ProcessButtonEvt( 1 ) ;\r
-}\r
-#else\r
-/**\r
- * \brief Handler for DBGU input.\r
- *\r
- * Handle process LED1 or LED2 status change.\r
- */\r
-static void _DBGU_Handler( void )\r
-{\r
- uint8_t key;\r
- if ( !DBGU_IsRxReady( ) ) return ;\r
- key = DBGU_GetChar( ) ;\r
- switch ( key )\r
- {\r
- case '1': case '2':\r
- ProcessButtonEvt( key - '1' ) ;\r
- break;\r
- }\r
-}\r
-#endif\r
-\r
-/**\r
- * \brief Handler for PIT interrupt.\r
- */\r
-static void _Pit_Handler( void )\r
-{\r
- uint32_t status;\r
-\r
- /* Read the PIT status register */\r
- status = PIT_GetStatus() & PIT_SR_PITS;\r
- if (status != 0) {\r
- /* 1 = The Periodic Interval timer has reached PIV since the last read of PIT_PIVR.\r
- Read the PIVR to acknowledge interrupt and get number of ticks\r
- Returns the number of occurrences of periodic intervals since the last read of PIT_PIVR. */\r
- dwTimeStamp += (PIT_GetPIVR() >> 20);\r
- }\r
-}\r
-\r
-/**\r
- * \brief Handler for Sysc interrupts.\r
- */\r
-void _Sysc_Handler( void );\r
-void _Sysc_Handler( void )\r
-{\r
- _Pit_Handler( ) ;\r
- #ifdef NO_PUSHBUTTON\r
- _DBGU_Handler( ) ;\r
- #endif\r
-}\r
-\r
-/**\r
- * \brief Configure the periodic interval timer (PIT) to generate an interrupt every\r
- * interrupt every millisecond\r
- */\r
-static void ConfigurePit(void)\r
-{\r
- PMC->PMC_PCER0 = 1 << ID_PIT;\r
- /* Initialize the PIT to the desired frequency */\r
- PIT_Init(BLINK_PERIOD, BOARD_MCK / 1000000);\r
- /* Configure interrupt on PIT */\r
- IRQ_ConfigureIT(ID_PIT, 0, _Sysc_Handler);\r
- IRQ_EnableIT(ID_PIT);\r
- PIT_EnableIT();\r
- /* Enable the pit */\r
- PIT_Enable();\r
-}\r
-\r
-#ifndef NO_PUSHBUTTON\r
-/**\r
- * \brief Configure the Pushbuttons\r
- *\r
- * Configure the PIO as inputs and generate corresponding interrupt when\r
- * pressed or released.\r
- */\r
-static void _ConfigureButtons( void )\r
-{\r
- /* Configure pios as inputs. */\r
- PIO_Configure( &pinPB1, 1 ) ;\r
- PIO_Configure( &pinPB2, 1 ) ;\r
-\r
- /* Adjust pio debounce filter patameters, uses 10 Hz filter. */\r
- PIO_SetDebounceFilter( &pinPB1, 10 ) ;\r
- PIO_SetDebounceFilter( &pinPB1, 10 ) ;\r
-\r
- /* Enable PIO controller IRQs. */\r
- PIO_InitializeInterrupts(0);\r
- /* Initialize pios interrupt handlers, see PIO definition in board.h. */\r
- PIO_ConfigureIt(&pinPB1, (void (*)(const Pin *))_Button1_Handler);\r
- PIO_ConfigureIt(&pinPB2, (void (*)(const Pin *))_Button2_Handler);\r
-\r
- /* Enable PIO line interrupts. */\r
- PIO_EnableIt( &pinPB1 ) ;\r
- PIO_EnableIt( &pinPB2 ) ;\r
-}\r
-#endif\r
-\r
-/**\r
- * \brief Configure LEDs\r
- *\r
- * Configures LEDs \#1 and \#2 (cleared by default).\r
- */\r
-static void _ConfigureLeds( void )\r
-{\r
- LED_Configure( 0 ) ;\r
- LED_Configure( 1 ) ;\r
-}\r
-\r
-/**\r
- * Interrupt handler for TC0 interrupt. Toggles the state of LED\#2.\r
- */\r
-static void TC0_IrqHandler( void )\r
-{\r
- volatile uint32_t dummy;\r
- /* Clear status bit to acknowledge interrupt */\r
- dummy = TC0->TC_CHANNEL[ 0 ].TC_SR ;\r
-\r
- /** Toggle LED state. */\r
- LED_Toggle( 1 ) ;\r
- printf( "2 " ) ;\r
-}\r
-\r
-/**\r
- * Configure Timer Counter 0 to generate an interrupt every 250ms.\r
- */\r
-static void _ConfigureTc( void )\r
-{\r
- uint32_t div;\r
- uint32_t tcclks;\r
-\r
- /** Enable peripheral clock. */\r
- PMC->PMC_PCER0 = 1 << ID_TC0;\r
-\r
- /** Configure TC for a 4Hz frequency and trigger on RC compare. */\r
- TC_FindMckDivisor( 4, BOARD_MCK, &div, &tcclks, BOARD_MCK );\r
- TC_Configure( TC0, 0, tcclks | TC_CMR_CPCTRG );\r
- TC0->TC_CHANNEL[ 0 ].TC_RC = ( BOARD_MCK / div ) / 4;\r
-\r
- /* Configure and enable interrupt on RC compare */\r
- IRQ_ConfigureIT(ID_TC0, 0, TC0_IrqHandler);\r
- TC0->TC_CHANNEL[ 0 ].TC_IER = TC_IER_CPCS;\r
- IRQ_EnableIT(ID_TC0);\r
-\r
- /** Start the counter if LED1 is enabled. */\r
- if ( bLed1Active )\r
- {\r
- TC_Start( TC0, 0 );\r
- }\r
-}\r
-\r
-/**\r
- * Waits for the given number of milliseconds (using the dwTimeStamp generated\r
- * by the SAM3's microcontrollers's system tick).\r
- * \param delay Delay to wait for, in milliseconds.\r
- */\r
-static void _Wait( unsigned long delay )\r
-{\r
- volatile uint32_t start = dwTimeStamp;\r
- uint32_t elapsed;\r
- do {\r
- elapsed = dwTimeStamp;\r
- elapsed -= start;\r
- }\r
- while (elapsed < delay);\r
-}\r
-\r
-/*----------------------------------------------------------------------------\r
- * Global functions\r
- *----------------------------------------------------------------------------*/\r
-\r
-/**\r
- * \brief getting-started Application entry point.\r
- *\r
- * \return Unused (ANSI-C compatibility).\r
- */\r
-int atmel_main( void );\r
-int atmel_main( void )\r
-{\r
- /* Disable watchdog */\r
- WDT_Disable( WDT ) ;\r
-#if defined (ddram)\r
- MMU_Initialize((uint32_t *)0x30C000);\r
- CP15_EnableMMU();\r
- CP15_EnableDcache();\r
- CP15_EnableIcache();\r
-#endif\r
-\r
- /* Output example information */\r
- printf( "-- Getting Started Example %s --\n\r", SOFTPACK_VERSION ) ;\r
- printf( "-- %s\n\r", BOARD_NAME ) ;\r
- printf( "-- Compiled: %s %s --\n\r", __DATE__, __TIME__ ) ;\r
-\r
- /* Configure PIT. */\r
- printf( "Configure PIT \n\r" ) ;\r
-//__asm volatile( "cpsid i" );\r
- ConfigurePit() ;\r
-\r
- /* PIO configuration for LEDs and Buttons. */\r
- PIO_InitializeInterrupts( IRQ_PRIOR_PIO ) ;\r
-\r
- printf( "Configure TC.\n\r" );\r
- _ConfigureTc() ;\r
-\r
- printf( "Configure LED PIOs.\n\r" ) ;\r
- _ConfigureLeds() ;\r
-\r
-#ifndef NO_PUSHBUTTON\r
- printf( "Configure buttons with debouncing.\n\r" ) ;\r
- _ConfigureButtons() ;\r
- printf( "Press USRBP1 to Start/Stop the blue LED D1 blinking.\n\r" ) ;\r
- printf( "Press USRBP2 to Start/Stop the red LED D2 blinking.\n\r" ) ;\r
-\r
-#else\r
- printf( "No push buttons, uses DBG key 1 & 2 instead.\n\r" ) ;\r
- printf( "Press 1 to Start/Stop the blue LED D1 blinking.\n\r" ) ;\r
- printf( "Press 2 to Start/Stop the red LED D2 blinking.\n\r" ) ;\r
-\r
-#endif\r
-\r
- while ( 1 )\r
- {\r
- /* Wait for LED to be active */\r
- while( !bLed0Active );\r
-\r
- /* Toggle LED state if active */\r
- if ( bLed0Active )\r
- {\r
- LED_Toggle( 0 );\r
- printf( "1 " );\r
- }\r
-\r
- /* Wait for 500ms */\r
- _Wait(500);\r
- }\r
-}\r
\r
/* Perform low-level initialization of the chip using LowLevelInit() */\r
label:\r
+ /* Sets up Supervisor stack before running LowLevelInit. The supervisor\r
+ stack is reused by interrupts, which switch from IRQ mode to SVC mode. */\r
LDR r0, =LowLevelInit\r
LDR r4, =SFE(CSTACK)\r
MOV sp, r4\r
MSR cpsr_c, #ARM_MODE_IRQ | I_BIT | F_BIT ; Change the mode\r
LDR sp, =SFE(IRQ_STACK)\r
\r
- /* Set up the SVC stack pointer. This allows the stack used by main()\r
- to get reused by interrupts (which switch from IRQ mode to SVC mode). */\r
- MSR cpsr_c, #ARM_MODE_SVC | F_BIT ; Change the mode\r
- LDR sp, =SFE(CSTACK)\r
-\r
/* No need to set up stacks for any other mode as that stack used by\r
tasks is allocated by FreeRTOS. */\r
\r
+ /* Back to Supervisor mode bfore calling main(). The schduduler should\r
+ be started from Supervisor mode. */\r
+ MSR cpsr_c, #ARM_MODE_SVC | F_BIT ; Change the mode\r
+\r
/* Branch to main() */\r
LDR r0, =?main\r
BLX r0\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
-#warning document configFPU_D32\r
+#warning Things to document 1) configFPU_D32 setting, 2) flops can't be used in ISRs, 3) Level interrupts need to be cleared in their handling functions 4) Notes on tailoring generic Cortex-A port 5) assert() will hit if CDC is hammered. 6) Barrier instructions in A9 callbacks. 7) In thumb mode the "common sub expression elimination" optimisation cannot be used.\r
\r
/* Scheduler include files. */\r
#include "FreeRTOS.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. The address of the ISR is passed into this function as a parameter.\r
+Note this level of indirection could be removed by creating a SAMA5 specific\r
+port layer that calls the IRQ directly from the port layer rather than via this\r
+application callback. */\r
+void vApplicationIRQHandler( uint32_t ulInterruptVectorAddress );\r
+\r
/*-----------------------------------------------------------*/\r
-#warning check stack sizes in linker script.\r
+\r
int main( void )\r
{\r
/* Configure the hardware ready to run the demo. */\r
\r
/* Configure ports used by LEDs. */\r
vParTestInitialise();\r
+\r
+ CP15_EnableIcache();\r
}\r
/*-----------------------------------------------------------*/\r
\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( uint32_t ulInterruptVectorAddress )\r
+{\r
+typedef void (*ISRFunction_t)( void );\r
+ISRFunction_t pxISRFunction;\r
+volatile uint32_t * pulAIC_IVR = ( uint32_t * ) configINTERRUPT_VECTOR_ADDRESS;\r
+\r
+ /* On the SAMA5 the parameter is a pointer to the ISR handling function. */\r
+ pxISRFunction = ( ISRFunction_t ) ulInterruptVectorAddress;\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 = 0;\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
<Debug-Log>\r
\r
\r
- <ColumnWidth0>20</ColumnWidth0><ColumnWidth1>1622</ColumnWidth1></Debug-Log>\r
+ <PreferedWindows><Position>3</Position><ScreenPosX>0</ScreenPosX><ScreenPosY>0</ScreenPosY><Windows><Window><Factory>Build</Factory></Window><Window><Factory>Find-in-Files</Factory></Window></Windows></PreferedWindows><ColumnWidth0>20</ColumnWidth0><ColumnWidth1>1622</ColumnWidth1></Debug-Log>\r
<Build>\r
\r
\r
\r
\r
- <ColumnWidth0>20</ColumnWidth0><ColumnWidth1>1216</ColumnWidth1><ColumnWidth2>324</ColumnWidth2><ColumnWidth3>81</ColumnWidth3></Build>\r
+ <ColumnWidth0>20</ColumnWidth0><ColumnWidth1>1216</ColumnWidth1><ColumnWidth2>324</ColumnWidth2><ColumnWidth3>81</ColumnWidth3><PreferedWindows><Position>3</Position><ScreenPosX>0</ScreenPosX><ScreenPosY>0</ScreenPosY><Windows><Window><Factory>Debug-Log</Factory></Window><Window><Factory>Find-in-Files</Factory></Window></Windows></PreferedWindows></Build>\r
<Workspace>\r
<ColumnWidths>\r
\r
\r
\r
\r
- <Column0>258</Column0><Column1>27</Column1><Column2>27</Column2><Column3>27</Column3></ColumnWidths>\r
+ <Column0>242</Column0><Column1>27</Column1><Column2>27</Column2><Column3>27</Column3></ColumnWidths>\r
</Workspace>\r
<Disassembly>\r
<col-names>\r
\r
\r
<item>500</item><item>20</item></col-widths>\r
- <DisasmHistory><item>0x0030211C</item><item>0x00302750</item></DisasmHistory>\r
+ <DisasmHistory><item>0x305444</item><item>0x0030211C</item><item>0x00302750</item></DisasmHistory>\r
\r
\r
<PreferedWindows><Position>2</Position><ScreenPosX>0</ScreenPosX><ScreenPosY>0</ScreenPosY><Windows/></PreferedWindows><ShowCodeCoverage>1</ShowCodeCoverage><ShowInstrProfiling>1</ShowInstrProfiling></Disassembly>\r
- <Register><PreferedWindows><Position>2</Position><ScreenPosX>0</ScreenPosX><ScreenPosY>0</ScreenPosY><Windows/></PreferedWindows></Register><WATCH_1><expressions><item></item></expressions><col-names><item>Expression</item><item>Location</item><item>Type</item><item>Value</item></col-names><col-widths><item>207</item><item>150</item><item>100</item><item>294</item></col-widths><PreferedWindows><Position>2</Position><ScreenPosX>0</ScreenPosX><ScreenPosY>0</ScreenPosY><Windows/></PreferedWindows></WATCH_1><CallStack><PreferedWindows><Position>1</Position><ScreenPosX>0</ScreenPosX><ScreenPosY>0</ScreenPosY><Windows/></PreferedWindows><col-names><item>Frame</item><item>_I0</item></col-names><col-widths><item>400</item><item>20</item></col-widths></CallStack><Breakpoints><PreferedWindows><Position>3</Position><ScreenPosX>0</ScreenPosX><ScreenPosY>0</ScreenPosY><Windows/></PreferedWindows><col-names><item>Breakpoint</item><item>_I0</item></col-names><col-widths><item>500</item><item>35</item></col-widths></Breakpoints><Find-in-Files><ColumnWidth0>497</ColumnWidth0><ColumnWidth1>82</ColumnWidth1><ColumnWidth2>746</ColumnWidth2><ColumnWidth3>331</ColumnWidth3></Find-in-Files><QuickWatch><PreferedWindows><Position>2</Position><ScreenPosX>0</ScreenPosX><ScreenPosY>0</ScreenPosY><Windows/></PreferedWindows><col-names><item>Expression</item><item>Location</item><item>Type</item><item>Value</item></col-names><col-widths><item>100</item><item>150</item><item>100</item><item>100</item></col-widths><QWatchHistory><item>TC0</item><item>TC0->TC_CHANNEL[ tmrTC0_CHANNEL_0 ].TC_RC</item></QWatchHistory></QuickWatch></Static>\r
+ <Register><PreferedWindows><Position>2</Position><ScreenPosX>0</ScreenPosX><ScreenPosY>0</ScreenPosY><Windows/></PreferedWindows></Register><WATCH_1><expressions><item></item></expressions><col-names><item>Expression</item><item>Location</item><item>Type</item><item>Value</item></col-names><col-widths><item>207</item><item>150</item><item>100</item><item>294</item></col-widths><PreferedWindows><Position>2</Position><ScreenPosX>0</ScreenPosX><ScreenPosY>0</ScreenPosY><Windows/></PreferedWindows></WATCH_1><CallStack><PreferedWindows><Position>1</Position><ScreenPosX>0</ScreenPosX><ScreenPosY>0</ScreenPosY><Windows/></PreferedWindows><col-names><item>Frame</item><item>_I0</item></col-names><col-widths><item>400</item><item>20</item></col-widths></CallStack><Breakpoints><PreferedWindows><Position>3</Position><ScreenPosX>0</ScreenPosX><ScreenPosY>0</ScreenPosY><Windows/></PreferedWindows><col-names><item>Breakpoint</item><item>_I0</item></col-names><col-widths><item>500</item><item>35</item></col-widths></Breakpoints><Find-in-Files><ColumnWidth0>497</ColumnWidth0><ColumnWidth1>82</ColumnWidth1><ColumnWidth2>746</ColumnWidth2><ColumnWidth3>331</ColumnWidth3><PreferedWindows><Position>3</Position><ScreenPosX>0</ScreenPosX><ScreenPosY>0</ScreenPosY><Windows><Window><Factory>Debug-Log</Factory></Window><Window><Factory>Build</Factory></Window></Windows></PreferedWindows></Find-in-Files><QuickWatch><PreferedWindows><Position>2</Position><ScreenPosX>0</ScreenPosX><ScreenPosY>0</ScreenPosY><Windows/></PreferedWindows><col-names><item>Expression</item><item>Location</item><item>Type</item><item>Value</item></col-names><col-widths><item>100</item><item>150</item><item>100</item><item>100</item></col-widths><QWatchHistory><item>TC0</item><item>TC0->TC_CHANNEL[ tmrTC0_CHANNEL_0 ].TC_RC</item></QWatchHistory></QuickWatch><Memory><PreferedWindows><Position>3</Position><ScreenPosX>0</ScreenPosX><ScreenPosY>0</ScreenPosY><Windows/></PreferedWindows><FindDirection>1</FindDirection><FindAsHex>0</FindAsHex></Memory><TASKVIEW><Column0>200</Column0><Column1>100</Column1><Column2>100</Column2><Column3>100</Column3><Column4>100</Column4><Column5>100</Column5><Column6>100</Column6><Column7>100</Column7><Column8>150</Column8></TASKVIEW><QUEUEVIEW><Column0>200</Column0><Column1>100</Column1><Column2>100</Column2><Column3>100</Column3><Column4>100</Column4><Column5>100</Column5><Column6>100</Column6></QUEUEVIEW></Static>\r
<Windows>\r
\r
\r
\r
<Wnd1>\r
- <Tabs>\r
- <Tab>\r
- <Identity>TabID-13925-23874</Identity>\r
- <TabName>Debug Log</TabName>\r
- <Factory>Debug-Log</Factory>\r
- <Session/>\r
- </Tab>\r
- <Tab>\r
- <Identity>TabID-13402-23884</Identity>\r
- <TabName>Build</TabName>\r
- <Factory>Build</Factory>\r
- <Session/>\r
- </Tab>\r
- <Tab><Identity>TabID-21109-11091</Identity><TabName>Find in Files</TabName><Factory>Find-in-Files</Factory><Session/></Tab></Tabs>\r
- \r
- <SelectedTab>0</SelectedTab></Wnd1><Wnd2>\r
<Tabs>\r
<Tab>\r
<Identity>TabID-24673-23877</Identity>\r
<Factory>Workspace</Factory>\r
<Session>\r
\r
- <NodeDict><ExpandedNode>RTOSDemo</ExpandedNode><ExpandedNode>RTOSDemo/Full Demo</ExpandedNode></NodeDict></Session>\r
+ <NodeDict><ExpandedNode>RTOSDemo</ExpandedNode><ExpandedNode>RTOSDemo/Atmel Files</ExpandedNode><ExpandedNode>RTOSDemo/Atmel Files/libchip_sama5d3x</ExpandedNode><ExpandedNode>RTOSDemo/FreeRTOS Source</ExpandedNode><ExpandedNode>RTOSDemo/FreeRTOS Source/portable</ExpandedNode><ExpandedNode>RTOSDemo/FreeRTOS Source/portable/MemMang</ExpandedNode><ExpandedNode>RTOSDemo/FreeRTOS+CLI</ExpandedNode><ExpandedNode>RTOSDemo/Full Demo</ExpandedNode><ExpandedNode>RTOSDemo/Full Demo/Common Demo Tasks</ExpandedNode></NodeDict></Session>\r
</Tab>\r
</Tabs>\r
\r
- <SelectedTab>0</SelectedTab></Wnd2></Windows>\r
+ <SelectedTab>0</SelectedTab></Wnd1><Wnd2><Tabs><Tab><Identity>TabID-22902-32031</Identity><TabName>Tasks</TabName><Factory>TASKVIEW</Factory><Session/></Tab></Tabs><SelectedTab>0</SelectedTab></Wnd2><Wnd3><Tabs><Tab><Identity>TabID-22379-32041</Identity><TabName>Queues</TabName><Factory>QUEUEVIEW</Factory><Session/></Tab></Tabs><SelectedTab>0</SelectedTab></Wnd3></Windows>\r
<Editor>\r
\r
\r
\r
\r
- <Pane><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\Full_Demo\main_full.c</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>370</YPos2><SelStart2>15067</SelStart2><SelEnd2>15067</SelEnd2></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\AtmelFiles\usb\common\core\USBDescriptors.c</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>165</YPos2><SelStart2>6026</SelStart2><SelEnd2>6026</SelEnd2></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\main.c</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>109</YPos2><SelStart2>6007</SelStart2><SelEnd2>6007</SelEnd2></Tab><ActiveTab>2</ActiveTab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\CDCCommandConsole.c</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>309</YPos2><SelStart2>11984</SelStart2><SelEnd2>11984</SelEnd2></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\Full_Demo\IntQueueTimer.c</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>162</YPos2><SelStart2>8098</SelStart2><SelEnd2>8116</SelEnd2></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\..\Source\tasks.c</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>1561</YPos2><SelStart2>55424</SelStart2><SelEnd2>55424</SelEnd2></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\..\Source\portable\IAR\ARM_CA5_No_GIC\portmacro.h</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>107</YPos2><SelStart2>5219</SelStart2><SelEnd2>5219</SelEnd2></Tab></Pane><ActivePane>0</ActivePane><Sizes><Pane><X>1000000</X><Y>1000000</Y></Pane></Sizes><SplitMode>1</SplitMode></Editor>\r
+ <Pane><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\main.c</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>140</YPos2><SelStart2>7249</SelStart2><SelEnd2>7249</SelEnd2></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\Full_Demo\main_full.c</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>63</YPos2><SelStart2>0</SelStart2><SelEnd2>0</SelEnd2></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\blinky_demo\main_blinky.c</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>63</YPos2><SelStart2>1373</SelStart2><SelEnd2>1373</SelEnd2></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\..\Source\portable\IAR\ARM_CA5_No_GIC\portASM.s</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>73</YPos2><SelStart2>3799</SelStart2><SelEnd2>3799</SelEnd2></Tab><ActiveTab>3</ActiveTab></Pane><ActivePane>0</ActivePane><Sizes><Pane><X>1000000</X><Y>1000000</Y></Pane></Sizes><SplitMode>1</SplitMode></Editor>\r
<Positions>\r
\r
\r
\r
\r
\r
- <Top><Row0><Sizes><Toolbar-0104A108><key>iaridepm.enu1</key></Toolbar-0104A108></Sizes></Row0><Row1><Sizes><Toolbar-16133258><key>debuggergui.enu1</key></Toolbar-16133258></Sizes></Row1></Top><Left><Row0><Sizes><Wnd2><Rect><Top>-2</Top><Left>-2</Left><Bottom>718</Bottom><Right>332</Right><x>-2</x><y>-2</y><xscreen>200</xscreen><yscreen>200</yscreen><sizeHorzCX>119048</sizeHorzCX><sizeHorzCY>203252</sizeHorzCY><sizeVertCX>198810</sizeVertCX><sizeVertCY>731707</sizeVertCY></Rect></Wnd2></Sizes></Row0></Left><Right><Row0><Sizes/></Row0></Right><Bottom><Row0><Sizes><Wnd1><Rect><Top>-2</Top><Left>-2</Left><Bottom>198</Bottom><Right>1682</Right><x>-2</x><y>-2</y><xscreen>1684</xscreen><yscreen>200</yscreen><sizeHorzCX>1002381</sizeHorzCX><sizeHorzCY>203252</sizeHorzCY><sizeVertCX>119048</sizeVertCX><sizeVertCY>203252</sizeVertCY></Rect></Wnd1></Sizes></Row0></Bottom><Float><Sizes/></Float></Positions>\r
+ <Top><Row0><Sizes><Toolbar-0111A108><key>iaridepm.enu1</key></Toolbar-0111A108></Sizes></Row0><Row1><Sizes><Toolbar-222ED2A8><key>debuggergui.enu1</key></Toolbar-222ED2A8></Sizes></Row1></Top><Left><Row0><Sizes><Wnd1><Rect><Top>-2</Top><Left>-2</Left><Bottom>520</Bottom><Right>332</Right><x>-2</x><y>-2</y><xscreen>200</xscreen><yscreen>200</yscreen><sizeHorzCX>119048</sizeHorzCX><sizeHorzCY>203252</sizeHorzCY><sizeVertCX>198810</sizeVertCX><sizeVertCY>530488</sizeVertCY></Rect></Wnd1></Sizes></Row0></Left><Right><Row0><Sizes/></Row0></Right><Bottom><Row0><Sizes><Wnd2><Rect><Top>-2</Top><Left>-2</Left><Bottom>198</Bottom><Right>1682</Right><x>-2</x><y>-2</y><xscreen>1684</xscreen><yscreen>200</yscreen><sizeHorzCX>1002381</sizeHorzCX><sizeHorzCY>203252</sizeHorzCY><sizeVertCX>119048</sizeVertCX><sizeVertCY>203252</sizeVertCY></Rect></Wnd2></Sizes></Row0><Row1><Sizes><Wnd3><Rect><Top>196</Top><Left>-2</Left><Bottom>396</Bottom><Right>1682</Right><x>-2</x><y>196</y><xscreen>1684</xscreen><yscreen>200</yscreen><sizeHorzCX>1002381</sizeHorzCX><sizeHorzCY>203252</sizeHorzCY><sizeVertCX>119048</sizeVertCX><sizeVertCY>203252</sizeVertCY></Rect></Wnd3></Sizes></Row1></Bottom><Float><Sizes/></Float></Positions>\r
</Desktop>\r
</Project>\r
\r
Watch1=_ 0 "" 0 "" 0 "" 0 "" 0 0 0 0\r
CStepIntDis=_ 0\r
[DebugChecksum]\r
-Checksum=1546321988\r
+Checksum=-666464609\r
[Exceptions]\r
StopOnUncaught=_ 0\r
StopOnThrow=_ 0\r
[Disassemble mode]\r
mode=0\r
[Breakpoints2]\r
-Bp0=_ 1 "EMUL_CODE" "{$PROJ_DIR$\main.c}.214.2" 0 0 1 "" 0 "" 0\r
+Bp0=_ 1 "EMUL_CODE" "{$PROJ_DIR$\main.c}.218.24" 0 0 1 "" 0 "" 0\r
Count=1\r
[Aliases]\r
Count=0\r
<Windows>\r
\r
\r
- <Wnd2>\r
+ <Wnd1>\r
<Tabs>\r
<Tab>\r
<Identity>TabID-22351-19008</Identity>\r
<Factory>Workspace</Factory>\r
<Session>\r
\r
- <NodeDict><ExpandedNode>RTOSDemo</ExpandedNode><ExpandedNode>RTOSDemo/FreeRTOS Source</ExpandedNode><ExpandedNode>RTOSDemo/FreeRTOS Source/portable</ExpandedNode><ExpandedNode>RTOSDemo/Full Demo</ExpandedNode></NodeDict></Session>\r
+ <NodeDict><ExpandedNode>RTOSDemo</ExpandedNode></NodeDict></Session>\r
</Tab>\r
</Tabs>\r
\r
- <SelectedTab>0</SelectedTab></Wnd2><Wnd3>\r
+ <SelectedTab>0</SelectedTab></Wnd1><Wnd4>\r
<Tabs>\r
<Tab>\r
<Identity>TabID-21076-19237</Identity>\r
</Tab>\r
<Tab><Identity>TabID-23502-23081</Identity><TabName>Debug Log</TabName><Factory>Debug-Log</Factory><Session/></Tab><Tab><Identity>TabID-24431-23894</Identity><TabName>Ambiguous Definitions</TabName><Factory>Select-Ambiguous-Definitions</Factory><Session/></Tab><Tab><Identity>TabID-9033-6116</Identity><TabName>Find in Files</TabName><Factory>Find-in-Files</Factory><Session/></Tab></Tabs>\r
\r
- <SelectedTab>0</SelectedTab></Wnd3></Windows>\r
+ <SelectedTab>0</SelectedTab></Wnd4></Windows>\r
<Editor>\r
\r
\r
\r
\r
- <Pane><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\Full_Demo\main_full.c</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>370</YPos2><SelStart2>15067</SelStart2><SelEnd2>15067</SelEnd2></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\AtmelFiles\usb\common\core\USBDescriptors.c</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>165</YPos2><SelStart2>6026</SelStart2><SelEnd2>6026</SelEnd2></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\main.c</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>109</YPos2><SelStart2>6007</SelStart2><SelEnd2>6007</SelEnd2></Tab><ActiveTab>2</ActiveTab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\CDCCommandConsole.c</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>309</YPos2><SelStart2>11984</SelStart2><SelEnd2>11984</SelEnd2></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\Full_Demo\IntQueueTimer.c</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>162</YPos2><SelStart2>8098</SelStart2><SelEnd2>8116</SelEnd2></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\..\Source\tasks.c</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>1561</YPos2><SelStart2>55424</SelStart2><SelEnd2>55424</SelEnd2></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\..\..\Source\portable\IAR\ARM_CA5_No_GIC\portmacro.h</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>107</YPos2><SelStart2>5219</SelStart2><SelEnd2>5219</SelEnd2></Tab></Pane><ActivePane>0</ActivePane><Sizes><Pane><X>1000000</X><Y>1000000</Y></Pane></Sizes><SplitMode>1</SplitMode></Editor>\r
+ <Pane><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\main.c</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>59</YPos2><SelStart2>7249</SelStart2><SelEnd2>7249</SelEnd2></Tab><ActiveTab>0</ActiveTab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\Full_Demo\main_full.c</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>63</YPos2><SelStart2>0</SelStart2><SelEnd2>0</SelEnd2></Tab><Tab><Factory>TextEditor</Factory><Filename>$WS_DIR$\blinky_demo\main_blinky.c</Filename><XPos>0</XPos><YPos>0</YPos><SelStart>0</SelStart><SelEnd>0</SelEnd><XPos2>0</XPos2><YPos2>63</YPos2><SelStart2>1373</SelStart2><SelEnd2>1373</SelEnd2></Tab></Pane><ActivePane>0</ActivePane><Sizes><Pane><X>1000000</X><Y>1000000</Y></Pane></Sizes><SplitMode>1</SplitMode></Editor>\r
<Positions>\r
\r
\r
\r
\r
\r
- <Top><Row0><Sizes><Toolbar-0104A108><key>iaridepm.enu1</key></Toolbar-0104A108></Sizes></Row0><Row1><Sizes/></Row1></Top><Left><Row0><Sizes><Wnd2><Rect><Top>-2</Top><Left>-2</Left><Bottom>668</Bottom><Right>352</Right><x>-2</x><y>-2</y><xscreen>190</xscreen><yscreen>170</yscreen><sizeHorzCX>113095</sizeHorzCX><sizeHorzCY>172764</sizeHorzCY><sizeVertCX>210714</sizeVertCX><sizeVertCY>680894</sizeVertCY></Rect></Wnd2></Sizes></Row0></Left><Right><Row0><Sizes/></Row0></Right><Bottom><Row0><Sizes><Wnd3><Rect><Top>-2</Top><Left>-2</Left><Bottom>272</Bottom><Right>1682</Right><x>-2</x><y>-2</y><xscreen>1684</xscreen><yscreen>274</yscreen><sizeHorzCX>1002381</sizeHorzCX><sizeHorzCY>278455</sizeHorzCY><sizeVertCX>113095</sizeVertCX><sizeVertCY>172764</sizeVertCY></Rect></Wnd3></Sizes></Row0></Bottom><Float><Sizes/></Float></Positions>\r
+ <Top><Row0><Sizes><Toolbar-0111A108><key>iaridepm.enu1</key></Toolbar-0111A108></Sizes></Row0></Top><Left><Row0><Sizes><Wnd1><Rect><Top>-2</Top><Left>-2</Left><Bottom>668</Bottom><Right>352</Right><x>-2</x><y>-2</y><xscreen>190</xscreen><yscreen>170</yscreen><sizeHorzCX>113095</sizeHorzCX><sizeHorzCY>172764</sizeHorzCY><sizeVertCX>210714</sizeVertCX><sizeVertCY>680894</sizeVertCY></Rect></Wnd1></Sizes></Row0></Left><Right><Row0><Sizes/></Row0></Right><Bottom><Row0><Sizes><Wnd4><Rect><Top>-2</Top><Left>-2</Left><Bottom>272</Bottom><Right>1682</Right><x>-2</x><y>-2</y><xscreen>1684</xscreen><yscreen>274</yscreen><sizeHorzCX>1002381</sizeHorzCX><sizeHorzCY>278455</sizeHorzCY><sizeVertCX>113095</sizeVertCX><sizeVertCY>172764</sizeVertCY></Rect></Wnd4></Sizes></Row0></Bottom><Float><Sizes/></Float></Positions>\r
</Desktop>\r
</Workspace>\r
\r
\r
static void prvLowPriorityMutexTask( void *pvParameters )\r
{\r
-SemaphoreHandle_t xMutex = ( SemaphoreHandle_t ) pvParameters;\r
+SemaphoreHandle_t xMutex = ( SemaphoreHandle_t ) pvParameters, xLocalMutex;\r
\r
#ifdef USE_STDIO\r
void vPrintDisplayMessage( const char * const * ppcMessageToSend );\r
vPrintDisplayMessage( &pcTaskStartMsg );\r
#endif\r
\r
+ /* The local mutex is used to check the 'mutexs held' count. */\r
+ xLocalMutex = xSemaphoreCreateMutex();\r
+ configASSERT( xLocalMutex );\r
+\r
for( ;; )\r
{\r
/* Take the mutex. It should be available now. */\r
xErrorDetected = pdTRUE;\r
}\r
\r
- /* Set our guarded variable to a known start value. */\r
+ /* Set the guarded variable to a known start value. */\r
ulGuardedVariable = 0;\r
\r
- /* Our priority should be as per that assigned when the task was\r
+ /* This task's priority should be as per that assigned when the task was\r
created. */\r
if( uxTaskPriorityGet( NULL ) != genqMUTEX_LOW_PRIORITY )\r
{\r
taskYIELD();\r
#endif\r
\r
- /* Ensure the task is reporting it priority as blocked and not\r
+ /* Ensure the task is reporting its priority as blocked and not\r
suspended (as it would have done in versions up to V7.5.3). */\r
#if( INCLUDE_eTaskGetState == 1 )\r
{\r
}\r
#endif /* INCLUDE_eTaskGetState */\r
\r
- /* We should now have inherited the prioritoy of the high priority task,\r
+ /* The priority of the high priority task should now have been inherited\r
as by now it will have attempted to get the mutex. */\r
if( uxTaskPriorityGet( NULL ) != genqMUTEX_HIGH_PRIORITY )\r
{\r
xErrorDetected = pdTRUE;\r
}\r
\r
- /* We can attempt to set our priority to the test priority - between the\r
- idle priority and the medium/high test priorities, but our actual\r
- prioroity should remain at the high priority. */\r
+ /* Attempt to set the priority of this task to the test priority -\r
+ between the idle priority and the medium/high test priorities, but the\r
+ actual priority should remain at the high priority. */\r
vTaskPrioritySet( NULL, genqMUTEX_TEST_PRIORITY );\r
if( uxTaskPriorityGet( NULL ) != genqMUTEX_HIGH_PRIORITY )\r
{\r
xErrorDetected = pdTRUE;\r
}\r
\r
- /* Now unsuspend the medium priority task. This should not run as our\r
- inherited priority is above that of the medium priority task. */\r
+ /* Now unsuspend the medium priority task. This should not run as the\r
+ inherited priority of this task is above that of the medium priority\r
+ task. */\r
vTaskResume( xMediumPriorityMutexTask );\r
\r
- /* If the did run then it will have incremented our guarded variable. */\r
+ /* If the medium priority task did run then it will have incremented the \r
+ guarded variable. */\r
if( ulGuardedVariable != 0 )\r
{\r
xErrorDetected = pdTRUE;\r
}\r
\r
- /* When we give back the semaphore our priority should be disinherited\r
- back to the priority to which we attempted to set ourselves. This means\r
- that when the high priority task next blocks, the medium priority task\r
- should execute and increment the guarded variable. When we next run\r
- both the high and medium priority tasks will have been suspended again. */\r
+ /* Take the local mutex too, so two mutexes are now held. */\r
+ if( xSemaphoreTake( xLocalMutex, genqNO_BLOCK ) != pdPASS )\r
+ {\r
+ xErrorDetected = pdTRUE;\r
+ }\r
+\r
+ /* When the semaphore is given back the priority of this task should not\r
+ yet be disinherited because the local mutex is still held. This is a\r
+ simplification to allow FreeRTOS to be integrated with middleware that\r
+ attempts to hold multiple mutexes without bloating the code with complex\r
+ algorithms. It is possible that the high priority mutex task will\r
+ execute as it shares a priority with this task. */\r
if( xSemaphoreGive( xMutex ) != pdPASS )\r
{\r
xErrorDetected = pdTRUE;\r
taskYIELD();\r
#endif\r
\r
- /* Check that the guarded variable did indeed increment... */\r
+ /* The guarded variable is only incremented by the medium priority task,\r
+ which still should not have executed as this task should remain at the\r
+ higher priority, ensure this is the case. */\r
+ if( ulGuardedVariable != 0 )\r
+ {\r
+ xErrorDetected = pdTRUE;\r
+ }\r
+\r
+ if( uxTaskPriorityGet( NULL ) != genqMUTEX_HIGH_PRIORITY )\r
+ {\r
+ xErrorDetected = pdTRUE;\r
+ }\r
+\r
+ /* Now also give back the local mutex, taking the held count back to 0.\r
+ This time the priority of this task should be disinherited back to the\r
+ priority to which it was set while the mutex was held. This means\r
+ the medium priority task should execute and increment the guarded \r
+ variable. When this task next runs both the high and medium priority \r
+ tasks will have been suspended again. */\r
+ if( xSemaphoreGive( xLocalMutex ) != pdPASS )\r
+ {\r
+ xErrorDetected = pdTRUE;\r
+ }\r
+\r
+ #if configUSE_PREEMPTION == 0\r
+ taskYIELD();\r
+ #endif\r
+\r
+ /* Check the guarded variable did indeed increment... */\r
if( ulGuardedVariable != 1 )\r
{\r
xErrorDetected = pdTRUE;\r
}\r
\r
- /* ... and that our priority has been disinherited to\r
+ /* ... and that the priority of this task has been disinherited to\r
genqMUTEX_TEST_PRIORITY. */\r
if( uxTaskPriorityGet( NULL ) != genqMUTEX_TEST_PRIORITY )\r
{\r
xErrorDetected = pdTRUE;\r
}\r
\r
- /* Set our priority back to our original priority ready for the next\r
- loop around this test. */\r
+ /* Set the priority of this task back to its original value, ready for\r
+ the next loop around this test. */\r
vTaskPrioritySet( NULL, genqMUTEX_LOW_PRIORITY );\r
\r
- /* Just to show we are still running. */\r
+ /* Just to show this task is still running. */\r
ulLoopCounter2++;\r
\r
#if configUSE_PREEMPTION == 0\r
xErrorDetected = pdTRUE;\r
}\r
\r
- /* When we eventually obtain the mutex we just give it back then\r
- return to suspend ready for the next test. */\r
+ /* When the mutex is eventually obtained it is just given back before\r
+ returning to suspend ready for the next cycle. */\r
if( xSemaphoreGive( xMutex ) != pdPASS )\r
{\r
xErrorDetected = pdTRUE;\r
/*\r
- FreeRTOS V8.0.1 - Copyright (C) 2014 Real Time Engineers Ltd. \r
+ FreeRTOS V8.0.1 - 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
#define timerNORMALLY_EMPTY_TX() \\r
if( xQueueIsQueueFullFromISR( xNormallyEmptyQueue ) != pdTRUE ) \\r
{ \\r
- UBaseType_t uxSavedInterruptStatus; \\r
+ UBaseType_t uxSavedInterruptStatus; \\r
uxSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR(); \\r
{ \\r
uxValueForNormallyEmptyQueue++; \\r
#define timerNORMALLY_FULL_TX() \\r
if( xQueueIsQueueFullFromISR( xNormallyFullQueue ) != pdTRUE ) \\r
{ \\r
- UBaseType_t uxSavedInterruptStatus; \\r
+ UBaseType_t uxSavedInterruptStatus; \\r
uxSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR(); \\r
{ \\r
uxValueForNormallyFullQueue++; \\r
/*\r
- FreeRTOS V8.0.1 - Copyright (C) 2014 Real Time Engineers Ltd. \r
+ FreeRTOS V8.0.1 - 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
/* Check the auto reload timers can be stopped correctly, and correctly\r
report their state. */\r
prvTest4_CheckAutoReloadTimersCanBeStopped();\r
- \r
+\r
/* Check the one shot timer only calls its callback once after it has been\r
started, and that it reports its state correctly. */\r
prvTest5_CheckBasicOneShotTimerBehaviour();\r
elsewhere. Start counting Iterations again. */\r
xIterationsWithoutCounterIncrement = ( TickType_t ) 0;\r
xLastCycleFrequency = xCycleFrequency;\r
- } \r
+ }\r
\r
/* Calculate the maximum number of times that it is permissible for this\r
function to be called without ulLoopCounter being incremented. This is\r
configASSERT( xTestStatus );\r
}\r
}\r
- \r
+\r
/* Create the timers that are used from the tick interrupt to test the timer\r
API functions that can be called from an ISR. */\r
xISRAutoReloadTimer = xTimerCreate( "ISR AR", /* The text name given to the timer. */\r
pdFALSE, /* This is a one shot timer. */\r
( void * ) NULL, /* The identifier is not required. */\r
prvISROneShotTimerCallback ); /* The callback that is executed when the timer expires. */\r
- \r
+\r
if( ( xISRAutoReloadTimer == NULL ) || ( xISROneShotTimer == NULL ) )\r
{\r
xTestStatus = pdFAIL;\r
\r
/* Check the auto reload timers expire at the expected rates. */\r
\r
- \r
+\r
/* Delaying for configTIMER_QUEUE_LENGTH * xBasePeriod ticks should allow\r
all the auto reload timers to expire at least once. */\r
xBlockPeriod = ( ( TickType_t ) configTIMER_QUEUE_LENGTH ) * xBasePeriod;\r
vTaskDelay( xBlockPeriod );\r
\r
- /* Check that all the auto reload timers have called their callback \r
+ /* Check that all the auto reload timers have called their callback\r
function the expected number of times. */\r
for( ucTimer = 0; ucTimer < ( uint8_t ) configTIMER_QUEUE_LENGTH; ucTimer++ )\r
{\r
by the timer period. */\r
xTimerPeriod = ( ( ( TickType_t ) ucTimer + ( TickType_t ) 1 ) * xBasePeriod );\r
xExpectedNumber = xBlockPeriod / xTimerPeriod;\r
- \r
+\r
ucMaxAllowableValue = ( ( uint8_t ) xExpectedNumber ) ;\r
ucMinAllowableValue = ( uint8_t ) ( ( uint8_t ) xExpectedNumber - ( uint8_t ) 1 ); /* Weird casting to try and please all compilers. */\r
\r
/*-----------------------------------------------------------*/\r
\r
static void prvTest4_CheckAutoReloadTimersCanBeStopped( void )\r
-{ \r
+{\r
uint8_t ucTimer;\r
\r
/* Check the auto reload timers can be stopped correctly, and correctly\r
\r
if( uxTick == 0 )\r
{\r
- /* The timers will have been created, but not started. Start them now \r
+ /* The timers will have been created, but not started. Start them now\r
by setting their period. */\r
ucISRAutoReloadTimerCounter = 0;\r
ucISROneShotTimerCounter = 0;\r
/* First timer was started, try starting the second timer. */\r
if( xTimerChangePeriodFromISR( xISROneShotTimer, xBasePeriod, NULL ) == pdPASS )\r
{\r
- /* Both timers were started, so set the uxTick back to its \r
+ /* Both timers were started, so set the uxTick back to its\r
proper value. */\r
uxTick = 0;\r
}\r
{\r
xTestStatus = pdFAIL;\r
configASSERT( xTestStatus );\r
- } \r
+ }\r
}\r
else if( uxTick == ( ( 2 * xBasePeriod ) + xMargin ) )\r
{\r
xTestStatus = pdFAIL;\r
configASSERT( xTestStatus );\r
}\r
- \r
+\r
if( ucISROneShotTimerCounter != 1 )\r
{\r
xTestStatus = pdFAIL;\r
xTestStatus = pdFAIL;\r
configASSERT( xTestStatus );\r
}\r
- \r
+\r
if( ucISROneShotTimerCounter != 1 )\r
{\r
xTestStatus = pdFAIL;\r
configASSERT( xTestStatus );\r
}\r
- } \r
+ }\r
else if( uxTick == ( 3 * xBasePeriod ) )\r
{\r
/* Start the one shot timer again. */\r
xTestStatus = pdFAIL;\r
configASSERT( xTestStatus );\r
}\r
- \r
+\r
if( ucISROneShotTimerCounter != 1 )\r
{\r
xTestStatus = pdFAIL;\r
configASSERT( xTestStatus );\r
}\r
- \r
+\r
/* Now stop the auto reload timer. The one shot timer was started\r
a few ticks ago. */\r
xTimerStopFromISR( xISRAutoReloadTimer, NULL );\r
- } \r
+ }\r
else if( uxTick == ( 4 * ( xBasePeriod - xMargin ) ) )\r
{\r
/* The auto reload timer is now stopped, and the one shot timer is\r
xTestStatus = pdFAIL;\r
configASSERT( xTestStatus );\r
}\r
- \r
+\r
if( ucISROneShotTimerCounter != 1 )\r
{\r
xTestStatus = pdFAIL;\r
configASSERT( xTestStatus );\r
}\r
- } \r
+ }\r
else if( uxTick == ( ( 4 * xBasePeriod ) + xMargin ) )\r
{\r
/* The auto reload timer is now stopped, and the one shot timer is\r
xTestStatus = pdFAIL;\r
configASSERT( xTestStatus );\r
}\r
- \r
+\r
if( ucISROneShotTimerCounter != 2 )\r
{\r
xTestStatus = pdFAIL;\r
configASSERT( xTestStatus );\r
}\r
- } \r
+ }\r
else if( uxTick == ( 8 * xBasePeriod ) )\r
{\r
/* The auto reload timer is now stopped, and the one shot timer has\r
xTestStatus = pdFAIL;\r
configASSERT( xTestStatus );\r
}\r
- \r
+\r
if( ucISROneShotTimerCounter != 2 )\r
{\r
xTestStatus = pdFAIL;\r
configASSERT( xTestStatus );\r
}\r
- \r
+\r
/* Now reset the one shot timer. */\r
xTimerResetFromISR( xISROneShotTimer, NULL );\r
- } \r
+ }\r
else if( uxTick == ( ( 9 * xBasePeriod ) - xMargin ) )\r
{\r
/* Only the one shot timer should be running, but it should not have\r
xTestStatus = pdFAIL;\r
configASSERT( xTestStatus );\r
}\r
- \r
+\r
if( ucISROneShotTimerCounter != 2 )\r
{\r
xTestStatus = pdFAIL;\r
configASSERT( xTestStatus );\r
}\r
- \r
+\r
xTimerResetFromISR( xISROneShotTimer, NULL );\r
- } \r
+ }\r
else if( uxTick == ( ( 10 * xBasePeriod ) - ( 2 * xMargin ) ) )\r
{\r
/* Only the one shot timer should be running, but it should not have\r
xTestStatus = pdFAIL;\r
configASSERT( xTestStatus );\r
}\r
- \r
+\r
if( ucISROneShotTimerCounter != 2 )\r
{\r
xTestStatus = pdFAIL;\r
configASSERT( xTestStatus );\r
}\r
- \r
+\r
xTimerResetFromISR( xISROneShotTimer, NULL );\r
}\r
else if( uxTick == ( ( 11 * xBasePeriod ) - ( 3 * xMargin ) ) )\r
xTestStatus = pdFAIL;\r
configASSERT( xTestStatus );\r
}\r
- \r
+\r
if( ucISROneShotTimerCounter != 2 )\r
{\r
xTestStatus = pdFAIL;\r
configASSERT( xTestStatus );\r
}\r
- \r
+\r
xTimerResetFromISR( xISROneShotTimer, NULL );\r
- } \r
+ }\r
else if( uxTick == ( ( 12 * xBasePeriod ) - ( 2 * xMargin ) ) )\r
{\r
/* Only the one shot timer should have been running and this time it\r
xTestStatus = pdFAIL;\r
configASSERT( xTestStatus );\r
}\r
- \r
+\r
if( ucISROneShotTimerCounter != 3 )\r
{\r
xTestStatus = pdFAIL;\r
xTestStatus = pdFAIL;\r
configASSERT( xTestStatus );\r
}\r
- \r
+\r
if( ucISROneShotTimerCounter != 3 )\r
{\r
xTestStatus = pdFAIL;\r
configASSERT( xTestStatus );\r
}\r
- \r
+\r
uxTick = ( TickType_t ) -1;\r
- } \r
+ }\r
}\r
/*-----------------------------------------------------------*/\r
\r
/*\r
- FreeRTOS V8.0.1 - Copyright (C) 2014 Real Time Engineers Ltd. \r
+ FreeRTOS V8.0.1 - 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
- * Creates eight tasks, each of which loops continuously performing a floating \r
+ * Creates eight tasks, each of which loops continuously performing a floating\r
* point calculation.\r
*\r
* All the tasks run at the idle priority and never block or yield. This causes\r
- * all eight tasks to time slice with the idle task. Running at the idle \r
- * priority means that these tasks will get pre-empted any time another task is \r
- * ready to run or a time slice occurs. More often than not the pre-emption \r
- * will occur mid calculation, creating a good test of the schedulers context \r
- * switch mechanism - a calculation producing an unexpected result could be a \r
+ * all eight tasks to time slice with the idle task. Running at the idle\r
+ * priority means that these tasks will get pre-empted any time another task is\r
+ * ready to run or a time slice occurs. More often than not the pre-emption\r
+ * will occur mid calculation, creating a good test of the schedulers context\r
+ * switch mechanism - a calculation producing an unexpected result could be a\r
* symptom of a corruption in the context of a task.\r
*/\r
\r
usTaskCheck[ xTask ] = pdFALSE;\r
}\r
}\r
- \r
+\r
return xReturn;\r
}\r
\r
/* Misc. */\r
#define recmuSHORT_DELAY ( 20 / portTICK_PERIOD_MS )\r
#define recmuNO_DELAY ( ( TickType_t ) 0 )\r
-#define recmuFIVE_TICK_DELAY ( ( TickType_t ) 5 )\r
+#define recmuEIGHT_TICK_DELAY ( ( TickType_t ) 8 )\r
\r
/* The three tasks as described at the top of this file. */\r
static void prvRecursiveMutexControllingTask( void *pvParameters );\r
long enough to ensure the polling task will execute again before the\r
block time expires. If the block time does expire then the error\r
flag will be set here. */\r
- if( xSemaphoreTakeRecursive( xMutex, recmuFIVE_TICK_DELAY ) != pdPASS )\r
+ if( xSemaphoreTakeRecursive( xMutex, recmuEIGHT_TICK_DELAY ) != pdPASS )\r
{\r
xErrorOccurred = pdTRUE;\r
}\r