X-Git-Url: http://developer.intra2net.com/git/?p=libftdi;a=blobdiff_plain;f=src%2Fftdi.h;h=debf053bb9735b3f7ab4448043a790426f616c31;hp=15067c73c48f1b54b15ddfb327db9b8380dd16ff;hb=add00ad60e3d942f23233a0a25a39cebfced5c15;hpb=74387f27647e7123e233d31d36daedc6b485650a diff --git a/src/ftdi.h b/src/ftdi.h index 15067c7..debf053 100644 --- a/src/ftdi.h +++ b/src/ftdi.h @@ -2,7 +2,7 @@ ftdi.h - description ------------------- begin : Fri Apr 4 2003 - copyright : (C) 2003-2013 by Intra2net AG and the libftdi developers + copyright : (C) 2003-2014 by Intra2net AG and the libftdi developers email : opensource@intra2net.com ***************************************************************************/ @@ -20,6 +20,18 @@ #include #include +/* 'interface' might be defined as a macro on Windows, so we need to + * undefine it so as not to break the current libftdi API, because + * struct ftdi_context has an 'interface' member + * As this can be problematic if you include windows.h after ftdi.h + * in your sources, we force windows.h to be included first. */ +#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) +#include +#if defined(interface) +#undef interface +#endif +#endif + /** FTDI chip type */ enum ftdi_chip_type { @@ -106,7 +118,7 @@ enum ftdi_module_detach_mode #define EN_ADAPTIVE 0x96 #define DIS_ADAPTIVE 0x97 #define CLK_BYTES_OR_HIGH 0x9c -#define CLK_BYTES_OR_LOW 0x0d +#define CLK_BYTES_OR_LOW 0x9d /*FT232H specific commands */ #define DRIVE_OPEN_COLLECTOR 0x9e /* Value Low */ @@ -338,20 +350,27 @@ struct ftdi_device_list #define POWER_SAVE_DISABLE_H 0x80 #define USE_SERIAL_NUM 0x08 -enum ftdi_cbus_func /* FIXME: Recheck value, especially the last */ +enum ftdi_cbus_func { CBUS_TXDEN = 0, CBUS_PWREN = 1, CBUS_RXLED = 2, CBUS_TXLED = 3, CBUS_TXRXLED = 4, CBUS_SLEEP = 5, CBUS_CLK48 = 6, CBUS_CLK24 = 7, CBUS_CLK12 = 8, CBUS_CLK6 = 9, - CBUS_IOMODE = 0xa, CBUS_BB_WR = 0xb, CBUS_BB_RD = 0xc, CBUS_BB = 0xd + CBUS_IOMODE = 0xa, CBUS_BB_WR = 0xb, CBUS_BB_RD = 0xc +}; + +enum ftdi_cbush_func +{ + CBUSH_TRISTATE = 0, CBUSH_TXLED = 1, CBUSH_RXLED = 2, CBUSH_TXRXLED = 3, CBUSH_PWREN = 4, + CBUSH_SLEEP = 5, CBUSH_DRIVE_0 = 6, CBUSH_DRIVE1 = 7, CBUSH_IOMODE = 8, CBUSH_TXDEN = 9, + CBUSH_CLK30 = 10, CBUSH_CLK15 = 11, CBUSH_CLK7_5 = 12 }; -enum ftdi_cbush_func /* FIXME: Recheck value, especially the last */ +enum ftdi_cbusx_func { - CBUSH_TRISTATE = 0, CBUSH_RXLED = 1, CBUSH_TXLED = 2, CBUSH_TXRXLED = 3, CBUSH_PWREN = 4, - CBUSH_SLEEP = 5, CBUSH_DRIVE_0 = 6, CBUSG_DRIVE1 = 7, CBUSH_IOMODE = 8, CBUSH_TXDEN = 9, - CBUSH_CLK30 = 10, CBUSH_CLK15 = 11, CBUSH_CLK7_5 = 12, CBUSH_BAT_DETECT = 13, - CBUSH_BAT_DETECT_NEG = 14, CBUSH_I2C_TXE = 15, CBUSH_I2C_RXF = 16, CBUSH_VBUS_SENSE = 17, - CBUSH_BB_WR = 18, CBUSH_BB_RD = 19, CBUSH_TIME_STAMP = 20, CBUSH_AWAKE = 21, + CBUSX_TRISTATE = 0, CBUSX_TXLED = 1, CBUSX_RXLED = 2, CBUSX_TXRXLED = 3, CBUSX_PWREN = 4, + CBUSX_SLEEP = 5, CBUSX_DRIVE_0 = 6, CBUSX_DRIVE1 = 7, CBUSX_IOMODE = 8, CBUSX_TXDEN = 9, + CBUSX_CLK24 = 10, CBUSX_CLK12 = 11, CBUSX_CLK6 = 12, CBUSX_BAT_DETECT = 13, + CBUSX_BAT_DETECT_NEG = 14, CBUSX_I2C_TXE = 15, CBUSX_I2C_RXF = 16, CBUSX_VBUS_SENSE = 17, + CBUSX_BB_WR = 18, CBUSX_BB_RD = 19, CBUSX_TIME_STAMP = 20, CBUSX_AWAKE = 21 }; /** Invert TXD# */ @@ -452,7 +471,7 @@ extern "C" void ftdi_free(struct ftdi_context *ftdi); void ftdi_set_usbdev (struct ftdi_context *ftdi, struct libusb_device_handle *usbdev); - struct ftdi_version_info ftdi_get_library_version(); + struct ftdi_version_info ftdi_get_library_version(void); int ftdi_usb_find_all(struct ftdi_context *ftdi, struct ftdi_device_list **devlist, int vendor, int product); @@ -490,7 +509,7 @@ extern "C" int ftdi_read_data_set_chunksize(struct ftdi_context *ftdi, unsigned int chunksize); int ftdi_read_data_get_chunksize(struct ftdi_context *ftdi, unsigned int *chunksize); - int ftdi_write_data(struct ftdi_context *ftdi, unsigned char *buf, int size); + int ftdi_write_data(struct ftdi_context *ftdi, const unsigned char *buf, int size); int ftdi_write_data_set_chunksize(struct ftdi_context *ftdi, unsigned int chunksize); int ftdi_write_data_get_chunksize(struct ftdi_context *ftdi, unsigned int *chunksize);