drivers: watchdog: nrfx wdt without IRQs
Add config option to build nrfx wdt driver with NRFX_WDT_CONFIG_NO_IRQ enabled. Signed-off-by: Lukasz Stepnicki <lukasz.stepnicki@nordicsemi.no>
This commit is contained in:
parent
e638602b6a
commit
83e3c2eb78
3 changed files with 22 additions and 6 deletions
|
@ -16,6 +16,11 @@ config WDT_NRFX
|
||||||
select NRFX_WDT130 if HAS_HW_NRF_WDT130
|
select NRFX_WDT130 if HAS_HW_NRF_WDT130
|
||||||
select NRFX_WDT131 if HAS_HW_NRF_WDT131
|
select NRFX_WDT131 if HAS_HW_NRF_WDT131
|
||||||
select NRFX_WDT132 if HAS_HW_NRF_WDT132
|
select NRFX_WDT132 if HAS_HW_NRF_WDT132
|
||||||
|
|
||||||
help
|
help
|
||||||
Enable support for nrfx WDT driver for nRF MCU series.
|
Enable support for nrfx WDT driver for nRF MCU series.
|
||||||
|
|
||||||
|
config WDT_NRFX_NO_IRQ
|
||||||
|
bool "nRF WDT nrfx driver without IRQ enabled"
|
||||||
|
depends on WDT_NRFX
|
||||||
|
help
|
||||||
|
Disable use of WDT interrupt in driver.
|
||||||
|
|
|
@ -114,7 +114,8 @@ static int wdt_nrf_install_timeout(const struct device *dev,
|
||||||
* the timeout) from range 0xF-0xFFFFFFFF given in 32768 Hz
|
* the timeout) from range 0xF-0xFFFFFFFF given in 32768 Hz
|
||||||
* clock ticks. This makes the allowed range of 0x1-0x07CFFFFF
|
* clock ticks. This makes the allowed range of 0x1-0x07CFFFFF
|
||||||
* in milliseconds. Check if the provided value is within
|
* in milliseconds. Check if the provided value is within
|
||||||
* this range. */
|
* this range.
|
||||||
|
*/
|
||||||
if ((cfg->window.max == 0U) || (cfg->window.max > 0x07CFFFFF)) {
|
if ((cfg->window.max == 0U) || (cfg->window.max > 0x07CFFFFF)) {
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
@ -186,23 +187,30 @@ static void wdt_event_handler(const struct device *dev, nrf_wdt_event_t event_ty
|
||||||
|
|
||||||
#define WDT(idx) DT_NODELABEL(wdt##idx)
|
#define WDT(idx) DT_NODELABEL(wdt##idx)
|
||||||
|
|
||||||
|
#define WDT_NRFX_WDT_IRQ(idx) \
|
||||||
|
COND_CODE_1(CONFIG_WDT_NRFX_NO_IRQ, \
|
||||||
|
(), \
|
||||||
|
(IRQ_CONNECT(DT_IRQN(WDT(idx)), DT_IRQ(WDT(idx), priority), \
|
||||||
|
nrfx_isr, nrfx_wdt_##idx##_irq_handler, 0)))
|
||||||
|
|
||||||
#define WDT_NRFX_WDT_DEVICE(idx) \
|
#define WDT_NRFX_WDT_DEVICE(idx) \
|
||||||
static void wdt_##idx##_event_handler(nrf_wdt_event_t event_type, \
|
static void wdt_##idx##_event_handler(nrf_wdt_event_t event_type, \
|
||||||
uint32_t requests, \
|
uint32_t requests, \
|
||||||
void *p_context) \
|
void *p_context) \
|
||||||
{ \
|
{ \
|
||||||
wdt_event_handler(DEVICE_DT_GET(WDT(idx)), event_type, \
|
wdt_event_handler(DEVICE_DT_GET(WDT(idx)), event_type, \
|
||||||
requests, p_context); \
|
requests, p_context); \
|
||||||
} \
|
} \
|
||||||
static int wdt_##idx##_init(const struct device *dev) \
|
static int wdt_##idx##_init(const struct device *dev) \
|
||||||
{ \
|
{ \
|
||||||
const struct wdt_nrfx_config *config = dev->config; \
|
const struct wdt_nrfx_config *config = dev->config; \
|
||||||
nrfx_err_t err_code; \
|
nrfx_err_t err_code; \
|
||||||
IRQ_CONNECT(DT_IRQN(WDT(idx)), DT_IRQ(WDT(idx), priority), \
|
WDT_NRFX_WDT_IRQ(idx); \
|
||||||
nrfx_isr, nrfx_wdt_##idx##_irq_handler, 0); \
|
|
||||||
err_code = nrfx_wdt_init(&config->wdt, \
|
err_code = nrfx_wdt_init(&config->wdt, \
|
||||||
NULL, \
|
NULL, \
|
||||||
wdt_##idx##_event_handler, \
|
IS_ENABLED(CONFIG_WDT_NRFX_NO_IRQ) \
|
||||||
|
? NULL \
|
||||||
|
: wdt_##idx##_event_handler, \
|
||||||
NULL); \
|
NULL); \
|
||||||
if (err_code != NRFX_SUCCESS) { \
|
if (err_code != NRFX_SUCCESS) { \
|
||||||
return -EBUSY; \
|
return -EBUSY; \
|
||||||
|
|
|
@ -835,6 +835,9 @@
|
||||||
#ifdef CONFIG_NRFX_WDT
|
#ifdef CONFIG_NRFX_WDT
|
||||||
#define NRFX_WDT_ENABLED 1
|
#define NRFX_WDT_ENABLED 1
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef CONFIG_WDT_NRFX_NO_IRQ
|
||||||
|
#define NRFX_WDT_CONFIG_NO_IRQ 1
|
||||||
|
#endif
|
||||||
#ifdef CONFIG_NRFX_WDT_LOG
|
#ifdef CONFIG_NRFX_WDT_LOG
|
||||||
#define NRFX_WDT_CONFIG_LOG_ENABLED 1
|
#define NRFX_WDT_CONFIG_LOG_ENABLED 1
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue