mips_ejtag: cache ejtag version to avoid recalculation
[fw/openocd] / src / target / mips_ejtag.h
index a6ed95a509b5bdc9c287ecbe4ed98ade5ccec42d..19b2c7574339c0d439554867931c5b8f0586ff99 100644 (file)
@@ -17,7 +17,7 @@
  *   You should have received a copy of the GNU General Public License     *
  *   along with this program; if not, write to the                         *
  *   Free Software Foundation, Inc.,                                       *
- *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
+ *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.           *
  ***************************************************************************/
 
 #ifndef MIPS_EJTAG
 #define        EJTAG_DBCn_BLM_SHIFT    4
 #define        EJTAG_DBCn_BE                   (1 << 0)
 
-struct mips_ejtag
-{
+#define EJTAG_VERSION_20               0
+#define EJTAG_VERSION_25               1
+#define EJTAG_VERSION_26               2
+#define EJTAG_VERSION_31               3
+#define EJTAG_VERSION_41               4
+#define EJTAG_VERSION_51               5
+
+struct mips_ejtag {
        struct jtag_tap *tap;
        uint32_t impcode;
        uint32_t idcode;
        uint32_t ejtag_ctrl;
        int fast_access_save;
+       uint32_t reg8;
+       uint32_t reg9;
+       unsigned scan_delay;
+       int mode;
+       unsigned int ejtag_version;
 };
 
 void mips_ejtag_set_instr(struct mips_ejtag *ejtag_info,
@@ -136,6 +147,8 @@ void mips_ejtag_set_instr(struct mips_ejtag *ejtag_info,
 int mips_ejtag_enter_debug(struct mips_ejtag *ejtag_info);
 int mips_ejtag_exit_debug(struct mips_ejtag *ejtag_info);
 int mips_ejtag_get_idcode(struct mips_ejtag *ejtag_info, uint32_t *idcode);
+void mips_ejtag_add_scan_96(struct mips_ejtag *ejtag_info,
+                           uint32_t ctrl, uint32_t data, uint8_t *in_scan_buf);
 void mips_ejtag_drscan_32_out(struct mips_ejtag *ejtag_info, uint32_t data);
 int mips_ejtag_drscan_32(struct mips_ejtag *ejtag_info, uint32_t *data);
 void mips_ejtag_drscan_8_out(struct mips_ejtag *ejtag_info, uint8_t data);
@@ -144,6 +157,11 @@ int mips_ejtag_fastdata_scan(struct mips_ejtag *ejtag_info, int write_t, uint32_
 
 int mips_ejtag_init(struct mips_ejtag *ejtag_info);
 int mips_ejtag_config_step(struct mips_ejtag *ejtag_info, int enable_step);
-int mips_ejtag_read_debug(struct mips_ejtag *ejtag_info, uint32_t* debug_reg);
+
+static inline void mips_le_to_h_u32(jtag_callback_data_t arg)
+{
+       uint8_t *in = (uint8_t *)arg;
+       *((uint32_t *)arg) = le_to_h_u32(in);
+}
 
 #endif /* MIPS_EJTAG */