eLooM for STM32 application
v3.3.0
A framework for multitasking low power embedded applications powerd by STM32
|
Timestamp service. More...
#include "drivers/HwTSDriver.h"
#include "drivers/HwTSDriver_vtbl.h"
#include "drivers/SwTSDriver.h"
#include "drivers/SwTSDriver_vtbl.h"
Go to the source code of this file.
Data Structures | |
struct | _SysTimestamp |
Typedefs | |
typedef struct _SysTimestamp | SysTimestamp_t |
Functions | |
sys_error_code_t | SysTsStart (SysTimestamp_t *_this, bool bReset) |
sys_error_code_t | SysTsStop (SysTimestamp_t *_this) |
double | SysTsGetTimestampF (SysTimestamp_t *_this) |
uint64_t | SysTsGetTimestampN (SysTimestamp_t *_this) |
SysTimestamp_t * | SysGetTimestampSrv (void) |
Timestamp service.
The framework timestamp service provides an efficient way to get a common timestamp across the whole application. The service is configured with three parameter in the global sysgonfig.h file:
When the service is not enabled, it does not increase the memory footprint of eLooM. The timestamp service can use a software driver base on the RTOS tick or a dedicated hardware timer as showed in the class diagram in Fig.1
Valid value are for SYS_TS_CFG_TSDRIVER_PARAMS are:
The configuration structure for an hardware timer. It must be compatible with SysTimestamp_t type (see SwTSDriver_t).
To use the service the application call the SysTsStart() first, then it can use SysTsGetTimestampF() or SysTsGetTimestampN() to get the current value of the timestamp in second as a double , or in tick as 64 bit integer. These functions can be used both in the code of a task and in an ISR.
This is an example code:
Copyright (c) 2022 STMicroelectronics. All rights reserved.
This software is licensed under terms that can be found in the LICENSE file in the root directory of this software component. If no LICENSE file comes with this software, it is provided AS-IS.
typedef struct _SysTimestamp SysTimestamp_t |
Create type name for _SysTimestamp.
SysTimestamp_t * SysGetTimestampSrv | ( | void | ) |
Get an instance of the system timestamp service.
double SysTsGetTimestampF | ( | SysTimestamp_t * | _this | ) |
Get the system timestamp in seconds. If the service was not started then the value is undefined. It can be used also form an ISR.
_this | [IN] specifies a system timestamp object. |
uint64_t SysTsGetTimestampN | ( | SysTimestamp_t * | _this | ) |
Get the system timestamp in ??tick??. If the service was not started then the value is undefined. It can be used also form an ISR.
_this | [IN] specifies a system timestamp object. |
sys_error_code_t SysTsStart | ( | SysTimestamp_t * | _this, |
bool | bReset | ||
) |
Public API declaration Start the system timestamp service. The service must be started before getting the timestamp value. If the service is not started the value returned by SysTsGetTimestampF() and SysTsGetTimestampN() is undefined. It is possible to reset the timestamp counter to zero by using the bReset parameter.
_this | [IN] specifies a system timestamp object. |
bReset | [IN] if true the timestamp counter is reset to zero. |
sys_error_code_t SysTsStop | ( | SysTimestamp_t * | _this | ) |
Stop the system timestamp service. When the service is stopped the value of the timestamp counter is frozen.
_this | [IN] specifies a system timestamp object. |