diff options
author | Daniel Hellstrom <daniel@gaisler.com> | 2012-06-19 08:34:37 +0200 |
---|---|---|
committer | Daniel Hellstrom <daniel@gaisler.com> | 2015-04-17 01:10:18 +0200 |
commit | 16d6e42c43887259316ce53b0bc1d7e21e98726f (patch) | |
tree | a9ea7912616f61944f94e73810fa3bced065b5c5 /c/src/lib/libbsp/sparc/shared/include | |
parent | GRTM: fixed bug where transmitter start loop was optimized away (diff) | |
download | rtems-16d6e42c43887259316ce53b0bc1d7e21e98726f.tar.bz2 |
LEON3: fixed nano seconds support in TLIB
The _Watchdog_Nanoseconds_since_tick_handler() function caller does
not take into account that the timer counter may wrap, underflow or
overflow. Instead, the driver must take that into account. This
GPTIMER DrvMgr driver patch makes use of the IRQ-Pending bit to
determine if a underflow has happened. In that case a greater time
than one tick is returned (even considering the function name..).
The TLIB clock layer must also ACK the interrupt pending bit,
otherwise we couldn't determine whether an IRQ is pending or if
belongs to un old already handled tick IRQ.
Note that this patch only fixes the DrvMgr GPTIMER driver and TLIB,
the standard LEON3 GPTIMER driver still needs a fix.
Diffstat (limited to 'c/src/lib/libbsp/sparc/shared/include')
-rw-r--r-- | c/src/lib/libbsp/sparc/shared/include/tlib.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/c/src/lib/libbsp/sparc/shared/include/tlib.h b/c/src/lib/libbsp/sparc/shared/include/tlib.h index 75ca6997f5..df9466e1e8 100644 --- a/c/src/lib/libbsp/sparc/shared/include/tlib.h +++ b/c/src/lib/libbsp/sparc/shared/include/tlib.h @@ -35,6 +35,7 @@ struct tlib_drv { void (*restart)(struct tlib_dev *hand); void (*get_counter)(struct tlib_dev *hand, unsigned int *counter); int (*custom)(struct tlib_dev *hand, int cmd, void *arg); + int (*int_pend)(struct tlib_dev *hand, int ack); }; struct tlib_dev { @@ -167,3 +168,10 @@ static inline void tlib_custom(void *hand, int cmd, void *arg) dev->drv->custom(dev, cmd, arg); } + +static inline int tlib_interrupt_pending(void *hand, int ack) +{ + struct tlib_dev *dev = hand; + + return dev->drv->int_pend(dev, ack); +} |