ace244b134f26b2b9397d24a3fffaa3957202095
[libftdi] / bindings / ftdi.i
1 /* File: example.i */
2 %module ftdi
3 %include "typemaps.i"
4 %include "cpointer.i"
5 %pointer_functions(unsigned int, uintp);
6 %pointer_functions(unsigned char *, ucharp);
7 %pointer_functions(char *, charp);
8
9 %typemap(in) unsigned char* = char*;
10 %ignore ftdi_write_data_async;
11 %ignore ftdi_async_complete;
12
13 %immutable ftdi_version_info::version_str;
14 %immutable ftdi_version_info::snapshot_str;
15
16 %include ftdi.h
17 %{
18 #include <ftdi.h>
19 %}
20
21 %include ftdi_i.h
22 %{
23 #include <ftdi_i.h>
24 %}
25
26 extern "C" {
27
28 %apply char *OUTPUT { unsigned char *buf };
29     int ftdi_read_data(struct ftdi_context *ftdi, unsigned char *buf, int size);
30 %clear unsigned char *buf;
31
32 %apply int *OUTPUT { unsigned int *chunksize };
33     int ftdi_read_data_get_chunksize(struct ftdi_context *ftdi, unsigned int *chunksize);
34     int ftdi_write_data_get_chunksize(struct ftdi_context *ftdi, unsigned int *chunksize);
35 %clear unsigned int *chunksize;
36
37     //int ftdi_write_data_async(struct ftdi_context *ftdi, unsigned char *buf, int size);
38     //void ftdi_async_complete(struct ftdi_context *ftdi, int wait_for_more);
39 %apply char *OUTPUT { unsigned char *pins };
40     int ftdi_read_pins(struct ftdi_context *ftdi, unsigned char *pins);
41 %clear unsigned char *pins;
42
43 %apply char *OUTPUT { unsigned char *latency };
44     int ftdi_get_latency_timer(struct ftdi_context *ftdi, unsigned char *latency);
45 %clear unsigned char *latency;
46
47 %apply char *OUTPUT { unsigned short *status };
48     int ftdi_poll_modem_status(struct ftdi_context *ftdi, unsigned short *status);
49 %clear unsigned short *status;
50
51 %apply char *OUTPUT { unsigned char *output };
52     int  ftdi_eeprom_build(struct ftdi_context *ftdi);
53 %clear unsigned char *output;
54
55 %apply char *OUTPUT { unsigned char *eeprom };
56     int ftdi_read_eeprom(struct ftdi_context *ftdi);
57     int ftdi_write_eeprom(struct ftdi_context *ftdi);
58 %clear unsigned char *eeprom;
59
60 %apply int *OUTPUT { unsigned int *chipid };
61     int ftdi_read_chipid(struct ftdi_context *ftdi, unsigned int *chipid);
62 %clear unsigned int *chipid;
63
64 }