diff options
author | mkdorg@users.sourceforge.net <mkdorg@users.sourceforge.net> | 2009-12-15 18:30:59 +0100 |
---|---|---|
committer | Øyvind Harboe <oyvind.harboe@zylin.com> | 2009-12-15 18:38:52 +0100 |
commit | 646ce814b4fb678b7d8d341afe0694c266112426 (patch) | |
tree | f47236c7e4e51f5125635bd562ba153bafac8544 /src/target/dsp563xx_once.c | |
parent | 4639366947427da6face9cb6954b6603eb2e2fd3 (diff) | |
download | riscv-openocd-646ce814b4fb678b7d8d341afe0694c266112426.zip riscv-openocd-646ce814b4fb678b7d8d341afe0694c266112426.tar.gz riscv-openocd-646ce814b4fb678b7d8d341afe0694c266112426.tar.bz2 |
target: add basic dsp563xx support
Diffstat (limited to 'src/target/dsp563xx_once.c')
-rw-r--r-- | src/target/dsp563xx_once.c | 124 |
1 files changed, 124 insertions, 0 deletions
diff --git a/src/target/dsp563xx_once.c b/src/target/dsp563xx_once.c new file mode 100644 index 0000000..0186751 --- /dev/null +++ b/src/target/dsp563xx_once.c @@ -0,0 +1,124 @@ +/*************************************************************************** + * Copyright (C) 2009 by Mathias Kuester * + * mkdorg@users.sourceforge.net * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * 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. * + ***************************************************************************/ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <helper/jim.h> + +#include "target.h" +#include "target_type.h" +#include "register.h" +#include "dsp563xx.h" +#include "dsp563xx_once.h" + +/** single word instruction */ +int dsp563xx_once_ir_exec(struct jtag_tap *tap, uint8_t instr, uint8_t rw, + uint8_t go, uint8_t ex) +{ + dsp563xx_write_dr_u8(tap, 0, + instr | (ex << 5) | (go << 6) | (rw << 7), 8, 0); + dsp563xx_execute_queue(); + + return ERROR_OK; +} + +/** single word instruction */ +int dsp563xx_once_ir_exec_nq(struct jtag_tap *tap, uint8_t instr, uint8_t rw, + uint8_t go, uint8_t ex) +{ + dsp563xx_write_dr_u8(tap, 0, + instr | (ex << 5) | (go << 6) | (rw << 7), 8, 0); + + return ERROR_OK; +} + +/** once read register */ +int dsp563xx_once_reg_read(struct jtag_tap *tap, uint8_t reg, uint32_t * data) +{ + uint32_t dr_in; + + dr_in = 0; + + dsp563xx_once_ir_exec(tap, reg, 1, 0, 0); + dsp563xx_write_dr_u32(tap, &dr_in, 0x00, 24, 0); + dsp563xx_execute_queue(); + + *data = dr_in; + + return ERROR_OK; +} + +/** once write register */ +int dsp563xx_once_reg_write(struct jtag_tap *tap, uint8_t reg, uint32_t data) +{ + dsp563xx_once_ir_exec(tap, reg, 0, 0, 0); + dsp563xx_write_dr_u32(tap, 0x00, data, 24, 0); + dsp563xx_execute_queue(); + + return ERROR_OK; +} + +/** single word instruction */ +int dsp563xx_once_execute_sw_ir(struct jtag_tap *tap, uint32_t opcode) +{ + dsp563xx_once_ir_exec(tap, DSP563XX_ONCE_OPDBR, 0, 1, 0); + dsp563xx_write_dr_u32(tap, 0, opcode, 24, 0); + dsp563xx_execute_queue(); + + return ERROR_OK; +} + +/** double word instruction */ +int dsp563xx_once_execute_dw_ir(struct jtag_tap *tap, uint32_t opcode, + uint32_t operand) +{ + dsp563xx_once_ir_exec(tap, DSP563XX_ONCE_OPDBR, 0, 0, 0); + dsp563xx_write_dr_u32(tap, 0, opcode, 24, 0); + dsp563xx_execute_queue(); + + dsp563xx_once_ir_exec(tap, DSP563XX_ONCE_OPDBR, 0, 1, 0); + dsp563xx_write_dr_u32(tap, 0, operand, 24, 0); + dsp563xx_execute_queue(); + + return ERROR_OK; +} + +/** single word instruction */ +int dsp563xx_once_execute_sw_ir_nq(struct jtag_tap *tap, uint32_t opcode) +{ + dsp563xx_once_ir_exec_nq(tap, DSP563XX_ONCE_OPDBR, 0, 1, 0); + dsp563xx_write_dr_u32(tap, 0, opcode, 24, 0); + + return ERROR_OK; +} + +/** double word instruction */ +int dsp563xx_once_execute_dw_ir_nq(struct jtag_tap *tap, uint32_t opcode, + uint32_t operand) +{ + dsp563xx_once_ir_exec_nq(tap, DSP563XX_ONCE_OPDBR, 0, 0, 0); + dsp563xx_write_dr_u32(tap, 0, opcode, 24, 0); + + dsp563xx_once_ir_exec_nq(tap, DSP563XX_ONCE_OPDBR, 0, 1, 0); + dsp563xx_write_dr_u32(tap, 0, operand, 24, 0); + + return ERROR_OK; +} |