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.
 
 
 
 
 
 

101 lines
3.3 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. * This program is free software; you can redistribute it and/or modify *
  9. * it under the terms of the GNU General Public License as published by *
  10. * the Free Software Foundation; either version 2 of the License, or *
  11. * (at your option) any later version. *
  12. * *
  13. * This program is distributed in the hope that it will be useful, *
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of *
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
  16. * GNU General Public License for more details. *
  17. * *
  18. * You should have received a copy of the GNU General Public License *
  19. * along with this program; if not, write to the *
  20. * Free Software Foundation, Inc., *
  21. * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
  22. ***************************************************************************/
  23. #ifdef HAVE_CONFIG_H
  24. #include "config.h"
  25. #endif
  26. #include "arm_jtag.h"
  27. #if 0
  28. #define _ARM_JTAG_SCAN_N_CHECK_
  29. #endif
  30. int arm_jtag_set_instr_inner(struct arm_jtag *jtag_info,
  31. uint32_t new_instr, void *no_verify_capture, tap_state_t end_state)
  32. {
  33. struct jtag_tap *tap;
  34. tap = jtag_info->tap;
  35. struct scan_field field;
  36. uint8_t t[4];
  37. field.num_bits = tap->ir_length;
  38. field.out_value = t;
  39. buf_set_u32(t, 0, field.num_bits, new_instr);
  40. field.in_value = NULL;
  41. if (no_verify_capture == NULL)
  42. jtag_add_ir_scan(tap, &field, end_state);
  43. else {
  44. /* FIX!!!! this is a kludge!!! arm926ejs.c should reimplement this arm_jtag_set_instr to
  45. * have special verification code.
  46. */
  47. jtag_add_ir_scan_noverify(tap, &field, end_state);
  48. }
  49. return ERROR_OK;
  50. }
  51. int arm_jtag_scann_inner(struct arm_jtag *jtag_info, uint32_t new_scan_chain, tap_state_t end_state)
  52. {
  53. int retval = ERROR_OK;
  54. uint32_t values[1];
  55. int num_bits[1];
  56. values[0] = new_scan_chain;
  57. num_bits[0] = jtag_info->scann_size;
  58. retval = arm_jtag_set_instr(jtag_info, jtag_info->scann_instr, NULL, end_state);
  59. if (retval != ERROR_OK)
  60. return retval;
  61. jtag_add_dr_out(jtag_info->tap,
  62. 1,
  63. num_bits,
  64. values,
  65. end_state);
  66. jtag_info->cur_scan_chain = new_scan_chain;
  67. return retval;
  68. }
  69. static int arm_jtag_reset_callback(enum jtag_event event, void *priv)
  70. {
  71. struct arm_jtag *jtag_info = priv;
  72. if (event == JTAG_TRST_ASSERTED)
  73. jtag_info->cur_scan_chain = 0;
  74. return ERROR_OK;
  75. }
  76. int arm_jtag_setup_connection(struct arm_jtag *jtag_info)
  77. {
  78. jtag_info->scann_instr = 0x2;
  79. jtag_info->cur_scan_chain = 0;
  80. jtag_info->intest_instr = 0xc;
  81. return jtag_register_event_callback(arm_jtag_reset_callback, jtag_info);
  82. }