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.
 
 
 
 
 
 

122 lines
3.6 KiB

  1. /***************************************************************************
  2. * Copyright (C) 2008 digenius technology GmbH. *
  3. * Michael Bruck *
  4. * *
  5. * Copyright (C) 2008 Georg Acher <acher@in.tum.de> *
  6. * *
  7. * This program is free software; you can redistribute it and/or modify *
  8. * it under the terms of the GNU General Public License as published by *
  9. * the Free Software Foundation; either version 2 of the License, or *
  10. * (at your option) any later version. *
  11. * *
  12. * This program is distributed in the hope that it will be useful, *
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of *
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
  15. * GNU General Public License for more details. *
  16. * *
  17. * You should have received a copy of the GNU General Public License *
  18. * along with this program; if not, write to the *
  19. * Free Software Foundation, Inc., *
  20. * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
  21. ***************************************************************************/
  22. #ifndef ARM11_H
  23. #define ARM11_H
  24. #include "arm.h"
  25. #include "arm_dpm.h"
  26. #define ARM11_TAP_DEFAULT TAP_INVALID
  27. #define CHECK_RETVAL(action) \
  28. do { \
  29. int __retval = (action); \
  30. if (__retval != ERROR_OK) { \
  31. LOG_DEBUG("error while calling \"%s\"", \
  32. # action ); \
  33. return __retval; \
  34. } \
  35. } while (0)
  36. /* bits from ARMv7 DIDR */
  37. enum arm11_debug_version
  38. {
  39. ARM11_DEBUG_V6 = 0x01,
  40. ARM11_DEBUG_V61 = 0x02,
  41. ARM11_DEBUG_V7 = 0x03,
  42. ARM11_DEBUG_V7_CP14 = 0x04,
  43. };
  44. struct arm11_common
  45. {
  46. struct arm arm;
  47. /** Debug module state. */
  48. struct arm_dpm dpm;
  49. struct arm11_sc7_action *bpwp_actions;
  50. unsigned bpwp_n;
  51. size_t brp; /**< Number of Breakpoint Register Pairs from DIDR */
  52. size_t free_brps; /**< Number of breakpoints allocated */
  53. uint32_t dscr; /**< Last retrieved DSCR value. */
  54. uint32_t saved_rdtr;
  55. uint32_t saved_wdtr;
  56. bool is_rdtr_saved;
  57. bool is_wdtr_saved;
  58. bool simulate_reset_on_next_halt; /**< Perform cleanups of the ARM state on next halt */
  59. /* Per-core configurable options.
  60. * NOTE that several of these boolean options should not exist
  61. * once the relevant code is known to work correctly.
  62. */
  63. bool memwrite_burst;
  64. bool memwrite_error_fatal;
  65. bool step_irq_enable;
  66. bool hardware_step;
  67. /** Configured Vector Catch Register settings. */
  68. uint32_t vcr;
  69. struct arm_jtag jtag_info;
  70. };
  71. static inline struct arm11_common *target_to_arm11(struct target *target)
  72. {
  73. return container_of(target->arch_info, struct arm11_common,
  74. arm);
  75. }
  76. /**
  77. * ARM11 DBGTAP instructions
  78. *
  79. * http://infocenter.arm.com/help/topic/com.arm.doc.ddi0301f/I1006229.html
  80. */
  81. enum arm11_instructions
  82. {
  83. ARM11_EXTEST = 0x00,
  84. ARM11_SCAN_N = 0x02,
  85. ARM11_RESTART = 0x04,
  86. ARM11_HALT = 0x08,
  87. ARM11_INTEST = 0x0C,
  88. ARM11_ITRSEL = 0x1D,
  89. ARM11_IDCODE = 0x1E,
  90. ARM11_BYPASS = 0x1F,
  91. };
  92. enum arm11_sc7
  93. {
  94. ARM11_SC7_NULL = 0,
  95. ARM11_SC7_VCR = 7,
  96. ARM11_SC7_PC = 8,
  97. ARM11_SC7_BVR0 = 64,
  98. ARM11_SC7_BCR0 = 80,
  99. ARM11_SC7_WVR0 = 96,
  100. ARM11_SC7_WCR0 = 112,
  101. };
  102. #endif /* ARM11_H */