29039249e3edbfabaae3d50c547d0ac76ce41aa6
[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 %include ftdi.h
14 %{
15 #include <ftdi.h>
16 %}
17
18 %include ftdi_i.h
19 %{
20 #include <ftdi_i.h>
21 %}
22
23 extern "C" {
24
25 %apply char *OUTPUT { unsigned char *buf };
26     int ftdi_read_data(struct ftdi_context *ftdi, unsigned char *buf, int size);
27 %clear unsigned char *buf;
28
29 %apply int *OUTPUT { unsigned int *chunksize };
30     int ftdi_read_data_get_chunksize(struct ftdi_context *ftdi, unsigned int *chunksize);
31     int ftdi_write_data_get_chunksize(struct ftdi_context *ftdi, unsigned int *chunksize);
32 %clear unsigned int *chunksize;
33
34     //int ftdi_write_data_async(struct ftdi_context *ftdi, unsigned char *buf, int size);
35     //void ftdi_async_complete(struct ftdi_context *ftdi, int wait_for_more);
36 %apply char *OUTPUT { unsigned char *pins };
37     int ftdi_read_pins(struct ftdi_context *ftdi, unsigned char *pins);
38 %clear unsigned char *pins;
39
40 %apply char *OUTPUT { unsigned char *latency };
41     int ftdi_get_latency_timer(struct ftdi_context *ftdi, unsigned char *latency);
42 %clear unsigned char *latency;
43
44 %apply char *OUTPUT { unsigned short *status };
45     int ftdi_poll_modem_status(struct ftdi_context *ftdi, unsigned short *status);
46 %clear unsigned short *status;
47
48 %apply char *OUTPUT { unsigned char *output };
49     int  ftdi_eeprom_build(struct ftdi_context *ftdi);
50 %clear unsigned char *output;
51
52 %apply char *OUTPUT { unsigned char *eeprom };
53     int ftdi_read_eeprom(struct ftdi_context *ftdi);
54     int ftdi_write_eeprom(struct ftdi_context *ftdi);
55 %clear unsigned char *eeprom;
56
57 %apply int *OUTPUT { unsigned int *chipid };
58     int ftdi_read_chipid(struct ftdi_context *ftdi, unsigned int *chipid);
59 %clear unsigned int *chipid;
60
61 }