diff options
| author | Keith Packard <keithp@keithp.com> | 2012-06-02 16:53:46 -0700 | 
|---|---|---|
| committer | Keith Packard <keithp@keithp.com> | 2012-06-02 16:53:46 -0700 | 
| commit | 8d425ffba84ec6f632e8c0d44105de73242a86a9 (patch) | |
| tree | 078232e95317498b78f4d7817b2319ad9568c928 /src/stm/stm32l.h | |
| parent | 1353b277f8314fbddef81c743bd6ea229364fd18 (diff) | |
altos: Route correct GPIO line to interrupt controller
Which GPIO a particular pin interrupt comes from is selected by the
SYSCFG EXTICR registers; set these when an exti interrupt is configured.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src/stm/stm32l.h')
| -rw-r--r-- | src/stm/stm32l.h | 33 | 
1 files changed, 29 insertions, 4 deletions
diff --git a/src/stm/stm32l.h b/src/stm/stm32l.h index 0bc7483e..cb66df6c 100644 --- a/src/stm/stm32l.h +++ b/src/stm/stm32l.h @@ -855,10 +855,7 @@ isr(tim7)  struct stm_syscfg {  	vuint32_t	memrmp;  	vuint32_t	pmc; -	vuint32_t	exticr1; -	vuint32_t	exticr2; -	vuint32_t	exticr3; -	vuint32_t	exticr4; +	vuint32_t	exticr[4];  };  extern struct stm_syscfg stm_syscfg; @@ -871,6 +868,34 @@ extern struct stm_syscfg stm_syscfg;  #define STM_SYSCFG_PMC_USB_PU		0 +#define STM_SYSCFG_EXTICR_PA		0 +#define STM_SYSCFG_EXTICR_PB		1 +#define STM_SYSCFG_EXTICR_PC		2 +#define STM_SYSCFG_EXTICR_PD		3 +#define STM_SYSCFG_EXTICR_PE		4 +#define STM_SYSCFG_EXTICR_PH		5 + +static inline void +stm_exticr_set(struct stm_gpio *gpio, int pin) { +	uint8_t	reg = pin >> 2; +	uint8_t	shift = (pin & 3) << 2; +	uint8_t	val = 0; + +	if (gpio == &stm_gpioa) +		val = STM_SYSCFG_EXTICR_PA; +	else if (gpio == &stm_gpiob) +		val = STM_SYSCFG_EXTICR_PB; +	else if (gpio == &stm_gpioc) +		val = STM_SYSCFG_EXTICR_PC; +	else if (gpio == &stm_gpiod) +		val = STM_SYSCFG_EXTICR_PD; +	else if (gpio == &stm_gpioe) +		val = STM_SYSCFG_EXTICR_PE; + +	stm_syscfg.exticr[reg] = (stm_syscfg.exticr[reg] & ~(0xf << shift)) | val << shift; +} + +  struct stm_dma_channel {  	vuint32_t	ccr;  	vuint32_t	cndtr;  | 
