rockchip_pm/variants/
_macros.rs1#[macro_export(local_inner_macros)]
3macro_rules! map {
4 () => {
6 {
7 ::alloc::collections::BTreeMap::new()
8 }
9 };
10 ( $( $key:expr => $value:expr ),+ $(,)? ) => {{
12 let mut map = ::alloc::collections::BTreeMap::new();
13 $( map.insert($key.into(), $value); )*
14 map
15 }};
16}
17
18macro_rules! define_power_domains {
20 (
21 $(
22 $(#[$meta:meta])*
23 $name:ident = $id:expr
24 ),* $(,)?
25 ) => {
26 $(
27 $(#[$meta])*
28 pub const $name: PowerDomain = PowerDomain($id);
29 )*
30 };
31}
32
33macro_rules! bit {
35 ($n:expr) => {
36 (1 << $n)
37 };
38 () => {};
39}
40
41use super::RockchipDomainInfo;
43
44#[allow(clippy::too_many_arguments)]
62pub fn domain_m_o_r(
63 name: &'static str,
64 pwr_offset: u32,
65 pwr: i32,
66 status: i32,
67 mem_offset: u32,
68 mem_status: i32,
69 repair_status: i32,
70 req_offset: u32,
71 req: i32,
72 idle: i32,
73 ack: i32,
74 wakeup: bool,
75 keepon: bool,
76) -> RockchipDomainInfo {
77 RockchipDomainInfo {
78 name,
79 pwr_offset,
80 pwr_w_mask: (pwr << 16),
81 pwr_mask: pwr,
82 status_mask: status,
83 mem_offset,
84 mem_status_mask: mem_status,
85 repair_status_mask: repair_status,
86 req_offset,
87 req_w_mask: (req << 16),
88 req_mask: req,
89 idle_mask: idle,
90 ack_mask: ack,
91 active_wakeup: wakeup,
92 keepon_startup: keepon,
93 ..Default::default()
94 }
95}