gerrit
2017-05-20 06:44:39 UTC
This is an automated email from Gerrit.
Salvador Arroyo (***@yahoo.es) just uploaded a new patch set to Gerrit, which you can find at http://openocd.zylin.com/4140
-- gerrit
commit 9b4de1ec90b2ad36eecb15ac1a25f7176ae58344
Author: Salvador Arroyo <***@yahoo.es>
Date: Sat May 20 08:21:49 2017 +0200
mips32: fastdata transfer, fixed memory footprint
queue and execute a fixed number of scans.
mips_ejtag_fasdata_scan() now selects fasdata register
adds clocks before data scan and the number of scans
indicated by count.
Change-Id: I9fc5ab928c1580cdcbaf3aee1ff6392a7445f621
Signed-off-by: Salvador Arroyo <***@yahoo.es>
diff --git a/src/target/mips32_pracc.c b/src/target/mips32_pracc.c
index a3fdb2a..7b00efd 100644
--- a/src/target/mips32_pracc.c
+++ b/src/target/mips32_pracc.c
@@ -995,10 +995,11 @@ int mips32_pracc_fastdata_xfer(struct mips_ejtag *ejtag_info, struct working_are
if (ejtag_info->pa_addr != MIPS32_PRACC_FASTDATA_AREA)
return ERROR_FAIL;
+ mips_ejtag_update_clocks(ejtag_info);
+
/* Send the load start address */
uint32_t val = addr;
- mips_ejtag_set_instr(ejtag_info, EJTAG_INST_FASTDATA);
- mips_ejtag_fastdata_scan(ejtag_info, 1, &val);
+ mips_ejtag_fastdata_scan(ejtag_info, 1, &val, 1);
retval = wait_for_pracc_rw(ejtag_info, 0);
if (retval != ERROR_OK)
@@ -1006,20 +1007,20 @@ int mips32_pracc_fastdata_xfer(struct mips_ejtag *ejtag_info, struct working_are
/* Send the load end address */
val = addr + (count - 1) * 4;
- mips_ejtag_set_instr(ejtag_info, EJTAG_INST_FASTDATA);
- mips_ejtag_fastdata_scan(ejtag_info, 1, &val);
+ mips_ejtag_fastdata_scan(ejtag_info, 1, &val, 1);
- mips_ejtag_update_clocks(ejtag_info);
+ while (count) {
+ int this_round_count = count > XFER_BLOCK ? XFER_BLOCK : count;
+ mips_ejtag_fastdata_scan(ejtag_info, 1, buf, this_round_count);
- for (int i = 0; i < count; i++) {
- jtag_add_clocks(ejtag_info->clocks);
- mips_ejtag_fastdata_scan(ejtag_info, write_t, buf++);
- }
+ retval = jtag_execute_queue();
+ if (retval != ERROR_OK) {
+ LOG_ERROR("fastdata load failed");
+ return retval;
+ }
- retval = jtag_execute_queue();
- if (retval != ERROR_OK) {
- LOG_ERROR("fastdata load failed");
- return retval;
+ buf += this_round_count;
+ count -= this_round_count;
}
retval = wait_for_pracc_rw(ejtag_info, READ_ADDR);
diff --git a/src/target/mips32_pracc.h b/src/target/mips32_pracc.h
index 7ab6237..b01ffce 100644
--- a/src/target/mips32_pracc.h
+++ b/src/target/mips32_pracc.h
@@ -45,6 +45,7 @@
#define PRACC_BLOCK 128 /* 1 Kbyte */
#define READ_ADDR 1
+#define XFER_BLOCK 1024 /* 4 kbyte */
typedef struct {
uint32_t instr;
diff --git a/src/target/mips_ejtag.c b/src/target/mips_ejtag.c
index ba8c7d3..d7a4093 100644
--- a/src/target/mips_ejtag.c
+++ b/src/target/mips_ejtag.c
@@ -386,39 +386,43 @@ int mips_ejtag_init(struct mips_ejtag *ejtag_info)
return ERROR_OK;
}
-int mips_ejtag_fastdata_scan(struct mips_ejtag *ejtag_info, int write_t, uint32_t *data)
+void mips_ejtag_fastdata_scan(struct mips_ejtag *ejtag_info, int write_t, uint32_t *data, int count)
{
- assert(ejtag_info->tap != NULL);
- struct jtag_tap *tap = ejtag_info->tap;
+ mips_ejtag_set_instr(ejtag_info, EJTAG_INST_FASTDATA);
- struct scan_field fields[2];
+ for (int i = 0; i != count; i++) {
+ assert(ejtag_info->tap != NULL);
+ struct jtag_tap *tap = ejtag_info->tap;
- /* fastdata 1-bit register */
- fields[0].num_bits = 1;
+ struct scan_field fields[2];
- uint8_t spracc = 0;
- fields[0].out_value = &spracc;
- fields[0].in_value = NULL;
+ /* fastdata 1-bit register */
+ fields[0].num_bits = 1;
- /* processor access data register 32 bit */
- fields[1].num_bits = 32;
+ uint8_t spracc = 0;
+ fields[0].out_value = &spracc;
+ fields[0].in_value = NULL;
- uint8_t t[4] = {0, 0, 0, 0};
- fields[1].out_value = t;
+ /* processor access data register 32 bit */
+ fields[1].num_bits = 32;
- if (write_t) {
- fields[1].in_value = NULL;
- buf_set_u32(t, 0, 32, *data);
- } else
- fields[1].in_value = (uint8_t *) data;
+ uint8_t t[4] = {0, 0, 0, 0};
+ fields[1].out_value = t;
- jtag_add_dr_scan(tap, 2, fields, TAP_IDLE);
+ if (write_t) {
+ fields[1].in_value = NULL;
+ buf_set_u32(t, 0, 32, *data);
+ } else
+ fields[1].in_value = (uint8_t *) data;
- if (!write_t && data)
- jtag_add_callback(mips_le_to_h_u32,
- (jtag_callback_data_t) data);
+ jtag_add_clocks(ejtag_info->clocks);
+ jtag_add_dr_scan(tap, 2, fields, TAP_IDLE);
- keep_alive();
+ if (!write_t && data)
+ jtag_add_callback(mips_le_to_h_u32,
+ (jtag_callback_data_t) data);
+ data++;
+ }
- return ERROR_OK;
+ keep_alive();
}
diff --git a/src/target/mips_ejtag.h b/src/target/mips_ejtag.h
index 3490560..ec9d547 100644
--- a/src/target/mips_ejtag.h
+++ b/src/target/mips_ejtag.h
@@ -238,7 +238,7 @@ int mips_ejtag_drscan_32(struct mips_ejtag *ejtag_info, uint32_t *data);
void mips_ejtag_drscan_32_queued(struct mips_ejtag *ejtag_info, uint32_t data_out, uint8_t *data_in);
void mips_ejtag_drscan_8_out(struct mips_ejtag *ejtag_info, uint8_t data);
int mips_ejtag_drscan_8(struct mips_ejtag *ejtag_info, uint8_t *data);
-int mips_ejtag_fastdata_scan(struct mips_ejtag *ejtag_info, int write_t, uint32_t *data);
+void mips_ejtag_fastdata_scan(struct mips_ejtag *ejtag_info, int write_t, uint32_t *data, int count);
int mips_ejtag_init(struct mips_ejtag *ejtag_info);
int mips_ejtag_config_step(struct mips_ejtag *ejtag_info, int enable_step);
--
Salvador Arroyo (***@yahoo.es) just uploaded a new patch set to Gerrit, which you can find at http://openocd.zylin.com/4140
-- gerrit
commit 9b4de1ec90b2ad36eecb15ac1a25f7176ae58344
Author: Salvador Arroyo <***@yahoo.es>
Date: Sat May 20 08:21:49 2017 +0200
mips32: fastdata transfer, fixed memory footprint
queue and execute a fixed number of scans.
mips_ejtag_fasdata_scan() now selects fasdata register
adds clocks before data scan and the number of scans
indicated by count.
Change-Id: I9fc5ab928c1580cdcbaf3aee1ff6392a7445f621
Signed-off-by: Salvador Arroyo <***@yahoo.es>
diff --git a/src/target/mips32_pracc.c b/src/target/mips32_pracc.c
index a3fdb2a..7b00efd 100644
--- a/src/target/mips32_pracc.c
+++ b/src/target/mips32_pracc.c
@@ -995,10 +995,11 @@ int mips32_pracc_fastdata_xfer(struct mips_ejtag *ejtag_info, struct working_are
if (ejtag_info->pa_addr != MIPS32_PRACC_FASTDATA_AREA)
return ERROR_FAIL;
+ mips_ejtag_update_clocks(ejtag_info);
+
/* Send the load start address */
uint32_t val = addr;
- mips_ejtag_set_instr(ejtag_info, EJTAG_INST_FASTDATA);
- mips_ejtag_fastdata_scan(ejtag_info, 1, &val);
+ mips_ejtag_fastdata_scan(ejtag_info, 1, &val, 1);
retval = wait_for_pracc_rw(ejtag_info, 0);
if (retval != ERROR_OK)
@@ -1006,20 +1007,20 @@ int mips32_pracc_fastdata_xfer(struct mips_ejtag *ejtag_info, struct working_are
/* Send the load end address */
val = addr + (count - 1) * 4;
- mips_ejtag_set_instr(ejtag_info, EJTAG_INST_FASTDATA);
- mips_ejtag_fastdata_scan(ejtag_info, 1, &val);
+ mips_ejtag_fastdata_scan(ejtag_info, 1, &val, 1);
- mips_ejtag_update_clocks(ejtag_info);
+ while (count) {
+ int this_round_count = count > XFER_BLOCK ? XFER_BLOCK : count;
+ mips_ejtag_fastdata_scan(ejtag_info, 1, buf, this_round_count);
- for (int i = 0; i < count; i++) {
- jtag_add_clocks(ejtag_info->clocks);
- mips_ejtag_fastdata_scan(ejtag_info, write_t, buf++);
- }
+ retval = jtag_execute_queue();
+ if (retval != ERROR_OK) {
+ LOG_ERROR("fastdata load failed");
+ return retval;
+ }
- retval = jtag_execute_queue();
- if (retval != ERROR_OK) {
- LOG_ERROR("fastdata load failed");
- return retval;
+ buf += this_round_count;
+ count -= this_round_count;
}
retval = wait_for_pracc_rw(ejtag_info, READ_ADDR);
diff --git a/src/target/mips32_pracc.h b/src/target/mips32_pracc.h
index 7ab6237..b01ffce 100644
--- a/src/target/mips32_pracc.h
+++ b/src/target/mips32_pracc.h
@@ -45,6 +45,7 @@
#define PRACC_BLOCK 128 /* 1 Kbyte */
#define READ_ADDR 1
+#define XFER_BLOCK 1024 /* 4 kbyte */
typedef struct {
uint32_t instr;
diff --git a/src/target/mips_ejtag.c b/src/target/mips_ejtag.c
index ba8c7d3..d7a4093 100644
--- a/src/target/mips_ejtag.c
+++ b/src/target/mips_ejtag.c
@@ -386,39 +386,43 @@ int mips_ejtag_init(struct mips_ejtag *ejtag_info)
return ERROR_OK;
}
-int mips_ejtag_fastdata_scan(struct mips_ejtag *ejtag_info, int write_t, uint32_t *data)
+void mips_ejtag_fastdata_scan(struct mips_ejtag *ejtag_info, int write_t, uint32_t *data, int count)
{
- assert(ejtag_info->tap != NULL);
- struct jtag_tap *tap = ejtag_info->tap;
+ mips_ejtag_set_instr(ejtag_info, EJTAG_INST_FASTDATA);
- struct scan_field fields[2];
+ for (int i = 0; i != count; i++) {
+ assert(ejtag_info->tap != NULL);
+ struct jtag_tap *tap = ejtag_info->tap;
- /* fastdata 1-bit register */
- fields[0].num_bits = 1;
+ struct scan_field fields[2];
- uint8_t spracc = 0;
- fields[0].out_value = &spracc;
- fields[0].in_value = NULL;
+ /* fastdata 1-bit register */
+ fields[0].num_bits = 1;
- /* processor access data register 32 bit */
- fields[1].num_bits = 32;
+ uint8_t spracc = 0;
+ fields[0].out_value = &spracc;
+ fields[0].in_value = NULL;
- uint8_t t[4] = {0, 0, 0, 0};
- fields[1].out_value = t;
+ /* processor access data register 32 bit */
+ fields[1].num_bits = 32;
- if (write_t) {
- fields[1].in_value = NULL;
- buf_set_u32(t, 0, 32, *data);
- } else
- fields[1].in_value = (uint8_t *) data;
+ uint8_t t[4] = {0, 0, 0, 0};
+ fields[1].out_value = t;
- jtag_add_dr_scan(tap, 2, fields, TAP_IDLE);
+ if (write_t) {
+ fields[1].in_value = NULL;
+ buf_set_u32(t, 0, 32, *data);
+ } else
+ fields[1].in_value = (uint8_t *) data;
- if (!write_t && data)
- jtag_add_callback(mips_le_to_h_u32,
- (jtag_callback_data_t) data);
+ jtag_add_clocks(ejtag_info->clocks);
+ jtag_add_dr_scan(tap, 2, fields, TAP_IDLE);
- keep_alive();
+ if (!write_t && data)
+ jtag_add_callback(mips_le_to_h_u32,
+ (jtag_callback_data_t) data);
+ data++;
+ }
- return ERROR_OK;
+ keep_alive();
}
diff --git a/src/target/mips_ejtag.h b/src/target/mips_ejtag.h
index 3490560..ec9d547 100644
--- a/src/target/mips_ejtag.h
+++ b/src/target/mips_ejtag.h
@@ -238,7 +238,7 @@ int mips_ejtag_drscan_32(struct mips_ejtag *ejtag_info, uint32_t *data);
void mips_ejtag_drscan_32_queued(struct mips_ejtag *ejtag_info, uint32_t data_out, uint8_t *data_in);
void mips_ejtag_drscan_8_out(struct mips_ejtag *ejtag_info, uint8_t data);
int mips_ejtag_drscan_8(struct mips_ejtag *ejtag_info, uint8_t *data);
-int mips_ejtag_fastdata_scan(struct mips_ejtag *ejtag_info, int write_t, uint32_t *data);
+void mips_ejtag_fastdata_scan(struct mips_ejtag *ejtag_info, int write_t, uint32_t *data, int count);
int mips_ejtag_init(struct mips_ejtag *ejtag_info);
int mips_ejtag_config_step(struct mips_ejtag *ejtag_info, int enable_step);
--