diff options
author | Takashi Sakamoto <o-takashi@sakamocchi.jp> | 2021-08-29 21:49:38 +0900 |
---|---|---|
committer | Takashi Sakamoto <o-takashi@sakamocchi.jp> | 2021-08-29 21:50:39 +0900 |
commit | 6865cfd30ef785038e44985669fdc81fde56ee0f (patch) | |
tree | 782282905bf9ac9d05f3e74e118efe4d2fcc7fc4 | |
parent | c5e1e3165817499979ba899f167542eef6f7fd36 (diff) | |
download | hinawa-rs-6865cfd30ef785038e44985669fdc81fde56ee0f.tar.gz |
hinawa-sys/hinawa: regenerate cratev0.4.0
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
-rw-r--r-- | hinawa-sys/src/lib.rs | 1 | ||||
-rw-r--r-- | hinawa/src/auto/fw_fcp.rs | 3 | ||||
-rw-r--r-- | hinawa/src/auto/fw_req.rs | 3 | ||||
-rw-r--r-- | hinawa/src/auto/fw_resp.rs | 62 |
4 files changed, 69 insertions, 0 deletions
diff --git a/hinawa-sys/src/lib.rs b/hinawa-sys/src/lib.rs index 0b63dd6..302dd19 100644 --- a/hinawa-sys/src/lib.rs +++ b/hinawa-sys/src/lib.rs @@ -569,6 +569,7 @@ extern "C" { pub fn hinawa_fw_resp_get_req_frame(self_: *mut HinawaFwResp, frame: *mut *const u8, length: *mut size_t); pub fn hinawa_fw_resp_release(self_: *mut HinawaFwResp); pub fn hinawa_fw_resp_reserve(self_: *mut HinawaFwResp, node: *mut HinawaFwNode, addr: u64, width: c_uint, error: *mut *mut glib::GError); + pub fn hinawa_fw_resp_reserve_within_region(self_: *mut HinawaFwResp, node: *mut HinawaFwNode, region_start: u64, region_end: u64, width: c_uint, error: *mut *mut glib::GError); pub fn hinawa_fw_resp_set_resp_frame(self_: *mut HinawaFwResp, frame: *mut u8, length: size_t); //========================================================================= diff --git a/hinawa/src/auto/fw_fcp.rs b/hinawa/src/auto/fw_fcp.rs index e5a2dc0..f0525e6 100644 --- a/hinawa/src/auto/fw_fcp.rs +++ b/hinawa/src/auto/fw_fcp.rs @@ -53,12 +53,15 @@ pub trait FwFcpExt: 'static { fn get_property_is_bound(&self) -> bool; + #[deprecated] fn get_property_timeout(&self) -> u32; + #[deprecated] fn set_property_timeout(&self, timeout: u32); fn connect_property_is_bound_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; + #[deprecated] fn connect_property_timeout_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; } diff --git a/hinawa/src/auto/fw_req.rs b/hinawa/src/auto/fw_req.rs index 499c005..1e73e83 100644 --- a/hinawa/src/auto/fw_req.rs +++ b/hinawa/src/auto/fw_req.rs @@ -41,10 +41,13 @@ impl Default for FwReq { pub const NONE_FW_REQ: Option<&FwReq> = None; pub trait FwReqExt: 'static { + #[deprecated] fn get_property_timeout(&self) -> u32; + #[deprecated] fn set_property_timeout(&self, timeout: u32); + #[deprecated] fn connect_property_timeout_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; } diff --git a/hinawa/src/auto/fw_resp.rs b/hinawa/src/auto/fw_resp.rs index 4ca5003..ca98b84 100644 --- a/hinawa/src/auto/fw_resp.rs +++ b/hinawa/src/auto/fw_resp.rs @@ -50,14 +50,24 @@ pub trait FwRespExt: 'static { fn reserve<P: IsA<FwNode>>(&self, node: &P, addr: u64, width: u32) -> Result<(), glib::Error>; + fn reserve_within_region<P: IsA<FwNode>>(&self, node: &P, region_start: u64, region_end: u64, width: u32) -> Result<(), glib::Error>; + fn set_resp_frame(&self, frame: &[u8]); fn get_property_is_reserved(&self) -> bool; + fn get_property_offset(&self) -> u64; + + fn get_property_width(&self) -> u32; + #[deprecated] fn connect_requested<F: Fn(&Self, FwTcode) -> FwRcode + 'static>(&self, f: F) -> SignalHandlerId; fn connect_property_is_reserved_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; + + fn connect_property_offset_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; + + fn connect_property_width_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; } impl<O: IsA<FwResp>> FwRespExt for O { @@ -75,6 +85,14 @@ impl<O: IsA<FwResp>> FwRespExt for O { } } + fn reserve_within_region<P: IsA<FwNode>>(&self, node: &P, region_start: u64, region_end: u64, width: u32) -> Result<(), glib::Error> { + unsafe { + let mut error = ptr::null_mut(); + let _ = hinawa_sys::hinawa_fw_resp_reserve_within_region(self.as_ref().to_glib_none().0, node.as_ref().to_glib_none().0, region_start, region_end, width, &mut error); + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + } + } + fn set_resp_frame(&self, frame: &[u8]) { let length = frame.len() as usize; unsafe { @@ -90,6 +108,22 @@ impl<O: IsA<FwResp>> FwRespExt for O { } } + fn get_property_offset(&self) -> u64 { + unsafe { + let mut value = Value::from_type(<u64 as StaticType>::static_type()); + gobject_sys::g_object_get_property(self.to_glib_none().0 as *mut gobject_sys::GObject, b"offset\0".as_ptr() as *const _, value.to_glib_none_mut().0); + value.get().expect("Return Value for property `offset` getter").unwrap() + } + } + + fn get_property_width(&self) -> u32 { + unsafe { + let mut value = Value::from_type(<u32 as StaticType>::static_type()); + gobject_sys::g_object_get_property(self.to_glib_none().0 as *mut gobject_sys::GObject, b"width\0".as_ptr() as *const _, value.to_glib_none_mut().0); + value.get().expect("Return Value for property `width` getter").unwrap() + } + } + fn connect_requested<F: Fn(&Self, FwTcode) -> FwRcode + 'static>(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn requested_trampoline<P, F: Fn(&P, FwTcode) -> FwRcode + 'static>(this: *mut hinawa_sys::HinawaFwResp, tcode: hinawa_sys::HinawaFwTcode, f: glib_sys::gpointer) -> hinawa_sys::HinawaFwRcode where P: IsA<FwResp> @@ -117,6 +151,34 @@ impl<O: IsA<FwResp>> FwRespExt for O { Some(transmute::<_, unsafe extern "C" fn()>(notify_is_reserved_trampoline::<Self, F> as *const ())), Box_::into_raw(f)) } } + + fn connect_property_offset_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn notify_offset_trampoline<P, F: Fn(&P) + 'static>(this: *mut hinawa_sys::HinawaFwResp, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) + where P: IsA<FwResp> + { + let f: &F = &*(f as *const F); + f(&FwResp::from_glib_borrow(this).unsafe_cast_ref()) + } + unsafe { + let f: Box_<F> = Box_::new(f); + connect_raw(self.as_ptr() as *mut _, b"notify::offset\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>(notify_offset_trampoline::<Self, F> as *const ())), Box_::into_raw(f)) + } + } + + fn connect_property_width_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn notify_width_trampoline<P, F: Fn(&P) + 'static>(this: *mut hinawa_sys::HinawaFwResp, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer) + where P: IsA<FwResp> + { + let f: &F = &*(f as *const F); + f(&FwResp::from_glib_borrow(this).unsafe_cast_ref()) + } + unsafe { + let f: Box_<F> = Box_::new(f); + connect_raw(self.as_ptr() as *mut _, b"notify::width\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>(notify_width_trampoline::<Self, F> as *const ())), Box_::into_raw(f)) + } + } } impl fmt::Display for FwResp { |