![]() |
m2mb API docs
25.30.003
m2mb API sets documentation
|
HW timer prototypes. More...
Go to the source code of this file.
Macros | |
| #define | M2MB_HWTMR_INVALID 0 |
| #define | M2MB_HWTMR_INVALID_ATTR 0 |
| #define | M2MB_HWTMR_PERIODIC_TMR 1 |
| #define | M2MB_HWTMR_ONESHOT_TMR 0 |
| #define | M2MB_HWTMR_AUTOSTART 1 |
| #define | M2MB_HWTMR_NOT_START 0 |
| #define | M2MB_HW_TASK_AUTOSTART 1 /* use M2MB_HWTMR_AUTOSTART instead */ |
| #define | M2MB_HW_TASK_NOT_START 0 /* use M2MB_HWTMR_NOT_START instead */ |
| #define | M2MB_HWTMR_MIN_TIMEOUT ( 100 ) /* minimum allowed timeout in us */ |
| #define | M2MB_HWTMR_MAX_TIMEOUT ( ( 1<<(sizeof(MEM_W)*4 - 1) ) | ~( 1<<(sizeof(MEM_W)*4 - 1) ) ) |
| #define | M2MB_HWTMR_UNIT_FACTOR ( 1000 ) /* is ms to us: current base time in us */ |
| #define | M2MB_HWTMR_TIME_MS(timems) ( timems * M2MB_HWTMR_UNIT_FACTOR ) |
| #define | M2MB_HWTMR_TIME_S(times) M2MB_HWTMR_TIME_MS(times * 1000 ) |
| #define | m2mb_hwTmr_setAttrItem_(h, args...) m2mb_hwTmr_setAttrItem( h, CMDS_ARGS( args ) ) |
| #define | enum_rename(a) M2MB_HW_##a, M2MB_HWTMR_##a = M2MB_HW_##a |
| #define | enum_rename_set(a, val) M2MB_HW_##a = val, M2MB_HWTMR_##a = M2MB_HW_##a |
Functions | |
| M2MB_HWTMR_RESULT_E | m2mb_hwTmr_init (M2MB_HWTMR_HANDLE *pTmrHwHandle, M2MB_HWTMR_ATTR_HANDLE *pTmrHwAttr) |
| Application timer Creation. More... | |
| M2MB_HWTMR_RESULT_E | m2mb_hwTmr_deinit (M2MB_HWTMR_HANDLE tmrHwHandle) |
| Timer deinit => deletion. More... | |
| M2MB_HWTMR_RESULT_E | m2mb_hwTmr_start (M2MB_HWTMR_HANDLE tmrHwHandle) |
| Start application timer. More... | |
| M2MB_HWTMR_RESULT_E | m2mb_hwTmr_stop (M2MB_HWTMR_HANDLE tmrHwHandle) |
| Stop an application timer. More... | |
| M2MB_HWTMR_RESULT_E | m2mb_hwTmr_setAttrItem (M2MB_HWTMR_ATTR_HANDLE *pTmrHwAttrHandle, UINT8 nCmds,...) |
| Set specific attribute for timer creation. More... | |
| M2MB_HWTMR_RESULT_E | m2mb_hwTmr_getItem (M2MB_HWTMR_HANDLE tmrHwHandle, M2MB_HWTMR_SEL_CMD_E selCmd, MEM_W *pOut, void *pIn) |
| Get specific properties of the timer. More... | |
| M2MB_HWTMR_RESULT_E | m2mb_hwTmr_setItem (M2MB_HWTMR_HANDLE tmrHwHandle, M2MB_HWTMR_SEL_CMD_E selCmd, void *pIn) |
| Set specific properties of the timer. More... | |
| M2MB_HWTMR_RESULT_E | m2mb_hwTmr_timeGet_ms (UINT64 *ms_time) |
| get time in ms More... | |
HW timer prototypes.
m2m/m2m_generic/common/m2mb_inc/m2mb_hwTmr.h
Basic functions for HW timer are provided
@notes Dependencies: m2mb_types.h
| M2MB_HWTMR_RESULT_E m2mb_hwTmr_deinit | ( | M2MB_HWTMR_HANDLE | tmrHwHandle | ) |
Timer deinit => deletion.
This service deletes the specified hw timer. The resources will be released. It is the application responsibility to prevent use of a deleted timer.
| [in] | tmrHwHandle | handle of the timer |
Example
| M2MB_HWTMR_RESULT_E m2mb_hwTmr_getItem | ( | M2MB_HWTMR_HANDLE | tmrHwHandle, |
| M2MB_HWTMR_SEL_CMD_E | selCmd, | ||
| MEM_W * | pOut, | ||
| void * | pIn | ||
| ) |
Get specific properties of the timer.
This service retrieve value for specified parameter of the specified timer Selecting cmd, a parameter to be retrieved can be set To be used when timer is already created: Right usage is under application's responsibility
| [in] | tmrHwHandle | handle of timer |
| [in] | selCmd | Select parameter to be set (see M2MB_HWTMR_SEL_CMD_E) param [out] pOut pointer Output parameter got: its meaning depend on selCmd used See examples as general pointer it is set to MEM_W |
| [in] | pIn | pointer to void, general Parameter to be specified, if any, to get right output See examples If parameter is not needed, use NULL |
Example
| M2MB_HWTMR_RESULT_E m2mb_hwTmr_init | ( | M2MB_HWTMR_HANDLE * | pTmrHwHandle, |
| M2MB_HWTMR_ATTR_HANDLE * | pTmrHwAttr | ||
| ) |
Application timer Creation.
This service creates an application timer with the specified Timer attributes
| [out] | pTmrHwHandle | pointer to timer handle |
| [in] | pTmrHwAttr | pointer to timer attribute handle |
Example Complete use of Timer with its callback, the time unit in USEC. Also ticks period M2MB_HWTMR_SEL_CMD_TICKS_PERIOD can be select, which is the period expressed in number of system ticks Period MUST BE not 0
| M2MB_HWTMR_RESULT_E m2mb_hwTmr_setAttrItem | ( | M2MB_HWTMR_ATTR_HANDLE * | pTmrHwAttrHandle, |
| UINT8 | nCmds, | ||
| ... | |||
| ) |
Set specific attribute for timer creation.
This service set the attribute (or create it) to be used for timer creation
| [in] | pTmrHwAttrHandle | pointer to timer attribute |
| [in] | nCmds | number of commands to be issued at once |
| [in] | ... | variable inputs, N cmds (see M2MB_HWTMR_SEL_CMD_E) followed by N arguments for their respective issued commands. CMDS(...) and CMDS_ARGS(...) macro can be used to better insert cmd and parameters and to better control right insertion |
Example
| M2MB_HWTMR_RESULT_E m2mb_hwTmr_setItem | ( | M2MB_HWTMR_HANDLE | tmrHwHandle, |
| M2MB_HWTMR_SEL_CMD_E | selCmd, | ||
| void * | pIn | ||
| ) |
Set specific properties of the timer.
This service set value for specified parameter of the specified timer if available Selecting cmd, a parameter to be set can be selected To be used when timer is already created: its right usage is under application responsibility
| [in] | tmrHwHandle | handle of timer |
| [in] | selCmd | Select parameter to be set (see M2MB_HWTMR_SEL_CMD_E) |
| [in] | pIn |
Example
| M2MB_HWTMR_RESULT_E m2mb_hwTmr_start | ( | M2MB_HWTMR_HANDLE | tmrHwHandle | ) |
Start application timer.
This service starts the specified application timer. The expiration routines of timers that expire at the same time are executed in the order they were activated.
| [in] | tmrHwHandle | handle of timer |
Example
| M2MB_HWTMR_RESULT_E m2mb_hwTmr_stop | ( | M2MB_HWTMR_HANDLE | tmrHwHandle | ) |
Stop an application timer.
This service stops the specified application timer. If the timer is already stopped, this service has no effect
| [in] | tmrHwHandle | handle of timer |
Example
| M2MB_HWTMR_RESULT_E m2mb_hwTmr_timeGet_ms | ( | UINT64 * | ms_time | ) |
get time in ms
Get a timestamp from System Time in millisecond units from 6 Jan 1980 00:00:00.
Example