capture compile

This commit is contained in:
pnb
2015-12-22 16:28:19 +01:00
parent 7d244d4d04
commit 9cc2119c4e
4 changed files with 313 additions and 251 deletions
+17 -22
View File
@@ -1433,6 +1433,7 @@ config STM32_STM32F407
select STM32_HAVE_UART5
select STM32_HAVE_USART6
select STM32_HAVE_TIM1
select STM32_HAVE_TIM2
select STM32_HAVE_TIM5
select STM32_HAVE_TIM6
select STM32_HAVE_TIM7
@@ -1603,6 +1604,10 @@ config STM32_HAVE_TIM1
bool
default n
config STM32_HAVE_TIM2
bool
default n
config STM32_HAVE_TIM3
bool
default n
@@ -5121,17 +5126,7 @@ config STM32_TIM14_DAC2
endchoice
config STM32_TIM1_CAP
bool "TIM1 Capture
default n
depends on STM32_HAVE_TIM1
---help---
Reserve timer 1 for use by Capture
Timer devices may be used for different purposes. One special purpose is
to capture input.
config STM32_TIM1_CAP
bool "TIM1 Capture
bool "TIM1 Capture"
default n
depends on STM32_HAVE_TIM1
---help---
@@ -5141,7 +5136,7 @@ config STM32_TIM1_CAP
to capture input.
config STM32_TIM2_CAP
bool "TIM2 Capture
bool "TIM2 Capture"
default n
depends on STM32_HAVE_TIM2
---help---
@@ -5151,7 +5146,7 @@ config STM32_TIM2_CAP
to capture input.
config STM32_TIM3_CAP
bool "TIM3 Capture
bool "TIM3 Capture"
default n
depends on STM32_HAVE_TIM3
---help---
@@ -5161,7 +5156,7 @@ config STM32_TIM3_CAP
to capture input.
config STM32_TIM4_CAP
bool "TIM4 Capture
bool "TIM4 Capture"
default n
depends on STM32_HAVE_TIM4
---help---
@@ -5171,7 +5166,7 @@ config STM32_TIM4_CAP
to capture input.
config STM32_TIM5_CAP
bool "TIM5 Capture
bool "TIM5 Capture"
default n
depends on STM32_HAVE_TIM5
---help---
@@ -5181,7 +5176,7 @@ config STM32_TIM5_CAP
to capture input.
config STM32_TIM8_CAP
bool "TIM8 Capture
bool "TIM8 Capture"
default n
depends on STM32_HAVE_TIM8
---help---
@@ -5191,7 +5186,7 @@ config STM32_TIM8_CAP
to capture input.
config STM32_TIM9_CAP
bool "TIM9 Capture
bool "TIM9 Capture"
default n
depends on STM32_HAVE_TIM9
---help---
@@ -5201,7 +5196,7 @@ config STM32_TIM9_CAP
to capture input.
config STM32_TIM10_CAP
bool "TIM10 Capture
bool "TIM10 Capture"
default n
depends on STM32_HAVE_TIM10
---help---
@@ -5211,7 +5206,7 @@ config STM32_TIM10_CAP
to capture input.
config STM32_TIM11_CAP
bool "TIM11 Capture
bool "TIM11 Capture"
default n
depends on STM32_HAVE_TIM11
---help---
@@ -5221,7 +5216,7 @@ config STM32_TIM11_CAP
to capture input.
config STM32_TIM12_CAP
bool "TIM12 Capture
bool "TIM12 Capture"
default n
depends on STM32_HAVE_TIM12
---help---
@@ -5231,7 +5226,7 @@ config STM32_TIM12_CAP
to capture input.
config STM32_TIM13_CAP
bool "TIM13 Capture
bool "TIM13 Capture"
default n
depends on STM32_HAVE_TIM13
---help---
@@ -5241,7 +5236,7 @@ config STM32_TIM13_CAP
to capture input.
config STM32_TIM14_CAP
bool "TIM14 Capture
bool "TIM14 Capture"
default n
depends on STM32_HAVE_TIM14
---help---
+2
View File
@@ -110,6 +110,7 @@ CHIP_CSRCS = stm32_allocateheap.c stm32_start.c stm32_rcc.c stm32_lse.c
CHIP_CSRCS += stm32_lsi.c stm32_gpio.c stm32_exti_gpio.c stm32_flash.c stm32_irq.c
CHIP_CSRCS += stm32_dma.c stm32_lowputc.c stm32_serial.c stm32_spi.c
CHIP_CSRCS += stm32_sdio.c stm32_tim.c stm32_waste.c stm32_ccm.c stm32_uid.c
CHIP_CSRCS += stm32_capture.c
ifeq ($(CONFIG_TIMER),y)
CHIP_CSRCS += stm32_tim_lowerhalf.c
@@ -228,6 +229,7 @@ ifeq ($(CONFIG_QENCODER),y)
CHIP_CSRCS += stm32_qencoder.c
endif
ifeq ($(CONFIG_CAN),y)
CHIP_CSRCS += stm32_can.c
endif
File diff suppressed because it is too large Load Diff
+21 -17
View File
@@ -53,13 +53,13 @@
************************************************************************************/
/* Helpers **************************************************************************/
#define STM32_TIM_SETCLOCK(d,freq) ((d)->ops->setclock(d,freq))
#define STM32_TIM_SETCHANNEL(d,ch,mode) ((d)->ops->setchannel(d,ch,mode))
#define STM32_TIM_GETCAPTURE(d,ch) ((d)->ops->getcapture(d,ch))
#define STM32_TIM_SETISR(d,hnd,s) ((d)->ops->setisr(d,hnd,s))
#define STM32_TIM_ENABLEINT(d,s,on) ((d)->ops->enableint(d,s,on))
#define STM32_TIM_ACKFLAGS(d,s) ((d)->ops->ackflags(d,s))
#define STM32_TIM_GETFLAGS(d) ((d)->ops->getflags(d))
#define STM32_CAP_SETCLOCK(d,clk_src,psc,max) ((d)->ops->setclock(d,clk_src,psc,max))
#define STM32_CAP_SETCHANNEL(d,ch,cfg) ((d)->ops->setchannel(d,ch,cfg))
#define STM32_CAP_GETCAPTURE(d,ch) ((d)->ops->getcapture(d,ch))
#define STM32_CAP_SETISR(d,hnd) ((d)->ops->setisr(d,hnd))
#define STM32_CAP_ENABLEINT(d,s,on) ((d)->ops->enableint(d,s,on))
#define STM32_CAP_ACKFLAGS(d,f) ((d)->ops->ackflags(d,f))
#define STM32_CAP_GETFLAGS(d) ((d)->ops->getflags(d))
/************************************************************************************
* Public Types
@@ -131,7 +131,7 @@ typedef enum
} stm32_cap_ch_cfg_t;
/* TIM clock sources */
/* Capture clock sources */
typedef enum
{
@@ -143,13 +143,13 @@ typedef enum
} stm32_cap_clk_t;
/* TIM Sources */
/* Capture flags */
typedef enum
{
/* One of the following */
STM32_CAP_FLAG_IRQ_TIMER = (GTIM_SR_UIF),
STM32_CAP_FLAG_IRG_COUNTER = (GTIM_SR_UIF),
STM32_CAP_FLAG_IRQ_CH_1 = (GTIM_SR_CC1IF),
STM32_CAP_FLAG_IRQ_CH_2 = (GTIM_SR_CC2IF),
@@ -163,16 +163,20 @@ typedef enum
} stm32_cap_flags_t;
#define STM32_CAP_FLAG_IRQ_CH(ch) (GTIM_SR_CC1IF<<((ch)-1))
#define STM32_CAP_FLAG_OF_CH(ch) (GTIM_SR_CC1OF<<((ch)-1))
/* TIM Operations */
/* Capture Operations */
struct stm32_cap_ops_s
{
int (*setclock)(FAR struct stm32_cap_dev_s *dev, stm32_cap_clk_src_t clk_src,
uint32_t prescaler);
int (*setchannel)(FAR struct stm32_cap_dev_s *dev, uint8_t channel);
int (*setisr)(FAR struct stm32_tim_dev_s *dev,xcpt_t handler);
void (*enableint)(FAR struct stm32_tim_dev_s *dev, stm32_cap_flags_t src, bool on );
int (*setclock)( FAR struct stm32_cap_dev_s *dev, stm32_cap_clk_t clk, uint32_t prescaler, uint32_t max);
int (*setchannel)(FAR struct stm32_cap_dev_s *dev, uint8_t channel, stm32_cap_ch_cfg_t cfg);
int (*getcapture)(FAR struct stm32_cap_dev_s *dev, uint8_t channel);
int (*setisr)( FAR struct stm32_cap_dev_s *dev, xcpt_t handler);
void (*enableint)( FAR struct stm32_cap_dev_s *dev, stm32_cap_flags_t src, bool on );
void (*ackflags)( FAR struct stm32_cap_dev_s *dev, int flags);
stm32_cap_flags_t (*getflags)(FAR struct stm32_cap_dev_s *dev);
};
/************************************************************************************
@@ -194,4 +198,4 @@ int stm32_cap_deinit(FAR struct stm32_cap_dev_s * dev);
#endif
#endif /* __ASSEMBLY__ */
#endif /* __ARCH_ARM_SRC_STM32_STM32_TIM_H */
#endif /* __ARCH_ARM_SRC_STM32_STM32_CAPTURE_H */