mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-08-19 09:38:32 -04:00
Kernel changes:
+ Support tickless idle when configUSE_PREEMPTION is 0 (previously tickless idle was only supported when the pre-emptive scheduler was being used). + If a stack was statically allocated, then don't try freeing it if the TCB cannot be allocated. + Remove use of INCLUDE_xEventGroupsSetBitsFromISR() pre-processor macro, as it was not tested anyway. Demo app changes: + Updated SAM4L Atmel Studio project to use Atmel Studio 7.
This commit is contained in:
parent
5e9787978c
commit
e9561c946c
20 changed files with 215 additions and 181 deletions
|
@ -87,14 +87,6 @@ header files above, but not in this file, in order to generate the correct
|
|||
privileged Vs unprivileged linkage and placement. */
|
||||
#undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE /*lint !e961 !e750. */
|
||||
|
||||
#if ( INCLUDE_xEventGroupSetBitFromISR == 1 ) && ( configUSE_TIMERS == 0 )
|
||||
#error configUSE_TIMERS must be set to 1 to make the xEventGroupSetBitFromISR() function available.
|
||||
#endif
|
||||
|
||||
#if ( INCLUDE_xEventGroupSetBitFromISR == 1 ) && ( INCLUDE_xTimerPendFunctionCall == 0 )
|
||||
#error INCLUDE_xTimerPendFunctionCall must also be set to one to make the xEventGroupSetBitFromISR() function available.
|
||||
#endif
|
||||
|
||||
/* The following bit fields convey control information in a task's event list
|
||||
item value. It is important they don't clash with the
|
||||
taskEVENT_LIST_ITEM_VALUE_IN_USE definition. */
|
||||
|
|
|
@ -247,10 +247,6 @@ extern "C" {
|
|||
#define INCLUDE_xTaskResumeFromISR 1
|
||||
#endif
|
||||
|
||||
#ifndef INCLUDE_xEventGroupSetBitFromISR
|
||||
#define INCLUDE_xEventGroupSetBitFromISR 0
|
||||
#endif
|
||||
|
||||
#ifndef INCLUDE_xTimerPendFunctionCall
|
||||
#define INCLUDE_xTimerPendFunctionCall 0
|
||||
#endif
|
||||
|
@ -405,6 +401,10 @@ extern "C" {
|
|||
#define traceMOVED_TASK_TO_READY_STATE( pxTCB )
|
||||
#endif
|
||||
|
||||
#ifndef tracePOST_MOVED_TASK_TO_READY_STATE
|
||||
#define tracePOST_MOVED_TASK_TO_READY_STATE( pxTCB )
|
||||
#endif
|
||||
|
||||
#ifndef traceQUEUE_CREATE
|
||||
#define traceQUEUE_CREATE( pxNewQueue )
|
||||
#endif
|
||||
|
@ -821,7 +821,7 @@ V8 if desired. */
|
|||
|
||||
/* Set configUSE_TASK_FPU_SUPPORT to 0 to omit floating point support even
|
||||
if floating point hardware is otherwise supported by the FreeRTOS port in use.
|
||||
This constant is not supported by all FreeRTOS ports that include floating
|
||||
This constant is not supported by all FreeRTOS ports that include floating
|
||||
point support. */
|
||||
#ifndef configUSE_TASK_FPU_SUPPORT
|
||||
#define configUSE_TASK_FPU_SUPPORT 1
|
||||
|
|
|
@ -376,7 +376,7 @@ EventBits_t xEventGroupClearBits( EventGroupHandle_t xEventGroup, const EventBit
|
|||
}
|
||||
}
|
||||
</pre>
|
||||
* \defgroup xEventGroupSetBitsFromISR xEventGroupSetBitsFromISR
|
||||
* \defgroup xEventGroupClearBitsFromISR xEventGroupClearBitsFromISR
|
||||
* \ingroup EventGroup
|
||||
*/
|
||||
#if( configUSE_TRACE_FACILITY == 1 )
|
||||
|
@ -470,7 +470,7 @@ EventBits_t xEventGroupSetBits( EventGroupHandle_t xEventGroup, const EventBits_
|
|||
* 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 in
|
||||
* interrupts or from critical sections. Therefore xEventGroupSetBitFromISR()
|
||||
* interrupts or from critical sections. Therefore xEventGroupSetBitsFromISR()
|
||||
* sends a message to the timer task to have the set operation performed in the
|
||||
* context of the timer task - where a scheduler lock is used in place of a
|
||||
* critical section.
|
||||
|
|
|
@ -107,6 +107,7 @@ typedef void (*TaskFunction_t)( void * );
|
|||
itself. */
|
||||
#define pdFREERTOS_ERRNO_NONE 0 /* No errors */
|
||||
#define pdFREERTOS_ERRNO_ENOENT 2 /* No such file or directory */
|
||||
#define pdFREERTOS_ERRNO_EINTR 4 /* Interrupted system call */
|
||||
#define pdFREERTOS_ERRNO_EIO 5 /* I/O error */
|
||||
#define pdFREERTOS_ERRNO_ENXIO 6 /* No such device or address */
|
||||
#define pdFREERTOS_ERRNO_EBADF 9 /* Bad file number */
|
||||
|
|
|
@ -118,6 +118,7 @@ typedef unsigned long UBaseType_t;
|
|||
/* Simulated interrupts return pdFALSE if no context switch should be performed,
|
||||
or a non-zero number if a context switch should be performed. */
|
||||
#define portYIELD_FROM_ISR( x ) return x
|
||||
#define portEND_SWITCHING_ISR( x ) portYIELD_FROM_ISR( ( x ) )
|
||||
|
||||
void vPortCloseRunningThread( void *pvTaskToDelete, volatile BaseType_t *pxPendYield );
|
||||
void vPortDeleteThread( void *pvThreadToDelete );
|
||||
|
|
|
@ -185,6 +185,8 @@ not necessary for to use this port. They are defined so the common demo files
|
|||
/* portNOP() is not required by this port. */
|
||||
#define portNOP()
|
||||
|
||||
#define portINLINE __inline
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -198,6 +198,8 @@ not necessary for to use this port. They are defined so the common demo files
|
|||
/* portNOP() is not required by this port. */
|
||||
#define portNOP()
|
||||
|
||||
#define portINLINE __inline
|
||||
|
||||
#ifndef portFORCE_INLINE
|
||||
#define portFORCE_INLINE __forceinline
|
||||
#endif
|
||||
|
|
|
@ -202,6 +202,8 @@ not necessary for to use this port. They are defined so the common demo files
|
|||
#define portFORCE_INLINE __forceinline
|
||||
#endif
|
||||
|
||||
#define portINLINE __inline
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static portFORCE_INLINE void vPortSetBASEPRI( uint32_t ulBASEPRI )
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
Each real time kernel port consists of three files that contain the core kernel
|
||||
components and are common to every port, and one or more files that are
|
||||
components and are common to every port, and one or more files that are
|
||||
specific to a particular microcontroller and/or compiler.
|
||||
|
||||
|
||||
+ The FreeRTOS/Source/Portable/MemMang directory contains the three sample
|
||||
+ The FreeRTOS/Source/Portable/MemMang directory contains the three sample
|
||||
memory allocators as described on the http://www.FreeRTOS.org WEB site.
|
||||
|
||||
+ The other directories each contain files specific to a particular
|
||||
+ The other directories each contain files specific to a particular
|
||||
microcontroller or compiler.
|
||||
|
||||
|
||||
|
||||
For example, if you are interested in the GCC port for the ATMega323
|
||||
microcontroller then the port specific files are contained in
|
||||
FreeRTOS/Source/Portable/GCC/ATMega323 directory. If this is the only
|
||||
port you are interested in then all the other directories can be
|
||||
For example, if you are interested in the [compiler] port for the [architecture]
|
||||
microcontroller, then the port specific files are contained in
|
||||
FreeRTOS/Source/Portable/[compiler]/[architecture] directory. If this is the
|
||||
only port you are interested in then all the other directories can be
|
||||
ignored.
|
||||
|
||||
|
|
|
@ -341,7 +341,7 @@ PRIVILEGED_DATA static volatile UBaseType_t uxSchedulerSuspended = ( UBaseType_t
|
|||
{ \
|
||||
UBaseType_t uxTopPriority; \
|
||||
\
|
||||
/* Find the highest priority queue that contains ready tasks. */ \
|
||||
/* Find the highest priority list that contains ready tasks. */ \
|
||||
portGET_HIGHEST_PRIORITY( uxTopPriority, uxTopReadyPriority ); \
|
||||
configASSERT( listCURRENT_LIST_LENGTH( &( pxReadyTasksLists[ uxTopPriority ] ) ) > 0 ); \
|
||||
listGET_OWNER_OF_NEXT_ENTRY( pxCurrentTCB, &( pxReadyTasksLists[ uxTopPriority ] ) ); \
|
||||
|
@ -389,7 +389,8 @@ count overflows. */
|
|||
#define prvAddTaskToReadyList( pxTCB ) \
|
||||
traceMOVED_TASK_TO_READY_STATE( pxTCB ); \
|
||||
taskRECORD_READY_PRIORITY( ( pxTCB )->uxPriority ); \
|
||||
vListInsertEnd( &( pxReadyTasksLists[ ( pxTCB )->uxPriority ] ), &( ( pxTCB )->xGenericListItem ) )
|
||||
vListInsertEnd( &( pxReadyTasksLists[ ( pxTCB )->uxPriority ] ), &( ( pxTCB )->xGenericListItem ) ); \
|
||||
tracePOST_MOVED_TASK_TO_READY_STATE( pxTCB )
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
|
@ -1645,6 +1646,34 @@ void vTaskSuspendAll( void )
|
|||
static TickType_t prvGetExpectedIdleTime( void )
|
||||
{
|
||||
TickType_t xReturn;
|
||||
UBaseType_t uxHigherPriorityReadyTasks = pdFALSE;
|
||||
|
||||
/* uxHigherPriorityReadyTasks takes care of the case where
|
||||
configUSE_PREEMPTION is 0, so there may be tasks above the idle priority
|
||||
task that are in the Ready state, even though the idle task is
|
||||
running. */
|
||||
#if( configUSE_PORT_OPTIMISED_TASK_SELECTION == 0 )
|
||||
{
|
||||
if( uxTopReadyPriority > tskIDLE_PRIORITY )
|
||||
{
|
||||
uxHigherPriorityReadyTasks = pdTRUE;
|
||||
}
|
||||
}
|
||||
#else
|
||||
{
|
||||
const UBaseType_t uxLeastSignificantBit = ( UBaseType_t ) 0x01;
|
||||
|
||||
/* When port optimised task selection is used the uxTopReadyPriority
|
||||
variable is used as a bit map. If bits other than the least
|
||||
significant bit are set then there are tasks that have a priority
|
||||
above the idle priority that are in the Ready state. This takes
|
||||
care of the case where the co-operative scheduler is in use. */
|
||||
if( uxTopReadyPriority > uxLeastSignificantBit )
|
||||
{
|
||||
uxHigherPriorityReadyTasks = pdTRUE;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if( pxCurrentTCB->uxPriority > tskIDLE_PRIORITY )
|
||||
{
|
||||
|
@ -1657,6 +1686,13 @@ void vTaskSuspendAll( void )
|
|||
processed. */
|
||||
xReturn = 0;
|
||||
}
|
||||
else if( uxHigherPriorityReadyTasks != pdFALSE )
|
||||
{
|
||||
/* There are tasks in the Ready state that have a priority above the
|
||||
idle priority. This path can only be reached if
|
||||
configUSE_PREEMPTION is 0. */
|
||||
xReturn = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
xReturn = xNextTaskUnblockTime - xTickCount;
|
||||
|
@ -2222,9 +2258,9 @@ void vTaskSwitchContext( void )
|
|||
#endif
|
||||
|
||||
/* Add the amount of time the task has been running to the
|
||||
accumulated time so far. The time the task started running was
|
||||
accumulated time so far. The time the task started running was
|
||||
stored in ulTaskSwitchedInTime. Note that there is no overflow
|
||||
protection here so count values are only valid until the timer
|
||||
protection here so count values are only valid until the timer
|
||||
overflows. The guard against negative values is to protect
|
||||
against suspect run time stat counter implementations - which
|
||||
are provided by the application, not the kernel. */
|
||||
|
@ -3148,7 +3184,10 @@ TCB_t *pxNewTCB;
|
|||
{
|
||||
/* The stack cannot be used as the TCB was not created. Free it
|
||||
again. */
|
||||
vPortFree( pxStack );
|
||||
if( puxStackBuffer == NULL )
|
||||
{
|
||||
vPortFree( pxStack );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue