Lines Matching full:firmware

3 //! Firmware abstraction
5 //! C header: [`include/linux/firmware.h`](srctree/include/linux/firmware.h)
15 unsafe extern "C" fn(*mut *const bindings::firmware, *const u8, *mut bindings::device) -> i32,
28 /// Abstraction around a C `struct firmware`.
30 /// This is a simple abstraction around the C firmware API. Just like with the C API, firmware can
31 /// be requested. Once requested the abstraction provides direct access to the firmware buffer as
32 /// `&[u8]`. The firmware is released once [`Firmware`] is dropped.
36 /// The pointer is valid, and has ownership over the instance of `struct firmware`.
38 /// The `Firmware`'s backing buffer is not modified.
43 /// # use kernel::{c_str, device::Device, firmware::Firmware};
49 /// let fw = Firmware::request(c_str!("path/to/firmware.bin"), &dev)?;
55 pub struct Firmware(NonNull<bindings::firmware>); struct
57 impl Firmware { impl
59 let mut fw: *mut bindings::firmware = core::ptr::null_mut(); in request_internal()
60 let pfw: *mut *mut bindings::firmware = &mut fw; in request_internal()
62 // SAFETY: `pfw` is a valid pointer to a NULL initialized `bindings::firmware` pointer. in request_internal()
70 // valid pointer to `bindings::firmware`. in request_internal()
71 Ok(Firmware(unsafe { NonNull::new_unchecked(fw) })) in request_internal()
74 /// Send a firmware request and wait for it. See also `bindings::request_firmware`.
79 /// Send a request for an optional firmware module. See also
85 fn as_raw(&self) -> *mut bindings::firmware { in as_raw() argument
89 /// Returns the size of the requested firmware in bytes.
95 /// Returns the requested firmware as `&[u8]`.
98 // `bindings::firmware` guarantees, if successfully requested, that in data()
99 // `bindings::firmware::data` has a size of `bindings::firmware::size` bytes. in data()
104 impl Drop for Firmware { implementation
111 // SAFETY: `Firmware` only holds a pointer to a C `struct firmware`, which is safe to be used from
113 unsafe impl Send for Firmware {} implementation
115 // SAFETY: `Firmware` only holds a pointer to a C `struct firmware`, references to which are safe to
117 unsafe impl Sync for Firmware {} implementation