PebbleOS v4.47.0-1312-gf1984a001
Loading...
Searching...
No Matches
STM32 LPTIM timer

Clock source and clock event device on an STM32 LPTIM, counting its kernel clock. More...

Macros

#define PBL_TIMER_STM32_LPTIM_DEFINE(sym, _name, _base, _irq, _clk, _rst)
 Define the clock source and clock event device of an LPTIM.
 

Detailed Description

Clock source and clock event device on an STM32 LPTIM, counting its kernel clock.

It keeps running and wakes the CPU up in Stop mode, through its EXTI line.

Macro Definition Documentation

◆ PBL_TIMER_STM32_LPTIM_DEFINE

#define PBL_TIMER_STM32_LPTIM_DEFINE (   sym,
  _name,
  _base,
  _irq,
  _clk,
  _rst 
)
Value:
extern const struct pbl_timer_stm32_lptim_cs sym##_cs_inst; \
extern const struct pbl_timer_stm32_lptim_ce sym##_ce_inst; \
static struct pbl_timer_stm32_lptim_state sym##_state; \
static const struct pbl_timer_stm32_lptim sym##_lptim = { \
.state = &sym##_state, \
.cs = &sym##_cs_inst.cs, \
.ce = &sym##_ce_inst.ce, \
.base = (_base), \
.irq = _irq, \
.clk = _clk, \
.rst = _rst, \
}; \
PBL_DEVICE_STATE_DEFINE(sym##_cs); \
PBL_DEVICE_INSTANCE(sym##_cs, struct pbl_timer_stm32_lptim_cs, struct pbl_clocksource, cs){ \
.cs = \
PBL_CLOCKSOURCE_INIT(sym##_cs, _name, pbl_timer_stm32_lptim_cs_init, nullptr, \
&pbl_timer_stm32_lptim_cs_ops, PBL_TIMER_STM32_LPTIM__COUNTER_BITS), \
.lptim = &sym##_lptim, \
}; \
PBL_DEVICE_STATE_DEFINE(sym##_ce); \
PBL_DEVICE_INSTANCE(sym##_ce, struct pbl_timer_stm32_lptim_ce, struct pbl_clockevent, ce){ \
.ce = PBL_CLOCKEVENT_INIT(sym##_ce, _name, pbl_timer_stm32_lptim_ce_init, nullptr, \
&pbl_timer_stm32_lptim_ce_ops, PBL_TIMER_STM32_LPTIM__MIN_DELTA, \
PBL_TIMER_STM32_LPTIM__MAX_DELTA), \
.lptim = &sym##_lptim, \
}; \
PBL_SYS_OFF_HANDLER_DEFINE(sym##_off, PBL_SYS_OFF_POWER_OFF, PBL_SYS_OFF_PRIO_LOW, \
pbl_timer_stm32_lptim_sys_off, (void *)&sym##_lptim)
Clock event device: a one-shot timer interrupt.
Definition timer.h:73
Clock source: a free-running counter.
Definition timer.h:52
#define PBL_CLOCKEVENT_INIT(sym, _name, _init, _parent, _ops, _min, _max)
Clock event device initializer.
Definition timer.h:113
#define PBL_SYS_OFF_PRIO_LOW
Priority of handlers that must run after the others of their mode.
Definition reboot.h:56
@ PBL_SYS_OFF_POWER_OFF
Power off the system.
Definition reboot.h:50

Define the clock source and clock event device of an LPTIM.

They are sym_cs and sym_ce.

Parameters
symSymbol.
_nameName.
_baseBase address.
_irqEXTI line, a struct pbl_irq_spec.
_clkKernel clock, a struct pbl_clk.
_rstReset, a struct pbl_reset.