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