aboutsummaryrefslogtreecommitdiff
path: root/sys/arm/broadcom/bcm2835/bcm2835_systimer.c
diff options
context:
space:
mode:
authorAlexander Motin <mav@FreeBSD.org>2013-02-28 13:46:03 +0000
committerAlexander Motin <mav@FreeBSD.org>2013-02-28 13:46:03 +0000
commitfdc5dd2d2fedb812958cf7c835a5dce2dcd874c5 (patch)
treec8556591f85961643a9b4ddfaaa7c1008bb03d81 /sys/arm/broadcom/bcm2835/bcm2835_systimer.c
parentd9ddf0c057f436df4eb9ac8b8a60640a84394f08 (diff)
downloadsrc-fdc5dd2d2fedb812958cf7c835a5dce2dcd874c5.tar.gz
src-fdc5dd2d2fedb812958cf7c835a5dce2dcd874c5.zip
MFcalloutng:
Switch eventtimers(9) from using struct bintime to sbintime_t. Even before this not a single driver really supported full dynamic range of struct bintime even in theory, not speaking about practical inexpediency. This change legitimates the status quo and cleans up the code.
Notes
Notes: svn path=/head/; revision=247463
Diffstat (limited to 'sys/arm/broadcom/bcm2835/bcm2835_systimer.c')
-rw-r--r--sys/arm/broadcom/bcm2835/bcm2835_systimer.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/sys/arm/broadcom/bcm2835/bcm2835_systimer.c b/sys/arm/broadcom/bcm2835/bcm2835_systimer.c
index 97ec43aebcf2..1d7fddaea8f8 100644
--- a/sys/arm/broadcom/bcm2835/bcm2835_systimer.c
+++ b/sys/arm/broadcom/bcm2835/bcm2835_systimer.c
@@ -118,19 +118,16 @@ bcm_systimer_tc_get_timecount(struct timecounter *tc)
}
static int
-bcm_systimer_start(struct eventtimer *et, struct bintime *first,
- struct bintime *period)
+bcm_systimer_start(struct eventtimer *et, sbintime_t first, sbintime_t period)
{
struct systimer *st = et->et_priv;
uint32_t clo;
uint32_t count;
register_t s;
- if (first != NULL) {
+ if (first != 0) {
- count = (st->et.et_frequency * (first->frac >> 32)) >> 32;
- if (first->sec != 0)
- count += st->et.et_frequency * first->sec;
+ count = ((uint32_t)et->et_frequency * first) >> 32;
s = intr_disable();
clo = bcm_systimer_tc_read_4(SYSTIMER_CLO);
@@ -238,12 +235,10 @@ bcm_systimer_attach(device_t dev)
sc->st[DEFAULT_TIMER].et.et_flags = ET_FLAGS_ONESHOT;
sc->st[DEFAULT_TIMER].et.et_quality = 1000;
sc->st[DEFAULT_TIMER].et.et_frequency = sc->sysclk_freq;
- sc->st[DEFAULT_TIMER].et.et_min_period.sec = 0;
- sc->st[DEFAULT_TIMER].et.et_min_period.frac =
- ((MIN_PERIOD << 32) / sc->st[DEFAULT_TIMER].et.et_frequency) << 32;
- sc->st[DEFAULT_TIMER].et.et_max_period.sec = 0xfffffff0U / sc->st[DEFAULT_TIMER].et.et_frequency;
- sc->st[DEFAULT_TIMER].et.et_max_period.frac =
- ((0xfffffffeLLU << 32) / sc->st[DEFAULT_TIMER].et.et_frequency) << 32;
+ sc->st[DEFAULT_TIMER].et.et_min_period =
+ (MIN_PERIOD << 32) / sc->st[DEFAULT_TIMER].et.et_frequency;
+ sc->st[DEFAULT_TIMER].et.et_max_period =
+ (0xfffffffeLLU << 32) / sc->st[DEFAULT_TIMER].et.et_frequency;
sc->st[DEFAULT_TIMER].et.et_start = bcm_systimer_start;
sc->st[DEFAULT_TIMER].et.et_stop = bcm_systimer_stop;
sc->st[DEFAULT_TIMER].et.et_priv = &sc->st[DEFAULT_TIMER];