Skip to main content

darra_ethercat/utils/
ffi.rs

1
2use std::os::raw::{c_char, c_int, c_void};
3
4pub const CORE_OP_21: u32 = 0x44525421;
5pub const CORE_OP_22: u32 = 0x44525422;
6pub const CORE_OP_23: u32 = 0x44525423;
7pub const CORE_OP_24: u32 = 0x44525424;
8pub const CORE_OP_25: u32 = 0x44525425;
9pub const CORE_OP_26: u32 = 0x44525426;
10pub const CORE_OP_27: u32 = 0x44525427;
11pub const CORE_OP_28: u32 = 0x44525428;
12pub const CORE_FLAG_01: u32 = 0x00000001;
13
14pub const EC_STATE_INIT: u8 = 0x01;
15pub const EC_STATE_PRE_OP: u8 = 0x02;
16pub const EC_STATE_BOOT: u8 = 0x03;
17pub const EC_STATE_SAFE_OP: u8 = 0x04;
18pub const EC_STATE_OPERATIONAL: u8 = 0x08;
19pub const EC_STATE_ACK: u8 = 0x10;
20
21pub const TRANS_IP: u8 = 0;
22pub const TRANS_PS: u8 = 1;
23pub const TRANS_SO: u8 = 2;
24pub const TRANS_OS: u8 = 3;
25pub const TRANS_SP: u8 = 4;
26pub const TRANS_PI: u8 = 5;
27
28pub const TIMING_BEFORE: u8 = 0;
29pub const TIMING_AFTER: u8 = 1;
30
31#[repr(C, packed)]
32#[derive(Clone, Copy)]
33pub struct DllVersionInfo {
34    pub major: u16,
35    pub minor: u16,
36    pub patch: u16,
37    pub build: u16,
38    pub build_date: [u8; 32],
39}
40
41impl std::fmt::Debug for DllVersionInfo {
42    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
43
44        let major = unsafe { std::ptr::addr_of!(self.major).read_unaligned() };
45        let minor = unsafe { std::ptr::addr_of!(self.minor).read_unaligned() };
46        let patch = unsafe { std::ptr::addr_of!(self.patch).read_unaligned() };
47        let build = unsafe { std::ptr::addr_of!(self.build).read_unaligned() };
48        let build_date = unsafe { std::ptr::addr_of!(self.build_date).read_unaligned() };
49        f.debug_struct("DllVersionInfo")
50            .field("major", &major)
51            .field("minor", &minor)
52            .field("patch", &patch)
53            .field("build", &build)
54            .field("build_date", &build_date)
55            .finish()
56    }
57}
58
59#[repr(C, packed(4))]
60#[derive(Clone, Copy)]
61pub struct DriverVersionInfo {
62    pub major: u32,
63    pub minor: u32,
64    pub build: u32,
65    pub build_date: [u8; 32],
66    pub driver_name: [u8; 32],
67    pub available: u32,
68    pub error_code: u32,
69}
70
71impl std::fmt::Debug for DriverVersionInfo {
72    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
73        let major = unsafe { std::ptr::addr_of!(self.major).read_unaligned() };
74        let minor = unsafe { std::ptr::addr_of!(self.minor).read_unaligned() };
75        let build = unsafe { std::ptr::addr_of!(self.build).read_unaligned() };
76        let available = unsafe { std::ptr::addr_of!(self.available).read_unaligned() };
77        let error_code = unsafe { std::ptr::addr_of!(self.error_code).read_unaligned() };
78        f.debug_struct("DriverVersionInfo")
79            .field("major", &major)
80            .field("minor", &minor)
81            .field("build", &build)
82            .field("available", &available)
83            .field("error_code", &error_code)
84            .finish()
85    }
86}
87
88#[repr(C, packed)]
89#[derive(Clone, Copy)]
90pub struct StartupParam {
91    pub index: u16,
92    pub sub_index: u8,
93    pub data: [u8; 256],
94    pub data_len: u16,
95    pub transition: u8,
96    pub timing: u8,
97    pub priority: u16,
98    pub complete_access: u8,
99    pub is_register_write: u8,
100}
101
102impl std::fmt::Debug for StartupParam {
103    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
104
105        let index = unsafe { std::ptr::addr_of!(self.index).read_unaligned() };
106        let sub_index = unsafe { std::ptr::addr_of!(self.sub_index).read_unaligned() };
107        let data_len = unsafe { std::ptr::addr_of!(self.data_len).read_unaligned() };
108        let transition = unsafe { std::ptr::addr_of!(self.transition).read_unaligned() };
109        let timing = unsafe { std::ptr::addr_of!(self.timing).read_unaligned() };
110        let priority = unsafe { std::ptr::addr_of!(self.priority).read_unaligned() };
111        let ca = unsafe { std::ptr::addr_of!(self.complete_access).read_unaligned() };
112        let rw = unsafe { std::ptr::addr_of!(self.is_register_write).read_unaligned() };
113        f.debug_struct("StartupParam")
114            .field("index", &index)
115            .field("sub_index", &sub_index)
116            .field("data_len", &data_len)
117            .field("transition", &transition)
118            .field("timing", &timing)
119            .field("priority", &priority)
120            .field("complete_access", &ca)
121            .field("is_register_write", &rw)
122            .finish()
123    }
124}
125
126#[repr(C, packed)]
127#[derive(Clone, Copy)]
128pub struct SiiGeneralInfo {
129    pub group_idx: u8,
130    pub image_idx: u8,
131    pub order_idx: u8,
132    pub name_idx: u8,
133    pub coe_details: u8,
134    pub foe_details: u8,
135    pub eoe_details: u8,
136    pub soe_details: u8,
137    pub flags: u8,
138    pub ebus_current_ma: i16,
139    pub physical_port: u16,
140    pub reserved: [u8; 8],
141}
142
143impl std::fmt::Debug for SiiGeneralInfo {
144    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
145        let group_idx = unsafe { std::ptr::addr_of!(self.group_idx).read_unaligned() };
146        let image_idx = unsafe { std::ptr::addr_of!(self.image_idx).read_unaligned() };
147        let order_idx = unsafe { std::ptr::addr_of!(self.order_idx).read_unaligned() };
148        let name_idx = unsafe { std::ptr::addr_of!(self.name_idx).read_unaligned() };
149        let coe = unsafe { std::ptr::addr_of!(self.coe_details).read_unaligned() };
150        let foe = unsafe { std::ptr::addr_of!(self.foe_details).read_unaligned() };
151        let eoe = unsafe { std::ptr::addr_of!(self.eoe_details).read_unaligned() };
152        let soe = unsafe { std::ptr::addr_of!(self.soe_details).read_unaligned() };
153        let flags = unsafe { std::ptr::addr_of!(self.flags).read_unaligned() };
154        let ebus = unsafe { std::ptr::addr_of!(self.ebus_current_ma).read_unaligned() };
155        let port = unsafe { std::ptr::addr_of!(self.physical_port).read_unaligned() };
156        f.debug_struct("SiiGeneralInfo")
157            .field("group_idx", &group_idx)
158            .field("image_idx", &image_idx)
159            .field("order_idx", &order_idx)
160            .field("name_idx", &name_idx)
161            .field("coe_details", &coe)
162            .field("foe_details", &foe)
163            .field("eoe_details", &eoe)
164            .field("soe_details", &soe)
165            .field("flags", &flags)
166            .field("ebus_current_ma", &ebus)
167            .field("physical_port", &port)
168            .finish()
169    }
170}
171
172#[repr(C)]
173#[derive(Debug, Clone, Copy)]
174pub struct WatchdogConfig {
175    pub wd_divider: u16,
176    pub wd_time_pdi: u16,
177    pub wd_time_pd: u16,
178}
179
180#[repr(C)]
181#[derive(Debug, Clone, Copy)]
182pub struct WatchdogStatus {
183    pub wd_status: u8,
184    pub wd_counter: u8,
185    pub wd_divider: u16,
186    pub wd_time_pd: u16,
187}
188
189#[repr(C, packed)]
190#[derive(Clone, Copy)]
191pub struct EmcyRecord {
192
193    pub error_code: u16,
194
195    pub error_register: u8,
196
197    pub data: [u8; 5],
198
199    pub slave_index: u16,
200
201    pub timestamp_ms: u32,
202}
203
204impl Default for EmcyRecord {
205    fn default() -> Self {
206        Self {
207            error_code: 0,
208            error_register: 0,
209            data: [0; 5],
210            slave_index: 0,
211            timestamp_ms: 0,
212        }
213    }
214}
215
216impl std::fmt::Debug for EmcyRecord {
217    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
218
219        let error_code = unsafe { std::ptr::addr_of!(self.error_code).read_unaligned() };
220        let error_register = unsafe { std::ptr::addr_of!(self.error_register).read_unaligned() };
221        let data = unsafe { std::ptr::addr_of!(self.data).read_unaligned() };
222        let slave_index = unsafe { std::ptr::addr_of!(self.slave_index).read_unaligned() };
223        let timestamp_ms = unsafe { std::ptr::addr_of!(self.timestamp_ms).read_unaligned() };
224        f.debug_struct("EmcyRecord")
225            .field("error_code", &error_code)
226            .field("error_register", &error_register)
227            .field("data", &data)
228            .field("slave_index", &slave_index)
229            .field("timestamp_ms", &timestamp_ms)
230            .finish()
231    }
232}
233
234#[repr(C, packed)]
235#[derive(Clone, Copy)]
236pub struct TopologyNode {
237
238    pub slave_index: u16,
239
240    pub config_addr: u16,
241
242    pub parent_index: u16,
243
244    pub entry_port: u8,
245
246    pub active_ports: u8,
247
248    pub topology: u8,
249
250    pub port_type: u8,
251}
252
253impl std::fmt::Debug for TopologyNode {
254    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
255
256        let slave_index = unsafe { std::ptr::addr_of!(self.slave_index).read_unaligned() };
257        let config_addr = unsafe { std::ptr::addr_of!(self.config_addr).read_unaligned() };
258        let parent_index = unsafe { std::ptr::addr_of!(self.parent_index).read_unaligned() };
259        let entry_port = unsafe { std::ptr::addr_of!(self.entry_port).read_unaligned() };
260        let active_ports = unsafe { std::ptr::addr_of!(self.active_ports).read_unaligned() };
261        let topology = unsafe { std::ptr::addr_of!(self.topology).read_unaligned() };
262        let port_type = unsafe { std::ptr::addr_of!(self.port_type).read_unaligned() };
263        f.debug_struct("TopologyNode")
264            .field("slave_index", &slave_index)
265            .field("config_addr", &config_addr)
266            .field("parent_index", &parent_index)
267            .field("entry_port", &entry_port)
268            .field("active_ports", &active_ports)
269            .field("topology", &topology)
270            .field("port_type", &port_type)
271            .finish()
272    }
273}
274
275#[repr(C, packed)]
276#[derive(Clone, Copy)]
277pub struct FoEOptions {
278
279    pub enable_crc: u8,
280
281    pub strict_mode: u8,
282
283    pub auto_append_crc: u8,
284
285    pub expected_crc: u32,
286
287    pub crc_progress_callback: Option<extern "C" fn(u32, u32, *mut c_void)>,
288
289    pub crc_callback_userdata: *mut c_void,
290
291    pub reserved: [u32; 8],
292}
293
294impl std::fmt::Debug for FoEOptions {
295    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
296
297        let enable_crc = unsafe { std::ptr::addr_of!(self.enable_crc).read_unaligned() };
298        let strict_mode = unsafe { std::ptr::addr_of!(self.strict_mode).read_unaligned() };
299        let auto_append_crc = unsafe { std::ptr::addr_of!(self.auto_append_crc).read_unaligned() };
300        let expected_crc = unsafe { std::ptr::addr_of!(self.expected_crc).read_unaligned() };
301        f.debug_struct("FoEOptions")
302            .field("enable_crc", &enable_crc)
303            .field("strict_mode", &strict_mode)
304            .field("auto_append_crc", &auto_append_crc)
305            .field("expected_crc", &expected_crc)
306            .finish()
307    }
308}
309
310#[repr(C)]
311#[derive(Debug, Clone, Copy)]
312pub struct SlaveIdentity {
313    pub vendor_id: u32,
314    pub product_code: u32,
315    pub revision_no: u32,
316    pub serial_no: u32,
317}
318
319#[repr(C)]
320#[derive(Debug, Clone, Copy)]
321pub struct EsmTimeouts {
322
323    pub ip: u32,
324
325    pub ps: u32,
326
327    pub so: u32,
328
329    pub os: u32,
330
331    pub sp: u32,
332
333    pub pi: u32,
334
335    pub bi: u32,
336
337    pub ib: u32,
338}
339
340#[repr(C)]
341#[derive(Debug, Clone, Copy)]
342pub struct RedundancyStatus {
343
344    pub state: i32,
345
346    pub primary_link_up: i32,
347
348    pub secondary_link_up: i32,
349
350    pub primary_tx_frames: u32,
351
352    pub primary_rx_frames: u32,
353
354    pub secondary_tx_frames: u32,
355
356    pub secondary_rx_frames: u32,
357
358    pub failover_count: u32,
359
360    pub last_failover_time: u32,
361}
362
363#[repr(C)]
364#[derive(Debug, Clone, Copy)]
365pub struct CommunicationStats {
366    pub total_cycles: u32,
367    pub successful_cycles: u32,
368    pub failed_cycles: u32,
369    pub timeout_cycles: u32,
370    pub average_cycle_time_us: f64,
371    pub max_cycle_time_us: f64,
372    pub min_cycle_time_us: f64,
373}
374
375pub type LogCallback = extern "C" fn(category: c_int, message: *const c_char);
376
377pub type CrashNotifyCallback = extern "C" fn(exception_code: c_int, message: *const c_char);
378
379pub type ProcessDataCyclicCallback = extern "C" fn(master_index: u16);
380
381pub type SlaveStateChangeCallback = extern "C" fn(master_index: u16, slave_index: u16, old_state: c_int, new_state: c_int);
382
383pub type EmergencyEventCallback = extern "C" fn(master_index: u16, slave_index: u16, error_code: u16, error_reg: u16, b1: u8, w1: u16, w2: u16);
384
385pub type SlaveDiscoveryCallback = extern "C" fn(master_index: u16, slave_index: u16, is_found: i32);
386
387pub type InputDataChangedCallback = extern "C" fn(master_index: u16, changed_slave_bits: *const u8, changed_count: u16);
388
389pub type RedundancyModeChangedCallback = extern "C" fn(master_index: u16, old_mode: c_int, new_mode: c_int);
390
391pub type PDOFrameLossCallback = extern "C" fn(master_index: u16, group: u8, consecutive_lost: u32, total_lost: u32);
392
393pub type SlavePreOpReconfigCallback = extern "C" fn(master_index: u16, slave_index: u16);
394
395pub type SlaveIdentityMismatchCallback = extern "C" fn(
396    master_index: u16,
397    slave_index: u16,
398    expected_vendor: u32,
399    expected_product: u32,
400    expected_revision: u32,
401    actual_vendor: u32,
402    actual_product: u32,
403    actual_revision: u32,
404);
405
406pub type SlavePortLinkChangedCallback = extern "C" fn(
407    master_index: u16,
408    slave_index: u16,
409    port: u8,
410    is_up: i32,
411);
412
413pub type FoEProgressCallback = extern "C" fn(slave: u16, packet_number: c_int, data_size: c_int);
414
415pub type FoEBusyCallback = extern "C" fn(
416    slave: u16,
417    done: u16,
418    entire: u16,
419    text: *const c_char,
420    retry_idx: c_int,
421);
422
423pub type DCSyncLostCallback = extern "C" fn(master_index: u16, slave_index: u16, diff_ns: c_int);
424
425pub type AOENotificationCallback = extern "C" fn(
426    slave: u16, handle: u32, timestamp: u64,
427    data: *const c_void, data_size: u32, user_data: *mut c_void,
428);
429
430pub type EOEFrameCallback = unsafe extern "C" fn(
431    master_index: u16, slave: u16, frame_data: *const u8, frame_size: c_int,
432);
433
434pub type VOENotificationCallback = unsafe extern "C" fn(
435    slave: u16, vendor_id: u32, vendor_type: u16,
436    data: *const u8, data_size: u32, user_data: *mut c_void,
437);
438
439pub type SoENotificationCallback = unsafe extern "C" fn(
440    master_index: u16, slave_index: u16, drive_no: u8,
441    idn: u16, element_flags: u8, data: *const c_void, data_len: u16,
442);
443
444pub type SoEEmergencyCallback = extern "C" fn(
445    master_index: u16, slave_index: u16, drive_no: u8, error_code: u16,
446);
447
448#[repr(C)]
449#[derive(Debug, Clone, Copy, Default)]
450pub struct MbgStatsC {
451
452    pub rx_packets: u64,
453
454    pub rx_bytes: u64,
455
456    pub forwarded_ok: u64,
457
458    pub forwarded_failed: u64,
459
460    pub timeout_count: u64,
461
462    pub invalid_frame: u64,
463
464    pub unknown_target: u64,
465
466    pub unsupported_type: u64,
467
468    pub tx_packets: u64,
469
470    pub tx_bytes: u64,
471
472    pub master_requests: u64,
473
474    pub udp_port: u16,
475
476    pub is_running: u8,
477
478    pub reserved: u8,
479
480    pub discovery_requests: u64,
481
482    pub tcp_connections: u64,
483
484    pub tcp_active: u64,
485
486    pub tcp_port: u16,
487
488    pub _pad_tail: [u8; 6],
489}
490
491#[repr(C)]
492#[derive(Debug, Clone, Copy)]
493pub struct EcMbxTransactionC {
494
495    pub slave: u16,
496
497    pub protocol_type: u8,
498
499    pub reserved0: u8,
500
501    pub timeout_us: u32,
502
503    pub cancel_flag: i32,
504
505    pub _pad_ptr1: u32,
506
507    pub request_frame: *mut u8,
508
509    pub request_len: u16,
510
511    pub reserved1: u16,
512
513    pub _pad_ptr2: u32,
514
515    pub response_frame: *mut u8,
516
517    pub response_cap: u16,
518
519    pub response_len: u16,
520
521    pub status: i32,
522
523    pub error_code: u32,
524
525    pub response_counter: u8,
526
527    pub reserved2_0: u8,
528
529    pub reserved2_1: u8,
530
531    pub reserved2_2: u8,
532
533    pub submit_time_us: u64,
534
535    pub complete_time_us: u64,
536}
537
538impl Default for EcMbxTransactionC {
539    fn default() -> Self {
540        Self {
541            slave: 0, protocol_type: 0, reserved0: 0, timeout_us: 0,
542            cancel_flag: 0, _pad_ptr1: 0,
543            request_frame: core::ptr::null_mut(), request_len: 0, reserved1: 0,
544            _pad_ptr2: 0,
545            response_frame: core::ptr::null_mut(), response_cap: 0, response_len: 0,
546            status: 0, error_code: 0,
547            response_counter: 0, reserved2_0: 0, reserved2_1: 0, reserved2_2: 0,
548            submit_time_us: 0, complete_time_us: 0,
549        }
550    }
551}
552
553#[repr(C)]
554#[derive(Debug, Clone, Copy)]
555pub struct MasterIdentity {
556    pub vendor_id: u32,
557    pub product_code: u32,
558    pub revision_no: u32,
559    pub serial_no: u32,
560    pub device_name: [u8; 64],
561    pub hw_version: [u8; 32],
562    pub sw_version: [u8; 32],
563}
564
565impl Default for MasterIdentity {
566    fn default() -> Self {
567        Self {
568            vendor_id: 0,
569            product_code: 0,
570            revision_no: 0,
571            serial_no: 0,
572            device_name: [0; 64],
573            hw_version: [0; 32],
574            sw_version: [0; 32],
575        }
576    }
577}
578
579#[repr(C)]
580#[derive(Debug, Clone, Copy, Default)]
581pub struct MasterDiagData {
582    pub cyclic_lost_frames: u32,
583    pub acyclic_lost_frames: u32,
584    pub cyclic_frames_per_sec: u32,
585    pub acyclic_frames_per_sec: u32,
586    pub master_state: u16,
587}
588
589#[repr(i32)]
590#[derive(Debug, Clone, Copy, PartialEq, Eq)]
591pub enum FsoeState {
592
593    Reset      = 0x100,
594
595    Session    = 0x101,
596
597    Connection = 0x102,
598
599    Parameter  = 0x103,
600
601    Data       = 0x104,
602
603    Failsafe   = 0x105,
604}
605
606#[repr(i32)]
607#[derive(Debug, Clone, Copy, PartialEq, Eq)]
608pub enum FsoeError {
609
610    None              = 0x0000,
611
612    WrongCommand      = 0x0001,
613
614    UnknownCommand    = 0x0002,
615
616    WrongConnId       = 0x0003,
617
618    Crc               = 0x0004,
619
620    Watchdog          = 0x0005,
621
622    WrongAddress      = 0x0006,
623
624    WrongData         = 0x0007,
625
626    CommParamLength   = 0x0008,
627
628    CommParam         = 0x0009,
629
630    AppParamLength    = 0x000A,
631
632    AppParam          = 0x000B,
633
634    UnexpectedSession = 0x000C,
635
636    FailsafeData      = 0x000D,
637
638    NotInitialized    = 0x0100,
639
640    MaxConnections    = 0x0101,
641
642    InvalidState      = 0x0102,
643}
644
645#[repr(C)]
646#[derive(Debug, Clone, Copy)]
647pub struct FsoeConfig {
648
649    pub connection_id: u16,
650
651    pub safety_address: u16,
652
653    pub watchdog_time_ms: u32,
654
655    pub safe_input_size: u16,
656
657    pub safe_output_size: u16,
658
659    pub pdo_input_offset: u32,
660
661    pub pdo_output_offset: u32,
662}
663
664#[repr(C)]
665#[derive(Debug, Clone, Copy)]
666pub struct FsoeStatus {
667
668    pub state: FsoeState,
669
670    pub last_error: FsoeError,
671
672    pub error_count: u32,
673
674    pub frames_sent: u32,
675
676    pub frames_received: u32,
677
678    pub crc_errors: u32,
679
680    pub watchdog_errors: u32,
681
682    pub watchdog_expired: u8,
683
684    pub in_failsafe: u8,
685
686    pub toggle_bit: u8,
687
688    pub initialized: u8,
689}
690
691#[repr(C)]
692#[derive(Debug, Clone, Copy)]
693pub struct SafeMdpConfig {
694
695    pub connection_id: u16,
696
697    pub safety_address: u16,
698
699    pub watchdog_time_ms: u32,
700
701    pub safe_input_size: u16,
702
703    pub safe_output_size: u16,
704
705    pub pdo_input_offset: u32,
706
707    pub pdo_output_offset: u32,
708
709    pub module_number: u16,
710
711    pub module_profile: u16,
712
713    pub axis_number: u16,
714
715    pub connection_type: u16,
716}
717
718#[repr(C)]
719#[derive(Clone, Copy, Debug, Default)]
720pub struct SlaveIoDescBlittable {
721
722    pub bits: u16,
723
724    pub bytes: u32,
725
726    pub ptr: usize,
727
728    pub offset: u32,
729
730    pub startbit: u8,
731}
732
733#[repr(C)]
734#[derive(Clone, Copy, Debug, Default)]
735pub struct SlaveFsoeBlittable {
736
737    pub capable: u8,
738
739    pub connection: usize,
740
741    pub sm_context: usize,
742
743    pub connection_id: u16,
744
745    pub safety_address: u16,
746
747    pub safe_input_size: u16,
748
749    pub safe_output_size: u16,
750
751    pub pdo_input_offset: u32,
752
753    pub pdo_output_offset: u32,
754}
755
756#[repr(C)]
757#[derive(Clone, Copy, Debug, Default)]
758pub struct SlaveMailboxBlittable {
759
760    pub length: u16,
761
762    pub write_offset: u16,
763
764    pub read_length: u16,
765
766    pub read_offset: u16,
767
768    pub supported_proto: u16,
769
770    pub cnt: u8,
771}
772
773#[repr(C)]
774#[derive(Clone, Copy, Debug, Default)]
775pub struct SlaveEepromConfigBlittable {
776
777    pub _reserved_sii: u16,
778
779    pub read_8byte: u8,
780
781    pub pdi: u8,
782}
783
784#[repr(C)]
785#[derive(Clone, Copy, Debug, Default)]
786pub struct SlaveHandlerBlittable {
787
788    pub state: i32,
789
790    pub rmp_state: i32,
791
792    pub instate_ex: u16,
793}
794
795#[repr(C)]
796#[derive(Clone, Copy, Debug, Default)]
797pub struct SlaveIdentityBlittable {
798
799    pub vendor_id: u32,
800
801    pub product_id: u32,
802
803    pub revision: u32,
804
805    pub serial: u32,
806
807    pub itype: u16,
808
809    pub dtype: u16,
810}
811
812#[repr(C)]
813#[derive(Clone, Copy)]
814pub struct SlaveMetadataBlittable {
815
816    pub identity: SlaveIdentityBlittable,
817
818    pub group_name: [u8; 41],
819
820    pub device_name: [u8; 41],
821
822    pub sm_count: u16,
823}
824
825impl Default for SlaveMetadataBlittable {
826    fn default() -> Self {
827        Self {
828            identity: SlaveIdentityBlittable::default(),
829            group_name: [0; 41],
830            device_name: [0; 41],
831            sm_count: 0,
832        }
833    }
834}
835
836#[repr(C)]
837#[derive(Clone, Copy, Debug, Default)]
838pub struct SlaveCapabilitiesBlittable {
839
840    pub is_optional: u8,
841
842    pub supports_frame_repeat: u8,
843
844    pub mailbox_side: u8,
845
846    pub coe_details: u8,
847
848    pub foe_details: u8,
849
850    pub eoe_details: u8,
851
852    pub soe_details: u8,
853}
854
855#[repr(C)]
856#[derive(Clone, Copy, Debug, Default)]
857pub struct SlaveRuntimeBlittable {
858
859    pub ebus_current: i16,
860
861    pub block_lrw: u8,
862
863    pub group: u8,
864
865    pub is_lost: u8,
866
867    pub freerun_demoted: u8,
868
869    pub mbx_health: u8,
870
871    pub health_alstatuscode: u16,
872
873    pub health_degraded_count: u32,
874
875    pub health_probe_us: u64,
876}
877
878#[repr(C)]
879#[derive(Clone, Copy, Debug, Default)]
880pub struct SlaveSmFmmuBlittable {
881
882    pub sm_type: [u8; 8],
883
884    pub sm_app_length: [u16; 8],
885
886    pub fmmu_func: [u8; 4],
887
888    pub fmmu_unused: u8,
889}
890
891#[repr(C)]
892#[derive(Clone, Copy, Debug, Default)]
893pub struct SlaveProtoMbxBlittable {
894
895    pub in_ptr: usize,
896
897    pub in_full: u8,
898
899    pub overrun: i32,
900}
901
902#[repr(C)]
903#[derive(Clone, Copy, Debug, Default)]
904pub struct SlavePdoConfigBlittable {
905
906    pub assignment_enabled: u8,
907
908    pub configuration_enabled: u8,
909
910    pub config_initialized: u8,
911
912    pub supports_complete_access: u8,
913}
914
915#[repr(C)]
916#[derive(Clone, Copy, Debug, Default)]
917pub struct SlaveTopologyBlittable {
918
919    pub has_dc: u8,
920
921    pub phy_type: u8,
922
923    pub link_count: u8,
924
925    pub active_ports: u8,
926
927    pub consumed_ports: u8,
928
929    pub parent: u16,
930
931    pub parent_port: u8,
932
933    pub entry_port: u8,
934}
935
936#[repr(C)]
937#[derive(Clone, Copy, Debug, Default)]
938pub struct SlaveDcBlittable {
939
940    pub recvtime: [i32; 4],
941
942    pub propagation_delay: i32,
943
944    pub next: u16,
945
946    pub prev: u16,
947
948    pub cycle0: i32,
949
950    pub cycle1: i32,
951
952    pub shift: i32,
953
954    pub active: u16,
955}
956
957#[repr(C)]
958#[derive(Clone, Copy)]
959pub struct EcSlaveBlittable {
960
961    pub state: u16,
962
963    pub al_status_code: u16,
964
965    pub config_addr: u16,
966
967    pub alias_addr: u16,
968
969    pub fsoe: SlaveFsoeBlittable,
970
971    pub output: SlaveIoDescBlittable,
972
973    pub input: SlaveIoDescBlittable,
974
975    pub sm_buffer: [u8; 64],
976
977    pub fmmu_buffer: [u8; 64],
978
979    pub sm_fmmu: SlaveSmFmmuBlittable,
980
981    pub mbx: SlaveMailboxBlittable,
982
983    pub topo: SlaveTopologyBlittable,
984
985    pub dc: SlaveDcBlittable,
986
987    pub eeprom_config: SlaveEepromConfigBlittable,
988
989    pub runtime: SlaveRuntimeBlittable,
990
991    pub po2so_config: usize,
992
993    pub handler: SlaveHandlerBlittable,
994
995    pub coe: SlaveProtoMbxBlittable,
996
997    pub soe: SlaveProtoMbxBlittable,
998
999    pub foe: SlaveProtoMbxBlittable,
1000
1001    pub eoe: SlaveProtoMbxBlittable,
1002
1003    pub voe: SlaveProtoMbxBlittable,
1004
1005    pub aoe: SlaveProtoMbxBlittable,
1006
1007    pub mbx_status: usize,
1008
1009    pub metadata: SlaveMetadataBlittable,
1010
1011    pub pdo_config: SlavePdoConfigBlittable,
1012
1013    pub capabilities: SlaveCapabilitiesBlittable,
1014}
1015
1016impl EcSlaveBlittable {
1017
1018    pub fn group_name_str(&self) -> String {
1019        let len = self.metadata.group_name.iter().position(|&b| b == 0).unwrap_or(41);
1020        crate::utils::help::decode_ethercat_string(&self.metadata.group_name[..len])
1021    }
1022
1023    pub fn device_name_str(&self) -> String {
1024        let len = self.metadata.device_name.iter().position(|&b| b == 0).unwrap_or(41);
1025        crate::utils::help::decode_ethercat_string(&self.metadata.device_name[..len])
1026    }
1027}
1028
1029#[link(name = "Darra.Core")]
1030extern "C" {
1031
1032    #[link_name = "D_1547"]
1033    pub fn Initialize() -> u16;
1034    #[link_name = "D_1548"]
1035    pub fn InitializeSpecificMaster(master_index: u16) -> u16;
1036    #[link_name = "D_1549"]
1037    pub fn Dispose(master_index: u16);
1038    #[link_name = "D_1592"]
1039    pub fn Start(master_index: u16);
1040    #[link_name = "D_1593"]
1041    pub fn Stop(master_index: u16);
1042    #[link_name = "D_1047"]
1043    pub fn FreeMemory(ptr: *mut c_void);
1044
1045    #[link_name = "D_1596"]
1046    pub fn GetDllVersionInfo() -> *const DllVersionInfo;
1047
1048    #[link_name = "D_1654"]
1049    pub fn GetDriverVersion() -> *const DriverVersionInfo;
1050
1051    #[link_name = "D_1655"]
1052    pub fn InvalidateDriverVersionCache();
1053
1054    #[link_name = "D_1546"]
1055    pub fn EnsureDriversRunning() -> c_int;
1056
1057    #[link_name = "D_1550"]
1058    pub fn SetNetwork(master_index: u16, adapter: *const c_char, redundant: *const c_char) -> c_int;
1059    #[link_name = "D_1076"]
1060    pub fn GetNetworkInfo(is_redundant: i32, need_slaves_num: i32) -> c_int;
1061    #[link_name = "D_1077"]
1062    pub fn GetNetworksPointer() -> *const c_void;
1063    #[link_name = "D_1080"]
1064    pub fn QuickSlaveCount(adapter_name: *const c_char) -> c_int;
1065    #[link_name = "D_1084"]
1066    pub fn ReadSlaveInfo(adapter_name: *const c_char) -> c_int;
1067    #[link_name = "D_1085"]
1068    pub fn GetScannedSlaveCount() -> c_int;
1069    #[link_name = "D_1086"]
1070    pub fn GetScannedSlaveInfo(
1071        index: c_int, vendor_id: *mut u32, product_code: *mut u32,
1072        revision: *mut u32, serial: *mut u32,
1073        name: *mut c_char, name_size: c_int,
1074        config_addr: *mut u16, alias_addr: *mut u16,
1075        parent: *mut u16, topology: *mut u8, activeports: *mut u8,
1076        entryport: *mut u8, parentport: *mut u8, ptype: *mut u8,
1077    ) -> i32;
1078    #[link_name = "D_1082"]
1079    pub fn GetRingSlaveCount() -> c_int;
1080
1081    #[link_name = "D_1551"]
1082    pub fn SetState(master_index: u16, state: c_int) -> i32;
1083    #[link_name = "D_1092"]
1084    pub fn SetStateWithTimeout(master_index: u16, state: c_int, timeout_ms: u32) -> i32;
1085    #[link_name = "D_1093"]
1086    pub fn SetSlaveStateWithTimeout(master_index: u16, slave_index: u16, state: c_int, timeout_ms: u32) -> i32;
1087    #[link_name = "D_1132"]
1088    pub fn SetStateSequence(master_index: u16, target_state: c_int, timeout_ms: u32) -> i32;
1089    #[link_name = "D_1131"]
1090    pub fn SetStateWithStartup(master_index: u16, target_state: c_int, timeout_ms: u32) -> i32;
1091    #[link_name = "D_1553"]
1092    pub fn GetMasterState(master_index: u16) -> *const c_void;
1093    #[link_name = "D_1555"]
1094    pub fn GetMasterStateCache(master_index: u16) -> *const c_void;
1095    #[link_name = "D_1552"]
1096    pub fn GetLinkStatus(master_index: u16) -> u8;
1097    #[link_name = "D_1094"]
1098    pub fn GetSlaveState(master_index: u16, slave_index: u16) -> u8;
1099    #[link_name = "D_1095"]
1100    pub fn GetSlaveALStatusCode(master_index: u16, slave_index: u16) -> u16;
1101
1102    #[link_name = "D_1700"]
1103    pub fn GetSlaveStateLive(master_index: u16, slave_index: u16) -> u8;
1104
1105    #[link_name = "D_1699"]
1106    pub fn GetSlaveALStatusCodeLive(master_index: u16, slave_index: u16) -> u16;
1107
1108    #[link_name = "D_1557"]
1109    pub fn GetIO(master_index: u16, slave: u16, out_byte_size: *mut c_int, out_byte: *mut *mut u8, in_byte_size: *mut c_int, in_byte: *mut *mut u8) -> u8;
1110    #[link_name = "D_1558"]
1111    pub fn LockIOmap(master_index: u16);
1112    #[link_name = "D_1559"]
1113    pub fn UnlockIOmap(master_index: u16);
1114    #[link_name = "D_1561"]
1115    pub fn WriteSlaveOutput(master_index: u16, slave_index: u16, data: *const u8, size: u32);
1116    #[link_name = "D_1562"]
1117    pub fn WriteSlaveOutputByte(master_index: u16, slave_index: u16, offset: u32, value: u8);
1118    #[link_name = "D_1597"]
1119    pub fn SetMutexProtection(master_index: u16, enable: i32);
1120    #[link_name = "D_1560"]
1121    pub fn GetMutexProtection(master_index: u16) -> i32;
1122
1123    #[link_name = "D_1572"]
1124    pub fn SDOread(master_index: u16, slave: u16, index: u16, subindex: u8, ca: i32, out_byte_size: *mut c_int) -> *mut u8;
1125    #[link_name = "D_1571"]
1126    pub fn SDOwrite_raw(master_index: u16, slave: u16, index: u16, subindex: u8, ca: i32, bytes: *const u8, length: c_int) -> u8;
1127
1128    #[link_name = "D_1573"]
1129    pub fn SDOread_ex(master_index: u16, slave: u16, index: u16, subindex: u8, ca: i32,
1130                      out_byte_size: *mut c_int, out_abort_code: *mut u32, out_wkc: *mut c_int) -> *mut u8;
1131
1132    #[link_name = "D_1574"]
1133    pub fn SDOwrite_ex(master_index: u16, slave: u16, index: u16, subindex: u8, ca: i32,
1134                       bytes: *const u8, length: c_int, out_abort_code: *mut u32, out_wkc: *mut c_int) -> c_int;
1135
1136    #[link_name = "D_1564"]
1137    pub fn GetSlaveSDOList(master_index: u16, slave_index: u16) -> *const c_void;
1138    #[link_name = "D_1563"]
1139    pub fn GetSlaveSDOListBasic(master_index: u16, slave_index: u16) -> *const c_void;
1140    #[link_name = "D_1569"]
1141    pub fn GetSlavePointer_SDO_Value(master_index: u16, slave_index: u16, od_index: u16, oe_index: u8, out_byte_size: *mut c_int) -> *mut u8;
1142    #[link_name = "D_1570"]
1143    pub fn GetSlavePointer_SDO_IndexValue(master_index: u16, slave_index: u16, index: u16, subidx: u8, out_byte_size: *mut c_int) -> *mut u8;
1144    #[link_name = "D_1556"]
1145    pub fn GetSlave(master_index: u16, slave_index: u16) -> *const c_void;
1146    #[link_name = "D_1330"]
1147    pub fn GetSlaveDetailedInfo(master_index: u16, slave_index: u16) -> *const c_void;
1148
1149    #[link_name = "D_1501"]
1150    pub fn SoERead(master_index: u16, slave: u16, drive_no: u8, element_flags: u8, idn: u16, data: *mut *mut c_void, data_size: *mut c_int, timeout: c_int) -> i32;
1151    #[link_name = "D_1502"]
1152    pub fn SoEWrite(master_index: u16, slave: u16, drive_no: u8, element_flags: u8, idn: u16, data: *const u8, data_size: c_int, timeout: c_int) -> i32;
1153    #[link_name = "D_1503"]
1154    pub fn SoEReadAttributes(master_index: u16, slave: u16, drive_no: u8, idn: u16, attributes: *mut u32, timeout: c_int) -> i32;
1155    #[link_name = "D_1504"]
1156    pub fn SoEReadName(master_index: u16, slave: u16, drive_no: u8, idn: u16, name: *mut *mut c_void, name_length: *mut c_int, timeout: c_int) -> i32;
1157    #[link_name = "D_1505"]
1158    pub fn SoEReadUnit(master_index: u16, slave: u16, drive_no: u8, idn: u16, unit: *mut *mut c_void, unit_length: *mut c_int, timeout: c_int) -> i32;
1159    #[link_name = "D_1506"]
1160    pub fn SoEReadIDNList(master_index: u16, slave: u16, drive_no: u8, idn_list: *mut *mut u16, list_count: *mut c_int, timeout: c_int) -> i32;
1161    #[link_name = "D_1507"]
1162    pub fn SoEReadMinMax(master_index: u16, slave: u16, drive_no: u8, idn: u16,
1163                         min_value: *mut *mut c_void, min_size: *mut c_int,
1164                         max_value: *mut *mut c_void, max_size: *mut c_int,
1165                         timeout: c_int) -> i32;
1166
1167    #[link_name = "D_1058"]
1168    pub fn RegisterSoENotificationCallback(callback: SoENotificationCallback);
1169
1170    #[link_name = "D_1059"]
1171    pub fn RegisterSoEEmergencyCallback(callback: SoEEmergencyCallback);
1172
1173    #[link_name = "D_1649"]
1174    pub fn UnregisterSoENotificationCallback(callback: SoENotificationCallback);
1175
1176    #[link_name = "D_1650"]
1177    pub fn UnregisterSoEEmergencyCallback(callback: SoEEmergencyCallback);
1178
1179    #[link_name = "D_1476"]
1180    pub fn FOERead(master_index: u16, slave: u16, filename: *const c_char, password: u32, file_data: *mut *mut c_void, file_size: *mut c_int, timeout: c_int) -> i32;
1181    #[link_name = "D_1477"]
1182    pub fn FOEWrite(master_index: u16, slave: u16, filename: *const c_char, password: u32, file_data: *const c_void, file_size: c_int, timeout: c_int) -> i32;
1183    #[link_name = "D_1480"]
1184    pub fn FOEReadEx(master_index: u16, slave: u16, filename: *const c_char, password: u32, file_data: *mut *mut c_void, file_size: *mut c_int, timeout: c_int, options: *mut FoEOptions) -> i32;
1185    #[link_name = "D_1481"]
1186    pub fn FOEWriteEx(master_index: u16, slave: u16, filename: *const c_char, password: u32, file_data: *const c_void, file_size: c_int, timeout: c_int, options: *mut FoEOptions) -> i32;
1187    #[link_name = "D_1478"]
1188    pub fn FOESetProgressHook(master_index: u16, callback: Option<FoEProgressCallback>) -> i32;
1189    #[link_name = "D_1479"]
1190    pub fn FOEClearProgressHook(master_index: u16) -> i32;
1191
1192    #[link_name = "D_1485"]
1193    pub fn EOESetIP(master_index: u16, slave: u16, port: u8, ip: u32, subnet: u32, gateway: u32, timeout: c_int) -> i32;
1194    #[link_name = "D_1486"]
1195    pub fn EOEGetIP(master_index: u16, slave: u16, port: u8, ip: *mut u32, subnet: *mut u32, gateway: *mut u32, timeout: c_int) -> i32;
1196    #[link_name = "D_1495"]
1197    pub fn EOESendFrame(master_index: u16, slave: u16, port: u8, frame_data: *const u8, frame_size: c_int, timeout: c_int) -> i32;
1198    #[link_name = "D_1496"]
1199    pub fn EOEReceiveFrame(master_index: u16, slave: u16, port: u8, frame_data: *mut *mut c_void, frame_size: *mut c_int, timeout: c_int) -> i32;
1200    #[link_name = "D_1487"]
1201    pub fn EOESetMAC(master_index: u16, slave: u16, port: u8, mac: *const u8, timeout: c_int) -> i32;
1202    #[link_name = "D_1488"]
1203    pub fn EOEGetMAC(master_index: u16, slave: u16, port: u8, mac: *mut u8, timeout: c_int) -> i32;
1204
1205    #[link_name = "D_1508"]
1206    pub fn AOESendCommand(master_index: u16, slave: u16, target_port: u16, command_id: u16, command_data: *const u8, command_size: u32, response_data: *mut *mut c_void, response_size: *mut u32, timeout: c_int) -> i32;
1207    #[link_name = "D_1509"]
1208    pub fn AOEReadWrite(master_index: u16, slave: u16, index_group: u32, index_offset: u32, read_length: u32, write_length: u32, write_data: *const u8, read_data: *mut *mut c_void, bytes_read: *mut u32, timeout: c_int) -> i32;
1209    #[link_name = "D_1510"]
1210    pub fn AOEReadDeviceInfo(master_index: u16, slave: u16, major_ver: *mut u8, minor_ver: *mut u8, build: *mut u16, device_name: *mut u8, name_size: c_int, timeout: c_int) -> i32;
1211    #[link_name = "D_1511"]
1212    pub fn AOEReadState(master_index: u16, slave: u16, ads_state: *mut u16, device_state: *mut u16, timeout: c_int) -> i32;
1213    #[link_name = "D_1512"]
1214    pub fn AOEWriteControl(master_index: u16, slave: u16, ads_state: u16, device_state: u16, data: *const u8, data_size: c_int, timeout: c_int) -> i32;
1215    #[link_name = "D_1513"]
1216    pub fn AOEAddNotification(master_index: u16, slave: u16,
1217                              index_group: u32, index_offset: u32, length: u32,
1218                              trans_mode: u32, max_delay: u32, cycle_time: u32,
1219                              handle: *mut u32, timeout: c_int) -> i32;
1220    #[link_name = "D_1514"]
1221    pub fn AOEDelNotification(master_index: u16, slave: u16, handle: u32, timeout: c_int) -> i32;
1222    #[link_name = "D_1515"]
1223    pub fn AOESetConfig(master_index: u16, slave: u16,
1224                        target_net_id: *const u8, target_port: u16,
1225                        source_net_id: *const u8, source_port: u16) -> i32;
1226    #[link_name = "D_1516"]
1227    pub fn AOEGetConfig(master_index: u16, slave: u16,
1228                        target_net_id: *mut u8, target_port: *mut u16,
1229                        source_net_id: *mut u8, source_port: *mut u16) -> i32;
1230
1231    #[link_name = "D_1062"]
1232    pub fn AOEGetLastError(master_index: u16, slave: u16,
1233                           error_code: *mut u32, error_class: *mut u16,
1234                           error_low: *mut u16, last_command: *mut u16) -> i32;
1235
1236    #[link_name = "D_1063"]
1237    pub fn AOEClearLastError(master_index: u16, slave: u16);
1238
1239    #[link_name = "D_1064"]
1240    pub fn AOEInitSlaveNetId(master_index: u16, master_net_id: *const u8, timeout: c_int) -> c_int;
1241
1242    #[link_name = "D_1065"]
1243    pub fn AOEReadWriteEx(master_index: u16, slave: u16,
1244                          index_group: u32, index_offset: u32,
1245                          read_length: u32, write_length: u32, write_data: *const u8,
1246                          read_data: *mut *mut c_void, actual_read: *mut u32, timeout: c_int) -> i32;
1247
1248    #[link_name = "D_1066"]
1249    pub fn AOESendFragmented(master_index: u16, slave: u16,
1250                             payload: *const u8, payload_len: u32,
1251                             packet_number: u16, timeout: c_int) -> i32;
1252
1253    #[link_name = "D_1067"]
1254    pub fn AOERecvReassemble(master_index: u16, slave: u16,
1255                             out_buffer: *mut u8, out_cap: u32,
1256                             packet_number: u16, timeout: c_int, out_len: *mut u32) -> i32;
1257
1258    #[link_name = "D_1068"]
1259    pub fn AOEPeekInvokeId(master_index: u16, slave: u16) -> u32;
1260
1261    #[link_name = "D_1518"]
1262    pub fn VOESend(master_index: u16, slave: u16, vendor_id: u32, vendor_type: u16, data: *const u8, data_size: c_int, timeout: c_int) -> i32;
1263    #[link_name = "D_1519"]
1264    pub fn VOEReceive(master_index: u16, slave: u16, vendor_id: *mut u32, vendor_type: *mut u16, data: *mut *mut c_void, data_size: *mut c_int, timeout: c_int) -> i32;
1265    #[link_name = "D_1520"]
1266    pub fn VOESendRaw(master_index: u16, slave: u16, frame_data: *const u8, frame_size: c_int, timeout: c_int) -> i32;
1267    #[link_name = "D_1521"]
1268    pub fn VOEReceiveRaw(master_index: u16, slave: u16, frame_data: *mut *mut c_void, frame_size: *mut c_int, timeout: c_int) -> i32;
1269    #[link_name = "D_1517"]
1270    pub fn VOEIsSupported(master_index: u16, slave: u16) -> i32;
1271
1272    #[link_name = "D_1135"]
1273    pub fn EcInit(json_config: *const c_char) -> u16;
1274    #[link_name = "D_1136"]
1275    pub fn EcInitFromFile(json_file_path: *const c_char) -> u16;
1276    #[link_name = "D_1137"]
1277    pub fn EcClose(master_index: u16);
1278    #[link_name = "D_1133"]
1279    pub fn LoadConfigJson(master_index: u16, json_str: *const c_char) -> c_int;
1280    #[link_name = "D_1134"]
1281    pub fn AutoConfigureSM(master_index: u16, slave_index: u16) -> c_int;
1282    pub fn DarraCoreInvoke(master_index: u16, command: u32, arg0: u32, arg1: u32, arg2: u32) -> c_int;
1283    pub fn DarraCoreInvokeText(master_index: u16, command: u32, text: *const c_char, arg0: u32, arg1: u32, arg2: u32) -> c_int;
1284
1285    #[link_name = "D_1125"]
1286    pub fn AddStartupParameter(master_index: u16, slave_index: u16, param: *const StartupParam) -> c_int;
1287    #[link_name = "D_1126"]
1288    pub fn AddStartupParameterBatch(master_index: u16, slave_index: u16, param_array: *const StartupParam, count: c_int) -> c_int;
1289    #[link_name = "D_1127"]
1290    pub fn ClearStartupParameters(master_index: u16, slave_index: u16) -> c_int;
1291    #[link_name = "D_1128"]
1292    pub fn GetStartupParameterCount(master_index: u16, slave_index: u16) -> c_int;
1293    #[link_name = "D_1129"]
1294    pub fn ApplyStartupParameters(master_index: u16, slave_index: u16, transition: u8, timing: u8) -> c_int;
1295    #[link_name = "D_1130"]
1296    pub fn ApplyStartupParametersAll(master_index: u16, transition: u8, timing: u8) -> c_int;
1297
1298    #[link_name = "D_1087"]
1299    pub fn SetMasterDCCycleTime(master_index: u16, time_ns: u32);
1300    #[link_name = "D_1088"]
1301    pub fn SetMasterLoopCycleTime(master_index: u16, time_ns: u32);
1302    #[link_name = "D_1090"]
1303    pub fn SetSyncBySlaveIndex(master_index: u16, slave_index: u16, sync0_ns: u32, sync1_ns: u32, shift_ns: i32);
1304    #[link_name = "D_1278"]
1305    pub fn ConfigureDCAll(master_index: u16, sync0_ns: u32, sync1_ns: u32) -> c_int;
1306    #[link_name = "D_1274"]
1307    pub fn UpdatePropagationDelays(master_index: u16) -> c_int;
1308    #[link_name = "D_1277"]
1309    pub fn AutoCalculateDCShift(master_index: u16) -> c_int;
1310    #[link_name = "D_1275"]
1311    pub fn GetSlavePropagationDelay(master_index: u16, slave_index: u16) -> i32;
1312    #[link_name = "D_1276"]
1313    pub fn GetMaxPropagationDelay(master_index: u16) -> i32;
1314    #[link_name = "D_1279"]
1315    pub fn EnableContinuousMeasurement(master_index: u16, enable: i32, interval_sec: u32);
1316    #[link_name = "D_1280"]
1317    pub fn EnableDriftCompensation(master_index: u16, enable: i32, threshold_ns: i32, gain: i32);
1318    #[link_name = "D_1023"]
1319    pub fn SetDCAutoShiftEnabled(master_index: u16, enable: i32);
1320    #[link_name = "D_1024"]
1321    pub fn GetDCAutoShiftEnabled(master_index: u16) -> i32;
1322
1323    #[link_name = "D_1281"]
1324    pub fn GetSlaveSyncWindowStatus(master_index: u16, slave_index: u16,
1325                                    diff_ns: *mut c_int, max_diff_ns: *mut c_int, min_diff_ns: *mut c_int,
1326                                    in_sync: *mut i32, out_of_sync_count: *mut u32) -> i32;
1327    #[link_name = "D_1283"]
1328    pub fn SetSyncWindowThreshold(master_index: u16, threshold_ns: c_int);
1329    #[link_name = "D_1284"]
1330    pub fn GetSyncWindowThreshold(master_index: u16) -> c_int;
1331    #[link_name = "D_1285"]
1332    pub fn ResetSlaveSyncWindowStats(master_index: u16, slave_index: u16);
1333    #[link_name = "D_1286"]
1334    pub fn GetMaxSyncDifference(master_index: u16) -> c_int;
1335    #[link_name = "D_1289"]
1336    pub fn IsAllSlavesInSync(master_index: u16) -> i32;
1337
1338    #[link_name = "D_1016"]
1339    pub fn GetAvailableCpuCores() -> c_int;
1340    #[link_name = "D_1017"]
1341    pub fn SetMasterCpuAffinity(master_index: u16, cpu_core: c_int) -> i32;
1342    #[link_name = "D_1018"]
1343    pub fn SetProcessCpuAffinity(cpu_core: c_int) -> i32;
1344    #[link_name = "D_1021"]
1345    pub fn SetPDOThreadCpuAffinity(master_index: u16, cpu_core: c_int) -> i32;
1346    #[link_name = "D_1022"]
1347    pub fn GetPDOThreadCpuAffinity(master_index: u16) -> c_int;
1348    #[link_name = "D_1595"]
1349    pub fn ApplyRealtimeOptimizations() -> i32;
1350    #[link_name = "D_1019"]
1351    pub fn RemoveRealtimeOptimizations() -> i32;
1352    #[link_name = "D_1020"]
1353    pub fn GetRealtimeOptimizationsStatus() -> i32;
1354    #[link_name = "D_1089"]
1355    pub fn GetTimingMode(master_index: u16) -> u32;
1356
1357    #[link_name = "D_1005"]
1358    pub fn SetSlaveGroup(master_index: u16, slave_index: u16, group: u8) -> i32;
1359    #[link_name = "D_1006"]
1360    pub fn GetSlaveGroup(master_index: u16, slave_index: u16) -> u8;
1361    #[link_name = "D_1007"]
1362    pub fn SetGroupCycleDivider(master_index: u16, group: u8, divider: u8) -> i32;
1363    #[link_name = "D_1008"]
1364    pub fn GetGroupCycleDivider(master_index: u16, group: u8) -> u8;
1365    #[link_name = "D_1009"]
1366    pub fn SetGroupEnabled(master_index: u16, group: u8, enabled: i32) -> i32;
1367    #[link_name = "D_1010"]
1368    pub fn GetGroupEnabled(master_index: u16, group: u8) -> i32;
1369    #[link_name = "D_1011"]
1370    pub fn GetGroupExpectedWKC(master_index: u16, group: u8) -> u16;
1371    #[link_name = "D_1014"]
1372    pub fn GetActiveGroupCount(master_index: u16) -> u8;
1373    #[link_name = "D_1015"]
1374    pub fn GetGroupSlaveCount(master_index: u16, group: u8) -> u16;
1375
1376    #[link_name = "D_1117"]
1377    pub fn SetSlaveWatchdog(master_index: u16, slave_index: u16, timeout_ms: u32) -> i32;
1378    #[link_name = "D_1118"]
1379    pub fn SetSlavePdiWatchdog(master_index: u16, slave_index: u16, timeout_ms: u32) -> i32;
1380    #[link_name = "D_1119"]
1381    pub fn GetSlaveWatchdogConfig(master_index: u16, slave_index: u16, config: *mut WatchdogConfig) -> i32;
1382    #[link_name = "D_1120"]
1383    pub fn GetSlaveWatchdogStatus(master_index: u16, slave_index: u16, status: *mut WatchdogStatus) -> i32;
1384    #[link_name = "D_1121"]
1385    pub fn SetAllSlaveWatchdog(master_index: u16, timeout_ms: u32) -> c_int;
1386    #[link_name = "D_1122"]
1387    pub fn SetAllSlavePdiWatchdog(master_index: u16, timeout_ms: u32) -> c_int;
1388
1389    #[link_name = "D_1103"]
1390    pub fn GetSlaveIdentity(master_index: u16, slave_index: u16, identity: *mut SlaveIdentity) -> i32;
1391    #[link_name = "D_1104"]
1392    pub fn VerifySlaveIdentity(master_index: u16, slave_index: u16, expected: *const SlaveIdentity, check_rev: i32, check_serial: i32) -> i32;
1393    #[link_name = "D_1113"]
1394    pub fn SetSlaveOptional(master_index: u16, slave_index: u16, is_optional: i32) -> i32;
1395    #[link_name = "D_1114"]
1396    pub fn GetSlaveOptional(master_index: u16, slave_index: u16) -> i32;
1397    #[link_name = "D_1115"]
1398    pub fn SetSlaveSupportsFrameRepeat(master_index: u16, slave_index: u16, supports: i32) -> i32;
1399    #[link_name = "D_1116"]
1400    pub fn GetSlaveSupportsFrameRepeat(master_index: u16, slave_index: u16) -> i32;
1401
1402    #[link_name = "D_1101"]
1403    pub fn GetSlaveEsmTimeouts(master_index: u16, slave_index: u16, timeouts: *mut EsmTimeouts) -> i32;
1404    #[link_name = "D_1102"]
1405    pub fn SetSlaveEsmTimeouts(master_index: u16, slave_index: u16, timeouts: *const EsmTimeouts) -> i32;
1406
1407    #[link_name = "D_1106"]
1408    pub fn WriteSlaveRegister(master_index: u16, slave_index: u16, reg_addr: u16, data: *const u8, len: u32) -> i32;
1409    #[link_name = "D_1107"]
1410    pub fn ReadSlaveRegister(master_index: u16, slave_index: u16, reg_addr: u16, data: *mut u8, len: u32) -> i32;
1411    #[link_name = "D_1263"]
1412    pub fn SIIReadWord(master_index: u16, slave_index: u16, word_addr: u16, out_value: *mut u16) -> i32;
1413    #[link_name = "D_1264"]
1414    pub fn SIIWriteWord(master_index: u16, slave_index: u16, word_addr: u16, value: u16) -> i32;
1415
1416    #[link_name = "D_1265"]
1417    pub fn SIIReadControlReg(master_index: u16, slave_index: u16, out_ctrl: *mut u8) -> i32;
1418
1419    #[link_name = "D_1266"]
1420    pub fn SIIAcquire(master_index: u16, slave_index: u16) -> i32;
1421
1422    #[link_name = "D_1267"]
1423    pub fn SIIRelease(master_index: u16, slave_index: u16) -> i32;
1424
1425    #[link_name = "D_1268"]
1426    pub fn SIIFindCategory(master_index: u16, slave_index: u16, cat_type: u16,
1427                           out_byte_offset: *mut u32, out_byte_size: *mut u32) -> i32;
1428
1429    #[link_name = "D_1269"]
1430    pub fn SIIReadCategory(master_index: u16, slave_index: u16, cat_type: u16,
1431                           buffer: *mut u8, max_bytes: u32, out_actual_bytes: *mut u32) -> i32;
1432
1433    #[link_name = "D_1270"]
1434    pub fn SIIEnumerateCategories(master_index: u16, slave_index: u16,
1435                                  out_types: *mut u16, max_count: c_int) -> i32;
1436
1437    #[link_name = "D_1271"]
1438    pub fn SIIGetStrings(master_index: u16, slave_index: u16, buffer: *mut u8, max_bytes: u32) -> i32;
1439
1440    #[link_name = "D_1272"]
1441    pub fn SIIGetStringByIndex(master_index: u16, slave_index: u16, string_index: u8,
1442                               buffer: *mut u8, max_bytes: u32) -> i32;
1443
1444    #[link_name = "D_1273"]
1445    pub fn SIIGetGeneralInfo(master_index: u16, slave_index: u16, out_info: *mut SiiGeneralInfo) -> i32;
1446    #[link_name = "D_1111"]
1447    pub fn ConfigureSyncManager(master_index: u16, slave_index: u16,
1448                                sm_index: u8, start_addr: u16, length: u16,
1449                                control: u8, enable: i32) -> i32;
1450    #[link_name = "D_1112"]
1451    pub fn ConfigureFMMU(master_index: u16, slave_index: u16,
1452                         fmmu_index: u8, logical_addr: u32, length: u16,
1453                         logical_start_bit: u8, logical_end_bit: u8,
1454                         physical_addr: u16, physical_start_bit: u8,
1455                         fmmu_type: u8, enable: i32) -> i32;
1456
1457    #[link_name = "D_1538"]
1458    pub fn SetRedProcessdata(mode: c_int);
1459    #[link_name = "D_1539"]
1460    pub fn GetRedProcessdata() -> c_int;
1461    #[link_name = "D_1534"]
1462    pub fn EnableRedundancy(master_index: u16, enable: i32) -> i32;
1463    #[link_name = "D_1535"]
1464    pub fn GetRedundancyStatus(master_index: u16) -> *const c_void;
1465    #[link_name = "D_1536"]
1466    pub fn ForceRedundancyFailover(master_index: u16) -> i32;
1467    #[link_name = "D_1537"]
1468    pub fn CheckRedundancyHealth(master_index: u16) -> i32;
1469
1470    #[link_name = "D_1026"]
1471    pub fn SetLogCallback(callback: LogCallback);
1472    #[link_name = "D_1004"]
1473    pub fn SetCrashCallback(callback: CrashNotifyCallback);
1474    #[link_name = "D_1028"]
1475    pub fn SetPDOLogging(enable: i32);
1476    #[link_name = "D_1029"]
1477    pub fn SetMailboxLogging(enable: i32);
1478    #[link_name = "D_1030"]
1479    pub fn SetDebugLogging(enable: i32);
1480
1481    #[link_name = "D_1031"]
1482    pub fn CloseDebugLog();
1483
1484    #[link_name = "D_1032"]
1485    pub fn RegisterProcessDataCyclicCallbackSync(callback: ProcessDataCyclicCallback);
1486
1487    #[link_name = "D_1033"]
1488    pub fn RegisterProcessDataCyclicCallbackAsync(callback: ProcessDataCyclicCallback);
1489    #[link_name = "D_1034"]
1490    pub fn RegisterSlaveStateChangeCallbackSync(callback: SlaveStateChangeCallback);
1491    #[link_name = "D_1035"]
1492    pub fn RegisterSlaveStateChangeCallbackAsync(callback: SlaveStateChangeCallback);
1493    #[link_name = "D_1036"]
1494    pub fn RegisterEmergencyEventCallback(callback: EmergencyEventCallback);
1495    #[link_name = "D_1037"]
1496    pub fn RegisterSlaveDiscoveryCallbackSync(callback: SlaveDiscoveryCallback);
1497    #[link_name = "D_1038"]
1498    pub fn RegisterSlaveDiscoveryCallbackAsync(callback: SlaveDiscoveryCallback);
1499
1500    #[link_name = "D_1043"]
1501    pub fn RegisterInputDataChangedCallback(callback: InputDataChangedCallback);
1502    #[link_name = "D_1040"]
1503    pub fn RegisterRedundancyModeChangedCallback(callback: RedundancyModeChangedCallback);
1504    #[link_name = "D_1039"]
1505    pub fn RegisterPDOFrameLossCallback(callback: PDOFrameLossCallback);
1506    #[link_name = "D_1041"]
1507    pub fn RegisterSlavePreOpReconfigCallback(callback: SlavePreOpReconfigCallback);
1508
1509    #[link_name = "D_1042"]
1510    pub fn RegisterSlaveIdentityMismatchCallback(callback: SlaveIdentityMismatchCallback);
1511
1512    #[link_name = "D_1044"]
1513    pub fn RegisterSlavePortLinkChangedCallback(callback: SlavePortLinkChangedCallback);
1514
1515    #[cfg(any(debug_assertions, feature = "internal-dlport"))]
1516    #[link_name = "D_1108"]
1517    pub fn WriteSlaveDLPORT(master_index: u16, slave_index: u16, dlport_value: u8) -> c_int;
1518
1519    #[cfg(any(debug_assertions, feature = "internal-dlport"))]
1520    #[link_name = "D_1109"]
1521    pub fn ReadSlaveDLPORT(master_index: u16, slave_index: u16, dlport_value: *mut u8) -> c_int;
1522    #[link_name = "D_1282"]
1523    pub fn SetDCSyncLostCallback(callback: DCSyncLostCallback);
1524
1525    #[link_name = "D_1313"]
1526    pub fn GetDetailedDiagnostics(master_index: u16) -> *const c_void;
1527    #[link_name = "D_1314"]
1528    pub fn ResetDiagnostics(master_index: u16);
1529    #[link_name = "D_1312"]
1530    pub fn GetDiagnosticsPointer(master_index: u16) -> *const c_void;
1531    #[link_name = "D_1316"]
1532    pub fn GetSummaryPointer(master_index: u16) -> *const c_void;
1533    #[link_name = "D_1290"]
1534    pub fn SetDiagnosticsEnabled(master_index: u16, enable: i32);
1535    #[link_name = "D_1291"]
1536    pub fn GetDiagnosticsEnabled(master_index: u16) -> i32;
1537    #[link_name = "D_1053"]
1538    pub fn GetCommunicationStats(master_index: u16) -> *const c_void;
1539    #[link_name = "D_1054"]
1540    pub fn ResetCommunicationStats(master_index: u16);
1541
1542    #[link_name = "D_1295"]
1543    pub fn GetExpectedWKC(master: u16) -> u16;
1544    #[link_name = "D_1311"]
1545    pub fn SetExpectedWKC(master: u16, expected_wkc: u16);
1546
1547    #[link_name = "D_1303"]
1548    pub fn GetPacketLossRate(master: u16) -> f32;
1549    #[link_name = "D_1304"]
1550    pub fn GetLateFrameRate(master: u16) -> f32;
1551    #[link_name = "D_1315"]
1552    pub fn GetSlaveLinkQuality(master: u16, slave: u16) -> i16;
1553
1554    #[link_name = "D_1293"]
1555    pub fn RecordPDOCycleStart(master: u16);
1556    #[link_name = "D_1294"]
1557    pub fn RecordWKC(master: u16, wkc: u16);
1558    #[link_name = "D_1292"]
1559    pub fn UpdateDiagnosticsSnapshot(master: u16);
1560    #[link_name = "D_1320"]
1561    pub fn ResetSlavePortErrorCounters(master: u16, slave: u16) -> i32;
1562
1563    #[link_name = "D_1296"]
1564    pub fn GetPrimaryWKC() -> u16;
1565
1566    #[link_name = "D_1297"]
1567    pub fn GetSecondaryWKC() -> u16;
1568
1569    #[link_name = "D_1623"]
1570    pub fn IsWdkAvailable(master_index: u16) -> i32;
1571    #[link_name = "D_1624"]
1572    pub fn SetWdkMode(master_index: u16, enable: i32) -> i32;
1573    #[link_name = "D_1625"]
1574    pub fn GetWdkMode(master_index: u16) -> i32;
1575    #[link_name = "D_1626"]
1576    pub fn StartWdkRT(master_index: u16, cycle_us: u32, cpu_index: u32) -> i32;
1577    #[link_name = "D_1627"]
1578    pub fn StopWdkRT(master_index: u16) -> i32;
1579
1580    #[link_name = "D_1543"]
1581    pub fn SetUdpMode(master_index: u16, enable: i32) -> i32;
1582    #[link_name = "D_1544"]
1583    pub fn GetUdpMode(master_index: u16) -> i32;
1584    #[link_name = "D_1545"]
1585    pub fn IsUdpAvailable(master_index: u16) -> i32;
1586
1587    #[link_name = "D_1072"]
1588    pub fn AbortScan();
1589    #[link_name = "D_1073"]
1590    pub fn ResetScanAbort();
1591    #[link_name = "D_1609"]
1592    pub fn AbortNetwork();
1593    #[link_name = "D_1610"]
1594    pub fn ResetAbortNetwork();
1595    #[link_name = "D_1612"]
1596    pub fn EmergencyCloseNics();
1597
1598    #[link_name = "D_1138"]
1599    pub fn CiA402_ParseState(statusword: u16) -> i32;
1600    #[link_name = "D_1139"]
1601    pub fn CiA402_GetEnableCommand(statusword: u16) -> u16;
1602    #[link_name = "D_1140"]
1603    pub fn CiA402_SetMode(master: u16, slave: u16, mode: i8) -> i32;
1604    #[link_name = "D_1141"]
1605    pub fn CiA402_GetMode(master: u16, slave: u16) -> i8;
1606    #[link_name = "D_1142"]
1607    pub fn CiA402_ReadStatusWord(master: u16, slave: u16) -> u16;
1608    #[link_name = "D_1143"]
1609    pub fn CiA402_WriteControlWord(master: u16, slave: u16, cw: u16) -> i32;
1610    #[link_name = "D_1144"]
1611    pub fn CiA402_Enable(master: u16, slave: u16, max_retries: i32) -> i32;
1612    #[link_name = "D_1145"]
1613    pub fn CiA402_FaultReset(master: u16, slave: u16) -> i32;
1614
1615    #[link_name = "D_1168"]
1616    pub fn EmcyGetHistory(master: u16, slave: u16, out: *mut EmcyRecord, max: i32) -> i32;
1617    #[link_name = "D_1169"]
1618    pub fn EmcyClearHistory(master: u16, slave: u16);
1619    #[link_name = "D_1170"]
1620    pub fn EmcyGetCount(master: u16, slave: u16) -> i32;
1621
1622    #[link_name = "D_1171"]
1623    pub fn PDOReadInputU8(master: u16, slave: u16, offset: u32) -> u8;
1624    #[link_name = "D_1172"]
1625    pub fn PDOReadInputI16(master: u16, slave: u16, offset: u32) -> i16;
1626    #[link_name = "D_1173"]
1627    pub fn PDOReadInputU16(master: u16, slave: u16, offset: u32) -> u16;
1628    #[link_name = "D_1174"]
1629    pub fn PDOReadInputI32(master: u16, slave: u16, offset: u32) -> i32;
1630    #[link_name = "D_1175"]
1631    pub fn PDOReadInputU32(master: u16, slave: u16, offset: u32) -> u32;
1632    #[link_name = "D_1176"]
1633    pub fn PDOReadInputF32(master: u16, slave: u16, offset: u32) -> f32;
1634    #[link_name = "D_1177"]
1635    pub fn PDOWriteOutputU8(master: u16, slave: u16, offset: u32, val: u8) -> i32;
1636    #[link_name = "D_1178"]
1637    pub fn PDOWriteOutputI16(master: u16, slave: u16, offset: u32, val: i16) -> i32;
1638    #[link_name = "D_1179"]
1639    pub fn PDOWriteOutputU16(master: u16, slave: u16, offset: u32, val: u16) -> i32;
1640    #[link_name = "D_1180"]
1641    pub fn PDOWriteOutputI32(master: u16, slave: u16, offset: u32, val: i32) -> i32;
1642    #[link_name = "D_1181"]
1643    pub fn PDOWriteOutputU32(master: u16, slave: u16, offset: u32, val: u32) -> i32;
1644    #[link_name = "D_1182"]
1645    pub fn PDOWriteOutputF32(master: u16, slave: u16, offset: u32, val: f32) -> i32;
1646
1647    #[link_name = "D_1325"]
1648    pub fn GetTopology(master: u16, out: *mut TopologyNode, max: c_int) -> c_int;
1649    #[link_name = "D_1326"]
1650    pub fn GetSlaveActivePorts(master: u16, slave: u16) -> u8;
1651    #[link_name = "D_1327"]
1652    pub fn GetSlaveParent(master: u16, slave: u16) -> u16;
1653    #[link_name = "D_1183"]
1654    pub fn TopologyBuild(master: u16, out: *mut TopologyNode, max: c_int) -> c_int;
1655    #[link_name = "D_1184"]
1656    pub fn TopologyGetChildren(master: u16, parent_index: u16, out: *mut u16, max: c_int) -> c_int;
1657    #[link_name = "D_1185"]
1658    pub fn TopologyGetRoots(master: u16, out: *mut u16, max: c_int) -> c_int;
1659
1660    #[link_name = "D_1048"]
1661    pub fn GetSerialNumber() -> *const c_char;
1662
1663    #[link_name = "D_1049"]
1664    pub fn GetDeviceName() -> *const c_char;
1665
1666    #[link_name = "D_1050"]
1667    pub fn GetUserEmail() -> *const c_char;
1668
1669    #[link_name = "D_1051"]
1670    pub fn GetWindowsProductKey() -> *const c_char;
1671
1672    #[link_name = "D_1052"]
1673    pub fn GetDriverList() -> *const c_char;
1674
1675    #[link_name = "D_1586"]
1676    pub fn VerifyLicense() -> c_int;
1677
1678    #[link_name = "D_1590"]
1679    pub fn InvalidateLicense();
1680
1681    #[link_name = "D_1589"]
1682    pub fn IsLicenseValid() -> c_int;
1683
1684    #[link_name = "D_1737"]
1685    pub fn GetLicenseStatusEx() -> c_int;
1686
1687    #[link_name = "D_1599"]
1688    pub fn LicenseActivate(activation_code: *const c_char, err_buf: *mut c_char, err_buf_len: c_int) -> c_int;
1689
1690    #[link_name = "D_1594"]
1691    pub fn GetMaxMasterInstances() -> c_int;
1692
1693    #[link_name = "D_1324"]
1694    pub fn DumpSlaveStructOffsets();
1695
1696    #[link_name = "D_1075"]
1697    pub fn QuickFindRedundantPairBatch(
1698        adapter_names: *const *const c_char,
1699        adapter_count: c_int,
1700        primary_idx: *mut c_int,
1701        secondary_idx: *mut c_int,
1702        out_ring_count: *mut c_int,
1703        out_total_count: *mut c_int,
1704    ) -> c_int;
1705
1706    #[link_name = "D_1002"]
1707    pub fn GetSlaveNeedsStartupReconfig(master_index: u16, slave_index: u16) -> i32;
1708
1709    #[link_name = "D_1003"]
1710    pub fn ClearSlaveNeedsStartupReconfig(master_index: u16, slave_index: u16);
1711
1712    #[link_name = "D_1045"]
1713    pub fn GetPDOFrameLossStats(
1714        master_index: u16, group: u8,
1715        total_lost: *mut u32, consecutive_lost: *mut u32, max_consecutive_lost: *mut u32,
1716    );
1717
1718    #[link_name = "D_1046"]
1719    pub fn ResetPDOFrameLossStats(master_index: u16, group: u8);
1720
1721    #[link_name = "D_1025"]
1722    pub fn DarraValidateTimerAccuracy(expected_usec: u32, tolerance_usec: u32) -> c_int;
1723
1724    #[link_name = "D_1565"]
1725    pub fn GetMultiSlaveSDOList(
1726        master_index: u16,
1727        slave_indices: *const u16,
1728        count: c_int,
1729        results: *mut *const c_void,
1730    ) -> c_int;
1731
1732    #[link_name = "D_1566"]
1733    pub fn FreeMultiSlaveSDOList(results: *mut *const c_void, count: c_int);
1734
1735    #[link_name = "D_1567"]
1736    pub fn GetSlavePointer_SDO(master_index: u16, slave_index: u16, oe_index: u16) -> *const c_void;
1737
1738    #[link_name = "D_1568"]
1739    pub fn GetSlavePointer_SDO_WithODList(
1740        master_index: u16, slave_index: u16, oe_index: u16, odlist: *const c_void,
1741    ) -> *const c_void;
1742
1743    #[link_name = "D_1096"]
1744    pub fn EnableOutputSyncManager(master_index: u16, slave_index: u16) -> i32;
1745
1746    #[link_name = "D_1097"]
1747    pub fn DisableOutputSyncManager(master_index: u16, slave_index: u16) -> i32;
1748
1749    #[link_name = "D_1098"]
1750    pub fn GetSlaveOpOnlyFlag(master_index: u16, slave_index: u16) -> i32;
1751
1752    #[link_name = "D_1099"]
1753    pub fn SetSlaveErrorAck(master_index: u16, slave_index: u16, set_ack: i32) -> i32;
1754
1755    #[link_name = "D_1100"]
1756    pub fn GetSlaveDeviceEmulationFlag(master_index: u16, slave_index: u16) -> i32;
1757
1758    #[link_name = "D_1105"]
1759    pub fn VerifyAllSlaveIdentities(
1760        master_index: u16,
1761        expected: *const SlaveIdentity,
1762        slave_count: u32,
1763        check_revision: i32,
1764        check_serial: i32,
1765        mismatch_mask: *mut u64,
1766    ) -> i32;
1767
1768    #[link_name = "D_1528"]
1769    pub fn AOEStartNotificationListener(master_index: u16) -> i32;
1770
1771    #[link_name = "D_1529"]
1772    pub fn AOEStopNotificationListener() -> i32;
1773
1774    #[link_name = "D_1530"]
1775    pub fn AOEIsNotificationListening() -> i32;
1776
1777    #[link_name = "D_1531"]
1778    pub fn AOERegisterNotification(
1779        slave: u16, handle: u32,
1780        index_group: u32, index_offset: u32, data_length: u32,
1781        callback: AOENotificationCallback,
1782        user_data: *mut c_void,
1783    ) -> c_int;
1784
1785    #[link_name = "D_1532"]
1786    pub fn AOEUnregisterNotification(subscription_index: c_int) -> i32;
1787
1788    #[link_name = "D_1489"]
1789    pub fn EOESetDNS(master_index: u16, slave: u16, port: u8, dns_ip: u32, dns_name: *const c_char, timeout: c_int) -> i32;
1790
1791    #[link_name = "D_1492"]
1792    pub fn EOEGetDNS(master_index: u16, slave: u16, port: u8, dns_ip: *mut u32, dns_name: *mut c_char, timeout: c_int) -> i32;
1793
1794    #[link_name = "D_1490"]
1795    pub fn EOEGetFullParam(
1796        master_index: u16, slave: u16, port: u8,
1797        ip: *mut u32, subnet: *mut u32, gateway: *mut u32,
1798        mac: *mut u8, dns_ip: *mut u32, dns_name: *mut c_char, timeout: c_int,
1799    ) -> i32;
1800
1801    #[link_name = "D_1491"]
1802    pub fn EOESetFullParam(
1803        master_index: u16, slave: u16, port: u8,
1804        ip: u32, subnet: u32, gateway: u32,
1805        mac: *const u8, dns_ip: u32, dns_name: *const c_char, timeout: c_int,
1806    ) -> i32;
1807
1808    #[link_name = "D_1493"]
1809    pub fn EOESetAddressFilter(
1810        master_index: u16, slave: u16, port: u8,
1811        filter_count: u8, mac_filters: *const u8, timeout: c_int,
1812    ) -> i32;
1813
1814    #[link_name = "D_1494"]
1815    pub fn EOEGetAddressFilter(
1816        master_index: u16, slave: u16, port: u8,
1817        filter_count: *mut u8, mac_filters: *mut u8, max_filters: c_int, timeout: c_int,
1818    ) -> i32;
1819
1820    #[link_name = "D_1123"]
1821    pub fn GetMasterIdentity(master_index: u16, identity: *mut MasterIdentity) -> i32;
1822
1823    #[link_name = "D_1124"]
1824    pub fn GetMasterDiagData(master_index: u16, diag: *mut MasterDiagData) -> i32;
1825
1826    #[link_name = "D_1322"]
1827    pub fn GetBreakPoints(
1828        master_index: u16,
1829        out_slaves: *mut u16, out_ports: *mut u8, out_types: *mut u8,
1830        max_results: u16,
1831    ) -> c_int;
1832
1833    #[link_name = "D_1542"]
1834    pub fn GetRingMode(master_index: u16) -> c_int;
1835
1836    #[link_name = "D_1533"]
1837    pub fn GetSecondaryLinkStatus(master_index: u16) -> i32;
1838
1839    #[link_name = "D_1370"]
1840    pub fn ec_validate_config(master_index: u16) -> c_int;
1841
1842    #[link_name = "D_1371"]
1843    pub fn ec_perf_export_csv(master_index: u16, filepath: *const c_char) -> c_int;
1844
1845    #[cfg(any(debug_assertions, feature = "internal-debug-probes"))]
1846    #[link_name = "D_1091"]
1847    pub fn DebugSlaveHasDC(master_index: u16, slave_index: u16);
1848
1849    #[link_name = "D_1317"]
1850    pub fn ReadSlavePortErrorCounters(
1851        master_index: u16, slave_index: u16,
1852        rx_error: *mut u8, invalid_frame: *mut u8, lost_link: *mut u8,
1853    ) -> i32;
1854
1855    #[link_name = "D_1318"]
1856    pub fn ReadAllSlavePortErrorCounters(master_index: u16) -> c_int;
1857
1858    #[link_name = "D_1319"]
1859    pub fn GetSlavePortErrorStats(master_index: u16, slave_index: u16) -> *const c_void;
1860
1861    #[link_name = "D_1321"]
1862    pub fn UpdateDiagnosticsWithESCErrors(master_index: u16);
1863
1864    #[link_name = "D_1335"]
1865    pub fn FSoEInitConnection(master_index: u16, slave_index: u16, config: *mut FsoeConfig) -> i32;
1866
1867    #[link_name = "D_1336"]
1868    pub fn FSoECloseConnection(master_index: u16, slave_index: u16) -> i32;
1869
1870    #[link_name = "D_1337"]
1871    pub fn FSoEGetStatus(master_index: u16, slave_index: u16, status: *mut FsoeStatus) -> i32;
1872
1873    #[link_name = "D_1338"]
1874    pub fn FSoERequestState(master_index: u16, slave_index: u16, target_state: c_int) -> i32;
1875
1876    #[link_name = "D_1339"]
1877    pub fn FSoEGetState(master_index: u16, slave_index: u16) -> c_int;
1878
1879    #[link_name = "D_1340"]
1880    pub fn FSoEReset(master_index: u16, slave_index: u16) -> i32;
1881
1882    #[link_name = "D_1341"]
1883    pub fn FSoEWriteSafeOutput(master_index: u16, slave_index: u16, data: *const u8, size: u32) -> i32;
1884
1885    #[link_name = "D_1342"]
1886    pub fn FSoEReadSafeInput(master_index: u16, slave_index: u16, data: *mut u8, size: *mut u32) -> i32;
1887
1888    #[link_name = "D_1343"]
1889    pub fn FSoEDownloadParameters(master_index: u16, slave_index: u16, param_data: *const u8, param_size: u32, sra_crc: *mut u32) -> i32;
1890
1891    #[link_name = "D_1344"]
1892    pub fn FSoESetFailsafeOutput(master_index: u16, slave_index: u16, data: *const u8, size: u32) -> i32;
1893
1894    #[link_name = "D_1345"]
1895    pub fn FSoECheckWatchdog(master_index: u16, slave_index: u16) -> i32;
1896
1897    #[link_name = "D_1346"]
1898    pub fn FSoEGetLastError(master_index: u16, slave_index: u16) -> c_int;
1899
1900    #[link_name = "D_1347"]
1901    pub fn FSoEClearError(master_index: u16, slave_index: u16);
1902
1903    #[link_name = "D_1348"]
1904    pub fn FSoEIsSlaveCapable(master_index: u16, slave_index: u16) -> i32;
1905
1906    #[link_name = "D_1349"]
1907    pub fn FSoEGetConnectionCount(master_index: u16) -> u16;
1908
1909    #[link_name = "D_1350"]
1910    pub fn FSoEProcessCycle(master_index: u16);
1911
1912    #[link_name = "D_1351"]
1913    pub fn SafeMdpInitConnection(master_index: u16, slave_index: u16, connection_index: u16, config: *mut SafeMdpConfig) -> i32;
1914
1915    #[link_name = "D_1352"]
1916    pub fn SafeMdpCloseConnection(master_index: u16, slave_index: u16, connection_index: u16) -> i32;
1917
1918    #[link_name = "D_1353"]
1919    pub fn SafeMdpGetStatus(master_index: u16, slave_index: u16, connection_index: u16, status: *mut FsoeStatus) -> i32;
1920
1921    #[link_name = "D_1354"]
1922    pub fn SafeMdpRequestState(master_index: u16, slave_index: u16, connection_index: u16, target_state: c_int) -> i32;
1923
1924    #[link_name = "D_1355"]
1925    pub fn SafeMdpGetState(master_index: u16, slave_index: u16, connection_index: u16) -> c_int;
1926
1927    #[link_name = "D_1356"]
1928    pub fn SafeMdpReset(master_index: u16, slave_index: u16, connection_index: u16) -> i32;
1929
1930    #[link_name = "D_1357"]
1931    pub fn SafeMdpWriteSafeOutput(master_index: u16, slave_index: u16, connection_index: u16, data: *const u8, size: u32) -> i32;
1932
1933    #[link_name = "D_1358"]
1934    pub fn SafeMdpReadSafeInput(master_index: u16, slave_index: u16, connection_index: u16, data: *mut u8, size: *mut u32) -> i32;
1935
1936    #[link_name = "D_1359"]
1937    pub fn SafeMdpDownloadParameters(master_index: u16, slave_index: u16, connection_index: u16, param_data: *const u8, param_size: u32, sra_crc: *mut u32) -> i32;
1938
1939    #[link_name = "D_1360"]
1940    pub fn SafeMdpSetFailsafeOutput(master_index: u16, slave_index: u16, connection_index: u16, data: *const u8, size: u32) -> i32;
1941
1942    #[link_name = "D_1361"]
1943    pub fn SafeMdpCheckWatchdog(master_index: u16, slave_index: u16, connection_index: u16) -> i32;
1944
1945    #[link_name = "D_1362"]
1946    pub fn SafeMdpGetLastError(master_index: u16, slave_index: u16, connection_index: u16) -> c_int;
1947
1948    #[link_name = "D_1363"]
1949    pub fn SafeMdpClearError(master_index: u16, slave_index: u16, connection_index: u16);
1950
1951    #[link_name = "D_1364"]
1952    pub fn SafeMdpGetSlaveConnectionCount(master_index: u16, slave_index: u16) -> u16;
1953
1954    #[link_name = "D_1365"]
1955    pub fn SafeMdpDetectConnections(master_index: u16, slave_index: u16) -> u16;
1956
1957    #[link_name = "D_1366"]
1958    pub fn SafeMdpGetDeviceAddress(master_index: u16, slave_index: u16, safety_address: *mut u16) -> i32;
1959
1960    #[link_name = "D_1367"]
1961    pub fn SafeMdpGetModuleCommParam(master_index: u16, slave_index: u16, module_number: u16, param_data: *mut u8, param_size: *mut u32) -> i32;
1962
1963    #[link_name = "D_1368"]
1964    pub fn SafeMdpGetModuleDiagnosis(master_index: u16, slave_index: u16, module_number: u16, connection_state: *mut u16, connection_diagnosis: *mut u16) -> i32;
1965
1966    #[link_name = "D_1369"]
1967    pub fn FSoEValidateConnId(conn_id: u16) -> c_int;
1968
1969    #[link_name = "D_1331"]
1970    pub fn coe_diag_poll_new_available(
1971        master_index: u16,
1972        slave_index: u16,
1973        out_abort_code: *mut u32,
1974    ) -> c_int;
1975
1976    #[link_name = "D_1332"]
1977    pub fn coe_diag_read_meta(
1978        master_index: u16,
1979        slave_index: u16,
1980        out_max_msgs: *mut u8,
1981        out_newest: *mut u8,
1982        out_acknowledged: *mut u8,
1983        out_flags16: *mut u16,
1984        out_abort_code: *mut u32,
1985    ) -> c_int;
1986
1987    #[link_name = "D_1333"]
1988    pub fn coe_diag_read_message(
1989        master_index: u16,
1990        slave_index: u16,
1991        msg_subidx: u8,
1992        out_buf: *mut u8,
1993        buf_cap: c_int,
1994        out_len: *mut c_int,
1995        out_abort_code: *mut u32,
1996    ) -> c_int;
1997
1998    #[link_name = "D_1334"]
1999    pub fn coe_diag_acknowledge(
2000        master_index: u16,
2001        slave_index: u16,
2002        ack_subidx: u8,
2003        out_abort_code: *mut u32,
2004    ) -> c_int;
2005
2006    #[link_name = "D_1575"]
2007    pub fn coe_get_od_list(master_index: u16, slave_index: u16) -> *const c_void;
2008
2009    #[link_name = "D_1576"]
2010    pub fn coe_get_object_desc(
2011        master_index: u16,
2012        slave_index: u16,
2013        index: u16,
2014    ) -> *const c_void;
2015
2016    #[link_name = "D_1577"]
2017    pub fn coe_get_entry_desc(
2018        master_index: u16,
2019        slave_index: u16,
2020        index: u16,
2021        subindex: u8,
2022    ) -> *const c_void;
2023
2024    #[link_name = "D_1578"]
2025    pub fn coe_free_odlist(p: *const c_void);
2026
2027    #[link_name = "D_1579"]
2028    pub fn coe_free_oelist(p: *const c_void);
2029
2030    #[link_name = "D_1287"]
2031    pub fn GetMasterDCTime(master_index: u16) -> i64;
2032
2033    #[link_name = "D_1288"]
2034    pub fn GetReferenceClockSlaveIndex(master_index: u16) -> u16;
2035
2036    #[link_name = "D_1482"]
2037    pub fn FOESetBusyHook(master_index: u16, callback: Option<FoEBusyCallback>) -> c_int;
2038
2039    #[link_name = "D_1483"]
2040    pub fn FOERequestCancel(master_index: u16, slave: u16) -> c_int;
2041
2042    #[link_name = "D_1484"]
2043    pub fn FOEClearCancel(master_index: u16, slave: u16) -> c_int;
2044
2045    #[link_name = "D_1240"]
2046    pub fn GetSlaveHasEsi(master_index: u16, slave_index: u16) -> i32;
2047
2048    #[link_name = "D_1242"]
2049    pub fn SetSlaveEsiFile(master_index: u16, slave_index: u16, name: *const c_char) -> i32;
2050
2051    #[link_name = "D_1243"]
2052    pub fn GetSlaveEsiVersion(master_index: u16, slave_index: u16, buf: *mut c_char, buf_len: c_int) -> i32;
2053
2054    #[link_name = "D_1241"]
2055    pub fn GetSlaveHasMDP(master_index: u16, slave_index: u16) -> i32;
2056
2057    #[link_name = "D_1244"]
2058    pub fn GetSlaveVendorName(master_index: u16, slave_index: u16, buf: *mut c_char, buf_len: c_int) -> i32;
2059
2060    #[link_name = "D_1245"]
2061    pub fn GetSlaveRedundancyActivated(master_index: u16, slave_index: u16) -> i32;
2062
2063    #[link_name = "D_1246"]
2064    pub fn GetSlavePrimaryLinkBroken(master_index: u16, slave_index: u16) -> i32;
2065
2066    #[link_name = "D_1247"]
2067    pub fn GetSlaveSecondaryLinkBroken(master_index: u16, slave_index: u16) -> i32;
2068
2069    #[link_name = "D_1200"]
2070    pub fn GetSlaveMailboxProto(master_index: u16, slave_index: u16) -> u16;
2071
2072    #[link_name = "D_1248"]
2073    pub fn mbx_get_stats_by_master(
2074        master_index: u16,
2075        slave_index: u16,
2076        protocol_type: u8,
2077        stats: *mut EcMbxStatsC,
2078    ) -> i32;
2079
2080    #[link_name = "D_1249"]
2081    pub fn mbx_reset_stats_by_master(
2082        master_index: u16,
2083        slave_index: u16,
2084        protocol_type: u8,
2085    );
2086
2087    #[link_name = "D_1472"]
2088    pub fn AL_StatusCode_GetDescription(code: u16) -> *const c_char;
2089    #[link_name = "D_1473"]
2090    pub fn AL_StatusCode_GetSeverity(code: u16) -> i32;
2091    #[link_name = "D_1474"]
2092    pub fn AL_StatusCode_GetRecoveryHint(code: u16) -> *const c_char;
2093    #[link_name = "D_1475"]
2094    pub fn AL_StatusCode_IsVendorSpecific(code: u16) -> i32;
2095
2096    #[link_name = "D_1441"]
2097    pub fn SDOAbort_GetDescription(abort_code: u32) -> *const c_char;
2098    #[link_name = "D_1442"]
2099    pub fn SDOAbort_GetCategory(abort_code: u32) -> i32;
2100    #[link_name = "D_1443"]
2101    pub fn SDOAbort_IsRetryable(abort_code: u32) -> i32;
2102    #[link_name = "D_1444"]
2103    pub fn SDOAbort_GetHint(abort_code: u32) -> *const c_char;
2104
2105    #[link_name = "D_1416"]
2106    pub fn EmcyCode_GetDescription(error_code: u16) -> *const c_char;
2107    #[link_name = "D_1417"]
2108    pub fn EmcyCode_GetClass(error_code: u16) -> i32;
2109    #[link_name = "D_1418"]
2110    pub fn EmcyCode_GetClassName(class_code: i32) -> *const c_char;
2111    #[link_name = "D_1419"]
2112    pub fn EmcyCode_FormatErrorRegister(error_register: u8, buf: *mut u8, buf_size: c_int);
2113    #[link_name = "D_1420"]
2114    pub fn EmcyCode_IsRecovery(error_code: u16) -> i32;
2115
2116    #[link_name = "D_1464"]
2117    pub fn EcState_IsValidTransition(from: u16, to: u16) -> i32;
2118    #[link_name = "D_1465"]
2119    pub fn EcState_GetTransitionType(from: u16, to: u16) -> i32;
2120    #[link_name = "D_1466"]
2121    pub fn EcState_GetTransitionPath(from: u16, to: u16, path: *mut u16, path_capacity: c_int) -> i32;
2122    #[link_name = "D_1467"]
2123    pub fn EcState_IsBootstrapRequired(state: u16) -> i32;
2124    #[link_name = "D_1468"]
2125    pub fn EcState_GetName(state: u16) -> *const c_char;
2126    #[link_name = "D_1469"]
2127    pub fn EcState_GetNameEn(state: u16) -> *const c_char;
2128    #[link_name = "D_1470"]
2129    pub fn EcState_HasErrorAck(state: u16) -> i32;
2130    #[link_name = "D_1471"]
2131    pub fn EcState_StripErrorAck(state: u16) -> u16;
2132
2133    #[link_name = "D_1426"]
2134    pub fn EcPdoCodec_DataTypeBitSize(dt: c_int) -> c_int;
2135    #[link_name = "D_1427"]
2136    pub fn EcPdoCodec_DataTypeName(dt: c_int) -> *const c_char;
2137    #[link_name = "D_1428"]
2138    pub fn EcPdoCodec_ExtractU64(
2139        src: *const u8,
2140        src_size: c_int,
2141        bit_offset: c_int,
2142        bit_length: c_int,
2143        out_value: *mut u64,
2144    ) -> c_int;
2145    #[link_name = "D_1429"]
2146    pub fn EcPdoCodec_ExtractI64(
2147        src: *const u8,
2148        src_size: c_int,
2149        bit_offset: c_int,
2150        bit_length: c_int,
2151        out_value: *mut i64,
2152    ) -> c_int;
2153    #[link_name = "D_1430"]
2154    pub fn EcPdoCodec_InsertU64(
2155        dst: *mut u8,
2156        dst_size: c_int,
2157        bit_offset: c_int,
2158        bit_length: c_int,
2159        value: u64,
2160    ) -> c_int;
2161    #[link_name = "D_1431"]
2162    pub fn EcPdoCodec_InsertI64(
2163        dst: *mut u8,
2164        dst_size: c_int,
2165        bit_offset: c_int,
2166        bit_length: c_int,
2167        value: i64,
2168    ) -> c_int;
2169    #[link_name = "D_1432"]
2170    pub fn EcPdoCodec_ExtractReal32(
2171        src: *const u8,
2172        src_size: c_int,
2173        bit_offset: c_int,
2174        out_value: *mut f32,
2175    ) -> c_int;
2176    #[link_name = "D_1433"]
2177    pub fn EcPdoCodec_ExtractReal64(
2178        src: *const u8,
2179        src_size: c_int,
2180        bit_offset: c_int,
2181        out_value: *mut f64,
2182    ) -> c_int;
2183    #[link_name = "D_1434"]
2184    pub fn EcPdoCodec_InsertReal32(
2185        dst: *mut u8,
2186        dst_size: c_int,
2187        bit_offset: c_int,
2188        value: f32,
2189    ) -> c_int;
2190    #[link_name = "D_1435"]
2191    pub fn EcPdoCodec_InsertReal64(
2192        dst: *mut u8,
2193        dst_size: c_int,
2194        bit_offset: c_int,
2195        value: f64,
2196    ) -> c_int;
2197    #[link_name = "D_1436"]
2198    pub fn EcPdoCodec_CountActivePorts(active_ports: u8) -> c_int;
2199    #[link_name = "D_1437"]
2200    pub fn EcPdoCodec_GetTopology(active_ports: u8) -> c_int;
2201    #[link_name = "D_1438"]
2202    pub fn EcPdoCodec_GetTopologyName(topo: c_int) -> *const c_char;
2203    #[link_name = "D_1439"]
2204    pub fn EcPdoCodec_GetTopologyNameEn(topo: c_int) -> *const c_char;
2205    #[link_name = "D_1440"]
2206    pub fn EcPdoCodec_IsPortActive(active_ports: u8, port: c_int) -> c_int;
2207
2208    #[link_name = "D_1390"]
2209    pub fn CiA402Modes_ModeToSupportedBit(mode: i8) -> c_int;
2210    #[link_name = "D_1391"]
2211    pub fn CiA402Modes_IsModeSupportedInMask(mask: u32, mode: i8) -> c_int;
2212    #[link_name = "D_1392"]
2213    pub fn CiA402Modes_ExpandSupportedMask(mask: u32, modes: *mut i8, capacity: c_int) -> c_int;
2214    #[link_name = "D_1393"]
2215    pub fn CiA402Modes_GetModeName(mode: i8) -> *const c_char;
2216    #[link_name = "D_1394"]
2217    pub fn CiA402Modes_GetModeNameEn(mode: i8) -> *const c_char;
2218    #[link_name = "D_1395"]
2219    pub fn CiA402Modes_GetModeDescription(mode: i8) -> *const c_char;
2220    #[link_name = "D_1396"]
2221    pub fn CiA402Modes_IsCyclicSyncMode(mode: i8) -> c_int;
2222    #[link_name = "D_1397"]
2223    pub fn CiA402Modes_RequiresDC(mode: i8) -> c_int;
2224    #[link_name = "D_1398"]
2225    pub fn CiA402Modes_IsStandardHomingMethod(method: i8) -> c_int;
2226    #[link_name = "D_1399"]
2227    pub fn CiA402Modes_GetHomingMethodName(method: i8) -> *const c_char;
2228    #[link_name = "D_1400"]
2229    pub fn CiA402Modes_GetHomingTrigger(method: i8) -> c_int;
2230    #[link_name = "D_1401"]
2231    pub fn CiA402Modes_GetHomingDirection(method: i8) -> c_int;
2232    #[link_name = "D_1402"]
2233    pub fn CiA402Modes_ListStandardHomingMethods(array: *mut i8, capacity: c_int) -> c_int;
2234
2235    #[link_name = "D_1421"]
2236    pub fn EcMailbox_GetTypeName(mbx_type: u16) -> *const c_char;
2237    #[link_name = "D_1422"]
2238    pub fn EcMailbox_GetTypeNameEn(mbx_type: u16) -> *const c_char;
2239    #[link_name = "D_1423"]
2240    pub fn EcMailbox_GetErrorDescription(mbx_error_code: u16) -> *const c_char;
2241    #[link_name = "D_1424"]
2242    pub fn EcMailbox_NextCounter(current: u8) -> u8;
2243
2244    #[link_name = "D_1425"]
2245    pub fn EcSoE_GetErrorDescription(soe_error: u16) -> *const c_char;
2246
2247    #[link_name = "D_1454"]
2248    pub fn EcSii_FindCategory(
2249        sii_data: *const u8,
2250        sii_size: c_int,
2251        cat_type: u16,
2252        out_size_bytes: *mut c_int,
2253    ) -> c_int;
2254    #[link_name = "D_1455"]
2255    pub fn EcSii_EnumerateCategories(
2256        sii_data: *const u8,
2257        sii_size: c_int,
2258        cat_types: *mut u16,
2259        capacity: c_int,
2260    ) -> c_int;
2261    #[link_name = "D_1458"]
2262    pub fn EcSii_GetStringByIndex(
2263        cat_data: *const u8,
2264        cat_size: c_int,
2265        idx: c_int,
2266        out_buf: *mut u8,
2267        buf_size: c_int,
2268    ) -> c_int;
2269    #[link_name = "D_1457"]
2270    pub fn EcSii_GetStringCount(cat_data: *const u8, cat_size: c_int) -> c_int;
2271    #[link_name = "D_1460"]
2272    pub fn EcSii_GetVendorId(sii_data: *const u8, sii_size: c_int) -> u32;
2273    #[link_name = "D_1461"]
2274    pub fn EcSii_GetProductCode(sii_data: *const u8, sii_size: c_int) -> u32;
2275    #[link_name = "D_1462"]
2276    pub fn EcSii_GetRevision(sii_data: *const u8, sii_size: c_int) -> u32;
2277    #[link_name = "D_1463"]
2278    pub fn EcSii_GetSerialNumber(sii_data: *const u8, sii_size: c_int) -> u32;
2279    #[link_name = "D_1459"]
2280    pub fn EcSii_GetConfiguredAlias(sii_data: *const u8, sii_size: c_int) -> u16;
2281    #[link_name = "D_1446"]
2282    pub fn EcSii_CoeEnabled(coe_details: u8) -> c_int;
2283    #[link_name = "D_1447"]
2284    pub fn EcSii_CoeSdoInfo(coe_details: u8) -> c_int;
2285    #[link_name = "D_1448"]
2286    pub fn EcSii_CoePdoAssign(coe_details: u8) -> c_int;
2287    #[link_name = "D_1449"]
2288    pub fn EcSii_CoePdoConfig(coe_details: u8) -> c_int;
2289    #[link_name = "D_1450"]
2290    pub fn EcSii_CoeUploadAtStartup(coe_details: u8) -> c_int;
2291    #[link_name = "D_1451"]
2292    pub fn EcSii_CoeCompleteAccess(coe_details: u8) -> c_int;
2293    #[link_name = "D_1452"]
2294    pub fn EcSii_FoeEnabled(foe_details: u8) -> c_int;
2295    #[link_name = "D_1453"]
2296    pub fn EcSii_EoeEnabled(eoe_details: u8) -> c_int;
2297
2298    #[link_name = "D_1403"]
2299    pub fn EcCouplerId_DetectDeviceType(vendor_id: u32, product_code: u32) -> c_int;
2300    #[link_name = "D_1404"]
2301    pub fn EcCouplerId_IsCoupler(vendor_id: u32, product_code: u32) -> c_int;
2302    #[link_name = "D_1405"]
2303    pub fn EcCouplerId_IsTerminal(vendor_id: u32, product_code: u32) -> c_int;
2304    #[link_name = "D_1406"]
2305    pub fn EcCouplerId_GetVendorName(vendor_id: u32) -> *const c_char;
2306    #[link_name = "D_1407"]
2307    pub fn EcCouplerId_GetVendorNameEn(vendor_id: u32) -> *const c_char;
2308    #[link_name = "D_1408"]
2309    pub fn EcCouplerId_GetDeviceTypeName(dtype: c_int) -> *const c_char;
2310
2311    #[link_name = "D_1412"]
2312    pub fn EcDiagStrings_TopologyDescription(topo: u8) -> *const c_char;
2313    #[link_name = "D_1413"]
2314    pub fn EcDiagStrings_TimingMode(mode: u32) -> *const c_char;
2315    #[link_name = "D_1414"]
2316    pub fn EcDiagStrings_BreakpointType(bp: u8) -> *const c_char;
2317    #[link_name = "D_1415"]
2318    pub fn EcDiagStrings_FormatBreakpoint(
2319        slave_idx: u16,
2320        port: u8,
2321        bp: u8,
2322        buf: *mut u8,
2323        buf_size: c_int,
2324    );
2325
2326    #[link_name = "D_1615"]
2327    pub fn EcEsi_LoadFile(file_path: *const c_char) -> i32;
2328    #[link_name = "D_1616"]
2329    pub fn EcEsi_LoadDirectory(dir_path: *const c_char) -> i32;
2330    #[link_name = "D_1617"]
2331    pub fn EcEsi_Clear();
2332    #[link_name = "D_1618"]
2333    pub fn EcEsi_GetLoadedCount() -> i32;
2334    #[link_name = "D_1619"]
2335    pub fn EcEsi_BindToSlave(mi: u16, si: u16, file_path: *const c_char) -> i32;
2336    #[link_name = "D_1620"]
2337    pub fn EcEsi_AutoMatchAll(mi: u16) -> i32;
2338    #[link_name = "D_1621"]
2339    pub fn EcEsi_RegisterStartupParameters(mi: u16, si: u16) -> i32;
2340    #[link_name = "D_1622"]
2341    pub fn EcEsi_ApplyAllSlaves(mi: u16) -> i32;
2342
2343    #[link_name = "D_1602"]
2344    pub fn EnumerateDefaultPdo(
2345        master_index: u16,
2346        slave_index: u16,
2347        direction: c_int,
2348        out_indices: *mut u16,
2349        max_count: c_int,
2350    ) -> c_int;
2351
2352    #[link_name = "D_1600"]
2353    pub fn SetDcSyncMode(master_index: u16, slave_index: u16, sync_type: u8) -> c_int;
2354
2355    #[link_name = "D_1601"]
2356    pub fn GetDcSyncMode(master_index: u16, slave_index: u16) -> u8;
2357
2358    #[link_name = "D_1603"]
2359    pub fn EcEsi_GetDevicePdoIndices(
2360        master_index: u16,
2361        slave_index: u16,
2362        direction: c_int,
2363        out_indices: *mut u16,
2364        max_count: c_int,
2365    ) -> c_int;
2366
2367    #[link_name = "D_1604"]
2368    pub fn EcEsi_GetDevicePdoSizeBits(master_index: u16, slave_index: u16, pdo_index: u16) -> c_int;
2369
2370    #[link_name = "D_1605"]
2371    pub fn EcEsi_GetDeviceSmInfo(
2372        master_index: u16,
2373        slave_index: u16,
2374        sm_idx: u8,
2375        start_addr: *mut u16,
2376        default_len: *mut u16,
2377        control_byte: *mut u8,
2378    ) -> c_int;
2379
2380    #[link_name = "D_1606"]
2381    pub fn EcEsi_GetDeviceDcSyncMode(master_index: u16, slave_index: u16) -> c_int;
2382
2383    #[link_name = "D_1607"]
2384    pub fn EcEsi_GetDeviceMailboxTimeout(
2385        master_index: u16,
2386        slave_index: u16,
2387        request_ms: *mut c_int,
2388        response_ms: *mut c_int,
2389    ) -> c_int;
2390
2391    #[link_name = "D_1608"]
2392    pub fn EcEsi_GetDeviceIdentity(
2393        master_index: u16,
2394        slave_index: u16,
2395        vendor_id: *mut u32,
2396        product_code: *mut u32,
2397        revision_no: *mut u32,
2398        name_buf: *mut u8,
2399        name_buf_size: c_int,
2400    ) -> c_int;
2401
2402    #[link_name = "D_1629"]
2403    pub fn DarraEcat_KernelProbe() -> c_int;
2404
2405    #[link_name = "D_1630"]
2406    pub fn DarraEcat_KernelStatusMessage(status: c_int) -> *const c_char;
2407
2408    #[link_name = "D_1631"]
2409    pub fn DarraEcat_KernelInstallerUrl() -> *const c_char;
2410
2411    #[link_name = "D_1667"]
2412    pub fn GetSlaveWcState(master_index: u16, slave_index: u16) -> u8;
2413
2414    #[link_name = "D_1668"]
2415    pub fn GetSlaveAlStatusMirror(master_index: u16, slave_index: u16) -> u16;
2416
2417    #[link_name = "D_1669"]
2418    pub fn GetWcDeficit(master_index: u16) -> u16;
2419
2420    #[link_name = "D_1670"]
2421    pub fn GetWcStateSeq(master_index: u16) -> u64;
2422
2423    #[link_name = "D_1671"]
2424    pub fn GetMappedSlaveCount(master_index: u16) -> u16;
2425
2426    #[link_name = "D_1672"]
2427    pub fn GetWkcActualMirror(master_index: u16) -> u16;
2428
2429    #[link_name = "D_1673"]
2430    pub fn GetWkcExpectedMirror(master_index: u16) -> u16;
2431
2432    #[link_name = "D_1027"]
2433    pub fn TraceLog(msg: *const c_char);
2434
2435    #[link_name = "D_1074"]
2436    pub fn GetLastQFBPerNICSlaves(out_slaves_per_nic: *mut c_int, max_count: c_int) -> c_int;
2437
2438    #[link_name = "D_1078"]
2439    pub fn ScanSlaveInfo(primary: *const c_char, secondary: *const c_char) -> c_int;
2440
2441    #[link_name = "D_1083"]
2442    pub fn QuickScanAllNICs() -> c_int;
2443
2444    #[link_name = "D_1110"]
2445    pub fn RecoverSlaveToOP(master_index: u16, slave_index: u16) -> u16;
2446
2447    #[link_name = "D_1012"]
2448    pub fn GetGroupActualWKC(master_index: u16, group: u8) -> u16;
2449
2450    #[link_name = "D_1013"]
2451    pub fn GetGroupDiag(
2452        master_index: u16, group: u8,
2453        consecutive_miss: *mut u16, total_frames: *mut u32, mismatch_frames: *mut u32,
2454    ) -> c_int;
2455
2456    #[link_name = "D_1201"]
2457    pub fn GetSlaveMailboxWriteLength(master_index: u16, slave_index: u16) -> u16;
2458
2459    #[link_name = "D_1202"]
2460    pub fn GetSlaveMailboxWriteOffset(master_index: u16, slave_index: u16) -> u16;
2461
2462    #[link_name = "D_1203"]
2463    pub fn GetSlaveMailboxReadLength(master_index: u16, slave_index: u16) -> u16;
2464
2465    #[link_name = "D_1204"]
2466    pub fn GetSlaveMailboxReadOffset(master_index: u16, slave_index: u16) -> u16;
2467
2468    #[link_name = "D_1205"]
2469    pub fn GetSlaveMbxCount(master_index: u16, slave_index: u16) -> u8;
2470
2471    #[link_name = "D_1254"]
2472    pub fn GetSlaveSMLength(master_index: u16, slave_index: u16, sm_idx: u8) -> u16;
2473
2474    #[link_name = "D_1238"]
2475    pub fn GetSlaveName(master_index: u16, slave_index: u16, buf: *mut u8, buf_size: c_int) -> c_int;
2476
2477    #[link_name = "D_1239"]
2478    pub fn GetSlaveDeviceName(master_index: u16, slave_index: u16, buf: *mut u8, buf_size: c_int) -> c_int;
2479
2480    #[link_name = "D_1323"]
2481    pub fn GetSlavePortLinkStatus(
2482        master_index: u16, out_port_link: *mut u8, out_unreachable: *mut u8, max_slaves: u16,
2483    ) -> c_int;
2484
2485    #[link_name = "D_1305"]
2486    pub fn DiagnoseNicHealth(master_index: u16) -> c_int;
2487
2488    #[link_name = "D_1306"]
2489    pub fn VerifyNicHealth(master_index: u16, num_probes: c_int, timeout_ms: c_int) -> c_int;
2490
2491    #[link_name = "D_1307"]
2492    pub fn AutoRecoverNic(master_index: u16) -> c_int;
2493
2494    #[link_name = "D_1298"]
2495    pub fn GetWdkPrimaryFrameTx(master_index: u16) -> u32;
2496
2497    #[link_name = "D_1299"]
2498    pub fn GetWdkPrimaryFrameRx(master_index: u16) -> u32;
2499
2500    #[link_name = "D_1300"]
2501    pub fn GetWdkSecondaryFrameTx(master_index: u16) -> u32;
2502
2503    #[link_name = "D_1301"]
2504    pub fn GetWdkSecondaryFrameRx(master_index: u16) -> u32;
2505
2506    #[link_name = "D_1302"]
2507    pub fn GetWdkPdoIdxDropCount(master_index: u16) -> u32;
2508
2509    #[link_name = "D_1661"]
2510    pub fn GetTopoPriIntact(master_index: u16) -> u16;
2511
2512    #[link_name = "D_1662"]
2513    pub fn GetTopoSecIntact(master_index: u16) -> u16;
2514
2515    #[link_name = "D_1693"]
2516    pub fn GetPrimaryWKCEx(master_index: u16) -> u16;
2517
2518    #[link_name = "D_1694"]
2519    pub fn GetSecondaryWKCEx(master_index: u16) -> u16;
2520
2521    #[link_name = "D_1739"]
2522    pub fn HotSwapRebuild(master_index: u16) -> i32;
2523
2524    #[link_name = "D_1733"]
2525    pub fn GetPrimaryWkcRt(master_index: u16) -> u16;
2526
2527    #[link_name = "D_1734"]
2528    pub fn GetSecondaryWkcRt(master_index: u16) -> u16;
2529
2530    #[link_name = "D_1735"]
2531    pub fn GetPrimaryPhyLinkUp(master_index: u16) -> i32;
2532
2533    #[link_name = "D_1736"]
2534    pub fn GetSecondaryPhyLinkUp(master_index: u16) -> i32;
2535
2536    #[link_name = "D_1540"]
2537    pub fn EnablePiggybackDiag(master_index: u16, enable: c_int);
2538
2539    #[link_name = "D_1541"]
2540    pub fn IsPiggybackDiagEnabled(master_index: u16) -> c_int;
2541
2542    #[link_name = "D_1658"]
2543    pub fn GetMasterAlstatRefresh(
2544        master_index: u16, refresh_us: *mut u64, aggregate: *mut u16, wkc_match: *mut u16,
2545    );
2546
2547    #[link_name = "D_1659"]
2548    pub fn GetPiggybackDiagCounters(
2549        master_index: u16, brd_tx: *mut u64, brd_rx: *mut u64, brd_miss: *mut u64,
2550    );
2551
2552    #[link_name = "D_1660"]
2553    pub fn GetPiggybackDiagCounters2(
2554        master_index: u16, alstat_changes: *mut u64, last_alstat: *mut u16, last_slave: *mut u16,
2555    );
2556
2557    #[link_name = "D_1632"]
2558    pub fn GetCycleEventHandle(master_index: u16) -> *mut c_void;
2559
2560    #[link_name = "D_1633"]
2561    pub fn GetCycleEventName(master_index: u16) -> *const c_char;
2562
2563    #[link_name = "D_1634"]
2564    pub fn WaitForCycleEvent(master_index: u16, timeout_ms: u32) -> c_int;
2565
2566    #[link_name = "D_1635"]
2567    pub fn GetCycleCount(master_index: u16) -> u64;
2568
2569    #[link_name = "D_1656"]
2570    pub fn AL_StatusCode_GetDescriptionChinese(code: u16) -> *const c_char;
2571
2572    #[link_name = "D_1657"]
2573    pub fn AL_StatusCode_GetRecoveryHintChinese(code: u16) -> *const c_char;
2574
2575    #[link_name = "D_1636"]
2576    pub fn UnregisterProcessDataCyclicCallbackSync(callback: ProcessDataCyclicCallback);
2577
2578    #[link_name = "D_1637"]
2579    pub fn UnregisterProcessDataCyclicCallbackAsync(callback: ProcessDataCyclicCallback);
2580
2581    #[link_name = "D_1638"]
2582    pub fn UnregisterSlaveStateChangeCallbackSync(callback: SlaveStateChangeCallback);
2583
2584    #[link_name = "D_1639"]
2585    pub fn UnregisterSlaveStateChangeCallbackAsync(callback: SlaveStateChangeCallback);
2586
2587    #[link_name = "D_1640"]
2588    pub fn UnregisterEmergencyEventCallback(callback: EmergencyEventCallback);
2589
2590    #[link_name = "D_1641"]
2591    pub fn UnregisterSlaveDiscoveryCallbackSync(callback: SlaveDiscoveryCallback);
2592
2593    #[link_name = "D_1642"]
2594    pub fn UnregisterSlaveDiscoveryCallbackAsync(callback: SlaveDiscoveryCallback);
2595
2596    #[link_name = "D_1643"]
2597    pub fn UnregisterPDOFrameLossCallback(callback: PDOFrameLossCallback);
2598
2599    #[link_name = "D_1644"]
2600    pub fn UnregisterRedundancyModeChangedCallback(callback: RedundancyModeChangedCallback);
2601
2602    #[link_name = "D_1645"]
2603    pub fn UnregisterSlavePreOpReconfigCallback(callback: SlavePreOpReconfigCallback);
2604
2605    #[link_name = "D_1646"]
2606    pub fn UnregisterSlaveIdentityMismatchCallback(callback: SlaveIdentityMismatchCallback);
2607
2608    #[link_name = "D_1647"]
2609    pub fn UnregisterInputDataChangedCallback(callback: InputDataChangedCallback);
2610
2611    #[link_name = "D_1648"]
2612    pub fn UnregisterSlavePortLinkChangedCallback(callback: SlavePortLinkChangedCallback);
2613
2614    #[link_name = "D_1651"]
2615    pub fn UnsetLogCallback(callback: LogCallback);
2616
2617    #[link_name = "D_1652"]
2618    pub fn UnsetCrashCallback(callback: CrashNotifyCallback);
2619
2620    #[link_name = "D_1653"]
2621    pub fn UnsetDCSyncLostCallback(callback: DCSyncLostCallback);
2622
2623    #[link_name = "D_1055"]
2624    pub fn StartPerformanceMonitoring(master_index: u16) -> c_int;
2625
2626    #[link_name = "D_1056"]
2627    pub fn StopPerformanceMonitoring(master_index: u16) -> c_int;
2628
2629    #[link_name = "D_1057"]
2630    pub fn GetRealtimeStats(master_index: u16, stats: *mut c_void) -> c_int;
2631
2632    #[link_name = "D_1146"]
2633    pub fn CiA402_GetTransitionCommand(current: c_int, target: c_int) -> u16;
2634
2635    #[link_name = "D_1147"]
2636    pub fn CiA402_RequestTransition(master_index: u16, slave_index: u16, target: c_int) -> u8;
2637
2638    #[link_name = "D_1148"]
2639    pub fn CiA402_FaultResetStep(master_index: u16, slave_index: u16, step: c_int) -> u8;
2640
2641    #[link_name = "D_1149"]
2642    pub fn CiA402_GetSupportedDriveModes(master_index: u16, slave_index: u16) -> u32;
2643
2644    #[link_name = "D_1150"]
2645    pub fn CiA402_IsModeSupported(master_index: u16, slave_index: u16, mode: c_int) -> u8;
2646
2647    #[link_name = "D_1151"]
2648    pub fn CiA402_GetQuickStopOption(master_index: u16, slave_index: u16) -> i16;
2649
2650    #[link_name = "D_1152"]
2651    pub fn CiA402_SetQuickStopOption(master_index: u16, slave_index: u16, value: i16) -> u8;
2652
2653    #[link_name = "D_1153"]
2654    pub fn CiA402_GetShutdownOption(master_index: u16, slave_index: u16) -> i16;
2655
2656    #[link_name = "D_1154"]
2657    pub fn CiA402_SetShutdownOption(master_index: u16, slave_index: u16, value: i16) -> u8;
2658
2659    #[link_name = "D_1155"]
2660    pub fn CiA402_GetDisableOperationOption(master_index: u16, slave_index: u16) -> i16;
2661
2662    #[link_name = "D_1156"]
2663    pub fn CiA402_SetDisableOperationOption(master_index: u16, slave_index: u16, value: i16) -> u8;
2664
2665    #[link_name = "D_1157"]
2666    pub fn CiA402_GetHaltOption(master_index: u16, slave_index: u16) -> i16;
2667
2668    #[link_name = "D_1158"]
2669    pub fn CiA402_SetHaltOption(master_index: u16, slave_index: u16, value: i16) -> u8;
2670
2671    #[link_name = "D_1159"]
2672    pub fn CiA402_GetFaultReactionOption(master_index: u16, slave_index: u16) -> i16;
2673
2674    #[link_name = "D_1160"]
2675    pub fn CiA402_SetFaultReactionOption(master_index: u16, slave_index: u16, value: i16) -> u8;
2676
2677    #[link_name = "D_1161"]
2678    pub fn CiA402_GetErrorCode(master_index: u16, slave_index: u16) -> u16;
2679
2680    #[link_name = "D_1162"]
2681    pub fn CiA402_GetErrorHistory(
2682        master_index: u16, slave_index: u16, out_codes: *mut u32, max_count: c_int,
2683    ) -> c_int;
2684
2685    #[link_name = "D_1163"]
2686    pub fn CiA402_ClearErrorHistory(master_index: u16, slave_index: u16) -> u8;
2687
2688    #[link_name = "D_1164"]
2689    pub fn CiA402_SetHomingMethod(master_index: u16, slave_index: u16, method: i8) -> u8;
2690
2691    #[link_name = "D_1165"]
2692    pub fn CiA402_GetHomingMethod(master_index: u16, slave_index: u16) -> i8;
2693
2694    #[link_name = "D_1166"]
2695    pub fn CiA402_GetSupportedHomingMethods(
2696        master_index: u16, slave_index: u16, out_methods: *mut i8, max_count: c_int,
2697    ) -> c_int;
2698
2699    #[link_name = "D_1167"]
2700    pub fn CiA402_IsStandardHomingMethod(method: i8) -> u8;
2701
2702    #[link_name = "D_1580"]
2703    pub fn EsmIsLegalTransition(from: c_int, to: c_int) -> c_int;
2704
2705    #[link_name = "D_1581"]
2706    pub fn EsmGetLegalTransitions(from: c_int, out_states: *mut u8, max_count: c_int) -> c_int;
2707
2708    #[link_name = "D_1582"]
2709    pub fn EsmGetDefaultTimeoutMs(from: c_int, to: c_int) -> u32;
2710
2711    #[link_name = "D_1583"]
2712    pub fn EsmIsKnownAlStatusCode(al_status_code: u16) -> c_int;
2713
2714    #[link_name = "D_1584"]
2715    pub fn EsmClassifyAlStatusCode(al_status_code: u16) -> c_int;
2716
2717    #[link_name = "D_1585"]
2718    pub fn EsmGetMasterClass(master_index: u16) -> u8;
2719
2720    #[link_name = "D_1259"]
2721    pub fn MDPGetConfigModuleList(
2722        master_index: u16, slave_index: u16, out_idents: *mut u32, max_count: c_int,
2723    ) -> c_int;
2724
2725    #[link_name = "D_1260"]
2726    pub fn MDPGetDetectedModuleList(
2727        master_index: u16, slave_index: u16, out_idents: *mut u32, max_count: c_int,
2728    ) -> c_int;
2729
2730    #[link_name = "D_1261"]
2731    pub fn MDPCheckModuleMatch(
2732        master_index: u16, slave_index: u16, out_first_mismatch: *mut c_int,
2733    ) -> c_int;
2734
2735    #[link_name = "D_1262"]
2736    pub fn MDPAutoEnumerate(master_index: u16) -> c_int;
2737
2738    #[link_name = "D_1372"]
2739    pub fn MBGStart(master_index: u16, udp_port: u16) -> c_int;
2740
2741    #[link_name = "D_1373"]
2742    pub fn MBGStop(master_index: u16) -> c_int;
2743
2744    #[link_name = "D_1374"]
2745    pub fn MBGIsRunning(master_index: u16) -> c_int;
2746
2747    #[link_name = "D_1375"]
2748    pub fn MBGGetStats(master_index: u16, stats: *mut MbgStatsC) -> c_int;
2749
2750    #[link_name = "D_1376"]
2751    pub fn MBGResetStats(master_index: u16);
2752
2753    #[link_name = "D_1377"]
2754    pub fn MBGGetPort(master_index: u16) -> u16;
2755
2756    #[link_name = "D_1378"]
2757    pub fn MBGStartTcp(master_index: u16, tcp_port: u16) -> c_int;
2758
2759    #[link_name = "D_1379"]
2760    pub fn MBGStopTcp(master_index: u16) -> c_int;
2761
2762    #[link_name = "D_1380"]
2763    pub fn MBGTcpIsRunning(master_index: u16) -> c_int;
2764
2765    #[link_name = "D_1381"]
2766    pub fn MBGGetTcpPort(master_index: u16) -> u16;
2767
2768    #[link_name = "D_1382"]
2769    pub fn MBGGetSelectedMaster(master_index: u16) -> u16;
2770
2771    #[link_name = "D_1383"]
2772    pub fn MBGSetSelectedMaster(master_index: u16, selected: u16) -> c_int;
2773
2774    #[link_name = "D_1384"]
2775    pub fn HotConnectAddGroup(
2776        master_index: u16, group_id: u16, alias: u16, vendor_id: u32, product_code: u32,
2777    ) -> c_int;
2778
2779    #[link_name = "D_1385"]
2780    pub fn HotConnectRemoveGroup(master_index: u16, group_id: u16) -> c_int;
2781
2782    #[link_name = "D_1386"]
2783    pub fn HotConnectGetGroupStatus(master_index: u16, group_id: u16) -> c_int;
2784
2785    #[link_name = "D_1387"]
2786    pub fn HotConnectEnumerate(master_index: u16, out_buf: *mut c_void, max: c_int) -> c_int;
2787
2788    #[link_name = "D_1388"]
2789    pub fn HotConnectClearAll(master_index: u16);
2790
2791    #[link_name = "D_1389"]
2792    pub fn HotConnectGetGroupCount(master_index: u16) -> c_int;
2793
2794    #[link_name = "D_1497"]
2795    pub fn EOESendFrameEx(
2796        master_index: u16, slave: u16, port: u8,
2797        frame_data: *const u8, frame_size: c_int, timeout: c_int,
2798    ) -> i32;
2799
2800    #[link_name = "D_1498"]
2801    pub fn EOESetAddressFilterFull(
2802        master_index: u16, slave: u16, port: u8,
2803        mac_filter: *const u8, mac_mask: *const u8, timeout: c_int,
2804    ) -> i32;
2805
2806    #[link_name = "D_1499"]
2807    pub fn EOESetReceiveHook(master_index: u16, callback: Option<EOEFrameCallback>) -> c_int;
2808
2809    #[link_name = "D_1500"]
2810    pub fn EOEClearReceiveHook(master_index: u16) -> c_int;
2811
2812    #[link_name = "D_1522"]
2813    pub fn VOEGetLastErrorCode(master_index: u16, slave: u16) -> u32;
2814
2815    #[link_name = "D_1523"]
2816    pub fn VOEStartNotificationListener(master_index: u16) -> c_int;
2817
2818    #[link_name = "D_1524"]
2819    pub fn VOEStopNotificationListener() -> c_int;
2820
2821    #[link_name = "D_1525"]
2822    pub fn VOEIsNotificationListening() -> c_int;
2823
2824    #[link_name = "D_1526"]
2825    pub fn VOERegisterNotification(
2826        slave: u16, vendor_id: u32, vendor_type: u16,
2827        callback: Option<VOENotificationCallback>, user_data: *mut c_void,
2828    ) -> c_int;
2829
2830    #[link_name = "D_1527"]
2831    pub fn VOEUnregisterNotification(subscription_index: c_int) -> c_int;
2832
2833    #[link_name = "D_1250"]
2834    pub fn mbx_submit_async_by_master(
2835        master_index: u16, txn: *mut EcMbxTransactionC, out_ticket: *mut u32,
2836    ) -> c_int;
2837
2838    #[link_name = "D_1251"]
2839    pub fn mbx_wait_by_master(master_index: u16, ticket: u32, timeout_ms: c_int) -> c_int;
2840
2841    #[link_name = "D_1252"]
2842    pub fn mbx_cancel_by_master(master_index: u16, ticket: u32) -> c_int;
2843
2844    #[link_name = "D_1253"]
2845    pub fn mbx_get_result_by_master(
2846        master_index: u16, ticket: u32, txn: *mut EcMbxTransactionC,
2847    ) -> c_int;
2848
2849    #[link_name = "D_1587"]
2850    pub fn GetCachePoolStatus(master_index: u16) -> c_int;
2851
2852    #[link_name = "D_1588"]
2853    pub fn GetCachePoolMode(master_index: u16) -> c_int;
2854
2855    #[link_name = "D_1591"]
2856    pub fn GetCachePoolError(master_index: u16) -> c_int;
2857
2858    #[link_name = "D_1554"]
2859    pub fn CopyMasterState(master_index: u16, out_state: *mut c_void) -> c_int;
2860
2861    #[link_name = "D_1598"]
2862    pub fn GetDiagnosticsSnapshot(master_index: u16) -> *const c_void;
2863
2864    #[link_name = "D_1308"]
2865    pub fn LockExpectedWKC(master_index: u16) -> c_int;
2866
2867    #[link_name = "D_1309"]
2868    pub fn UnlockExpectedWKC(master_index: u16) -> c_int;
2869
2870    #[link_name = "D_1310"]
2871    pub fn EnforceExpectedWkcLock(master_index: u16) -> c_int;
2872
2873    #[link_name = "D_1069"]
2874    pub fn SetWdkPdOffloadExtraGroup(master_index: u16, group: u8) -> c_int;
2875
2876    #[link_name = "D_1070"]
2877    pub fn DisableWdkPdOffloadExtraGroup(master_index: u16, group: u8) -> c_int;
2878
2879    #[link_name = "D_1071"]
2880    pub fn UpdateWdkWkcExpected(master_index: u16, expected: u16) -> c_int;
2881
2882    #[link_name = "D_1000"]
2883    pub fn RegisterExtraGroupMapping(master_index: u16, group: u8, slave_index: u16) -> c_int;
2884
2885    #[link_name = "D_1001"]
2886    pub fn ClearExtraGroupMapping(master_index: u16) -> c_int;
2887
2888    #[link_name = "D_1663"]
2889    pub fn GetSlaveFreeRunDemoted(master_index: u16, slave_index: u16) -> u8;
2890
2891    #[link_name = "D_1664"]
2892    pub fn GetSlaveMailboxHealth(master_index: u16, slave_index: u16) -> u8;
2893
2894    #[link_name = "D_1665"]
2895    pub fn GetSlaveHealthDegradedCount(master_index: u16, slave_index: u16) -> u32;
2896
2897    #[link_name = "D_1666"]
2898    pub fn RecoverSlaveMailboxHealth(master_index: u16, slave_index: u16) -> c_int;
2899
2900    #[link_name = "D_1674"]
2901    pub fn GetRtPreemptCount(master_index: u16) -> u64;
2902
2903    #[link_name = "D_1675"]
2904    pub fn GetRtPreemptPeakNs(master_index: u16) -> u32;
2905
2906    #[link_name = "D_1676"]
2907    pub fn GetBigGapUnknownCount(master_index: u16) -> u64;
2908
2909    #[link_name = "D_1677"]
2910    pub fn GetSmiMsrAvailable(master_index: u16) -> u32;
2911
2912    #[link_name = "D_1678"]
2913    pub fn GetWdkRtCpuIndex(master_index: u16) -> c_int;
2914
2915    #[link_name = "D_1679"]
2916    pub fn GetWdkRxCpuIndex(master_index: u16) -> c_int;
2917
2918    #[link_name = "D_1680"]
2919    pub fn GetWdkJitterInstrumentVer(master_index: u16) -> u32;
2920
2921    #[link_name = "D_1681"]
2922    pub fn GetWdkJitterHistBin(master_index: u16, bin_index: u32) -> u32;
2923
2924    #[link_name = "D_1682"]
2925    pub fn GetWdkJitterTotalSamples(master_index: u16) -> u64;
2926
2927    #[link_name = "D_1683"]
2928    pub fn GetWdkJitterMinNs(master_index: u16) -> u32;
2929
2930    #[link_name = "D_1684"]
2931    pub fn GetWdkJitterLastWakeDeltaNs(master_index: u16) -> c_int;
2932
2933    #[link_name = "D_1685"]
2934    pub fn GetWdkPathCountFast(master_index: u16) -> u32;
2935
2936    #[link_name = "D_1686"]
2937    pub fn GetWdkPathCountMed(master_index: u16) -> u32;
2938
2939    #[link_name = "D_1687"]
2940    pub fn GetWdkPathCountSlow(master_index: u16) -> u32;
2941
2942    #[link_name = "D_1688"]
2943    pub fn GetWdkKtimerWakeNormalCnt(master_index: u16) -> u32;
2944
2945    #[link_name = "D_1689"]
2946    pub fn GetWdkKtimerWakeOverrunCnt(master_index: u16) -> u32;
2947
2948    #[link_name = "D_1690"]
2949    pub fn GetWdkDispatchCycleMaxJitterNs(master_index: u16) -> u32;
2950
2951    #[link_name = "D_1691"]
2952    pub fn GetWdkDrainCycleMaxJitterNs(master_index: u16) -> u32;
2953
2954    #[link_name = "D_1692"]
2955    pub fn GetWdkDiagCounter(master_index: u16, counter_id: u32) -> u32;
2956
2957    #[link_name = "D_1695"]
2958    pub fn AcknowledgeSlaveReplacement(master_index: u16, slave_index: u16) -> c_int;
2959
2960    #[link_name = "D_1696"]
2961    pub fn EnablePDOMonitoring(enable: u8);
2962
2963    #[link_name = "D_1697"]
2964    pub fn GetPDOMapping(
2965        master_index: u16, slave_index: u16, pdo_type: u16,
2966        mapping_buffer: *mut c_void, buffer_size: u32, mapping_count: *mut u32,
2967    ) -> u8;
2968
2969    #[link_name = "D_1698"]
2970    pub fn GetPDOStats(master_index: u16, slave_index: u16) -> *const c_void;
2971
2972    #[link_name = "D_1701"]
2973    pub fn IsPDOMonitoringEnabled() -> u8;
2974
2975    #[link_name = "D_1702"]
2976    pub fn PDOBatchRead(
2977        master_index: u16, slave_indices: *const u16, slave_count: u32,
2978        data_buffers: *mut *mut c_void, buffer_sizes: *const u32, bytes_read: *mut u32,
2979    ) -> u32;
2980
2981    #[link_name = "D_1703"]
2982    pub fn PDOBatchWrite(
2983        master_index: u16, slave_indices: *const u16, slave_count: u32,
2984        data_buffers: *const *const c_void, data_sizes: *const u32,
2985    ) -> u32;
2986
2987    #[link_name = "D_1704"]
2988    pub fn PDOReadDirect(
2989        master_index: u16, slave_index: u16, pdo_index: u16,
2990        data_buffer: *mut c_void, buffer_size: u32, bytes_read: *mut u32,
2991    ) -> u8;
2992
2993    #[link_name = "D_1705"]
2994    pub fn PDOWriteDirect(
2995        master_index: u16, slave_index: u16, pdo_index: u16,
2996        data_buffer: *const c_void, data_size: u32,
2997    ) -> u8;
2998
2999    #[link_name = "D_1720"]
3000    pub fn ResetPDOStats(master_index: u16, slave_index: u16);
3001}
3002
3003#[repr(C)]
3004#[derive(Debug, Clone, Copy, Default)]
3005pub struct EcMbxStatsC {
3006
3007    pub total_sent: u64,
3008
3009    pub total_received: u64,
3010
3011    pub total_timeout: u64,
3012
3013    pub total_mbx_error: u64,
3014
3015    pub total_proto_error: u64,
3016
3017    pub total_cancelled: u64,
3018
3019    pub last_error_code: u32,
3020
3021    pub _pad1: u32,
3022
3023    pub last_error_time_us: u64,
3024
3025    pub total_latency_us: u64,
3026}