| * Copyright (c) 2023 Jerzy Kasenberg. |
| * SPDX-License-Identifier: Apache-2.0 |
| #include <zephyr/device.h> |
| #include <zephyr/drivers/hwinfo.h> |
| int z_impl_hwinfo_get_reset_cause(uint32_t *cause) |
| uint32_t reason = CRG_TOP->RESET_STAT_REG; |
| * When POR is detected other bits are not valid. |
| if (reason & CRG_TOP_RESET_STAT_REG_PORESET_STAT_Msk) { |
| if (reason & CRG_TOP_RESET_STAT_REG_HWRESET_STAT_Msk) { |
| if (reason & CRG_TOP_RESET_STAT_REG_SWRESET_STAT_Msk) { |
| if (reason & CRG_TOP_RESET_STAT_REG_WDOGRESET_STAT_Msk) { |
| if (reason & CRG_TOP_RESET_STAT_REG_CMAC_WDOGRESET_STAT_Msk) { |
| if (reason & CRG_TOP_RESET_STAT_REG_SWD_HWRESET_STAT_Msk) { |
| int z_impl_hwinfo_clear_reset_cause(void) |
| CRG_TOP->RESET_STAT_REG = 0; |
| int z_impl_hwinfo_get_supported_reset_cause(uint32_t *supported) |