flash: print flash bank name on flash info cmd
[openocd/jflash.git] / src / jtag / transport.h
blobd2d38ec200622a5a832770f56efb64ce63720a06
1 /*
2 * Copyright (c) 2010 by David Brownell
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software Foundation,
16 * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 #include "helper/command.h"
21 /**
22 * Wrapper for transport lifecycle operations.
24 * OpenOCD talks to targets through some kind of debugging
25 * or programming adapter, using some protocol that probably
26 * has target-specific aspects.
28 * A "transport" reflects electrical protocol to the target,
29 * e..g jtag, swd, spi, uart, ... NOT the messaging protocols
30 * layered over it (e.g. JTAG has eICE, CoreSight, Nexus, OnCE,
31 * and more).
33 * In addition to the lifecycle operations packaged by this
34 * structure, a transport also involves an interface supported
35 * by debug adapters and used by components such as debug targets.
36 * For non-debug transports, there may be interfaces used to
37 * write to flash chips.
39 struct transport {
40 /**
41 * Each transport has a unique name, used to select it
42 * from among the alternatives. Examples might include
43 * "jtag", * "swd", "AVR_ISP" and more.
45 const char *name;
47 /**
48 * When a transport is selected, this method registers
49 * its commands and activates the transport (e.g. resets
50 * the link).
52 * After those commands are registered, they will often
53 * be used for further configuration of the debug link.
55 int (*select)(struct command_context *ctx);
57 /**
58 * server startup uses this method to validate transport
59 * configuration. (For example, with JTAG this interrogates
60 * the scan chain against the list of expected TAPs.)
62 int (*init)(struct command_context *ctx);
64 /**
65 * Transports are stored in a singly linked list.
67 struct transport *next;
70 int transport_register(struct transport *new_transport);
72 struct transport *get_current_transport(void);
74 int transport_register_commands(struct command_context *ctx);
76 COMMAND_HELPER(transport_list_parse, char ***vector);
78 int allow_transports(struct command_context *ctx, const char **vector);
80 bool transports_are_declared(void);