| 1 | /* File: ftdi.i */ |
| 2 | |
| 3 | %module(docstring="Python interface to libftdi") ftdi |
| 4 | |
| 5 | %include "typemaps.i" |
| 6 | %include "cpointer.i" |
| 7 | %include "cstring.i" |
| 8 | |
| 9 | %typemap(in) unsigned char* = char*; |
| 10 | |
| 11 | %ignore ftdi_write_data_async; |
| 12 | %ignore ftdi_async_complete; |
| 13 | |
| 14 | %immutable ftdi_version_info::version_str; |
| 15 | %immutable ftdi_version_info::snapshot_str; |
| 16 | |
| 17 | %rename("%(strip:[ftdi_])s") ""; |
| 18 | |
| 19 | %apply char *OUTPUT { char * manufacturer }; |
| 20 | %apply char *OUTPUT { char * description }; |
| 21 | %apply char *OUTPUT { char * serial }; |
| 22 | %cstring_bounded_output( char * manufacturer, 256 ); |
| 23 | %cstring_bounded_output( char * description, 256 ); |
| 24 | %cstring_bounded_output( char * serial, 256 ); |
| 25 | int ftdi_usb_get_strings(struct ftdi_context *ftdi, struct libusb_device *dev, |
| 26 | char * manufacturer, int mnf_len, |
| 27 | char * description, int desc_len, |
| 28 | char * serial, int serial_len); |
| 29 | %clear char * manufacturer; |
| 30 | %clear char * description; |
| 31 | %clear char * serial; |
| 32 | |
| 33 | %apply char *OUTPUT { unsigned char *buf }; |
| 34 | int ftdi_read_data(struct ftdi_context *ftdi, unsigned char *buf, int size); |
| 35 | %clear unsigned char *buf; |
| 36 | |
| 37 | %apply int *OUTPUT { unsigned int *chunksize }; |
| 38 | int ftdi_read_data_get_chunksize(struct ftdi_context *ftdi, unsigned int *chunksize); |
| 39 | int ftdi_write_data_get_chunksize(struct ftdi_context *ftdi, unsigned int *chunksize); |
| 40 | %clear unsigned int *chunksize; |
| 41 | |
| 42 | %apply char *OUTPUT { unsigned char *pins }; |
| 43 | int ftdi_read_pins(struct ftdi_context *ftdi, unsigned char *pins); |
| 44 | %clear unsigned char *pins; |
| 45 | |
| 46 | %apply char *OUTPUT { unsigned char *latency }; |
| 47 | int ftdi_get_latency_timer(struct ftdi_context *ftdi, unsigned char *latency); |
| 48 | %clear unsigned char *latency; |
| 49 | |
| 50 | %apply short *OUTPUT { unsigned short *status }; |
| 51 | int ftdi_poll_modem_status(struct ftdi_context *ftdi, unsigned short *status); |
| 52 | %clear unsigned short *status; |
| 53 | |
| 54 | %apply int *OUTPUT { int* value }; |
| 55 | int ftdi_get_eeprom_value(struct ftdi_context *ftdi, enum ftdi_eeprom_value value_name, int* value); |
| 56 | %clear int* value; |
| 57 | |
| 58 | %apply short *OUTPUT { unsigned short *eeprom_val }; |
| 59 | int ftdi_read_eeprom_location (struct ftdi_context *ftdi, int eeprom_addr, unsigned short *eeprom_val); |
| 60 | %clear unsigned short *eeprom_val; |
| 61 | |
| 62 | %apply int *OUTPUT { unsigned int *chipid }; |
| 63 | int ftdi_read_chipid(struct ftdi_context *ftdi, unsigned int *chipid); |
| 64 | %clear unsigned int *chipid; |
| 65 | |
| 66 | %include ftdi.h |
| 67 | %{ |
| 68 | #include <ftdi.h> |
| 69 | %} |
| 70 | |
| 71 | %include ftdi_i.h |
| 72 | %{ |
| 73 | #include <ftdi_i.h> |
| 74 | %} |
| 75 | |
| 76 | %pointer_functions(struct ftdi_device_list *, device_listpp) |