[prev in list] [next in list] [prev in thread] [next in thread]
List: openocd-development
Subject: [OpenOCD-devel] [PATCH]: 6602faa ft2232: Add deinit hook in ft2232_quit()
From: gerrit () openocd ! org (gerrit)
Date: 2015-08-30 22:33:07
Message-ID: 20150830223307.CB9071980722 () mail ! openocd ! org
[Download RAW message or body]
This is an automated email from Gerrit.
Stephan Linz (linz@li-pro.net) just uploaded a new patch set to Gerrit, which you can \
find at http://openocd.zylin.com/2948
-- gerrit
commit 6602faa32a345740f5992d5dcb0ded9621766b57
Author: Stephan Linz <linz@li-pro.net>
Date: Mon Oct 29 17:33:59 2012 +0100
ft2232: Add deinit hook in ft2232_quit()
Some layouts maybe need a proper hardware deinitialization on
shutdown, for example to disable gates, drivers, buffers, or
switch off blinking LEDs.
The current implementation of ft2232_quit() will only close the
USB interface and cleanup all related buffers in memory. There
is no call to cleanup all the changes that the ft2232_init()
has done on hardware side.
Based on the individuell init call per layout we expand
ft2232_quit() with a new hook calling to deinit, if the
specific layout has that feature (setup in ft2232_layouts[]).
Change-Id: If6e476ac619ad0f3456294f8a330270e9d0d6601
Signed-off-by: Stephan Linz <linz@li-pro.net>
diff --git a/src/jtag/drivers/ft2232.c b/src/jtag/drivers/ft2232.c
index 6f8a0fc..9184266 100644
--- a/src/jtag/drivers/ft2232.c
+++ b/src/jtag/drivers/ft2232.c
@@ -166,6 +166,7 @@ static uint16_t ft2232_pid[MAX_USB_IDS + 1] = { 0x6010, 0 };
struct ft2232_layout {
const char *name;
int (*init)(void);
+ int (*deinit)(void);
void (*reset)(int trst, int srst);
void (*blink)(void);
int channel;
@@ -3146,19 +3147,27 @@ static void flossjtag_blink(void)
static int ft2232_quit(void)
{
-#if BUILD_FT2232_FTD2XX == 1
+ int rc = ERROR_OK;
+
+ /* deinit, if the current layout has that feature */
+ if (layout && layout->deinit) {
+ LOG_DEBUG("'ft2232' interface calling deinit for '%s' layout",
+ layout->name ? layout->name : "unknown");
+ if (layout->deinit() != ERROR_OK)
+ rc = ERROR_JTAG_DEVICE_ERROR;
+ }
+#if BUILD_FT2232_FTD2XX == 1
FT_Close(ftdih);
#elif BUILD_FT2232_LIBFTDI == 1
ftdi_usb_close(&ftdic);
-
ftdi_deinit(&ftdic);
#endif
free(ft2232_buffer);
ft2232_buffer = NULL;
- return ERROR_OK;
+ return rc;
}
COMMAND_HANDLER(ft2232_handle_device_desc_command)
--
------------------------------------------------------------------------------
_______________________________________________
OpenOCD-devel mailing list
OpenOCD-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openocd-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic