diff --git a/flight/pios/common/libraries/FreeRTOS/Source/croutine.c b/flight/pios/common/libraries/FreeRTOS/Source/croutine.c index 0f481a552..047f1bf88 100644 --- a/flight/pios/common/libraries/FreeRTOS/Source/croutine.c +++ b/flight/pios/common/libraries/FreeRTOS/Source/croutine.c @@ -1,5 +1,5 @@ /* - FreeRTOS V8.0.0 - Copyright (C) 2014 Real Time Engineers Ltd. + FreeRTOS V8.0.1 - Copyright (C) 2014 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -24,10 +24,10 @@ 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 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. + >>! 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 @@ -292,7 +292,7 @@ CRCB_t *pxCRCB; have been moved to the pending ready list and the following line is still valid. Also the pvContainer parameter will have been set to NULL so the following lines are also valid. */ - uxListRemove( &( pxCRCB->xGenericListItem ) ); + ( void ) uxListRemove( &( pxCRCB->xGenericListItem ) ); /* Is the co-routine waiting on an event also? */ if( pxCRCB->xEventListItem.pvContainer ) diff --git a/flight/pios/common/libraries/FreeRTOS/Source/event_groups.c b/flight/pios/common/libraries/FreeRTOS/Source/event_groups.c index 11e40044e..cc5b6a815 100644 --- a/flight/pios/common/libraries/FreeRTOS/Source/event_groups.c +++ b/flight/pios/common/libraries/FreeRTOS/Source/event_groups.c @@ -1,5 +1,5 @@ /* - FreeRTOS V8.0.0 - Copyright (C) 2014 Real Time Engineers Ltd. + FreeRTOS V8.0.1 - Copyright (C) 2014 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -24,10 +24,10 @@ 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 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. + >>! 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 @@ -179,7 +179,7 @@ BaseType_t xTimeoutOccurred = pdFALSE; /* Rendezvous always clear the bits. They will have been cleared already unless this is the only task in the rendezvous. */ - pxEventBits->uxEventBits &= uxBitsToWaitFor; + pxEventBits->uxEventBits &= ~uxBitsToWaitFor; xTicksToWait = 0; } @@ -237,7 +237,7 @@ BaseType_t xTimeoutOccurred = pdFALSE; /* Although the task got here because it timed out before the bits it was waiting for were set, it is possible that since it unblocked another task has set the bits. If this is the case - then it may be required to clear the bits before exiting. */ + then it needs to clear the bits before exiting. */ if( ( uxReturn & uxBitsToWaitFor ) == uxBitsToWaitFor ) { pxEventBits->uxEventBits &= ~uxBitsToWaitFor; @@ -253,13 +253,16 @@ BaseType_t xTimeoutOccurred = pdFALSE; } else { - /* The task unblocked because the bits were set. Clear the control - bits before returning the value. */ - uxReturn &= ~eventEVENT_BITS_CONTROL_BYTES; + /* The task unblocked because the bits were set. */ } + + /* Control bits might be set as the task had blocked should not be + returned. */ + uxReturn &= ~eventEVENT_BITS_CONTROL_BYTES; } traceEVENT_GROUP_SYNC_END( xEventGroup, uxBitsToSet, uxBitsToWaitFor, xTimeoutOccurred ); + return uxReturn; } /*-----------------------------------------------------------*/ @@ -394,16 +397,19 @@ BaseType_t xTimeoutOccurred = pdFALSE; } taskEXIT_CRITICAL(); + /* Prevent compiler warnings when trace macros are not used. */ xTimeoutOccurred = pdFALSE; } else { - /* The task unblocked because the bits were set. Clear the control - bits before returning the value. */ - uxReturn &= ~eventEVENT_BITS_CONTROL_BYTES; + /* The task unblocked because the bits were set. */ } + + /* The task blocked so control bits may have been set. */ + uxReturn &= ~eventEVENT_BITS_CONTROL_BYTES; } traceEVENT_GROUP_WAIT_BITS_END( xEventGroup, uxBitsToWaitFor, xTimeoutOccurred ); + return uxReturn; } /*-----------------------------------------------------------*/ @@ -434,26 +440,30 @@ EventBits_t uxReturn; } /*-----------------------------------------------------------*/ -EventBits_t xEventGroupClearBitsFromISR( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToClear ) +#if ( ( configUSE_TRACE_FACILITY == 1 ) && ( INCLUDE_xTimerPendFunctionCall == 1 ) && ( configUSE_TIMERS == 1 ) ) + + BaseType_t xEventGroupClearBitsFromISR( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToClear ) + { + BaseType_t xReturn; + + traceEVENT_GROUP_CLEAR_BITS_FROM_ISR( xEventGroup, uxBitsToClear ); + xReturn = xTimerPendFunctionCallFromISR( vEventGroupClearBitsCallback, ( void * ) xEventGroup, ( uint32_t ) uxBitsToClear, NULL ); + + return xReturn; + } + +#endif +/*-----------------------------------------------------------*/ + +EventBits_t xEventGroupGetBitsFromISR( EventGroupHandle_t xEventGroup ) { UBaseType_t uxSavedInterruptStatus; EventGroup_t *pxEventBits = ( EventGroup_t * ) xEventGroup; EventBits_t uxReturn; - /* Check the user is not attempting to clear the bits used by the kernel - itself. */ - configASSERT( ( uxBitsToClear & eventEVENT_BITS_CONTROL_BYTES ) == 0 ); - uxSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR(); { - traceEVENT_GROUP_CLEAR_BITS_FROM_ISR( xEventGroup, uxBitsToClear ); - - /* The value returned is the event group value prior to the bits being - cleared. */ uxReturn = pxEventBits->uxEventBits; - - /* Clear the bits. */ - pxEventBits->uxEventBits &= ~uxBitsToClear; } portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedInterruptStatus ); @@ -585,6 +595,14 @@ void vEventGroupSetBitsCallback( void *pvEventGroup, const uint32_t ulBitsToSet } /*-----------------------------------------------------------*/ +/* For internal use only - execute a 'clear bits' command that was pended from +an interrupt. */ +void vEventGroupClearBitsCallback( void *pvEventGroup, const uint32_t ulBitsToClear ) +{ + ( void ) xEventGroupClearBits( pvEventGroup, ( EventBits_t ) ulBitsToClear ); +} +/*-----------------------------------------------------------*/ + static BaseType_t prvTestWaitCondition( const EventBits_t uxCurrentEventBits, const EventBits_t uxBitsToWaitFor, const BaseType_t xWaitForAllBits ) { BaseType_t xWaitConditionMet = pdFALSE; @@ -621,6 +639,7 @@ BaseType_t xWaitConditionMet = pdFALSE; /*-----------------------------------------------------------*/ #if ( ( configUSE_TRACE_FACILITY == 1 ) && ( INCLUDE_xTimerPendFunctionCall == 1 ) && ( configUSE_TIMERS == 1 ) ) + BaseType_t xEventGroupSetBitsFromISR( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToSet, BaseType_t *pxHigherPriorityTaskWoken ) { BaseType_t xReturn; @@ -630,10 +649,12 @@ BaseType_t xWaitConditionMet = pdFALSE; return xReturn; } + #endif /*-----------------------------------------------------------*/ #if (configUSE_TRACE_FACILITY == 1) + UBaseType_t uxEventGroupGetNumber( void* xEventGroup ) { UBaseType_t xReturn; @@ -650,5 +671,6 @@ BaseType_t xWaitConditionMet = pdFALSE; return xReturn; } + #endif diff --git a/flight/pios/common/libraries/FreeRTOS/Source/include/FreeRTOS.h b/flight/pios/common/libraries/FreeRTOS/Source/include/FreeRTOS.h index 8362ec4bd..349a08594 100644 --- a/flight/pios/common/libraries/FreeRTOS/Source/include/FreeRTOS.h +++ b/flight/pios/common/libraries/FreeRTOS/Source/include/FreeRTOS.h @@ -1,5 +1,5 @@ /* - FreeRTOS V8.0.0 - Copyright (C) 2014 Real Time Engineers Ltd. + FreeRTOS V8.0.1 - Copyright (C) 2014 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -24,10 +24,10 @@ 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 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. + >>! 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 diff --git a/flight/pios/common/libraries/FreeRTOS/Source/include/StackMacros.h b/flight/pios/common/libraries/FreeRTOS/Source/include/StackMacros.h index dfdcff317..13f3a0f2b 100644 --- a/flight/pios/common/libraries/FreeRTOS/Source/include/StackMacros.h +++ b/flight/pios/common/libraries/FreeRTOS/Source/include/StackMacros.h @@ -1,5 +1,5 @@ /* - FreeRTOS V8.0.0 - Copyright (C) 2014 Real Time Engineers Ltd. + FreeRTOS V8.0.1 - Copyright (C) 2014 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -24,10 +24,10 @@ 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 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. + >>! 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 diff --git a/flight/pios/common/libraries/FreeRTOS/Source/include/croutine.h b/flight/pios/common/libraries/FreeRTOS/Source/include/croutine.h index a1ca754db..cd5a54d8a 100644 --- a/flight/pios/common/libraries/FreeRTOS/Source/include/croutine.h +++ b/flight/pios/common/libraries/FreeRTOS/Source/include/croutine.h @@ -1,5 +1,5 @@ /* - FreeRTOS V8.0.0 - Copyright (C) 2014 Real Time Engineers Ltd. + FreeRTOS V8.0.1 - Copyright (C) 2014 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -24,10 +24,10 @@ 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 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. + >>! 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 diff --git a/flight/pios/common/libraries/FreeRTOS/Source/include/event_groups.h b/flight/pios/common/libraries/FreeRTOS/Source/include/event_groups.h index f6dd2a525..ef066e677 100644 --- a/flight/pios/common/libraries/FreeRTOS/Source/include/event_groups.h +++ b/flight/pios/common/libraries/FreeRTOS/Source/include/event_groups.h @@ -1,5 +1,5 @@ /* - FreeRTOS V8.0.0 - Copyright (C) 2014 Real Time Engineers Ltd. + FreeRTOS V8.0.1 - Copyright (C) 2014 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -24,10 +24,10 @@ 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 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. + >>! 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 @@ -325,16 +325,61 @@ EventBits_t xEventGroupClearBits( EventGroupHandle_t xEventGroup, const EventBit /** * event_groups.h *
-	EventBits_t xEventGroupClearBitsFromISR( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToClear );
+	BaseType_t xEventGroupClearBitsFromISR( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToSet );
  
* - * A version of xEventGroupClearBits() that can be called from an interrupt - * service routine. See the xEventGroupClearBits() documentation. + * A version of xEventGroupClearBits() that can be called from an interrupt. * - * \defgroup xEventGroupClearBitsFromISR xEventGroupClearBitsFromISR + * Setting bits in an event group is not a deterministic operation because there + * are an unknown number of tasks that may be waiting for the bit or bits being + * set. FreeRTOS does not allow nondeterministic operations to be performed + * while interrupts are disabled, so protects event groups that are accessed + * from tasks by suspending the scheduler rather than disabling interrupts. As + * a result event groups cannot be accessed directly from an interrupt service + * routine. Therefore xEventGroupClearBitsFromISR() sends a message to the + * timer task to have the clear operation performed in the context of the timer + * task. + * + * @param xEventGroup The event group in which the bits are to be cleared. + * + * @param uxBitsToClear A bitwise value that indicates the bit or bits to clear. + * For example, to clear bit 3 only, set uxBitsToClear to 0x08. To clear bit 3 + * and bit 0 set uxBitsToClear to 0x09. + * + * @return If the request to execute the function was posted successfully then + * pdPASS is returned, otherwise pdFALSE is returned. pdFALSE will be returned + * if the timer service queue was full. + * + * Example usage: +
+   #define BIT_0	( 1 << 0 )
+   #define BIT_4	( 1 << 4 )
+
+   // An event group which it is assumed has already been created by a call to
+   // xEventGroupCreate().
+   EventGroupHandle_t xEventGroup;
+
+   void anInterruptHandler( void )
+   {
+		// Clear bit 0 and bit 4 in xEventGroup.
+		xResult = xEventGroupClearBitsFromISR(
+							xEventGroup,	 // The event group being updated.
+							BIT_0 | BIT_4 ); // The bits being set.
+
+		if( xResult == pdPASS )
+		{
+			// The message was posted successfully.
+		}
+  }
+   
+ * \defgroup xEventGroupSetBitsFromISR xEventGroupSetBitsFromISR * \ingroup EventGroup */ -EventBits_t xEventGroupClearBitsFromISR( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToClear ) PRIVILEGED_FUNCTION; +#if( configUSE_TRACE_FACILITY == 1 ) + BaseType_t xEventGroupClearBitsFromISR( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToSet ); +#else + #define xEventGroupClearBitsFromISR( xEventGroup, uxBitsToClear ) xTimerPendFunctionCallFromISR( vEventGroupClearBitsCallback, ( void * ) xEventGroup, ( uint32_t ) uxBitsToClear, NULL ) +#endif /** * event_groups.h @@ -648,7 +693,7 @@ EventBits_t xEventGroupSync( EventGroupHandle_t xEventGroup, const EventBits_t u * \defgroup xEventGroupGetBitsFromISR xEventGroupGetBitsFromISR * \ingroup EventGroup */ -#define xEventGroupGetBitsFromISR( xEventGroup ) xEventGroupClearBitsFromISR( xEventGroup, 0 ) +EventBits_t xEventGroupGetBitsFromISR( EventGroupHandle_t xEventGroup ); /** * event_groups.h @@ -666,6 +711,7 @@ void vEventGroupDelete( EventGroupHandle_t xEventGroup ); /* For internal use only. */ void vEventGroupSetBitsCallback( void *pvEventGroup, const uint32_t ulBitsToSet ); +void vEventGroupClearBitsCallback( void *pvEventGroup, const uint32_t ulBitsToClear ); #if (configUSE_TRACE_FACILITY == 1) UBaseType_t uxEventGroupGetNumber( void* xEventGroup ); diff --git a/flight/pios/common/libraries/FreeRTOS/Source/include/list.h b/flight/pios/common/libraries/FreeRTOS/Source/include/list.h index 183dc84ab..cb99f313d 100644 --- a/flight/pios/common/libraries/FreeRTOS/Source/include/list.h +++ b/flight/pios/common/libraries/FreeRTOS/Source/include/list.h @@ -1,5 +1,5 @@ /* - FreeRTOS V8.0.0 - Copyright (C) 2014 Real Time Engineers Ltd. + FreeRTOS V8.0.1 - Copyright (C) 2014 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -24,10 +24,10 @@ 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 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. + >>! 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 diff --git a/flight/pios/common/libraries/FreeRTOS/Source/include/mpu_wrappers.h b/flight/pios/common/libraries/FreeRTOS/Source/include/mpu_wrappers.h index 2893681e5..2a6983041 100644 --- a/flight/pios/common/libraries/FreeRTOS/Source/include/mpu_wrappers.h +++ b/flight/pios/common/libraries/FreeRTOS/Source/include/mpu_wrappers.h @@ -1,5 +1,5 @@ /* - FreeRTOS V8.0.0 - Copyright (C) 2014 Real Time Engineers Ltd. + FreeRTOS V8.0.1 - Copyright (C) 2014 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -24,10 +24,10 @@ 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 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. + >>! 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 @@ -117,6 +117,7 @@ only for ports that are using the MPU. */ #define xQueueAddToSet MPU_xQueueAddToSet #define xQueueRemoveFromSet MPU_xQueueRemoveFromSet #define xQueuePeekFromISR MPU_xQueuePeekFromISR + #define xQueueGetMutexHolder MPU_xQueueGetMutexHolder #define pvPortMalloc MPU_pvPortMalloc #define vPortFree MPU_vPortFree diff --git a/flight/pios/common/libraries/FreeRTOS/Source/include/portable.h b/flight/pios/common/libraries/FreeRTOS/Source/include/portable.h index 59829eb5e..516ca2410 100644 --- a/flight/pios/common/libraries/FreeRTOS/Source/include/portable.h +++ b/flight/pios/common/libraries/FreeRTOS/Source/include/portable.h @@ -1,5 +1,5 @@ /* - FreeRTOS V8.0.0 - Copyright (C) 2014 Real Time Engineers Ltd. + FreeRTOS V8.0.1 - Copyright (C) 2014 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -24,10 +24,10 @@ 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 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. + >>! 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 diff --git a/flight/pios/common/libraries/FreeRTOS/Source/include/projdefs.h b/flight/pios/common/libraries/FreeRTOS/Source/include/projdefs.h index 813b4d036..deeb5dd24 100644 --- a/flight/pios/common/libraries/FreeRTOS/Source/include/projdefs.h +++ b/flight/pios/common/libraries/FreeRTOS/Source/include/projdefs.h @@ -1,5 +1,5 @@ /* - FreeRTOS V8.0.0 - Copyright (C) 2014 Real Time Engineers Ltd. + FreeRTOS V8.0.1 - Copyright (C) 2014 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -24,10 +24,10 @@ 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 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. + >>! 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 diff --git a/flight/pios/common/libraries/FreeRTOS/Source/include/queue.h b/flight/pios/common/libraries/FreeRTOS/Source/include/queue.h index f42ac8689..8eb3f2992 100644 --- a/flight/pios/common/libraries/FreeRTOS/Source/include/queue.h +++ b/flight/pios/common/libraries/FreeRTOS/Source/include/queue.h @@ -1,5 +1,5 @@ /* - FreeRTOS V8.0.0 - Copyright (C) 2014 Real Time Engineers Ltd. + FreeRTOS V8.0.1 - Copyright (C) 2014 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -24,10 +24,10 @@ 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 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. + >>! 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 diff --git a/flight/pios/common/libraries/FreeRTOS/Source/include/semphr.h b/flight/pios/common/libraries/FreeRTOS/Source/include/semphr.h index 47bb87c5d..feeadc0b7 100644 --- a/flight/pios/common/libraries/FreeRTOS/Source/include/semphr.h +++ b/flight/pios/common/libraries/FreeRTOS/Source/include/semphr.h @@ -1,5 +1,5 @@ /* - FreeRTOS V8.0.0 - Copyright (C) 2014 Real Time Engineers Ltd. + FreeRTOS V8.0.1 - Copyright (C) 2014 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -24,10 +24,10 @@ 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 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. + >>! 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 diff --git a/flight/pios/common/libraries/FreeRTOS/Source/include/task.h b/flight/pios/common/libraries/FreeRTOS/Source/include/task.h index 03afd4def..0824f054d 100644 --- a/flight/pios/common/libraries/FreeRTOS/Source/include/task.h +++ b/flight/pios/common/libraries/FreeRTOS/Source/include/task.h @@ -1,5 +1,5 @@ /* - FreeRTOS V8.0.0 - Copyright (C) 2014 Real Time Engineers Ltd. + FreeRTOS V8.0.1 - Copyright (C) 2014 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -24,10 +24,10 @@ 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 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. + >>! 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 @@ -81,10 +81,10 @@ extern "C" { * MACROS AND DEFINITIONS *----------------------------------------------------------*/ -#define tskKERNEL_VERSION_NUMBER "V8.0.0" +#define tskKERNEL_VERSION_NUMBER "V8.0.1" #define tskKERNEL_VERSION_MAJOR 8 #define tskKERNEL_VERSION_MINOR 0 -#define tskKERNEL_VERSION_BUILD 0 +#define tskKERNEL_VERSION_BUILD 1 /** * task. h diff --git a/flight/pios/common/libraries/FreeRTOS/Source/include/timers.h b/flight/pios/common/libraries/FreeRTOS/Source/include/timers.h index 27ea841e2..1c377c35b 100644 --- a/flight/pios/common/libraries/FreeRTOS/Source/include/timers.h +++ b/flight/pios/common/libraries/FreeRTOS/Source/include/timers.h @@ -1,5 +1,5 @@ /* - FreeRTOS V8.0.0 - Copyright (C) 2014 Real Time Engineers Ltd. + FreeRTOS V8.0.1 - Copyright (C) 2014 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -24,10 +24,10 @@ 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 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. + >>! 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 @@ -1094,6 +1094,17 @@ BaseType_t xTimerPendFunctionCallFromISR( PendedFunction_t xFunctionToPend, void */ BaseType_t xTimerPendFunctionCall( PendedFunction_t xFunctionToPend, void *pvParameter1, uint32_t ulParameter2, TickType_t xTicksToWait ); +/** + * const char * const pcTimerGetTimerName( TimerHandle_t xTimer ); + * + * Returns the name that was assigned to a timer when the timer was created. + * + * @param xTimer The handle of the timer being queried. + * + * @return The name assigned to the timer specified by the xTimer parameter. + */ +const char * pcTimerGetTimerName( TimerHandle_t xTimer ); + /* * Functions beyond this part are not part of the public API and are intended * for use by the kernel only. diff --git a/flight/pios/common/libraries/FreeRTOS/Source/list.c b/flight/pios/common/libraries/FreeRTOS/Source/list.c index 307f95691..3883e9b02 100644 --- a/flight/pios/common/libraries/FreeRTOS/Source/list.c +++ b/flight/pios/common/libraries/FreeRTOS/Source/list.c @@ -1,5 +1,5 @@ /* - FreeRTOS V8.0.0 - Copyright (C) 2014 Real Time Engineers Ltd. + FreeRTOS V8.0.1 - Copyright (C) 2014 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -24,10 +24,10 @@ 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 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. + >>! 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 diff --git a/flight/pios/common/libraries/FreeRTOS/Source/portable/GCC/ARM_CM0/port.c b/flight/pios/common/libraries/FreeRTOS/Source/portable/GCC/ARM_CM0/port.c index 1f654a754..d10f099af 100644 --- a/flight/pios/common/libraries/FreeRTOS/Source/portable/GCC/ARM_CM0/port.c +++ b/flight/pios/common/libraries/FreeRTOS/Source/portable/GCC/ARM_CM0/port.c @@ -1,5 +1,5 @@ /* - FreeRTOS V8.0.0 - Copyright (C) 2014 Real Time Engineers Ltd. + FreeRTOS V8.0.1 - Copyright (C) 2014 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -24,10 +24,10 @@ 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 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. + >>! 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 diff --git a/flight/pios/common/libraries/FreeRTOS/Source/portable/GCC/ARM_CM0/portmacro.h b/flight/pios/common/libraries/FreeRTOS/Source/portable/GCC/ARM_CM0/portmacro.h index 4026d0621..bb8948222 100644 --- a/flight/pios/common/libraries/FreeRTOS/Source/portable/GCC/ARM_CM0/portmacro.h +++ b/flight/pios/common/libraries/FreeRTOS/Source/portable/GCC/ARM_CM0/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS V8.0.0 - Copyright (C) 2014 Real Time Engineers Ltd. + FreeRTOS V8.0.1 - Copyright (C) 2014 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -24,10 +24,10 @@ 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 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. + >>! 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 diff --git a/flight/pios/common/libraries/FreeRTOS/Source/portable/GCC/ARM_CM3/port.c b/flight/pios/common/libraries/FreeRTOS/Source/portable/GCC/ARM_CM3/port.c index 42194616f..916ddfc97 100644 --- a/flight/pios/common/libraries/FreeRTOS/Source/portable/GCC/ARM_CM3/port.c +++ b/flight/pios/common/libraries/FreeRTOS/Source/portable/GCC/ARM_CM3/port.c @@ -1,5 +1,5 @@ /* - FreeRTOS V8.0.0 - Copyright (C) 2014 Real Time Engineers Ltd. + FreeRTOS V8.0.1 - Copyright (C) 2014 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -24,10 +24,10 @@ 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 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. + >>! 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 diff --git a/flight/pios/common/libraries/FreeRTOS/Source/portable/GCC/ARM_CM3/portmacro.h b/flight/pios/common/libraries/FreeRTOS/Source/portable/GCC/ARM_CM3/portmacro.h index 17810e6fb..e403ca053 100644 --- a/flight/pios/common/libraries/FreeRTOS/Source/portable/GCC/ARM_CM3/portmacro.h +++ b/flight/pios/common/libraries/FreeRTOS/Source/portable/GCC/ARM_CM3/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS V8.0.0 - Copyright (C) 2014 Real Time Engineers Ltd. + FreeRTOS V8.0.1 - Copyright (C) 2014 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -24,10 +24,10 @@ 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 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. + >>! 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 diff --git a/flight/pios/common/libraries/FreeRTOS/Source/portable/GCC/ARM_CM3_MPU/port.c b/flight/pios/common/libraries/FreeRTOS/Source/portable/GCC/ARM_CM3_MPU/port.c index 460ac2bda..e05f2532f 100644 --- a/flight/pios/common/libraries/FreeRTOS/Source/portable/GCC/ARM_CM3_MPU/port.c +++ b/flight/pios/common/libraries/FreeRTOS/Source/portable/GCC/ARM_CM3_MPU/port.c @@ -1,5 +1,5 @@ /* - FreeRTOS V8.0.0 - Copyright (C) 2014 Real Time Engineers Ltd. + FreeRTOS V8.0.1 - Copyright (C) 2014 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -24,10 +24,10 @@ 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 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. + >>! 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 @@ -216,6 +216,7 @@ QueueSetMemberHandle_t MPU_xQueueSelectFromSet( QueueSetHandle_t xQueueSet, Tick BaseType_t MPU_xQueueAddToSet( QueueSetMemberHandle_t xQueueOrSemaphore, QueueSetHandle_t xQueueSet ); BaseType_t MPU_xQueueRemoveFromSet( QueueSetMemberHandle_t xQueueOrSemaphore, QueueSetHandle_t xQueueSet ); BaseType_t MPU_xQueuePeekFromISR( QueueHandle_t xQueue, void * const pvBuffer ); +void* MPU_xQueueGetMutexHolder( QueueHandle_t xSemaphore ); /*-----------------------------------------------------------*/ @@ -1016,6 +1017,17 @@ BaseType_t xReturn; } /*-----------------------------------------------------------*/ +void* MPU_xQueueGetMutexHolder( QueueHandle_t xSemaphore ) +{ +BaseType_t xRunningPrivileged = prvRaisePrivilege(); +void * xReturn; + + xReturn = ( void * ) xQueueGetMutexHolder( xSemaphore ); + portRESET_PRIVILEGE( xRunningPrivileged ); + return xReturn; +} +/*-----------------------------------------------------------*/ + #if ( configUSE_MUTEXES == 1 ) QueueHandle_t MPU_xQueueCreateMutex( void ) { diff --git a/flight/pios/common/libraries/FreeRTOS/Source/portable/GCC/ARM_CM3_MPU/portmacro.h b/flight/pios/common/libraries/FreeRTOS/Source/portable/GCC/ARM_CM3_MPU/portmacro.h index e8408baa9..03c1493ce 100644 --- a/flight/pios/common/libraries/FreeRTOS/Source/portable/GCC/ARM_CM3_MPU/portmacro.h +++ b/flight/pios/common/libraries/FreeRTOS/Source/portable/GCC/ARM_CM3_MPU/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS V8.0.0 - Copyright (C) 2014 Real Time Engineers Ltd. + FreeRTOS V8.0.1 - Copyright (C) 2014 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -24,10 +24,10 @@ 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 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. + >>! 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 diff --git a/flight/pios/common/libraries/FreeRTOS/Source/portable/GCC/ARM_CM4F/port.c b/flight/pios/common/libraries/FreeRTOS/Source/portable/GCC/ARM_CM4F/port.c index 2bb541415..03b3e55a8 100644 --- a/flight/pios/common/libraries/FreeRTOS/Source/portable/GCC/ARM_CM4F/port.c +++ b/flight/pios/common/libraries/FreeRTOS/Source/portable/GCC/ARM_CM4F/port.c @@ -1,5 +1,5 @@ /* - FreeRTOS V8.0.0 - Copyright (C) 2014 Real Time Engineers Ltd. + FreeRTOS V8.0.1 - Copyright (C) 2014 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -24,10 +24,10 @@ 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 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. + >>! 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 diff --git a/flight/pios/common/libraries/FreeRTOS/Source/portable/GCC/ARM_CM4F/portmacro.h b/flight/pios/common/libraries/FreeRTOS/Source/portable/GCC/ARM_CM4F/portmacro.h index 239e0666c..84669a046 100644 --- a/flight/pios/common/libraries/FreeRTOS/Source/portable/GCC/ARM_CM4F/portmacro.h +++ b/flight/pios/common/libraries/FreeRTOS/Source/portable/GCC/ARM_CM4F/portmacro.h @@ -1,5 +1,5 @@ /* - FreeRTOS V8.0.0 - Copyright (C) 2014 Real Time Engineers Ltd. + FreeRTOS V8.0.1 - Copyright (C) 2014 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -24,10 +24,10 @@ 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 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. + >>! 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 diff --git a/flight/pios/common/libraries/FreeRTOS/Source/portable/MSVC-MingW/port.c b/flight/pios/common/libraries/FreeRTOS/Source/portable/MSVC-MingW/port.c new file mode 100644 index 000000000..fdaa8de01 --- /dev/null +++ b/flight/pios/common/libraries/FreeRTOS/Source/portable/MSVC-MingW/port.c @@ -0,0 +1,609 @@ +/* + FreeRTOS V8.0.1 - Copyright (C) 2014 Real Time Engineers Ltd. + All rights reserved + + VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. + + *************************************************************************** + * * + * FreeRTOS provides completely free yet professionally developed, * + * robust, strictly quality controlled, supported, and cross * + * platform software that has become a de facto standard. * + * * + * Help yourself get started quickly and support the FreeRTOS * + * project by purchasing a FreeRTOS tutorial book, reference * + * manual, or both from: http://www.FreeRTOS.org/Documentation * + * * + * Thank you! * + * * + *************************************************************************** + + 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 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. Full license text is available from the following + link: http://www.freertos.org/a00114.html + + 1 tab == 4 spaces! + + *************************************************************************** + * * + * Having a problem? Start by reading the FAQ "My application does * + * not run, what could be wrong?" * + * * + * http://www.FreeRTOS.org/FAQHelp.html * + * * + *************************************************************************** + + http://www.FreeRTOS.org - Documentation, books, training, latest versions, + license and Real Time Engineers Ltd. contact details. + + http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products, + including FreeRTOS+Trace - an indispensable productivity tool, a DOS + compatible FAT file system, and our tiny thread aware UDP/IP stack. + + http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High + Integrity Systems to sell under the OpenRTOS brand. Low cost OpenRTOS + licenses offer ticketed support, indemnification and middleware. + + http://www.SafeRTOS.com - High Integrity Systems also provide a safety + engineered and independently SIL3 certified version for use in safety and + mission critical applications that require provable dependability. + + 1 tab == 4 spaces! +*/ + +/* Scheduler includes. */ +#include "FreeRTOS.h" +#include "task.h" +#include + +#ifdef __GNUC__ + #include "mmsystem.h" +#else + #pragma comment(lib, "winmm.lib") +#endif + +#define portMAX_INTERRUPTS ( ( uint32_t ) sizeof( uint32_t ) * 8UL ) /* The number of bits in an uint32_t. */ +#define portNO_CRITICAL_NESTING ( ( uint32_t ) 0 ) + +/* + * Created as a high priority thread, this function uses a timer to simulate + * a tick interrupt being generated on an embedded target. In this Windows + * environment the timer does not achieve anything approaching real time + * performance though. + */ +static DWORD WINAPI prvSimulatedPeripheralTimer( LPVOID lpParameter ); + +/* + * Process all the simulated interrupts - each represented by a bit in + * ulPendingInterrupts variable. + */ +static void prvProcessSimulatedInterrupts( void ); + +/* + * Interrupt handlers used by the kernel itself. These are executed from the + * simulated interrupt handler thread. + */ +static uint32_t prvProcessYieldInterrupt( void ); +static uint32_t prvProcessTickInterrupt( void ); + +/* + * Called when the process exits to let Windows know the high timer resolution + * is no longer required. + */ +static BOOL WINAPI prvEndProcess( DWORD dwCtrlType ); + +/*-----------------------------------------------------------*/ + +/* The WIN32 simulator runs each task in a thread. The context switching is +managed by the threads, so the task stack does not have to be managed directly, +although the task stack is still used to hold an xThreadState structure this is +the only thing it will ever hold. The structure indirectly maps the task handle +to a thread handle. */ +typedef struct +{ + /* Handle of the thread that executes the task. */ + void *pvThread; + +} xThreadState; + +/* Simulated interrupts waiting to be processed. This is a bit mask where each +bit represents one interrupt, so a maximum of 32 interrupts can be simulated. */ +static volatile uint32_t ulPendingInterrupts = 0UL; + +/* An event used to inform the simulated interrupt processing thread (a high +priority thread that simulated interrupt processing) that an interrupt is +pending. */ +static void *pvInterruptEvent = NULL; + +/* Mutex used to protect all the simulated interrupt variables that are accessed +by multiple threads. */ +static void *pvInterruptEventMutex = NULL; + +/* The critical nesting count for the currently executing task. This is +initialised to a non-zero value so interrupts do not become enabled during +the initialisation phase. As each task has its own critical nesting value +ulCriticalNesting will get set to zero when the first task runs. This +initialisation is probably not critical in this simulated environment as the +simulated interrupt handlers do not get created until the FreeRTOS scheduler is +started anyway. */ +static uint32_t ulCriticalNesting = 9999UL; + +/* Handlers for all the simulated software interrupts. The first two positions +are used for the Yield and Tick interrupts so are handled slightly differently, +all the other interrupts can be user defined. */ +static uint32_t (*ulIsrHandler[ portMAX_INTERRUPTS ])( void ) = { 0 }; + +/* Pointer to the TCB of the currently executing task. */ +extern void *pxCurrentTCB; + +/* Used to ensure nothing is processed during the startup sequence. */ +static BaseType_t xPortRunning = pdFALSE; + +/*-----------------------------------------------------------*/ + +static DWORD WINAPI prvSimulatedPeripheralTimer( LPVOID lpParameter ) +{ +TickType_t xMinimumWindowsBlockTime; +TIMECAPS xTimeCaps; + + /* Set the timer resolution to the maximum possible. */ + if( timeGetDevCaps( &xTimeCaps, sizeof( xTimeCaps ) ) == MMSYSERR_NOERROR ) + { + xMinimumWindowsBlockTime = ( TickType_t ) xTimeCaps.wPeriodMin; + timeBeginPeriod( xTimeCaps.wPeriodMin ); + + /* Register an exit handler so the timeBeginPeriod() function can be + matched with a timeEndPeriod() when the application exits. */ + SetConsoleCtrlHandler( prvEndProcess, TRUE ); + } + else + { + xMinimumWindowsBlockTime = ( TickType_t ) 20; + } + + /* Just to prevent compiler warnings. */ + ( void ) lpParameter; + + for(;;) + { + /* Wait until the timer expires and we can access the simulated interrupt + variables. *NOTE* this is not a 'real time' way of generating tick + events as the next wake time should be relative to the previous wake + time, not the time that Sleep() is called. It is done this way to + prevent overruns in this very non real time simulated/emulated + environment. */ + if( portTICK_PERIOD_MS < xMinimumWindowsBlockTime ) + { + Sleep( xMinimumWindowsBlockTime ); + } + else + { + Sleep( portTICK_PERIOD_MS ); + } + + configASSERT( xPortRunning ); + + WaitForSingleObject( pvInterruptEventMutex, INFINITE ); + + /* The timer has expired, generate the simulated tick event. */ + ulPendingInterrupts |= ( 1 << portINTERRUPT_TICK ); + + /* The interrupt is now pending - notify the simulated interrupt + handler thread. */ + if( ulCriticalNesting == 0 ) + { + SetEvent( pvInterruptEvent ); + } + + /* Give back the mutex so the simulated interrupt handler unblocks + and can access the interrupt handler variables. */ + ReleaseMutex( pvInterruptEventMutex ); + } + + #ifdef __GNUC__ + /* Should never reach here - MingW complains if you leave this line out, + MSVC complains if you put it in. */ + return 0; + #endif +} +/*-----------------------------------------------------------*/ + +static BOOL WINAPI prvEndProcess( DWORD dwCtrlType ) +{ +TIMECAPS xTimeCaps; + + ( void ) dwCtrlType; + + if( timeGetDevCaps( &xTimeCaps, sizeof( xTimeCaps ) ) == MMSYSERR_NOERROR ) + { + /* Match the call to timeBeginPeriod( xTimeCaps.wPeriodMin ) made when + the process started with a timeEndPeriod() as the process exits. */ + timeEndPeriod( xTimeCaps.wPeriodMin ); + } + + return pdPASS; +} +/*-----------------------------------------------------------*/ + +StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, TaskFunction_t pxCode, void *pvParameters ) +{ +xThreadState *pxThreadState = NULL; +int8_t *pcTopOfStack = ( int8_t * ) pxTopOfStack; + + /* In this simulated case a stack is not initialised, but instead a thread + is created that will execute the task being created. The thread handles + the context switching itself. The xThreadState object is placed onto + the stack that was created for the task - so the stack buffer is still + used, just not in the conventional way. It will not be used for anything + other than holding this structure. */ + pxThreadState = ( xThreadState * ) ( pcTopOfStack - sizeof( xThreadState ) ); + + /* Create the thread itself. */ + pxThreadState->pvThread = CreateThread( NULL, 0, ( LPTHREAD_START_ROUTINE ) pxCode, pvParameters, CREATE_SUSPENDED, NULL ); + configASSERT( pxThreadState->pvThread ); + SetThreadAffinityMask( pxThreadState->pvThread, 0x01 ); + SetThreadPriorityBoost( pxThreadState->pvThread, TRUE ); + SetThreadPriority( pxThreadState->pvThread, THREAD_PRIORITY_IDLE ); + + return ( StackType_t * ) pxThreadState; +} +/*-----------------------------------------------------------*/ + +BaseType_t xPortStartScheduler( void ) +{ +void *pvHandle; +int32_t lSuccess = pdPASS; +xThreadState *pxThreadState; + + /* Install the interrupt handlers used by the scheduler itself. */ + vPortSetInterruptHandler( portINTERRUPT_YIELD, prvProcessYieldInterrupt ); + vPortSetInterruptHandler( portINTERRUPT_TICK, prvProcessTickInterrupt ); + + /* Create the events and mutexes that are used to synchronise all the + threads. */ + pvInterruptEventMutex = CreateMutex( NULL, FALSE, NULL ); + pvInterruptEvent = CreateEvent( NULL, FALSE, FALSE, NULL ); + + if( ( pvInterruptEventMutex == NULL ) || ( pvInterruptEvent == NULL ) ) + { + lSuccess = pdFAIL; + } + + /* Set the priority of this thread such that it is above the priority of + the threads that run tasks. This higher priority is required to ensure + simulated interrupts take priority over tasks. */ + pvHandle = GetCurrentThread(); + if( pvHandle == NULL ) + { + lSuccess = pdFAIL; + } + + if( lSuccess == pdPASS ) + { + if( SetThreadPriority( pvHandle, THREAD_PRIORITY_NORMAL ) == 0 ) + { + lSuccess = pdFAIL; + } + SetThreadPriorityBoost( pvHandle, TRUE ); + SetThreadAffinityMask( pvHandle, 0x01 ); + } + + if( lSuccess == pdPASS ) + { + /* Start the thread that simulates the timer peripheral to generate + tick interrupts. The priority is set below that of the simulated + interrupt handler so the interrupt event mutex is used for the + handshake / overrun protection. */ + pvHandle = CreateThread( NULL, 0, prvSimulatedPeripheralTimer, NULL, 0, NULL ); + if( pvHandle != NULL ) + { + SetThreadPriority( pvHandle, THREAD_PRIORITY_BELOW_NORMAL ); + SetThreadPriorityBoost( pvHandle, TRUE ); + SetThreadAffinityMask( pvHandle, 0x01 ); + } + + /* Start the highest priority task by obtaining its associated thread + state structure, in which is stored the thread handle. */ + pxThreadState = ( xThreadState * ) *( ( uint32_t * ) pxCurrentTCB ); + ulCriticalNesting = portNO_CRITICAL_NESTING; + + /* Bump up the priority of the thread that is going to run, in the + hope that this will assist in getting the Windows thread scheduler to + behave as an embedded engineer might expect. */ + ResumeThread( pxThreadState->pvThread ); + + /* Handle all simulated interrupts - including yield requests and + simulated ticks. */ + prvProcessSimulatedInterrupts(); + } + + /* Would not expect to return from prvProcessSimulatedInterrupts(), so should + not get here. */ + return 0; +} +/*-----------------------------------------------------------*/ + +static uint32_t prvProcessYieldInterrupt( void ) +{ + return pdTRUE; +} +/*-----------------------------------------------------------*/ + +static uint32_t prvProcessTickInterrupt( void ) +{ +uint32_t ulSwitchRequired; + + /* Process the tick itself. */ + configASSERT( xPortRunning ); + ulSwitchRequired = ( uint32_t ) xTaskIncrementTick(); + + return ulSwitchRequired; +} +/*-----------------------------------------------------------*/ + +static void prvProcessSimulatedInterrupts( void ) +{ +uint32_t ulSwitchRequired, i; +xThreadState *pxThreadState; +void *pvObjectList[ 2 ]; + + /* Going to block on the mutex that ensured exclusive access to the simulated + interrupt objects, and the event that signals that a simulated interrupt + should be processed. */ + pvObjectList[ 0 ] = pvInterruptEventMutex; + pvObjectList[ 1 ] = pvInterruptEvent; + + /* Create a pending tick to ensure the first task is started as soon as + this thread pends. */ + ulPendingInterrupts |= ( 1 << portINTERRUPT_TICK ); + SetEvent( pvInterruptEvent ); + + xPortRunning = pdTRUE; + + for(;;) + { + WaitForMultipleObjects( sizeof( pvObjectList ) / sizeof( void * ), pvObjectList, TRUE, INFINITE ); + + /* Used to indicate whether the simulated interrupt processing has + necessitated a context switch to another task/thread. */ + ulSwitchRequired = pdFALSE; + + /* For each interrupt we are interested in processing, each of which is + represented by a bit in the 32bit ulPendingInterrupts variable. */ + for( i = 0; i < portMAX_INTERRUPTS; i++ ) + { + /* Is the simulated interrupt pending? */ + if( ulPendingInterrupts & ( 1UL << i ) ) + { + /* Is a handler installed? */ + if( ulIsrHandler[ i ] != NULL ) + { + /* Run the actual handler. */ + if( ulIsrHandler[ i ]() != pdFALSE ) + { + ulSwitchRequired |= ( 1 << i ); + } + } + + /* Clear the interrupt pending bit. */ + ulPendingInterrupts &= ~( 1UL << i ); + } + } + + if( ulSwitchRequired != pdFALSE ) + { + void *pvOldCurrentTCB; + + pvOldCurrentTCB = pxCurrentTCB; + + /* Select the next task to run. */ + vTaskSwitchContext(); + + /* If the task selected to enter the running state is not the task + that is already in the running state. */ + if( pvOldCurrentTCB != pxCurrentTCB ) + { + /* Suspend the old thread. */ + pxThreadState = ( xThreadState *) *( ( uint32_t * ) pvOldCurrentTCB ); + SuspendThread( pxThreadState->pvThread ); + + /* Obtain the state of the task now selected to enter the + Running state. */ + pxThreadState = ( xThreadState * ) ( *( uint32_t *) pxCurrentTCB ); + ResumeThread( pxThreadState->pvThread ); + } + } + + ReleaseMutex( pvInterruptEventMutex ); + } +} +/*-----------------------------------------------------------*/ + +void vPortDeleteThread( void *pvTaskToDelete ) +{ +xThreadState *pxThreadState; +uint32_t ulErrorCode; + + /* Remove compiler warnings if configASSERT() is not defined. */ + ( void ) ulErrorCode; + + /* Find the handle of the thread being deleted. */ + pxThreadState = ( xThreadState * ) ( *( uint32_t *) pvTaskToDelete ); + + /* Check that the thread is still valid, it might have been closed by + vPortCloseRunningThread() - which will be the case if the task associated + with the thread originally deleted itself rather than being deleted by a + different task. */ + if( pxThreadState->pvThread != NULL ) + { + WaitForSingleObject( pvInterruptEventMutex, INFINITE ); + + ulErrorCode = TerminateThread( pxThreadState->pvThread, 0 ); + configASSERT( ulErrorCode ); + + ulErrorCode = CloseHandle( pxThreadState->pvThread ); + configASSERT( ulErrorCode ); + + ReleaseMutex( pvInterruptEventMutex ); + } +} +/*-----------------------------------------------------------*/ + +void vPortCloseRunningThread( void *pvTaskToDelete, volatile BaseType_t *pxPendYield ) +{ +xThreadState *pxThreadState; +void *pvThread; +uint32_t ulErrorCode; + + /* Remove compiler warnings if configASSERT() is not defined. */ + ( void ) ulErrorCode; + + /* Find the handle of the thread being deleted. */ + pxThreadState = ( xThreadState * ) ( *( uint32_t *) pvTaskToDelete ); + pvThread = pxThreadState->pvThread; + + /* Raise the Windows priority of the thread to ensure the FreeRTOS scheduler + does not run and swap it out before it is closed. If that were to happen + the thread would never run again and effectively be a thread handle and + memory leak. */ + SetThreadPriority( pvThread, THREAD_PRIORITY_ABOVE_NORMAL ); + + /* This function will not return, therefore a yield is set as pending to + ensure a context switch occurs away from this thread on the next tick. */ + *pxPendYield = pdTRUE; + + /* Mark the thread associated with this task as invalid so + vPortDeleteThread() does not try to terminate it. */ + pxThreadState->pvThread = NULL; + + /* Close the thread. */ + ulErrorCode = CloseHandle( pvThread ); + configASSERT( ulErrorCode ); + + ExitThread( 0 ); +} +/*-----------------------------------------------------------*/ + +void vPortEndScheduler( void ) +{ + /* This function IS NOT TESTED! */ + TerminateProcess( GetCurrentProcess(), 0 ); +} +/*-----------------------------------------------------------*/ + +void vPortGenerateSimulatedInterrupt( uint32_t ulInterruptNumber ) +{ + configASSERT( xPortRunning ); + + if( ( ulInterruptNumber < portMAX_INTERRUPTS ) && ( pvInterruptEventMutex != NULL ) ) + { + /* Yield interrupts are processed even when critical nesting is non-zero. */ + WaitForSingleObject( pvInterruptEventMutex, INFINITE ); + ulPendingInterrupts |= ( 1 << ulInterruptNumber ); + + /* The simulated interrupt is now held pending, but don't actually process it + yet if this call is within a critical section. It is possible for this to + be in a critical section as calls to wait for mutexes are accumulative. */ + if( ulCriticalNesting == 0 ) + { + SetEvent( pvInterruptEvent ); + } + + ReleaseMutex( pvInterruptEventMutex ); + } +} +/*-----------------------------------------------------------*/ + +void vPortSetInterruptHandler( uint32_t ulInterruptNumber, uint32_t (*pvHandler)( void ) ) +{ + if( ulInterruptNumber < portMAX_INTERRUPTS ) + { + if( pvInterruptEventMutex != NULL ) + { + WaitForSingleObject( pvInterruptEventMutex, INFINITE ); + ulIsrHandler[ ulInterruptNumber ] = pvHandler; + ReleaseMutex( pvInterruptEventMutex ); + } + else + { + ulIsrHandler[ ulInterruptNumber ] = pvHandler; + } + } +} +/*-----------------------------------------------------------*/ + +void vPortEnterCritical( void ) +{ + if( xPortRunning == pdTRUE ) + { + /* The interrupt event mutex is held for the entire critical section, + effectively disabling (simulated) interrupts. */ + WaitForSingleObject( pvInterruptEventMutex, INFINITE ); + ulCriticalNesting++; + } + else + { + ulCriticalNesting++; + } +} +/*-----------------------------------------------------------*/ + +void vPortExitCritical( void ) +{ +int32_t lMutexNeedsReleasing; + + /* The interrupt event mutex should already be held by this thread as it was + obtained on entry to the critical section. */ + + lMutexNeedsReleasing = pdTRUE; + + if( ulCriticalNesting > portNO_CRITICAL_NESTING ) + { + if( ulCriticalNesting == ( portNO_CRITICAL_NESTING + 1 ) ) + { + ulCriticalNesting--; + + /* Were any interrupts set to pending while interrupts were + (simulated) disabled? */ + if( ulPendingInterrupts != 0UL ) + { + configASSERT( xPortRunning ); + SetEvent( pvInterruptEvent ); + + /* Mutex will be released now, so does not require releasing + on function exit. */ + lMutexNeedsReleasing = pdFALSE; + ReleaseMutex( pvInterruptEventMutex ); + } + } + else + { + /* Tick interrupts will still not be processed as the critical + nesting depth will not be zero. */ + ulCriticalNesting--; + } + } + + if( pvInterruptEventMutex != NULL ) + { + if( lMutexNeedsReleasing == pdTRUE ) + { + configASSERT( xPortRunning ); + ReleaseMutex( pvInterruptEventMutex ); + } + } +} +/*-----------------------------------------------------------*/ + diff --git a/flight/pios/common/libraries/FreeRTOS/Source/portable/MSVC-MingW/portmacro.h b/flight/pios/common/libraries/FreeRTOS/Source/portable/MSVC-MingW/portmacro.h new file mode 100644 index 000000000..194f67d04 --- /dev/null +++ b/flight/pios/common/libraries/FreeRTOS/Source/portable/MSVC-MingW/portmacro.h @@ -0,0 +1,176 @@ +/* + FreeRTOS V8.0.1 - Copyright (C) 2014 Real Time Engineers Ltd. + All rights reserved + + VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. + + *************************************************************************** + * * + * FreeRTOS provides completely free yet professionally developed, * + * robust, strictly quality controlled, supported, and cross * + * platform software that has become a de facto standard. * + * * + * Help yourself get started quickly and support the FreeRTOS * + * project by purchasing a FreeRTOS tutorial book, reference * + * manual, or both from: http://www.FreeRTOS.org/Documentation * + * * + * Thank you! * + * * + *************************************************************************** + + 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 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. Full license text is available from the following + link: http://www.freertos.org/a00114.html + + 1 tab == 4 spaces! + + *************************************************************************** + * * + * Having a problem? Start by reading the FAQ "My application does * + * not run, what could be wrong?" * + * * + * http://www.FreeRTOS.org/FAQHelp.html * + * * + *************************************************************************** + + http://www.FreeRTOS.org - Documentation, books, training, latest versions, + license and Real Time Engineers Ltd. contact details. + + http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products, + including FreeRTOS+Trace - an indispensable productivity tool, a DOS + compatible FAT file system, and our tiny thread aware UDP/IP stack. + + http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High + Integrity Systems to sell under the OpenRTOS brand. Low cost OpenRTOS + licenses offer ticketed support, indemnification and middleware. + + http://www.SafeRTOS.com - High Integrity Systems also provide a safety + engineered and independently SIL3 certified version for use in safety and + mission critical applications that require provable dependability. + + 1 tab == 4 spaces! +*/ + +#ifndef PORTMACRO_H +#define PORTMACRO_H + +#include + +/****************************************************************************** + Defines +******************************************************************************/ +/* Type definitions. */ +#define portCHAR char +#define portFLOAT float +#define portDOUBLE double +#define portLONG long +#define portSHORT short +#define portSTACK_TYPE uint32_t +#define portBASE_TYPE long + +typedef portSTACK_TYPE StackType_t; +typedef long BaseType_t; +typedef unsigned long UBaseType_t; + + +#if( configUSE_16_BIT_TICKS == 1 ) + typedef uint16_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffff +#else + typedef uint32_t TickType_t; + #define portMAX_DELAY ( TickType_t ) 0xffffffffUL +#endif + +/* Hardware specifics. */ +#define portSTACK_GROWTH ( -1 ) +#define portTICK_PERIOD_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ ) +#define portBYTE_ALIGNMENT 4 + +#define portYIELD() vPortGenerateSimulatedInterrupt( portINTERRUPT_YIELD ) + +void vPortCloseRunningThread( void *pvTaskToDelete, volatile BaseType_t *pxPendYield ); +void vPortDeleteThread( void *pvThreadToDelete ); +#define portCLEAN_UP_TCB( pxTCB ) vPortDeleteThread( pxTCB ) +#define portPRE_TASK_DELETE_HOOK( pvTaskToDelete, pxPendYield ) vPortCloseRunningThread( ( pvTaskToDelete ), ( pxPendYield ) ) +#define portDISABLE_INTERRUPTS() vPortEnterCritical() +#define portENABLE_INTERRUPTS() vPortExitCritical() + +/* Critical section handling. */ +void vPortEnterCritical( void ); +void vPortExitCritical( void ); + +#define portENTER_CRITICAL() vPortEnterCritical() +#define portEXIT_CRITICAL() vPortExitCritical() + +#if configUSE_PORT_OPTIMISED_TASK_SELECTION == 1 + + /* Check the configuration. */ + #if( configMAX_PRIORITIES > 32 ) + #error configUSE_PORT_OPTIMISED_TASK_SELECTION can only be set to 1 when configMAX_PRIORITIES is less than or equal to 32. It is very rare that a system requires more than 10 to 15 difference priorities as tasks that share a priority will time slice. + #endif + + /* Store/clear the ready priorities in a bit map. */ + #define portRECORD_READY_PRIORITY( uxPriority, uxReadyPriorities ) ( uxReadyPriorities ) |= ( 1UL << ( uxPriority ) ) + #define portRESET_READY_PRIORITY( uxPriority, uxReadyPriorities ) ( uxReadyPriorities ) &= ~( 1UL << ( uxPriority ) ) + + + /*-----------------------------------------------------------*/ + + #ifdef __GNUC__ + #define portGET_HIGHEST_PRIORITY( uxTopPriority, uxReadyPriorities ) \ + __asm volatile( "mov %0, %%eax \n\t" \ + "bsr %%eax, %%eax \n\t" \ + "mov %%eax, %1 \n\t" \ + :"=r"(uxTopPriority) : "r"(uxReadyPriorities) : "eax" ) + #else + /* BitScanReverse returns the bit position of the most significant '1' + in the word. */ + #define portGET_HIGHEST_PRIORITY( uxTopPriority, uxReadyPriorities ) _BitScanReverse( ( DWORD * ) &( uxTopPriority ), ( uxReadyPriorities ) ) + #endif /* __GNUC__ */ + +#endif /* taskRECORD_READY_PRIORITY */ + +#ifndef __GNUC__ + __pragma( warning( disable:4211 ) ) /* Nonstandard extension used, as extern is only nonstandard to MSVC. */ +#endif + + +/* Task function macros as described on the FreeRTOS.org WEB site. */ +#define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) void vFunction( void * pvParameters ) +#define portTASK_FUNCTION( vFunction, pvParameters ) void vFunction( void * pvParameters ) + + +#define portINTERRUPT_YIELD ( 0UL ) +#define portINTERRUPT_TICK ( 1UL ) + +/* + * Raise a simulated interrupt represented by the bit mask in ulInterruptMask. + * Each bit can be used to represent an individual interrupt - with the first + * two bits being used for the Yield and Tick interrupts respectively. +*/ +void vPortGenerateSimulatedInterrupt( uint32_t ulInterruptNumber ); + +/* + * Install an interrupt handler to be called by the simulated interrupt handler + * thread. The interrupt number must be above any used by the kernel itself + * (at the time of writing the kernel was using interrupt numbers 0, 1, and 2 + * as defined above). The number must also be lower than 32. + * + * Interrupt handler functions must return a non-zero value if executing the + * handler resulted in a task switch being required. + */ +void vPortSetInterruptHandler( uint32_t ulInterruptNumber, uint32_t (*pvHandler)( void ) ); + +#endif diff --git a/flight/pios/common/libraries/FreeRTOS/Source/portable/MemMang/heap_1.c b/flight/pios/common/libraries/FreeRTOS/Source/portable/MemMang/heap_1.c index 57ea722b2..eb47be24b 100644 --- a/flight/pios/common/libraries/FreeRTOS/Source/portable/MemMang/heap_1.c +++ b/flight/pios/common/libraries/FreeRTOS/Source/portable/MemMang/heap_1.c @@ -129,8 +129,8 @@ size_t mask = alignment - 1; } traceMALLOC( pvReturn, xWantedSize ); - } - xTaskResumeAll(); + } + ( void ) xTaskResumeAll(); #if( configUSE_MALLOC_FAILED_HOOK == 1 ) { diff --git a/flight/pios/common/libraries/FreeRTOS/Source/portable/MemMang/heap_2.c b/flight/pios/common/libraries/FreeRTOS/Source/portable/MemMang/heap_2.c index 4a06b42fd..4f936b7b4 100644 --- a/flight/pios/common/libraries/FreeRTOS/Source/portable/MemMang/heap_2.c +++ b/flight/pios/common/libraries/FreeRTOS/Source/portable/MemMang/heap_2.c @@ -1,5 +1,5 @@ /* - FreeRTOS V8.0.0 - Copyright (C) 2014 Real Time Engineers Ltd. + FreeRTOS V8.0.1 - Copyright (C) 2014 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -24,10 +24,10 @@ 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 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. + >>! 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 @@ -218,7 +218,7 @@ void *pvReturn = NULL; traceMALLOC( pvReturn, xWantedSize ); } - xTaskResumeAll(); + ( void ) xTaskResumeAll(); #if( configUSE_MALLOC_FAILED_HOOK == 1 ) { @@ -256,7 +256,7 @@ BlockLink_t *pxLink; xFreeBytesRemaining += pxLink->xBlockSize; traceFREE( pv, pxLink->xBlockSize ); } - xTaskResumeAll(); + ( void ) xTaskResumeAll(); } } /*-----------------------------------------------------------*/ diff --git a/flight/pios/common/libraries/FreeRTOS/Source/portable/MemMang/heap_3.c b/flight/pios/common/libraries/FreeRTOS/Source/portable/MemMang/heap_3.c index 71fe4d427..9f4b81a61 100644 --- a/flight/pios/common/libraries/FreeRTOS/Source/portable/MemMang/heap_3.c +++ b/flight/pios/common/libraries/FreeRTOS/Source/portable/MemMang/heap_3.c @@ -1,5 +1,5 @@ /* - FreeRTOS V8.0.0 - Copyright (C) 2014 Real Time Engineers Ltd. + FreeRTOS V8.0.1 - Copyright (C) 2014 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -24,10 +24,10 @@ 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 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. + >>! 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 @@ -71,7 +71,7 @@ * This file can only be used if the linker is configured to to generate * a heap memory area. * - * See heap_1.c, heap_2.c and heap_4.c for alternative implementations, and the + * See heap_1.c, heap_2.c and heap_4.c for alternative implementations, and the * memory management pages of http://www.FreeRTOS.org for more information. */ @@ -98,7 +98,7 @@ void *pvReturn; pvReturn = malloc( xWantedSize ); traceMALLOC( pvReturn, xWantedSize ); } - xTaskResumeAll(); + ( void ) xTaskResumeAll(); #if( configUSE_MALLOC_FAILED_HOOK == 1 ) { @@ -109,7 +109,7 @@ void *pvReturn; } } #endif - + return pvReturn; } /*-----------------------------------------------------------*/ @@ -123,7 +123,7 @@ void vPortFree( void *pv ) free( pv ); traceFREE( pv, 0 ); } - xTaskResumeAll(); + ( void ) xTaskResumeAll(); } } diff --git a/flight/pios/common/libraries/FreeRTOS/Source/portable/MemMang/heap_4.c b/flight/pios/common/libraries/FreeRTOS/Source/portable/MemMang/heap_4.c index 64d9622ae..30882a341 100644 --- a/flight/pios/common/libraries/FreeRTOS/Source/portable/MemMang/heap_4.c +++ b/flight/pios/common/libraries/FreeRTOS/Source/portable/MemMang/heap_4.c @@ -1,5 +1,5 @@ /* - FreeRTOS V8.0.0 - Copyright (C) 2014 Real Time Engineers Ltd. + FreeRTOS V8.0.1 - Copyright (C) 2014 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -24,10 +24,10 @@ 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 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. + >>! 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 @@ -271,7 +271,7 @@ void *pvReturn = NULL; traceMALLOC( pvReturn, xWantedSize ); } - xTaskResumeAll(); + ( void ) xTaskResumeAll(); #if( configUSE_MALLOC_FAILED_HOOK == 1 ) { @@ -322,9 +322,9 @@ BlockLink_t *pxLink; /* Add this block to the list of free blocks. */ xFreeBytesRemaining += pxLink->xBlockSize; traceFREE( pv, pxLink->xBlockSize ); - prvInsertBlockIntoFreeList( ( ( BlockLink_t * ) pxLink ) ); + prvInsertBlockIntoFreeList( ( ( BlockLink_t * ) pxLink ) ); } - xTaskResumeAll(); + ( void ) xTaskResumeAll(); } else { diff --git a/flight/pios/common/libraries/FreeRTOS/Source/queue.c b/flight/pios/common/libraries/FreeRTOS/Source/queue.c index 70de24bd2..5ad7985dc 100644 --- a/flight/pios/common/libraries/FreeRTOS/Source/queue.c +++ b/flight/pios/common/libraries/FreeRTOS/Source/queue.c @@ -1,5 +1,5 @@ /* - FreeRTOS V8.0.0 - Copyright (C) 2014 Real Time Engineers Ltd. + FreeRTOS V8.0.1 - Copyright (C) 2014 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -24,10 +24,10 @@ 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 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. + >>! 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 diff --git a/flight/pios/common/libraries/FreeRTOS/Source/tasks.c b/flight/pios/common/libraries/FreeRTOS/Source/tasks.c index 6835a72b0..3e3212ad2 100644 --- a/flight/pios/common/libraries/FreeRTOS/Source/tasks.c +++ b/flight/pios/common/libraries/FreeRTOS/Source/tasks.c @@ -1,5 +1,5 @@ /* - FreeRTOS V8.0.0 - Copyright (C) 2014 Real Time Engineers Ltd. + FreeRTOS V8.0.1 - Copyright (C) 2014 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -24,10 +24,10 @@ 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 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. + >>! 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 @@ -760,7 +760,11 @@ TCB_t * pxNewTCB; { /* Reset the next expected unblock time in case it referred to the task that has just been deleted. */ - prvResetNextTaskUnblockTime(); + taskENTER_CRITICAL(); + { + prvResetNextTaskUnblockTime(); + } + taskEXIT_CRITICAL(); } } } @@ -1259,7 +1263,11 @@ TCB_t * pxNewTCB; /* A task other than the currently running task was suspended, reset the next expected unblock time in case it referred to the task that is now in the Suspended state. */ - prvResetNextTaskUnblockTime(); + taskENTER_CRITICAL(); + { + prvResetNextTaskUnblockTime(); + } + taskEXIT_CRITICAL(); } else { @@ -3093,8 +3101,13 @@ TCB_t *pxNewTCB; want to allocate and clean RAM statically. */ portCLEAN_UP_TCB( pxTCB ); - /* Free up the memory allocated by the scheduler for the task. It is up to - the task to free any memory allocated at the application level. */ + /* Free up the memory allocated by the scheduler for the task. It is up + to the task to free any memory allocated at the application level. */ + #if ( configUSE_NEWLIB_REENTRANT == 1 ) + { + _reclaim_reent( &( pxTCB->xNewLib_reent ) ); + } + #endif /* configUSE_NEWLIB_REENTRANT */ vPortFreeAligned( pxTCB->pxStack ); vPortFree( pxTCB ); } diff --git a/flight/pios/common/libraries/FreeRTOS/Source/timers.c b/flight/pios/common/libraries/FreeRTOS/Source/timers.c index c4ba8325e..9e8dd1389 100644 --- a/flight/pios/common/libraries/FreeRTOS/Source/timers.c +++ b/flight/pios/common/libraries/FreeRTOS/Source/timers.c @@ -1,5 +1,5 @@ /* - FreeRTOS V8.0.0 - Copyright (C) 2014 Real Time Engineers Ltd. + FreeRTOS V8.0.1 - Copyright (C) 2014 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -24,10 +24,10 @@ 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 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. + >>! 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 @@ -363,6 +363,14 @@ DaemonTaskMessage_t xMessage; #endif /*-----------------------------------------------------------*/ +const char * pcTimerGetTimerName( TimerHandle_t xTimer ) +{ +Timer_t *pxTimer = ( Timer_t * ) xTimer; + + return pxTimer->pcTimerName; +} +/*-----------------------------------------------------------*/ + static void prvProcessExpiredTimer( const TickType_t xNextExpireTime, const TickType_t xTimeNow ) { BaseType_t xResult; @@ -804,7 +812,7 @@ Timer_t *pxTimer = ( Timer_t * ) xTimer; /* Checking to see if it is in the NULL list in effect checks to see if it is referenced from either the current or the overflow timer lists in one go, but the logic has to be reversed, hence the '!'. */ - xTimerIsInActiveList = !( listIS_CONTAINED_WITHIN( NULL, &( pxTimer->xTimerListItem ) ) ); + xTimerIsInActiveList = ( BaseType_t ) !( listIS_CONTAINED_WITHIN( NULL, &( pxTimer->xTimerListItem ) ) ); } taskEXIT_CRITICAL();