• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2021 The ChromiumOS Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 use zerocopy::AsBytes;
6 use zerocopy::FromBytes;
7 
8 #[repr(C, packed)]
9 #[derive(Clone, Copy, Default, FromBytes, AsBytes)]
10 pub struct FACS {
11     pub signature: [u8; 4],
12     pub length: u32,
13     pub hardware_signature: u32,
14     pub waking: u32,
15     pub lock: u32,
16     pub flags: u32,
17     pub x_waking: u64,
18     pub version: u8,
19     pub _reserved1: [u8; 3],
20     pub ospm_flags: u32,
21     pub _reserved2: [u8; 24],
22 }
23 
24 impl FACS {
new() -> Self25     pub fn new() -> Self {
26         FACS {
27             signature: *b"FACS",
28             length: std::mem::size_of::<FACS>() as u32,
29             hardware_signature: 0,
30             waking: 0,
31             lock: 0,
32             flags: 0,
33             x_waking: 0,
34             version: 1,
35             _reserved1: [0; 3],
36             ospm_flags: 0,
37             _reserved2: [0; 24],
38         }
39     }
40 
len() -> usize41     pub fn len() -> usize {
42         std::mem::size_of::<FACS>()
43     }
44 }
45