1#![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;
18use hinawa_sys as hinawa;
19
20#[allow(unused_imports)]
21use libc::{
22 c_char, c_double, c_float, c_int, c_long, c_short, c_uchar, c_uint, c_ulong, c_ushort, c_void,
23 intptr_t, off_t, size_t, ssize_t, time_t, uintptr_t, FILE,
24};
25#[cfg(unix)]
26#[allow(unused_imports)]
27use libc::{dev_t, gid_t, pid_t, socklen_t, uid_t};
28
29#[allow(unused_imports)]
30use glib::{gboolean, gconstpointer, gpointer, GType};
31
32pub type HinokoFwIsoCtxError = c_int;
34pub const HINOKO_FW_ISO_CTX_ERROR_FAILED: HinokoFwIsoCtxError = 0;
35pub const HINOKO_FW_ISO_CTX_ERROR_ALLOCATED: HinokoFwIsoCtxError = 1;
36pub const HINOKO_FW_ISO_CTX_ERROR_NOT_ALLOCATED: HinokoFwIsoCtxError = 2;
37pub const HINOKO_FW_ISO_CTX_ERROR_MAPPED: HinokoFwIsoCtxError = 3;
38pub const HINOKO_FW_ISO_CTX_ERROR_NOT_MAPPED: HinokoFwIsoCtxError = 4;
39pub const HINOKO_FW_ISO_CTX_ERROR_CHUNK_UNREGISTERED: HinokoFwIsoCtxError = 5;
40pub const HINOKO_FW_ISO_CTX_ERROR_NO_ISOC_CHANNEL: HinokoFwIsoCtxError = 6;
41
42pub type HinokoFwIsoCtxMode = c_int;
43pub const HINOKO_FW_ISO_CTX_MODE_IT: HinokoFwIsoCtxMode = 0;
44pub const HINOKO_FW_ISO_CTX_MODE_IR_SINGLE: HinokoFwIsoCtxMode = 1;
45pub const HINOKO_FW_ISO_CTX_MODE_IR_MULTIPLE: HinokoFwIsoCtxMode = 2;
46
47pub type HinokoFwIsoResourceAutoError = c_int;
48pub const HINOKO_FW_ISO_RESOURCE_AUTO_ERROR_FAILED: HinokoFwIsoResourceAutoError = 0;
49pub const HINOKO_FW_ISO_RESOURCE_AUTO_ERROR_ALLOCATED: HinokoFwIsoResourceAutoError = 1;
50pub const HINOKO_FW_ISO_RESOURCE_AUTO_ERROR_NOT_ALLOCATED: HinokoFwIsoResourceAutoError = 2;
51
52pub type HinokoFwIsoResourceError = c_int;
53pub const HINOKO_FW_ISO_RESOURCE_ERROR_FAILED: HinokoFwIsoResourceError = 0;
54pub const HINOKO_FW_ISO_RESOURCE_ERROR_OPENED: HinokoFwIsoResourceError = 1;
55pub const HINOKO_FW_ISO_RESOURCE_ERROR_NOT_OPENED: HinokoFwIsoResourceError = 2;
56pub const HINOKO_FW_ISO_RESOURCE_ERROR_TIMEOUT: HinokoFwIsoResourceError = 3;
57pub const HINOKO_FW_ISO_RESOURCE_ERROR_EVENT: HinokoFwIsoResourceError = 4;
58
59pub type HinokoFwScode = c_int;
60pub const HINOKO_FW_SCODE_S100: HinokoFwScode = 0;
61pub const HINOKO_FW_SCODE_S200: HinokoFwScode = 1;
62pub const HINOKO_FW_SCODE_S400: HinokoFwScode = 2;
63pub const HINOKO_FW_SCODE_S800: HinokoFwScode = 3;
64pub const HINOKO_FW_SCODE_S1600: HinokoFwScode = 4;
65pub const HINOKO_FW_SCODE_S3200: HinokoFwScode = 5;
66
67pub type HinokoFwIsoCtxMatchFlag = c_uint;
69pub const HINOKO_FW_ISO_CTX_MATCH_FLAG_TAG0: HinokoFwIsoCtxMatchFlag = 1;
70pub const HINOKO_FW_ISO_CTX_MATCH_FLAG_TAG1: HinokoFwIsoCtxMatchFlag = 2;
71pub const HINOKO_FW_ISO_CTX_MATCH_FLAG_TAG2: HinokoFwIsoCtxMatchFlag = 4;
72pub const HINOKO_FW_ISO_CTX_MATCH_FLAG_TAG3: HinokoFwIsoCtxMatchFlag = 8;
73
74#[derive(Copy, Clone)]
76#[repr(C)]
77pub struct HinokoFwIsoCtxInterface {
78 pub parent_iface: gobject::GTypeInterface,
79 pub stop: Option<unsafe extern "C" fn(*mut HinokoFwIsoCtx)>,
80 pub unmap_buffer: Option<unsafe extern "C" fn(*mut HinokoFwIsoCtx)>,
81 pub release: Option<unsafe extern "C" fn(*mut HinokoFwIsoCtx)>,
82 pub read_cycle_time: Option<
83 unsafe extern "C" fn(
84 *mut HinokoFwIsoCtx,
85 c_int,
86 *mut *mut hinawa::HinawaCycleTime,
87 *mut *mut glib::GError,
88 ) -> gboolean,
89 >,
90 pub flush_completions:
91 Option<unsafe extern "C" fn(*mut HinokoFwIsoCtx, *mut *mut glib::GError) -> gboolean>,
92 pub create_source: Option<
93 unsafe extern "C" fn(
94 *mut HinokoFwIsoCtx,
95 *mut *mut glib::GSource,
96 *mut *mut glib::GError,
97 ) -> gboolean,
98 >,
99 pub stopped: Option<unsafe extern "C" fn(*mut HinokoFwIsoCtx, *const glib::GError)>,
100}
101
102impl ::std::fmt::Debug for HinokoFwIsoCtxInterface {
103 fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
104 f.debug_struct(&format!("HinokoFwIsoCtxInterface @ {self:p}"))
105 .field("parent_iface", &self.parent_iface)
106 .field("stop", &self.stop)
107 .field("unmap_buffer", &self.unmap_buffer)
108 .field("release", &self.release)
109 .field("read_cycle_time", &self.read_cycle_time)
110 .field("flush_completions", &self.flush_completions)
111 .field("create_source", &self.create_source)
112 .field("stopped", &self.stopped)
113 .finish()
114 }
115}
116
117#[derive(Copy, Clone)]
118#[repr(C)]
119pub struct HinokoFwIsoIrMultipleClass {
120 pub parent_class: gobject::GObjectClass,
121 pub interrupted: Option<unsafe extern "C" fn(*mut HinokoFwIsoIrMultiple, c_uint)>,
122}
123
124impl ::std::fmt::Debug for HinokoFwIsoIrMultipleClass {
125 fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
126 f.debug_struct(&format!("HinokoFwIsoIrMultipleClass @ {self:p}"))
127 .field("parent_class", &self.parent_class)
128 .field("interrupted", &self.interrupted)
129 .finish()
130 }
131}
132
133#[derive(Copy, Clone)]
134#[repr(C)]
135pub struct HinokoFwIsoIrSingleClass {
136 pub parent_class: gobject::GObjectClass,
137 pub interrupted: Option<
138 unsafe extern "C" fn(*mut HinokoFwIsoIrSingle, c_uint, c_uint, *const u8, c_uint, c_uint),
139 >,
140}
141
142impl ::std::fmt::Debug for HinokoFwIsoIrSingleClass {
143 fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
144 f.debug_struct(&format!("HinokoFwIsoIrSingleClass @ {self:p}"))
145 .field("parent_class", &self.parent_class)
146 .field("interrupted", &self.interrupted)
147 .finish()
148 }
149}
150
151#[derive(Copy, Clone)]
152#[repr(C)]
153pub struct HinokoFwIsoItClass {
154 pub parent_class: gobject::GObjectClass,
155 pub interrupted:
156 Option<unsafe extern "C" fn(*mut HinokoFwIsoIt, c_uint, c_uint, *const u8, c_uint, c_uint)>,
157}
158
159impl ::std::fmt::Debug for HinokoFwIsoItClass {
160 fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
161 f.debug_struct(&format!("HinokoFwIsoItClass @ {self:p}"))
162 .field("parent_class", &self.parent_class)
163 .field("interrupted", &self.interrupted)
164 .finish()
165 }
166}
167
168#[derive(Copy, Clone)]
169#[repr(C)]
170pub struct HinokoFwIsoResourceAutoClass {
171 pub parent_class: gobject::GObjectClass,
172}
173
174impl ::std::fmt::Debug for HinokoFwIsoResourceAutoClass {
175 fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
176 f.debug_struct(&format!("HinokoFwIsoResourceAutoClass @ {self:p}"))
177 .field("parent_class", &self.parent_class)
178 .finish()
179 }
180}
181
182#[derive(Copy, Clone)]
183#[repr(C)]
184pub struct HinokoFwIsoResourceInterface {
185 pub parent_iface: gobject::GTypeInterface,
186 pub open: Option<
187 unsafe extern "C" fn(
188 *mut HinokoFwIsoResource,
189 *const c_char,
190 c_int,
191 *mut *mut glib::GError,
192 ) -> gboolean,
193 >,
194 pub allocate: Option<
195 unsafe extern "C" fn(
196 *mut HinokoFwIsoResource,
197 *const u8,
198 size_t,
199 c_uint,
200 *mut *mut glib::GError,
201 ) -> gboolean,
202 >,
203 pub create_source: Option<
204 unsafe extern "C" fn(
205 *mut HinokoFwIsoResource,
206 *mut *mut glib::GSource,
207 *mut *mut glib::GError,
208 ) -> gboolean,
209 >,
210 pub allocated:
211 Option<unsafe extern "C" fn(*mut HinokoFwIsoResource, c_uint, c_uint, *const glib::GError)>,
212 pub deallocated:
213 Option<unsafe extern "C" fn(*mut HinokoFwIsoResource, c_uint, c_uint, *const glib::GError)>,
214}
215
216impl ::std::fmt::Debug for HinokoFwIsoResourceInterface {
217 fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
218 f.debug_struct(&format!("HinokoFwIsoResourceInterface @ {self:p}"))
219 .field("parent_iface", &self.parent_iface)
220 .field("open", &self.open)
221 .field("allocate", &self.allocate)
222 .field("create_source", &self.create_source)
223 .field("allocated", &self.allocated)
224 .field("deallocated", &self.deallocated)
225 .finish()
226 }
227}
228
229#[derive(Copy, Clone)]
230#[repr(C)]
231pub struct HinokoFwIsoResourceOnceClass {
232 pub parent_class: gobject::GObjectClass,
233}
234
235impl ::std::fmt::Debug for HinokoFwIsoResourceOnceClass {
236 fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
237 f.debug_struct(&format!("HinokoFwIsoResourceOnceClass @ {self:p}"))
238 .field("parent_class", &self.parent_class)
239 .finish()
240 }
241}
242
243#[derive(Copy, Clone)]
245#[repr(C)]
246pub struct HinokoFwIsoIrMultiple {
247 pub parent_instance: gobject::GObject,
248}
249
250impl ::std::fmt::Debug for HinokoFwIsoIrMultiple {
251 fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
252 f.debug_struct(&format!("HinokoFwIsoIrMultiple @ {self:p}"))
253 .field("parent_instance", &self.parent_instance)
254 .finish()
255 }
256}
257
258#[derive(Copy, Clone)]
259#[repr(C)]
260pub struct HinokoFwIsoIrSingle {
261 pub parent_instance: gobject::GObject,
262}
263
264impl ::std::fmt::Debug for HinokoFwIsoIrSingle {
265 fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
266 f.debug_struct(&format!("HinokoFwIsoIrSingle @ {self:p}"))
267 .field("parent_instance", &self.parent_instance)
268 .finish()
269 }
270}
271
272#[derive(Copy, Clone)]
273#[repr(C)]
274pub struct HinokoFwIsoIt {
275 pub parent_instance: gobject::GObject,
276}
277
278impl ::std::fmt::Debug for HinokoFwIsoIt {
279 fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
280 f.debug_struct(&format!("HinokoFwIsoIt @ {self:p}"))
281 .field("parent_instance", &self.parent_instance)
282 .finish()
283 }
284}
285
286#[derive(Copy, Clone)]
287#[repr(C)]
288pub struct HinokoFwIsoResourceAuto {
289 pub parent_instance: gobject::GObject,
290}
291
292impl ::std::fmt::Debug for HinokoFwIsoResourceAuto {
293 fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
294 f.debug_struct(&format!("HinokoFwIsoResourceAuto @ {self:p}"))
295 .field("parent_instance", &self.parent_instance)
296 .finish()
297 }
298}
299
300#[derive(Copy, Clone)]
301#[repr(C)]
302pub struct HinokoFwIsoResourceOnce {
303 pub parent_instance: gobject::GObject,
304}
305
306impl ::std::fmt::Debug for HinokoFwIsoResourceOnce {
307 fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
308 f.debug_struct(&format!("HinokoFwIsoResourceOnce @ {self:p}"))
309 .field("parent_instance", &self.parent_instance)
310 .finish()
311 }
312}
313
314#[repr(C)]
316#[allow(dead_code)]
317pub struct HinokoFwIsoCtx {
318 _data: [u8; 0],
319 _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>,
320}
321
322impl ::std::fmt::Debug for HinokoFwIsoCtx {
323 fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
324 write!(f, "HinokoFwIsoCtx @ {self:p}")
325 }
326}
327
328#[repr(C)]
329#[allow(dead_code)]
330pub struct HinokoFwIsoResource {
331 _data: [u8; 0],
332 _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>,
333}
334
335impl ::std::fmt::Debug for HinokoFwIsoResource {
336 fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
337 write!(f, "HinokoFwIsoResource @ {self:p}")
338 }
339}
340
341#[link(name = "hinoko")]
342extern "C" {
343
344 pub fn hinoko_fw_iso_ctx_error_get_type() -> GType;
348 pub fn hinoko_fw_iso_ctx_error_quark() -> glib::GQuark;
349
350 pub fn hinoko_fw_iso_ctx_mode_get_type() -> GType;
354
355 pub fn hinoko_fw_iso_resource_auto_error_get_type() -> GType;
359 pub fn hinoko_fw_iso_resource_auto_error_quark() -> glib::GQuark;
360
361 pub fn hinoko_fw_iso_resource_error_get_type() -> GType;
365 pub fn hinoko_fw_iso_resource_error_quark() -> glib::GQuark;
366
367 pub fn hinoko_fw_scode_get_type() -> GType;
371
372 pub fn hinoko_fw_iso_ctx_match_flag_get_type() -> GType;
376
377 pub fn hinoko_fw_iso_ir_multiple_get_type() -> GType;
381 pub fn hinoko_fw_iso_ir_multiple_new() -> *mut HinokoFwIsoIrMultiple;
382 pub fn hinoko_fw_iso_ir_multiple_allocate(
383 self_: *mut HinokoFwIsoIrMultiple,
384 path: *const c_char,
385 channels: *const u8,
386 channels_length: c_uint,
387 error: *mut *mut glib::GError,
388 ) -> gboolean;
389 pub fn hinoko_fw_iso_ir_multiple_get_payload(
390 self_: *mut HinokoFwIsoIrMultiple,
391 index: c_uint,
392 payload: *mut *const u8,
393 length: *mut c_uint,
394 );
395 pub fn hinoko_fw_iso_ir_multiple_map_buffer(
396 self_: *mut HinokoFwIsoIrMultiple,
397 bytes_per_chunk: c_uint,
398 chunks_per_buffer: c_uint,
399 error: *mut *mut glib::GError,
400 ) -> gboolean;
401 pub fn hinoko_fw_iso_ir_multiple_start(
402 self_: *mut HinokoFwIsoIrMultiple,
403 cycle_match: *const [u16; 2],
404 sync_code: u32,
405 tags: HinokoFwIsoCtxMatchFlag,
406 chunks_per_irq: c_uint,
407 error: *mut *mut glib::GError,
408 ) -> gboolean;
409
410 pub fn hinoko_fw_iso_ir_single_get_type() -> GType;
414 pub fn hinoko_fw_iso_ir_single_new() -> *mut HinokoFwIsoIrSingle;
415 pub fn hinoko_fw_iso_ir_single_allocate(
416 self_: *mut HinokoFwIsoIrSingle,
417 path: *const c_char,
418 channel: c_uint,
419 header_size: c_uint,
420 error: *mut *mut glib::GError,
421 ) -> gboolean;
422 pub fn hinoko_fw_iso_ir_single_get_payload(
423 self_: *mut HinokoFwIsoIrSingle,
424 index: c_uint,
425 payload: *mut *const u8,
426 length: *mut c_uint,
427 );
428 pub fn hinoko_fw_iso_ir_single_map_buffer(
429 self_: *mut HinokoFwIsoIrSingle,
430 maximum_bytes_per_payload: c_uint,
431 payloads_per_buffer: c_uint,
432 error: *mut *mut glib::GError,
433 ) -> gboolean;
434 pub fn hinoko_fw_iso_ir_single_register_packet(
435 self_: *mut HinokoFwIsoIrSingle,
436 schedule_interrupt: gboolean,
437 error: *mut *mut glib::GError,
438 ) -> gboolean;
439 pub fn hinoko_fw_iso_ir_single_start(
440 self_: *mut HinokoFwIsoIrSingle,
441 cycle_match: *const [u16; 2],
442 sync_code: u32,
443 tags: HinokoFwIsoCtxMatchFlag,
444 error: *mut *mut glib::GError,
445 ) -> gboolean;
446
447 pub fn hinoko_fw_iso_it_get_type() -> GType;
451 pub fn hinoko_fw_iso_it_new() -> *mut HinokoFwIsoIt;
452 pub fn hinoko_fw_iso_it_allocate(
453 self_: *mut HinokoFwIsoIt,
454 path: *const c_char,
455 scode: HinokoFwScode,
456 channel: c_uint,
457 header_size: c_uint,
458 error: *mut *mut glib::GError,
459 ) -> gboolean;
460 pub fn hinoko_fw_iso_it_map_buffer(
461 self_: *mut HinokoFwIsoIt,
462 maximum_bytes_per_payload: c_uint,
463 payloads_per_buffer: c_uint,
464 error: *mut *mut glib::GError,
465 ) -> gboolean;
466 pub fn hinoko_fw_iso_it_register_packet(
467 self_: *mut HinokoFwIsoIt,
468 tags: HinokoFwIsoCtxMatchFlag,
469 sync_code: c_uint,
470 header: *const u8,
471 header_length: c_uint,
472 payload: *const u8,
473 payload_length: c_uint,
474 schedule_interrupt: gboolean,
475 error: *mut *mut glib::GError,
476 ) -> gboolean;
477 pub fn hinoko_fw_iso_it_start(
478 self_: *mut HinokoFwIsoIt,
479 cycle_match: *const [u16; 2],
480 error: *mut *mut glib::GError,
481 ) -> gboolean;
482
483 pub fn hinoko_fw_iso_resource_auto_get_type() -> GType;
487 pub fn hinoko_fw_iso_resource_auto_new() -> *mut HinokoFwIsoResourceAuto;
488 pub fn hinoko_fw_iso_resource_auto_deallocate(
489 self_: *mut HinokoFwIsoResourceAuto,
490 error: *mut *mut glib::GError,
491 ) -> gboolean;
492 pub fn hinoko_fw_iso_resource_auto_deallocate_wait(
493 self_: *mut HinokoFwIsoResourceAuto,
494 timeout_ms: c_uint,
495 error: *mut *mut glib::GError,
496 ) -> gboolean;
497
498 pub fn hinoko_fw_iso_resource_once_get_type() -> GType;
502 pub fn hinoko_fw_iso_resource_once_new() -> *mut HinokoFwIsoResourceOnce;
503 pub fn hinoko_fw_iso_resource_once_deallocate(
504 self_: *mut HinokoFwIsoResourceOnce,
505 channel: c_uint,
506 bandwidth: c_uint,
507 error: *mut *mut glib::GError,
508 ) -> gboolean;
509 pub fn hinoko_fw_iso_resource_once_deallocate_wait(
510 self_: *mut HinokoFwIsoResourceOnce,
511 channel: c_uint,
512 bandwidth: c_uint,
513 timeout_ms: c_uint,
514 error: *mut *mut glib::GError,
515 ) -> gboolean;
516
517 pub fn hinoko_fw_iso_ctx_get_type() -> GType;
521 pub fn hinoko_fw_iso_ctx_create_source(
522 self_: *mut HinokoFwIsoCtx,
523 source: *mut *mut glib::GSource,
524 error: *mut *mut glib::GError,
525 ) -> gboolean;
526 pub fn hinoko_fw_iso_ctx_flush_completions(
527 self_: *mut HinokoFwIsoCtx,
528 error: *mut *mut glib::GError,
529 ) -> gboolean;
530 pub fn hinoko_fw_iso_ctx_read_cycle_time(
531 self_: *mut HinokoFwIsoCtx,
532 clock_id: c_int,
533 cycle_time: *mut *mut hinawa::HinawaCycleTime,
534 error: *mut *mut glib::GError,
535 ) -> gboolean;
536 pub fn hinoko_fw_iso_ctx_release(self_: *mut HinokoFwIsoCtx);
537 pub fn hinoko_fw_iso_ctx_stop(self_: *mut HinokoFwIsoCtx);
538 pub fn hinoko_fw_iso_ctx_unmap_buffer(self_: *mut HinokoFwIsoCtx);
539
540 pub fn hinoko_fw_iso_resource_get_type() -> GType;
544 pub fn hinoko_fw_iso_resource_calculate_bandwidth(
545 bytes_per_payload: c_uint,
546 scode: HinokoFwScode,
547 ) -> c_uint;
548 pub fn hinoko_fw_iso_resource_allocate(
549 self_: *mut HinokoFwIsoResource,
550 channel_candidates: *const u8,
551 channel_candidates_count: size_t,
552 bandwidth: c_uint,
553 error: *mut *mut glib::GError,
554 ) -> gboolean;
555 pub fn hinoko_fw_iso_resource_allocate_wait(
556 self_: *mut HinokoFwIsoResource,
557 channel_candidates: *const u8,
558 channel_candidates_count: size_t,
559 bandwidth: c_uint,
560 timeout_ms: c_uint,
561 error: *mut *mut glib::GError,
562 ) -> gboolean;
563 pub fn hinoko_fw_iso_resource_create_source(
564 self_: *mut HinokoFwIsoResource,
565 source: *mut *mut glib::GSource,
566 error: *mut *mut glib::GError,
567 ) -> gboolean;
568 pub fn hinoko_fw_iso_resource_open(
569 self_: *mut HinokoFwIsoResource,
570 path: *const c_char,
571 open_flag: c_int,
572 error: *mut *mut glib::GError,
573 ) -> gboolean;
574
575}