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.
 
 
 
 
 
 

174 lines
4.8 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. #ifndef XSCALE_H
  24. #define XSCALE_H
  25. #include "armv4_5.h"
  26. #include "armv4_5_mmu.h"
  27. #include "trace.h"
  28. #define XSCALE_COMMON_MAGIC 0x58534341
  29. /* These four JTAG instructions are architecturally defined.
  30. * Lengths are core-specific; originally 5 bits, later 7.
  31. */
  32. #define XSCALE_DBGRX 0x02
  33. #define XSCALE_DBGTX 0x10
  34. #define XSCALE_LDIC 0x07
  35. #define XSCALE_SELDCSR 0x09
  36. enum xscale_debug_reason
  37. {
  38. XSCALE_DBG_REASON_GENERIC,
  39. XSCALE_DBG_REASON_RESET,
  40. XSCALE_DBG_REASON_TB_FULL,
  41. };
  42. enum xscale_trace_entry_type
  43. {
  44. XSCALE_TRACE_MESSAGE = 0x0,
  45. XSCALE_TRACE_ADDRESS = 0x1,
  46. };
  47. typedef struct xscale_trace_entry_s
  48. {
  49. uint8_t data;
  50. enum xscale_trace_entry_type type;
  51. } xscale_trace_entry_t;
  52. typedef struct xscale_trace_data_s
  53. {
  54. xscale_trace_entry_t *entries;
  55. int depth;
  56. uint32_t chkpt0;
  57. uint32_t chkpt1;
  58. uint32_t last_instruction;
  59. struct xscale_trace_data_s *next;
  60. } xscale_trace_data_t;
  61. typedef struct xscale_trace_s
  62. {
  63. trace_status_t capture_status; /* current state of capture run */
  64. struct image_s *image; /* source for target opcodes */
  65. xscale_trace_data_t *data; /* linked list of collected trace data */
  66. int buffer_enabled; /* whether trace buffer is enabled */
  67. int buffer_fill; /* maximum number of trace runs to read (-1 for wrap-around) */
  68. int pc_ok;
  69. uint32_t current_pc;
  70. armv4_5_state_t core_state; /* current core state (ARM, Thumb, Jazelle) */
  71. } xscale_trace_t;
  72. typedef struct xscale_common_s
  73. {
  74. int common_magic;
  75. /* XScale registers (CP15, DBG) */
  76. reg_cache_t *reg_cache;
  77. /* current state of the debug handler */
  78. int handler_installed;
  79. int handler_running;
  80. uint32_t handler_address;
  81. /* target-endian buffers with exception vectors */
  82. uint32_t low_vectors[8];
  83. uint32_t high_vectors[8];
  84. /* static low vectors */
  85. uint8_t static_low_vectors_set; /* bit field with static vectors set by the user */
  86. uint8_t static_high_vectors_set; /* bit field with static vectors set by the user */
  87. uint32_t static_low_vectors[8];
  88. uint32_t static_high_vectors[8];
  89. /* DCache cleaning */
  90. uint32_t cache_clean_address;
  91. /* whether hold_rst and ext_dbg_break should be set */
  92. int hold_rst;
  93. int external_debug_break;
  94. /* breakpoint / watchpoint handling */
  95. int dbr_available;
  96. int dbr0_used;
  97. int dbr1_used;
  98. int ibcr_available;
  99. int ibcr0_used;
  100. int ibcr1_used;
  101. uint32_t arm_bkpt;
  102. uint16_t thumb_bkpt;
  103. uint8_t vector_catch;
  104. xscale_trace_t trace;
  105. int arch_debug_reason;
  106. /* armv4/5 common stuff */
  107. armv4_5_common_t armv4_5_common;
  108. /* MMU/Caches */
  109. armv4_5_mmu_common_t armv4_5_mmu;
  110. uint32_t cp15_control_reg;
  111. /* possible future enhancements that go beyond XScale common stuff */
  112. void *arch_info;
  113. int fast_memory_access;
  114. } xscale_common_t;
  115. typedef struct xscale_reg_s
  116. {
  117. int dbg_handler_number;
  118. target_t *target;
  119. } xscale_reg_t;
  120. enum
  121. {
  122. XSCALE_MAINID, /* 0 */
  123. XSCALE_CACHETYPE,
  124. XSCALE_CTRL,
  125. XSCALE_AUXCTRL,
  126. XSCALE_TTB,
  127. XSCALE_DAC,
  128. XSCALE_FSR,
  129. XSCALE_FAR,
  130. XSCALE_PID,
  131. XSCALE_CPACCESS,
  132. XSCALE_IBCR0, /* 10 */
  133. XSCALE_IBCR1,
  134. XSCALE_DBR0,
  135. XSCALE_DBR1,
  136. XSCALE_DBCON,
  137. XSCALE_TBREG,
  138. XSCALE_CHKPT0,
  139. XSCALE_CHKPT1,
  140. XSCALE_DCSR,
  141. XSCALE_TX,
  142. XSCALE_RX, /* 20 */
  143. XSCALE_TXRXCTRL,
  144. };
  145. #define ERROR_XSCALE_NO_TRACE_DATA (-1500)
  146. #endif /* XSCALE_H */