1 /***************************************************************************
2 * Copyright (C) 2009 by Mathias Kuester *
3 * mkdorg@users.sourceforge.net *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19 ***************************************************************************/
24 #include <helper/jim.h>
27 #include "target_type.h"
30 #include "dsp563xx_once.h"
32 /** single word instruction */
33 static int dsp563xx_once_ir_exec(struct jtag_tap
*tap
, uint8_t instr
, uint8_t rw
,
34 uint8_t go
, uint8_t ex
)
36 dsp563xx_write_dr_u8(tap
, 0,
37 instr
| (ex
<< 5) | (go
<< 6) | (rw
<< 7), 8, 0);
38 dsp563xx_execute_queue();
43 /** single word instruction */
44 static int dsp563xx_once_ir_exec_nq(struct jtag_tap
*tap
, uint8_t instr
, uint8_t rw
,
45 uint8_t go
, uint8_t ex
)
47 dsp563xx_write_dr_u8(tap
, 0,
48 instr
| (ex
<< 5) | (go
<< 6) | (rw
<< 7), 8, 0);
53 /** once read register */
54 int dsp563xx_once_reg_read(struct jtag_tap
*tap
, uint8_t reg
, uint32_t * data
)
60 dsp563xx_once_ir_exec(tap
, reg
, 1, 0, 0);
61 dsp563xx_write_dr_u32(tap
, &dr_in
, 0x00, 24, 0);
62 dsp563xx_execute_queue();
69 /** once write register */
70 int dsp563xx_once_reg_write(struct jtag_tap
*tap
, uint8_t reg
, uint32_t data
)
72 dsp563xx_once_ir_exec(tap
, reg
, 0, 0, 0);
73 dsp563xx_write_dr_u32(tap
, 0x00, data
, 24, 0);
74 dsp563xx_execute_queue();
79 /** single word instruction */
80 int dsp563xx_once_execute_sw_ir(struct jtag_tap
*tap
, uint32_t opcode
)
82 dsp563xx_once_ir_exec(tap
, DSP563XX_ONCE_OPDBR
, 0, 1, 0);
83 dsp563xx_write_dr_u32(tap
, 0, opcode
, 24, 0);
84 dsp563xx_execute_queue();
89 /** double word instruction */
90 int dsp563xx_once_execute_dw_ir(struct jtag_tap
*tap
, uint32_t opcode
,
93 dsp563xx_once_ir_exec(tap
, DSP563XX_ONCE_OPDBR
, 0, 0, 0);
94 dsp563xx_write_dr_u32(tap
, 0, opcode
, 24, 0);
95 dsp563xx_execute_queue();
97 dsp563xx_once_ir_exec(tap
, DSP563XX_ONCE_OPDBR
, 0, 1, 0);
98 dsp563xx_write_dr_u32(tap
, 0, operand
, 24, 0);
99 dsp563xx_execute_queue();
104 /** single word instruction */
105 int dsp563xx_once_execute_sw_ir_nq(struct jtag_tap
*tap
, uint32_t opcode
)
107 dsp563xx_once_ir_exec_nq(tap
, DSP563XX_ONCE_OPDBR
, 0, 1, 0);
108 dsp563xx_write_dr_u32(tap
, 0, opcode
, 24, 0);
113 /** double word instruction */
114 int dsp563xx_once_execute_dw_ir_nq(struct jtag_tap
*tap
, uint32_t opcode
,
117 dsp563xx_once_ir_exec_nq(tap
, DSP563XX_ONCE_OPDBR
, 0, 0, 0);
118 dsp563xx_write_dr_u32(tap
, 0, opcode
, 24, 0);
120 dsp563xx_once_ir_exec_nq(tap
, DSP563XX_ONCE_OPDBR
, 0, 1, 0);
121 dsp563xx_write_dr_u32(tap
, 0, operand
, 24, 0);