From 927cbb1beeaf11a4fa715189aa3060b757f4d67c Mon Sep 17 00:00:00 2001 From: marcoveeneman Date: Sun, 22 Mar 2015 22:46:09 +0100 Subject: [PATCH] Tiva tickless mode is working for 16 bit timers too. Typecasting was not correct before. --- os/hal/ports/TIVA/LLD/st_lld.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/os/hal/ports/TIVA/LLD/st_lld.h b/os/hal/ports/TIVA/LLD/st_lld.h index fd6dc800..bec1a362 100644 --- a/os/hal/ports/TIVA/LLD/st_lld.h +++ b/os/hal/ports/TIVA/LLD/st_lld.h @@ -197,7 +197,7 @@ extern "C" { */ static inline systime_t st_lld_get_counter(void) { - return (systime_t) 0xffffffff - TIVA_ST_TIM->TAR; + return (systime_t) (((systime_t) 0xffffffff) - TIVA_ST_TIM->TAR); } /** @@ -211,7 +211,7 @@ static inline systime_t st_lld_get_counter(void) */ static inline void st_lld_start_alarm(systime_t time) { - TIVA_ST_TIM->TAMATCHR = (uint32_t) 0xffffffff - time; + TIVA_ST_TIM->TAMATCHR = (systime_t) (((systime_t) 0xffffffff) - time); TIVA_ST_TIM->ICR = TIVA_ST_TIM->MIS; TIVA_ST_TIM->IMR = GPTM_IMR_TAMIM; } @@ -235,7 +235,7 @@ static inline void st_lld_stop_alarm(void) */ static inline void st_lld_set_alarm(systime_t time) { - TIVA_ST_TIM->TAMATCHR = (uint32_t) (0xffffffff - time); + TIVA_ST_TIM->TAMATCHR = (systime_t) (((systime_t) 0xffffffff) - time); } /** @@ -247,7 +247,7 @@ static inline void st_lld_set_alarm(systime_t time) */ static inline systime_t st_lld_get_alarm(void) { - return (systime_t) (0xffffffff - TIVA_ST_TIM->TAMATCHR); + return (systime_t) (((systime_t)0xffffffff) - TIVA_ST_TIM->TAMATCHR); } /**