1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-12-01 09:24:10 +01:00

Upgrade FreeRTOS to the latest version (6.1.1) which allows compiling with -Os

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@2562 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
peabody124 2011-01-24 07:51:26 +00:00 committed by peabody124
parent c55d40bdbc
commit 607cdcac21
19 changed files with 266 additions and 277 deletions

View File

@ -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, * * + Looking for basic training, *
* + Wanting to improve your FreeRTOS skills and productivity * * + 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" * * "Using the FreeRTOS Real Time Kernel - a Practical Guide" *
* http://www.FreeRTOS.org/Documentation * * http://www.FreeRTOS.org/Documentation *
@ -55,15 +55,6 @@
#include "task.h" #include "task.h"
#include "croutine.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 * Some kernel aware debuggers require data to be viewed to be global, rather
* than file scope. * than file scope.

View File

@ -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, * * + Looking for basic training, *
* + Wanting to improve your FreeRTOS skills and productivity * * + 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" * * "Using the FreeRTOS Real Time Kernel - a Practical Guide" *
* http://www.FreeRTOS.org/Documentation * * http://www.FreeRTOS.org/Documentation *
@ -33,9 +33,9 @@
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT FreeRTOS is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 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 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 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 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 by writing to Richard Barry, contact details for whom are available on the
FreeRTOS WEB site. FreeRTOS WEB site.
@ -54,14 +54,6 @@
#ifndef INC_FREERTOS_H #ifndef INC_FREERTOS_H
#define 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. * Include the generic headers required for the FreeRTOS port being used.
@ -247,17 +239,17 @@ typedef portBASE_TYPE (*pdTASK_HOOK_CODE)( void * );
#endif #endif
#ifndef traceBLOCKING_ON_QUEUE_RECEIVE #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 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. */ task that attempted the read. */
#define traceBLOCKING_ON_QUEUE_RECEIVE( pxQueue ) #define traceBLOCKING_ON_QUEUE_RECEIVE( pxQueue )
#endif #endif
#ifndef traceBLOCKING_ON_QUEUE_SEND #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 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. */ task that attempted the write. */
#define traceBLOCKING_ON_QUEUE_SEND( pxQueue ) #define traceBLOCKING_ON_QUEUE_SEND( pxQueue )
#endif #endif
@ -296,6 +288,10 @@ typedef portBASE_TYPE (*pdTASK_HOOK_CODE)( void * );
#define traceTAKE_MUTEX_RECURSIVE( pxMutex ) #define traceTAKE_MUTEX_RECURSIVE( pxMutex )
#endif #endif
#ifndef traceTAKE_MUTEX_RECURSIVE_FAILED
#define traceTAKE_MUTEX_RECURSIVE_FAILED( pxMutex )
#endif
#ifndef traceCREATE_COUNTING_SEMAPHORE #ifndef traceCREATE_COUNTING_SEMAPHORE
#define traceCREATE_COUNTING_SEMAPHORE() #define traceCREATE_COUNTING_SEMAPHORE()
#endif #endif
@ -349,7 +345,7 @@ typedef portBASE_TYPE (*pdTASK_HOOK_CODE)( void * );
#endif #endif
#ifndef traceTASK_CREATE_FAILED #ifndef traceTASK_CREATE_FAILED
#define traceTASK_CREATE_FAILED( pxNewTCB ) #define traceTASK_CREATE_FAILED()
#endif #endif
#ifndef traceTASK_DELETE #ifndef traceTASK_DELETE
@ -395,7 +391,9 @@ typedef portBASE_TYPE (*pdTASK_HOOK_CODE)( void * );
#endif /* portCONFIGURE_TIMER_FOR_RUN_TIME_STATS */ #endif /* portCONFIGURE_TIMER_FOR_RUN_TIME_STATS */
#ifndef portGET_RUN_TIME_COUNTER_VALUE #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 /* portGET_RUN_TIME_COUNTER_VALUE */
#endif /* configGENERATE_RUN_TIME_STATS */ #endif /* configGENERATE_RUN_TIME_STATS */
@ -417,7 +415,7 @@ typedef portBASE_TYPE (*pdTASK_HOOK_CODE)( void * );
#endif #endif
#ifndef pvPortMallocAligned #ifndef pvPortMallocAligned
#define pvPortMallocAligned( xSize, pvBuffer ) pvPortMalloc( xSize ); ( void ) pvBuffer #define pvPortMallocAligned( x, puxStackBuffer ) ( ( puxStackBuffer == NULL ) ? ( pvPortMalloc( x ) ) : ( puxStackBuffer ) )
#endif #endif
#ifndef vPortFreeAligned #ifndef vPortFreeAligned

View File

@ -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, * * + Looking for basic training, *
* + Wanting to improve your FreeRTOS skills and productivity * * + 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" * * "Using the FreeRTOS Real Time Kernel - a Practical Guide" *
* http://www.FreeRTOS.org/Documentation * * http://www.FreeRTOS.org/Documentation *
@ -42,9 +33,9 @@
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT FreeRTOS is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 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 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 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 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 by writing to Richard Barry, contact details for whom are available on the
FreeRTOS WEB site. FreeRTOS WEB site.
@ -72,7 +63,7 @@
* the current stack state only - comparing the current top of stack value to * 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 * 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 * 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 * overwritten. Note this second test does not guarantee that an overflowed
* stack will always be recognised. * stack will always be recognised.
*/ */
@ -102,7 +93,7 @@
/* Only the current stack state is to be checked. */ /* Only the current stack state is to be checked. */
#define taskFIRST_CHECK_FOR_STACK_OVERFLOW() \ #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? */ \ /* Is the currently saved stack pointer within the stack limit? */ \
if( pxCurrentTCB->pxTopOfStack <= pxCurrentTCB->pxStack ) \ 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 ) ) #if( ( configCHECK_FOR_STACK_OVERFLOW > 0 ) && ( portSTACK_GROWTH > 0 ) )
@ -119,7 +110,7 @@
/* Only the current stack state is to be checked. */ /* Only the current stack state is to be checked. */
#define taskFIRST_CHECK_FOR_STACK_OVERFLOW() \ #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? */ \ /* Is the currently saved stack pointer within the stack limit? */ \
if( pxCurrentTCB->pxTopOfStack >= pxCurrentTCB->pxEndOfStack ) \ if( pxCurrentTCB->pxTopOfStack >= pxCurrentTCB->pxEndOfStack ) \
@ -135,8 +126,8 @@
#define taskSECOND_CHECK_FOR_STACK_OVERFLOW() \ #define taskSECOND_CHECK_FOR_STACK_OVERFLOW() \
{ \ { \
extern void vApplicationStackOverflowHook( xTaskHandle *pxTask, signed char *pcTaskName ); \ 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, \ 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, \ 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() \ #define taskSECOND_CHECK_FOR_STACK_OVERFLOW() \
{ \ { \
extern void vApplicationStackOverflowHook( xTaskHandle *pxTask, signed char *pcTaskName ); \ extern void vApplicationStackOverflowHook( xTaskHandle *pxTask, signed char *pcTaskName ); \
char *pcEndOfStack = ( char * ) pxCurrentTCB->pxEndOfStack; \ char *pcEndOfStack = ( char * ) pxCurrentTCB->pxEndOfStack; \
static const unsigned char ucExpectedStackBytes[] = { tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \ 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, \ 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, \

View File

@ -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, * * + Looking for basic training, *
* + Wanting to improve your FreeRTOS skills and productivity * * + 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" * * "Using the FreeRTOS Real Time Kernel - a Practical Guide" *
* http://www.FreeRTOS.org/Documentation * * http://www.FreeRTOS.org/Documentation *
@ -52,17 +52,10 @@
*/ */
#ifndef INC_FREERTOS_H #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 #endif
/**
* @file croutine.h
* @author FreeRTOS
* @addtogroup PIOS PIOS Core hardware abstraction layer
* @{
* @addtogroup FreeRTOS FreeRTOS Operating system
* @{
*/
#ifndef CO_ROUTINE_H #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. // 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. // This may not be necessary for const variables.
static const char cLedToFlash[ 2 ] = { 5, 6 }; 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(); // Must start every co-routine with a call to crSTART();
crSTART( xHandle ); crSTART( xHandle );

View File

@ -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, * * + Looking for basic training, *
* + Wanting to improve your FreeRTOS skills and productivity * * + 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" * * "Using the FreeRTOS Real Time Kernel - a Practical Guide" *
* http://www.FreeRTOS.org/Documentation * * http://www.FreeRTOS.org/Documentation *

View File

@ -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, * * + Looking for basic training, *
* + Wanting to improve your FreeRTOS skills and productivity * * + 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" * * "Using the FreeRTOS Real Time Kernel - a Practical Guide" *
* http://www.FreeRTOS.org/Documentation * * http://www.FreeRTOS.org/Documentation *
@ -59,7 +59,7 @@ only for ports that are using the MPU. */
#ifdef portUSING_MPU_WRAPPERS #ifdef portUSING_MPU_WRAPPERS
/* MPU_WRAPPERS_INCLUDED_FROM_API_FILE will be defined when this file is /* 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. */ those files. */
#ifndef MPU_WRAPPERS_INCLUDED_FROM_API_FILE #ifndef MPU_WRAPPERS_INCLUDED_FROM_API_FILE

View File

@ -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, * * + Looking for basic training, *
* + Wanting to improve your FreeRTOS skills and productivity * * + 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" * * "Using the FreeRTOS Real Time Kernel - a Practical Guide" *
* http://www.FreeRTOS.org/Documentation * * http://www.FreeRTOS.org/Documentation *
@ -67,7 +58,6 @@
#ifndef PORTABLE_H #ifndef PORTABLE_H
#define PORTABLE_H #define PORTABLE_H
/* Include the macro file relevant to the port being used. */ /* Include the macro file relevant to the port being used. */
#ifdef OPEN_WATCOM_INDUSTRIAL_PC_PORT #ifdef OPEN_WATCOM_INDUSTRIAL_PC_PORT

View File

@ -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, * * + Looking for basic training, *
* + Wanting to improve your FreeRTOS skills and productivity * * + 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" * * "Using the FreeRTOS Real Time Kernel - a Practical Guide" *
* http://www.FreeRTOS.org/Documentation * * http://www.FreeRTOS.org/Documentation *

View File

@ -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, * * + Looking for basic training, *
* + Wanting to improve your FreeRTOS skills and productivity * * + 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" * * "Using the FreeRTOS Real Time Kernel - a Practical Guide" *
* http://www.FreeRTOS.org/Documentation * * http://www.FreeRTOS.org/Documentation *
@ -65,6 +56,8 @@
#endif #endif
#ifndef QUEUE_H #ifndef QUEUE_H
#define QUEUE_H #define QUEUE_H

View File

@ -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, * * + Looking for basic training, *
* + Wanting to improve your FreeRTOS skills and productivity * * + 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" * * "Using the FreeRTOS Real Time Kernel - a Practical Guide" *
* http://www.FreeRTOS.org/Documentation * * http://www.FreeRTOS.org/Documentation *
@ -67,8 +58,6 @@
#ifndef SEMAPHORE_H #ifndef SEMAPHORE_H
#define SEMAPHORE_H #define SEMAPHORE_H
#include "queue.h" #include "queue.h"
typedef xQueueHandle xSemaphoreHandle; typedef xQueueHandle xSemaphoreHandle;
@ -126,7 +115,7 @@ typedef xQueueHandle xSemaphoreHandle;
/** /**
* semphr. h * semphr. h
* xSemaphoreTake( * <pre>xSemaphoreTake(
* xSemaphoreHandle xSemaphore, * xSemaphoreHandle xSemaphore,
* portTickType xBlockTime * portTickType xBlockTime
* )</pre> * )</pre>
@ -465,7 +454,7 @@ typedef xQueueHandle xSemaphoreHandle;
* <pre> * <pre>
xSemaphoreGiveFromISR( xSemaphoreGiveFromISR(
xSemaphoreHandle xSemaphore, xSemaphoreHandle xSemaphore,
portBASE_TYPE *pxHigherPriorityTaskWoken signed portBASE_TYPE *pxHigherPriorityTaskWoken
)</pre> )</pre>
* *
* <i>Macro</i> to release a semaphore. The semaphore must have previously been * <i>Macro</i> to release a semaphore. The semaphore must have previously been
@ -489,8 +478,8 @@ typedef xQueueHandle xSemaphoreHandle;
* *
* Example usage: * Example usage:
<pre> <pre>
#define LONG_TIME 0xffff \#define LONG_TIME 0xffff
#define TICKS_TO_WAIT 10 \#define TICKS_TO_WAIT 10
xSemaphoreHandle xSemaphore = NULL; xSemaphoreHandle xSemaphore = NULL;
// Repetitive task. // Repetitive task.
@ -520,7 +509,7 @@ typedef xQueueHandle xSemaphoreHandle;
void vTimerISR( void * pvParameters ) void vTimerISR( void * pvParameters )
{ {
static unsigned char ucLocalTickCount = 0; static unsigned char ucLocalTickCount = 0;
static portBASE_TYPE xHigherPriorityTaskWoken; static signed portBASE_TYPE xHigherPriorityTaskWoken;
// A timer tick has occurred. // A timer tick has occurred.
@ -720,7 +709,3 @@ typedef xQueueHandle xSemaphoreHandle;
#endif /* SEMAPHORE_H */ #endif /* SEMAPHORE_H */
/**
* @}
* @}
*/

View File

@ -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, * * + Looking for basic training, *
* + Wanting to improve your FreeRTOS skills and productivity * * + 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" * * "Using the FreeRTOS Real Time Kernel - a Practical Guide" *
* http://www.FreeRTOS.org/Documentation * * http://www.FreeRTOS.org/Documentation *
@ -33,9 +33,9 @@
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT FreeRTOS is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 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 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 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 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 by writing to Richard Barry, contact details for whom are available on the
FreeRTOS WEB site. FreeRTOS WEB site.
@ -53,16 +53,9 @@
#ifndef INC_FREERTOS_H #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 #endif
/**
* @author FreeRTOS
* @addtogroup PIOS PIOS Core hardware abstraction layer
* @{
* @addtogroup FreeRTOS FreeRTOS Operating system
* @{
*/
#ifndef TASK_H #ifndef TASK_H
@ -79,7 +72,7 @@ extern "C" {
* MACROS AND DEFINITIONS * MACROS AND DEFINITIONS
*----------------------------------------------------------*/ *----------------------------------------------------------*/
#define tskKERNEL_VERSION_NUMBER "V6.0.0" #define tskKERNEL_VERSION_NUMBER "V6.1.1"
/** /**
* task. h * task. h
@ -213,10 +206,10 @@ typedef struct xTASK_PARAMTERS
);</pre> );</pre>
* *
* Create a new task and add it to the list of tasks that are ready to run. * 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 * xTaskCreate() can only be used to create a task that has unrestricted
* access to the entire microcontroller memory map. Systems that include MPU * 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(). * xTaskCreateRestricted().
* *
* @param pvTaskCode Pointer to the task entry function. Tasks * @param pvTaskCode Pointer to the task entry function. Tasks
@ -281,7 +274,7 @@ typedef struct xTASK_PARAMTERS
/** /**
* task. h * task. h
*<pre> *<pre>
portBASE_TYPE xTaskCreateRestricted( xTaskParameters *pxTaskDefinition, xTaskHandle pxCreatedTask );</pre> portBASE_TYPE xTaskCreateRestricted( xTaskParameters *pxTaskDefinition, xTaskHandle *pxCreatedTask );</pre>
* *
* xTaskCreateRestricted() should only be used in systems that include an MPU * xTaskCreateRestricted() should only be used in systems that include an MPU
* implementation. * implementation.
@ -292,13 +285,9 @@ typedef struct xTASK_PARAMTERS
* *
* @param pxTaskDefinition Pointer to a structure that contains a member * @param pxTaskDefinition Pointer to a structure that contains a member
* for each of the normal xTaskCreate() parameters (see the xTaskCreate() API * 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. * 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 * @param pxCreatedTask Used to pass back a handle by which the created task
* can be referenced. * can be referenced.
* *
@ -359,7 +348,7 @@ xTaskHandle xHandle;
* Memory regions are assigned to a restricted task when the task is created by * Memory regions are assigned to a restricted task when the task is created by
* a call to xTaskCreateRestricted(). These regions can be redefined using * a call to xTaskCreateRestricted(). These regions can be redefined using
* vTaskAllocateMPURegions(). * vTaskAllocateMPURegions().
* *
* @param xTask The handle of the task being updated. * @param xTask The handle of the task being updated.
* *
* @param xRegions A pointer to an xMemoryRegion structure that contains the * @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 ) void vATask( void *pvParameters )
{ {
// This task was created such that it has access to certain regions of // 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 // desired that these MPU regions are replaced with that defined in the
// xAltRegions const struct above. Use a call to vTaskAllocateMPURegions() // xAltRegions const struct above. Use a call to vTaskAllocateMPURegions()
// for this purpose. NULL is used as the task handle to indicate that this // 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 * task. h
* <PRE>volatile portTickType xTaskGetTickCount( void );</PRE> * <PRE>portTickType xTaskGetTickCount( void );</PRE>
* *
* @return The count of ticks since vTaskStartScheduler was called. * @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; portTickType xTaskGetTickCount( void ) PRIVILEGED_FUNCTION;
/**
* task. h
* <PRE>portTickType xTaskGetTickCountFromISR( void );</PRE>
*
* @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 * task. h
* <PRE>unsigned short uxTaskGetNumberOfTasks( void );</PRE> * <PRE>unsigned short uxTaskGetNumberOfTasks( void );</PRE>
@ -1097,9 +1102,9 @@ unsigned long ulTaskEndTrace( void ) PRIVILEGED_FUNCTION;
* this function to be available. * this function to be available.
* *
* Returns the high water mark of the stack associated with xTask. That is, * 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 * the minimum free stack space there has been (in words, so on a 32 bit machine
* started. The smaller the returned number the closer the task has come * a value of 1 means 4 bytes) since the task started. The smaller the returned
* to overflowing its stack. * number the closer the task has come to overflowing its stack.
* *
* @param xTask Handle of the task associated with the stack to be checked. * @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. * 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; unsigned portBASE_TYPE uxTaskGetStackHighWaterMark( xTaskHandle xTask ) PRIVILEGED_FUNCTION;
/** /* When using trace macros it is sometimes necessary to include tasks.h before
* task.h FreeRTOS.h. When this is done pdTASK_HOOK_CODE will not yet have been defined,
* <pre>void vTaskSetApplicationTaskTag( xTaskHandle xTask, pdTASK_HOOK_CODE pxHookFunction );</pre> 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
* Sets pxHookFunction to be the task hook function used by the task xTask. they are explicitly required by the configUSE_APPLICATION_TASK_TAG configuration
* Passing xTask as NULL has the effect of setting the calling tasks hook constant. */
* function. #ifdef configUSE_APPLICATION_TASK_TAG
*/ #if configUSE_APPLICATION_TASK_TAG == 1
void vTaskSetApplicationTaskTag( xTaskHandle xTask, pdTASK_HOOK_CODE pxHookFunction ) PRIVILEGED_FUNCTION; /**
* task.h
* <pre>void vTaskSetApplicationTaskTag( xTaskHandle xTask, pdTASK_HOOK_CODE pxHookFunction );</pre>
*
* 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 * task.h
* <pre>void xTaskGetApplicationTaskTag( xTaskHandle xTask );</pre> * <pre>void xTaskGetApplicationTaskTag( xTaskHandle xTask );</pre>
* *
* Returns the pxHookFunction value assigned to the task xTask. * Returns the pxHookFunction value assigned to the task xTask.
*/ */
pdTASK_HOOK_CODE xTaskGetApplicationTaskTag( xTaskHandle xTask ) PRIVILEGED_FUNCTION; pdTASK_HOOK_CODE xTaskGetApplicationTaskTag( xTaskHandle xTask ) PRIVILEGED_FUNCTION;
#endif /* configUSE_APPLICATION_TASK_TAG ==1 */
#endif /* ifdef configUSE_APPLICATION_TASK_TAG */
/** /**
* task.h * 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 * 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; 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;

12
flight/PiOS/STM32F10x/Libraries/FreeRTOS/Source/list.c Normal file → Executable file
View File

@ -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, * * + Looking for basic training, *
* + Wanting to improve your FreeRTOS skills and productivity * * + 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" * * "Using the FreeRTOS Real Time Kernel - a Practical Guide" *
* http://www.FreeRTOS.org/Documentation * * http://www.FreeRTOS.org/Documentation *
@ -51,14 +51,6 @@
licensing and training services. licensing and training services.
*/ */
/**
* @file list.c
* @author FreeRTOS
* @addtogroup PIOS PIOS Core hardware abstraction layer
* @{
* @addtogroup FreeRTOS FreeRTOS Operating system
* @{
*/
#include <stdlib.h> #include <stdlib.h>
#include "FreeRTOS.h" #include "FreeRTOS.h"

View File

@ -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, * * + Looking for basic training, *
* + Wanting to improve your FreeRTOS skills and productivity * * + 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" * * "Using the FreeRTOS Real Time Kernel - a Practical Guide" *
* http://www.FreeRTOS.org/Documentation * * 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 /* Simulate the stack frame as it would be created by a context switch
interrupt. */ interrupt. */
pxTopOfStack--; /* Offset added to account for the way the MCU uses the stack on entry/exit of interrupts. */
*pxTopOfStack = portINITIAL_XPSR; /* xPSR */ *pxTopOfStack = portINITIAL_XPSR; /* xPSR */
pxTopOfStack--; pxTopOfStack--;
*pxTopOfStack = ( portSTACK_TYPE ) pxCode; /* PC */ *pxTopOfStack = ( portSTACK_TYPE ) pxCode; /* PC */
@ -164,7 +155,9 @@ void vPortStartFirstTask( void )
" ldr r0, [r0] \n" " ldr r0, [r0] \n"
" ldr r0, [r0] \n" " ldr r0, [r0] \n"
" msr msp, r0 \n" /* Set the msp back to the start of the stack. */ " 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. */ " svc 0 \n" /* System call to start first task. */
" nop \n"
); );
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/

View File

@ -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, * * + Looking for basic training, *
* + Wanting to improve your FreeRTOS skills and productivity * * + 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" * * "Using the FreeRTOS Real Time Kernel - a Practical Guide" *
* http://www.FreeRTOS.org/Documentation * * http://www.FreeRTOS.org/Documentation *
@ -65,7 +55,6 @@
#ifndef PORTMACRO_H #ifndef PORTMACRO_H
#define PORTMACRO_H #define PORTMACRO_H
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif

View File

@ -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, * * + Looking for basic training, *
* + Wanting to improve your FreeRTOS skills and productivity * * + 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" * * "Using the FreeRTOS Real Time Kernel - a Practical Guide" *
* http://www.FreeRTOS.org/Documentation * * http://www.FreeRTOS.org/Documentation *

View File

@ -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, * * + Looking for basic training, *
* + Wanting to improve your FreeRTOS skills and productivity * * + 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" * * "Using the FreeRTOS Real Time Kernel - a Practical Guide" *
* http://www.FreeRTOS.org/Documentation * * 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 /* Keeps track of the number of free bytes remaining, but says nothing about
fragmentation. */ fragmentation. */
static size_t xFreeBytesRemaining; static size_t xFreeBytesRemaining = configTOTAL_HEAP_SIZE;
/* STATIC FUNCTIONS ARE DEFINED AS MACROS TO MINIMIZE THE FUNCTION CALL DEPTH. */ /* STATIC FUNCTIONS ARE DEFINED AS MACROS TO MINIMIZE THE FUNCTION CALL DEPTH. */
@ -148,8 +148,6 @@ xBlockLink *pxFirstFreeBlock; \
pxFirstFreeBlock = ( void * ) xHeap.ucHeap; \ pxFirstFreeBlock = ( void * ) xHeap.ucHeap; \
pxFirstFreeBlock->xBlockSize = configTOTAL_HEAP_SIZE; \ pxFirstFreeBlock->xBlockSize = configTOTAL_HEAP_SIZE; \
pxFirstFreeBlock->pxNextFreeBlock = &xEnd; \ pxFirstFreeBlock->pxNextFreeBlock = &xEnd; \
\
xFreeBytesRemaining = configTOTAL_HEAP_SIZE; \
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
@ -223,7 +221,7 @@ void *pvReturn = NULL;
prvInsertBlockIntoFreeList( ( pxNewBlockLink ) ); prvInsertBlockIntoFreeList( ( pxNewBlockLink ) );
} }
xFreeBytesRemaining -= xWantedSize; xFreeBytesRemaining -= pxBlock->xBlockSize;
} }
} }
} }

View File

@ -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, * * + Looking for basic training, *
* + Wanting to improve your FreeRTOS skills and productivity * * + 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" * * "Using the FreeRTOS Real Time Kernel - a Practical Guide" *
* http://www.FreeRTOS.org/Documentation * * http://www.FreeRTOS.org/Documentation *

17
flight/PiOS/STM32F10x/Libraries/FreeRTOS/Source/queue.c Normal file → Executable file
View File

@ -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, * * + Looking for basic training, *
* + Wanting to improve your FreeRTOS skills and productivity * * + 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" * * "Using the FreeRTOS Real Time Kernel - a Practical Guide" *
* http://www.FreeRTOS.org/Documentation * * http://www.FreeRTOS.org/Documentation *
@ -424,6 +415,10 @@ size_t xQueueSizeInBytes;
{ {
( pxMutex->uxRecursiveCallCount )++; ( pxMutex->uxRecursiveCallCount )++;
} }
else
{
traceTAKE_MUTEX_RECURSIVE_FAILED( pxMutex );
}
} }
return xReturn; return xReturn;

182
flight/PiOS/STM32F10x/Libraries/FreeRTOS/Source/tasks.c Normal file → Executable file
View File

@ -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, * * + Looking for basic training, *
* + Wanting to improve your FreeRTOS skills and productivity * * + 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" * * "Using the FreeRTOS Real Time Kernel - a Practical Guide" *
* http://www.FreeRTOS.org/Documentation * * http://www.FreeRTOS.org/Documentation *
@ -33,9 +33,9 @@
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT FreeRTOS is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 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 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 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 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 by writing to Richard Barry, contact details for whom are available on the
FreeRTOS WEB site. FreeRTOS WEB site.
@ -51,16 +51,6 @@
licensing and training services. licensing and training services.
*/ */
/**
* @file tasks.c
* @author FreeRTOS
* @addtogroup PIOS PIOS Core hardware abstraction layer
* @{
* @addtogroup FreeRTOS FreeRTOS Operating system
* @{
*/
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@ -82,8 +72,6 @@ task.h is included from an application file. */
*/ */
#define tskIDLE_STACK_SIZE configMINIMAL_STACK_SIZE #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, * Task control block. A task control block (TCB) is allocated to each task,
* and stores the context of the 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; signed portBASE_TYPE xReturn;
tskTCB * pxNewTCB; tskTCB * pxNewTCB;
portBASE_TYPE xRunPrivileged;
/* Allocate the memory required by the TCB and stack for the new task, /* Allocate the memory required by the TCB and stack for the new task,
checking that the allocation was successful. */ checking that the allocation was successful. */
@ -409,16 +396,19 @@ portBASE_TYPE xRunPrivileged;
{ {
portSTACK_TYPE *pxTopOfStack; portSTACK_TYPE *pxTopOfStack;
/* Should the task be created in privileged mode? */ #if( portUSING_MPU_WRAPPERS == 1 )
if( ( uxPriority & portPRIVILEGE_BIT ) != 0x00 ) /* Should the task be created in privileged mode? */
{ portBASE_TYPE xRunPrivileged;
xRunPrivileged = pdTRUE; if( ( uxPriority & portPRIVILEGE_BIT ) != 0x00 )
} {
else xRunPrivileged = pdTRUE;
{ }
xRunPrivileged = pdFALSE; else
} {
uxPriority &= ~portPRIVILEGE_BIT; xRunPrivileged = pdFALSE;
}
uxPriority &= ~portPRIVILEGE_BIT;
#endif /* portUSING_MPU_WRAPPERS == 1 */
/* Calculate the top of stack address. This depends on whether the /* 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. stack grows from high memory to low (as per the 80x86) or visa versa.
@ -454,24 +444,35 @@ portBASE_TYPE xRunPrivileged;
#else #else
{ {
pxNewTCB->pxTopOfStack = pxPortInitialiseStack( pxTopOfStack, pxTaskCode, pvParameters ); pxNewTCB->pxTopOfStack = pxPortInitialiseStack( pxTopOfStack, pxTaskCode, pvParameters );
( void ) xRunPrivileged;
} }
#endif #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 /* We are going to manipulate the task queues to add this task to a
ready list, so must make sure no interrupts occur. */ ready list, so must make sure no interrupts occur. */
portENTER_CRITICAL(); portENTER_CRITICAL();
{ {
uxCurrentNumberOfTasks++; 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; pxCurrentTCB = pxNewTCB;
/* This is the first task to be created so do the preliminary if( uxCurrentNumberOfTasks == ( unsigned portBASE_TYPE ) 1 )
initialisation required. We will not recover if this call {
fails, but we will report the failure. */ /* This is the first task to be created so do the preliminary
prvInitialiseTaskLists(); initialisation required. We will not recover if this call
fails, but we will report the failure. */
prvInitialiseTaskLists();
}
} }
else else
{ {
@ -512,19 +513,11 @@ portBASE_TYPE xRunPrivileged;
else else
{ {
xReturn = errCOULD_NOT_ALLOCATE_REQUIRED_MEMORY; xReturn = errCOULD_NOT_ALLOCATE_REQUIRED_MEMORY;
traceTASK_CREATE_FAILED( pxNewTCB ); traceTASK_CREATE_FAILED();
} }
if( xReturn == pdPASS ) 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( xSchedulerRunning != pdFALSE )
{ {
/* If the created task is of a higher priority than the current task /* If the created task is of a higher priority than the current task
@ -904,10 +897,31 @@ portBASE_TYPE xRunPrivileged;
} }
portEXIT_CRITICAL(); portEXIT_CRITICAL();
/* We may have just suspended the current task. */
if( ( void * ) pxTaskToSuspend == NULL ) 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 macro must be defined to configure the timer/counter used to generate
the run time counter time base. */ the run time counter time base. */
portCONFIGURE_TIMER_FOR_RUN_TIME_STATS(); portCONFIGURE_TIMER_FOR_RUN_TIME_STATS();
/* Setting up the timer tick is hardware specific and thus in the /* Setting up the timer tick is hardware specific and thus in the
portable interface. */ portable interface. */
if( xPortStartScheduler() ) if( xPortStartScheduler() )
@ -1186,6 +1200,12 @@ portTickType xTicks;
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
portTickType xTaskGetTickCountFromISR( void )
{
return xTickCount;
}
/*-----------------------------------------------------------*/
unsigned portBASE_TYPE uxTaskGetNumberOfTasks( void ) unsigned portBASE_TYPE uxTaskGetNumberOfTasks( void )
{ {
/* A critical section is not required because the variables are of type /* 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 ) void vTaskGetRunTimeStats( signed char *pcWriteBuffer )
{ {
unsigned portBASE_TYPE uxQueue; 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. /* This is a VERY costly function that should be used for debug only.
It leaves interrupts disabled for a LONG time. */ It leaves interrupts disabled for a LONG time. */
vTaskSuspendAll(); 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, /* Run through all the lists that could potentially contain a TCB,
generating a table of run timer percentages in the provided generating a table of run timer percentages in the provided
buffer. */ buffer. */
@ -1574,7 +1604,13 @@ void vTaskSwitchContext( void )
#if ( configGENERATE_RUN_TIME_STATS == 1 ) #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 /* 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 time so far. The time the task started running was stored in
@ -1753,7 +1789,7 @@ portBASE_TYPE xReturn;
passed since vTaskSetTimeout() was called. */ passed since vTaskSetTimeout() was called. */
xReturn = pdTRUE; 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. */ /* Not a genuine timeout. Adjust parameters for time remaining. */
*pxTicksToWait -= ( ( portTickType ) xTickCount - ( portTickType ) pxTimeOut->xTimeOnEntering ); *pxTicksToWait -= ( ( portTickType ) xTickCount - ( portTickType ) pxTimeOut->xTimeOnEntering );
@ -2049,7 +2085,16 @@ tskTCB *pxNewTCB;
do do
{ {
listGET_OWNER_OF_NEXT_ENTRY( pxNextTCB, pxList ); 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 ); 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 ); strcat( ( char * ) pcWriteBuffer, ( char * ) pcStatusString );
@ -2084,19 +2129,40 @@ tskTCB *pxNewTCB;
} }
else else
{ {
/* What percentage of the total run time as the task used? /* What percentage of the total run time has the task used?
This will always be rounded down to the nearest integer. */ This will always be rounded down to the nearest integer.
ulStatsAsPercentage = ( 100UL * pxNextTCB->ulRunTimeCounter ) / ulTotalRunTime; ulTotalRunTime has already been divided by 100. */
ulStatsAsPercentage = pxNextTCB->ulRunTimeCounter / ulTotalRunTime;
if( ulStatsAsPercentage > 0UL ) 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 else
{ {
/* If the percentage is zero here then the task has /* If the percentage is zero here then the task has
consumed less than 1% of the total run time. */ 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 ) if( xSchedulerRunning != pdFALSE )
{ {
pxCurrentTCB->uxCriticalNesting++; ( pxCurrentTCB->uxCriticalNesting )++;
} }
} }
@ -2299,7 +2365,7 @@ void vTaskExitCritical( void )
{ {
if( pxCurrentTCB->uxCriticalNesting > 0 ) if( pxCurrentTCB->uxCriticalNesting > 0 )
{ {
pxCurrentTCB->uxCriticalNesting--; ( pxCurrentTCB->uxCriticalNesting )--;
if( pxCurrentTCB->uxCriticalNesting == 0 ) if( pxCurrentTCB->uxCriticalNesting == 0 )
{ {