diff --git a/flight/PiOS/STM32F10x/Libraries/FreeRTOS/Source/croutine.c b/flight/PiOS/STM32F10x/Libraries/FreeRTOS/Source/croutine.c old mode 100644 new mode 100755 index 2521ff97f..f180a8774 --- a/flight/PiOS/STM32F10x/Libraries/FreeRTOS/Source/croutine.c +++ b/flight/PiOS/STM32F10x/Libraries/FreeRTOS/Source/croutine.c @@ -1,5 +1,5 @@ /* - FreeRTOS V6.0.0 - Copyright (C) 2009 Real Time Engineers Ltd. + FreeRTOS V6.1.1 - Copyright (C) 2011 Real Time Engineers Ltd. *************************************************************************** * * @@ -10,7 +10,7 @@ * + Looking for basic training, * * + Wanting to improve your FreeRTOS skills and productivity * * * - * then take a look at the FreeRTOS eBook * + * then take a look at the FreeRTOS books - available as PDF or paperback * * * * "Using the FreeRTOS Real Time Kernel - a Practical Guide" * * http://www.FreeRTOS.org/Documentation * @@ -55,15 +55,6 @@ #include "task.h" #include "croutine.h" -/** - * @file croutine.c - * @author FreeRTOS - * @addtogroup PIOS PIOS Core hardware abstraction layer - * @{ - * @addtogroup FreeRTOS FreeRTOS Operating system - * @{ - */ - /* * Some kernel aware debuggers require data to be viewed to be global, rather * than file scope. diff --git a/flight/PiOS/STM32F10x/Libraries/FreeRTOS/Source/include/FreeRTOS.h b/flight/PiOS/STM32F10x/Libraries/FreeRTOS/Source/include/FreeRTOS.h old mode 100644 new mode 100755 index 1ad821d92..f440a16d1 --- a/flight/PiOS/STM32F10x/Libraries/FreeRTOS/Source/include/FreeRTOS.h +++ b/flight/PiOS/STM32F10x/Libraries/FreeRTOS/Source/include/FreeRTOS.h @@ -1,5 +1,5 @@ /* - FreeRTOS V6.0.0 - Copyright (C) 2009 Real Time Engineers Ltd. + FreeRTOS V6.1.1 - Copyright (C) 2011 Real Time Engineers Ltd. *************************************************************************** * * @@ -10,7 +10,7 @@ * + Looking for basic training, * * + Wanting to improve your FreeRTOS skills and productivity * * * - * then take a look at the FreeRTOS eBook * + * then take a look at the FreeRTOS books - available as PDF or paperback * * * * "Using the FreeRTOS Real Time Kernel - a Practical Guide" * * http://www.FreeRTOS.org/Documentation * @@ -33,9 +33,9 @@ FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - more details. You should have received a copy of the GNU General Public - License and the FreeRTOS license exception along with FreeRTOS; if not it - can be viewed here: http://www.freertos.org/a00114.html and also obtained + more details. You should have received a copy of the GNU General Public + License and the FreeRTOS license exception along with FreeRTOS; if not it + can be viewed here: http://www.freertos.org/a00114.html and also obtained by writing to Richard Barry, contact details for whom are available on the FreeRTOS WEB site. @@ -54,14 +54,6 @@ #ifndef INC_FREERTOS_H #define INC_FREERTOS_H -/** - * @file FreeRTOS.h - * @author FreeRTOS - * @addtogroup PIOS PIOS Core hardware abstraction layer - * @{ - * @addtogroup FreeRTOS FreeRTOS Operating system - * @{ - */ /* * Include the generic headers required for the FreeRTOS port being used. @@ -247,17 +239,17 @@ typedef portBASE_TYPE (*pdTASK_HOOK_CODE)( void * ); #endif #ifndef traceBLOCKING_ON_QUEUE_RECEIVE - /* Task is about to block because it cannot read from a + /* Task is about to block because it cannot read from a queue/mutex/semaphore. pxQueue is a pointer to the queue/mutex/semaphore - upon which the read was attempted. pxCurrentTCB points to the TCB of the + upon which the read was attempted. pxCurrentTCB points to the TCB of the task that attempted the read. */ #define traceBLOCKING_ON_QUEUE_RECEIVE( pxQueue ) #endif #ifndef traceBLOCKING_ON_QUEUE_SEND - /* Task is about to block because it cannot write to a + /* Task is about to block because it cannot write to a queue/mutex/semaphore. pxQueue is a pointer to the queue/mutex/semaphore - upon which the write was attempted. pxCurrentTCB points to the TCB of the + upon which the write was attempted. pxCurrentTCB points to the TCB of the task that attempted the write. */ #define traceBLOCKING_ON_QUEUE_SEND( pxQueue ) #endif @@ -296,6 +288,10 @@ typedef portBASE_TYPE (*pdTASK_HOOK_CODE)( void * ); #define traceTAKE_MUTEX_RECURSIVE( pxMutex ) #endif +#ifndef traceTAKE_MUTEX_RECURSIVE_FAILED + #define traceTAKE_MUTEX_RECURSIVE_FAILED( pxMutex ) +#endif + #ifndef traceCREATE_COUNTING_SEMAPHORE #define traceCREATE_COUNTING_SEMAPHORE() #endif @@ -349,7 +345,7 @@ typedef portBASE_TYPE (*pdTASK_HOOK_CODE)( void * ); #endif #ifndef traceTASK_CREATE_FAILED - #define traceTASK_CREATE_FAILED( pxNewTCB ) + #define traceTASK_CREATE_FAILED() #endif #ifndef traceTASK_DELETE @@ -395,7 +391,9 @@ typedef portBASE_TYPE (*pdTASK_HOOK_CODE)( void * ); #endif /* portCONFIGURE_TIMER_FOR_RUN_TIME_STATS */ #ifndef portGET_RUN_TIME_COUNTER_VALUE - #error If configGENERATE_RUN_TIME_STATS is defined then portGET_RUN_TIME_COUNTER_VALUE must also be defined. portGET_RUN_TIME_COUNTER_VALUE should evaluate to the counter value of the timer/counter peripheral used as the run time counter time base. + #ifndef portALT_GET_RUN_TIME_COUNTER_VALUE + #error If configGENERATE_RUN_TIME_STATS is defined then either portGET_RUN_TIME_COUNTER_VALUE or portALT_GET_RUN_TIME_COUNTER_VALUE must also be defined. See the examples provided and the FreeRTOS web site for more information. + #endif /* portALT_GET_RUN_TIME_COUNTER_VALUE */ #endif /* portGET_RUN_TIME_COUNTER_VALUE */ #endif /* configGENERATE_RUN_TIME_STATS */ @@ -417,7 +415,7 @@ typedef portBASE_TYPE (*pdTASK_HOOK_CODE)( void * ); #endif #ifndef pvPortMallocAligned - #define pvPortMallocAligned( xSize, pvBuffer ) pvPortMalloc( xSize ); ( void ) pvBuffer + #define pvPortMallocAligned( x, puxStackBuffer ) ( ( puxStackBuffer == NULL ) ? ( pvPortMalloc( x ) ) : ( puxStackBuffer ) ) #endif #ifndef vPortFreeAligned diff --git a/flight/PiOS/STM32F10x/Libraries/FreeRTOS/Source/include/StackMacros.h b/flight/PiOS/STM32F10x/Libraries/FreeRTOS/Source/include/StackMacros.h old mode 100644 new mode 100755 index 255e57870..00645e895 --- a/flight/PiOS/STM32F10x/Libraries/FreeRTOS/Source/include/StackMacros.h +++ b/flight/PiOS/STM32F10x/Libraries/FreeRTOS/Source/include/StackMacros.h @@ -1,14 +1,5 @@ -/** - * @addtogroup PIOS PIOS Core hardware abstraction layer - * @{ - * @addtogroup FreeRTOS FreeRTOS Operating system - * @{ - * @file StackMacros.h - * @author FreeRTOS - */ - /* - FreeRTOS V6.0.0 - Copyright (C) 2009 Real Time Engineers Ltd. + FreeRTOS V6.1.1 - Copyright (C) 2011 Real Time Engineers Ltd. *************************************************************************** * * @@ -19,7 +10,7 @@ * + Looking for basic training, * * + Wanting to improve your FreeRTOS skills and productivity * * * - * then take a look at the FreeRTOS eBook * + * then take a look at the FreeRTOS books - available as PDF or paperback * * * * "Using the FreeRTOS Real Time Kernel - a Practical Guide" * * http://www.FreeRTOS.org/Documentation * @@ -42,9 +33,9 @@ FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - more details. You should have received a copy of the GNU General Public - License and the FreeRTOS license exception along with FreeRTOS; if not it - can be viewed here: http://www.freertos.org/a00114.html and also obtained + more details. You should have received a copy of the GNU General Public + License and the FreeRTOS license exception along with FreeRTOS; if not it + can be viewed here: http://www.freertos.org/a00114.html and also obtained by writing to Richard Barry, contact details for whom are available on the FreeRTOS WEB site. @@ -72,7 +63,7 @@ * the current stack state only - comparing the current top of stack value to * the stack limit. Setting configCHECK_FOR_STACK_OVERFLOW to greater than 1 * will also cause the last few stack bytes to be checked to ensure the value - * to which the bytes were set when the task was created have not been + * to which the bytes were set when the task was created have not been * overwritten. Note this second test does not guarantee that an overflowed * stack will always be recognised. */ @@ -102,7 +93,7 @@ /* Only the current stack state is to be checked. */ #define taskFIRST_CHECK_FOR_STACK_OVERFLOW() \ { \ - extern void vApplicationStackOverflowHook( xTaskHandle *pxTask, signed char *pcTaskName ); \ + extern void vApplicationStackOverflowHook( xTaskHandle *pxTask, signed char *pcTaskName ); \ \ /* Is the currently saved stack pointer within the stack limit? */ \ if( pxCurrentTCB->pxTopOfStack <= pxCurrentTCB->pxStack ) \ @@ -111,7 +102,7 @@ } \ } -#endif /* configCHECK_FOR_STACK_OVERFLOW == 1 */ +#endif /* configCHECK_FOR_STACK_OVERFLOW > 0 */ /*-----------------------------------------------------------*/ #if( ( configCHECK_FOR_STACK_OVERFLOW > 0 ) && ( portSTACK_GROWTH > 0 ) ) @@ -119,7 +110,7 @@ /* Only the current stack state is to be checked. */ #define taskFIRST_CHECK_FOR_STACK_OVERFLOW() \ { \ - extern void vApplicationStackOverflowHook( xTaskHandle *pxTask, signed char *pcTaskName ); \ + extern void vApplicationStackOverflowHook( xTaskHandle *pxTask, signed char *pcTaskName ); \ \ /* Is the currently saved stack pointer within the stack limit? */ \ if( pxCurrentTCB->pxTopOfStack >= pxCurrentTCB->pxEndOfStack ) \ @@ -135,8 +126,8 @@ #define taskSECOND_CHECK_FOR_STACK_OVERFLOW() \ { \ - extern void vApplicationStackOverflowHook( xTaskHandle *pxTask, signed char *pcTaskName ); \ - static const unsigned char ucExpectedStackBytes[] = { tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \ + extern void vApplicationStackOverflowHook( xTaskHandle *pxTask, signed char *pcTaskName ); \ + static const unsigned char ucExpectedStackBytes[] = { tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \ tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \ tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \ tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \ @@ -157,9 +148,9 @@ #define taskSECOND_CHECK_FOR_STACK_OVERFLOW() \ { \ - extern void vApplicationStackOverflowHook( xTaskHandle *pxTask, signed char *pcTaskName ); \ - char *pcEndOfStack = ( char * ) pxCurrentTCB->pxEndOfStack; \ - static const unsigned char ucExpectedStackBytes[] = { tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \ + extern void vApplicationStackOverflowHook( xTaskHandle *pxTask, signed char *pcTaskName ); \ + char *pcEndOfStack = ( char * ) pxCurrentTCB->pxEndOfStack; \ + static const unsigned char ucExpectedStackBytes[] = { tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \ tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \ tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \ tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \ diff --git a/flight/PiOS/STM32F10x/Libraries/FreeRTOS/Source/include/croutine.h b/flight/PiOS/STM32F10x/Libraries/FreeRTOS/Source/include/croutine.h old mode 100644 new mode 100755 index a6d3f0ddd..64c64a754 --- a/flight/PiOS/STM32F10x/Libraries/FreeRTOS/Source/include/croutine.h +++ b/flight/PiOS/STM32F10x/Libraries/FreeRTOS/Source/include/croutine.h @@ -1,5 +1,5 @@ /* - FreeRTOS V6.0.0 - Copyright (C) 2009 Real Time Engineers Ltd. + FreeRTOS V6.1.1 - Copyright (C) 2011 Real Time Engineers Ltd. *************************************************************************** * * @@ -10,7 +10,7 @@ * + Looking for basic training, * * + Wanting to improve your FreeRTOS skills and productivity * * * - * then take a look at the FreeRTOS eBook * + * then take a look at the FreeRTOS books - available as PDF or paperback * * * * "Using the FreeRTOS Real Time Kernel - a Practical Guide" * * http://www.FreeRTOS.org/Documentation * @@ -52,17 +52,10 @@ */ #ifndef INC_FREERTOS_H - #error "#include FreeRTOS.h" must appear in source files before "#include croutine.h" + #error "include FreeRTOS.h must appear in source files before include croutine.h" #endif -/** - * @file croutine.h - * @author FreeRTOS - * @addtogroup PIOS PIOS Core hardware abstraction layer - * @{ - * @addtogroup FreeRTOS FreeRTOS Operating system - * @{ - */ + #ifndef CO_ROUTINE_H @@ -126,7 +119,7 @@ typedef struct corCoRoutineControlBlock // Variables in co-routines must be declared static if they must maintain value across a blocking call. // This may not be necessary for const variables. static const char cLedToFlash[ 2 ] = { 5, 6 }; - static const portTickType xTimeToDelay[ 2 ] = { 200, 400 }; + static const portTickType uxFlashRates[ 2 ] = { 200, 400 }; // Must start every co-routine with a call to crSTART(); crSTART( xHandle ); diff --git a/flight/PiOS/STM32F10x/Libraries/FreeRTOS/Source/include/list.h b/flight/PiOS/STM32F10x/Libraries/FreeRTOS/Source/include/list.h old mode 100644 new mode 100755 index b337ec22d..5a09fd1d6 --- a/flight/PiOS/STM32F10x/Libraries/FreeRTOS/Source/include/list.h +++ b/flight/PiOS/STM32F10x/Libraries/FreeRTOS/Source/include/list.h @@ -1,5 +1,5 @@ /* - FreeRTOS V6.0.0 - Copyright (C) 2009 Real Time Engineers Ltd. + FreeRTOS V6.1.1 - Copyright (C) 2011 Real Time Engineers Ltd. *************************************************************************** * * @@ -10,7 +10,7 @@ * + Looking for basic training, * * + Wanting to improve your FreeRTOS skills and productivity * * * - * then take a look at the FreeRTOS eBook * + * then take a look at the FreeRTOS books - available as PDF or paperback * * * * "Using the FreeRTOS Real Time Kernel - a Practical Guide" * * http://www.FreeRTOS.org/Documentation * diff --git a/flight/PiOS/STM32F10x/Libraries/FreeRTOS/Source/include/mpu_wrappers.h b/flight/PiOS/STM32F10x/Libraries/FreeRTOS/Source/include/mpu_wrappers.h old mode 100644 new mode 100755 index 6f13f5af3..6f5287fd2 --- a/flight/PiOS/STM32F10x/Libraries/FreeRTOS/Source/include/mpu_wrappers.h +++ b/flight/PiOS/STM32F10x/Libraries/FreeRTOS/Source/include/mpu_wrappers.h @@ -1,5 +1,5 @@ /* - FreeRTOS V6.0.0 - Copyright (C) 2009 Real Time Engineers Ltd. + FreeRTOS V6.1.1 - Copyright (C) 2011 Real Time Engineers Ltd. *************************************************************************** * * @@ -10,7 +10,7 @@ * + Looking for basic training, * * + Wanting to improve your FreeRTOS skills and productivity * * * - * then take a look at the FreeRTOS eBook * + * then take a look at the FreeRTOS books - available as PDF or paperback * * * * "Using the FreeRTOS Real Time Kernel - a Practical Guide" * * http://www.FreeRTOS.org/Documentation * @@ -59,7 +59,7 @@ only for ports that are using the MPU. */ #ifdef portUSING_MPU_WRAPPERS /* MPU_WRAPPERS_INCLUDED_FROM_API_FILE will be defined when this file is - included from queue.c or task.c to prevent it from having an effict within + included from queue.c or task.c to prevent it from having an effect within those files. */ #ifndef MPU_WRAPPERS_INCLUDED_FROM_API_FILE diff --git a/flight/PiOS/STM32F10x/Libraries/FreeRTOS/Source/include/portable.h b/flight/PiOS/STM32F10x/Libraries/FreeRTOS/Source/include/portable.h old mode 100644 new mode 100755 index 5ec907c4a..b4f37f336 --- a/flight/PiOS/STM32F10x/Libraries/FreeRTOS/Source/include/portable.h +++ b/flight/PiOS/STM32F10x/Libraries/FreeRTOS/Source/include/portable.h @@ -1,14 +1,5 @@ -/** - * @addtogroup PIOS PIOS Core hardware abstraction layer - * @{ - * @addtogroup FreeRTOS FreeRTOS Operating system - * @{ - * @file portable.h - * @author FreeRTOS - */ - /* - FreeRTOS V6.0.0 - Copyright (C) 2009 Real Time Engineers Ltd. + FreeRTOS V6.1.1 - Copyright (C) 2011 Real Time Engineers Ltd. *************************************************************************** * * @@ -19,7 +10,7 @@ * + Looking for basic training, * * + Wanting to improve your FreeRTOS skills and productivity * * * - * then take a look at the FreeRTOS eBook * + * then take a look at the FreeRTOS books - available as PDF or paperback * * * * "Using the FreeRTOS Real Time Kernel - a Practical Guide" * * http://www.FreeRTOS.org/Documentation * @@ -67,7 +58,6 @@ #ifndef PORTABLE_H #define PORTABLE_H - /* Include the macro file relevant to the port being used. */ #ifdef OPEN_WATCOM_INDUSTRIAL_PC_PORT diff --git a/flight/PiOS/STM32F10x/Libraries/FreeRTOS/Source/include/projdefs.h b/flight/PiOS/STM32F10x/Libraries/FreeRTOS/Source/include/projdefs.h old mode 100644 new mode 100755 index 05a1fd41e..d00d6195d --- a/flight/PiOS/STM32F10x/Libraries/FreeRTOS/Source/include/projdefs.h +++ b/flight/PiOS/STM32F10x/Libraries/FreeRTOS/Source/include/projdefs.h @@ -1,5 +1,5 @@ /* - FreeRTOS V6.0.0 - Copyright (C) 2009 Real Time Engineers Ltd. + FreeRTOS V6.1.1 - Copyright (C) 2011 Real Time Engineers Ltd. *************************************************************************** * * @@ -10,7 +10,7 @@ * + Looking for basic training, * * + Wanting to improve your FreeRTOS skills and productivity * * * - * then take a look at the FreeRTOS eBook * + * then take a look at the FreeRTOS books - available as PDF or paperback * * * * "Using the FreeRTOS Real Time Kernel - a Practical Guide" * * http://www.FreeRTOS.org/Documentation * diff --git a/flight/PiOS/STM32F10x/Libraries/FreeRTOS/Source/include/queue.h b/flight/PiOS/STM32F10x/Libraries/FreeRTOS/Source/include/queue.h old mode 100644 new mode 100755 index b8c6e43ef..53790f676 --- a/flight/PiOS/STM32F10x/Libraries/FreeRTOS/Source/include/queue.h +++ b/flight/PiOS/STM32F10x/Libraries/FreeRTOS/Source/include/queue.h @@ -1,14 +1,5 @@ -/** - * @addtogroup PIOS PIOS Core hardware abstraction layer - * @{ - * @addtogroup FreeRTOS FreeRTOS Operating system - * @{ - * @file queue.h - * @author FreeRTOS - */ - /* - FreeRTOS V6.0.0 - Copyright (C) 2009 Real Time Engineers Ltd. + FreeRTOS V6.1.1 - Copyright (C) 2011 Real Time Engineers Ltd. *************************************************************************** * * @@ -19,7 +10,7 @@ * + Looking for basic training, * * + Wanting to improve your FreeRTOS skills and productivity * * * - * then take a look at the FreeRTOS eBook * + * then take a look at the FreeRTOS books - available as PDF or paperback * * * * "Using the FreeRTOS Real Time Kernel - a Practical Guide" * * http://www.FreeRTOS.org/Documentation * @@ -65,6 +56,8 @@ #endif + + #ifndef QUEUE_H #define QUEUE_H diff --git a/flight/PiOS/STM32F10x/Libraries/FreeRTOS/Source/include/semphr.h b/flight/PiOS/STM32F10x/Libraries/FreeRTOS/Source/include/semphr.h old mode 100644 new mode 100755 index 87b71b4b8..8674096ad --- a/flight/PiOS/STM32F10x/Libraries/FreeRTOS/Source/include/semphr.h +++ b/flight/PiOS/STM32F10x/Libraries/FreeRTOS/Source/include/semphr.h @@ -1,14 +1,5 @@ -/** - * @addtogroup PIOS PIOS Core hardware abstraction layer - * @{ - * @addtogroup FreeRTOS FreeRTOS Operating system - * @{ - * @file tasks.c - * @author FreeRTOS - */ - /* - FreeRTOS V6.0.0 - Copyright (C) 2009 Real Time Engineers Ltd. + FreeRTOS V6.1.1 - Copyright (C) 2011 Real Time Engineers Ltd. *************************************************************************** * * @@ -19,7 +10,7 @@ * + Looking for basic training, * * + Wanting to improve your FreeRTOS skills and productivity * * * - * then take a look at the FreeRTOS eBook * + * then take a look at the FreeRTOS books - available as PDF or paperback * * * * "Using the FreeRTOS Real Time Kernel - a Practical Guide" * * http://www.FreeRTOS.org/Documentation * @@ -67,8 +58,6 @@ #ifndef SEMAPHORE_H #define SEMAPHORE_H - - #include "queue.h" typedef xQueueHandle xSemaphoreHandle; @@ -126,7 +115,7 @@ typedef xQueueHandle xSemaphoreHandle; /** * semphr. h - * xSemaphoreTake( + *
xSemaphoreTake( 
  *                   xSemaphoreHandle xSemaphore, 
  *                   portTickType xBlockTime 
  *               )
@@ -465,7 +454,7 @@ typedef xQueueHandle xSemaphoreHandle; *
  xSemaphoreGiveFromISR( 
                           xSemaphoreHandle xSemaphore, 
-                          portBASE_TYPE *pxHigherPriorityTaskWoken
+                          signed portBASE_TYPE *pxHigherPriorityTaskWoken
                       )
* * Macro to release a semaphore. The semaphore must have previously been @@ -489,8 +478,8 @@ typedef xQueueHandle xSemaphoreHandle; * * Example usage:
- #define LONG_TIME 0xffff
- #define TICKS_TO_WAIT	10
+ \#define LONG_TIME 0xffff
+ \#define TICKS_TO_WAIT	10
  xSemaphoreHandle xSemaphore = NULL;
 
  // Repetitive task.
@@ -520,7 +509,7 @@ typedef xQueueHandle xSemaphoreHandle;
  void vTimerISR( void * pvParameters )
  {
  static unsigned char ucLocalTickCount = 0;
- static portBASE_TYPE xHigherPriorityTaskWoken;
+ static signed portBASE_TYPE xHigherPriorityTaskWoken;
 
     // A timer tick has occurred.
 
@@ -720,7 +709,3 @@ typedef xQueueHandle xSemaphoreHandle;
 #endif /* SEMAPHORE_H */
 
 
-/**
-  * @}
-  * @}
-  */
\ No newline at end of file
diff --git a/flight/PiOS/STM32F10x/Libraries/FreeRTOS/Source/include/task.h b/flight/PiOS/STM32F10x/Libraries/FreeRTOS/Source/include/task.h
old mode 100644
new mode 100755
index 753ac3f76..1f29ef46f
--- a/flight/PiOS/STM32F10x/Libraries/FreeRTOS/Source/include/task.h
+++ b/flight/PiOS/STM32F10x/Libraries/FreeRTOS/Source/include/task.h
@@ -1,5 +1,5 @@
 /*
-    FreeRTOS V6.0.0 - Copyright (C) 2009 Real Time Engineers Ltd.
+    FreeRTOS V6.1.1 - Copyright (C) 2011 Real Time Engineers Ltd.
 
     ***************************************************************************
     *                                                                         *
@@ -10,7 +10,7 @@
     *    + Looking for basic training,                                        *
     *    + Wanting to improve your FreeRTOS skills and productivity           *
     *                                                                         *
-    * then take a look at the FreeRTOS eBook                                  *
+    * then take a look at the FreeRTOS books - available as PDF or paperback  *
     *                                                                         *
     *        "Using the FreeRTOS Real Time Kernel - a Practical Guide"        *
     *                  http://www.FreeRTOS.org/Documentation                  *
@@ -33,9 +33,9 @@
     FreeRTOS is distributed in the hope that it will be useful, but WITHOUT
     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
-    more details. You should have received a copy of the GNU General Public 
-    License and the FreeRTOS license exception along with FreeRTOS; if not it 
-    can be viewed here: http://www.freertos.org/a00114.html and also obtained 
+    more details. You should have received a copy of the GNU General Public
+    License and the FreeRTOS license exception along with FreeRTOS; if not it
+    can be viewed here: http://www.freertos.org/a00114.html and also obtained
     by writing to Richard Barry, contact details for whom are available on the
     FreeRTOS WEB site.
 
@@ -53,16 +53,9 @@
 
 
 #ifndef INC_FREERTOS_H
-	#error "#include FreeRTOS.h" must appear in source files before "#include task.h"
+	#error "include FreeRTOS.h must appear in source files before include task.h"
 #endif
 
-/**
- * @author FreeRTOS
- * @addtogroup PIOS PIOS Core hardware abstraction layer
- * @{
- * @addtogroup FreeRTOS FreeRTOS Operating system
- * @{
- */
 
 
 #ifndef TASK_H
@@ -79,7 +72,7 @@ extern "C" {
  * MACROS AND DEFINITIONS
  *----------------------------------------------------------*/
 
-#define tskKERNEL_VERSION_NUMBER "V6.0.0"
+#define tskKERNEL_VERSION_NUMBER "V6.1.1"
 
 /**
  * task. h
@@ -213,10 +206,10 @@ typedef struct xTASK_PARAMTERS
 						  );
* * Create a new task and add it to the list of tasks that are ready to run. - * + * * xTaskCreate() can only be used to create a task that has unrestricted * access to the entire microcontroller memory map. Systems that include MPU - * support can alternatively create an MPU constrained task using + * support can alternatively create an MPU constrained task using * xTaskCreateRestricted(). * * @param pvTaskCode Pointer to the task entry function. Tasks @@ -281,7 +274,7 @@ typedef struct xTASK_PARAMTERS /** * task. h *
- portBASE_TYPE xTaskCreateRestricted( xTaskParameters *pxTaskDefinition, xTaskHandle pxCreatedTask );
+ portBASE_TYPE xTaskCreateRestricted( xTaskParameters *pxTaskDefinition, xTaskHandle *pxCreatedTask ); * * xTaskCreateRestricted() should only be used in systems that include an MPU * implementation. @@ -292,13 +285,9 @@ typedef struct xTASK_PARAMTERS * * @param pxTaskDefinition Pointer to a structure that contains a member * for each of the normal xTaskCreate() parameters (see the xTaskCreate() API - * documentation) plus an optional stack buffer and the memory region + * documentation) plus an optional stack buffer and the memory region * definitions. * - * @param pcName A descriptive name for the task. This is mainly used to - * facilitate debugging. Max length defined by tskMAX_TASK_NAME_LEN - default - * is 16. - * * @param pxCreatedTask Used to pass back a handle by which the created task * can be referenced. * @@ -359,7 +348,7 @@ xTaskHandle xHandle; * Memory regions are assigned to a restricted task when the task is created by * a call to xTaskCreateRestricted(). These regions can be redefined using * vTaskAllocateMPURegions(). - * + * * @param xTask The handle of the task being updated. * * @param xRegions A pointer to an xMemoryRegion structure that contains the @@ -382,7 +371,7 @@ static const xMemoryRegion xAltRegions[ portNUM_CONFIGURABLE_REGIONS ] = void vATask( void *pvParameters ) { // This task was created such that it has access to certain regions of - // memory as defined by the MPU configuration. At some point it is + // memory as defined by the MPU configuration. At some point it is // desired that these MPU regions are replaced with that defined in the // xAltRegions const struct above. Use a call to vTaskAllocateMPURegions() // for this purpose. NULL is used as the task handle to indicate that this @@ -974,7 +963,7 @@ signed portBASE_TYPE xTaskIsTaskSuspended( xTaskHandle xTask ) PRIVILEGED_FUNCTI /** * task. h - *
volatile portTickType xTaskGetTickCount( void );
+ *
portTickType xTaskGetTickCount( void );
* * @return The count of ticks since vTaskStartScheduler was called. * @@ -983,6 +972,22 @@ signed portBASE_TYPE xTaskIsTaskSuspended( xTaskHandle xTask ) PRIVILEGED_FUNCTI */ portTickType xTaskGetTickCount( void ) PRIVILEGED_FUNCTION; +/** + * task. h + *
portTickType xTaskGetTickCountFromISR( void );
+ * + * @return The count of ticks since vTaskStartScheduler was called. + * + * This is a version of xTaskGetTickCount() that is safe to be called from an + * ISR - provided that portTickType is the natural word size of the + * microcontroller being used or interrupt nesting is either not supported or + * not being used. + * + * \page xTaskGetTickCount xTaskGetTickCount + * \ingroup TaskUtils + */ +portTickType xTaskGetTickCountFromISR( void ) PRIVILEGED_FUNCTION; + /** * task. h *
unsigned short uxTaskGetNumberOfTasks( void );
@@ -1097,9 +1102,9 @@ unsigned long ulTaskEndTrace( void ) PRIVILEGED_FUNCTION; * this function to be available. * * Returns the high water mark of the stack associated with xTask. That is, - * the minimum free stack space there has been (in bytes) since the task - * started. The smaller the returned number the closer the task has come - * to overflowing its stack. + * the minimum free stack space there has been (in words, so on a 32 bit machine + * a value of 1 means 4 bytes) since the task started. The smaller the returned + * number the closer the task has come to overflowing its stack. * * @param xTask Handle of the task associated with the stack to be checked. * Set xTask to NULL to check the stack of the calling task. @@ -1109,23 +1114,33 @@ unsigned long ulTaskEndTrace( void ) PRIVILEGED_FUNCTION; */ unsigned portBASE_TYPE uxTaskGetStackHighWaterMark( xTaskHandle xTask ) PRIVILEGED_FUNCTION; -/** - * task.h - *
void vTaskSetApplicationTaskTag( xTaskHandle xTask, pdTASK_HOOK_CODE pxHookFunction );
- * - * Sets pxHookFunction to be the task hook function used by the task xTask. - * Passing xTask as NULL has the effect of setting the calling tasks hook - * function. - */ -void vTaskSetApplicationTaskTag( xTaskHandle xTask, pdTASK_HOOK_CODE pxHookFunction ) PRIVILEGED_FUNCTION; +/* When using trace macros it is sometimes necessary to include tasks.h before +FreeRTOS.h. When this is done pdTASK_HOOK_CODE will not yet have been defined, +so the following two prototypes will cause a compilation error. This can be +fixed by simply guarding against the inclusion of these two prototypes unless +they are explicitly required by the configUSE_APPLICATION_TASK_TAG configuration +constant. */ +#ifdef configUSE_APPLICATION_TASK_TAG + #if configUSE_APPLICATION_TASK_TAG == 1 + /** + * task.h + *
void vTaskSetApplicationTaskTag( xTaskHandle xTask, pdTASK_HOOK_CODE pxHookFunction );
+ * + * Sets pxHookFunction to be the task hook function used by the task xTask. + * Passing xTask as NULL has the effect of setting the calling tasks hook + * function. + */ + void vTaskSetApplicationTaskTag( xTaskHandle xTask, pdTASK_HOOK_CODE pxHookFunction ) PRIVILEGED_FUNCTION; -/** - * task.h - *
void xTaskGetApplicationTaskTag( xTaskHandle xTask );
- * - * Returns the pxHookFunction value assigned to the task xTask. - */ -pdTASK_HOOK_CODE xTaskGetApplicationTaskTag( xTaskHandle xTask ) PRIVILEGED_FUNCTION; + /** + * task.h + *
void xTaskGetApplicationTaskTag( xTaskHandle xTask );
+ * + * Returns the pxHookFunction value assigned to the task xTask. + */ + pdTASK_HOOK_CODE xTaskGetApplicationTaskTag( xTaskHandle xTask ) PRIVILEGED_FUNCTION; + #endif /* configUSE_APPLICATION_TASK_TAG ==1 */ +#endif /* ifdef configUSE_APPLICATION_TASK_TAG */ /** * task.h @@ -1261,7 +1276,7 @@ void vTaskPriorityDisinherit( xTaskHandle * const pxMutexHolder ) PRIVILEGED_FUN /* * Generic version of the task creation function which is in turn called by the - * xTaskCreate() and xTaskCreateProtected() macros. + * xTaskCreate() and xTaskCreateRestricted() macros. */ signed portBASE_TYPE xTaskGenericCreate( pdTASK_CODE pvTaskCode, const signed char * const pcName, unsigned short usStackDepth, void *pvParameters, unsigned portBASE_TYPE uxPriority, xTaskHandle *pxCreatedTask, portSTACK_TYPE *puxStackBuffer, const xMemoryRegion * const xRegions ) PRIVILEGED_FUNCTION; diff --git a/flight/PiOS/STM32F10x/Libraries/FreeRTOS/Source/list.c b/flight/PiOS/STM32F10x/Libraries/FreeRTOS/Source/list.c old mode 100644 new mode 100755 index 76598be1d..a800c030a --- a/flight/PiOS/STM32F10x/Libraries/FreeRTOS/Source/list.c +++ b/flight/PiOS/STM32F10x/Libraries/FreeRTOS/Source/list.c @@ -1,5 +1,5 @@ /* - FreeRTOS V6.0.0 - Copyright (C) 2009 Real Time Engineers Ltd. + FreeRTOS V6.1.1 - Copyright (C) 2011 Real Time Engineers Ltd. *************************************************************************** * * @@ -10,7 +10,7 @@ * + Looking for basic training, * * + Wanting to improve your FreeRTOS skills and productivity * * * - * then take a look at the FreeRTOS eBook * + * then take a look at the FreeRTOS books - available as PDF or paperback * * * * "Using the FreeRTOS Real Time Kernel - a Practical Guide" * * http://www.FreeRTOS.org/Documentation * @@ -51,14 +51,6 @@ licensing and training services. */ -/** - * @file list.c - * @author FreeRTOS - * @addtogroup PIOS PIOS Core hardware abstraction layer - * @{ - * @addtogroup FreeRTOS FreeRTOS Operating system - * @{ - */ #include #include "FreeRTOS.h" diff --git a/flight/PiOS/STM32F10x/Libraries/FreeRTOS/Source/portable/GCC/ARM_CM3/port.c b/flight/PiOS/STM32F10x/Libraries/FreeRTOS/Source/portable/GCC/ARM_CM3/port.c old mode 100644 new mode 100755 index f23506d2e..fa24c7ff5 --- a/flight/PiOS/STM32F10x/Libraries/FreeRTOS/Source/portable/GCC/ARM_CM3/port.c +++ b/flight/PiOS/STM32F10x/Libraries/FreeRTOS/Source/portable/GCC/ARM_CM3/port.c @@ -1,15 +1,5 @@ -/** - * @addtogroup PIOS PIOS Core hardware abstraction layer - * @{ - * @addtogroup FreeRTOS FreeRTOS Operating system - * @{ - * - * @file port.c - * @author FreeRTOS - */ - /* - FreeRTOS V6.0.0 - Copyright (C) 2009 Real Time Engineers Ltd. + FreeRTOS V6.1.1 - Copyright (C) 2011 Real Time Engineers Ltd. *************************************************************************** * * @@ -20,7 +10,7 @@ * + Looking for basic training, * * + Wanting to improve your FreeRTOS skills and productivity * * * - * then take a look at the FreeRTOS eBook * + * then take a look at the FreeRTOS books - available as PDF or paperback * * * * "Using the FreeRTOS Real Time Kernel - a Practical Guide" * * http://www.FreeRTOS.org/Documentation * @@ -125,6 +115,7 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE { /* Simulate the stack frame as it would be created by a context switch interrupt. */ + pxTopOfStack--; /* Offset added to account for the way the MCU uses the stack on entry/exit of interrupts. */ *pxTopOfStack = portINITIAL_XPSR; /* xPSR */ pxTopOfStack--; *pxTopOfStack = ( portSTACK_TYPE ) pxCode; /* PC */ @@ -164,7 +155,9 @@ void vPortStartFirstTask( void ) " ldr r0, [r0] \n" " ldr r0, [r0] \n" " msr msp, r0 \n" /* Set the msp back to the start of the stack. */ + " cpsie i \n" /* Globally enable interrupts. */ " svc 0 \n" /* System call to start first task. */ + " nop \n" ); } /*-----------------------------------------------------------*/ diff --git a/flight/PiOS/STM32F10x/Libraries/FreeRTOS/Source/portable/GCC/ARM_CM3/portmacro.h b/flight/PiOS/STM32F10x/Libraries/FreeRTOS/Source/portable/GCC/ARM_CM3/portmacro.h old mode 100644 new mode 100755 index 87baedbfb..3a106d568 --- a/flight/PiOS/STM32F10x/Libraries/FreeRTOS/Source/portable/GCC/ARM_CM3/portmacro.h +++ b/flight/PiOS/STM32F10x/Libraries/FreeRTOS/Source/portable/GCC/ARM_CM3/portmacro.h @@ -1,15 +1,5 @@ -/** - * @addtogroup PIOS PIOS Core hardware abstraction layer - * @{ - * @addtogroup FreeRTOS FreeRTOS Operating system - * @{ - * @file portmacro.h - * @author FreeRTOS - */ - - /* - FreeRTOS V6.0.0 - Copyright (C) 2009 Real Time Engineers Ltd. + FreeRTOS V6.1.1 - Copyright (C) 2011 Real Time Engineers Ltd. *************************************************************************** * * @@ -20,7 +10,7 @@ * + Looking for basic training, * * + Wanting to improve your FreeRTOS skills and productivity * * * - * then take a look at the FreeRTOS eBook * + * then take a look at the FreeRTOS books - available as PDF or paperback * * * * "Using the FreeRTOS Real Time Kernel - a Practical Guide" * * http://www.FreeRTOS.org/Documentation * @@ -65,7 +55,6 @@ #ifndef PORTMACRO_H #define PORTMACRO_H - #ifdef __cplusplus extern "C" { #endif diff --git a/flight/PiOS/STM32F10x/Libraries/FreeRTOS/Source/portable/MemMang/heap_1.c b/flight/PiOS/STM32F10x/Libraries/FreeRTOS/Source/portable/MemMang/heap_1.c old mode 100644 new mode 100755 index f4d26fe03..70a6bb172 --- a/flight/PiOS/STM32F10x/Libraries/FreeRTOS/Source/portable/MemMang/heap_1.c +++ b/flight/PiOS/STM32F10x/Libraries/FreeRTOS/Source/portable/MemMang/heap_1.c @@ -1,5 +1,5 @@ /* - FreeRTOS V6.0.0 - Copyright (C) 2009 Real Time Engineers Ltd. + FreeRTOS V6.1.1 - Copyright (C) 2011 Real Time Engineers Ltd. *************************************************************************** * * @@ -10,7 +10,7 @@ * + Looking for basic training, * * + Wanting to improve your FreeRTOS skills and productivity * * * - * then take a look at the FreeRTOS eBook * + * then take a look at the FreeRTOS books - available as PDF or paperback * * * * "Using the FreeRTOS Real Time Kernel - a Practical Guide" * * http://www.FreeRTOS.org/Documentation * diff --git a/flight/PiOS/STM32F10x/Libraries/FreeRTOS/Source/portable/MemMang/heap_2.c b/flight/PiOS/STM32F10x/Libraries/FreeRTOS/Source/portable/MemMang/heap_2.c old mode 100644 new mode 100755 index a41d40f00..9f8de5cd2 --- a/flight/PiOS/STM32F10x/Libraries/FreeRTOS/Source/portable/MemMang/heap_2.c +++ b/flight/PiOS/STM32F10x/Libraries/FreeRTOS/Source/portable/MemMang/heap_2.c @@ -1,5 +1,5 @@ /* - FreeRTOS V6.0.0 - Copyright (C) 2009 Real Time Engineers Ltd. + FreeRTOS V6.1.1 - Copyright (C) 2011 Real Time Engineers Ltd. *************************************************************************** * * @@ -10,7 +10,7 @@ * + Looking for basic training, * * + Wanting to improve your FreeRTOS skills and productivity * * * - * then take a look at the FreeRTOS eBook * + * then take a look at the FreeRTOS books - available as PDF or paperback * * * * "Using the FreeRTOS Real Time Kernel - a Practical Guide" * * http://www.FreeRTOS.org/Documentation * @@ -100,7 +100,7 @@ static xBlockLink xStart, xEnd; /* Keeps track of the number of free bytes remaining, but says nothing about fragmentation. */ -static size_t xFreeBytesRemaining; +static size_t xFreeBytesRemaining = configTOTAL_HEAP_SIZE; /* STATIC FUNCTIONS ARE DEFINED AS MACROS TO MINIMIZE THE FUNCTION CALL DEPTH. */ @@ -148,8 +148,6 @@ xBlockLink *pxFirstFreeBlock; \ pxFirstFreeBlock = ( void * ) xHeap.ucHeap; \ pxFirstFreeBlock->xBlockSize = configTOTAL_HEAP_SIZE; \ pxFirstFreeBlock->pxNextFreeBlock = &xEnd; \ - \ - xFreeBytesRemaining = configTOTAL_HEAP_SIZE; \ } /*-----------------------------------------------------------*/ @@ -223,7 +221,7 @@ void *pvReturn = NULL; prvInsertBlockIntoFreeList( ( pxNewBlockLink ) ); } - xFreeBytesRemaining -= xWantedSize; + xFreeBytesRemaining -= pxBlock->xBlockSize; } } } diff --git a/flight/PiOS/STM32F10x/Libraries/FreeRTOS/Source/portable/MemMang/heap_3.c b/flight/PiOS/STM32F10x/Libraries/FreeRTOS/Source/portable/MemMang/heap_3.c old mode 100644 new mode 100755 index f55f6dd26..7ff9bb515 --- a/flight/PiOS/STM32F10x/Libraries/FreeRTOS/Source/portable/MemMang/heap_3.c +++ b/flight/PiOS/STM32F10x/Libraries/FreeRTOS/Source/portable/MemMang/heap_3.c @@ -1,5 +1,5 @@ /* - FreeRTOS V6.0.0 - Copyright (C) 2009 Real Time Engineers Ltd. + FreeRTOS V6.1.1 - Copyright (C) 2011 Real Time Engineers Ltd. *************************************************************************** * * @@ -10,7 +10,7 @@ * + Looking for basic training, * * + Wanting to improve your FreeRTOS skills and productivity * * * - * then take a look at the FreeRTOS eBook * + * then take a look at the FreeRTOS books - available as PDF or paperback * * * * "Using the FreeRTOS Real Time Kernel - a Practical Guide" * * http://www.FreeRTOS.org/Documentation * diff --git a/flight/PiOS/STM32F10x/Libraries/FreeRTOS/Source/queue.c b/flight/PiOS/STM32F10x/Libraries/FreeRTOS/Source/queue.c old mode 100644 new mode 100755 index 5521bb011..a62d179e9 --- a/flight/PiOS/STM32F10x/Libraries/FreeRTOS/Source/queue.c +++ b/flight/PiOS/STM32F10x/Libraries/FreeRTOS/Source/queue.c @@ -1,14 +1,5 @@ -/** - * @addtogroup PIOS PIOS Core hardware abstraction layer - * @{ - * @addtogroup FreeRTOS FreeRTOS Operating system - * @{ - * @file queue.c - * @author FreeRTOS - */ - /* - FreeRTOS V6.0.0 - Copyright (C) 2009 Real Time Engineers Ltd. + FreeRTOS V6.1.1 - Copyright (C) 2011 Real Time Engineers Ltd. *************************************************************************** * * @@ -19,7 +10,7 @@ * + Looking for basic training, * * + Wanting to improve your FreeRTOS skills and productivity * * * - * then take a look at the FreeRTOS eBook * + * then take a look at the FreeRTOS books - available as PDF or paperback * * * * "Using the FreeRTOS Real Time Kernel - a Practical Guide" * * http://www.FreeRTOS.org/Documentation * @@ -424,6 +415,10 @@ size_t xQueueSizeInBytes; { ( pxMutex->uxRecursiveCallCount )++; } + else + { + traceTAKE_MUTEX_RECURSIVE_FAILED( pxMutex ); + } } return xReturn; diff --git a/flight/PiOS/STM32F10x/Libraries/FreeRTOS/Source/tasks.c b/flight/PiOS/STM32F10x/Libraries/FreeRTOS/Source/tasks.c old mode 100644 new mode 100755 index 8af5cd309..120f8f7e3 --- a/flight/PiOS/STM32F10x/Libraries/FreeRTOS/Source/tasks.c +++ b/flight/PiOS/STM32F10x/Libraries/FreeRTOS/Source/tasks.c @@ -1,5 +1,5 @@ /* - FreeRTOS V6.0.0 - Copyright (C) 2009 Real Time Engineers Ltd. + FreeRTOS V6.1.1 - Copyright (C) 2011 Real Time Engineers Ltd. *************************************************************************** * * @@ -10,7 +10,7 @@ * + Looking for basic training, * * + Wanting to improve your FreeRTOS skills and productivity * * * - * then take a look at the FreeRTOS eBook * + * then take a look at the FreeRTOS books - available as PDF or paperback * * * * "Using the FreeRTOS Real Time Kernel - a Practical Guide" * * http://www.FreeRTOS.org/Documentation * @@ -33,9 +33,9 @@ FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - more details. You should have received a copy of the GNU General Public - License and the FreeRTOS license exception along with FreeRTOS; if not it - can be viewed here: http://www.freertos.org/a00114.html and also obtained + more details. You should have received a copy of the GNU General Public + License and the FreeRTOS license exception along with FreeRTOS; if not it + can be viewed here: http://www.freertos.org/a00114.html and also obtained by writing to Richard Barry, contact details for whom are available on the FreeRTOS WEB site. @@ -51,16 +51,6 @@ licensing and training services. */ -/** - * @file tasks.c - * @author FreeRTOS - * @addtogroup PIOS PIOS Core hardware abstraction layer - * @{ - * @addtogroup FreeRTOS FreeRTOS Operating system - * @{ - */ - - #include #include @@ -82,8 +72,6 @@ task.h is included from an application file. */ */ #define tskIDLE_STACK_SIZE configMINIMAL_STACK_SIZE -#define tskIDLE_PRIORITY ( ( unsigned portBASE_TYPE ) 0 ) - /* * Task control block. A task control block (TCB) is allocated to each task, * and stores the context of the task. @@ -399,7 +387,6 @@ signed portBASE_TYPE xTaskGenericCreate( pdTASK_CODE pxTaskCode, const signed ch { signed portBASE_TYPE xReturn; tskTCB * pxNewTCB; -portBASE_TYPE xRunPrivileged; /* Allocate the memory required by the TCB and stack for the new task, checking that the allocation was successful. */ @@ -409,16 +396,19 @@ portBASE_TYPE xRunPrivileged; { portSTACK_TYPE *pxTopOfStack; - /* Should the task be created in privileged mode? */ - if( ( uxPriority & portPRIVILEGE_BIT ) != 0x00 ) - { - xRunPrivileged = pdTRUE; - } - else - { - xRunPrivileged = pdFALSE; - } - uxPriority &= ~portPRIVILEGE_BIT; + #if( portUSING_MPU_WRAPPERS == 1 ) + /* Should the task be created in privileged mode? */ + portBASE_TYPE xRunPrivileged; + if( ( uxPriority & portPRIVILEGE_BIT ) != 0x00 ) + { + xRunPrivileged = pdTRUE; + } + else + { + xRunPrivileged = pdFALSE; + } + uxPriority &= ~portPRIVILEGE_BIT; + #endif /* portUSING_MPU_WRAPPERS == 1 */ /* Calculate the top of stack address. This depends on whether the stack grows from high memory to low (as per the 80x86) or visa versa. @@ -454,24 +444,35 @@ portBASE_TYPE xRunPrivileged; #else { pxNewTCB->pxTopOfStack = pxPortInitialiseStack( pxTopOfStack, pxTaskCode, pvParameters ); - ( void ) xRunPrivileged; } #endif + if( ( void * ) pxCreatedTask != NULL ) + { + /* Pass the TCB out - in an anonymous way. The calling function/ + task can use this as a handle to delete the task later if + required.*/ + *pxCreatedTask = ( xTaskHandle ) pxNewTCB; + } + /* We are going to manipulate the task queues to add this task to a ready list, so must make sure no interrupts occur. */ portENTER_CRITICAL(); { uxCurrentNumberOfTasks++; - if( uxCurrentNumberOfTasks == ( unsigned portBASE_TYPE ) 1 ) + if( pxCurrentTCB == NULL ) { - /* As this is the first task it must also be the current task. */ + /* There are no other tasks, or all the other tasks are in + the suspended state - make this the current task. */ pxCurrentTCB = pxNewTCB; - /* This is the first task to be created so do the preliminary - initialisation required. We will not recover if this call - fails, but we will report the failure. */ - prvInitialiseTaskLists(); + if( uxCurrentNumberOfTasks == ( unsigned portBASE_TYPE ) 1 ) + { + /* This is the first task to be created so do the preliminary + initialisation required. We will not recover if this call + fails, but we will report the failure. */ + prvInitialiseTaskLists(); + } } else { @@ -512,19 +513,11 @@ portBASE_TYPE xRunPrivileged; else { xReturn = errCOULD_NOT_ALLOCATE_REQUIRED_MEMORY; - traceTASK_CREATE_FAILED( pxNewTCB ); + traceTASK_CREATE_FAILED(); } if( xReturn == pdPASS ) { - if( ( void * ) pxCreatedTask != NULL ) - { - /* Pass the TCB out - in an anonymous way. The calling function/ - task can use this as a handle to delete the task later if - required.*/ - *pxCreatedTask = ( xTaskHandle ) pxNewTCB; - } - if( xSchedulerRunning != pdFALSE ) { /* If the created task is of a higher priority than the current task @@ -904,10 +897,31 @@ portBASE_TYPE xRunPrivileged; } portEXIT_CRITICAL(); - /* We may have just suspended the current task. */ if( ( void * ) pxTaskToSuspend == NULL ) { - portYIELD_WITHIN_API(); + if( xSchedulerRunning != pdFALSE ) + { + /* We have just suspended the current task. */ + portYIELD_WITHIN_API(); + } + else + { + /* The scheduler is not running, but the task that was pointed + to by pxCurrentTCB has just been suspended and pxCurrentTCB + must be adjusted to point to a different task. */ + if( uxCurrentNumberOfTasks == 1 ) + { + /* No other tasks are defined, so set pxCurrentTCB back to + NULL so when the next task is created pxCurrentTCB will + be set to point to it no matter what its relative priority + is. */ + pxCurrentTCB = NULL; + } + else + { + vTaskSwitchContext(); + } + } } } @@ -1054,7 +1068,7 @@ portBASE_TYPE xReturn; macro must be defined to configure the timer/counter used to generate the run time counter time base. */ portCONFIGURE_TIMER_FOR_RUN_TIME_STATS(); - + /* Setting up the timer tick is hardware specific and thus in the portable interface. */ if( xPortStartScheduler() ) @@ -1186,6 +1200,12 @@ portTickType xTicks; } /*-----------------------------------------------------------*/ +portTickType xTaskGetTickCountFromISR( void ) +{ + return xTickCount; +} +/*-----------------------------------------------------------*/ + unsigned portBASE_TYPE uxTaskGetNumberOfTasks( void ) { /* A critical section is not required because the variables are of type @@ -1262,13 +1282,23 @@ unsigned portBASE_TYPE uxTaskGetNumberOfTasks( void ) void vTaskGetRunTimeStats( signed char *pcWriteBuffer ) { unsigned portBASE_TYPE uxQueue; - unsigned long ulTotalRunTime = portGET_RUN_TIME_COUNTER_VALUE(); + unsigned long ulTotalRunTime; /* This is a VERY costly function that should be used for debug only. It leaves interrupts disabled for a LONG time. */ vTaskSuspendAll(); { + #ifdef portALT_GET_RUN_TIME_COUNTER_VALUE + portALT_GET_RUN_TIME_COUNTER_VALUE( ulTotalRunTime ); + #else + ulTotalRunTime = portGET_RUN_TIME_COUNTER_VALUE(); + #endif + + /* Divide ulTotalRunTime by 100 to make the percentage caluclations + simpler in the prvGenerateRunTimeStatsForTasksInList() function. */ + ulTotalRunTime /= 100UL; + /* Run through all the lists that could potentially contain a TCB, generating a table of run timer percentages in the provided buffer. */ @@ -1574,7 +1604,13 @@ void vTaskSwitchContext( void ) #if ( configGENERATE_RUN_TIME_STATS == 1 ) { - unsigned long ulTempCounter = portGET_RUN_TIME_COUNTER_VALUE(); + unsigned long ulTempCounter; + + #ifdef portALT_GET_RUN_TIME_COUNTER_VALUE + portALT_GET_RUN_TIME_COUNTER_VALUE( ulTempCounter ); + #else + ulTempCounter = portGET_RUN_TIME_COUNTER_VALUE(); + #endif /* Add the amount of time the task has been running to the accumulated time so far. The time the task started running was stored in @@ -1753,7 +1789,7 @@ portBASE_TYPE xReturn; passed since vTaskSetTimeout() was called. */ xReturn = pdTRUE; } - else if( ( ( portTickType ) xTickCount - ( portTickType ) pxTimeOut->xTimeOnEntering ) < ( portTickType ) *pxTicksToWait ) + else if( ( ( portTickType ) ( ( portTickType ) xTickCount - ( portTickType ) pxTimeOut->xTimeOnEntering ) ) < ( portTickType ) *pxTicksToWait ) { /* Not a genuine timeout. Adjust parameters for time remaining. */ *pxTicksToWait -= ( ( portTickType ) xTickCount - ( portTickType ) pxTimeOut->xTimeOnEntering ); @@ -2049,7 +2085,16 @@ tskTCB *pxNewTCB; do { listGET_OWNER_OF_NEXT_ENTRY( pxNextTCB, pxList ); - usStackRemaining = usTaskCheckFreeStackSpace( ( unsigned char * ) pxNextTCB->pxStack ); + #if ( portSTACK_GROWTH > 0 ) + { + usStackRemaining = usTaskCheckFreeStackSpace( ( unsigned char * ) pxNextTCB->pxEndOfStack ); + } + #else + { + usStackRemaining = usTaskCheckFreeStackSpace( ( unsigned char * ) pxNextTCB->pxStack ); + } + #endif + sprintf( pcStatusString, ( char * ) "%s\t\t%c\t%u\t%u\t%u\r\n", pxNextTCB->pcTaskName, cStatus, ( unsigned int ) pxNextTCB->uxPriority, usStackRemaining, ( unsigned int ) pxNextTCB->uxTCBNumber ); strcat( ( char * ) pcWriteBuffer, ( char * ) pcStatusString ); @@ -2084,19 +2129,40 @@ tskTCB *pxNewTCB; } else { - /* What percentage of the total run time as the task used? - This will always be rounded down to the nearest integer. */ - ulStatsAsPercentage = ( 100UL * pxNextTCB->ulRunTimeCounter ) / ulTotalRunTime; + /* What percentage of the total run time has the task used? + This will always be rounded down to the nearest integer. + ulTotalRunTime has already been divided by 100. */ + ulStatsAsPercentage = pxNextTCB->ulRunTimeCounter / ulTotalRunTime; if( ulStatsAsPercentage > 0UL ) { - sprintf( pcStatsString, ( char * ) "%s\t\t%u\t\t%u%%\r\n", pxNextTCB->pcTaskName, ( unsigned int ) pxNextTCB->ulRunTimeCounter, ( unsigned int ) ulStatsAsPercentage ); + #ifdef portLU_PRINTF_SPECIFIER_REQUIRED + { + sprintf( pcStatsString, ( char * ) "%s\t\t%lu\t\t%lu%%\r\n", pxNextTCB->pcTaskName, pxNextTCB->ulRunTimeCounter, ulStatsAsPercentage ); + } + #else + { + /* sizeof( int ) == sizeof( long ) so a smaller + printf() library can be used. */ + sprintf( pcStatsString, ( char * ) "%s\t\t%u\t\t%u%%\r\n", pxNextTCB->pcTaskName, ( unsigned int ) pxNextTCB->ulRunTimeCounter, ( unsigned int ) ulStatsAsPercentage ); + } + #endif } else { /* If the percentage is zero here then the task has consumed less than 1% of the total run time. */ - sprintf( pcStatsString, ( char * ) "%s\t\t%u\t\t<1%%\r\n", pxNextTCB->pcTaskName, ( unsigned int ) pxNextTCB->ulRunTimeCounter ); + #ifdef portLU_PRINTF_SPECIFIER_REQUIRED + { + sprintf( pcStatsString, ( char * ) "%s\t\t%lu\t\t<1%%\r\n", pxNextTCB->pcTaskName, pxNextTCB->ulRunTimeCounter ); + } + #else + { + /* sizeof( int ) == sizeof( long ) so a smaller + printf() library can be used. */ + sprintf( pcStatsString, ( char * ) "%s\t\t%u\t\t<1%%\r\n", pxNextTCB->pcTaskName, ( unsigned int ) pxNextTCB->ulRunTimeCounter ); + } + #endif } } @@ -2284,7 +2350,7 @@ tskTCB *pxNewTCB; if( xSchedulerRunning != pdFALSE ) { - pxCurrentTCB->uxCriticalNesting++; + ( pxCurrentTCB->uxCriticalNesting )++; } } @@ -2299,7 +2365,7 @@ void vTaskExitCritical( void ) { if( pxCurrentTCB->uxCriticalNesting > 0 ) { - pxCurrentTCB->uxCriticalNesting--; + ( pxCurrentTCB->uxCriticalNesting )--; if( pxCurrentTCB->uxCriticalNesting == 0 ) {