rockchip_pm/variants/
_macros.rs1#[macro_export(local_inner_macros)]
2macro_rules! map {
3 () => {
5 {
6 ::alloc::collections::BTreeMap::new()
7 }
8 };
9 ( $( $key:expr => $value:expr ),+ $(,)? ) => {{
11 let mut map = ::alloc::collections::BTreeMap::new();
12 $( map.insert($key.into(), $value); )*
13 map
14 }};
15}
16
17macro_rules! define_power_domains {
19 (
20 $(
21 $(#[$meta:meta])*
22 $name:ident = $id:expr
23 ),* $(,)?
24 ) => {
25 $(
26 $(#[$meta])*
27 pub const $name: PowerDomain = PowerDomain($id);
28 )*
29 };
30}
31
32
33
34macro_rules! bit {
35 ($n:expr) => {
36 (1 << $n)
37 };
38 () => {};
39}
40
41use super::RockchipDomainInfo;
43
44#[allow(clippy::too_many_arguments)]
45pub fn domain_m_o_r(
46 name: &'static str,
47 pwr_offset: u32,
48 pwr: i32,
49 status: i32,
50 mem_offset: u32,
51 mem_status: i32,
52 repair_status: i32,
53 req_offset: u32,
54 req: i32,
55 idle: i32,
56 ack: i32,
57 wakeup: bool,
58 keepon: bool,
59) -> RockchipDomainInfo {
60 RockchipDomainInfo {
61 name,
62 pwr_offset,
63 pwr_w_mask: (pwr << 16),
64 pwr_mask: pwr,
65 status_mask: status,
66 mem_offset,
67 mem_status_mask: mem_status,
68 repair_status_mask: repair_status,
69 req_offset,
70 req_w_mask: (req << 16),
71 req_mask: req,
72 idle_mask: idle,
73 ack_mask: ack,
74 active_wakeup: wakeup,
75 keepon_startup: keepon,
76 ..Default::default()
77 }
78}