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.
 
 
 
 
 
 

136 lines
5.2 KiB

  1. /***************************************************************************
  2. * Copyright (C) 2005 by Dominic Rath *
  3. * Dominic.Rath@gmx.de *
  4. * *
  5. * Copyright (C) 2007,2008 Øyvind Harboe *
  6. * oyvind.harboe@zylin.com *
  7. * *
  8. * Copyright (C) 2009 Zachary T Welch *
  9. * zw@superlucidity.net *
  10. * *
  11. * This program is free software; you can redistribute it and/or modify *
  12. * it under the terms of the GNU General Public License as published by *
  13. * the Free Software Foundation; either version 2 of the License, or *
  14. * (at your option) any later version. *
  15. * *
  16. * This program is distributed in the hope that it will be useful, *
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of *
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
  19. * GNU General Public License for more details. *
  20. * *
  21. * You should have received a copy of the GNU General Public License *
  22. * along with this program; if not, write to the *
  23. * Free Software Foundation, Inc., *
  24. * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
  25. ***************************************************************************/
  26. #ifndef MINIDRIVER_H
  27. #define MINIDRIVER_H
  28. /* @page jtagminidriver JTAG Mini-Driver
  29. *
  30. * The JTAG minidriver interface allows the definition of alternate
  31. * interface functions, instead of the built-in asynchronous driver
  32. * module that is used by the standard JTAG interface drivers.
  33. *
  34. * In addtion to the functions defined in the c minidriver.h file, the
  35. * @c jtag_minidriver.h file must declare the following functions (or
  36. * define static inline versions of them):
  37. * - jtag_add_callback
  38. * - jtag_add_callback4
  39. * - interface_jtag_add_dr_out
  40. *
  41. * The following core functions are declared in this file for use by
  42. * the minidriver and do @b not need to be defined by an implementation:
  43. * - default_interface_jtag_execute_queue()
  44. */
  45. #ifdef HAVE_JTAG_MINIDRIVER_H
  46. #include "jtag_minidriver.h"
  47. static inline void interface_jtag_alloc_in_value32(scan_field_t *field)
  48. {
  49. field->in_value = field->intmp;
  50. }
  51. static inline void interface_jtag_add_scan_check_alloc(scan_field_t *field)
  52. {
  53. /* We're executing this synchronously, so try to use local storage. */
  54. if (field->num_bits > 32)
  55. {
  56. unsigned num_bytes = TAP_SCAN_BYTES(field->num_bits);
  57. field->in_value = (uint8_t *)malloc(num_bytes);
  58. field->allocated = 1;
  59. }
  60. else
  61. field->in_value = field->intmp;
  62. }
  63. #else
  64. #include "commands.h"
  65. static inline void interface_jtag_alloc_in_value32(scan_field_t *field)
  66. {
  67. field->in_value = (uint8_t *)cmd_queue_alloc(4);
  68. }
  69. static inline void interface_jtag_add_scan_check_alloc(scan_field_t *field)
  70. {
  71. unsigned num_bytes = TAP_SCAN_BYTES(field->num_bits);
  72. field->in_value = (uint8_t *)cmd_queue_alloc(num_bytes);
  73. }
  74. extern void interface_jtag_add_dr_out(jtag_tap_t* tap,
  75. int num_fields, const int* num_bits, const uint32_t* value,
  76. tap_state_t end_state);
  77. extern void interface_jtag_add_callback(jtag_callback1_t f, uint8_t *in);
  78. extern void interface_jtag_add_callback4(jtag_callback_t f, uint8_t *in,
  79. jtag_callback_data_t data1, jtag_callback_data_t data2,
  80. jtag_callback_data_t data3);
  81. #endif
  82. extern int interface_jtag_add_ir_scan(
  83. int num_fields, const scan_field_t* fields,
  84. tap_state_t endstate);
  85. extern int interface_jtag_add_plain_ir_scan(
  86. int num_fields, const scan_field_t* fields,
  87. tap_state_t endstate);
  88. extern int interface_jtag_add_dr_scan(
  89. int num_fields, const scan_field_t* fields,
  90. tap_state_t endstate);
  91. extern int interface_jtag_add_plain_dr_scan(
  92. int num_fields, const scan_field_t* fields,
  93. tap_state_t endstate);
  94. extern int interface_jtag_add_tlr(void);
  95. extern int interface_jtag_add_pathmove(int num_states, const tap_state_t* path);
  96. extern int interface_jtag_add_runtest(int num_cycles, tap_state_t endstate);
  97. /**
  98. * This drives the actual srst and trst pins. srst will always be 0
  99. * if jtag_reset_config & RESET_SRST_PULLS_TRST != 0 and ditto for
  100. * trst.
  101. *
  102. * the higher level jtag_add_reset will invoke jtag_add_tlr() if
  103. * approperiate
  104. */
  105. extern int interface_jtag_add_reset(int trst, int srst);
  106. extern int interface_jtag_set_end_state(tap_state_t endstate);
  107. extern int interface_jtag_add_sleep(uint32_t us);
  108. extern int interface_jtag_add_clocks(int num_cycles);
  109. extern int interface_jtag_execute_queue(void);
  110. /**
  111. * Calls the interface callback to execute the queue. This routine
  112. * is used by the JTAG driver layer and should not be called directly.
  113. */
  114. extern int default_interface_jtag_execute_queue(void);
  115. #endif // MINIDRIVER_H