mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-17 02:52:12 +01:00
More of the 7.0 files for OSX simulation
This commit is contained in:
parent
356802b5ac
commit
99e246f151
@ -1,41 +1,47 @@
|
||||
/*
|
||||
FreeRTOS V6.0.4 - Copyright (C) 2010 Real Time Engineers Ltd.
|
||||
FreeRTOS V7.0.1 - Copyright (C) 2011 Real Time Engineers Ltd.
|
||||
|
||||
|
||||
FreeRTOS supports many tools and architectures. V7.0.0 is sponsored by:
|
||||
Atollic AB - Atollic provides professional embedded systems development
|
||||
tools for C/C++ development, code analysis and test automation.
|
||||
See http://www.atollic.com
|
||||
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* If you are: *
|
||||
* *
|
||||
* + New to FreeRTOS, *
|
||||
* + Wanting to learn FreeRTOS or multitasking in general quickly *
|
||||
* + Looking for basic training, *
|
||||
* + Wanting to improve your FreeRTOS skills and productivity *
|
||||
* *
|
||||
* then take a look at the FreeRTOS eBook *
|
||||
* *
|
||||
* "Using the FreeRTOS Real Time Kernel - a Practical Guide" *
|
||||
* http://www.FreeRTOS.org/Documentation *
|
||||
* *
|
||||
* A pdf reference manual is also available. Both are usually delivered *
|
||||
* to your inbox within 20 minutes to two hours when purchased between 8am *
|
||||
* and 8pm GMT (although please allow up to 24 hours in case of *
|
||||
* exceptional circumstances). Thank you for your support! *
|
||||
* *
|
||||
* *
|
||||
* FreeRTOS tutorial books are available in pdf and paperback. *
|
||||
* Complete, revised, and edited pdf reference manuals are also *
|
||||
* available. *
|
||||
* *
|
||||
* Purchasing FreeRTOS documentation will not only help you, by *
|
||||
* ensuring you get running as quickly as possible and with an *
|
||||
* in-depth knowledge of how to use FreeRTOS, it will also help *
|
||||
* the FreeRTOS project to continue with its mission of providing *
|
||||
* professional grade, cross platform, de facto standard solutions *
|
||||
* for microcontrollers - completely free of charge! *
|
||||
* *
|
||||
* >>> See http://www.FreeRTOS.org/Documentation for details. <<< *
|
||||
* *
|
||||
* Thank you for using FreeRTOS, and thank you for your support! *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
|
||||
This file is part of the FreeRTOS distribution.
|
||||
|
||||
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License (version 2) as published by the
|
||||
Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
|
||||
***NOTE*** The exception to the GPL is included to allow you to distribute
|
||||
a combined work that includes FreeRTOS without being obliged to provide the
|
||||
source code for proprietary components outside of the FreeRTOS kernel.
|
||||
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
|
||||
>>>NOTE<<< The modification to the GPL is included to allow you to
|
||||
distribute a combined work that includes FreeRTOS without being obliged to
|
||||
provide the source code for proprietary components outside of the FreeRTOS
|
||||
kernel. 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
|
||||
by writing to Richard Barry, contact details for whom are available on the
|
||||
FreeRTOS WEB site.
|
||||
|
||||
@ -222,7 +228,7 @@ static void prvCheckPendingReadyList( void )
|
||||
/* Are there any co-routines waiting to get moved to the ready list? These
|
||||
are co-routines that have been readied by an ISR. The ISR cannot access
|
||||
the ready lists itself. */
|
||||
while( !listLIST_IS_EMPTY( &xPendingReadyCoRoutineList ) )
|
||||
while( listLIST_IS_EMPTY( &xPendingReadyCoRoutineList ) == pdFALSE )
|
||||
{
|
||||
corCRCB *pxUnblockedCRCB;
|
||||
|
||||
@ -263,8 +269,10 @@ corCRCB *pxCRCB;
|
||||
}
|
||||
|
||||
/* See if this tick has made a timeout expire. */
|
||||
while( ( pxCRCB = ( corCRCB * ) listGET_OWNER_OF_HEAD_ENTRY( pxDelayedCoRoutineList ) ) != NULL )
|
||||
{
|
||||
while( listLIST_IS_EMPTY( pxDelayedCoRoutineList ) == pdFALSE )
|
||||
{
|
||||
pxCRCB = ( corCRCB * ) listGET_OWNER_OF_HEAD_ENTRY( pxDelayedCoRoutineList );
|
||||
|
||||
if( xCoRoutineTickCount < listGET_LIST_ITEM_VALUE( &( pxCRCB->xGenericListItem ) ) )
|
||||
{
|
||||
/* Timeout not yet expired. */
|
||||
@ -352,7 +360,8 @@ corCRCB *pxUnblockedCRCB;
|
||||
signed portBASE_TYPE xReturn;
|
||||
|
||||
/* This function is called from within an interrupt. It can only access
|
||||
event lists and the pending ready list. */
|
||||
event lists and the pending ready list. This function assumes that a
|
||||
check has already been made to ensure pxEventList is not empty. */
|
||||
pxUnblockedCRCB = ( corCRCB * ) listGET_OWNER_OF_HEAD_ENTRY( pxEventList );
|
||||
vListRemove( &( pxUnblockedCRCB->xEventListItem ) );
|
||||
vListInsertEnd( ( xList * ) &( xPendingReadyCoRoutineList ), &( pxUnblockedCRCB->xEventListItem ) );
|
||||
|
@ -1311,6 +1311,8 @@ void vTaskPriorityDisinherit( xTaskHandle * const pxMutexHolder ) PRIVILEGED_FUN
|
||||
*/
|
||||
signed portBASE_TYPE xTaskGenericCreate( pdTASK_CODE pxTaskCode, 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;
|
||||
|
||||
void printTasks();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -430,22 +430,12 @@ void vPortEnterCritical( void )
|
||||
|
||||
void vPortExitCritical( void )
|
||||
{
|
||||
/* Check for unmatched exits. */
|
||||
if ( uxCriticalNesting > 0 )
|
||||
{
|
||||
uxCriticalNesting--;
|
||||
}
|
||||
uxCriticalNesting--;
|
||||
assert(uxCriticalNesting >= 0);
|
||||
|
||||
/* If we have reached 0 then re-enable the interrupts. */
|
||||
if( uxCriticalNesting == 0 )
|
||||
if( uxCriticalNesting == 0)
|
||||
{
|
||||
/* Have we missed ticks? This is the equivalent of pending an interrupt. */
|
||||
if ( pdTRUE == xPendYield )
|
||||
{
|
||||
xPendYield = pdFALSE;
|
||||
// vPortYield();
|
||||
}
|
||||
vPortEnableInterrupts();
|
||||
portENABLE_INTERRUPTS();
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
@ -870,8 +860,8 @@ void pauseThread( portBASE_TYPE pauseMode )
|
||||
} else {
|
||||
static int i;
|
||||
i ++;
|
||||
//if(i % 1000 == 0)
|
||||
//printTasks();
|
||||
if(i % 1000 == 0)
|
||||
printTasks();
|
||||
}
|
||||
|
||||
#else
|
||||
|
@ -1984,6 +1984,11 @@ static portTASK_FUNCTION( prvIdleTask, pvParameters )
|
||||
vApplicationIdleHook();
|
||||
}
|
||||
#endif
|
||||
|
||||
static int i = 0;
|
||||
i++;
|
||||
if (i % 100000 == 0)
|
||||
printTasks();
|
||||
}
|
||||
} /*lint !e715 pvParameters is not accessed but all task functions require the same prototype. */
|
||||
|
||||
@ -2532,6 +2537,94 @@ void vTaskExitCritical( void )
|
||||
#endif
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
||||
static void printNamesInList( const signed char *pcWriteBuffer, xList *pxList)
|
||||
{
|
||||
volatile tskTCB *pxNextTCB, *pxFirstTCB;
|
||||
char pcStatsString[100];
|
||||
/* Write the run time stats of all the TCB's in pxList into the buffer. */
|
||||
listGET_OWNER_OF_NEXT_ENTRY( pxFirstTCB, pxList );
|
||||
do
|
||||
{
|
||||
/* Get next TCB in from the list. */
|
||||
listGET_OWNER_OF_NEXT_ENTRY( pxNextTCB, pxList );
|
||||
if(pxNextTCB) {
|
||||
sprintf( pcStatsString, ( char * ) "%s, ", pxNextTCB->pcTaskName);
|
||||
|
||||
strcat( ( char * ) pcWriteBuffer, ( char * ) pcStatsString );
|
||||
}
|
||||
|
||||
} while( pxNextTCB != pxFirstTCB );
|
||||
}
|
||||
|
||||
void printTasks()
|
||||
{
|
||||
signed char pcWriteBuffer[500];
|
||||
int uxQueue;
|
||||
taskENTER_CRITICAL();
|
||||
{
|
||||
/* Run through all the lists that could potentially contain a TCB,
|
||||
generating a table of run timer percentages in the provided
|
||||
buffer. */
|
||||
|
||||
pcWriteBuffer[ 0 ] = ( signed char ) 0x00;
|
||||
|
||||
uxQueue = uxTopUsedPriority + 1;
|
||||
|
||||
do
|
||||
{
|
||||
uxQueue--;
|
||||
|
||||
if( !listLIST_IS_EMPTY( &( pxReadyTasksLists[ uxQueue ] ) ) )
|
||||
{
|
||||
char readyMessage[30];
|
||||
sprintf(readyMessage, "\r\nReady priority %d: ", uxQueue);
|
||||
strcat( ( char * ) pcWriteBuffer,readyMessage);
|
||||
printNamesInList( pcWriteBuffer, ( xList * ) &( pxReadyTasksLists[ uxQueue ] ));
|
||||
}
|
||||
}while( uxQueue > ( unsigned short ) tskIDLE_PRIORITY );
|
||||
|
||||
if( !listLIST_IS_EMPTY( pxDelayedTaskList ) )
|
||||
{
|
||||
strcat( ( char * ) pcWriteBuffer, "\r\nDelay: ");
|
||||
printNamesInList( pcWriteBuffer, ( xList * ) &( pxDelayedTaskList));
|
||||
}
|
||||
|
||||
if( !listLIST_IS_EMPTY( pxOverflowDelayedTaskList ) )
|
||||
{
|
||||
strcat( ( char * ) pcWriteBuffer, "\r\nDelay Overflow: ");
|
||||
printNamesInList( pcWriteBuffer, ( xList * ) pxOverflowDelayedTaskList);
|
||||
}
|
||||
|
||||
if( !listLIST_IS_EMPTY( &xPendingReadyList ) )
|
||||
{
|
||||
strcat( ( char * ) pcWriteBuffer, "\r\nPending ready: ");
|
||||
printNamesInList( pcWriteBuffer, ( xList * ) &xPendingReadyList);
|
||||
}
|
||||
|
||||
#if ( INCLUDE_vTaskDelete == 1 )
|
||||
{
|
||||
if( !listLIST_IS_EMPTY( &xTasksWaitingTermination ) )
|
||||
{
|
||||
strcat( ( char * ) pcWriteBuffer, "\r\nWaiting termination: ");
|
||||
printNamesInList( pcWriteBuffer, ( xList * ) &xTasksWaitingTermination);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if ( INCLUDE_vTaskSuspend == 1 )
|
||||
{
|
||||
if( !listLIST_IS_EMPTY( &xSuspendedTaskList ) )
|
||||
{
|
||||
strcat( ( char * ) pcWriteBuffer, "\r\nSuspended: ");
|
||||
printNamesInList( pcWriteBuffer, ( xList * ) &xSuspendedTaskList);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
strcat( (char *) pcWriteBuffer, "\r\n\r\n");
|
||||
fprintf(stderr, "%s", ( char * ) pcWriteBuffer);
|
||||
taskEXIT_CRITICAL();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user