]> git.sur5r.net Git - openocd/blob - src/jtag/drivers/ftd2xx_common.h
Remove FSF address from GPL notices
[openocd] / src / jtag / drivers / ftd2xx_common.h
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, see <http://www.gnu.org/licenses/>. *
18  ***************************************************************************/
19
20 #ifndef _FTD2XX_COMMON_H
21 #define _FTD2XX_COMMON_H
22
23 #if ((BUILD_FT2232_FTD2XX == 1) || (BUILD_PRESTO_FTD2XX == 1) || (BUILD_USB_BLASTER_FTD2XX == 1))
24 #include <ftd2xx.h>
25
26 static const char *ftd2xx_status_string(FT_STATUS status)
27 {
28         switch (status) {
29                 case FT_OK:                                                     return "OK";
30                 case FT_INVALID_HANDLE:                         return "invalid handle";
31                 case FT_DEVICE_NOT_FOUND:                       return "device not found";
32                 case FT_DEVICE_NOT_OPENED:                      return "device not opened";
33                 case FT_IO_ERROR:                                       return "io error";
34                 case FT_INSUFFICIENT_RESOURCES:         return "insufficient resources";
35                 case FT_INVALID_PARAMETER:                      return "invalid parameter";
36                 case FT_INVALID_BAUD_RATE:                      return "invalid baud rate";
37
38                 case FT_DEVICE_NOT_OPENED_FOR_ERASE: return "device not opened for erase";
39                 case FT_DEVICE_NOT_OPENED_FOR_WRITE: return "device not opened for write";
40                 case FT_FAILED_TO_WRITE_DEVICE:         return "failed to write device";
41                 case FT_EEPROM_READ_FAILED:                     return "eeprom read failed";
42                 case FT_EEPROM_WRITE_FAILED:            return "eeprom write failed";
43                 case FT_EEPROM_ERASE_FAILED:            return "eeprom erase failed";
44                 case FT_EEPROM_NOT_PRESENT:                     return "eeprom not present";
45                 case FT_EEPROM_NOT_PROGRAMMED:          return "eeprom not programmed";
46                 case FT_INVALID_ARGS:                           return "invalid args";
47                 case FT_NOT_SUPPORTED:                          return "not supported";
48                 case FT_OTHER_ERROR:                            return "other error";
49         }
50
51         return "undefined FTD2xx error";
52 }
53
54 #endif
55 #endif /* _FTD2XX_COMMON_H */