mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
ztimer: apply uncrustify patches
This commit is contained in:
parent
8a31d2ec9f
commit
7e3846b6a4
@ -411,7 +411,7 @@ void ztimer_set_msg(ztimer_clock_t *clock, ztimer_t *timer, uint32_t offset,
|
||||
int ztimer_msg_receive_timeout(ztimer_clock_t *clock, msg_t *msg,
|
||||
uint32_t timeout);
|
||||
|
||||
/* created with dist/tools/define2u16.py */
|
||||
/* created with dist/tools/define2u16.py */
|
||||
#define MSG_ZTIMER 0xc83e /**< msg type used by ztimer_msg_receive_timeout */
|
||||
|
||||
/**
|
||||
@ -484,7 +484,8 @@ void ztimer_sleep(ztimer_clock_t *clock, uint32_t duration);
|
||||
* @param[in] clock ztimer clock to use
|
||||
* @param[in] duration duration to spin, in @p clock time units
|
||||
*/
|
||||
static inline void ztimer_spin(ztimer_clock_t *clock, uint32_t duration) {
|
||||
static inline void ztimer_spin(ztimer_clock_t *clock, uint32_t duration)
|
||||
{
|
||||
uint32_t end = ztimer_now(clock) + duration;
|
||||
|
||||
/* Rely on integer overflow. `end - now` will be smaller than `duration`,
|
||||
|
@ -87,7 +87,8 @@ static inline uint64_t xtimer_now_usec64(void)
|
||||
return ztimer_now(ZTIMER_USEC);
|
||||
}
|
||||
|
||||
static inline void _ztimer_sleep_scale(ztimer_clock_t *clock, uint32_t time, uint32_t scale)
|
||||
static inline void _ztimer_sleep_scale(ztimer_clock_t *clock, uint32_t time,
|
||||
uint32_t scale)
|
||||
{
|
||||
const uint32_t max_sleep = UINT32_MAX / scale;
|
||||
|
||||
@ -104,7 +105,8 @@ static inline void xtimer_sleep(uint32_t seconds)
|
||||
/* TODO: use ZTIMER_SEC */
|
||||
if (IS_ACTIVE(MODULE_ZTIMER_MSEC)) {
|
||||
_ztimer_sleep_scale(ZTIMER_MSEC, seconds, 1000);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
_ztimer_sleep_scale(ZTIMER_USEC, seconds, 1000000);
|
||||
}
|
||||
}
|
||||
@ -113,7 +115,8 @@ static inline void xtimer_msleep(uint32_t milliseconds)
|
||||
{
|
||||
if (IS_ACTIVE(MODULE_ZTIMER_MSEC)) {
|
||||
ztimer_sleep(ZTIMER_MSEC, milliseconds);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
_ztimer_sleep_scale(ZTIMER_USEC, milliseconds, 1000);
|
||||
}
|
||||
}
|
||||
@ -204,6 +207,7 @@ static inline void xtimer_spin(xtimer_ticks32_t ticks)
|
||||
{
|
||||
assert(ticks < US_PER_MS);
|
||||
ztimer_now_t start = ztimer_now(ZTIMER_USEC);
|
||||
|
||||
while (ztimer_now(ZTIMER_USEC) - start < ticks) {
|
||||
/* busy waiting */
|
||||
}
|
||||
|
@ -64,6 +64,7 @@ static uint32_t ztimer_convert_frac_op_now(ztimer_clock_t *z)
|
||||
return 0;
|
||||
}
|
||||
uint32_t scaled = frac_scale(&self->scale_now, lower_now);
|
||||
|
||||
DEBUG("ztimer_convert_frac_op_now() %" PRIu32 "->%" PRIu32 "\n", lower_now,
|
||||
scaled);
|
||||
return scaled;
|
||||
|
@ -169,8 +169,10 @@ ztimer_now_t _ztimer_now_extend(ztimer_clock_t *clock)
|
||||
assert(clock->max_value);
|
||||
unsigned state = irq_disable();
|
||||
uint32_t lower_now = clock->ops->now(clock);
|
||||
|
||||
DEBUG(
|
||||
"ztimer_now() checkpoint=%" PRIu32 " lower_last=%" PRIu32 " lower_now=%" PRIu32 " diff=%" PRIu32 "\n",
|
||||
"ztimer_now() checkpoint=%" PRIu32 " lower_last=%" PRIu32
|
||||
" lower_now=%" PRIu32 " diff=%" PRIu32 "\n",
|
||||
(uint32_t)clock->checkpoint, clock->lower_last, lower_now,
|
||||
_add_modulo(lower_now, clock->lower_last, clock->max_value));
|
||||
clock->checkpoint += _add_modulo(lower_now, clock->lower_last,
|
||||
@ -178,6 +180,7 @@ ztimer_now_t _ztimer_now_extend(ztimer_clock_t *clock)
|
||||
clock->lower_last = lower_now;
|
||||
DEBUG("ztimer_now() returning %" PRIu32 "\n", (uint32_t)clock->checkpoint);
|
||||
ztimer_now_t now = clock->checkpoint;
|
||||
|
||||
irq_restore(state);
|
||||
return now;
|
||||
}
|
||||
|
@ -50,6 +50,7 @@ void _timestamp_to_gmt_civil(struct tm *_tm, uint32_t epoch)
|
||||
epoch /= 86400;
|
||||
uint32_t h = s / 3600;
|
||||
uint32_t m = s / 60 % 60;
|
||||
|
||||
s = s % 60;
|
||||
uint32_t x = (epoch * 4 + 102032) / 146097 + 15;
|
||||
uint32_t b = epoch + 2442113 + x - (x / 4);
|
||||
@ -82,6 +83,7 @@ static uint32_t _ztimer_periph_rtc_now(ztimer_clock_t *clock)
|
||||
(void)clock;
|
||||
|
||||
struct tm time;
|
||||
|
||||
rtc_get_time(&time);
|
||||
|
||||
return _gmt_civil_to_timestamp(time.tm_year + 1900, time.tm_mon,
|
||||
|
@ -80,6 +80,7 @@ void ztimer_periph_timer_init(ztimer_periph_timer_t *clock, tim_t dev,
|
||||
clock->super.ops = &_ztimer_periph_timer_ops;
|
||||
clock->super.max_value = max_val;
|
||||
int ret = timer_init(dev, freq, _ztimer_periph_timer_callback, clock);
|
||||
|
||||
(void)ret;
|
||||
assert(ret == 0);
|
||||
ztimer_init_extend(&clock->super);
|
||||
|
@ -158,7 +158,8 @@ void ztimer_set_wakeup(ztimer_clock_t *clock, ztimer_t *timer, uint32_t offset,
|
||||
ztimer_set(clock, timer, offset);
|
||||
}
|
||||
|
||||
static void timeout_cb(void *arg) {
|
||||
static void timeout_cb(void *arg)
|
||||
{
|
||||
mutex_cancel(arg);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user