STM32: Various fixed to get a clean compile after integrating tickless mode. Mostly because patch came from an old version of NuttX.

This commit is contained in:
Gregory Nutt 2016-07-06 13:37:08 -06:00
parent 711f3318c5
commit 7c568f249a
5 changed files with 60 additions and 46 deletions

View File

@ -224,6 +224,7 @@ config ARCH_CHIP_STM32
select ARM_HAVE_MPU_UNIFIED
select ARCH_HAVE_I2CRESET
select ARCH_HAVE_HEAPCHECK
select ARCH_HAVE_TICKLESS
select ARMV7M_HAVE_STACKCHECK
---help---
STMicro STM32 architectures (ARM Cortex-M3/4).

View File

@ -1285,7 +1285,6 @@ config STM32_LOWDENSITY
config STM32_STM32F20XX
bool
default n
select ARCH_HAVE_TICKLESS
config STM32_STM32F205
bool
@ -2167,42 +2166,6 @@ config STM32_TSC
default n
depends on STM32_STM32F30XX
config STM32_ONESHOT
bool "TIM one-shot wrapper"
default n if !SCHED_TICKLESS
default y if SCHED_TICKLESS
---help---
Enable a wrapper around the low level timer/counter functions to
support one-shot timer.
config STM32_FREERUN
bool "TIM free-running wrapper"
default n if !SCHED_TICKLESS
default y if SCHED_TICKLESS
---help---
Enable a wrapper around the low level timer/counter functions to
support a free-running timer.
if SCHED_TICKLESS
config STM32_TICKLESS_ONESHOT
int "Tickless one-shot timer channel"
default 2
range 1 14
---help---
If the Tickless OS feature is enabled, the one clock must be
assigned to provided the one-shot timer needed by the OS.
config STM32_TICKLESS_FREERUN
int "Tickless free-running timer channel"
default 5
range 1 14
---help---
If the Tickless OS feature is enabled, the one clock must be
assigned to provided the free-running timer needed by the OS.
endif
config STM32_USART1
bool "USART1"
default n
@ -2581,6 +2544,54 @@ config STM32_FSMC_SRAM
menu "Timer Configuration"
if SCHED_TICKLESS
config STM32_ONESHOT
bool
default y
config STM32_FREERUN
bool
default y
endif # SCHED_TICKLESS
if !SCHED_TICKLESS
config STM32_ONESHOT
bool "TIM one-shot wrapper"
default n
---help---
Enable a wrapper around the low level timer/counter functions to
support one-shot timer.
config STM32_FREERUN
bool "TIM free-running wrapper"
default n
---help---
Enable a wrapper around the low level timer/counter functions to
support a free-running timer.
endif # !SCHED_TICKLESS
config STM32_TICKLESS_ONESHOT
int "Tickless one-shot timer channel"
default 2
range 1 14
depends on STM32_ONESHOT
---help---
If the Tickless OS feature is enabled, the one clock must be
assigned to provided the one-shot timer needed by the OS.
config STM32_TICKLESS_FREERUN
int "Tickless free-running timer channel"
default 5
range 1 14
depends on STM32_FREERUN
---help---
If the Tickless OS feature is enabled, the one clock must be
assigned to provided the free-running timer needed by the OS.
config STM32_TIM1_PWM
bool "TIM1 PWM"
default n

View File

@ -45,7 +45,7 @@
#include <assert.h>
#include <errno.h>
#include <arch/irq.h>
#include <nuttx/irq.h>
#include <nuttx/clock.h>
#include "stm32_freerun.h"
@ -201,7 +201,7 @@ int stm32_freerun_counter(struct stm32_freerun_s *freerun,
* be lost.
*/
flags = irqsave();
flags = enter_critical_section();
overflow = freerun->overflow;
counter = STM32_TIM_GETCOUNTER(freerun->tch);
@ -228,7 +228,7 @@ int stm32_freerun_counter(struct stm32_freerun_s *freerun,
freerun->overflow = overflow;
}
irqrestore(flags);
leave_critical_section(flags);
tmrinfo("counter=%lu (%lu) overflow=%lu, pending=%i\n",
(unsigned long)counter, (unsigned long)verify,

View File

@ -44,6 +44,7 @@
#include <stdint.h>
#include <time.h>
#include <debug.h>
#include "stm32_tim.h"

View File

@ -44,8 +44,9 @@
#include <stdbool.h>
#include <assert.h>
#include <errno.h>
#include <debug.h>
#include <arch/irq.h>
#include <nuttx/irq.h>
#include <nuttx/clock.h>
#include "stm32_oneshot.h"
@ -223,7 +224,7 @@ int stm32_oneshot_start(struct stm32_oneshot_s *oneshot,
/* Was the oneshot already running? */
flags = irqsave();
flags = enter_critical_section();
if (oneshot->running)
{
/* Yes.. then cancel it */
@ -276,7 +277,7 @@ int stm32_oneshot_start(struct stm32_oneshot_s *oneshot,
*/
oneshot->running = true;
irqrestore(flags);
leave_critical_section(flags);
return OK;
}
@ -317,7 +318,7 @@ int stm32_oneshot_cancel(struct stm32_oneshot_s *oneshot,
/* Was the timer running? */
flags = irqsave();
flags = enter_critical_section();
if (!oneshot->running)
{
/* No.. Just return zero timer remaining and successful cancellation.
@ -327,7 +328,7 @@ int stm32_oneshot_cancel(struct stm32_oneshot_s *oneshot,
ts->tv_sec = 0;
ts->tv_nsec = 0;
irqrestore(flags);
leave_critical_section(flags);
return OK;
}
@ -355,7 +356,7 @@ int stm32_oneshot_cancel(struct stm32_oneshot_s *oneshot,
oneshot->running = false;
oneshot->handler = NULL;
oneshot->arg = NULL;
irqrestore(flags);
leave_critical_section(flags);
/* Did the caller provide us with a location to return the time
* remaining?