Skip to content

Commit

Permalink
arch/arm/stm32/: Added enable/disable to timer low level ops.
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-p-carvalho authored and xiaoxiang781216 committed Jan 7, 2025
1 parent e5ac1c6 commit 3f3e6dd
Show file tree
Hide file tree
Showing 14 changed files with 56 additions and 0 deletions.
2 changes: 2 additions & 0 deletions arch/arm/src/stm32/stm32_tim.c
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,8 @@ static int stm32_tim_checkint(struct stm32_tim_dev_s *dev, int source);

static const struct stm32_tim_ops_s stm32_tim_ops =
{
.enable = stm32_tim_enable,
.disable = stm32_tim_disable,
.setmode = stm32_tim_setmode,
.setclock = stm32_tim_setclock,
.setperiod = stm32_tim_setperiod,
Expand Down
4 changes: 4 additions & 0 deletions arch/arm/src/stm32/stm32_tim.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@
#define STM32_TIM_DISABLEINT(d,s) ((d)->ops->disableint(d,s))
#define STM32_TIM_ACKINT(d,s) ((d)->ops->ackint(d,s))
#define STM32_TIM_CHECKINT(d,s) ((d)->ops->checkint(d,s))
#define STM32_TIM_ENABLE(d) ((d)->ops->enable(d))
#define STM32_TIM_DISABLE(d) ((d)->ops->disable(d))

/****************************************************************************
* Public Types
Expand Down Expand Up @@ -153,6 +155,8 @@ struct stm32_tim_ops_s
{
/* Basic Timers */

void (*enable)(struct stm32_tim_dev_s *dev);
void (*disable)(struct stm32_tim_dev_s *dev);
int (*setmode)(struct stm32_tim_dev_s *dev, stm32_tim_mode_t mode);
int (*setclock)(struct stm32_tim_dev_s *dev, uint32_t freq);
void (*setperiod)(struct stm32_tim_dev_s *dev, uint32_t period);
Expand Down
9 changes: 9 additions & 0 deletions arch/arm/src/stm32f0l0g0/stm32_tim.c
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,13 @@ struct stm32_tim_priv_s
* Private Function prototypes
****************************************************************************/

/* Timer helpers */

static void stm32_tim_reload_counter(struct stm32_tim_dev_s *dev);
static void stm32_tim_enable(struct stm32_tim_dev_s *dev);
static void stm32_tim_disable(struct stm32_tim_dev_s *dev);
static void stm32_tim_reset(struct stm32_tim_dev_s *dev);

/* Timer methods */

static int stm32_tim_setmode(struct stm32_tim_dev_s *dev,
Expand Down Expand Up @@ -298,6 +305,8 @@ static void stm32_tim_ackint(struct stm32_tim_dev_s *dev, int source);

static const struct stm32_tim_ops_s stm32_tim_ops =
{
.enable = &stm32_tim_enable,
.disable = &stm32_tim_disable,
.setmode = &stm32_tim_setmode,
.setclock = &stm32_tim_setclock,
.getclock = &stm32_tim_getclock,
Expand Down
4 changes: 4 additions & 0 deletions arch/arm/src/stm32f0l0g0/stm32_tim.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@
#define STM32_TIM_ENABLEINT(d,s) ((d)->ops->enableint(d,s))
#define STM32_TIM_DISABLEINT(d,s) ((d)->ops->disableint(d,s))
#define STM32_TIM_ACKINT(d,s) ((d)->ops->ackint(d,s))
#define STM32_TIM_ENABLE(d) ((d)->ops->enable(d))
#define STM32_TIM_DISABLE(d) ((d)->ops->disable(d))

/****************************************************************************
* Public Types
Expand Down Expand Up @@ -160,6 +162,8 @@ struct stm32_tim_ops_s
{
/* Basic Timers */

void (*enable)(struct stm32_tim_dev_s *dev);
void (*disable)(struct stm32_tim_dev_s *dev);
int (*setmode)(struct stm32_tim_dev_s *dev, stm32_tim_mode_t mode);
int (*setclock)(struct stm32_tim_dev_s *dev, uint32_t freq);
uint32_t (*getclock)(struct stm32_tim_dev_s *dev);
Expand Down
2 changes: 2 additions & 0 deletions arch/arm/src/stm32f7/stm32_tim.c
Original file line number Diff line number Diff line change
Expand Up @@ -1222,6 +1222,8 @@ static int stm32_tim_getcapture(struct stm32_tim_dev_s *dev,

struct stm32_tim_ops_s stm32_tim_ops =
{
.enable = stm32_tim_enable,
.disable = stm32_tim_disable,
.setmode = stm32_tim_setmode,
.setclock = stm32_tim_setclock,
.setperiod = stm32_tim_setperiod,
Expand Down
4 changes: 4 additions & 0 deletions arch/arm/src/stm32f7/stm32_tim.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@
#define STM32_TIM_DISABLEINT(d,s) ((d)->ops->disableint(d,s))
#define STM32_TIM_ACKINT(d,s) ((d)->ops->ackint(d,s))
#define STM32_TIM_CHECKINT(d,s) ((d)->ops->checkint(d,s))
#define STM32_TIM_ENABLE(d) ((d)->ops->enable(d))
#define STM32_TIM_DISABLE(d) ((d)->ops->disable(d))

/****************************************************************************
* Public Types
Expand Down Expand Up @@ -149,6 +151,8 @@ struct stm32_tim_ops_s
{
/* Basic Timers */

void (*enable)(struct stm32_tim_dev_s *dev);
void (*disable)(struct stm32_tim_dev_s *dev);
int (*setmode)(struct stm32_tim_dev_s *dev, stm32_tim_mode_t mode);
int (*setclock)(struct stm32_tim_dev_s *dev, uint32_t freq);
void (*setperiod)(struct stm32_tim_dev_s *dev, uint32_t period);
Expand Down
9 changes: 9 additions & 0 deletions arch/arm/src/stm32h7/stm32_tim.c
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,13 @@ struct stm32_tim_priv_s
* Private Function prototypes
****************************************************************************/

/* Timer helpers */

static void stm32_tim_reload_counter(struct stm32_tim_dev_s *dev);
static void stm32_tim_enable(struct stm32_tim_dev_s *dev);
static void stm32_tim_disable(struct stm32_tim_dev_s *dev);
static void stm32_tim_reset(struct stm32_tim_dev_s *dev);

/* Timer methods */

static int stm32_tim_setmode(struct stm32_tim_dev_s *dev,
Expand Down Expand Up @@ -287,6 +294,8 @@ static int stm32_tim_checkint(struct stm32_tim_dev_s *dev,

static const struct stm32_tim_ops_s stm32_tim_ops =
{
.enable = &stm32_tim_enable,
.disable = &stm32_tim_disable,
.setmode = &stm32_tim_setmode,
.setclock = &stm32_tim_setclock,
.setperiod = &stm32_tim_setperiod,
Expand Down
4 changes: 4 additions & 0 deletions arch/arm/src/stm32h7/stm32_tim.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@
#define STM32_TIM_DISABLEINT(d,s) ((d)->ops->disableint(d,s))
#define STM32_TIM_ACKINT(d,s) ((d)->ops->ackint(d,s))
#define STM32_TIM_CHECKINT(d,s) ((d)->ops->checkint(d,s))
#define STM32_TIM_ENABLE(d) ((d)->ops->enable(d))
#define STM32_TIM_DISABLE(d) ((d)->ops->disable(d))

/****************************************************************************
* Public Types
Expand Down Expand Up @@ -151,6 +153,8 @@ struct stm32_tim_ops_s
{
/* Basic Timers */

void (*enable)(struct stm32_tim_dev_s *dev);
void (*disable)(struct stm32_tim_dev_s *dev);
int (*setmode)(struct stm32_tim_dev_s *dev, stm32_tim_mode_t mode);
int (*setclock)(struct stm32_tim_dev_s *dev, uint32_t freq);
void (*setperiod)(struct stm32_tim_dev_s *dev, uint32_t period);
Expand Down
2 changes: 2 additions & 0 deletions arch/arm/src/stm32l5/stm32l5_tim.c
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,8 @@ static int stm32l5_tim_checkint(struct stm32l5_tim_dev_s *dev,

static const struct stm32l5_tim_ops_s stm32l5_tim_ops =
{
.enable = stm32l5_tim_enable,
.disable = stm32l5_tim_disable,
.setmode = stm32l5_tim_setmode,
.setclock = stm32l5_tim_setclock,
.getclock = stm32l5_tim_getclock,
Expand Down
4 changes: 4 additions & 0 deletions arch/arm/src/stm32l5/stm32l5_tim.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@
#define STM32L5_TIM_DISABLEINT(d,s) ((d)->ops->disableint(d,s))
#define STM32L5_TIM_ACKINT(d,s) ((d)->ops->ackint(d,s))
#define STM32L5_TIM_CHECKINT(d,s) ((d)->ops->checkint(d,s))
#define STM32_TIM_ENABLE(d) ((d)->ops->enable(d))
#define STM32_TIM_DISABLE(d) ((d)->ops->disable(d))

/****************************************************************************
* Public Types
Expand Down Expand Up @@ -149,6 +151,8 @@ struct stm32l5_tim_ops_s
{
/* Basic Timers */

void (*enable)(struct stm32l5_tim_dev_s *dev);
void (*disable)(struct stm32l5_tim_dev_s *dev);
int (*setmode)(struct stm32l5_tim_dev_s *dev,
enum stm32l5_tim_mode_e mode);
int (*setclock)(struct stm32l5_tim_dev_s *dev, uint32_t freq);
Expand Down
2 changes: 2 additions & 0 deletions arch/arm/src/stm32u5/stm32_tim.c
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,8 @@ static int stm32_tim_checkint(struct stm32_tim_dev_s *dev,

static const struct stm32_tim_ops_s stm32_tim_ops =
{
.enable = stm32_tim_enable,
.disable = stm32_tim_disable,
.setmode = stm32_tim_setmode,
.setclock = stm32_tim_setclock,
.getclock = stm32_tim_getclock,
Expand Down
4 changes: 4 additions & 0 deletions arch/arm/src/stm32u5/stm32_tim.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@
#define STM32U5_TIM_DISABLEINT(d,s) ((d)->ops->disableint(d,s))
#define STM32U5_TIM_ACKINT(d,s) ((d)->ops->ackint(d,s))
#define STM32U5_TIM_CHECKINT(d,s) ((d)->ops->checkint(d,s))
#define STM32_TIM_ENABLE(d) ((d)->ops->enable(d))
#define STM32_TIM_DISABLE(d) ((d)->ops->disable(d))

/****************************************************************************
* Public Types
Expand Down Expand Up @@ -143,6 +145,8 @@ struct stm32_tim_ops_s
{
/* Basic Timers */

void (*enable)(struct stm32_tim_dev_s *dev);
void (*disable)(struct stm32_tim_dev_s *dev);
int (*setmode)(struct stm32_tim_dev_s *dev,
enum stm32_tim_mode_e mode);
int (*setclock)(struct stm32_tim_dev_s *dev, uint32_t freq);
Expand Down
2 changes: 2 additions & 0 deletions arch/arm/src/stm32wl5/stm32wl5_tim.c
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,8 @@ static int stm32wl5_tim_checkint(struct stm32wl5_tim_dev_s *dev,

static const struct stm32wl5_tim_ops_s stm32wl5_tim_ops =
{
.enable = stm32wl5_tim_enable,
.disable = stm32wl5_tim_disable,
.setmode = stm32wl5_tim_setmode,
.setclock = stm32wl5_tim_setclock,
.getclock = stm32wl5_tim_getclock,
Expand Down
4 changes: 4 additions & 0 deletions arch/arm/src/stm32wl5/stm32wl5_tim.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@
#define STM32WL5_TIM_DISABLEINT(d,s) ((d)->ops->disableint(d,s))
#define STM32WL5_TIM_ACKINT(d,s) ((d)->ops->ackint(d,s))
#define STM32WL5_TIM_CHECKINT(d,s) ((d)->ops->checkint(d,s))
#define STM32_TIM_ENABLE(d) ((d)->ops->enable(d))
#define STM32_TIM_DISABLE(d) ((d)->ops->disable(d))

/****************************************************************************
* Public Types
Expand Down Expand Up @@ -141,6 +143,8 @@ struct stm32wl5_tim_ops_s
{
/* Basic Timers */

void (*enable)(struct stm32wl5_tim_dev_s *dev);
void (*disable)(struct stm32wl5_tim_dev_s *dev);
int (*setmode)(struct stm32wl5_tim_dev_s *dev,
enum stm32wl5_tim_mode_e mode);
int (*setclock)(struct stm32wl5_tim_dev_s *dev, uint32_t freq);
Expand Down

0 comments on commit 3f3e6dd

Please sign in to comment.