diff options
author | marcoveeneman <marco-veeneman@hotmail.com> | 2016-10-08 19:51:16 +0200 |
---|---|---|
committer | marcoveeneman <marco-veeneman@hotmail.com> | 2016-10-08 19:51:16 +0200 |
commit | 3e069788d9d21be39fc298685b4e991685fe14a9 (patch) | |
tree | 3f7907eeea04f5db50bdccc65450f7f10bb870b9 /os/hal/ports/TIVA/LLD/GPTM | |
parent | f8d62560b7e9f136f3d204e18cc321cdffc0ef80 (diff) | |
download | ChibiOS-Contrib-3e069788d9d21be39fc298685b4e991685fe14a9.tar.gz ChibiOS-Contrib-3e069788d9d21be39fc298685b4e991685fe14a9.tar.bz2 ChibiOS-Contrib-3e069788d9d21be39fc298685b4e991685fe14a9.zip |
Updated st_lld to use TivaWare.
Tickless mode is working again.
Fixed st_lld_get_counter reading the wrong register.
Diffstat (limited to 'os/hal/ports/TIVA/LLD/GPTM')
-rw-r--r-- | os/hal/ports/TIVA/LLD/GPTM/hal_st_lld.c | 18 | ||||
-rw-r--r-- | os/hal/ports/TIVA/LLD/GPTM/hal_st_lld.h | 26 |
2 files changed, 22 insertions, 22 deletions
diff --git a/os/hal/ports/TIVA/LLD/GPTM/hal_st_lld.c b/os/hal/ports/TIVA/LLD/GPTM/hal_st_lld.c index 30fdb8a..c98a30f 100644 --- a/os/hal/ports/TIVA/LLD/GPTM/hal_st_lld.c +++ b/os/hal/ports/TIVA/LLD/GPTM/hal_st_lld.c @@ -67,8 +67,8 @@ #elif TIVA_ST_TIMER_NUMBER == 5 #define ST_HANDLER TIVA_WGPT5A_HANDLER #define ST_NUMBER TIVA_WGPT5A_NUMBER -#define ST_ENABLE_CLOCK() (SYSCTL->RCGCWTIMER |= (1 << 5)) -#define ST_WAIT_CLOCK() while (!(SYSCTL->PRWTIMER & (1 << 5))) +#define ST_ENABLE_CLOCK() (HWREG(SYSCTL_RCGCWTIMER) |= (1 << 5)) +#define ST_WAIT_CLOCK() while (!(HWREG(SYSCTL_PRWTIMER) & (1 << 5))) #else #error "TIVA_ST_USE_TIMER specifies an unsupported timer" @@ -184,8 +184,8 @@ OSAL_IRQ_HANDLER(ST_HANDLER) OSAL_IRQ_PROLOGUE(); - mis = TIVA_ST_TIM->MIS; - TIVA_ST_TIM->ICR = mis; + mis = HWREG(TIVA_ST_TIM + TIMER_O_MIS); + HWREG(TIVA_ST_TIM + TIMER_O_ICR) = mis; if (mis & GPTM_IMR_TAMIM) { osalSysLockFromISR(); @@ -218,14 +218,14 @@ void st_lld_init(void) ST_WAIT_CLOCK(); /* Initializing the counter in free running down mode.*/ - TIVA_ST_TIM->CTL = 0; - TIVA_ST_TIM->CFG = GPTM_CFG_CFG_SPLIT; /* Timer split mode */ - TIVA_ST_TIM->TAMR = (GPTM_TAMR_TAMR_PERIODIC |/* Periodic mode */ + HWREG(TIVA_ST_TIM + TIMER_O_CTL) = 0; + HWREG(TIVA_ST_TIM + TIMER_O_CFG) = GPTM_CFG_CFG_SPLIT; /* Timer split mode */ + HWREG(TIVA_ST_TIM + TIMER_O_TAMR) = (GPTM_TAMR_TAMR_PERIODIC |/* Periodic mode */ GPTM_TAMR_TAMIE | /* Match interrupt enable */ GPTM_TAMR_TASNAPS); /* Snapshot mode */ - TIVA_ST_TIM->TAPR = (TIVA_SYSCLK / OSAL_ST_FREQUENCY) - 1; - TIVA_ST_TIM->CTL = (GPTM_CTL_TAEN | /* Timer A enable */ + HWREG(TIVA_ST_TIM + TIMER_O_TAPR) = (TIVA_SYSCLK / OSAL_ST_FREQUENCY) - 1; + HWREG(TIVA_ST_TIM + TIMER_O_CTL) = (GPTM_CTL_TAEN | /* Timer A enable */ GPTM_CTL_TASTALL); /* Timer A stall when paused */ /* IRQ enabled.*/ diff --git a/os/hal/ports/TIVA/LLD/GPTM/hal_st_lld.h b/os/hal/ports/TIVA/LLD/GPTM/hal_st_lld.h index 027304b..177b9ba 100644 --- a/os/hal/ports/TIVA/LLD/GPTM/hal_st_lld.h +++ b/os/hal/ports/TIVA/LLD/GPTM/hal_st_lld.h @@ -112,7 +112,7 @@ #if !TIVA_HAS_WGPT5 #error "WGPT5 not present" #endif -#define TIVA_ST_TIM WGPT5 +#define TIVA_ST_TIM WTIMER5_BASE #else #error "TIVA_ST_USE_TIMER specifies an unsupported timer" @@ -164,10 +164,10 @@ #error "wrong value defined for TIVA_ST_USE_WIDE_TIMER" #endif -#if OSAL_ST_MODE != OSAL_ST_MODE_NONE && \ - !OSAL_IRQ_IS_VALID_PRIORITY(TIVA_ST_IRQ_PRIORITY) -#error "Invalid IRQ priority assigned to ST" -#endif +//#if OSAL_ST_MODE != OSAL_ST_MODE_NONE && \ +// !OSAL_IRQ_IS_VALID_PRIORITY(TIVA_ST_IRQ_PRIORITY) +//#error "Invalid IRQ priority assigned to ST" +//#endif /*===========================================================================*/ /* Driver data structures and types. */ @@ -203,7 +203,7 @@ extern "C" { static inline systime_t st_lld_get_counter(void) { #if OSAL_ST_MODE == OSAL_ST_MODE_FREERUNNING - return (systime_t) (((systime_t) 0xffffffff) - TIVA_ST_TIM->TAR); + return (systime_t) (((systime_t) 0xffffffff) - HWREG(TIVA_ST_TIM + TIMER_O_TAV)); #else return 0; #endif @@ -221,9 +221,9 @@ static inline systime_t st_lld_get_counter(void) static inline void st_lld_start_alarm(systime_t time) { #if OSAL_ST_MODE == OSAL_ST_MODE_FREERUNNING - 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; + HWREG(TIVA_ST_TIM + TIMER_O_TAMATCHR) = (systime_t) (((systime_t) 0xffffffff) - time); + HWREG(TIVA_ST_TIM + TIMER_O_ICR) = HWREG(TIVA_ST_TIM + TIMER_O_MIS); + HWREG(TIVA_ST_TIM + TIMER_O_IMR) = GPTM_IMR_TAMIM; #endif } @@ -235,7 +235,7 @@ static inline void st_lld_start_alarm(systime_t time) static inline void st_lld_stop_alarm(void) { #if OSAL_ST_MODE == OSAL_ST_MODE_FREERUNNING - TIVA_ST_TIM->IMR = 0; + HWREG(TIVA_ST_TIM + TIMER_O_IMR) = 0; #endif } @@ -249,7 +249,7 @@ static inline void st_lld_stop_alarm(void) static inline void st_lld_set_alarm(systime_t time) { #if OSAL_ST_MODE == OSAL_ST_MODE_FREERUNNING - TIVA_ST_TIM->TAMATCHR = (systime_t) (((systime_t) 0xffffffff) - time); + HWREG(TIVA_ST_TIM + TIMER_O_TAMATCHR) = (systime_t) (((systime_t) 0xffffffff) - time); #endif } @@ -263,7 +263,7 @@ static inline void st_lld_set_alarm(systime_t time) static inline systime_t st_lld_get_alarm(void) { #if OSAL_ST_MODE == OSAL_ST_MODE_FREERUNNING - return (systime_t) (((systime_t)0xffffffff) - TIVA_ST_TIM->TAMATCHR); + return (systime_t) (((systime_t)0xffffffff) - HWREG(TIVA_ST_TIM + TIMER_O_TAMATCHR)); #else return 0; #endif @@ -281,7 +281,7 @@ static inline systime_t st_lld_get_alarm(void) static inline bool st_lld_is_alarm_active(void) { #if OSAL_ST_MODE == OSAL_ST_MODE_FREERUNNING - return (bool) ((TIVA_ST_TIM->IMR & GPTM_IMR_TAMIM) !=0); + return (bool) ((HWREG(TIVA_ST_TIM + TIMER_O_IMR) & GPTM_IMR_TAMIM) !=0); #else return false; #endif |