24.01.2016 07:28, Peter Crosthwaite пишет: [snip]
/* Set counter frequency in Hz. */ void ptimer_set_freq(ptimer_state *s, uint32_t freq) { + g_assert(freq != 0); s->delta = ptimer_get_count(s); s->period = 1000000000ll / freq; s->period_frac = (1000000000ll << 32) / freq;
I noticed that this should be g_assert(freq != 0 && freq <= 1000000000), otherwise it possible to make period = 0 for the running timer when setting freq > 1GHz, which doesn't make sense because we can't set period < 1ns.
Or maybe we should clamp period = max(1, period), freq = min(1000000000, freq) to "allow" higher timer freq's?
What do you think? -- Dmitry