1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
/* automatically generated by rust-bindgen 0.59.1 */

pub type timeval = libc::timeval;
#[deprecated] pub const SIO_RESET_PURGE_RX: u32 = 1;
#[deprecated] pub const SIO_RESET_PURGE_TX: u32 = 2;

pub const SIO_RESET: u32 = 0;
pub const SIO_MODEM_CTRL: u32 = 1;
pub const SIO_SET_FLOW_CTRL: u32 = 2;
pub const SIO_SET_BAUD_RATE: u32 = 3;
pub const SIO_SET_DATA: u32 = 4;
pub const SIO_RESET_REQUEST: u32 = 0;
pub const SIO_SET_BAUDRATE_REQUEST: u32 = 3;
pub const SIO_SET_DATA_REQUEST: u32 = 4;
pub const SIO_SET_FLOW_CTRL_REQUEST: u32 = 2;
pub const SIO_SET_MODEM_CTRL_REQUEST: u32 = 1;
pub const SIO_POLL_MODEM_STATUS_REQUEST: u32 = 5;
pub const SIO_SET_EVENT_CHAR_REQUEST: u32 = 6;
pub const SIO_SET_ERROR_CHAR_REQUEST: u32 = 7;
pub const SIO_SET_LATENCY_TIMER_REQUEST: u32 = 9;
pub const SIO_GET_LATENCY_TIMER_REQUEST: u32 = 10;
pub const SIO_SET_BITMODE_REQUEST: u32 = 11;
pub const SIO_READ_PINS_REQUEST: u32 = 12;
pub const SIO_READ_EEPROM_REQUEST: u32 = 144;
pub const SIO_WRITE_EEPROM_REQUEST: u32 = 145;
pub const SIO_ERASE_EEPROM_REQUEST: u32 = 146;
pub const SIO_RESET_SIO: u32 = 0;
pub const SIO_TCIFLUSH: u32 = 2;
pub const SIO_TCOFLUSH: u32 = 1;
pub const SIO_DISABLE_FLOW_CTRL: ::std::os::raw::c_int = 0;
pub const SIO_RTS_CTS_HS: ::std::os::raw::c_int = 256;
pub const SIO_DTR_DSR_HS: ::std::os::raw::c_int = 512;
pub const SIO_XON_XOFF_HS: ::std::os::raw::c_int = 1024;
pub const SIO_SET_DTR_MASK: u32 = 1;
pub const SIO_SET_DTR_HIGH: u32 = 257;
pub const SIO_SET_DTR_LOW: u32 = 256;
pub const SIO_SET_RTS_MASK: u32 = 2;
pub const SIO_SET_RTS_HIGH: u32 = 514;
pub const SIO_SET_RTS_LOW: u32 = 512;
impl ftdi_chip_type {
    pub const TYPE_AM: ftdi_chip_type = ftdi_chip_type(0);
}
impl ftdi_chip_type {
    pub const TYPE_BM: ftdi_chip_type = ftdi_chip_type(1);
}
impl ftdi_chip_type {
    pub const TYPE_2232C: ftdi_chip_type = ftdi_chip_type(2);
}
impl ftdi_chip_type {
    pub const TYPE_R: ftdi_chip_type = ftdi_chip_type(3);
}
impl ftdi_chip_type {
    pub const TYPE_2232H: ftdi_chip_type = ftdi_chip_type(4);
}
impl ftdi_chip_type {
    pub const TYPE_4232H: ftdi_chip_type = ftdi_chip_type(5);
}
impl ftdi_chip_type {
    pub const TYPE_232H: ftdi_chip_type = ftdi_chip_type(6);
}
impl ftdi_chip_type {
    pub const TYPE_230X: ftdi_chip_type = ftdi_chip_type(7);
}
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct ftdi_chip_type(pub ::std::os::raw::c_uint);
impl ftdi_parity_type {
    pub const NONE: ftdi_parity_type = ftdi_parity_type(0);
}
impl ftdi_parity_type {
    pub const ODD: ftdi_parity_type = ftdi_parity_type(1);
}
impl ftdi_parity_type {
    pub const EVEN: ftdi_parity_type = ftdi_parity_type(2);
}
impl ftdi_parity_type {
    pub const MARK: ftdi_parity_type = ftdi_parity_type(3);
}
impl ftdi_parity_type {
    pub const SPACE: ftdi_parity_type = ftdi_parity_type(4);
}
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct ftdi_parity_type(pub ::std::os::raw::c_uint);
impl ftdi_stopbits_type {
    pub const STOP_BIT_1: ftdi_stopbits_type = ftdi_stopbits_type(0);
}
impl ftdi_stopbits_type {
    pub const STOP_BIT_15: ftdi_stopbits_type = ftdi_stopbits_type(1);
}
impl ftdi_stopbits_type {
    pub const STOP_BIT_2: ftdi_stopbits_type = ftdi_stopbits_type(2);
}
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct ftdi_stopbits_type(pub ::std::os::raw::c_uint);
impl ftdi_bits_type {
    pub const BITS_7: ftdi_bits_type = ftdi_bits_type(7);
}
impl ftdi_bits_type {
    pub const BITS_8: ftdi_bits_type = ftdi_bits_type(8);
}
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct ftdi_bits_type(pub ::std::os::raw::c_uint);
impl ftdi_break_type {
    pub const BREAK_OFF: ftdi_break_type = ftdi_break_type(0);
}
impl ftdi_break_type {
    pub const BREAK_ON: ftdi_break_type = ftdi_break_type(1);
}
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct ftdi_break_type(pub ::std::os::raw::c_uint);
impl ftdi_mpsse_mode {
    pub const BITMODE_RESET: ftdi_mpsse_mode = ftdi_mpsse_mode(0);
}
impl ftdi_mpsse_mode {
    pub const BITMODE_BITBANG: ftdi_mpsse_mode = ftdi_mpsse_mode(1);
}
impl ftdi_mpsse_mode {
    pub const BITMODE_MPSSE: ftdi_mpsse_mode = ftdi_mpsse_mode(2);
}
impl ftdi_mpsse_mode {
    pub const BITMODE_SYNCBB: ftdi_mpsse_mode = ftdi_mpsse_mode(4);
}
impl ftdi_mpsse_mode {
    pub const BITMODE_MCU: ftdi_mpsse_mode = ftdi_mpsse_mode(8);
}
impl ftdi_mpsse_mode {
    pub const BITMODE_OPTO: ftdi_mpsse_mode = ftdi_mpsse_mode(16);
}
impl ftdi_mpsse_mode {
    pub const BITMODE_CBUS: ftdi_mpsse_mode = ftdi_mpsse_mode(32);
}
impl ftdi_mpsse_mode {
    pub const BITMODE_SYNCFF: ftdi_mpsse_mode = ftdi_mpsse_mode(64);
}
impl ftdi_mpsse_mode {
    pub const BITMODE_FT1284: ftdi_mpsse_mode = ftdi_mpsse_mode(128);
}
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct ftdi_mpsse_mode(pub ::std::os::raw::c_uint);
impl ftdi_interface {
    pub const INTERFACE_ANY: ftdi_interface = ftdi_interface(0);
}
impl ftdi_interface {
    pub const INTERFACE_A: ftdi_interface = ftdi_interface(1);
}
impl ftdi_interface {
    pub const INTERFACE_B: ftdi_interface = ftdi_interface(2);
}
impl ftdi_interface {
    pub const INTERFACE_C: ftdi_interface = ftdi_interface(3);
}
impl ftdi_interface {
    pub const INTERFACE_D: ftdi_interface = ftdi_interface(4);
}
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct ftdi_interface(pub ::std::os::raw::c_uint);
impl ftdi_module_detach_mode {
    pub const AUTO_DETACH_SIO_MODULE: ftdi_module_detach_mode = ftdi_module_detach_mode(0);
}
impl ftdi_module_detach_mode {
    pub const DONT_DETACH_SIO_MODULE: ftdi_module_detach_mode = ftdi_module_detach_mode(1);
}
impl ftdi_module_detach_mode {
    pub const AUTO_DETACH_REATACH_SIO_MODULE: ftdi_module_detach_mode = ftdi_module_detach_mode(2);
}
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct ftdi_module_detach_mode(pub ::std::os::raw::c_uint);
#[repr(C)]
#[derive(Debug)]
pub struct ftdi_transfer_control {
    pub completed: ::std::os::raw::c_int,
    pub buf: *mut ::std::os::raw::c_uchar,
    pub size: ::std::os::raw::c_int,
    pub offset: ::std::os::raw::c_int,
    pub ftdi: *mut ftdi_context,
    pub transfer: *mut libusb_transfer,
}
#[repr(C)]
#[derive(Debug)]
pub struct ftdi_context {
    pub usb_ctx: *mut libusb_context,
    pub usb_dev: *mut libusb_device_handle,
    pub usb_read_timeout: ::std::os::raw::c_int,
    pub usb_write_timeout: ::std::os::raw::c_int,
    pub type_: ftdi_chip_type,
    pub baudrate: ::std::os::raw::c_int,
    pub bitbang_enabled: ::std::os::raw::c_uchar,
    pub readbuffer: *mut ::std::os::raw::c_uchar,
    pub readbuffer_offset: ::std::os::raw::c_uint,
    pub readbuffer_remaining: ::std::os::raw::c_uint,
    pub readbuffer_chunksize: ::std::os::raw::c_uint,
    pub writebuffer_chunksize: ::std::os::raw::c_uint,
    pub max_packet_size: ::std::os::raw::c_uint,
    pub interface: ::std::os::raw::c_int,
    pub index: ::std::os::raw::c_int,
    pub in_ep: ::std::os::raw::c_int,
    pub out_ep: ::std::os::raw::c_int,
    pub bitbang_mode: ::std::os::raw::c_uchar,
    pub eeprom: *mut ftdi_eeprom,
    pub error_str: *const ::std::os::raw::c_char,
    pub module_detach_mode: ftdi_module_detach_mode,
}
impl ftdi_eeprom_value {
    pub const VENDOR_ID: ftdi_eeprom_value = ftdi_eeprom_value(0);
}
impl ftdi_eeprom_value {
    pub const PRODUCT_ID: ftdi_eeprom_value = ftdi_eeprom_value(1);
}
impl ftdi_eeprom_value {
    pub const SELF_POWERED: ftdi_eeprom_value = ftdi_eeprom_value(2);
}
impl ftdi_eeprom_value {
    pub const REMOTE_WAKEUP: ftdi_eeprom_value = ftdi_eeprom_value(3);
}
impl ftdi_eeprom_value {
    pub const IS_NOT_PNP: ftdi_eeprom_value = ftdi_eeprom_value(4);
}
impl ftdi_eeprom_value {
    pub const SUSPEND_DBUS7: ftdi_eeprom_value = ftdi_eeprom_value(5);
}
impl ftdi_eeprom_value {
    pub const IN_IS_ISOCHRONOUS: ftdi_eeprom_value = ftdi_eeprom_value(6);
}
impl ftdi_eeprom_value {
    pub const OUT_IS_ISOCHRONOUS: ftdi_eeprom_value = ftdi_eeprom_value(7);
}
impl ftdi_eeprom_value {
    pub const SUSPEND_PULL_DOWNS: ftdi_eeprom_value = ftdi_eeprom_value(8);
}
impl ftdi_eeprom_value {
    pub const USE_SERIAL: ftdi_eeprom_value = ftdi_eeprom_value(9);
}
impl ftdi_eeprom_value {
    pub const USB_VERSION: ftdi_eeprom_value = ftdi_eeprom_value(10);
}
impl ftdi_eeprom_value {
    pub const USE_USB_VERSION: ftdi_eeprom_value = ftdi_eeprom_value(11);
}
impl ftdi_eeprom_value {
    pub const MAX_POWER: ftdi_eeprom_value = ftdi_eeprom_value(12);
}
impl ftdi_eeprom_value {
    pub const CHANNEL_A_TYPE: ftdi_eeprom_value = ftdi_eeprom_value(13);
}
impl ftdi_eeprom_value {
    pub const CHANNEL_B_TYPE: ftdi_eeprom_value = ftdi_eeprom_value(14);
}
impl ftdi_eeprom_value {
    pub const CHANNEL_A_DRIVER: ftdi_eeprom_value = ftdi_eeprom_value(15);
}
impl ftdi_eeprom_value {
    pub const CHANNEL_B_DRIVER: ftdi_eeprom_value = ftdi_eeprom_value(16);
}
impl ftdi_eeprom_value {
    pub const CBUS_FUNCTION_0: ftdi_eeprom_value = ftdi_eeprom_value(17);
}
impl ftdi_eeprom_value {
    pub const CBUS_FUNCTION_1: ftdi_eeprom_value = ftdi_eeprom_value(18);
}
impl ftdi_eeprom_value {
    pub const CBUS_FUNCTION_2: ftdi_eeprom_value = ftdi_eeprom_value(19);
}
impl ftdi_eeprom_value {
    pub const CBUS_FUNCTION_3: ftdi_eeprom_value = ftdi_eeprom_value(20);
}
impl ftdi_eeprom_value {
    pub const CBUS_FUNCTION_4: ftdi_eeprom_value = ftdi_eeprom_value(21);
}
impl ftdi_eeprom_value {
    pub const CBUS_FUNCTION_5: ftdi_eeprom_value = ftdi_eeprom_value(22);
}
impl ftdi_eeprom_value {
    pub const CBUS_FUNCTION_6: ftdi_eeprom_value = ftdi_eeprom_value(23);
}
impl ftdi_eeprom_value {
    pub const CBUS_FUNCTION_7: ftdi_eeprom_value = ftdi_eeprom_value(24);
}
impl ftdi_eeprom_value {
    pub const CBUS_FUNCTION_8: ftdi_eeprom_value = ftdi_eeprom_value(25);
}
impl ftdi_eeprom_value {
    pub const CBUS_FUNCTION_9: ftdi_eeprom_value = ftdi_eeprom_value(26);
}
impl ftdi_eeprom_value {
    pub const HIGH_CURRENT: ftdi_eeprom_value = ftdi_eeprom_value(27);
}
impl ftdi_eeprom_value {
    pub const HIGH_CURRENT_A: ftdi_eeprom_value = ftdi_eeprom_value(28);
}
impl ftdi_eeprom_value {
    pub const HIGH_CURRENT_B: ftdi_eeprom_value = ftdi_eeprom_value(29);
}
impl ftdi_eeprom_value {
    pub const INVERT: ftdi_eeprom_value = ftdi_eeprom_value(30);
}
impl ftdi_eeprom_value {
    pub const GROUP0_DRIVE: ftdi_eeprom_value = ftdi_eeprom_value(31);
}
impl ftdi_eeprom_value {
    pub const GROUP0_SCHMITT: ftdi_eeprom_value = ftdi_eeprom_value(32);
}
impl ftdi_eeprom_value {
    pub const GROUP0_SLEW: ftdi_eeprom_value = ftdi_eeprom_value(33);
}
impl ftdi_eeprom_value {
    pub const GROUP1_DRIVE: ftdi_eeprom_value = ftdi_eeprom_value(34);
}
impl ftdi_eeprom_value {
    pub const GROUP1_SCHMITT: ftdi_eeprom_value = ftdi_eeprom_value(35);
}
impl ftdi_eeprom_value {
    pub const GROUP1_SLEW: ftdi_eeprom_value = ftdi_eeprom_value(36);
}
impl ftdi_eeprom_value {
    pub const GROUP2_DRIVE: ftdi_eeprom_value = ftdi_eeprom_value(37);
}
impl ftdi_eeprom_value {
    pub const GROUP2_SCHMITT: ftdi_eeprom_value = ftdi_eeprom_value(38);
}
impl ftdi_eeprom_value {
    pub const GROUP2_SLEW: ftdi_eeprom_value = ftdi_eeprom_value(39);
}
impl ftdi_eeprom_value {
    pub const GROUP3_DRIVE: ftdi_eeprom_value = ftdi_eeprom_value(40);
}
impl ftdi_eeprom_value {
    pub const GROUP3_SCHMITT: ftdi_eeprom_value = ftdi_eeprom_value(41);
}
impl ftdi_eeprom_value {
    pub const GROUP3_SLEW: ftdi_eeprom_value = ftdi_eeprom_value(42);
}
impl ftdi_eeprom_value {
    pub const CHIP_SIZE: ftdi_eeprom_value = ftdi_eeprom_value(43);
}
impl ftdi_eeprom_value {
    pub const CHIP_TYPE: ftdi_eeprom_value = ftdi_eeprom_value(44);
}
impl ftdi_eeprom_value {
    pub const POWER_SAVE: ftdi_eeprom_value = ftdi_eeprom_value(45);
}
impl ftdi_eeprom_value {
    pub const CLOCK_POLARITY: ftdi_eeprom_value = ftdi_eeprom_value(46);
}
impl ftdi_eeprom_value {
    pub const DATA_ORDER: ftdi_eeprom_value = ftdi_eeprom_value(47);
}
impl ftdi_eeprom_value {
    pub const FLOW_CONTROL: ftdi_eeprom_value = ftdi_eeprom_value(48);
}
impl ftdi_eeprom_value {
    pub const CHANNEL_C_DRIVER: ftdi_eeprom_value = ftdi_eeprom_value(49);
}
impl ftdi_eeprom_value {
    pub const CHANNEL_D_DRIVER: ftdi_eeprom_value = ftdi_eeprom_value(50);
}
impl ftdi_eeprom_value {
    pub const CHANNEL_A_RS485: ftdi_eeprom_value = ftdi_eeprom_value(51);
}
impl ftdi_eeprom_value {
    pub const CHANNEL_B_RS485: ftdi_eeprom_value = ftdi_eeprom_value(52);
}
impl ftdi_eeprom_value {
    pub const CHANNEL_C_RS485: ftdi_eeprom_value = ftdi_eeprom_value(53);
}
impl ftdi_eeprom_value {
    pub const CHANNEL_D_RS485: ftdi_eeprom_value = ftdi_eeprom_value(54);
}
impl ftdi_eeprom_value {
    pub const RELEASE_NUMBER: ftdi_eeprom_value = ftdi_eeprom_value(55);
}
impl ftdi_eeprom_value {
    pub const EXTERNAL_OSCILLATOR: ftdi_eeprom_value = ftdi_eeprom_value(56);
}
impl ftdi_eeprom_value {
    pub const USER_DATA_ADDR: ftdi_eeprom_value = ftdi_eeprom_value(57);
}
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct ftdi_eeprom_value(pub ::std::os::raw::c_uint);
#[repr(C)]
#[derive(Debug)]
pub struct ftdi_device_list {
    pub next: *mut ftdi_device_list,
    pub dev: *mut libusb_device,
}
impl ftdi_cbus_func {
    pub const CBUS_TXDEN: ftdi_cbus_func = ftdi_cbus_func(0);
}
impl ftdi_cbus_func {
    pub const CBUS_PWREN: ftdi_cbus_func = ftdi_cbus_func(1);
}
impl ftdi_cbus_func {
    pub const CBUS_RXLED: ftdi_cbus_func = ftdi_cbus_func(2);
}
impl ftdi_cbus_func {
    pub const CBUS_TXLED: ftdi_cbus_func = ftdi_cbus_func(3);
}
impl ftdi_cbus_func {
    pub const CBUS_TXRXLED: ftdi_cbus_func = ftdi_cbus_func(4);
}
impl ftdi_cbus_func {
    pub const CBUS_SLEEP: ftdi_cbus_func = ftdi_cbus_func(5);
}
impl ftdi_cbus_func {
    pub const CBUS_CLK48: ftdi_cbus_func = ftdi_cbus_func(6);
}
impl ftdi_cbus_func {
    pub const CBUS_CLK24: ftdi_cbus_func = ftdi_cbus_func(7);
}
impl ftdi_cbus_func {
    pub const CBUS_CLK12: ftdi_cbus_func = ftdi_cbus_func(8);
}
impl ftdi_cbus_func {
    pub const CBUS_CLK6: ftdi_cbus_func = ftdi_cbus_func(9);
}
impl ftdi_cbus_func {
    pub const CBUS_IOMODE: ftdi_cbus_func = ftdi_cbus_func(10);
}
impl ftdi_cbus_func {
    pub const CBUS_BB_WR: ftdi_cbus_func = ftdi_cbus_func(11);
}
impl ftdi_cbus_func {
    pub const CBUS_BB_RD: ftdi_cbus_func = ftdi_cbus_func(12);
}
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct ftdi_cbus_func(pub ::std::os::raw::c_uint);
impl ftdi_cbush_func {
    pub const CBUSH_TRISTATE: ftdi_cbush_func = ftdi_cbush_func(0);
}
impl ftdi_cbush_func {
    pub const CBUSH_TXLED: ftdi_cbush_func = ftdi_cbush_func(1);
}
impl ftdi_cbush_func {
    pub const CBUSH_RXLED: ftdi_cbush_func = ftdi_cbush_func(2);
}
impl ftdi_cbush_func {
    pub const CBUSH_TXRXLED: ftdi_cbush_func = ftdi_cbush_func(3);
}
impl ftdi_cbush_func {
    pub const CBUSH_PWREN: ftdi_cbush_func = ftdi_cbush_func(4);
}
impl ftdi_cbush_func {
    pub const CBUSH_SLEEP: ftdi_cbush_func = ftdi_cbush_func(5);
}
impl ftdi_cbush_func {
    pub const CBUSH_DRIVE_0: ftdi_cbush_func = ftdi_cbush_func(6);
}
impl ftdi_cbush_func {
    pub const CBUSH_DRIVE1: ftdi_cbush_func = ftdi_cbush_func(7);
}
impl ftdi_cbush_func {
    pub const CBUSH_IOMODE: ftdi_cbush_func = ftdi_cbush_func(8);
}
impl ftdi_cbush_func {
    pub const CBUSH_TXDEN: ftdi_cbush_func = ftdi_cbush_func(9);
}
impl ftdi_cbush_func {
    pub const CBUSH_CLK30: ftdi_cbush_func = ftdi_cbush_func(10);
}
impl ftdi_cbush_func {
    pub const CBUSH_CLK15: ftdi_cbush_func = ftdi_cbush_func(11);
}
impl ftdi_cbush_func {
    pub const CBUSH_CLK7_5: ftdi_cbush_func = ftdi_cbush_func(12);
}
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct ftdi_cbush_func(pub ::std::os::raw::c_uint);
impl ftdi_cbusx_func {
    pub const CBUSX_TRISTATE: ftdi_cbusx_func = ftdi_cbusx_func(0);
}
impl ftdi_cbusx_func {
    pub const CBUSX_TXLED: ftdi_cbusx_func = ftdi_cbusx_func(1);
}
impl ftdi_cbusx_func {
    pub const CBUSX_RXLED: ftdi_cbusx_func = ftdi_cbusx_func(2);
}
impl ftdi_cbusx_func {
    pub const CBUSX_TXRXLED: ftdi_cbusx_func = ftdi_cbusx_func(3);
}
impl ftdi_cbusx_func {
    pub const CBUSX_PWREN: ftdi_cbusx_func = ftdi_cbusx_func(4);
}
impl ftdi_cbusx_func {
    pub const CBUSX_SLEEP: ftdi_cbusx_func = ftdi_cbusx_func(5);
}
impl ftdi_cbusx_func {
    pub const CBUSX_DRIVE_0: ftdi_cbusx_func = ftdi_cbusx_func(6);
}
impl ftdi_cbusx_func {
    pub const CBUSX_DRIVE1: ftdi_cbusx_func = ftdi_cbusx_func(7);
}
impl ftdi_cbusx_func {
    pub const CBUSX_IOMODE: ftdi_cbusx_func = ftdi_cbusx_func(8);
}
impl ftdi_cbusx_func {
    pub const CBUSX_TXDEN: ftdi_cbusx_func = ftdi_cbusx_func(9);
}
impl ftdi_cbusx_func {
    pub const CBUSX_CLK24: ftdi_cbusx_func = ftdi_cbusx_func(10);
}
impl ftdi_cbusx_func {
    pub const CBUSX_CLK12: ftdi_cbusx_func = ftdi_cbusx_func(11);
}
impl ftdi_cbusx_func {
    pub const CBUSX_CLK6: ftdi_cbusx_func = ftdi_cbusx_func(12);
}
impl ftdi_cbusx_func {
    pub const CBUSX_BAT_DETECT: ftdi_cbusx_func = ftdi_cbusx_func(13);
}
impl ftdi_cbusx_func {
    pub const CBUSX_BAT_DETECT_NEG: ftdi_cbusx_func = ftdi_cbusx_func(14);
}
impl ftdi_cbusx_func {
    pub const CBUSX_I2C_TXE: ftdi_cbusx_func = ftdi_cbusx_func(15);
}
impl ftdi_cbusx_func {
    pub const CBUSX_I2C_RXF: ftdi_cbusx_func = ftdi_cbusx_func(16);
}
impl ftdi_cbusx_func {
    pub const CBUSX_VBUS_SENSE: ftdi_cbusx_func = ftdi_cbusx_func(17);
}
impl ftdi_cbusx_func {
    pub const CBUSX_BB_WR: ftdi_cbusx_func = ftdi_cbusx_func(18);
}
impl ftdi_cbusx_func {
    pub const CBUSX_BB_RD: ftdi_cbusx_func = ftdi_cbusx_func(19);
}
impl ftdi_cbusx_func {
    pub const CBUSX_TIME_STAMP: ftdi_cbusx_func = ftdi_cbusx_func(20);
}
impl ftdi_cbusx_func {
    pub const CBUSX_AWAKE: ftdi_cbusx_func = ftdi_cbusx_func(21);
}
#[repr(transparent)]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct ftdi_cbusx_func(pub ::std::os::raw::c_uint);
#[repr(C)]
pub struct size_and_time {
    pub totalBytes: u64,
    pub time: timeval,
}
#[repr(C)]
pub struct FTDIProgressInfo {
    pub first: size_and_time,
    pub prev: size_and_time,
    pub current: size_and_time,
    pub totalTime: f64,
    pub totalRate: f64,
    pub currentRate: f64,
}
pub type FTDIStreamCallback = ::std::option::Option<
    unsafe extern "C" fn(
        buffer: *mut u8,
        length: ::std::os::raw::c_int,
        progress: *mut FTDIProgressInfo,
        userdata: *mut ::std::os::raw::c_void,
    ) -> ::std::os::raw::c_int,
>;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ftdi_version_info {
    pub major: ::std::os::raw::c_int,
    pub minor: ::std::os::raw::c_int,
    pub micro: ::std::os::raw::c_int,
    pub version_str: *const ::std::os::raw::c_char,
    pub snapshot_str: *const ::std::os::raw::c_char,
}
extern "C" {
    pub fn ftdi_init(ftdi: *mut ftdi_context) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn ftdi_new() -> *mut ftdi_context;
}
extern "C" {
    pub fn ftdi_set_interface(
        ftdi: *mut ftdi_context,
        interface: ftdi_interface,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn ftdi_deinit(ftdi: *mut ftdi_context);
}
extern "C" {
    pub fn ftdi_free(ftdi: *mut ftdi_context);
}
extern "C" {
    pub fn ftdi_set_usbdev(ftdi: *mut ftdi_context, usbdev: *mut libusb_device_handle);
}
extern "C" {
    pub fn ftdi_get_library_version() -> ftdi_version_info;
}
extern "C" {
    pub fn ftdi_usb_find_all(
        ftdi: *mut ftdi_context,
        devlist: *mut *mut ftdi_device_list,
        vendor: ::std::os::raw::c_int,
        product: ::std::os::raw::c_int,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn ftdi_list_free(devlist: *mut *mut ftdi_device_list);
}
extern "C" {
    pub fn ftdi_list_free2(devlist: *mut ftdi_device_list);
}
extern "C" {
    pub fn ftdi_usb_get_strings(
        ftdi: *mut ftdi_context,
        dev: *mut libusb_device,
        manufacturer: *mut ::std::os::raw::c_char,
        mnf_len: ::std::os::raw::c_int,
        description: *mut ::std::os::raw::c_char,
        desc_len: ::std::os::raw::c_int,
        serial: *mut ::std::os::raw::c_char,
        serial_len: ::std::os::raw::c_int,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn ftdi_usb_get_strings2(
        ftdi: *mut ftdi_context,
        dev: *mut libusb_device,
        manufacturer: *mut ::std::os::raw::c_char,
        mnf_len: ::std::os::raw::c_int,
        description: *mut ::std::os::raw::c_char,
        desc_len: ::std::os::raw::c_int,
        serial: *mut ::std::os::raw::c_char,
        serial_len: ::std::os::raw::c_int,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn ftdi_eeprom_get_strings(
        ftdi: *mut ftdi_context,
        manufacturer: *mut ::std::os::raw::c_char,
        mnf_len: ::std::os::raw::c_int,
        product: *mut ::std::os::raw::c_char,
        prod_len: ::std::os::raw::c_int,
        serial: *mut ::std::os::raw::c_char,
        serial_len: ::std::os::raw::c_int,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn ftdi_eeprom_set_strings(
        ftdi: *mut ftdi_context,
        manufacturer: *const ::std::os::raw::c_char,
        product: *const ::std::os::raw::c_char,
        serial: *const ::std::os::raw::c_char,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn ftdi_usb_open(
        ftdi: *mut ftdi_context,
        vendor: ::std::os::raw::c_int,
        product: ::std::os::raw::c_int,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn ftdi_usb_open_desc(
        ftdi: *mut ftdi_context,
        vendor: ::std::os::raw::c_int,
        product: ::std::os::raw::c_int,
        description: *const ::std::os::raw::c_char,
        serial: *const ::std::os::raw::c_char,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn ftdi_usb_open_desc_index(
        ftdi: *mut ftdi_context,
        vendor: ::std::os::raw::c_int,
        product: ::std::os::raw::c_int,
        description: *const ::std::os::raw::c_char,
        serial: *const ::std::os::raw::c_char,
        index: ::std::os::raw::c_uint,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn ftdi_usb_open_bus_addr(
        ftdi: *mut ftdi_context,
        bus: u8,
        addr: u8,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn ftdi_usb_open_dev(
        ftdi: *mut ftdi_context,
        dev: *mut libusb_device,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn ftdi_usb_open_string(
        ftdi: *mut ftdi_context,
        description: *const ::std::os::raw::c_char,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn ftdi_usb_close(ftdi: *mut ftdi_context) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn ftdi_usb_reset(ftdi: *mut ftdi_context) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn ftdi_tciflush(ftdi: *mut ftdi_context) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn ftdi_tcoflush(ftdi: *mut ftdi_context) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn ftdi_tcioflush(ftdi: *mut ftdi_context) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn ftdi_usb_purge_rx_buffer(ftdi: *mut ftdi_context) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn ftdi_usb_purge_tx_buffer(ftdi: *mut ftdi_context) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn ftdi_usb_purge_buffers(ftdi: *mut ftdi_context) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn ftdi_set_baudrate(
        ftdi: *mut ftdi_context,
        baudrate: ::std::os::raw::c_int,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn ftdi_set_line_property(
        ftdi: *mut ftdi_context,
        bits: ftdi_bits_type,
        sbit: ftdi_stopbits_type,
        parity: ftdi_parity_type,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn ftdi_set_line_property2(
        ftdi: *mut ftdi_context,
        bits: ftdi_bits_type,
        sbit: ftdi_stopbits_type,
        parity: ftdi_parity_type,
        break_type: ftdi_break_type,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn ftdi_read_data(
        ftdi: *mut ftdi_context,
        buf: *mut ::std::os::raw::c_uchar,
        size: ::std::os::raw::c_int,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn ftdi_read_data_set_chunksize(
        ftdi: *mut ftdi_context,
        chunksize: ::std::os::raw::c_uint,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn ftdi_read_data_get_chunksize(
        ftdi: *mut ftdi_context,
        chunksize: *mut ::std::os::raw::c_uint,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn ftdi_write_data(
        ftdi: *mut ftdi_context,
        buf: *const ::std::os::raw::c_uchar,
        size: ::std::os::raw::c_int,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn ftdi_write_data_set_chunksize(
        ftdi: *mut ftdi_context,
        chunksize: ::std::os::raw::c_uint,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn ftdi_write_data_get_chunksize(
        ftdi: *mut ftdi_context,
        chunksize: *mut ::std::os::raw::c_uint,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn ftdi_readstream(
        ftdi: *mut ftdi_context,
        callback: FTDIStreamCallback,
        userdata: *mut ::std::os::raw::c_void,
        packetsPerTransfer: ::std::os::raw::c_int,
        numTransfers: ::std::os::raw::c_int,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn ftdi_write_data_submit(
        ftdi: *mut ftdi_context,
        buf: *mut ::std::os::raw::c_uchar,
        size: ::std::os::raw::c_int,
    ) -> *mut ftdi_transfer_control;
}
extern "C" {
    pub fn ftdi_read_data_submit(
        ftdi: *mut ftdi_context,
        buf: *mut ::std::os::raw::c_uchar,
        size: ::std::os::raw::c_int,
    ) -> *mut ftdi_transfer_control;
}
extern "C" {
    pub fn ftdi_transfer_data_done(tc: *mut ftdi_transfer_control) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn ftdi_transfer_data_cancel(tc: *mut ftdi_transfer_control, to: *mut timeval);
}
extern "C" {
    pub fn ftdi_set_bitmode(
        ftdi: *mut ftdi_context,
        bitmask: ::std::os::raw::c_uchar,
        mode: ::std::os::raw::c_uchar,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn ftdi_disable_bitbang(ftdi: *mut ftdi_context) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn ftdi_read_pins(
        ftdi: *mut ftdi_context,
        pins: *mut ::std::os::raw::c_uchar,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn ftdi_set_latency_timer(
        ftdi: *mut ftdi_context,
        latency: ::std::os::raw::c_uchar,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn ftdi_get_latency_timer(
        ftdi: *mut ftdi_context,
        latency: *mut ::std::os::raw::c_uchar,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn ftdi_poll_modem_status(
        ftdi: *mut ftdi_context,
        status: *mut ::std::os::raw::c_ushort,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn ftdi_setflowctrl(
        ftdi: *mut ftdi_context,
        flowctrl: ::std::os::raw::c_int,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn ftdi_setflowctrl_xonxoff(
        ftdi: *mut ftdi_context,
        xon: ::std::os::raw::c_uchar,
        xoff: ::std::os::raw::c_uchar,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn ftdi_setdtr_rts(
        ftdi: *mut ftdi_context,
        dtr: ::std::os::raw::c_int,
        rts: ::std::os::raw::c_int,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn ftdi_setdtr(
        ftdi: *mut ftdi_context,
        state: ::std::os::raw::c_int,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn ftdi_setrts(
        ftdi: *mut ftdi_context,
        state: ::std::os::raw::c_int,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn ftdi_set_event_char(
        ftdi: *mut ftdi_context,
        eventch: ::std::os::raw::c_uchar,
        enable: ::std::os::raw::c_uchar,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn ftdi_set_error_char(
        ftdi: *mut ftdi_context,
        errorch: ::std::os::raw::c_uchar,
        enable: ::std::os::raw::c_uchar,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn ftdi_eeprom_initdefaults(
        ftdi: *mut ftdi_context,
        manufacturer: *mut ::std::os::raw::c_char,
        product: *mut ::std::os::raw::c_char,
        serial: *mut ::std::os::raw::c_char,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn ftdi_eeprom_build(ftdi: *mut ftdi_context) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn ftdi_eeprom_decode(
        ftdi: *mut ftdi_context,
        verbose: ::std::os::raw::c_int,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn ftdi_get_eeprom_value(
        ftdi: *mut ftdi_context,
        value_name: ftdi_eeprom_value,
        value: *mut ::std::os::raw::c_int,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn ftdi_set_eeprom_value(
        ftdi: *mut ftdi_context,
        value_name: ftdi_eeprom_value,
        value: ::std::os::raw::c_int,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn ftdi_get_eeprom_buf(
        ftdi: *mut ftdi_context,
        buf: *mut ::std::os::raw::c_uchar,
        size: ::std::os::raw::c_int,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn ftdi_set_eeprom_buf(
        ftdi: *mut ftdi_context,
        buf: *const ::std::os::raw::c_uchar,
        size: ::std::os::raw::c_int,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn ftdi_set_eeprom_user_data(
        ftdi: *mut ftdi_context,
        buf: *const ::std::os::raw::c_char,
        size: ::std::os::raw::c_int,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn ftdi_read_eeprom(ftdi: *mut ftdi_context) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn ftdi_read_chipid(
        ftdi: *mut ftdi_context,
        chipid: *mut ::std::os::raw::c_uint,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn ftdi_write_eeprom(ftdi: *mut ftdi_context) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn ftdi_erase_eeprom(ftdi: *mut ftdi_context) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn ftdi_read_eeprom_location(
        ftdi: *mut ftdi_context,
        eeprom_addr: ::std::os::raw::c_int,
        eeprom_val: *mut ::std::os::raw::c_ushort,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn ftdi_write_eeprom_location(
        ftdi: *mut ftdi_context,
        eeprom_addr: ::std::os::raw::c_int,
        eeprom_val: ::std::os::raw::c_ushort,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn ftdi_get_error_string(ftdi: *mut ftdi_context) -> *const ::std::os::raw::c_char;
}
#[repr(C)]
#[derive(Debug)]
pub struct ftdi_eeprom {
    pub _address: u8,
}