diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2011-12-21 23:31:03 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2011-12-21 23:31:03 +0000 |
commit | 80f67779e93a19f4ead282f5fff0bd070ba93de8 (patch) | |
tree | ddb8c15a8f76f2a8bd90b39906833c12edde472c /nuttx/arch/arm/src/stm32/stm32_pwm.c | |
parent | 9f331c4e5b05657516a1d634da9e38758d82c601 (diff) | |
download | px4-nuttx-80f67779e93a19f4ead282f5fff0bd070ba93de8.tar.gz px4-nuttx-80f67779e93a19f4ead282f5fff0bd070ba93de8.tar.bz2 px4-nuttx-80f67779e93a19f4ead282f5fff0bd070ba93de8.zip |
STM32 CAN driver now compiles
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4210 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/arch/arm/src/stm32/stm32_pwm.c')
-rw-r--r-- | nuttx/arch/arm/src/stm32/stm32_pwm.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/nuttx/arch/arm/src/stm32/stm32_pwm.c b/nuttx/arch/arm/src/stm32/stm32_pwm.c index fb3323d7e..8261b07ad 100644 --- a/nuttx/arch/arm/src/stm32/stm32_pwm.c +++ b/nuttx/arch/arm/src/stm32/stm32_pwm.c @@ -815,10 +815,10 @@ static int pwm_start(FAR struct pwm_lowerhalf_s *dev, FAR const struct pwm_info_ static int pwm_stop(FAR struct pwm_lowerhalf_s *dev) { FAR struct stm32_pwmtimer_s *priv = (FAR struct stm32_pwmtimer_s *)dev; - uint32_t resetbit; uint32_t regaddr; uint32_t regval; + irqstate_t flags; pwmvdbg("TIM%d\n", priv->timid); @@ -898,6 +898,12 @@ static int pwm_stop(FAR struct pwm_lowerhalf_s *dev) #endif } + /* Disable interrupts momentary to stop any ongoing timer processing and + * to prevent any concurrent access to the reset register. + */ + + flags = irqsave(); + /* Reset the timer - stopping the output and putting the timer back * into a state where pwm_start() can be called. */ @@ -908,6 +914,7 @@ static int pwm_stop(FAR struct pwm_lowerhalf_s *dev) regval &= ~resetbit; putreg32(regval, regaddr); + irqrestore(flags); pwmvdbg("regaddr: %08x resetbit: %08x\n", regaddr, resetbit); pwm_dumpregs(priv, "After stop"); |