hinawa_sys/
lib.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from
3// from gir-files (https://github.com/gtk-rs/gir-files)
4// DO NOT EDIT
5
6#![doc = include_str!("../README.md")]
7#![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)]
8#![allow(
9    clippy::approx_constant,
10    clippy::type_complexity,
11    clippy::unreadable_literal,
12    clippy::upper_case_acronyms
13)]
14#![cfg_attr(docsrs, feature(doc_cfg))]
15
16use glib_sys as glib;
17use gobject_sys as gobject;
18
19#[cfg(unix)]
20#[allow(unused_imports)]
21use libc::{dev_t, gid_t, pid_t, socklen_t, uid_t};
22#[allow(unused_imports)]
23use libc::{intptr_t, off_t, size_t, ssize_t, time_t, uintptr_t, FILE};
24#[allow(unused_imports)]
25use std::ffi::{
26    c_char, c_double, c_float, c_int, c_long, c_short, c_uchar, c_uint, c_ulong, c_ushort, c_void,
27};
28
29#[allow(unused_imports)]
30use glib::{gboolean, gconstpointer, gpointer, GType};
31
32// Enums
33pub type HinawaFwFcpError = c_int;
34pub const HINAWA_FW_FCP_ERROR_TIMEOUT: HinawaFwFcpError = 0;
35pub const HINAWA_FW_FCP_ERROR_LARGE_RESP: HinawaFwFcpError = 1;
36pub const HINAWA_FW_FCP_ERROR_ABORTED: HinawaFwFcpError = 2;
37
38pub type HinawaFwNodeError = c_int;
39pub const HINAWA_FW_NODE_ERROR_DISCONNECTED: HinawaFwNodeError = 0;
40pub const HINAWA_FW_NODE_ERROR_OPENED: HinawaFwNodeError = 1;
41pub const HINAWA_FW_NODE_ERROR_NOT_OPENED: HinawaFwNodeError = 2;
42pub const HINAWA_FW_NODE_ERROR_FAILED: HinawaFwNodeError = 3;
43
44pub type HinawaFwRcode = c_int;
45pub const HINAWA_FW_RCODE_COMPLETE: HinawaFwRcode = 0;
46pub const HINAWA_FW_RCODE_CONFLICT_ERROR: HinawaFwRcode = 4;
47pub const HINAWA_FW_RCODE_DATA_ERROR: HinawaFwRcode = 5;
48pub const HINAWA_FW_RCODE_TYPE_ERROR: HinawaFwRcode = 6;
49pub const HINAWA_FW_RCODE_ADDRESS_ERROR: HinawaFwRcode = 7;
50pub const HINAWA_FW_RCODE_SEND_ERROR: HinawaFwRcode = 16;
51pub const HINAWA_FW_RCODE_CANCELLED: HinawaFwRcode = 17;
52pub const HINAWA_FW_RCODE_BUSY: HinawaFwRcode = 18;
53pub const HINAWA_FW_RCODE_GENERATION: HinawaFwRcode = 19;
54pub const HINAWA_FW_RCODE_NO_ACK: HinawaFwRcode = 20;
55pub const HINAWA_FW_RCODE_INVALID: HinawaFwRcode = 21;
56
57pub type HinawaFwReqError = c_int;
58pub const HINAWA_FW_REQ_ERROR_CONFLICT_ERROR: HinawaFwReqError = 4;
59pub const HINAWA_FW_REQ_ERROR_DATA_ERROR: HinawaFwReqError = 5;
60pub const HINAWA_FW_REQ_ERROR_TYPE_ERROR: HinawaFwReqError = 6;
61pub const HINAWA_FW_REQ_ERROR_ADDRESS_ERROR: HinawaFwReqError = 7;
62pub const HINAWA_FW_REQ_ERROR_SEND_ERROR: HinawaFwReqError = 16;
63pub const HINAWA_FW_REQ_ERROR_CANCELLED: HinawaFwReqError = 17;
64pub const HINAWA_FW_REQ_ERROR_BUSY: HinawaFwReqError = 18;
65pub const HINAWA_FW_REQ_ERROR_GENERATION: HinawaFwReqError = 19;
66pub const HINAWA_FW_REQ_ERROR_NO_ACK: HinawaFwReqError = 20;
67pub const HINAWA_FW_REQ_ERROR_INVALID: HinawaFwReqError = 21;
68
69pub type HinawaFwRespError = c_int;
70pub const HINAWA_FW_RESP_ERROR_FAILED: HinawaFwRespError = 0;
71pub const HINAWA_FW_RESP_ERROR_RESERVED: HinawaFwRespError = 1;
72pub const HINAWA_FW_RESP_ERROR_ADDR_SPACE_USED: HinawaFwRespError = 2;
73
74pub type HinawaFwTcode = c_int;
75pub const HINAWA_FW_TCODE_WRITE_QUADLET_REQUEST: HinawaFwTcode = 0;
76pub const HINAWA_FW_TCODE_WRITE_BLOCK_REQUEST: HinawaFwTcode = 1;
77pub const HINAWA_FW_TCODE_WRITE_RESPONSE: HinawaFwTcode = 2;
78pub const HINAWA_FW_TCODE_READ_QUADLET_REQUEST: HinawaFwTcode = 4;
79pub const HINAWA_FW_TCODE_READ_BLOCK_REQUEST: HinawaFwTcode = 5;
80pub const HINAWA_FW_TCODE_READ_QUADLET_RESPONSE: HinawaFwTcode = 6;
81pub const HINAWA_FW_TCODE_READ_BLOCK_RESPONSE: HinawaFwTcode = 7;
82pub const HINAWA_FW_TCODE_CYCLE_START: HinawaFwTcode = 8;
83pub const HINAWA_FW_TCODE_LOCK_REQUEST: HinawaFwTcode = 9;
84pub const HINAWA_FW_TCODE_STREAM_DATA: HinawaFwTcode = 10;
85pub const HINAWA_FW_TCODE_LOCK_RESPONSE: HinawaFwTcode = 11;
86pub const HINAWA_FW_TCODE_LOCK_MASK_SWAP: HinawaFwTcode = 17;
87pub const HINAWA_FW_TCODE_LOCK_COMPARE_SWAP: HinawaFwTcode = 18;
88pub const HINAWA_FW_TCODE_LOCK_FETCH_ADD: HinawaFwTcode = 19;
89pub const HINAWA_FW_TCODE_LOCK_LITTLE_ADD: HinawaFwTcode = 20;
90pub const HINAWA_FW_TCODE_LOCK_BOUNDED_ADD: HinawaFwTcode = 21;
91pub const HINAWA_FW_TCODE_LOCK_WRAP_ADD: HinawaFwTcode = 22;
92pub const HINAWA_FW_TCODE_LOCK_VENDOR_DEPENDENT: HinawaFwTcode = 23;
93
94// Records
95#[repr(C)]
96#[allow(dead_code)]
97pub struct HinawaCycleTime {
98    _data: [u8; 0],
99    _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>,
100}
101
102impl ::std::fmt::Debug for HinawaCycleTime {
103    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
104        f.debug_struct(&format!("HinawaCycleTime @ {self:p}"))
105            .finish()
106    }
107}
108
109#[derive(Copy, Clone)]
110#[repr(C)]
111pub struct HinawaFwFcpClass {
112    pub parent_class: HinawaFwRespClass,
113    pub responded:
114        Option<unsafe extern "C" fn(*mut HinawaFwFcp, c_uint, c_uint, *const u8, c_uint)>,
115}
116
117impl ::std::fmt::Debug for HinawaFwFcpClass {
118    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
119        f.debug_struct(&format!("HinawaFwFcpClass @ {self:p}"))
120            .field("parent_class", &self.parent_class)
121            .field("responded", &self.responded)
122            .finish()
123    }
124}
125
126#[derive(Copy, Clone)]
127#[repr(C)]
128pub struct HinawaFwNodeClass {
129    pub parent_class: gobject::GObjectClass,
130    pub bus_update: Option<unsafe extern "C" fn(*mut HinawaFwNode)>,
131    pub disconnected: Option<unsafe extern "C" fn(*mut HinawaFwNode)>,
132}
133
134impl ::std::fmt::Debug for HinawaFwNodeClass {
135    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
136        f.debug_struct(&format!("HinawaFwNodeClass @ {self:p}"))
137            .field("parent_class", &self.parent_class)
138            .field("bus_update", &self.bus_update)
139            .field("disconnected", &self.disconnected)
140            .finish()
141    }
142}
143
144#[derive(Copy, Clone)]
145#[repr(C)]
146pub struct HinawaFwReqClass {
147    pub parent_class: gobject::GObjectClass,
148    pub responded: Option<
149        unsafe extern "C" fn(*mut HinawaFwReq, HinawaFwRcode, c_uint, c_uint, *const u8, c_uint),
150    >,
151}
152
153impl ::std::fmt::Debug for HinawaFwReqClass {
154    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
155        f.debug_struct(&format!("HinawaFwReqClass @ {self:p}"))
156            .field("parent_class", &self.parent_class)
157            .field("responded", &self.responded)
158            .finish()
159    }
160}
161
162#[derive(Copy, Clone)]
163#[repr(C)]
164pub struct HinawaFwRespClass {
165    pub parent_class: gobject::GObjectClass,
166    pub requested: Option<
167        unsafe extern "C" fn(
168            *mut HinawaFwResp,
169            HinawaFwTcode,
170            u64,
171            c_uint,
172            c_uint,
173            c_uint,
174            c_uint,
175            c_uint,
176            *const u8,
177            c_uint,
178        ) -> HinawaFwRcode,
179    >,
180}
181
182impl ::std::fmt::Debug for HinawaFwRespClass {
183    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
184        f.debug_struct(&format!("HinawaFwRespClass @ {self:p}"))
185            .field("parent_class", &self.parent_class)
186            .field("requested", &self.requested)
187            .finish()
188    }
189}
190
191// Classes
192#[derive(Copy, Clone)]
193#[repr(C)]
194pub struct HinawaFwFcp {
195    pub parent_instance: HinawaFwResp,
196}
197
198impl ::std::fmt::Debug for HinawaFwFcp {
199    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
200        f.debug_struct(&format!("HinawaFwFcp @ {self:p}"))
201            .field("parent_instance", &self.parent_instance)
202            .finish()
203    }
204}
205
206#[derive(Copy, Clone)]
207#[repr(C)]
208pub struct HinawaFwNode {
209    pub parent_instance: gobject::GObject,
210}
211
212impl ::std::fmt::Debug for HinawaFwNode {
213    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
214        f.debug_struct(&format!("HinawaFwNode @ {self:p}"))
215            .field("parent_instance", &self.parent_instance)
216            .finish()
217    }
218}
219
220#[derive(Copy, Clone)]
221#[repr(C)]
222pub struct HinawaFwReq {
223    pub parent_instance: gobject::GObject,
224}
225
226impl ::std::fmt::Debug for HinawaFwReq {
227    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
228        f.debug_struct(&format!("HinawaFwReq @ {self:p}"))
229            .field("parent_instance", &self.parent_instance)
230            .finish()
231    }
232}
233
234#[derive(Copy, Clone)]
235#[repr(C)]
236pub struct HinawaFwResp {
237    pub parent_instance: gobject::GObject,
238}
239
240impl ::std::fmt::Debug for HinawaFwResp {
241    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
242        f.debug_struct(&format!("HinawaFwResp @ {self:p}"))
243            .field("parent_instance", &self.parent_instance)
244            .finish()
245    }
246}
247
248extern "C" {
249
250    //=========================================================================
251    // HinawaFwFcpError
252    //=========================================================================
253    pub fn hinawa_fw_fcp_error_get_type() -> GType;
254    pub fn hinawa_fw_fcp_error_quark() -> glib::GQuark;
255
256    //=========================================================================
257    // HinawaFwNodeError
258    //=========================================================================
259    pub fn hinawa_fw_node_error_get_type() -> GType;
260    pub fn hinawa_fw_node_error_quark() -> glib::GQuark;
261
262    //=========================================================================
263    // HinawaFwRcode
264    //=========================================================================
265    pub fn hinawa_fw_rcode_get_type() -> GType;
266
267    //=========================================================================
268    // HinawaFwReqError
269    //=========================================================================
270    pub fn hinawa_fw_req_error_get_type() -> GType;
271    pub fn hinawa_fw_req_error_quark() -> glib::GQuark;
272
273    //=========================================================================
274    // HinawaFwRespError
275    //=========================================================================
276    pub fn hinawa_fw_resp_error_get_type() -> GType;
277    pub fn hinawa_fw_resp_error_quark() -> glib::GQuark;
278
279    //=========================================================================
280    // HinawaFwTcode
281    //=========================================================================
282    pub fn hinawa_fw_tcode_get_type() -> GType;
283
284    //=========================================================================
285    // HinawaCycleTime
286    //=========================================================================
287    pub fn hinawa_cycle_time_get_type() -> GType;
288    pub fn hinawa_cycle_time_new() -> *mut HinawaCycleTime;
289    pub fn hinawa_cycle_time_compute_tstamp(
290        self_: *const HinawaCycleTime,
291        tstamp: c_uint,
292        isoc_cycle: *mut [c_uint; 2],
293    );
294    pub fn hinawa_cycle_time_get_clock_id(self_: *const HinawaCycleTime, clock_id: *mut c_int);
295    pub fn hinawa_cycle_time_get_fields(self_: *const HinawaCycleTime, fields: *mut [u16; 3]);
296    pub fn hinawa_cycle_time_get_raw(self_: *const HinawaCycleTime, raw: *mut u32);
297    pub fn hinawa_cycle_time_get_system_time(
298        self_: *const HinawaCycleTime,
299        tv_sec: *mut i64,
300        tv_nsec: *mut i32,
301    );
302    pub fn hinawa_cycle_time_parse_tstamp(tstamp: c_uint, isoc_cycle: *mut [c_uint; 2]);
303
304    //=========================================================================
305    // HinawaFwFcp
306    //=========================================================================
307    pub fn hinawa_fw_fcp_get_type() -> GType;
308    pub fn hinawa_fw_fcp_new() -> *mut HinawaFwFcp;
309    pub fn hinawa_fw_fcp_avc_transaction(
310        self_: *mut HinawaFwFcp,
311        cmd: *const u8,
312        cmd_size: size_t,
313        resp: *mut *mut u8,
314        resp_size: *mut size_t,
315        timeout_ms: c_uint,
316        error: *mut *mut glib::GError,
317    ) -> gboolean;
318    pub fn hinawa_fw_fcp_avc_transaction_with_tstamp(
319        self_: *mut HinawaFwFcp,
320        cmd: *const u8,
321        cmd_size: size_t,
322        resp: *mut *mut u8,
323        resp_size: *mut size_t,
324        tstamp: *mut [c_uint; 3],
325        timeout_ms: c_uint,
326        error: *mut *mut glib::GError,
327    ) -> gboolean;
328    pub fn hinawa_fw_fcp_bind(
329        self_: *mut HinawaFwFcp,
330        node: *mut HinawaFwNode,
331        error: *mut *mut glib::GError,
332    ) -> gboolean;
333    pub fn hinawa_fw_fcp_command(
334        self_: *mut HinawaFwFcp,
335        cmd: *const u8,
336        cmd_size: size_t,
337        timeout_ms: c_uint,
338        error: *mut *mut glib::GError,
339    ) -> gboolean;
340    pub fn hinawa_fw_fcp_command_with_tstamp(
341        self_: *mut HinawaFwFcp,
342        cmd: *const u8,
343        cmd_size: size_t,
344        tstamp: *mut [c_uint; 2],
345        timeout_ms: c_uint,
346        error: *mut *mut glib::GError,
347    ) -> gboolean;
348    pub fn hinawa_fw_fcp_unbind(self_: *mut HinawaFwFcp);
349
350    //=========================================================================
351    // HinawaFwNode
352    //=========================================================================
353    pub fn hinawa_fw_node_get_type() -> GType;
354    pub fn hinawa_fw_node_new() -> *mut HinawaFwNode;
355    pub fn hinawa_fw_node_create_source(
356        self_: *mut HinawaFwNode,
357        gsrc: *mut *mut glib::GSource,
358        error: *mut *mut glib::GError,
359    ) -> gboolean;
360    pub fn hinawa_fw_node_get_config_rom(
361        self_: *mut HinawaFwNode,
362        image: *mut *const u8,
363        length: *mut size_t,
364        error: *mut *mut glib::GError,
365    ) -> gboolean;
366    pub fn hinawa_fw_node_open(
367        self_: *mut HinawaFwNode,
368        path: *const c_char,
369        open_flag: c_int,
370        error: *mut *mut glib::GError,
371    ) -> gboolean;
372    pub fn hinawa_fw_node_read_cycle_time(
373        self_: *mut HinawaFwNode,
374        clock_id: c_int,
375        cycle_time: *mut *mut HinawaCycleTime,
376        error: *mut *mut glib::GError,
377    ) -> gboolean;
378
379    //=========================================================================
380    // HinawaFwReq
381    //=========================================================================
382    pub fn hinawa_fw_req_get_type() -> GType;
383    pub fn hinawa_fw_req_new() -> *mut HinawaFwReq;
384    pub fn hinawa_fw_req_request(
385        self_: *mut HinawaFwReq,
386        node: *mut HinawaFwNode,
387        tcode: HinawaFwTcode,
388        addr: u64,
389        length: size_t,
390        frame: *mut *mut u8,
391        frame_size: *mut size_t,
392        error: *mut *mut glib::GError,
393    ) -> gboolean;
394    pub fn hinawa_fw_req_transaction(
395        self_: *mut HinawaFwReq,
396        node: *mut HinawaFwNode,
397        tcode: HinawaFwTcode,
398        addr: u64,
399        length: size_t,
400        frame: *mut *mut u8,
401        frame_size: *mut size_t,
402        timeout_ms: c_uint,
403        error: *mut *mut glib::GError,
404    ) -> gboolean;
405    pub fn hinawa_fw_req_transaction_with_tstamp(
406        self_: *mut HinawaFwReq,
407        node: *mut HinawaFwNode,
408        tcode: HinawaFwTcode,
409        addr: u64,
410        length: size_t,
411        frame: *mut *mut u8,
412        frame_size: *mut size_t,
413        tstamp: *mut [c_uint; 2],
414        timeout_ms: c_uint,
415        error: *mut *mut glib::GError,
416    ) -> gboolean;
417
418    //=========================================================================
419    // HinawaFwResp
420    //=========================================================================
421    pub fn hinawa_fw_resp_get_type() -> GType;
422    pub fn hinawa_fw_resp_new() -> *mut HinawaFwResp;
423    pub fn hinawa_fw_resp_release(self_: *mut HinawaFwResp);
424    pub fn hinawa_fw_resp_reserve(
425        self_: *mut HinawaFwResp,
426        node: *mut HinawaFwNode,
427        addr: u64,
428        width: c_uint,
429        error: *mut *mut glib::GError,
430    ) -> gboolean;
431    pub fn hinawa_fw_resp_reserve_within_region(
432        self_: *mut HinawaFwResp,
433        node: *mut HinawaFwNode,
434        region_start: u64,
435        region_end: u64,
436        width: c_uint,
437        error: *mut *mut glib::GError,
438    ) -> gboolean;
439    pub fn hinawa_fw_resp_set_resp_frame(self_: *mut HinawaFwResp, frame: *mut u8, length: size_t);
440
441}