ipdbg: fix double free of virtual-ir data
[openocd.git] / src / jtag / hla / hla_layout.c
blob51671d60aa39901eb8be3597e5c9bf086a3e55c2
1 // SPDX-License-Identifier: GPL-2.0-or-later
3 /***************************************************************************
4 * Copyright (C) 2011 by Mathias Kuester *
5 * Mathias Kuester <kesmtp@freenet.de> *
6 * *
7 * Copyright (C) 2012 by Spencer Oliver *
8 * spen@spen-soft.co.uk *
9 ***************************************************************************/
11 #ifdef HAVE_CONFIG_H
12 #include "config.h"
13 #endif
15 /* project specific includes */
16 #include <jtag/interface.h>
17 #include <transport/transport.h>
18 #include <helper/time_support.h>
20 #include <jtag/hla/hla_layout.h>
21 #include <jtag/hla/hla_transport.h>
22 #include <jtag/hla/hla_interface.h>
24 static int hl_layout_open(struct hl_interface_s *adapter)
26 int res;
28 LOG_DEBUG("hl_layout_open");
30 adapter->handle = NULL;
32 res = adapter->layout->api->open(&adapter->param, &adapter->handle);
34 if (res != ERROR_OK) {
35 LOG_DEBUG("failed");
36 return res;
39 return ERROR_OK;
42 static int hl_layout_close(struct hl_interface_s *adapter)
44 return ERROR_OK;
47 static const struct hl_layout hl_layouts[] = {
48 #if BUILD_HLADAPTER_STLINK
50 .name = "stlink",
51 .open = hl_layout_open,
52 .close = hl_layout_close,
53 .api = &stlink_usb_layout_api,
55 #endif
56 #if BUILD_HLADAPTER_ICDI
58 .name = "ti-icdi",
59 .open = hl_layout_open,
60 .close = hl_layout_close,
61 .api = &icdi_usb_layout_api,
63 #endif
64 #if BUILD_HLADAPTER_NULINK
66 .name = "nulink",
67 .open = hl_layout_open,
68 .close = hl_layout_close,
69 .api = &nulink_usb_layout_api,
71 #endif
72 {.name = NULL, /* END OF TABLE */ },
75 /** */
76 const struct hl_layout *hl_layout_get_list(void)
78 return hl_layouts;
81 int hl_layout_init(struct hl_interface_s *adapter)
83 LOG_DEBUG("hl_layout_init");
85 if (!adapter->layout) {
86 LOG_ERROR("no layout specified");
87 return ERROR_FAIL;
89 return ERROR_OK;