Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

port user-irq feature to STM32P103 and STM32F429i DISCOVERY #115

Merged
merged 10 commits into from
May 5, 2015
95 changes: 93 additions & 2 deletions board/discoveryf429/defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,94 @@ CONFIG_BOARD_STM32F429DISCOVERY=y
# CONFIG_STDIO_NODEV is not set
CONFIG_STDIO_USE_DBGPORT=y
# CONFIG_DBGPORT_USE_USART1 is not set
# CONFIG_DBGPORT_USE_USART2 is not set
CONFIG_DBGPORT_USE_USART4=y
CONFIG_DBGPORT_USE_USART2=y
# CONFIG_DBGPORT_USE_USART4 is not set
# CONFIG_WWDG_USER_IRQ is not set
# CONFIG_PVD_USER_IRQ is not set
# CONFIG_TAMP_STAMP_USER_IRQ is not set
# CONFIG_RTC_WKUP_USER_IRQ is not set
# CONFIG_FLASH_USER_IRQ is not set
# CONFIG_RCC_USER_IRQ is not set
CONFIG_EXTI0_USER_IRQ=y
CONFIG_EXTI1_USER_IRQ=y
# CONFIG_EXTI2_USER_IRQ is not set
# CONFIG_EXTI3_USER_IRQ is not set
# CONFIG_EXTI4_USER_IRQ is not set
# CONFIG_DMA1_Stream0_USER_IRQ is not set
# CONFIG_DMA1_Stream1_USER_IRQ is not set
# CONFIG_DMA1_Stream2_USER_IRQ is not set
# CONFIG_DMA1_Stream3_USER_IRQ is not set
# CONFIG_DMA1_Stream4_USER_IRQ is not set
# CONFIG_DMA1_Stream5_USER_IRQ is not set
# CONFIG_DMA1_Stream6_USER_IRQ is not set
# CONFIG_ADC_USER_IRQ is not set
# CONFIG_CAN1_TX_USER_IRQ is not set
# CONFIG_CAN1_RX_USER_IRQ is not set
# CONFIG_CAN1_RX1_USER_IRQ is not set
# CONFIG_CAN1_SCE_USER_IRQ is not set
# CONFIG_EXTI9_5_USER_IRQ is not set
# CONFIG_TIM1_BRK_TIM9_USER_IRQ is not set
# CONFIG_TIM1_UP_TIM10_USER_IRQ is not set
# CONFIG_TIM1_TRG_COM_TIM11_USER_IRQ is not set
# CONFIG_TIM1_CC_USER_IRQ is not set
# CONFIG_TIM2_USER_IRQ is not set
# CONFIG_TIM3_USER_IRQ is not set
# CONFIG_TIM4_USER_IRQ is not set
# CONFIG_I2C1_EV_USER_IRQ is not set
# CONFIG_I2C1_ER_USER_IRQ is not set
# CONFIG_I2C2_EV_USER_IRQ is not set
# CONFIG_I2C2_ER_USER_IRQ is not set
# CONFIG_SPI1_USER_IRQ is not set
# CONFIG_SPI2_USER_IRQ is not set
# CONFIG_USART1_USER_IRQ is not set
# CONFIG_USART2_USER_IRQ is not set
# CONFIG_USART3_USER_IRQ is not set
# CONFIG_EXTI15_10_USER_IRQ is not set
# CONFIG_RTC_Alarm_USER_IRQ is not set
# CONFIG_OTG_FS_WKUP_USER_IRQ is not set
# CONFIG_TIM8_BRK_TIM12_USER_IRQ is not set
# CONFIG_TIM8_UP_TIM13_USER_IRQ is not set
# CONFIG_TIM8_TRG_COM_TIM14_USER_IRQ is not set
# CONFIG_TIM8_CC_USER_IRQ is not set
# CONFIG_DMA1_Stream7_USER_IRQ is not set
# CONFIG_FSMC_USER_IRQ is not set
# CONFIG_SDIO_USER_IRQ is not set
# CONFIG_TIM5_USER_IRQ is not set
# CONFIG_SPI3_USER_IRQ is not set
# CONFIG_UART4_USER_IRQ is not set
# CONFIG_UART5_USER_IRQ is not set
# CONFIG_TIM6_DAC_USER_IRQ is not set
# CONFIG_TIM7_USER_IRQ is not set
# CONFIG_DMA2_Stream0_USER_IRQ is not set
# CONFIG_DMA2_Stream1_USER_IRQ is not set
# CONFIG_DMA2_Stream2_USER_IRQ is not set
# CONFIG_DMA2_Stream3_USER_IRQ is not set
# CONFIG_DMA2_Stream4_USER_IRQ is not set
# CONFIG_ETH_USER_IRQ is not set
# CONFIG_ETH_WKUP_USER_IRQ is not set
# CONFIG_CAN2_TX_USER_IRQ is not set
# CONFIG_CAN2_RX0_USER_IRQ is not set
# CONFIG_CAN2_RX1_USER_IRQ is not set
# CONFIG_CAN2_SCE_USER_IRQ is not set
# CONFIG_OTG_FS_USER_IRQ is not set
# CONFIG_DMA2_Stream5_USER_IRQ is not set
# CONFIG_DMA2_Stream6_USER_IRQ is not set
# CONFIG_DMA2_Stream7_USER_IRQ is not set
# CONFIG_USART6_USER_IRQ is not set
# CONFIG_I2C3_EV_USER_IRQ is not set
# CONFIG_I2C3_ER_USER_IRQ is not set
# CONFIG_OTG_HS_EP1_OUT_USER_IRQ is not set
# CONFIG_OTG_HS_EP1_IN_USER_IRQ is not set
# CONFIG_OTG_HS_WKUP_USER_IRQ is not set
# CONFIG_OTG_HS_USER_IRQ is not set
# CONFIG_DCMI_USER_IRQ is not set
# CONFIG_CRYP_USER_IRQ is not set
# CONFIG_HASH_RNG_USER_IRQ is not set
# CONFIG_FPU_USER_IRQ is not set

#
# User Interrupt Config
#

#
# Limitations
Expand Down Expand Up @@ -62,3 +148,8 @@ CONFIG_KPROBES=y
CONFIG_SYMMAP=y
CONFIG_PANIC_DUMP_STACK=y
# CONFIG_LOADER is not set

#
# Test Case
#
CONFIG_EXTI_INTERRUPT_TEST=y
52 changes: 52 additions & 0 deletions board/stm32p103/defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,53 @@ CONFIG_STDIO_USE_DBGPORT=y
# CONFIG_DBGPORT_USE_USART1 is not set
CONFIG_DBGPORT_USE_USART2=y
# CONFIG_DBGPORT_USE_USART4 is not set
# CONFIG_WWDG_USER_IRQ is not set
# CONFIG_PVD_USER_IRQ is not set
# CONFIG_TAMP_STAMP_USER_IRQ is not set
# CONFIG_RTC_WKUP_USER_IRQ is not set
# CONFIG_FLASH_USER_IRQ is not set
# CONFIG_RCC_USER_IRQ is not set
CONFIG_EXTI0_USER_IRQ=y
CONFIG_EXTI1_USER_IRQ=y
# CONFIG_EXTI2_USER_IRQ is not set
# CONFIG_EXTI3_USER_IRQ is not set
# CONFIG_EXTI4_USER_IRQ is not set
# CONFIG_ADC_USER_IRQ is not set
# CONFIG_CAN1_TX_USER_IRQ is not set
# CONFIG_CAN1_RX_USER_IRQ is not set
# CONFIG_CAN1_RX1_USER_IRQ is not set
# CONFIG_CAN1_SCE_USER_IRQ is not set
# CONFIG_EXTI9_5_USER_IRQ is not set
# CONFIG_TIM1_CC_USER_IRQ is not set
# CONFIG_TIM2_USER_IRQ is not set
# CONFIG_TIM3_USER_IRQ is not set
# CONFIG_TIM4_USER_IRQ is not set
# CONFIG_I2C1_EV_USER_IRQ is not set
# CONFIG_I2C1_ER_USER_IRQ is not set
# CONFIG_I2C2_EV_USER_IRQ is not set
# CONFIG_I2C2_ER_USER_IRQ is not set
# CONFIG_SPI1_USER_IRQ is not set
# CONFIG_SPI2_USER_IRQ is not set
# CONFIG_USART1_USER_IRQ is not set
# CONFIG_USART2_USER_IRQ is not set
# CONFIG_USART3_USER_IRQ is not set
# CONFIG_EXTI15_10_USER_IRQ is not set
# CONFIG_RTC_Alarm_USER_IRQ is not set
# CONFIG_OTG_FS_WKUP_USER_IRQ is not set

#
# User Interrupt Config
#
# CONFIG_DMA_Stream0_USER_IRQ is not set
# CONFIG_DMA_Stream1_USER_IRQ is not set
# CONFIG_DMA_Stream2_USER_IRQ is not set
# CONFIG_DMA_Stream3_USER_IRQ is not set
# CONFIG_DMA_Stream4_USER_IRQ is not set
# CONFIG_DMA_Stream5_USER_IRQ is not set
# CONFIG_DMA_Stream6_USER_IRQ is not set
# CONFIG_TIM1_BRK_USER_IRQ is not set
# CONFIG_TIM1_UP_USER_IRQ is not set
# CONFIG_TIM1_TRG_COM_USER_IRQ is not set

#
# Limitations
Expand Down Expand Up @@ -63,3 +110,8 @@ CONFIG_KPROBES=y
CONFIG_SYMMAP=y
CONFIG_PANIC_DUMP_STACK=y
# CONFIG_LOADER is not set

#
# Test Case
#
CONFIG_EXTI_INTERRUPT_TEST=y
28 changes: 28 additions & 0 deletions include/platform/stm32f1/exti.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#ifndef PLATFORM_STM32F1_EXTI_H_
#define PLATFORM_STM32F1_EXTI_H_

#include <platform/stm32f1/registers.h>
#include <platform/stm32f1/gpio.h>

/* EXTI mode */
#define EXTI_INTERRUPT_MODE 0x0
#define EXTI_EVENT_MODE 0x4

/* EXTI trigger type */
#define EXTI_RISING_TRIGGER 0x8
#define EXTI_FALLING_TRIGGER 0xc
#define EXTI_RISING_FALLING_TRIGGER 0x10

#define EXTI_LINE(x) ((uint32_t)0x1 << x)

struct exti_regs {
volatile uint32_t IMR;
volatile uint32_t EMR;
volatile uint32_t RTSR;
volatile uint32_t FTSR;
volatile uint32_t SWIER;
volatile uint32_t PR;
};


#endif
1 change: 1 addition & 0 deletions include/platform/stm32f1/nvic.h
Original file line number Diff line number Diff line change
Expand Up @@ -190,4 +190,5 @@ inline static uint32_t NVIC_GetActive(IRQn_Type IRQn)
(1 << ((uint32_t)(IRQn) & 0x1F))) ? 1 : 0);
}

int nvic_is_setup(int irq);
#endif /* __PLATFORM_STM32F1_NVIC_H__ */
Loading