drivers: counter: gecko: Add SYSRTC stimer support
SiLabs' sleeptimer driver supports several hardware peripherals, of which the counter driver so far only supports the RTCC-based variant. This patch adds support for the SYSRTC-based sleeptimer implementation, which is required for Gecko SoCs that do not have an RTCC module. Signed-off-by: Markus Fuchs <markus.fuchs@ch.sauter-bc.com>
This commit is contained in:
parent
8474cdcaad
commit
27af62603c
4 changed files with 16 additions and 5 deletions
|
@ -18,6 +18,7 @@ config COUNTER_GECKO_STIMER
|
||||||
default y
|
default y
|
||||||
depends on DT_HAS_SILABS_GECKO_STIMER_ENABLED
|
depends on DT_HAS_SILABS_GECKO_STIMER_ENABLED
|
||||||
select SOC_GECKO_RTCC
|
select SOC_GECKO_RTCC
|
||||||
|
select SOC_GECKO_PRS
|
||||||
help
|
help
|
||||||
Enable the counter driver for Sleep Timer module for Silicon Labs
|
Enable the counter driver for Sleep Timer module for Silicon Labs
|
||||||
Gecko chips.
|
Gecko chips.
|
||||||
|
|
|
@ -18,10 +18,20 @@
|
||||||
#include <em_cmu.h>
|
#include <em_cmu.h>
|
||||||
#include <sl_atomic.h>
|
#include <sl_atomic.h>
|
||||||
#include <sl_sleeptimer.h>
|
#include <sl_sleeptimer.h>
|
||||||
|
#include <sli_sleeptimer_hal.h>
|
||||||
|
|
||||||
LOG_MODULE_REGISTER(counter_gecko, CONFIG_COUNTER_LOG_LEVEL);
|
LOG_MODULE_REGISTER(counter_gecko, CONFIG_COUNTER_LOG_LEVEL);
|
||||||
|
|
||||||
#define STIMER_MAX_VALUE (_RTCC_CNT_MASK)
|
#if SL_SLEEPTIMER_PERIPHERAL == SL_SLEEPTIMER_PERIPHERAL_RTCC
|
||||||
|
#define STIMER_IRQ_HANDLER RTCC_IRQHandler
|
||||||
|
#define STIMER_MAX_VALUE _RTCC_CNT_MASK
|
||||||
|
#elif SL_SLEEPTIMER_PERIPHERAL == SL_SLEEPTIMER_PERIPHERAL_SYSRTC
|
||||||
|
#define STIMER_IRQ_HANDLER SYSRTC_APP_IRQHandler
|
||||||
|
#define STIMER_MAX_VALUE _SYSRTC_CNT_MASK
|
||||||
|
#else
|
||||||
|
#error "Unsupported sleep timer peripheral"
|
||||||
|
#endif
|
||||||
|
|
||||||
#define STIMER_ALARM_NUM 2
|
#define STIMER_ALARM_NUM 2
|
||||||
|
|
||||||
struct counter_gecko_config {
|
struct counter_gecko_config {
|
||||||
|
@ -270,7 +280,7 @@ BUILD_ASSERT((DT_INST_PROP(0, prescaler) > 0U) && (DT_INST_PROP(0, prescaler) <=
|
||||||
|
|
||||||
static void counter_gecko_0_irq_config(void)
|
static void counter_gecko_0_irq_config(void)
|
||||||
{
|
{
|
||||||
IRQ_DIRECT_CONNECT(DT_INST_IRQN(0), DT_INST_IRQ(0, priority), RTCC_IRQHandler, 0);
|
IRQ_DIRECT_CONNECT(DT_INST_IRQN(0), DT_INST_IRQ(0, priority), STIMER_IRQ_HANDLER, 0);
|
||||||
irq_enable(DT_INST_IRQN(0));
|
irq_enable(DT_INST_IRQN(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -199,8 +199,8 @@ config SOC_GECKO_DEV_INIT
|
||||||
config COUNTER_GECKO_STIMER
|
config COUNTER_GECKO_STIMER
|
||||||
bool
|
bool
|
||||||
help
|
help
|
||||||
Enable counter driver based on RTCC module for Silicon Labs Gecko
|
Enable counter driver based on the Sleep Timer driver for Silicon Labs
|
||||||
chips.
|
Gecko chips.
|
||||||
|
|
||||||
config SOC_GECKO_CMU
|
config SOC_GECKO_CMU
|
||||||
bool
|
bool
|
||||||
|
|
2
west.yml
2
west.yml
|
@ -219,7 +219,7 @@ manifest:
|
||||||
groups:
|
groups:
|
||||||
- hal
|
- hal
|
||||||
- name: hal_silabs
|
- name: hal_silabs
|
||||||
revision: fbb47a4067c460a2c26917ff34189fb4f32f654f
|
revision: d184c2ccc0ec5a7189d6d5cb7645c7f9bd38c2b5
|
||||||
path: modules/hal/silabs
|
path: modules/hal/silabs
|
||||||
groups:
|
groups:
|
||||||
- hal
|
- hal
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue