+ MIPS32_NOP, //this one will not be executed
+ };
+
+ /* TODO remove array */
+ uint32_t *param_in = malloc((count + 2) * sizeof(uint32_t));
+ param_in[0] = addr;
+ param_in[1] = addr + count * sizeof(uint32_t); //last address
+
+ memcpy(¶m_in[2], buf, count * sizeof(uint32_t));
+
+ mips32_pracc_exec(ejtag_info, sizeof(code)/sizeof(code[0]), code, \
+ count + 2, param_in, 0, NULL, 1);
+
+ free(param_in);
+
+ return ERROR_OK;
+}
+
+int mips32_pracc_write_u32(struct mips_ejtag *ejtag_info, uint32_t addr, uint32_t *buf)
+{
+ static const uint32_t code[] = {
+ /* start: */
+ MIPS32_MTC0(15,31,0), /* move $15 to COP0 DeSave */
+ MIPS32_LUI(15,UPPER16(MIPS32_PRACC_STACK)), /* $15 = MIPS32_PRACC_STACK */
+ MIPS32_ORI(15,15,LOWER16(MIPS32_PRACC_STACK)),
+ MIPS32_SW(8,0,15), /* sw $8,($15) */
+ MIPS32_SW(9,0,15), /* sw $9,($15) */
+
+ MIPS32_LW(8,NEG16((MIPS32_PRACC_STACK-MIPS32_PRACC_PARAM_IN)-4), 15), //load R8 @ param_in[1] = data
+ MIPS32_LW(9,NEG16(MIPS32_PRACC_STACK-MIPS32_PRACC_PARAM_IN), 15), //load R9 @ param_in[0] = address
+
+ MIPS32_SW(8,0,9), /* sw $8,0($9) */
+
+ MIPS32_LW(9,0,15), /* lw $9,($15) */
+ MIPS32_LW(8,0,15), /* lw $8,($15) */
+ MIPS32_B(NEG16(11)), /* b start */
+ MIPS32_MFC0(15,31,0), /* move COP0 DeSave to $15 */