Lines Matching full:bindings
10 bindings,
46 impl From<bindings::pwm_waveform> for Waveform {
47 fn from(wf: bindings::pwm_waveform) -> Self {
56 impl From<Waveform> for bindings::pwm_waveform {
58 bindings::pwm_waveform {
78 pub struct Device(Opaque<bindings::pwm_device>);
87 pub(crate) unsafe fn from_raw<'a>(ptr: *mut bindings::pwm_device) -> &'a Self {
94 fn as_raw(&self) -> *mut bindings::pwm_device {
127 let c_wf = bindings::pwm_waveform::from(*wf);
132 to_result(unsafe { bindings::pwm_set_waveform_might_sleep(self.as_raw(), &c_wf, exact) })
138 let mut c_wf = bindings::pwm_waveform::from(*wf);
143 let ret = unsafe { bindings::pwm_round_waveform_might_sleep(self.as_raw(), &mut c_wf) };
158 let mut c_wf = bindings::pwm_waveform::default();
162 to_result(unsafe { bindings::pwm_get_waveform_might_sleep(self.as_raw(), &mut c_wf) })?;
193 _result: &mut bindings::pwm_capture,
255 build_assert!(size <= bindings::PWM_WFHWSIZE as usize);
275 build_assert!(size <= bindings::PWM_WFHWSIZE as usize);
292 /// `dev` must be a valid pointer to a `bindings::device` embedded within a
293 /// `bindings::pwm_chip`. This function is called by the device core when the
295 unsafe extern "C" fn release_callback(dev: *mut bindings::device) {
299 let c_chip_ptr = unsafe { container_of!(dev, bindings::pwm_chip, dev) };
303 let drvdata_ptr = unsafe { bindings::pwmchip_get_drvdata(c_chip_ptr) };
311 unsafe { bindings::pwmchip_release(dev) };
318 chip_ptr: *mut bindings::pwm_chip,
319 pwm_ptr: *mut bindings::pwm_device,
336 chip_ptr: *mut bindings::pwm_chip,
337 pwm_ptr: *mut bindings::pwm_device,
338 res: *mut bindings::pwm_capture,
363 chip_ptr: *mut bindings::pwm_chip,
364 pwm_ptr: *mut bindings::pwm_device,
365 wf_ptr: *const bindings::pwm_waveform,
393 chip_ptr: *mut bindings::pwm_chip,
394 pwm_ptr: *mut bindings::pwm_device,
396 wf_ptr: *mut bindings::pwm_waveform,
422 chip_ptr: *mut bindings::pwm_chip,
423 pwm_ptr: *mut bindings::pwm_device,
446 chip_ptr: *mut bindings::pwm_chip,
447 pwm_ptr: *mut bindings::pwm_device,
472 pub struct PwmOpsVTable(bindings::pwm_ops);
487 pub(crate) fn as_raw(&self) -> *const bindings::pwm_ops {
499 let mut ops: bindings::pwm_ops = unsafe { core::mem::zeroed() };
515 pub struct Chip<T: PwmOps>(Opaque<bindings::pwm_chip>, PhantomData<T>);
524 pub(crate) unsafe fn from_raw<'a>(ptr: *mut bindings::pwm_chip) -> &'a Self {
531 pub(crate) fn as_raw(&self) -> *mut bindings::pwm_chip {
550 // - `self.as_raw()` provides a valid pointer to `bindings::pwm_chip`.
551 // - The `dev` field is an instance of `bindings::device` embedded
563 unsafe { &*bindings::pwmchip_get_drvdata(self.as_raw()).cast::<T>() }
581 /// Allocates and wraps a PWM chip using `bindings::pwmchip_alloc`.
594 unsafe { bindings::pwmchip_alloc(parent_dev.as_raw(), num_channels, sizeof_priv) };
596 let c_chip_ptr: *mut bindings::pwm_chip = error::from_err_ptr(c_chip_ptr_raw)?;
600 let drvdata_ptr = unsafe { bindings::pwmchip_get_drvdata(c_chip_ptr) };
606 unsafe { bindings::pwmchip_put(c_chip_ptr) }
617 // Cast the `*mut bindings::pwm_chip` to `*mut Chip`. This is valid because
618 // `Chip` is `repr(transparent)` over `Opaque<bindings::pwm_chip>`, and
623 // `bindings::pwm_chip`) whose embedded device has refcount 1.
637 unsafe { bindings::get_device(&raw mut (*self.0.get()).dev) };
642 let c_chip_ptr = obj.cast::<bindings::pwm_chip>().as_ptr();
644 // SAFETY: `obj` is a valid pointer to a `Chip` (and thus `bindings::pwm_chip`)
646 unsafe { bindings::put_device(&raw mut (*c_chip_ptr).dev) };
650 // SAFETY: `Chip` is a wrapper around `*mut bindings::pwm_chip`. The underlying C
680 to_result(unsafe { bindings::__pwmchip_add(c_chip_ptr, core::ptr::null_mut()) })?;
714 // `bindings::pwmchip_remove` is the correct C function to unregister it.
716 unsafe { bindings::pwmchip_remove(chip_raw) };