drivers: counter: Move nRF TIMER and RTC configuration to device tree
Reduced Kconfig for counter with nRF TIMER and RTC. Added overlays for TIMER and RTC configuration in the counter test. Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
This commit is contained in:
parent
a5f36427d2
commit
6d4a5200bc
22 changed files with 169 additions and 154 deletions
|
@ -17,85 +17,30 @@ config COUNTER_TIMER0
|
|||
select COUNTER_NRF_TIMER
|
||||
select NRFX_TIMER0
|
||||
|
||||
if COUNTER_TIMER0
|
||||
|
||||
config COUNTER_TIMER0_PRESCALER
|
||||
int "Timer prescaler"
|
||||
default 0
|
||||
range 0 9
|
||||
help
|
||||
Frequency = 16 Mhz / 2^prescaler.
|
||||
|
||||
endif #COUNTER_TIMER0
|
||||
|
||||
config COUNTER_TIMER1
|
||||
bool "Enable Counter on TIMER1"
|
||||
depends on HAS_HW_NRF_TIMER1
|
||||
select COUNTER_NRF_TIMER
|
||||
select NRFX_TIMER1
|
||||
|
||||
if COUNTER_TIMER1
|
||||
|
||||
config COUNTER_TIMER1_PRESCALER
|
||||
int "Timer prescaler"
|
||||
default 0
|
||||
range 0 9
|
||||
help
|
||||
Frequency = 16 Mhz / 2^prescaler.
|
||||
|
||||
endif #COUNTER_TIMER1
|
||||
|
||||
config COUNTER_TIMER2
|
||||
bool "Enable Counter on TIMER2"
|
||||
depends on HAS_HW_NRF_TIMER2
|
||||
select COUNTER_NRF_TIMER
|
||||
select NRFX_TIMER2
|
||||
|
||||
if COUNTER_TIMER2
|
||||
|
||||
config COUNTER_TIMER2_PRESCALER
|
||||
int "Timer prescaler"
|
||||
default 0
|
||||
range 0 9
|
||||
help
|
||||
Frequency = 16 Mhz / 2^prescaler.
|
||||
|
||||
endif #COUNTER_TIMER2
|
||||
|
||||
config COUNTER_TIMER3
|
||||
bool "Enable Counter on TIMER3"
|
||||
depends on HAS_HW_NRF_TIMER3
|
||||
select COUNTER_NRF_TIMER
|
||||
select NRFX_TIMER3
|
||||
|
||||
if COUNTER_TIMER3
|
||||
|
||||
config COUNTER_TIMER3_PRESCALER
|
||||
int "Timer prescaler"
|
||||
default 0
|
||||
range 0 9
|
||||
help
|
||||
Frequency = 16 Mhz / 2^prescaler.
|
||||
|
||||
endif #COUNTER_TIMER3
|
||||
|
||||
config COUNTER_TIMER4
|
||||
bool "Enable Counter on TIMER4"
|
||||
depends on HAS_HW_NRF_TIMER4
|
||||
select COUNTER_NRF_TIMER
|
||||
select NRFX_TIMER4
|
||||
|
||||
if COUNTER_TIMER4
|
||||
|
||||
config COUNTER_TIMER4_PRESCALER
|
||||
int "Timer prescaler"
|
||||
default 0
|
||||
range 0 9
|
||||
help
|
||||
Frequency = 16 Mhz / 2^prescaler.
|
||||
|
||||
endif #COUNTER_TIMER4
|
||||
|
||||
config COUNTER_RTC0
|
||||
bool "Enable Counter on RTC0"
|
||||
depends on HAS_HW_NRF_RTC0
|
||||
|
@ -103,27 +48,6 @@ config COUNTER_RTC0
|
|||
select COUNTER_NRF_RTC
|
||||
select NRFX_RTC0
|
||||
|
||||
if COUNTER_RTC0
|
||||
|
||||
config COUNTER_RTC0_PRESCALER
|
||||
int "RTC prescaler"
|
||||
default 0
|
||||
range 0 2047
|
||||
help
|
||||
Frequency = 32768 / (prescaler+1).
|
||||
|
||||
config COUNTER_RTC0_PPI_WRAP
|
||||
bool "Enable PPI wrapping in RTC0"
|
||||
select NRFX_PPI if HAS_HW_NRF_PPI
|
||||
select NRFX_DPPI if HAS_HW_NRF_DPPIC
|
||||
help
|
||||
If enabled, overflow different than full range (24 bits) is handled
|
||||
through PPI channel which ensures precise timing. If disabled then
|
||||
counter is cleared in the interrupt which results in accumulative
|
||||
error of counter period if top value is different than maximal.
|
||||
|
||||
endif #COUNTER_RTC0
|
||||
|
||||
config COUNTER_RTC1
|
||||
bool "Enable Counter on RTC1"
|
||||
depends on HAS_HW_NRF_RTC1
|
||||
|
@ -131,50 +55,20 @@ config COUNTER_RTC1
|
|||
select COUNTER_NRF_RTC
|
||||
select NRFX_RTC1
|
||||
|
||||
if COUNTER_RTC1
|
||||
|
||||
config COUNTER_RTC1_PRESCALER
|
||||
int "RTC prescaler"
|
||||
default 0
|
||||
range 0 2047
|
||||
help
|
||||
Frequency = 32768 / (prescaler+1).
|
||||
|
||||
config COUNTER_RTC1_PPI_WRAP
|
||||
bool "Enable PPI wrapping in RTC1"
|
||||
select NRFX_PPI if HAS_HW_NRF_PPI
|
||||
select NRFX_DPPI if HAS_HW_NRF_DPPIC
|
||||
help
|
||||
If enabled, overflow different than full range (24 bits) is handled
|
||||
through PPI channel which ensures precise timing. If disabled then
|
||||
counter is cleared in the interrupt which results in accumulative
|
||||
error of counter period if top value is different than maximal.
|
||||
|
||||
endif #COUNTER_RTC1
|
||||
|
||||
config COUNTER_RTC2
|
||||
bool "Enable Counter on RTC2"
|
||||
depends on HAS_HW_NRF_RTC2
|
||||
select COUNTER_NRF_RTC
|
||||
select NRFX_RTC2
|
||||
|
||||
if COUNTER_RTC2
|
||||
# Internal flag which detects if PPI wrap feature is enabled for any instance
|
||||
if $(dt_int_val,DT_NORDIC_NRF_RTC_0_PPI_WRAP) > 0 || \
|
||||
$(dt_int_val,DT_NORDIC_NRF_RTC_1_PPI_WRAP) > 0 || \
|
||||
$(dt_int_val,DT_NORDIC_NRF_RTC_2_PPI_WRAP) > 0
|
||||
|
||||
config COUNTER_RTC2_PRESCALER
|
||||
int "RTC prescaler"
|
||||
default 0
|
||||
range 0 2047
|
||||
help
|
||||
Frequency = 32768 / (prescaler+1).
|
||||
|
||||
config COUNTER_RTC2_PPI_WRAP
|
||||
bool "Enable PPI wrapping in RTC2"
|
||||
config COUNTER_RTC_WITH_PPI_WRAP
|
||||
bool
|
||||
default y
|
||||
select NRFX_PPI if HAS_HW_NRF_PPI
|
||||
select NRFX_DPPI if HAS_HW_NRF_DPPIC
|
||||
help
|
||||
If enabled, overflow different than full range (24 bits) is handled
|
||||
through PPI channel which ensures precise timing. If disabled then
|
||||
counter is cleared in the interrupt which results in accumulative
|
||||
error of counter period if top value is different than maximal.
|
||||
|
||||
endif # COUNTER_RTC2
|
||||
endif
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
#include <logging/log.h>
|
||||
LOG_MODULE_REGISTER(LOG_MODULE_NAME, LOG_LEVEL);
|
||||
|
||||
#define RTC_CLOCK 32768
|
||||
#define COUNTER_MAX_TOP_VALUE RTC_COUNTER_COUNTER_Msk
|
||||
|
||||
#define CC_TO_ID(cc) ((cc) - 1)
|
||||
|
@ -27,16 +26,11 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME, LOG_LEVEL);
|
|||
#define TOP_CH 0
|
||||
#define COUNTER_TOP_INT NRFX_RTC_INT_COMPARE0
|
||||
|
||||
#define IS_PPI_WRAP_ENABLED() \
|
||||
(IS_ENABLED(CONFIG_COUNTER_RTC0_PPI_WRAP) || \
|
||||
IS_ENABLED(CONFIG_COUNTER_RTC1_PPI_WRAP) || \
|
||||
IS_ENABLED(CONFIG_COUNTER_RTC2_PPI_WRAP))
|
||||
|
||||
struct counter_nrfx_data {
|
||||
counter_top_callback_t top_cb;
|
||||
void *top_user_data;
|
||||
u32_t top;
|
||||
#if IS_PPI_WRAP_ENABLED()
|
||||
#if CONFIG_COUNTER_RTC_WITH_PPI_WRAP
|
||||
u8_t ppi_ch;
|
||||
#endif
|
||||
};
|
||||
|
@ -50,7 +44,7 @@ struct counter_nrfx_config {
|
|||
struct counter_config_info info;
|
||||
struct counter_nrfx_ch_data *ch_data;
|
||||
nrfx_rtc_t rtc;
|
||||
#if IS_PPI_WRAP_ENABLED()
|
||||
#if CONFIG_COUNTER_RTC_WITH_PPI_WRAP
|
||||
bool use_ppi;
|
||||
#endif
|
||||
LOG_INSTANCE_PTR_DECLARE(log);
|
||||
|
@ -200,7 +194,7 @@ static void event_handler(nrfx_rtc_int_type_t int_type, void *p_context)
|
|||
if (int_type == COUNTER_TOP_INT) {
|
||||
/* Manually reset counter if top value is different than max. */
|
||||
if ((data->top != COUNTER_MAX_TOP_VALUE)
|
||||
#if IS_PPI_WRAP_ENABLED()
|
||||
#if CONFIG_COUNTER_RTC_WITH_PPI_WRAP
|
||||
&& !get_nrfx_config(dev)->use_ppi
|
||||
#endif
|
||||
) {
|
||||
|
@ -221,7 +215,7 @@ static void event_handler(nrfx_rtc_int_type_t int_type, void *p_context)
|
|||
|
||||
static int ppi_setup(struct device *dev)
|
||||
{
|
||||
#if IS_PPI_WRAP_ENABLED()
|
||||
#if CONFIG_COUNTER_RTC_WITH_PPI_WRAP
|
||||
const struct counter_nrfx_config *nrfx_config = get_nrfx_config(dev);
|
||||
struct counter_nrfx_data *data = get_dev_data(dev);
|
||||
const nrfx_rtc_t *rtc = &nrfx_config->rtc;
|
||||
|
@ -259,7 +253,7 @@ static int ppi_setup(struct device *dev)
|
|||
(void)nrfx_ppi_channel_assign(data->ppi_ch, evt, task);
|
||||
(void)nrfx_ppi_channel_enable(data->ppi_ch);
|
||||
#endif
|
||||
#endif /* IS_PPI_WRAP_ENABLED() */
|
||||
#endif /* CONFIG_COUNTER_RTC_WITH_PPI_WRAP */
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -322,6 +316,9 @@ static const struct counter_driver_api counter_nrfx_driver_api = {
|
|||
};
|
||||
|
||||
#define COUNTER_NRFX_RTC_DEVICE(idx) \
|
||||
BUILD_ASSERT_MSG((DT_NORDIC_NRF_RTC_RTC_##idx##_PRESCALER - 1) <= \
|
||||
RTC_PRESCALER_PRESCALER_Msk, \
|
||||
"RTC prescaler out of range"); \
|
||||
DEVICE_DECLARE(rtc_##idx); \
|
||||
static void rtc_##idx##_handler(nrfx_rtc_int_type_t int_type) \
|
||||
{ \
|
||||
|
@ -333,7 +330,8 @@ static const struct counter_driver_api counter_nrfx_driver_api = {
|
|||
DT_NORDIC_NRF_RTC_RTC_##idx##_IRQ_PRIORITY, \
|
||||
nrfx_isr, nrfx_rtc_##idx##_irq_handler, 0); \
|
||||
const nrfx_rtc_config_t config = { \
|
||||
.prescaler = CONFIG_COUNTER_RTC##idx##_PRESCALER, \
|
||||
.prescaler = \
|
||||
DT_NORDIC_NRF_RTC_RTC_##idx##_PRESCALER - 1, \
|
||||
}; \
|
||||
return init_rtc(dev, &config, rtc_##idx##_handler); \
|
||||
} \
|
||||
|
@ -344,14 +342,14 @@ static const struct counter_driver_api counter_nrfx_driver_api = {
|
|||
static const struct counter_nrfx_config nrfx_counter_##idx##z_config = {\
|
||||
.info = { \
|
||||
.max_top_value = COUNTER_MAX_TOP_VALUE, \
|
||||
.freq = RTC_CLOCK / \
|
||||
(CONFIG_COUNTER_RTC##idx##_PRESCALER + 1), \
|
||||
.freq = DT_NORDIC_NRF_RTC_RTC_##idx##_CLOCK_FREQUENCY /\
|
||||
(DT_NORDIC_NRF_RTC_RTC_##idx##_PRESCALER), \
|
||||
.count_up = true, \
|
||||
.channels = CC_TO_ID(RTC##idx##_CC_NUM) \
|
||||
}, \
|
||||
.ch_data = counter##idx##_ch_data, \
|
||||
.rtc = NRFX_RTC_INSTANCE(idx), \
|
||||
COND_CODE_1(CONFIG_COUNTER_RTC##idx##_PPI_WRAP, \
|
||||
COND_CODE_1(DT_NORDIC_NRF_RTC_RTC_##idx##_PPI_WRAP, \
|
||||
(.use_ppi = true,), ()) \
|
||||
LOG_INSTANCE_PTR_INIT(log, LOG_MODULE_NAME, idx) \
|
||||
}; \
|
||||
|
|
|
@ -252,13 +252,17 @@ static const struct counter_driver_api counter_nrfx_driver_api = {
|
|||
};
|
||||
|
||||
#define COUNTER_NRFX_TIMER_DEVICE(idx) \
|
||||
BUILD_ASSERT_MSG(DT_NORDIC_NRF_TIMER_TIMER_##idx##_PRESCALER <= \
|
||||
TIMER_PRESCALER_PRESCALER_Msk, \
|
||||
"TIMER prescaler out of range"); \
|
||||
static int counter_##idx##_init(struct device *dev) \
|
||||
{ \
|
||||
IRQ_CONNECT(DT_NORDIC_NRF_TIMER_TIMER_##idx##_IRQ, \
|
||||
DT_NORDIC_NRF_TIMER_TIMER_##idx##_IRQ_PRIORITY, \
|
||||
nrfx_isr, nrfx_timer_##idx##_irq_handler, 0); \
|
||||
const nrfx_timer_config_t config = { \
|
||||
.frequency = CONFIG_COUNTER_TIMER##idx##_PRESCALER, \
|
||||
.frequency = \
|
||||
DT_NORDIC_NRF_TIMER_TIMER_##idx##_PRESCALER, \
|
||||
.mode = NRF_TIMER_MODE_TIMER, \
|
||||
.bit_width = (TIMER##idx##_MAX_SIZE == 32) ? \
|
||||
NRF_TIMER_BIT_WIDTH_32 : \
|
||||
|
@ -276,7 +280,7 @@ static const struct counter_driver_api counter_nrfx_driver_api = {
|
|||
.max_top_value = (TIMER##idx##_MAX_SIZE == 32) ? \
|
||||
0xffffffff : 0x0000ffff, \
|
||||
.freq = TIMER_CLOCK / \
|
||||
(1 << CONFIG_COUNTER_TIMER##idx##_PRESCALER), \
|
||||
(1 << DT_NORDIC_NRF_TIMER_TIMER_##idx##_PRESCALER), \
|
||||
.count_up = true, \
|
||||
.channels = CC_TO_ID(TIMER##idx##_CC_NUM), \
|
||||
}, \
|
||||
|
|
|
@ -154,6 +154,8 @@
|
|||
reg = <0x4000b000 0x1000>;
|
||||
interrupts = <11 1>;
|
||||
status = "ok";
|
||||
clock-frequency = <32768>;
|
||||
prescaler = <1>;
|
||||
label = "RTC_0";
|
||||
};
|
||||
|
||||
|
@ -162,6 +164,8 @@
|
|||
reg = <0x40011000 0x1000>;
|
||||
interrupts = <17 1>;
|
||||
status = "ok";
|
||||
clock-frequency = <32768>;
|
||||
prescaler = <1>;
|
||||
label = "RTC_1";
|
||||
};
|
||||
|
||||
|
@ -170,6 +174,7 @@
|
|||
status = "ok";
|
||||
reg = <0x40008000 0x1000>;
|
||||
interrupts = <8 1>;
|
||||
prescaler = <0>;
|
||||
label = "TIMER_0";
|
||||
};
|
||||
|
||||
|
@ -178,6 +183,7 @@
|
|||
status = "ok";
|
||||
reg = <0x40009000 0x1000>;
|
||||
interrupts = <9 1>;
|
||||
prescaler = <0>;
|
||||
label = "TIMER_1";
|
||||
};
|
||||
|
||||
|
@ -186,6 +192,7 @@
|
|||
status = "ok";
|
||||
reg = <0x4000a000 0x1000>;
|
||||
interrupts = <10 1>;
|
||||
prescaler = <0>;
|
||||
label = "TIMER_2";
|
||||
};
|
||||
|
||||
|
|
|
@ -140,6 +140,8 @@
|
|||
reg = <0x4000b000 0x1000>;
|
||||
interrupts = <11 1>;
|
||||
status = "ok";
|
||||
clock-frequency = <32768>;
|
||||
prescaler = <1>;
|
||||
label = "RTC_0";
|
||||
};
|
||||
|
||||
|
@ -148,6 +150,8 @@
|
|||
reg = <0x40011000 0x1000>;
|
||||
interrupts = <17 1>;
|
||||
status = "ok";
|
||||
clock-frequency = <32768>;
|
||||
prescaler = <1>;
|
||||
label = "RTC_1";
|
||||
};
|
||||
|
||||
|
@ -156,6 +160,7 @@
|
|||
status = "ok";
|
||||
reg = <0x40008000 0x1000>;
|
||||
interrupts = <8 1>;
|
||||
prescaler = <0>;
|
||||
label = "TIMER_0";
|
||||
};
|
||||
|
||||
|
@ -164,6 +169,7 @@
|
|||
status = "ok";
|
||||
reg = <0x40009000 0x1000>;
|
||||
interrupts = <9 1>;
|
||||
prescaler = <0>;
|
||||
label = "TIMER_1";
|
||||
};
|
||||
|
||||
|
@ -172,6 +178,7 @@
|
|||
status = "ok";
|
||||
reg = <0x4000a000 0x1000>;
|
||||
interrupts = <10 1>;
|
||||
prescaler = <0>;
|
||||
label = "TIMER_2";
|
||||
};
|
||||
|
||||
|
|
|
@ -158,6 +158,8 @@
|
|||
reg = <0x4000b000 0x1000>;
|
||||
interrupts = <11 1>;
|
||||
status = "ok";
|
||||
clock-frequency = <32768>;
|
||||
prescaler = <1>;
|
||||
label = "RTC_0";
|
||||
};
|
||||
|
||||
|
@ -166,6 +168,8 @@
|
|||
reg = <0x40011000 0x1000>;
|
||||
interrupts = <17 1>;
|
||||
status = "ok";
|
||||
clock-frequency = <32768>;
|
||||
prescaler = <1>;
|
||||
label = "RTC_1";
|
||||
};
|
||||
|
||||
|
@ -174,6 +178,7 @@
|
|||
status = "ok";
|
||||
reg = <0x40008000 0x1000>;
|
||||
interrupts = <8 1>;
|
||||
prescaler = <0>;
|
||||
label = "TIMER_0";
|
||||
};
|
||||
|
||||
|
@ -182,6 +187,7 @@
|
|||
status = "ok";
|
||||
reg = <0x40009000 0x1000>;
|
||||
interrupts = <9 1>;
|
||||
prescaler = <0>;
|
||||
label = "TIMER_1";
|
||||
};
|
||||
|
||||
|
@ -190,6 +196,7 @@
|
|||
status = "ok";
|
||||
reg = <0x4000a000 0x1000>;
|
||||
interrupts = <10 1>;
|
||||
prescaler = <0>;
|
||||
label = "TIMER_2";
|
||||
};
|
||||
|
||||
|
|
|
@ -196,6 +196,8 @@
|
|||
reg = <0x4000b000 0x1000>;
|
||||
interrupts = <11 1>;
|
||||
status = "ok";
|
||||
clock-frequency = <32768>;
|
||||
prescaler = <1>;
|
||||
label = "RTC_0";
|
||||
};
|
||||
|
||||
|
@ -204,6 +206,8 @@
|
|||
reg = <0x40011000 0x1000>;
|
||||
interrupts = <17 1>;
|
||||
status = "ok";
|
||||
clock-frequency = <32768>;
|
||||
prescaler = <1>;
|
||||
label = "RTC_1";
|
||||
};
|
||||
|
||||
|
@ -212,6 +216,8 @@
|
|||
reg = <0x40024000 0x1000>;
|
||||
interrupts = <36 1>;
|
||||
status = "ok";
|
||||
clock-frequency = <32768>;
|
||||
prescaler = <1>;
|
||||
label = "RTC_2";
|
||||
};
|
||||
|
||||
|
@ -220,6 +226,7 @@
|
|||
status = "ok";
|
||||
reg = <0x40008000 0x1000>;
|
||||
interrupts = <8 1>;
|
||||
prescaler = <0>;
|
||||
label = "TIMER_0";
|
||||
};
|
||||
|
||||
|
@ -228,6 +235,7 @@
|
|||
status = "ok";
|
||||
reg = <0x40009000 0x1000>;
|
||||
interrupts = <9 1>;
|
||||
prescaler = <0>;
|
||||
label = "TIMER_1";
|
||||
};
|
||||
|
||||
|
@ -236,6 +244,7 @@
|
|||
status = "ok";
|
||||
reg = <0x4000a000 0x1000>;
|
||||
interrupts = <10 1>;
|
||||
prescaler = <0>;
|
||||
label = "TIMER_2";
|
||||
};
|
||||
|
||||
|
@ -244,6 +253,7 @@
|
|||
status = "ok";
|
||||
reg = <0x4001a000 0x1000>;
|
||||
interrupts = <26 1>;
|
||||
prescaler = <0>;
|
||||
label = "TIMER_3";
|
||||
};
|
||||
|
||||
|
@ -252,6 +262,7 @@
|
|||
status = "ok";
|
||||
reg = <0x4001b000 0x1000>;
|
||||
interrupts = <27 1>;
|
||||
prescaler = <0>;
|
||||
label = "TIMER_4";
|
||||
};
|
||||
|
||||
|
|
|
@ -240,6 +240,8 @@
|
|||
reg = <0x4000b000 0x1000>;
|
||||
interrupts = <11 1>;
|
||||
status = "ok";
|
||||
clock-frequency = <32768>;
|
||||
prescaler = <1>;
|
||||
label = "RTC_0";
|
||||
};
|
||||
|
||||
|
@ -248,6 +250,8 @@
|
|||
reg = <0x40011000 0x1000>;
|
||||
interrupts = <17 1>;
|
||||
status = "ok";
|
||||
clock-frequency = <32768>;
|
||||
prescaler = <1>;
|
||||
label = "RTC_1";
|
||||
};
|
||||
|
||||
|
@ -256,6 +260,8 @@
|
|||
reg = <0x40024000 0x1000>;
|
||||
interrupts = <36 1>;
|
||||
status = "ok";
|
||||
clock-frequency = <32768>;
|
||||
prescaler = <1>;
|
||||
label = "RTC_2";
|
||||
};
|
||||
|
||||
|
@ -264,6 +270,7 @@
|
|||
status = "ok";
|
||||
reg = <0x40008000 0x1000>;
|
||||
interrupts = <8 1>;
|
||||
prescaler = <0>;
|
||||
label = "TIMER_0";
|
||||
};
|
||||
|
||||
|
@ -272,6 +279,7 @@
|
|||
status = "ok";
|
||||
reg = <0x40009000 0x1000>;
|
||||
interrupts = <9 1>;
|
||||
prescaler = <0>;
|
||||
label = "TIMER_1";
|
||||
};
|
||||
|
||||
|
@ -280,6 +288,7 @@
|
|||
status = "ok";
|
||||
reg = <0x4000a000 0x1000>;
|
||||
interrupts = <10 1>;
|
||||
prescaler = <0>;
|
||||
label = "TIMER_2";
|
||||
};
|
||||
|
||||
|
@ -288,6 +297,7 @@
|
|||
status = "ok";
|
||||
reg = <0x4001a000 0x1000>;
|
||||
interrupts = <26 1>;
|
||||
prescaler = <0>;
|
||||
label = "TIMER_3";
|
||||
};
|
||||
|
||||
|
@ -296,6 +306,7 @@
|
|||
status = "ok";
|
||||
reg = <0x4001b000 0x1000>;
|
||||
interrupts = <27 1>;
|
||||
prescaler = <0>;
|
||||
label = "TIMER_4";
|
||||
};
|
||||
|
||||
|
|
|
@ -198,6 +198,8 @@ rtc0: rtc@14000 {
|
|||
reg = <0x14000 0x1000>;
|
||||
interrupts = <20 1>;
|
||||
status = "ok";
|
||||
clock-frequency = <32768>;
|
||||
prescaler = <1>;
|
||||
label = "RTC_0";
|
||||
};
|
||||
|
||||
|
@ -206,6 +208,8 @@ rtc1: rtc@15000 {
|
|||
reg = <0x15000 0x1000>;
|
||||
interrupts = <21 1>;
|
||||
status = "ok";
|
||||
clock-frequency = <32768>;
|
||||
prescaler = <1>;
|
||||
label = "RTC_1";
|
||||
};
|
||||
|
||||
|
@ -237,6 +241,7 @@ timer0: timer@f000 {
|
|||
status = "disabled";
|
||||
reg = <0xf000 0x1000>;
|
||||
interrupts = <15 1>;
|
||||
prescaler = <0>;
|
||||
label = "TIMER_0";
|
||||
};
|
||||
|
||||
|
@ -245,6 +250,7 @@ timer1: timer@10000 {
|
|||
status = "disabled";
|
||||
reg = <0x10000 0x1000>;
|
||||
interrupts = <16 1>;
|
||||
prescaler = <0>;
|
||||
label = "TIMER_1";
|
||||
};
|
||||
|
||||
|
@ -253,5 +259,6 @@ timer2: timer@11000 {
|
|||
status = "disabled";
|
||||
reg = <0x11000 0x1000>;
|
||||
interrupts = <17 1>;
|
||||
prescaler = <0>;
|
||||
label = "TIMER_2";
|
||||
};
|
||||
|
|
|
@ -22,4 +22,14 @@ properties:
|
|||
description: mmio register space
|
||||
generation: define
|
||||
category: required
|
||||
|
||||
#If enabled, overflow different than full range (24 bits) is handled
|
||||
#through PPI channel which ensures precise timing. If disabled then
|
||||
#counter is cleared in the interrupt which results in accumulative
|
||||
#error of counter period if top value is different than maximal.
|
||||
ppi-wrap:
|
||||
type: boolean
|
||||
description: Enable wrapping with PPI
|
||||
generation: define
|
||||
category: required
|
||||
...
|
||||
|
|
|
@ -36,9 +36,10 @@ properties:
|
|||
type: stringlist
|
||||
category: optional
|
||||
description: names of required interrupts
|
||||
|
||||
prescaler:
|
||||
type: int
|
||||
category: required
|
||||
description: Prescaler value denotes number of RTC ticks in 1 second
|
||||
description: RTC frequency equals clock-frequency divided by the prescaler value
|
||||
generation: define
|
||||
...
|
||||
|
|
|
@ -34,4 +34,10 @@ properties:
|
|||
category: required
|
||||
description: Human readable string describing the device (used by Zephyr for API name)
|
||||
generation: define
|
||||
|
||||
prescaler:
|
||||
type: int
|
||||
category: required
|
||||
description: Prescaler value determines frequency (16MHz/2^prescaler)
|
||||
generation: define
|
||||
...
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
CONFIG_COUNTER_TIMER0=y
|
||||
CONFIG_COUNTER_TIMER0_PRESCALER=4
|
||||
CONFIG_COUNTER_TIMER1=y
|
||||
CONFIG_COUNTER_TIMER1_PRESCALER=4
|
||||
CONFIG_COUNTER_TIMER2=y
|
||||
CONFIG_COUNTER_TIMER2_PRESCALER=4
|
||||
CONFIG_COUNTER_RTC0=y
|
||||
CONFIG_COUNTER_RTC0=y
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
CONFIG_COUNTER_TIMER0=y
|
||||
CONFIG_COUNTER_TIMER0_PRESCALER=4
|
||||
CONFIG_COUNTER_TIMER1=y
|
||||
CONFIG_COUNTER_TIMER1_PRESCALER=4
|
||||
CONFIG_COUNTER_TIMER2=y
|
||||
CONFIG_COUNTER_TIMER2_PRESCALER=4
|
||||
CONFIG_COUNTER_RTC0=y
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
CONFIG_COUNTER_TIMER0=y
|
||||
CONFIG_COUNTER_TIMER0_PRESCALER=4
|
||||
CONFIG_COUNTER_TIMER1=y
|
||||
CONFIG_COUNTER_TIMER1_PRESCALER=4
|
||||
CONFIG_COUNTER_TIMER2=y
|
||||
CONFIG_COUNTER_TIMER2_PRESCALER=4
|
||||
CONFIG_COUNTER_RTC0=y
|
||||
|
|
|
@ -1,12 +1,7 @@
|
|||
CONFIG_COUNTER_TIMER0=y
|
||||
CONFIG_COUNTER_TIMER0_PRESCALER=4
|
||||
CONFIG_COUNTER_TIMER1=y
|
||||
CONFIG_COUNTER_TIMER1_PRESCALER=4
|
||||
CONFIG_COUNTER_TIMER2=y
|
||||
CONFIG_COUNTER_TIMER2_PRESCALER=4
|
||||
CONFIG_COUNTER_TIMER3=y
|
||||
CONFIG_COUNTER_TIMER3_PRESCALER=4
|
||||
CONFIG_COUNTER_TIMER4=y
|
||||
CONFIG_COUNTER_TIMER4_PRESCALER=4
|
||||
CONFIG_COUNTER_RTC0=y
|
||||
CONFIG_COUNTER_RTC2=y
|
||||
CONFIG_COUNTER_RTC2=y
|
||||
|
|
|
@ -1,12 +1,7 @@
|
|||
CONFIG_COUNTER_TIMER0=y
|
||||
CONFIG_COUNTER_TIMER0_PRESCALER=4
|
||||
CONFIG_COUNTER_TIMER1=y
|
||||
CONFIG_COUNTER_TIMER1_PRESCALER=4
|
||||
CONFIG_COUNTER_TIMER2=y
|
||||
CONFIG_COUNTER_TIMER2_PRESCALER=4
|
||||
CONFIG_COUNTER_TIMER3=y
|
||||
CONFIG_COUNTER_TIMER3_PRESCALER=4
|
||||
CONFIG_COUNTER_TIMER4=y
|
||||
CONFIG_COUNTER_TIMER4_PRESCALER=4
|
||||
CONFIG_COUNTER_RTC0=y
|
||||
CONFIG_COUNTER_RTC2=y
|
||||
CONFIG_COUNTER_RTC2=y
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
&timer0 {
|
||||
prescaler = <4>;
|
||||
};
|
||||
|
||||
&timer1 {
|
||||
prescaler = <4>;
|
||||
};
|
||||
|
||||
&timer2 {
|
||||
prescaler = <4>;
|
||||
};
|
|
@ -0,0 +1,11 @@
|
|||
&timer0 {
|
||||
prescaler = <4>;
|
||||
};
|
||||
|
||||
&timer1 {
|
||||
prescaler = <4>;
|
||||
};
|
||||
|
||||
&timer2 {
|
||||
prescaler = <4>;
|
||||
};
|
|
@ -0,0 +1,11 @@
|
|||
&timer0 {
|
||||
prescaler = <4>;
|
||||
};
|
||||
|
||||
&timer1 {
|
||||
prescaler = <4>;
|
||||
};
|
||||
|
||||
&timer2 {
|
||||
prescaler = <4>;
|
||||
};
|
|
@ -0,0 +1,19 @@
|
|||
&timer0 {
|
||||
prescaler = <4>;
|
||||
};
|
||||
|
||||
&timer1 {
|
||||
prescaler = <4>;
|
||||
};
|
||||
|
||||
&timer2 {
|
||||
prescaler = <4>;
|
||||
};
|
||||
|
||||
&timer3 {
|
||||
prescaler = <4>;
|
||||
};
|
||||
|
||||
&timer4 {
|
||||
prescaler = <4>;
|
||||
};
|
|
@ -0,0 +1,19 @@
|
|||
&timer0 {
|
||||
prescaler = <4>;
|
||||
};
|
||||
|
||||
&timer1 {
|
||||
prescaler = <4>;
|
||||
};
|
||||
|
||||
&timer2 {
|
||||
prescaler = <4>;
|
||||
};
|
||||
|
||||
&timer3 {
|
||||
prescaler = <4>;
|
||||
};
|
||||
|
||||
&timer4 {
|
||||
prescaler = <4>;
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue