mips32, add realloc code
[fw/openocd] / src / target / mips32_pracc.h
index 921587cf827fc9cd0c0c3bdc86615ced64f073ab..525d6e618ec5646770e392cf8c7bfc306b04ad78 100644 (file)
  *   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.,                                       *
- *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.           *
+ *   along with this program.  If not, see <http://www.gnu.org/licenses/>. *
  ***************************************************************************/
 
-#ifndef MIPS32_PRACC_H
-#define MIPS32_PRACC_H
+#ifndef OPENOCD_TARGET_MIPS32_PRACC_H
+#define OPENOCD_TARGET_MIPS32_PRACC_H
 
 #include <target/mips32.h>
 #include <target/mips_ejtag.h>
 #define NEG16(v)                                               (((~(v)) + 1) & 0xFFFF)
 /*#define NEG18(v) (((~(v)) + 1) & 0x3FFFF)*/
 
+#define PRACC_BLOCK    128     /* 1 Kbyte */
+
+typedef struct {
+       uint32_t instr;
+       uint32_t addr;
+} pa_list;
+
 struct pracc_queue_info {
        int retval;
-       const int max_code;
        int code_count;
        int store_count;
-       uint32_t *pracc_list;   /* Code and store addresses */
+       int max_code;           /* max intstructions with currently allocated memory */
+       pa_list *pracc_list;    /* Code and store addresses at dmseg */
 };
 void pracc_queue_init(struct pracc_queue_info *ctx);
 void pracc_add(struct pracc_queue_info *ctx, uint32_t addr, uint32_t instr);
+void pracc_add_li32(struct pracc_queue_info *ctx, uint32_t reg_num, uint32_t data, bool optimize);
 void pracc_queue_free(struct pracc_queue_info *ctx);
 int mips32_pracc_queue_exec(struct mips_ejtag *ejtag_info,
                            struct pracc_queue_info *ctx, uint32_t *buf);
@@ -67,8 +73,7 @@ int mips32_pracc_fastdata_xfer(struct mips_ejtag *ejtag_info, struct working_are
 int mips32_pracc_read_regs(struct mips_ejtag *ejtag_info, uint32_t *regs);
 int mips32_pracc_write_regs(struct mips_ejtag *ejtag_info, uint32_t *regs);
 
-int mips32_pracc_exec(struct mips_ejtag *ejtag_info, int code_len, const uint32_t *code,
-                       int num_param_out, uint32_t *param_out, int cycle);
+int mips32_pracc_exec(struct mips_ejtag *ejtag_info, struct pracc_queue_info *ctx, uint32_t *param_out);
 
 /**
  * \b mips32_cp0_read
@@ -102,4 +107,4 @@ int mips32_cp0_read(struct mips_ejtag *ejtag_info,
 int mips32_cp0_write(struct mips_ejtag *ejtag_info,
                uint32_t val, uint32_t cp0_reg, uint32_t cp0_sel);
 
-#endif
+#endif /* OPENOCD_TARGET_MIPS32_PRACC_H */