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:
parent
711f3318c5
commit
7c568f249a
@ -224,6 +224,7 @@ config ARCH_CHIP_STM32
|
|||||||
select ARM_HAVE_MPU_UNIFIED
|
select ARM_HAVE_MPU_UNIFIED
|
||||||
select ARCH_HAVE_I2CRESET
|
select ARCH_HAVE_I2CRESET
|
||||||
select ARCH_HAVE_HEAPCHECK
|
select ARCH_HAVE_HEAPCHECK
|
||||||
|
select ARCH_HAVE_TICKLESS
|
||||||
select ARMV7M_HAVE_STACKCHECK
|
select ARMV7M_HAVE_STACKCHECK
|
||||||
---help---
|
---help---
|
||||||
STMicro STM32 architectures (ARM Cortex-M3/4).
|
STMicro STM32 architectures (ARM Cortex-M3/4).
|
||||||
|
@ -1285,7 +1285,6 @@ config STM32_LOWDENSITY
|
|||||||
config STM32_STM32F20XX
|
config STM32_STM32F20XX
|
||||||
bool
|
bool
|
||||||
default n
|
default n
|
||||||
select ARCH_HAVE_TICKLESS
|
|
||||||
|
|
||||||
config STM32_STM32F205
|
config STM32_STM32F205
|
||||||
bool
|
bool
|
||||||
@ -2167,42 +2166,6 @@ config STM32_TSC
|
|||||||
default n
|
default n
|
||||||
depends on STM32_STM32F30XX
|
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
|
config STM32_USART1
|
||||||
bool "USART1"
|
bool "USART1"
|
||||||
default n
|
default n
|
||||||
@ -2581,6 +2544,54 @@ config STM32_FSMC_SRAM
|
|||||||
|
|
||||||
menu "Timer Configuration"
|
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
|
config STM32_TIM1_PWM
|
||||||
bool "TIM1 PWM"
|
bool "TIM1 PWM"
|
||||||
default n
|
default n
|
||||||
|
@ -45,7 +45,7 @@
|
|||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#include <arch/irq.h>
|
#include <nuttx/irq.h>
|
||||||
#include <nuttx/clock.h>
|
#include <nuttx/clock.h>
|
||||||
|
|
||||||
#include "stm32_freerun.h"
|
#include "stm32_freerun.h"
|
||||||
@ -201,7 +201,7 @@ int stm32_freerun_counter(struct stm32_freerun_s *freerun,
|
|||||||
* be lost.
|
* be lost.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
flags = irqsave();
|
flags = enter_critical_section();
|
||||||
|
|
||||||
overflow = freerun->overflow;
|
overflow = freerun->overflow;
|
||||||
counter = STM32_TIM_GETCOUNTER(freerun->tch);
|
counter = STM32_TIM_GETCOUNTER(freerun->tch);
|
||||||
@ -228,7 +228,7 @@ int stm32_freerun_counter(struct stm32_freerun_s *freerun,
|
|||||||
freerun->overflow = overflow;
|
freerun->overflow = overflow;
|
||||||
}
|
}
|
||||||
|
|
||||||
irqrestore(flags);
|
leave_critical_section(flags);
|
||||||
|
|
||||||
tmrinfo("counter=%lu (%lu) overflow=%lu, pending=%i\n",
|
tmrinfo("counter=%lu (%lu) overflow=%lu, pending=%i\n",
|
||||||
(unsigned long)counter, (unsigned long)verify,
|
(unsigned long)counter, (unsigned long)verify,
|
||||||
|
@ -44,6 +44,7 @@
|
|||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
#include <debug.h>
|
||||||
|
|
||||||
#include "stm32_tim.h"
|
#include "stm32_tim.h"
|
||||||
|
|
||||||
|
@ -44,8 +44,9 @@
|
|||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <debug.h>
|
||||||
|
|
||||||
#include <arch/irq.h>
|
#include <nuttx/irq.h>
|
||||||
#include <nuttx/clock.h>
|
#include <nuttx/clock.h>
|
||||||
|
|
||||||
#include "stm32_oneshot.h"
|
#include "stm32_oneshot.h"
|
||||||
@ -223,7 +224,7 @@ int stm32_oneshot_start(struct stm32_oneshot_s *oneshot,
|
|||||||
|
|
||||||
/* Was the oneshot already running? */
|
/* Was the oneshot already running? */
|
||||||
|
|
||||||
flags = irqsave();
|
flags = enter_critical_section();
|
||||||
if (oneshot->running)
|
if (oneshot->running)
|
||||||
{
|
{
|
||||||
/* Yes.. then cancel it */
|
/* Yes.. then cancel it */
|
||||||
@ -276,7 +277,7 @@ int stm32_oneshot_start(struct stm32_oneshot_s *oneshot,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
oneshot->running = true;
|
oneshot->running = true;
|
||||||
irqrestore(flags);
|
leave_critical_section(flags);
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -317,7 +318,7 @@ int stm32_oneshot_cancel(struct stm32_oneshot_s *oneshot,
|
|||||||
|
|
||||||
/* Was the timer running? */
|
/* Was the timer running? */
|
||||||
|
|
||||||
flags = irqsave();
|
flags = enter_critical_section();
|
||||||
if (!oneshot->running)
|
if (!oneshot->running)
|
||||||
{
|
{
|
||||||
/* No.. Just return zero timer remaining and successful cancellation.
|
/* 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_sec = 0;
|
||||||
ts->tv_nsec = 0;
|
ts->tv_nsec = 0;
|
||||||
irqrestore(flags);
|
leave_critical_section(flags);
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -355,7 +356,7 @@ int stm32_oneshot_cancel(struct stm32_oneshot_s *oneshot,
|
|||||||
oneshot->running = false;
|
oneshot->running = false;
|
||||||
oneshot->handler = NULL;
|
oneshot->handler = NULL;
|
||||||
oneshot->arg = NULL;
|
oneshot->arg = NULL;
|
||||||
irqrestore(flags);
|
leave_critical_section(flags);
|
||||||
|
|
||||||
/* Did the caller provide us with a location to return the time
|
/* Did the caller provide us with a location to return the time
|
||||||
* remaining?
|
* remaining?
|
||||||
|
Loading…
Reference in New Issue
Block a user