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.
 
 
 
 
 
 

125 lines
3.9 KiB

  1. /***************************************************************************
  2. * Copyright (C) 2009 by Mathias Kuester *
  3. * mkdorg@users.sourceforge.net *
  4. * *
  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. *
  9. * *
  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. *
  14. * *
  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. ***************************************************************************/
  20. #ifdef HAVE_CONFIG_H
  21. #include "config.h"
  22. #endif
  23. #include <helper/jim.h>
  24. #include "target.h"
  25. #include "target_type.h"
  26. #include "register.h"
  27. #include "dsp563xx.h"
  28. #include "dsp563xx_once.h"
  29. /** single word instruction */
  30. int dsp563xx_once_ir_exec(struct jtag_tap *tap, uint8_t instr, uint8_t rw,
  31. uint8_t go, uint8_t ex)
  32. {
  33. dsp563xx_write_dr_u8(tap, 0,
  34. instr | (ex << 5) | (go << 6) | (rw << 7), 8, 0);
  35. dsp563xx_execute_queue();
  36. return ERROR_OK;
  37. }
  38. /** single word instruction */
  39. int dsp563xx_once_ir_exec_nq(struct jtag_tap *tap, uint8_t instr, uint8_t rw,
  40. uint8_t go, uint8_t ex)
  41. {
  42. dsp563xx_write_dr_u8(tap, 0,
  43. instr | (ex << 5) | (go << 6) | (rw << 7), 8, 0);
  44. return ERROR_OK;
  45. }
  46. /** once read register */
  47. int dsp563xx_once_reg_read(struct jtag_tap *tap, uint8_t reg, uint32_t * data)
  48. {
  49. uint32_t dr_in;
  50. dr_in = 0;
  51. dsp563xx_once_ir_exec(tap, reg, 1, 0, 0);
  52. dsp563xx_write_dr_u32(tap, &dr_in, 0x00, 24, 0);
  53. dsp563xx_execute_queue();
  54. *data = dr_in;
  55. return ERROR_OK;
  56. }
  57. /** once write register */
  58. int dsp563xx_once_reg_write(struct jtag_tap *tap, uint8_t reg, uint32_t data)
  59. {
  60. dsp563xx_once_ir_exec(tap, reg, 0, 0, 0);
  61. dsp563xx_write_dr_u32(tap, 0x00, data, 24, 0);
  62. dsp563xx_execute_queue();
  63. return ERROR_OK;
  64. }
  65. /** single word instruction */
  66. int dsp563xx_once_execute_sw_ir(struct jtag_tap *tap, uint32_t opcode)
  67. {
  68. dsp563xx_once_ir_exec(tap, DSP563XX_ONCE_OPDBR, 0, 1, 0);
  69. dsp563xx_write_dr_u32(tap, 0, opcode, 24, 0);
  70. dsp563xx_execute_queue();
  71. return ERROR_OK;
  72. }
  73. /** double word instruction */
  74. int dsp563xx_once_execute_dw_ir(struct jtag_tap *tap, uint32_t opcode,
  75. uint32_t operand)
  76. {
  77. dsp563xx_once_ir_exec(tap, DSP563XX_ONCE_OPDBR, 0, 0, 0);
  78. dsp563xx_write_dr_u32(tap, 0, opcode, 24, 0);
  79. dsp563xx_execute_queue();
  80. dsp563xx_once_ir_exec(tap, DSP563XX_ONCE_OPDBR, 0, 1, 0);
  81. dsp563xx_write_dr_u32(tap, 0, operand, 24, 0);
  82. dsp563xx_execute_queue();
  83. return ERROR_OK;
  84. }
  85. /** single word instruction */
  86. int dsp563xx_once_execute_sw_ir_nq(struct jtag_tap *tap, uint32_t opcode)
  87. {
  88. dsp563xx_once_ir_exec_nq(tap, DSP563XX_ONCE_OPDBR, 0, 1, 0);
  89. dsp563xx_write_dr_u32(tap, 0, opcode, 24, 0);
  90. return ERROR_OK;
  91. }
  92. /** double word instruction */
  93. int dsp563xx_once_execute_dw_ir_nq(struct jtag_tap *tap, uint32_t opcode,
  94. uint32_t operand)
  95. {
  96. dsp563xx_once_ir_exec_nq(tap, DSP563XX_ONCE_OPDBR, 0, 0, 0);
  97. dsp563xx_write_dr_u32(tap, 0, opcode, 24, 0);
  98. dsp563xx_once_ir_exec_nq(tap, DSP563XX_ONCE_OPDBR, 0, 1, 0);
  99. dsp563xx_write_dr_u32(tap, 0, operand, 24, 0);
  100. return ERROR_OK;
  101. }