88#include <zephyr/drivers/hwinfo.h>
99#include <string.h>
1010#include <zephyr/sys/byteorder.h>
11- #if !defined(CONFIG_SOC_SERIES_NRF54HX ) && !defined( CONFIG_BOARD_QEMU_CORTEX_M0 )
11+ #if !defined(CONFIG_BOARD_QEMU_CORTEX_M0 )
1212#include <helpers/nrfx_reset_reason.h>
1313#endif
1414
@@ -63,7 +63,7 @@ ssize_t z_impl_hwinfo_get_device_id(uint8_t *buffer, size_t length)
6363 return length ;
6464}
6565
66- #if !defined(CONFIG_SOC_SERIES_NRF54HX ) && !defined( CONFIG_BOARD_QEMU_CORTEX_M0 )
66+ #if !defined(CONFIG_BOARD_QEMU_CORTEX_M0 )
6767int z_impl_hwinfo_get_reset_cause (uint32_t * cause )
6868{
6969 uint32_t flags = 0 ;
@@ -76,16 +76,37 @@ int z_impl_hwinfo_get_reset_cause(uint32_t *cause)
7676 if (reason & NRFX_RESET_REASON_DOG_MASK ) {
7777 flags |= RESET_WATCHDOG ;
7878 }
79- if (reason & NRFX_RESET_REASON_LOCKUP_MASK ) {
79+
80+ #if defined(NRF_RESETINFO )
81+ if (reason & NRFX_RESET_REASON_LOCAL_DOG0_MASK ) {
82+ flags |= RESET_WATCHDOG ;
83+ }
84+ #endif
85+
86+ #if defined(NRF_RESETINFO )
87+ if ((reason & NRFX_RESET_REASON_LOCKUP )
88+ || (reason & NRFX_RESET_REASON_LOCAL_LOCKUP_MASK ))
89+ #else
90+ if (reason & NRFX_RESET_REASON_LOCKUP_MASK )
91+ #endif
92+ {
8093 flags |= RESET_CPU_LOCKUP ;
8194 }
95+
8296 if (reason & NRFX_RESET_REASON_OFF_MASK ) {
8397 flags |= RESET_LOW_POWER_WAKE ;
8498 }
8599 if (reason & NRFX_RESET_REASON_DIF_MASK ) {
86100 flags |= RESET_DEBUG ;
87101 }
88- if (reason & NRFX_RESET_REASON_SREQ_MASK ) {
102+
103+ #if defined(NRF_RESETINFO )
104+ if ((reason & NRFX_RESET_REASON_SREQ )
105+ || (reason & NRFX_RESET_REASON_LOCAL_SREQ_MASK ))
106+ #else
107+ if (reason & NRFX_RESET_REASON_SREQ_MASK )
108+ #endif
109+ {
89110 flags |= RESET_SOFTWARE ;
90111 }
91112
@@ -124,11 +145,18 @@ int z_impl_hwinfo_get_reset_cause(uint32_t *cause)
124145 flags |= RESET_DEBUG ;
125146 }
126147#endif
148+
127149#if !NRF_POWER_HAS_RESETREAS
128- if (reason & NRFX_RESET_REASON_DOG1_MASK ) {
150+ #if defined(NRF_RESETINFO )
151+ if (reason & NRFX_RESET_REASON_LOCAL_DOG1_MASK )
152+ #else
153+ if (reason & NRFX_RESET_REASON_DOG1_MASK )
154+ #endif
155+ {
129156 flags |= RESET_WATCHDOG ;
130157 }
131- #endif
158+ #endif /* !NRF_POWER_HAS_RESETREAS */
159+
132160#if NRFX_RESET_REASON_HAS_GRTC
133161 if (reason & NRFX_RESET_REASON_GRTC_MASK ) {
134162 flags |= RESET_CLOCK ;
0 commit comments