Tiva Timer: Add support for input clock prescaler in 16-bit one-shot/periodic modes
This commit is contained in:
parent
df48abcc47
commit
2871677362
@ -725,24 +725,12 @@
|
||||
#define TIMER_TnPR_TnPSR_MASK (0xff << TIMER_TnPR_TnPSR_SHIFT)
|
||||
# define TIMER_TnPR_TnPSR(n) ((uint32_t)(n) << TIMER_TnPR_TnPSR_SHIFT)
|
||||
|
||||
#if 0
|
||||
# define TIMER_TnPR_TnPSRH_SHIFT (8) /* Bits 8-15: GPTM Timer A/B Prescale High word */
|
||||
# define TIMER_TnPR_TnPSRH_MASK (0xff << TIMER_TnPR_TnPSRH_SHIFT)
|
||||
# define TIMER_TnPR_TnPSRH(n) ((uint32_t)(n) << TIMER_TnPR_TnPSRH_SHIFT)
|
||||
#endif
|
||||
|
||||
/* GPTM Timer A/B Prescale Match (TnPMR) */
|
||||
|
||||
#define TIMER_TnPMR_TnPSMR_SHIFT (0) /* Bits 0-8: GPTM Timer A/B Prescale Match */
|
||||
#define TIMER_TnPMR_TnPSMR_MASK (0xff << TIMER_TnPMR_TnPSMR_SHIFT)
|
||||
# define TIMER_TnPMR_TnPSMR(n) ((uint32_t)(n) << TIMER_TnPMR_TnPSMR_SHIFT)
|
||||
|
||||
#if 0
|
||||
# define TIMER_TnPMR_TnPSMRH_SHIFT (8) /* Bits 8-15: GPTM Timer A/B Prescale Match High word */
|
||||
# define TIMER_TnPMR_TnPSMRH_MASK (0xff << TIMER_TnPMR_TnPSMRH_SHIFT)
|
||||
# define TIMER_TnPMR_TnPSMRH(n) ((uint32_t)(n) << TIMER_TnPMR_TnPSMRH_SHIFT)
|
||||
#endif
|
||||
|
||||
/* GPTM Timer A (TAR) (32-bit value) */
|
||||
/* GPTM Timer B (TBR) (32-bit value) */
|
||||
/* GPTM Timer A Value (TAV) (32-bit value) */
|
||||
|
@ -88,7 +88,7 @@ struct tiva_gptmstate_s
|
||||
|
||||
/* Variable state values */
|
||||
|
||||
uint32_t frequency; /* Frequency of the input clock */
|
||||
uint32_t clkin; /* Frequency of the input clock */
|
||||
uint32_t imr; /* Interrupt mask value. Zero if no interrupts */
|
||||
|
||||
#ifdef CONFIG_TIVA_TIMER_REGDEBUG
|
||||
@ -975,12 +975,17 @@ static int tiva_oneshot_periodic_mode16(struct tiva_gptmstate_s *priv,
|
||||
*/
|
||||
#warning Missing Logic
|
||||
|
||||
/* Set the input clock pre-scaler value */
|
||||
|
||||
regoffset = tmndx ? TIVA_TIMER_TBPR_OFFSET : TIVA_TIMER_TAPR_OFFSET;
|
||||
tiva_putreg(priv, regoffset, (uint32_t)timer->u.periodic.prescaler);
|
||||
|
||||
/* 5. Load the start value into the GPTM Timer n Interval Load Register
|
||||
* (GPTMTnILR).
|
||||
*/
|
||||
|
||||
regoffset = tmndx ? TIVA_TIMER_TBILR_OFFSET : TIVA_TIMER_TAILR_OFFSET;
|
||||
tiva_putreg(priv, regoffset, timer->u.periodic.interval);
|
||||
tiva_putreg(priv, regoffset, (uint32_t)timer->u.periodic.interval);
|
||||
|
||||
/* 6. If interrupts are required, set the appropriate bits in the GPTM
|
||||
* Interrupt Mask Register (GPTMIMR).
|
||||
@ -1504,13 +1509,13 @@ TIMER_HANDLE tiva_gptm_configure(const struct tiva_gptmconfig_s *config)
|
||||
|
||||
/* Remember the frequency of the input clock */
|
||||
|
||||
priv->frequency = ALTCLK_FREQUENCY;
|
||||
priv->clkin = ALTCLK_FREQUENCY;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Remember the frequency of the input clock */
|
||||
|
||||
priv->frequency = SYSCLK_FREQUENCY;
|
||||
priv->clkin = SYSCLK_FREQUENCY;
|
||||
}
|
||||
|
||||
/* Then [re-]configure the timer into the new configuration */
|
||||
|
@ -200,6 +200,7 @@ struct tiva_timer16config_s
|
||||
|
||||
struct
|
||||
{
|
||||
uint8_t prescaler; /* Prescaler-1: 0-255 corresponding to 1-256 */
|
||||
uint16_t interval; /* Value for interval load register */
|
||||
} periodic;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user