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 use zerocopy::FromZeroes; 8 9 #[repr(C, packed)] 10 #[derive(Clone, Copy, Default, FromZeroes, FromBytes, AsBytes)] 11 pub struct FACS { 12 pub signature: [u8; 4], 13 pub length: u32, 14 pub hardware_signature: u32, 15 pub waking: u32, 16 pub lock: u32, 17 pub flags: u32, 18 pub x_waking: u64, 19 pub version: u8, 20 pub _reserved1: [u8; 3], 21 pub ospm_flags: u32, 22 pub _reserved2: [u8; 24], 23 } 24 25 impl FACS { new() -> Self26 pub fn new() -> Self { 27 FACS { 28 signature: *b"FACS", 29 length: std::mem::size_of::<FACS>() as u32, 30 hardware_signature: 0, 31 waking: 0, 32 lock: 0, 33 flags: 0, 34 x_waking: 0, 35 version: 1, 36 _reserved1: [0; 3], 37 ospm_flags: 0, 38 _reserved2: [0; 24], 39 } 40 } 41 len() -> usize42 pub fn len() -> usize { 43 std::mem::size_of::<FACS>() 44 } 45 } 46