summaryrefslogtreecommitdiffstats
path: root/sys/arm/versatile/sp804.c
diff options
context:
space:
mode:
authormav <mav@FreeBSD.org>2013-02-28 13:46:03 +0000
committermav <mav@FreeBSD.org>2013-02-28 13:46:03 +0000
commit6cf7cc6e4d8da1cf9aba1c481b914e4ca5e9f38f (patch)
treec8556591f85961643a9b4ddfaaa7c1008bb03d81 /sys/arm/versatile/sp804.c
parent240074414d4919ebd889f27087c72783a7ed9b19 (diff)
downloadFreeBSD-src-6cf7cc6e4d8da1cf9aba1c481b914e4ca5e9f38f.zip
FreeBSD-src-6cf7cc6e4d8da1cf9aba1c481b914e4ca5e9f38f.tar.gz
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.
Diffstat (limited to 'sys/arm/versatile/sp804.c')
-rw-r--r--sys/arm/versatile/sp804.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/sys/arm/versatile/sp804.c b/sys/arm/versatile/sp804.c
index 82a1889..000ccb6 100644
--- a/sys/arm/versatile/sp804.c
+++ b/sys/arm/versatile/sp804.c
@@ -120,18 +120,15 @@ sp804_timer_tc_get_timecount(struct timecounter *tc)
}
static int
-sp804_timer_start(struct eventtimer *et, struct bintime *first,
- struct bintime *period)
+sp804_timer_start(struct eventtimer *et, sbintime_t first, sbintime_t period)
{
struct sp804_timer_softc *sc = et->et_priv;
uint32_t count, reg;
- if (first != NULL) {
+ if (first != 0) {
sc->et_enabled = 1;
- count = (sc->et.et_frequency * (first->frac >> 32)) >> 32;
- if (first->sec != 0)
- count += sc->et.et_frequency * first->sec;
+ count = ((uint32_t)et->et_frequency * first) >> 32;
sp804_timer_tc_write_4(SP804_TIMER2_LOAD, count);
reg = TIMER_CONTROL_32BIT | TIMER_CONTROL_INTREN |
@@ -142,7 +139,7 @@ sp804_timer_start(struct eventtimer *et, struct bintime *first,
return (0);
}
- if (period != NULL) {
+ if (period != 0) {
panic("period");
}
@@ -264,12 +261,8 @@ sp804_timer_attach(device_t dev)
sc->et.et_flags = ET_FLAGS_PERIODIC | ET_FLAGS_ONESHOT;
sc->et.et_quality = 1000;
sc->et.et_frequency = sc->sysclk_freq / DEFAULT_DIVISOR;
- sc->et.et_min_period.sec = 0;
- sc->et.et_min_period.frac =
- ((0x00000002LLU << 32) / sc->et.et_frequency) << 32;
- sc->et.et_max_period.sec = 0xfffffff0U / sc->et.et_frequency;
- sc->et.et_max_period.frac =
- ((0xfffffffeLLU << 32) / sc->et.et_frequency) << 32;
+ sc->et.et_min_period = (0x00000002LLU << 32) / sc->et.et_frequency;
+ sc->et.et_max_period = (0xfffffffeLLU << 32) / sc->et.et_frequency;
sc->et.et_start = sp804_timer_start;
sc->et.et_stop = sp804_timer_stop;
sc->et.et_priv = sc;
OpenPOWER on IntegriCloud