Perhaps something like:
enum ftdi_interface
{
INTERFACE_ANY = 0,
INTERFACE_A = 0x10,
INTERFACE_B = 0x20,
INTERFACE_C = 0x40,
INTERFACE_D = 0x80,
INTERFACE_A_OR_B = INTERFACE_A | INTERFACE_B,
INTERFACE_A_OR_C = INTERFACE_A | INTERFACE_C,
INTERFACE_A_OR_D = INTERFACE_A | INTERFACE_D,
INTERFACE_B_OR_C = INTERFACE_B | INTERFACE_C,
INTERFACE_B_OR_D = INTERFACE_B | INTERFACE_D,
INTERFACE_C_OR_D = INTERFACE_C | INTERFACE_D,
INTERFACE_A_OR_B_OR_C = INTERFACE_A | INTERFACE_B |
INTERFACE_C,
INTERFACE_A_OR_B_OR_D = INTERFACE_A | INTERFACE_B |
INTERFACE_D,
INTERFACE_A_OR_C_OR_D = INTERFACE_A | INTERFACE_C |
INTERFACE_D,
INTERFACE_B_OR_C_OR_D = INTERFACE_B | INTERFACE_C |
INTERFACE_D,
INTERFACE_A_OR_B_OR_C_OR_D = INTERFACE_A | INTERFACE_B |
INTERFACE_C | INTERFACE_D,
DEPRECATED_INTERFACE_A = 1,
DEPRECATED_INTERFACE_B = 2,
DEPRECATED_INTERFACE_C = 3,
DEPRECATED_INTERFACE_D = 4
};
The code could be changed slightly to work with either
'DEPRECATED_INTERFACE_x' or 'INTERFACE_x', so that there would be no
effect on existing code.
Over time more apps will be rebuilt against the new header, and
eventually the deprecated interfaces could be removed.
Evan
On Mon, 5 Dec 2011 13:37:45 +0100, Uwe Bonnes wrote:
"evan" == evan <evan@xxxxxxxxxxx> writes:
evan> Hi all,
evan> I have been working on OpenOCD, which uses libFTDI, and
have found
evan> an issue with the way interfaces are declared in libFTDI.
evan> Basically the problem is that I have implemented support
for
evan> INTERFACE_ANY in OpenOCD, but there are many devices where
it
evan> might be appropriate to have more than one interface
available,
evan> but not all. Especially with the FT4232H which has 2 JTAG
ports
evan> and 2 serial ports.
evan> Hence I would like to suggest that 'ftdi_interface'
enumeration
evan> should be changed to allow it to be a bit field as follows:
evan> enum ftdi_interface { INTERFACE_ANY = 0, INTERFACE_A = 1,
evan> INTERFACE_B = 2, INTERFACE_C = 4, INTERFACE_D = 8, };
evan> That way we can make definitions like INTERFACE_A_OR_B =
evan> INTERFACE_A | INTERFACE_B; for the FT4232H.
evan> You can see the discussion on OpenOCD so far at
evan> http://openocd.zylin.com/#change,239
The proposal seems sensible, but will impact some users that already
use
INTERFACE_C and INTERFACE_D.
Any thoughts how to keep the impact small?
Bye
--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx
|