Skip to main content

fidl_data_zbi/
reboot.rs

1// Copyright 2022 The Fuchsia Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5// DO NOT EDIT.
6// Generated from FIDL library `zbi` by zither, a Fuchsia platform tool.
7
8#![allow(unused_imports)]
9
10use zerocopy::IntoBytes;
11
12/// ZBI_TYPE_HW_REBOOT_REASON payload.
13#[repr(u32)]
14#[derive(Clone, Copy, Debug, Eq, IntoBytes, PartialEq)]
15pub enum HwRebootReason {
16    Undefined = 0,
17    Cold = 1,
18    Warm = 2,
19    Brownout = 3,
20    Watchdog = 4,
21    UserHardReset = 5,
22}
23
24impl HwRebootReason {
25    pub fn from_raw(raw: u32) -> Option<Self> {
26        match raw {
27            0 => Some(Self::Undefined),
28
29            1 => Some(Self::Cold),
30
31            2 => Some(Self::Warm),
32
33            3 => Some(Self::Brownout),
34
35            4 => Some(Self::Watchdog),
36
37            5 => Some(Self::UserHardReset),
38
39            _ => None,
40        }
41    }
42}