1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

ztimer/convert: pass-thru start/stop ops to lower timer

This commit is contained in:
Juergen Fitschen 2022-02-04 18:51:21 +01:00 committed by Jue
parent 9fbb4d3391
commit 90b2f3158c
5 changed files with 44 additions and 0 deletions

View File

@ -71,6 +71,24 @@ void ztimer_convert_init(ztimer_convert_t *ztimer_convert,
*/
void ztimer_convert_cancel(ztimer_clock_t *clock);
/**
* @brief ztimer_convert common start() op
*
* Used by some conversion modules as ztimer_clock_t::ops.start().
*
* @param[in] clock ztimer clock to operate on
*/
void ztimer_convert_start(ztimer_clock_t *clock);
/**
* @brief ztimer_convert common stop() op
*
* Used by some conversion modules as ztimer_clock_t::ops.stop().
*
* @param[in] clock ztimer clock to operate on
*/
void ztimer_convert_stop(ztimer_clock_t *clock);
#ifdef __cplusplus
}
#endif

View File

@ -35,6 +35,20 @@ void ztimer_convert_cancel(ztimer_clock_t *clock)
ztimer_remove(ztimer_convert->lower, &ztimer_convert->lower_entry);
}
void ztimer_convert_start(ztimer_clock_t *clock)
{
ztimer_convert_t *ztimer_convert = (ztimer_convert_t *)clock;
ztimer_acquire(ztimer_convert->lower);
}
void ztimer_convert_stop(ztimer_clock_t *clock)
{
ztimer_convert_t *ztimer_convert = (ztimer_convert_t *)clock;
ztimer_release(ztimer_convert->lower);
}
void ztimer_convert_init(ztimer_convert_t *ztimer_convert,
ztimer_clock_t *lower,
uint32_t max_value)

View File

@ -74,6 +74,10 @@ static const ztimer_ops_t ztimer_convert_frac_ops = {
.set = ztimer_convert_frac_op_set,
.now = ztimer_convert_frac_op_now,
.cancel = ztimer_convert_cancel,
#if MODULE_ZTIMER_ONDEMAND
.start = ztimer_convert_start,
.stop = ztimer_convert_stop,
#endif
};
static void ztimer_convert_frac_compute_scale(ztimer_convert_frac_t *self,

View File

@ -98,6 +98,10 @@ static const ztimer_ops_t _ztimer_convert_muldiv64_ops = {
.set = _ztimer_convert_muldiv64_set,
.now = _ztimer_convert_muldiv64_now,
.cancel = ztimer_convert_cancel,
#if MODULE_ZTIMER_ONDEMAND
.start = ztimer_convert_start,
.stop = ztimer_convert_stop,
#endif
};
void ztimer_convert_muldiv64_init(

View File

@ -78,6 +78,10 @@ static const ztimer_ops_t _ztimer_convert_shift_ops_up = {
.set = _ztimer_convert_shift_up_set,
.now = _ztimer_convert_shift_up_now,
.cancel = ztimer_convert_cancel,
#if MODULE_ZTIMER_ONDEMAND
.start = ztimer_convert_start,
.stop = ztimer_convert_stop,
#endif
};
void ztimer_convert_shift_up_init(ztimer_convert_shift_t *clock,