File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77
88use core:: sync:: atomic:: { AtomicU32 , Ordering } ;
99use core:: { mem, ptr, slice} ;
10+ use core:: fmt;
1011
1112use kernel:: {
1213 bindings, c_str, device,
@@ -23,6 +24,24 @@ use kernel::{
2324
2425use pin_init:: Zeroable ;
2526
27+ /// An unaligned u32 type.
28+ ///
29+ /// This is useful to avoid having to pack firmware structures entirely, since that is incompatible
30+ /// with `#[derive(Debug)]` and atomics.
31+ #[ derive( Copy , Clone , Default ) ]
32+ #[ repr( C , packed( 1 ) ) ]
33+ pub ( crate ) struct U32 ( pub ( crate ) u32 ) ;
34+
35+ // SAFETY: U32 is zeroable just like u32
36+ unsafe impl Zeroable for U32 { }
37+
38+ impl fmt:: Debug for U32 {
39+ fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
40+ let v = self . 0 ;
41+ f. write_fmt ( format_args ! ( "{:#x}" , v) )
42+ }
43+ }
44+
2645const EPIC_SUBTYPE_WRAPPED_CALL : u16 = 0x20 ;
2746const CALLTYPE_AUDIO_ATTACH_DEVICE : u32 = 0xc3000002 ;
2847const CALLTYPE_AUDIO_SET_PROP : u32 = 0xc3000005 ;
You can’t perform that action at this time.
0 commit comments