You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

87 lines
2.7 KiB

  1. /*
  2. * Copyright (c) 2010 by David Brownell
  3. * Copyright (C) 2011 Tomasz Boleslaw CEDRO (http://www.tomek.cedro.info)
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or
  8. * (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.
  13. * You should have received a copy of the GNU General Public License
  14. * along with this program; if not, write to the Free Software Foundation,
  15. * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  16. */
  17. #ifndef TRANSPORT_H
  18. #define TRANSPORT_H
  19. #include "helper/command.h"
  20. /**
  21. * Wrapper for transport lifecycle operations.
  22. *
  23. * OpenOCD talks to targets through some kind of debugging
  24. * or programming adapter, using some protocol that probably
  25. * has target-specific aspects.
  26. *
  27. * A "transport" reflects electrical protocol to the target,
  28. * e..g jtag, swd, spi, uart, ... NOT the messaging protocols
  29. * layered over it (e.g. JTAG has eICE, CoreSight, Nexus, OnCE,
  30. * and more).
  31. *
  32. * In addition to the lifecycle operations packaged by this
  33. * structure, a transport also involves an interface supported
  34. * by debug adapters and used by components such as debug targets.
  35. * For non-debug transports, there may be interfaces used to
  36. * write to flash chips.
  37. */
  38. struct transport {
  39. /**
  40. * Each transport has a unique name, used to select it
  41. * from among the alternatives. Examples might include
  42. * "jtag", * "swd", "AVR_ISP" and more.
  43. */
  44. const char *name;
  45. /**
  46. * When a transport is selected, this method registers
  47. * its commands and activates the transport (e.g. resets
  48. * the link).
  49. *
  50. * After those commands are registered, they will often
  51. * be used for further configuration of the debug link.
  52. */
  53. int (*select)(struct command_context *ctx);
  54. /**
  55. * server startup uses this method to validate transport
  56. * configuration. (For example, with JTAG this interrogates
  57. * the scan chain against the list of expected TAPs.)
  58. */
  59. int (*init)(struct command_context *ctx);
  60. /**
  61. * Transports are stored in a singly linked list.
  62. */
  63. struct transport *next;
  64. };
  65. int transport_register(struct transport *new_transport);
  66. struct transport *get_current_transport(void);
  67. int transport_register_commands(struct command_context *ctx);
  68. COMMAND_HELPER(transport_list_parse, char ***vector);
  69. int allow_transports(struct command_context *ctx, const char **vector);
  70. bool transports_are_declared(void);
  71. #endif