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.
 
 
 
 
 
 

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