From 560076be34b1ce77d108674b80652bfd67901c73 Mon Sep 17 00:00:00 2001 From: marcoveeneman Date: Mon, 23 Mar 2015 20:55:52 +0100 Subject: Removed ST_CLOCK_SRC for Tiva st_lld and replaced with TIVA_SYSCLK. --- os/hal/ports/TIVA/LLD/st_lld.c | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) (limited to 'os/hal') diff --git a/os/hal/ports/TIVA/LLD/st_lld.c b/os/hal/ports/TIVA/LLD/st_lld.c index d94e94c..7ca9e61 100644 --- a/os/hal/ports/TIVA/LLD/st_lld.c +++ b/os/hal/ports/TIVA/LLD/st_lld.c @@ -37,42 +37,36 @@ #if TIVA_ST_TIMER_NUMBER == 0 #define ST_HANDLER TIVA_WGPT0A_HANDLER #define ST_NUMBER TIVA_WGPT0A_NUMBER -#define ST_CLOCK_SRC (80000000) #define ST_ENABLE_CLOCK() (SYSCTL->RCGCWTIMER |= (1 << 0)) #define ST_WAIT_CLOCK() while (!(SYSCTL->PRWTIMER & (1 << 0))) #elif TIVA_ST_TIMER_NUMBER == 1 #define ST_HANDLER TIVA_WGPT1A_HANDLER #define ST_NUMBER TIVA_WGPT1A_NUMBER -#define ST_CLOCK_SRC (80000000) #define ST_ENABLE_CLOCK() (SYSCTL->RCGCWTIMER |= (1 << 1)) #define ST_WAIT_CLOCK() while (!(SYSCTL->PRWTIMER & (1 << 1))) #elif TIVA_ST_TIMER_NUMBER == 2 #define ST_HANDLER TIVA_WGPT2A_HANDLER #define ST_NUMBER TIVA_WGPT2A_NUMBER -#define ST_CLOCK_SRC (80000000) #define ST_ENABLE_CLOCK() (SYSCTL->RCGCWTIMER |= (1 << 2)) #define ST_WAIT_CLOCK() while (!(SYSCTL->PRWTIMER & (1 << 2))) #elif TIVA_ST_TIMER_NUMBER == 3 #define ST_HANDLER TIVA_WGPT3A_HANDLER #define ST_NUMBER TIVA_WGPT3A_NUMBER -#define ST_CLOCK_SRC (80000000) #define ST_ENABLE_CLOCK() (SYSCTL->RCGCWTIMER |= (1 << 3)) #define ST_WAIT_CLOCK() while (!(SYSCTL->PRWTIMER & (1 << 3))) #elif TIVA_ST_TIMER_NUMBER == 4 #define ST_HANDLER TIVA_WGPT4A_HANDLER #define ST_NUMBER TIVA_WGPT4A_NUMBER -#define ST_CLOCK_SRC (80000000) #define ST_ENABLE_CLOCK() (SYSCTL->RCGCWTIMER |= (1 << 4)) #define ST_WAIT_CLOCK() while (!(SYSCTL->PRWTIMER & (1 << 4))) #elif TIVA_ST_TIMER_NUMBER == 5 #define ST_HANDLER TIVA_WGPT5A_HANDLER #define ST_NUMBER TIVA_WGPT5A_NUMBER -#define ST_CLOCK_SRC (80000000) #define ST_ENABLE_CLOCK() (SYSCTL->RCGCWTIMER |= (1 << 5)) #define ST_WAIT_CLOCK() while (!(SYSCTL->PRWTIMER & (1 << 5))) @@ -89,42 +83,36 @@ #if TIVA_ST_TIMER_NUMBER == 0 #define ST_HANDLER TIVA_GPT0A_HANDLER #define ST_NUMBER TIVA_GPT0A_NUMBER -#define ST_CLOCK_SRC (80000000) #define ST_ENABLE_CLOCK() (SYSCTL->RCGCTIMER |= (1 << 0)) #define ST_WAIT_CLOCK() while (!(SYSCTL->PRTIMER & (1 << 0))) #elif TIVA_ST_TIMER_NUMBER == 1 #define ST_HANDLER TIVA_GPT1A_HANDLER #define ST_NUMBER TIVA_GPT1A_NUMBER -#define ST_CLOCK_SRC (80000000) #define ST_ENABLE_CLOCK() (SYSCTL->RCGCTIMER |= (1 << 1)) #define ST_WAIT_CLOCK() while (!(SYSCTL->PRTIMER & (1 << 1))) #elif TIVA_ST_TIMER_NUMBER == 2 #define ST_HANDLER TIVA_GPT2A_HANDLER #define ST_NUMBER TIVA_GPT2A_NUMBER -#define ST_CLOCK_SRC (80000000) #define ST_ENABLE_CLOCK() (SYSCTL->RCGCTIMER |= (1 << 2)) #define ST_WAIT_CLOCK() while (!(SYSCTL->PRTIMER & (1 << 2))) #elif TIVA_ST_TIMER_NUMBER == 3 #define ST_HANDLER TIVA_GPT3A_HANDLER #define ST_NUMBER TIVA_GPT3A_NUMBER -#define ST_CLOCK_SRC (80000000) #define ST_ENABLE_CLOCK() (SYSCTL->RCGCTIMER |= (1 << 3)) #define ST_WAIT_CLOCK() while (!(SYSCTL->PRTIMER & (1 << 3))) #elif TIVA_ST_TIMER_NUMBER == 4 #define ST_HANDLER TIVA_GPT4A_HANDLER #define ST_NUMBER TIVA_GPT4A_NUMBER -#define ST_CLOCK_SRC (80000000) #define ST_ENABLE_CLOCK() (SYSCTL->RCGCTIMER |= (1 << 4)) #define ST_WAIT_CLOCK() while (!(SYSCTL->PRTIMER & (1 << 4))) #elif TIVA_ST_TIMER_NUMBER == 5 #define ST_HANDLER TIVA_GPT5A_HANDLER #define ST_NUMBER TIVA_GPT5A_NUMBER -#define ST_CLOCK_SRC (80000000) #define ST_ENABLE_CLOCK() (SYSCTL->RCGCTIMER |= (1 << 5)) #define ST_WAIT_CLOCK() while (!(SYSCTL->PRTIMER & (1 << 5))) @@ -132,13 +120,13 @@ #error "TIVA_ST_USE_TIMER specifies an unsupported timer" #endif -#if (ST_CLOCK_SRC / OSAL_ST_FREQUENCY) - 1 > 0xFF +#if (TIVA_SYSCLK / OSAL_ST_FREQUENCY) - 1 > 0xFF #error "the selected ST frequency is not obtainable because TIM timer prescaler limits" #endif #endif -#if ST_CLOCK_SRC % OSAL_ST_FREQUENCY != 0 +#if TIVA_SYSCLK % OSAL_ST_FREQUENCY != 0 #error "the selected ST frequency is not obtainable because integer rounding" #endif @@ -234,7 +222,7 @@ void st_lld_init(void) TIVA_ST_TIM->CFG = GPTM_CFG_CFG_SPLIT; /* Timer split mode */ TIVA_ST_TIM->TAMR = (GPTM_TAMR_TAMR_PERIODIC |/* Periodic mode */ GPTM_TAMR_TAMIE); /* Match interrupt enable */ - TIVA_ST_TIM->TAPR = (ST_CLOCK_SRC / OSAL_ST_FREQUENCY) - 1; + TIVA_ST_TIM->TAPR = (TIVA_SYSCLK / OSAL_ST_FREQUENCY) - 1; TIVA_ST_TIM->CTL = (GPTM_CTL_TAEN | /* Timer A enable */ GPTM_CTL_TASTALL); /* Timer A stall when paused */ -- cgit v1.2.3