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