88#include <zephyr/drivers/hwinfo.h>
99#include <string.h>
1010#include <zephyr/sys/byteorder.h>
11- #if defined(CONFIG_BOARD_QEMU_CORTEX_M0 ) || \
12- (defined(CONFIG_NRF_PLATFORM_HALTIUM ) && \
13- defined(CONFIG_RISCV_CORE_NORDIC_VPR ))
14- #define RESET_CAUSE_AVAILABLE 0
15- #else
11+ #if !defined(CONFIG_SOC_SERIES_NRF54HX ) && !defined(CONFIG_BOARD_QEMU_CORTEX_M0 )
1612#include <helpers/nrfx_reset_reason.h>
17- #define RESET_CAUSE_AVAILABLE 1
1813#endif
1914
2015#if defined(CONFIG_TRUSTED_EXECUTION_NONSECURE ) && defined(NRF_FICR_S )
@@ -68,30 +63,7 @@ ssize_t z_impl_hwinfo_get_device_id(uint8_t *buffer, size_t length)
6863 return length ;
6964}
7065
71- #if RESET_CAUSE_AVAILABLE
72-
73- #if defined(NRF_RESETINFO )
74-
75- #define REASON_LOCKUP (NRFX_RESET_REASON_LOCKUP | NRFX_RESET_REASON_LOCAL_LOCKUP_MASK)
76- #define REASON_SOFTWARE (NRFX_RESET_REASON_SREQ | NRFX_RESET_REASON_LOCAL_SREQ_MASK)
77- #define REASON_WATCHDOG \
78- (NRFX_RESET_REASON_DOG_MASK | \
79- NRFX_RESET_REASON_LOCAL_DOG1_MASK | \
80- NRFX_RESET_REASON_LOCAL_DOG0_MASK)
81-
82- #else /* NRF_RESETINFO */
83-
84- #define REASON_LOCKUP NRFX_RESET_REASON_LOCKUP_MASK
85- #define REASON_SOFTWARE NRFX_RESET_REASON_SREQ_MASK
86-
87- #if NRF_POWER_HAS_RESETREAS
88- #define REASON_WATCHDOG NRFX_RESET_REASON_DOG_MASK
89- #else
90- #define REASON_WATCHDOG NRFX_RESET_REASON_DOG1_MASK
91- #endif /* NRF_POWER_HAS_RESETREAS */
92-
93- #endif /* NRF_RESETINFO */
94-
66+ #if !defined(CONFIG_SOC_SERIES_NRF54HX ) && !defined(CONFIG_BOARD_QEMU_CORTEX_M0 )
9567int z_impl_hwinfo_get_reset_cause (uint32_t * cause )
9668{
9769 uint32_t flags = 0 ;
@@ -101,21 +73,19 @@ int z_impl_hwinfo_get_reset_cause(uint32_t *cause)
10173 if (reason & NRFX_RESET_REASON_RESETPIN_MASK ) {
10274 flags |= RESET_PIN ;
10375 }
104- if (reason & REASON_WATCHDOG ) {
76+ if (reason & NRFX_RESET_REASON_DOG_MASK ) {
10577 flags |= RESET_WATCHDOG ;
10678 }
107-
108- if (reason & REASON_LOCKUP ) {
79+ if (reason & NRFX_RESET_REASON_LOCKUP_MASK ) {
10980 flags |= RESET_CPU_LOCKUP ;
11081 }
111-
11282 if (reason & NRFX_RESET_REASON_OFF_MASK ) {
11383 flags |= RESET_LOW_POWER_WAKE ;
11484 }
11585 if (reason & NRFX_RESET_REASON_DIF_MASK ) {
11686 flags |= RESET_DEBUG ;
11787 }
118- if (reason & REASON_SOFTWARE ) {
88+ if (reason & NRFX_RESET_REASON_SREQ_MASK ) {
11989 flags |= RESET_SOFTWARE ;
12090 }
12191
@@ -154,7 +124,11 @@ int z_impl_hwinfo_get_reset_cause(uint32_t *cause)
154124 flags |= RESET_DEBUG ;
155125 }
156126#endif
157-
127+ #if !NRF_POWER_HAS_RESETREAS
128+ if (reason & NRFX_RESET_REASON_DOG1_MASK ) {
129+ flags |= RESET_WATCHDOG ;
130+ }
131+ #endif
158132#if NRFX_RESET_REASON_HAS_GRTC
159133 if (reason & NRFX_RESET_REASON_GRTC_MASK ) {
160134 flags |= RESET_CLOCK ;
@@ -210,4 +184,4 @@ int z_impl_hwinfo_get_supported_reset_cause(uint32_t *supported)
210184
211185 return 0 ;
212186}
213- #endif /* RESET_CAUSE_AVAILABLE */
187+ #endif
0 commit comments