contiki/cpu/cc2538
Benoît Thébaudeau b7515004da cc2538: clock: Fix secs update in clock_adjust()
Whole elapsed seconds are added to secs first, so only the remaining subsecond
ticks should then be subtracted from second_countdown in order to decide whether
secs should be incremented again.

Otherwise, secs is not correctly updated in some cases, typically if the bit 7
of ticks is 1. E.g., with ticks = 128 (i.e. exactly 1 s elapsed) and
second_countdown = 128, secs was first incremented as expected, then 128 was
subtracted from second_countdown, giving 0 and triggering an unwanted second
increment of secs. Or with ticks = 129 (i.e. 1 s + 1 tick) and
second_countdown = 1, secs was first incremented as expected, then 129 was
subtracted from second_countdown, giving 128 and missing a second increment of
secs that should have occurred because second_countdown wrapped around.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
2013-12-06 13:02:37 +01:00
..
dev cc2538: lpm: Fix RTIMER_NOW() upon wake-up 2013-12-05 20:23:29 +01:00
usb cc2538: usb: Make the GPIO driving the pull-up optional 2013-11-25 15:15:35 +01:00
cc2538.lds cc2538: Add header file for flash CCA page and use it 2013-12-05 18:45:51 +01:00
clock.c cc2538: clock: Fix secs update in clock_adjust() 2013-12-06 13:02:37 +01:00
cpu.c New Platform: TI CC2538 Development Kit 2013-04-06 21:07:31 +01:00
cpu.h New Platform: TI CC2538 Development Kit 2013-04-06 21:07:31 +01:00
dbg.c New Platform: TI CC2538 Development Kit 2013-04-06 21:07:31 +01:00
dbg.h New Platform: TI CC2538 Development Kit 2013-04-06 21:07:31 +01:00
debug-uart.h New Platform: TI CC2538 Development Kit 2013-04-06 21:07:31 +01:00
ieee-addr.c New Platform: TI CC2538 Development Kit 2013-04-06 21:07:31 +01:00
ieee-addr.h Change the InfoPage Location of the IEEE address 2013-04-17 15:44:01 +01:00
lpm.c cc2538: lpm: Fix RTIMER_NOW() upon wake-up 2013-12-05 20:23:29 +01:00
lpm.h cc2538: lpm: Fix RTIMER_NOW() upon wake-up 2013-12-05 20:23:29 +01:00
Makefile.cc2538 cc2538: Make it possible to use a custom linker script 2013-11-15 15:41:58 +01:00
mtarch.h A massive all-tree automated update of all double inclusion guard #defines that changes from using two underscores as a prefix, which are reserved, to not using two underscores as a prefix 2013-11-24 20:20:11 +01:00
reg.h New Platform: TI CC2538 Development Kit 2013-04-06 21:07:31 +01:00
rtimer-arch.c cc2538: lpm: Fix RTIMER_NOW() upon wake-up 2013-12-05 20:23:29 +01:00
rtimer-arch.h New Platform: TI CC2538 Development Kit 2013-04-06 21:07:31 +01:00
slip-arch.c New Platform: TI CC2538 Development Kit 2013-04-06 21:07:31 +01:00
spi-arch.h cc2538: spi: Add enable and disable functions 2013-11-20 14:20:50 +01:00