Browse Source

mips: illustrates how to improve performance

Do not require unecessary roundtrips for clocking out
data.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
tags/v0.5.0-rc1
Øyvind Harboe 11 years ago
parent
commit
378567da4e
4 changed files with 21 additions and 14 deletions
  1. +3
    -6
      src/flash/nor/pic32mx.c
  2. +15
    -2
      src/target/mips_ejtag.c
  3. +1
    -0
      src/target/mips_ejtag.h
  4. +2
    -6
      src/target/mips_m4k.c

+ 3
- 6
src/flash/nor/pic32mx.c View File

@@ -774,11 +774,9 @@ COMMAND_HANDLER(pic32mx_handle_unlock_command)
}

/* unlock/erase device */
mchip_cmd = MCHP_ASERT_RST;
mips_ejtag_drscan_8(ejtag_info, &mchip_cmd);
mips_ejtag_drscan_8_out(ejtag_info, MCHP_ASERT_RST);

mchip_cmd = MCHP_ERASE;
mips_ejtag_drscan_8(ejtag_info, &mchip_cmd);
mips_ejtag_drscan_8_out(ejtag_info, MCHP_ERASE);

do {
mchip_cmd = MCHP_STATUS;
@@ -791,8 +789,7 @@ COMMAND_HANDLER(pic32mx_handle_unlock_command)
alive_sleep(1);
} while ((mchip_cmd & (1 << 2)) || (!(mchip_cmd & (1 << 3))));

mchip_cmd = MCHP_DE_ASSERT_RST;
mips_ejtag_drscan_8(ejtag_info, &mchip_cmd);
mips_ejtag_drscan_8_out(ejtag_info, MCHP_DE_ASSERT_RST);

/* select ejtag tap */
mips_ejtag_set_instr(ejtag_info, MTAP_SW_ETAP);


+ 15
- 2
src/target/mips_ejtag.c View File

@@ -146,11 +146,24 @@ int mips_ejtag_drscan_8(struct mips_ejtag *ejtag_info, uint32_t *data)

*data = buf_get_u32(field.in_value, 0, 32);

keep_alive();

return ERROR_OK;
}

void mips_ejtag_drscan_8_out(struct mips_ejtag *ejtag_info, uint8_t data)
{
struct jtag_tap *tap;
tap = ejtag_info->tap;
assert(tap != NULL);

struct scan_field field;

field.num_bits = 8;
field.out_value = &data;
field.in_value = NULL;

jtag_add_dr_scan(tap, 1, &field, TAP_IDLE);
}

static int mips_ejtag_step_enable(struct mips_ejtag *ejtag_info)
{
static const uint32_t code[] = {


+ 1
- 0
src/target/mips_ejtag.h View File

@@ -137,6 +137,7 @@ int mips_ejtag_enter_debug(struct mips_ejtag *ejtag_info);
int mips_ejtag_exit_debug(struct mips_ejtag *ejtag_info);
int mips_ejtag_get_idcode(struct mips_ejtag *ejtag_info, uint32_t *idcode);
int mips_ejtag_drscan_32(struct mips_ejtag *ejtag_info, uint32_t *data);
void mips_ejtag_drscan_8_out(struct mips_ejtag *ejtag_info, uint8_t data);
int mips_ejtag_drscan_8(struct mips_ejtag *ejtag_info, uint32_t *data);
int mips_ejtag_fastdata_scan(struct mips_ejtag *ejtag_info, int write_t, uint32_t *data);



+ 2
- 6
src/target/mips_m4k.c View File

@@ -254,18 +254,14 @@ static int mips_m4k_assert_reset(struct target *target)
{
if (mips_m4k->is_pic32mx)
{
uint32_t mchip_cmd;

LOG_DEBUG("Using MTAP reset to reset processor...");

/* use microchip specific MTAP reset */
mips_ejtag_set_instr(ejtag_info, MTAP_SW_MTAP);
mips_ejtag_set_instr(ejtag_info, MTAP_COMMAND);

mchip_cmd = MCHP_ASERT_RST;
mips_ejtag_drscan_8(ejtag_info, &mchip_cmd);
mchip_cmd = MCHP_DE_ASSERT_RST;
mips_ejtag_drscan_8(ejtag_info, &mchip_cmd);
mips_ejtag_drscan_8_out(ejtag_info, MCHP_ASERT_RST);
mips_ejtag_drscan_8_out(ejtag_info, MCHP_DE_ASSERT_RST);
mips_ejtag_set_instr(ejtag_info, MTAP_SW_ETAP);
}
else


Loading…
Cancel
Save