OpenOCD
ftd2xx_common.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2011 by Spencer Oliver <spen@spen-soft.co.uk> *
3  * *
4  * Written by Arnim Laeuger, 2008 (from urjtag) *
5  * *
6  * This program is free software; you can redistribute it and/or modify *
7  * it under the terms of the GNU General Public License as published by *
8  * the Free Software Foundation; either version 2 of the License, or *
9  * (at your option) any later version. *
10  * *
11  * This program is distributed in the hope that it will be useful, *
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14  * GNU General Public License for more details. *
15  * *
16  * You should have received a copy of the GNU General Public License *
17  * along with this program; if not, write to the *
18  * Free Software Foundation, Inc., *
19  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
20  ***************************************************************************/
21 
22 #ifndef _FTD2XX_COMMON_H
23 #define _FTD2XX_COMMON_H
24 
25 #if ((BUILD_FT2232_FTD2XX == 1) || (BUILD_PRESTO_FTD2XX == 1) || (BUILD_USB_BLASTER_FTD2XX == 1))
26 #include <ftd2xx.h>
27 
28 static const char *ftd2xx_status_string(FT_STATUS status)
29 {
30  switch (status) {
31  case FT_OK: return "OK";
32  case FT_INVALID_HANDLE: return "invalid handle";
33  case FT_DEVICE_NOT_FOUND: return "device not found";
34  case FT_DEVICE_NOT_OPENED: return "device not opened";
35  case FT_IO_ERROR: return "io error";
36  case FT_INSUFFICIENT_RESOURCES: return "insufficient resources";
37  case FT_INVALID_PARAMETER: return "invalid parameter";
38  case FT_INVALID_BAUD_RATE: return "invalid baud rate";
39 
40  case FT_DEVICE_NOT_OPENED_FOR_ERASE: return "device not opened for erase";
41  case FT_DEVICE_NOT_OPENED_FOR_WRITE: return "device not opened for write";
42  case FT_FAILED_TO_WRITE_DEVICE: return "failed to write device";
43  case FT_EEPROM_READ_FAILED: return "eeprom read failed";
44  case FT_EEPROM_WRITE_FAILED: return "eeprom write failed";
45  case FT_EEPROM_ERASE_FAILED: return "eeprom erase failed";
46  case FT_EEPROM_NOT_PRESENT: return "eeprom not present";
47  case FT_EEPROM_NOT_PROGRAMMED: return "eeprom not programmed";
48  case FT_INVALID_ARGS: return "invalid args";
49  case FT_NOT_SUPPORTED: return "not supported";
50  case FT_OTHER_ERROR: return "other error";
51  }
52 
53  return "undefined FTD2xx error";
54 }
55 
56 #endif
57 #endif /* _FTD2XX_COMMON_H */