mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2026-10-10 08:02:57 -04:00
Add timer system state snapshot APIs
This commit is contained in:
parent
4269c69a16
commit
98dcb8f9d7
3 changed files with 214 additions and 1 deletions
|
|
@ -1626,6 +1626,22 @@
|
|||
#define traceRETURN_xTimerGetExpiryTime( xReturn )
|
||||
#endif
|
||||
|
||||
#ifndef traceENTER_uxTimerGetNumberOfTimers
|
||||
#define traceENTER_uxTimerGetNumberOfTimers()
|
||||
#endif
|
||||
|
||||
#ifndef traceRETURN_uxTimerGetNumberOfTimers
|
||||
#define traceRETURN_uxTimerGetNumberOfTimers( uxNumberOfTimers )
|
||||
#endif
|
||||
|
||||
#ifndef traceENTER_uxTimerGetSystemState
|
||||
#define traceENTER_uxTimerGetSystemState( pxTimerStatusArray, uxArraySize )
|
||||
#endif
|
||||
|
||||
#ifndef traceRETURN_uxTimerGetSystemState
|
||||
#define traceRETURN_uxTimerGetSystemState( uxNumberOfTimers )
|
||||
#endif
|
||||
|
||||
#ifndef traceENTER_xTimerGetStaticBuffer
|
||||
#define traceENTER_xTimerGetStaticBuffer( xTimer, ppxTimerBuffer )
|
||||
#endif
|
||||
|
|
@ -3319,8 +3335,9 @@ typedef struct xSTATIC_TIMER
|
|||
TaskFunction_t pvDummy6;
|
||||
#if ( configUSE_TRACE_FACILITY == 1 )
|
||||
UBaseType_t uxDummy7;
|
||||
void * pvDummy8;
|
||||
#endif
|
||||
uint8_t ucDummy8;
|
||||
uint8_t ucDummy9;
|
||||
} StaticTimer_t;
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -77,6 +77,19 @@
|
|||
struct tmrTimerControl; /* The old naming convention is used to prevent breaking kernel aware debuggers. */
|
||||
typedef struct tmrTimerControl * TimerHandle_t;
|
||||
|
||||
/* Used with uxTimerGetSystemState() to return the state of each timer in the
|
||||
* timer registry. */
|
||||
typedef struct xTIMER_STATUS
|
||||
{
|
||||
TimerHandle_t xHandle; /* The handle of the timer. This value will be invalid if the timer is deleted after the structure is populated. */
|
||||
const char * pcTimerName; /* A pointer to the name assigned when the timer was created. */
|
||||
TickType_t xTimerPeriodInTicks; /* The timer's period in ticks. */
|
||||
TickType_t xNextExpiryTime; /* The next expiry time, or 0 if the timer is inactive. */
|
||||
void * pvTimerID; /* The application-supplied timer ID. */
|
||||
BaseType_t xIsActive; /* pdTRUE if the timer is active, otherwise pdFALSE. */
|
||||
BaseType_t xAutoReload; /* pdTRUE for an auto-reload timer, otherwise pdFALSE. */
|
||||
} TimerStatus_t;
|
||||
|
||||
/*
|
||||
* Defines the prototype to which timer callback functions must conform.
|
||||
*/
|
||||
|
|
@ -1333,6 +1346,50 @@ TickType_t xTimerGetPeriod( TimerHandle_t xTimer ) PRIVILEGED_FUNCTION;
|
|||
*/
|
||||
TickType_t xTimerGetExpiryTime( TimerHandle_t xTimer ) PRIVILEGED_FUNCTION;
|
||||
|
||||
/**
|
||||
* configUSE_TRACE_FACILITY must be set to 1 for
|
||||
* uxTimerGetNumberOfTimers() to be available.
|
||||
*
|
||||
* @return The number of timers currently stored in the timer registry.
|
||||
*/
|
||||
#if ( configUSE_TRACE_FACILITY == 1 )
|
||||
UBaseType_t uxTimerGetNumberOfTimers( void ) PRIVILEGED_FUNCTION;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* configUSE_TRACE_FACILITY must be set to 1 for
|
||||
* uxTimerGetSystemState() to be available.
|
||||
*
|
||||
* uxTimerGetSystemState() populates one TimerStatus_t structure for each
|
||||
* timer currently stored in the timer registry. Timers are automatically
|
||||
* added to the registry when they are created and removed when they are
|
||||
* deleted.
|
||||
*
|
||||
* This function is intended for debugging use and suspends the scheduler while
|
||||
* the registry is copied. The returned values provide a best-effort snapshot
|
||||
* of timer state. Timer commands still waiting in the timer command queue are
|
||||
* not reflected.
|
||||
*
|
||||
* TimerStatus_t contains borrowed handles and pointers. A timer handle becomes
|
||||
* invalid when that timer is deleted, and the application must ensure that the
|
||||
* memory referenced by timer names and IDs remains valid while it is used.
|
||||
*
|
||||
* When MPU wrappers are enabled, this API is privileged-only.
|
||||
*
|
||||
* @param pxTimerStatusArray A pointer to an array of TimerStatus_t structures.
|
||||
* The array must contain at least one entry for each timer in the registry. The
|
||||
* number of timers can be obtained using uxTimerGetNumberOfTimers().
|
||||
*
|
||||
* @param uxArraySize The number of TimerStatus_t entries in the array.
|
||||
*
|
||||
* @return The number of TimerStatus_t structures populated, or zero if the
|
||||
* supplied array is too small or pxTimerStatusArray is NULL.
|
||||
*/
|
||||
#if ( configUSE_TRACE_FACILITY == 1 )
|
||||
UBaseType_t uxTimerGetSystemState( TimerStatus_t * const pxTimerStatusArray,
|
||||
const UBaseType_t uxArraySize ) PRIVILEGED_FUNCTION;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* BaseType_t xTimerGetStaticBuffer( TimerHandle_t xTimer,
|
||||
* StaticTimer_t ** ppxTimerBuffer );
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue