mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-04-19 21:11:57 -04:00
Kernel updates:
+ Added vTimerSetTimerID() to compliment vTimerGetTimerID(). Now the timer ID can be used as timer local storage. + Updated comments and added some additional assert() calls. Win32 port: + Some changes to allow easier 64-bit builds PIC24/dsPIC port: + Added NOP after disable interrupt instruction.
This commit is contained in:
parent
dfdc319518
commit
86b09bfeb9
|
@ -30,6 +30,7 @@
|
|||
<SLE66AMisc></SLE66AMisc>
|
||||
<SLE66LinkerMisc></SLE66LinkerMisc>
|
||||
<SFDFile></SFDFile>
|
||||
<bCustSvd>0</bCustSvd>
|
||||
<UseEnv>0</UseEnv>
|
||||
<BinPath></BinPath>
|
||||
<IncludePath></IncludePath>
|
||||
|
@ -71,6 +72,8 @@
|
|||
<UserProg2Name></UserProg2Name>
|
||||
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
|
||||
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
|
||||
<nStopB1X>0</nStopB1X>
|
||||
<nStopB2X>0</nStopB2X>
|
||||
</BeforeMake>
|
||||
<AfterMake>
|
||||
<RunUserProg1>1</RunUserProg1>
|
||||
|
@ -97,6 +100,7 @@
|
|||
<StopOnExitCode>3</StopOnExitCode>
|
||||
<CustomArgument></CustomArgument>
|
||||
<IncludeLibraryModules></IncludeLibraryModules>
|
||||
<ComprImg>1</ComprImg>
|
||||
</CommonProperty>
|
||||
<DllOption>
|
||||
<SimDllName>SARMCM3.DLL</SimDllName>
|
||||
|
@ -117,7 +121,7 @@
|
|||
<Oh166RecLen>16</Oh166RecLen>
|
||||
</OPTHX>
|
||||
<Simulator>
|
||||
<UseSimulator>0</UseSimulator>
|
||||
<UseSimulator>1</UseSimulator>
|
||||
<LoadApplicationAtStartup>1</LoadApplicationAtStartup>
|
||||
<RunToMain>1</RunToMain>
|
||||
<RestoreBreakpoints>1</RestoreBreakpoints>
|
||||
|
@ -126,20 +130,22 @@
|
|||
<RestoreFunctions>1</RestoreFunctions>
|
||||
<RestoreToolbox>1</RestoreToolbox>
|
||||
<LimitSpeedToRealTime>0</LimitSpeedToRealTime>
|
||||
<RestoreSysVw>1</RestoreSysVw>
|
||||
</Simulator>
|
||||
<Target>
|
||||
<UseTarget>1</UseTarget>
|
||||
<UseTarget>0</UseTarget>
|
||||
<LoadApplicationAtStartup>1</LoadApplicationAtStartup>
|
||||
<RunToMain>0</RunToMain>
|
||||
<RunToMain>1</RunToMain>
|
||||
<RestoreBreakpoints>1</RestoreBreakpoints>
|
||||
<RestoreWatchpoints>1</RestoreWatchpoints>
|
||||
<RestoreMemoryDisplay>1</RestoreMemoryDisplay>
|
||||
<RestoreFunctions>0</RestoreFunctions>
|
||||
<RestoreToolbox>1</RestoreToolbox>
|
||||
<RestoreTracepoints>0</RestoreTracepoints>
|
||||
<RestoreSysVw>1</RestoreSysVw>
|
||||
</Target>
|
||||
<RunDebugAfterBuild>0</RunDebugAfterBuild>
|
||||
<TargetSelection>4</TargetSelection>
|
||||
<TargetSelection>2</TargetSelection>
|
||||
<SimDlls>
|
||||
<CpuDll></CpuDll>
|
||||
<CpuDllArguments></CpuDllArguments>
|
||||
|
@ -161,13 +167,18 @@
|
|||
<UseTargetDll>1</UseTargetDll>
|
||||
<UseExternalTool>0</UseExternalTool>
|
||||
<RunIndependent>0</RunIndependent>
|
||||
<UpdateFlashBeforeDebugging>0</UpdateFlashBeforeDebugging>
|
||||
<UpdateFlashBeforeDebugging>1</UpdateFlashBeforeDebugging>
|
||||
<Capability>1</Capability>
|
||||
<DriverSelection>4099</DriverSelection>
|
||||
</Flash1>
|
||||
<bUseTDR>1</bUseTDR>
|
||||
<Flash2>BIN\lmidk-agdi.dll</Flash2>
|
||||
<Flash3>"" ()</Flash3>
|
||||
<Flash4></Flash4>
|
||||
<pFcarmOut></pFcarmOut>
|
||||
<pFcarmGrp></pFcarmGrp>
|
||||
<pFcArmRoot></pFcArmRoot>
|
||||
<FcArmLst>0</FcArmLst>
|
||||
</Utilities>
|
||||
<TargetArmAds>
|
||||
<ArmAdsMisc>
|
||||
|
@ -346,6 +357,8 @@
|
|||
<wLevel>0</wLevel>
|
||||
<uThumb>0</uThumb>
|
||||
<uSurpInc>0</uSurpInc>
|
||||
<uC99>0</uC99>
|
||||
<useXO>0</useXO>
|
||||
<VariousControls>
|
||||
<MiscControls>--diag_suppress 191,550,513,167,177,144</MiscControls>
|
||||
<Define>RVDS_ARMCM3_LM3S102, "PACK_STRUCT_END=","ALIGN_STRUCT_END="</Define>
|
||||
|
@ -362,6 +375,7 @@
|
|||
<SwStkChk>0</SwStkChk>
|
||||
<NoWarn>0</NoWarn>
|
||||
<uSurpInc>0</uSurpInc>
|
||||
<useXO>0</useXO>
|
||||
<VariousControls>
|
||||
<MiscControls></MiscControls>
|
||||
<Define></Define>
|
||||
|
@ -378,6 +392,7 @@
|
|||
<useFile>0</useFile>
|
||||
<TextAddressRange>0x00000000</TextAddressRange>
|
||||
<DataAddressRange>0x20000000</DataAddressRange>
|
||||
<pXoBase></pXoBase>
|
||||
<ScatterFile></ScatterFile>
|
||||
<IncludeLibs></IncludeLibs>
|
||||
<IncludeLibsPath></IncludeLibsPath>
|
||||
|
@ -476,6 +491,11 @@
|
|||
<FileType>1</FileType>
|
||||
<FilePath>..\Common\Minimal\QueueSet.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>EventGroupsDemo.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\Common\Minimal\EventGroupsDemo.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
|
@ -531,6 +551,16 @@
|
|||
<FileType>1</FileType>
|
||||
<FilePath>..\..\Source\portable\RVDS\ARM_CM3\port.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>timers.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\Source\timers.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>event_groups.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\Source\event_groups.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>heap_2.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
|
|
|
@ -61,7 +61,7 @@ HTTPD_CGI_CALL(rtos, "rtos-stats", rtos_stats );
|
|||
HTTPD_CGI_CALL(io, "led-io", led_io );
|
||||
|
||||
|
||||
static const struct httpd_cgi_call * const calls[] = { &file, &tcp, &net, &rtos, &io, NULL };
|
||||
static const struct httpd_cgi_call * calls[] = { &file, &tcp, &net, &rtos, &io, NULL };
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static
|
||||
|
|
|
@ -95,7 +95,7 @@ must be set in the compiler's include path. */
|
|||
#endif
|
||||
|
||||
#if portBYTE_ALIGNMENT == 8
|
||||
#define portBYTE_ALIGNMENT_MASK ( 0x0007U )
|
||||
#define portBYTE_ALIGNMENT_MASK ( 0x0007 )
|
||||
#endif
|
||||
|
||||
#if portBYTE_ALIGNMENT == 4
|
||||
|
|
|
@ -1490,10 +1490,8 @@ BaseType_t xQueueTakeMutexRecursive( QueueHandle_t xMutex, TickType_t xTicksToWa
|
|||
BaseType_t xQueueGiveMutexRecursive( QueueHandle_t pxMutex ) PRIVILEGED_FUNCTION;
|
||||
|
||||
/*
|
||||
* Reset a queue back to its original empty state. pdPASS is returned if the
|
||||
* queue is successfully reset. pdFAIL is returned if the queue could not be
|
||||
* reset because there are tasks blocked on the queue waiting to either
|
||||
* receive from the queue or send to the queue.
|
||||
* Reset a queue back to its original empty state. The return value is now
|
||||
* obsolete and is always set to pdPASS.
|
||||
*/
|
||||
#define xQueueReset( xQueue ) xQueueGenericReset( xQueue, pdFALSE )
|
||||
|
||||
|
|
|
@ -265,11 +265,11 @@ TimerHandle_t xTimerCreate( const char * const pcTimerName, const TickType_t xTi
|
|||
* Returns the ID assigned to the timer.
|
||||
*
|
||||
* IDs are assigned to timers using the pvTimerID parameter of the call to
|
||||
* xTimerCreated() that was used to create the timer.
|
||||
* xTimerCreated() that was used to create the timer, and by calling the
|
||||
* vTimerSetTimerID() API function.
|
||||
*
|
||||
* If the same callback function is assigned to multiple timers then the timer
|
||||
* ID can be used within the callback function to identify which timer actually
|
||||
* expired.
|
||||
* ID can be used as time specific (timer local) storage.
|
||||
*
|
||||
* @param xTimer The timer being queried.
|
||||
*
|
||||
|
@ -281,6 +281,27 @@ TimerHandle_t xTimerCreate( const char * const pcTimerName, const TickType_t xTi
|
|||
*/
|
||||
void *pvTimerGetTimerID( TimerHandle_t xTimer ) PRIVILEGED_FUNCTION;
|
||||
|
||||
/**
|
||||
* void vTimerSetTimerID( TimerHandle_t xTimer, void *pvNewID );
|
||||
*
|
||||
* Sets the ID assigned to the timer.
|
||||
*
|
||||
* IDs are assigned to timers using the pvTimerID parameter of the call to
|
||||
* xTimerCreated() that was used to create the timer.
|
||||
*
|
||||
* If the same callback function is assigned to multiple timers then the timer
|
||||
* ID can be used as time specific (timer local) storage.
|
||||
*
|
||||
* @param xTimer The timer being updated.
|
||||
*
|
||||
* @param pvNewID The ID to assign to the timer.
|
||||
*
|
||||
* Example usage:
|
||||
*
|
||||
* See the xTimerCreate() API function example usage scenario.
|
||||
*/
|
||||
void vTimerSetTimerID( const TimerHandle_t xTimer, void *pvNewID ) PRIVILEGED_FUNCTION;
|
||||
|
||||
/**
|
||||
* BaseType_t xTimerIsTimerActive( TimerHandle_t xTimer );
|
||||
*
|
||||
|
|
|
@ -115,7 +115,7 @@ typedef unsigned short UBaseType_t;
|
|||
/* Critical section management. */
|
||||
#define portINTERRUPT_BITS ( ( uint16_t ) configKERNEL_INTERRUPT_PRIORITY << ( uint16_t ) 5 )
|
||||
|
||||
#define portDISABLE_INTERRUPTS() SR |= portINTERRUPT_BITS
|
||||
#define portDISABLE_INTERRUPTS() SR |= portINTERRUPT_BITS; __asm volatile ( "NOP" )
|
||||
#define portENABLE_INTERRUPTS() SR &= ~portINTERRUPT_BITS
|
||||
|
||||
/* Note that exiting a critical sectino will set the IPL bits to 0, nomatter
|
||||
|
|
|
@ -322,7 +322,7 @@ xThreadState *pxThreadState;
|
|||
|
||||
/* Start the highest priority task by obtaining its associated thread
|
||||
state structure, in which is stored the thread handle. */
|
||||
pxThreadState = ( xThreadState * ) *( ( uint32_t * ) pxCurrentTCB );
|
||||
pxThreadState = ( xThreadState * ) *( ( size_t * ) pxCurrentTCB );
|
||||
ulCriticalNesting = portNO_CRITICAL_NESTING;
|
||||
|
||||
/* Bump up the priority of the thread that is going to run, in the
|
||||
|
@ -422,12 +422,12 @@ void *pvObjectList[ 2 ];
|
|||
if( pvOldCurrentTCB != pxCurrentTCB )
|
||||
{
|
||||
/* Suspend the old thread. */
|
||||
pxThreadState = ( xThreadState *) *( ( uint32_t * ) pvOldCurrentTCB );
|
||||
pxThreadState = ( xThreadState *) *( ( size_t * ) pvOldCurrentTCB );
|
||||
SuspendThread( pxThreadState->pvThread );
|
||||
|
||||
/* Obtain the state of the task now selected to enter the
|
||||
Running state. */
|
||||
pxThreadState = ( xThreadState * ) ( *( uint32_t *) pxCurrentTCB );
|
||||
pxThreadState = ( xThreadState * ) ( *( size_t *) pxCurrentTCB );
|
||||
ResumeThread( pxThreadState->pvThread );
|
||||
}
|
||||
}
|
||||
|
@ -446,7 +446,7 @@ uint32_t ulErrorCode;
|
|||
( void ) ulErrorCode;
|
||||
|
||||
/* Find the handle of the thread being deleted. */
|
||||
pxThreadState = ( xThreadState * ) ( *( uint32_t *) pvTaskToDelete );
|
||||
pxThreadState = ( xThreadState * ) ( *( size_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
|
||||
|
@ -477,7 +477,7 @@ uint32_t ulErrorCode;
|
|||
( void ) ulErrorCode;
|
||||
|
||||
/* Find the handle of the thread being deleted. */
|
||||
pxThreadState = ( xThreadState * ) ( *( uint32_t *) pvTaskToDelete );
|
||||
pxThreadState = ( xThreadState * ) ( *( size_t *) pvTaskToDelete );
|
||||
pvThread = pxThreadState->pvThread;
|
||||
|
||||
/* Raise the Windows priority of the thread to ensure the FreeRTOS scheduler
|
||||
|
|
|
@ -81,8 +81,9 @@
|
|||
#define portDOUBLE double
|
||||
#define portLONG long
|
||||
#define portSHORT short
|
||||
#define portSTACK_TYPE uint32_t
|
||||
#define portSTACK_TYPE size_t
|
||||
#define portBASE_TYPE long
|
||||
#define portPOINTER_SIZE_TYPE size_t
|
||||
|
||||
typedef portSTACK_TYPE StackType_t;
|
||||
typedef long BaseType_t;
|
||||
|
@ -96,15 +97,21 @@ typedef unsigned long UBaseType_t;
|
|||
typedef uint32_t TickType_t;
|
||||
#define portMAX_DELAY ( TickType_t ) 0xffffffffUL
|
||||
|
||||
/* 32-bit tick type on a 32-bit architecture, so reads of the tick count do
|
||||
not need to be guarded with a critical section. */
|
||||
/* 32/64-bit tick type on a 32/64-bit architecture, so reads of the tick
|
||||
count do not need to be guarded with a critical section. */
|
||||
#define portTICK_TYPE_IS_ATOMIC 1
|
||||
#endif
|
||||
|
||||
/* Hardware specifics. */
|
||||
#define portSTACK_GROWTH ( -1 )
|
||||
#define portTICK_PERIOD_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
|
||||
|
||||
|
||||
#if defined( __x86_64_ _) || defined( _M_X64 )
|
||||
#define portBYTE_ALIGNMENT 8
|
||||
#else
|
||||
#define portBYTE_ALIGNMENT 4
|
||||
#endif
|
||||
|
||||
#define portYIELD() vPortGenerateSimulatedInterrupt( portINTERRUPT_YIELD )
|
||||
|
||||
|
@ -186,3 +193,4 @@ void vPortGenerateSimulatedInterrupt( uint32_t ulInterruptNumber );
|
|||
void vPortSetInterruptHandler( uint32_t ulInterruptNumber, uint32_t (*pvHandler)( void ) );
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -115,7 +115,7 @@ static uint8_t *pucAlignedHeap = NULL;
|
|||
if( pucAlignedHeap == NULL )
|
||||
{
|
||||
/* Ensure the heap starts on a correctly aligned boundary. */
|
||||
pucAlignedHeap = ( uint8_t * ) ( ( ( portPOINTER_SIZE_TYPE ) &ucHeap[ portBYTE_ALIGNMENT ] ) & ( ( portPOINTER_SIZE_TYPE ) ~portBYTE_ALIGNMENT_MASK ) );
|
||||
pucAlignedHeap = ( uint8_t * ) ( ( ( portPOINTER_SIZE_TYPE ) &ucHeap[ portBYTE_ALIGNMENT ] ) & ( ~( ( portPOINTER_SIZE_TYPE ) portBYTE_ALIGNMENT_MASK ) ) );
|
||||
}
|
||||
|
||||
/* Check there is enough room left for the allocation. */
|
||||
|
|
|
@ -283,7 +283,7 @@ BlockLink_t *pxFirstFreeBlock;
|
|||
uint8_t *pucAlignedHeap;
|
||||
|
||||
/* Ensure the heap starts on a correctly aligned boundary. */
|
||||
pucAlignedHeap = ( uint8_t * ) ( ( ( portPOINTER_SIZE_TYPE ) &ucHeap[ portBYTE_ALIGNMENT ] ) & ( ( portPOINTER_SIZE_TYPE ) ~portBYTE_ALIGNMENT_MASK ) );
|
||||
pucAlignedHeap = ( uint8_t * ) ( ( ( portPOINTER_SIZE_TYPE ) &ucHeap[ portBYTE_ALIGNMENT ] ) & ( ~( ( portPOINTER_SIZE_TYPE ) portBYTE_ALIGNMENT_MASK ) ) );
|
||||
|
||||
/* xStart is used to hold a pointer to the first item in the list of free
|
||||
blocks. The void cast is used to prevent compiler warnings. */
|
||||
|
|
|
@ -633,10 +633,10 @@ Queue_t * const pxQueue = ( Queue_t * ) xQueue;
|
|||
{
|
||||
taskENTER_CRITICAL();
|
||||
{
|
||||
/* Is there room on the queue now? The running task must be
|
||||
the highest priority task wanting to access the queue. If
|
||||
the head item in the queue is to be overwritten then it does
|
||||
not matter if the queue is full. */
|
||||
/* Is there room on the queue now? The running task must be the
|
||||
highest priority task wanting to access the queue. If the head item
|
||||
in the queue is to be overwritten then it does not matter if the
|
||||
queue is full. */
|
||||
if( ( pxQueue->uxMessagesWaiting < pxQueue->uxLength ) || ( xCopyPosition == queueOVERWRITE ) )
|
||||
{
|
||||
traceQUEUE_SEND( pxQueue );
|
||||
|
@ -1092,11 +1092,11 @@ Queue_t * const pxQueue = ( Queue_t * ) xQueue;
|
|||
{
|
||||
traceQUEUE_SEND_FROM_ISR( pxQueue );
|
||||
|
||||
/* A task can only have an inherited priority if it is a mutex
|
||||
holder - and if there is a mutex holder then the mutex cannot be
|
||||
given from an ISR. Therefore, unlike the xQueueGenericGive()
|
||||
function, there is no need to determine the need for priority
|
||||
disinheritance here or to clear the mutex holder TCB member. */
|
||||
/* Semaphores use xQueueGiveFromISR(), so pxQueue will not be a
|
||||
semaphore or mutex. That means prvCopyDataToQueue() cannot result
|
||||
in a task disinheriting a priority and prvCopyDataToQueue() can be
|
||||
called here even though the disinherit function does not check if
|
||||
the scheduler is suspended before accessing the ready lists. */
|
||||
( void ) prvCopyDataToQueue( pxQueue, pvItemToQueue, xCopyPosition );
|
||||
|
||||
/* The event list is not altered if the queue is locked. This will
|
||||
|
@ -1210,11 +1210,23 @@ BaseType_t xReturn;
|
|||
UBaseType_t uxSavedInterruptStatus;
|
||||
Queue_t * const pxQueue = ( Queue_t * ) xQueue;
|
||||
|
||||
/* Similar to xQueueGenericSendFromISR() but used with semaphores where the
|
||||
item size is 0. Don't directly wake a task that was blocked on a queue
|
||||
read, instead return a flag to say whether a context switch is required or
|
||||
not (i.e. has a task with a higher priority than us been woken by this
|
||||
post). */
|
||||
|
||||
configASSERT( pxQueue );
|
||||
|
||||
/* xQueueGenericSendFromISR() should be used in the item size is not 0. */
|
||||
/* xQueueGenericSendFromISR() should be used instead of xQueueGiveFromISR()
|
||||
if the item size is not 0. */
|
||||
configASSERT( pxQueue->uxItemSize == 0 );
|
||||
|
||||
/* Normally a mutex would not be given from an interrupt, and doing so is
|
||||
definitely wrong if there is a mutex holder as priority inheritance makes no
|
||||
sense for an interrupts, only tasks. */
|
||||
configASSERT( !( ( pxQueue->uxQueueType == queueQUEUE_IS_MUTEX ) && ( pxQueue->pxMutexHolder != NULL ) ) );
|
||||
|
||||
/* RTOS ports that support interrupt nesting have the concept of a maximum
|
||||
system call (or maximum API call) interrupt priority. Interrupts that are
|
||||
above the maximum system call priority are kept permanently enabled, even
|
||||
|
@ -1231,11 +1243,6 @@ Queue_t * const pxQueue = ( Queue_t * ) xQueue;
|
|||
link: http://www.freertos.org/RTOS-Cortex-M3-M4.html */
|
||||
portASSERT_IF_INTERRUPT_PRIORITY_INVALID();
|
||||
|
||||
/* Similar to xQueueGenericSendFromISR() but used with semaphores where the
|
||||
item size is 0. Don't directly wake a task that was blocked on a queue
|
||||
read, instead return a flag to say whether a context switch is required or
|
||||
not (i.e. has a task with a higher priority than us been woken by this
|
||||
post). */
|
||||
uxSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR();
|
||||
{
|
||||
/* When the queue is used to implement a semaphore no data is ever
|
||||
|
@ -1247,10 +1254,10 @@ Queue_t * const pxQueue = ( Queue_t * ) xQueue;
|
|||
|
||||
/* A task can only have an inherited priority if it is a mutex
|
||||
holder - and if there is a mutex holder then the mutex cannot be
|
||||
given from an ISR. Therefore, unlike the xQueueGenericGive()
|
||||
function, there is no need to determine the need for priority
|
||||
disinheritance here or to clear the mutex holder TCB member. */
|
||||
|
||||
given from an ISR. As this is the ISR version of the function it
|
||||
can be assumed there is no mutex holder and no need to determine if
|
||||
priority disinheritance is needed. Simply increase the count of
|
||||
messages (semaphores) available. */
|
||||
++( pxQueue->uxMessagesWaiting );
|
||||
|
||||
/* The event list is not altered if the queue is locked. This will
|
||||
|
@ -1441,8 +1448,6 @@ Queue_t * const pxQueue = ( Queue_t * ) xQueue;
|
|||
any other tasks waiting for the data. */
|
||||
if( listLIST_IS_EMPTY( &( pxQueue->xTasksWaitingToReceive ) ) == pdFALSE )
|
||||
{
|
||||
/* Tasks that are removed from the event list will get added to
|
||||
the pending ready list as the scheduler is still suspended. */
|
||||
if( xTaskRemoveFromEventList( &( pxQueue->xTasksWaitingToReceive ) ) != pdFALSE )
|
||||
{
|
||||
/* The task waiting has a higher priority than this task. */
|
||||
|
@ -2556,6 +2561,7 @@ BaseType_t xReturn;
|
|||
if( pxQueueSetContainer->uxMessagesWaiting < pxQueueSetContainer->uxLength )
|
||||
{
|
||||
traceQUEUE_SEND( pxQueueSetContainer );
|
||||
|
||||
/* The data copied is the handle of the queue that contains data. */
|
||||
xReturn = prvCopyDataToQueue( pxQueueSetContainer, &pxQueue, xCopyPosition );
|
||||
|
||||
|
|
|
@ -387,7 +387,7 @@ count overflows. */
|
|||
* the task. It is inserted at the end of the list.
|
||||
*/
|
||||
#define prvAddTaskToReadyList( pxTCB ) \
|
||||
traceMOVED_TASK_TO_READY_STATE( pxTCB ) \
|
||||
traceMOVED_TASK_TO_READY_STATE( pxTCB ); \
|
||||
taskRECORD_READY_PRIORITY( ( pxTCB )->uxPriority ); \
|
||||
vListInsertEnd( &( pxReadyTasksLists[ ( pxTCB )->uxPriority ] ), &( ( pxTCB )->xGenericListItem ) )
|
||||
/*-----------------------------------------------------------*/
|
||||
|
@ -598,7 +598,7 @@ StackType_t *pxTopOfStack;
|
|||
#if( portSTACK_GROWTH < 0 )
|
||||
{
|
||||
pxTopOfStack = pxNewTCB->pxStack + ( usStackDepth - ( uint16_t ) 1 );
|
||||
pxTopOfStack = ( StackType_t * ) ( ( ( portPOINTER_SIZE_TYPE ) pxTopOfStack ) & ( ( portPOINTER_SIZE_TYPE ) ~portBYTE_ALIGNMENT_MASK ) ); /*lint !e923 MISRA exception. Avoiding casts between pointers and integers is not practical. Size differences accounted for using portPOINTER_SIZE_TYPE type. */
|
||||
pxTopOfStack = ( StackType_t * ) ( ( ( portPOINTER_SIZE_TYPE ) pxTopOfStack ) & ( ~( ( portPOINTER_SIZE_TYPE ) portBYTE_ALIGNMENT_MASK ) ) ); /*lint !e923 MISRA exception. Avoiding casts between pointers and integers is not practical. Size differences accounted for using portPOINTER_SIZE_TYPE type. */
|
||||
|
||||
/* Check the alignment of the calculated top of stack is correct. */
|
||||
configASSERT( ( ( ( portPOINTER_SIZE_TYPE ) pxTopOfStack & ( portPOINTER_SIZE_TYPE ) portBYTE_ALIGNMENT_MASK ) == 0UL ) );
|
||||
|
@ -2395,7 +2395,7 @@ TickType_t xTimeToWake;
|
|||
/* This function should not be called by application code hence the
|
||||
'Restricted' in its name. It is not part of the public API. It is
|
||||
designed for use by kernel code, and has special calling requirements -
|
||||
it should be called from a critical section. */
|
||||
it should be called with the scheduler suspended. */
|
||||
|
||||
|
||||
/* Place the event list item of the TCB in the appropriate event list.
|
||||
|
@ -2406,7 +2406,8 @@ TickType_t xTimeToWake;
|
|||
|
||||
/* We must remove this task from the ready list before adding it to the
|
||||
blocked list as the same list item is used for both lists. This
|
||||
function is called form a critical section. */
|
||||
function is called with the scheduler locked so interrupts will not
|
||||
access the lists at the same time. */
|
||||
if( uxListRemove( &( pxCurrentTCB->xGenericListItem ) ) == ( UBaseType_t ) 0 )
|
||||
{
|
||||
/* The current task must be in a ready list, so there is no need to
|
||||
|
@ -3394,6 +3395,9 @@ TCB_t *pxTCB;
|
|||
locked then the mutex holder might now be NULL. */
|
||||
if( pxMutexHolder != NULL )
|
||||
{
|
||||
/* If the holder of the mutex has a priority below the priority of
|
||||
the task attempting to obtain the mutex then it will temporarily
|
||||
inherit the priority of the task attempting to obtain the mutex. */
|
||||
if( pxTCB->uxPriority < pxCurrentTCB->uxPriority )
|
||||
{
|
||||
/* Adjust the mutex holder state to account for its new
|
||||
|
@ -3408,8 +3412,8 @@ TCB_t *pxTCB;
|
|||
mtCOVERAGE_TEST_MARKER();
|
||||
}
|
||||
|
||||
/* If the task being modified is in the ready state it will need to
|
||||
be moved into a new list. */
|
||||
/* If the task being modified is in the ready state it will need
|
||||
to be moved into a new list. */
|
||||
if( listIS_CONTAINED_WITHIN( &( pxReadyTasksLists[ pxTCB->uxPriority ] ), &( pxTCB->xGenericListItem ) ) != pdFALSE )
|
||||
{
|
||||
if( uxListRemove( &( pxTCB->xGenericListItem ) ) == ( UBaseType_t ) 0 )
|
||||
|
@ -3456,15 +3460,23 @@ TCB_t *pxTCB;
|
|||
|
||||
if( pxMutexHolder != NULL )
|
||||
{
|
||||
/* A task can only have an inherited priority if it holds the mutex.
|
||||
If the mutex is held by a task then it cannot be given from an
|
||||
interrupt, and if a mutex is given by the holding task then it must
|
||||
be the running state task. */
|
||||
configASSERT( pxTCB == pxCurrentTCB );
|
||||
|
||||
configASSERT( pxTCB->uxMutexesHeld );
|
||||
( pxTCB->uxMutexesHeld )--;
|
||||
|
||||
/* Has the holder of the mutex inherited the priority of another
|
||||
task? */
|
||||
if( pxTCB->uxPriority != pxTCB->uxBasePriority )
|
||||
{
|
||||
/* Only disinherit if no other mutexes are held. */
|
||||
if( pxTCB->uxMutexesHeld == ( UBaseType_t ) 0 )
|
||||
{
|
||||
/* A task can only have an inhertied priority if it holds
|
||||
/* A task can only have an inherited priority if it holds
|
||||
the mutex. If the mutex is held by a task then it cannot be
|
||||
given from an interrupt, and if a mutex is given by the
|
||||
holding task then it must be the running state task. Remove
|
||||
|
|
|
@ -827,8 +827,31 @@ Timer_t *pxTimer = ( Timer_t * ) xTimer;
|
|||
void *pvTimerGetTimerID( const TimerHandle_t xTimer )
|
||||
{
|
||||
Timer_t * const pxTimer = ( Timer_t * ) xTimer;
|
||||
void *pvReturn;
|
||||
|
||||
return pxTimer->pvTimerID;
|
||||
configASSERT( xTimer );
|
||||
|
||||
taskENTER_CRITICAL();
|
||||
{
|
||||
pvReturn = pxTimer->pvTimerID;
|
||||
}
|
||||
taskEXIT_CRITICAL();
|
||||
|
||||
return pvReturn;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vTimerSetTimerID( const TimerHandle_t xTimer, void *pvNewID )
|
||||
{
|
||||
Timer_t * const pxTimer = ( Timer_t * ) xTimer;
|
||||
|
||||
configASSERT( xTimer );
|
||||
|
||||
taskENTER_CRITICAL();
|
||||
{
|
||||
pxTimer->pvTimerID = pvNewID;
|
||||
}
|
||||
taskEXIT_CRITICAL();
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
|
Loading…
Reference in a new issue