1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 /***************************************************************************
4 * Copyright (C) 2011 by Mathias Kuester *
5 * Mathias Kuester <kesmtp@freenet.de> *
7 * Copyright (C) 2012 by Spencer Oliver *
8 * spen@spen-soft.co.uk *
9 ***************************************************************************/
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_tcl.h>
22 #include <jtag/hla/hla_transport.h>
23 #include <jtag/hla/hla_interface.h>
25 static int hl_layout_open(struct hl_interface_s
*adapter
)
29 LOG_DEBUG("hl_layout_open");
31 adapter
->handle
= NULL
;
33 res
= adapter
->layout
->api
->open(&adapter
->param
, &adapter
->handle
);
35 if (res
!= ERROR_OK
) {
43 static int hl_layout_close(struct hl_interface_s
*adapter
)
48 static const struct hl_layout hl_layouts
[] = {
49 #if BUILD_HLADAPTER_STLINK
52 .open
= hl_layout_open
,
53 .close
= hl_layout_close
,
54 .api
= &stlink_usb_layout_api
,
57 #if BUILD_HLADAPTER_ICDI
60 .open
= hl_layout_open
,
61 .close
= hl_layout_close
,
62 .api
= &icdi_usb_layout_api
,
65 #if BUILD_HLADAPTER_NULINK
68 .open
= hl_layout_open
,
69 .close
= hl_layout_close
,
70 .api
= &nulink_usb_layout_api
,
73 {.name
= NULL
, /* END OF TABLE */ },
77 const struct hl_layout
*hl_layout_get_list(void)
82 int hl_layout_init(struct hl_interface_s
*adapter
)
84 LOG_DEBUG("hl_layout_init");
86 if (!adapter
->layout
) {
87 LOG_ERROR("no layout specified");