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#[allow(unused_imports)]
20use libc::{
21    c_char, c_double, c_float, c_int, c_long, c_short, c_uchar, c_uint, c_ulong, c_ushort, c_void,
22    intptr_t, off_t, size_t, ssize_t, time_t, uintptr_t, FILE,
23};
24#[cfg(unix)]
25#[allow(unused_imports)]
26use libc::{dev_t, gid_t, pid_t, socklen_t, uid_t};
27
28#[allow(unused_imports)]
29use glib::{gboolean, gconstpointer, gpointer, GType};
30
31// Enums
32pub type HinawaFwFcpError = c_int;
33pub const HINAWA_FW_FCP_ERROR_TIMEOUT: HinawaFwFcpError = 0;
34pub const HINAWA_FW_FCP_ERROR_LARGE_RESP: HinawaFwFcpError = 1;
35pub const HINAWA_FW_FCP_ERROR_ABORTED: HinawaFwFcpError = 2;
36
37pub type HinawaFwNodeError = c_int;
38pub const HINAWA_FW_NODE_ERROR_DISCONNECTED: HinawaFwNodeError = 0;
39pub const HINAWA_FW_NODE_ERROR_OPENED: HinawaFwNodeError = 1;
40pub const HINAWA_FW_NODE_ERROR_NOT_OPENED: HinawaFwNodeError = 2;
41pub const HINAWA_FW_NODE_ERROR_FAILED: HinawaFwNodeError = 3;
42
43pub type HinawaFwRcode = c_int;
44pub const HINAWA_FW_RCODE_COMPLETE: HinawaFwRcode = 0;
45pub const HINAWA_FW_RCODE_CONFLICT_ERROR: HinawaFwRcode = 4;
46pub const HINAWA_FW_RCODE_DATA_ERROR: HinawaFwRcode = 5;
47pub const HINAWA_FW_RCODE_TYPE_ERROR: HinawaFwRcode = 6;
48pub const HINAWA_FW_RCODE_ADDRESS_ERROR: HinawaFwRcode = 7;
49pub const HINAWA_FW_RCODE_SEND_ERROR: HinawaFwRcode = 16;
50pub const HINAWA_FW_RCODE_CANCELLED: HinawaFwRcode = 17;
51pub const HINAWA_FW_RCODE_BUSY: HinawaFwRcode = 18;
52pub const HINAWA_FW_RCODE_GENERATION: HinawaFwRcode = 19;
53pub const HINAWA_FW_RCODE_NO_ACK: HinawaFwRcode = 20;
54pub const HINAWA_FW_RCODE_INVALID: HinawaFwRcode = 21;
55
56pub type HinawaFwReqError = c_int;
57pub const HINAWA_FW_REQ_ERROR_CONFLICT_ERROR: HinawaFwReqError = 4;
58pub const HINAWA_FW_REQ_ERROR_DATA_ERROR: HinawaFwReqError = 5;
59pub const HINAWA_FW_REQ_ERROR_TYPE_ERROR: HinawaFwReqError = 6;
60pub const HINAWA_FW_REQ_ERROR_ADDRESS_ERROR: HinawaFwReqError = 7;
61pub const HINAWA_FW_REQ_ERROR_SEND_ERROR: HinawaFwReqError = 16;
62pub const HINAWA_FW_REQ_ERROR_CANCELLED: HinawaFwReqError = 17;
63pub const HINAWA_FW_REQ_ERROR_BUSY: HinawaFwReqError = 18;
64pub const HINAWA_FW_REQ_ERROR_GENERATION: HinawaFwReqError = 19;
65pub const HINAWA_FW_REQ_ERROR_NO_ACK: HinawaFwReqError = 20;
66pub const HINAWA_FW_REQ_ERROR_INVALID: HinawaFwReqError = 21;
67
68pub type HinawaFwRespError = c_int;
69pub const HINAWA_FW_RESP_ERROR_FAILED: HinawaFwRespError = 0;
70pub const HINAWA_FW_RESP_ERROR_RESERVED: HinawaFwRespError = 1;
71pub const HINAWA_FW_RESP_ERROR_ADDR_SPACE_USED: HinawaFwRespError = 2;
72
73pub type HinawaFwTcode = c_int;
74pub const HINAWA_FW_TCODE_WRITE_QUADLET_REQUEST: HinawaFwTcode = 0;
75pub const HINAWA_FW_TCODE_WRITE_BLOCK_REQUEST: HinawaFwTcode = 1;
76pub const HINAWA_FW_TCODE_WRITE_RESPONSE: HinawaFwTcode = 2;
77pub const HINAWA_FW_TCODE_READ_QUADLET_REQUEST: HinawaFwTcode = 4;
78pub const HINAWA_FW_TCODE_READ_BLOCK_REQUEST: HinawaFwTcode = 5;
79pub const HINAWA_FW_TCODE_READ_QUADLET_RESPONSE: HinawaFwTcode = 6;
80pub const HINAWA_FW_TCODE_READ_BLOCK_RESPONSE: HinawaFwTcode = 7;
81pub const HINAWA_FW_TCODE_CYCLE_START: HinawaFwTcode = 8;
82pub const HINAWA_FW_TCODE_LOCK_REQUEST: HinawaFwTcode = 9;
83pub const HINAWA_FW_TCODE_STREAM_DATA: HinawaFwTcode = 10;
84pub const HINAWA_FW_TCODE_LOCK_RESPONSE: HinawaFwTcode = 11;
85pub const HINAWA_FW_TCODE_LOCK_MASK_SWAP: HinawaFwTcode = 17;
86pub const HINAWA_FW_TCODE_LOCK_COMPARE_SWAP: HinawaFwTcode = 18;
87pub const HINAWA_FW_TCODE_LOCK_FETCH_ADD: HinawaFwTcode = 19;
88pub const HINAWA_FW_TCODE_LOCK_LITTLE_ADD: HinawaFwTcode = 20;
89pub const HINAWA_FW_TCODE_LOCK_BOUNDED_ADD: HinawaFwTcode = 21;
90pub const HINAWA_FW_TCODE_LOCK_WRAP_ADD: HinawaFwTcode = 22;
91pub const HINAWA_FW_TCODE_LOCK_VENDOR_DEPENDENT: HinawaFwTcode = 23;
92
93// Records
94#[repr(C)]
95#[allow(dead_code)]
96pub struct HinawaCycleTime {
97    _data: [u8; 0],
98    _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>,
99}
100
101impl ::std::fmt::Debug for HinawaCycleTime {
102    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
103        f.debug_struct(&format!("HinawaCycleTime @ {self:p}"))
104            .finish()
105    }
106}
107
108#[derive(Copy, Clone)]
109#[repr(C)]
110pub struct HinawaFwFcpClass {
111    pub parent_class: HinawaFwRespClass,
112    pub responded:
113        Option<unsafe extern "C" fn(*mut HinawaFwFcp, c_uint, c_uint, *const u8, c_uint)>,
114}
115
116impl ::std::fmt::Debug for HinawaFwFcpClass {
117    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
118        f.debug_struct(&format!("HinawaFwFcpClass @ {self:p}"))
119            .field("parent_class", &self.parent_class)
120            .field("responded", &self.responded)
121            .finish()
122    }
123}
124
125#[derive(Copy, Clone)]
126#[repr(C)]
127pub struct HinawaFwNodeClass {
128    pub parent_class: gobject::GObjectClass,
129    pub bus_update: Option<unsafe extern "C" fn(*mut HinawaFwNode)>,
130    pub disconnected: Option<unsafe extern "C" fn(*mut HinawaFwNode)>,
131}
132
133impl ::std::fmt::Debug for HinawaFwNodeClass {
134    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
135        f.debug_struct(&format!("HinawaFwNodeClass @ {self:p}"))
136            .field("parent_class", &self.parent_class)
137            .field("bus_update", &self.bus_update)
138            .field("disconnected", &self.disconnected)
139            .finish()
140    }
141}
142
143#[derive(Copy, Clone)]
144#[repr(C)]
145pub struct HinawaFwReqClass {
146    pub parent_class: gobject::GObjectClass,
147    pub responded: Option<
148        unsafe extern "C" fn(*mut HinawaFwReq, HinawaFwRcode, c_uint, c_uint, *const u8, c_uint),
149    >,
150}
151
152impl ::std::fmt::Debug for HinawaFwReqClass {
153    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
154        f.debug_struct(&format!("HinawaFwReqClass @ {self:p}"))
155            .field("parent_class", &self.parent_class)
156            .field("responded", &self.responded)
157            .finish()
158    }
159}
160
161#[derive(Copy, Clone)]
162#[repr(C)]
163pub struct HinawaFwRespClass {
164    pub parent_class: gobject::GObjectClass,
165    pub requested: Option<
166        unsafe extern "C" fn(
167            *mut HinawaFwResp,
168            HinawaFwTcode,
169            u64,
170            c_uint,
171            c_uint,
172            c_uint,
173            c_uint,
174            c_uint,
175            *const u8,
176            c_uint,
177        ) -> HinawaFwRcode,
178    >,
179}
180
181impl ::std::fmt::Debug for HinawaFwRespClass {
182    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
183        f.debug_struct(&format!("HinawaFwRespClass @ {self:p}"))
184            .field("parent_class", &self.parent_class)
185            .field("requested", &self.requested)
186            .finish()
187    }
188}
189
190// Classes
191#[derive(Copy, Clone)]
192#[repr(C)]
193pub struct HinawaFwFcp {
194    pub parent_instance: HinawaFwResp,
195}
196
197impl ::std::fmt::Debug for HinawaFwFcp {
198    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
199        f.debug_struct(&format!("HinawaFwFcp @ {self:p}"))
200            .field("parent_instance", &self.parent_instance)
201            .finish()
202    }
203}
204
205#[derive(Copy, Clone)]
206#[repr(C)]
207pub struct HinawaFwNode {
208    pub parent_instance: gobject::GObject,
209}
210
211impl ::std::fmt::Debug for HinawaFwNode {
212    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
213        f.debug_struct(&format!("HinawaFwNode @ {self:p}"))
214            .field("parent_instance", &self.parent_instance)
215            .finish()
216    }
217}
218
219#[derive(Copy, Clone)]
220#[repr(C)]
221pub struct HinawaFwReq {
222    pub parent_instance: gobject::GObject,
223}
224
225impl ::std::fmt::Debug for HinawaFwReq {
226    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
227        f.debug_struct(&format!("HinawaFwReq @ {self:p}"))
228            .field("parent_instance", &self.parent_instance)
229            .finish()
230    }
231}
232
233#[derive(Copy, Clone)]
234#[repr(C)]
235pub struct HinawaFwResp {
236    pub parent_instance: gobject::GObject,
237}
238
239impl ::std::fmt::Debug for HinawaFwResp {
240    fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
241        f.debug_struct(&format!("HinawaFwResp @ {self:p}"))
242            .field("parent_instance", &self.parent_instance)
243            .finish()
244    }
245}
246
247#[link(name = "hinawa")]
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}