Browse Source

command_handler: change 'cmd_ctx' to CMD_CTX

Convert all command handler 'cmd_ctx' parameter usage with CMD_CTX.
tags/v0.4.0-rc1
Zachary T Welch 12 years ago
parent
commit
2861877b32
51 changed files with 623 additions and 620 deletions
  1. +15
    -15
      src/flash/at91sam3.c
  2. +3
    -3
      src/flash/at91sam7.c
  3. +3
    -3
      src/flash/avrf.c
  4. +29
    -29
      src/flash/flash.c
  5. +3
    -3
      src/flash/lpc2000.c
  6. +8
    -8
      src/flash/lpc2900.c
  7. +2
    -2
      src/flash/lpc3180_nand_controller.c
  8. +3
    -3
      src/flash/mflash.c
  9. +33
    -33
      src/flash/nand.c
  10. +15
    -15
      src/flash/pic32mx.c
  11. +3
    -3
      src/flash/stellaris.c
  12. +26
    -26
      src/flash/stm32x.c
  13. +1
    -1
      src/flash/str7x.c
  14. +23
    -23
      src/flash/str9xpec.c
  15. +10
    -10
      src/flash/tms470.c
  16. +1
    -1
      src/hello.c
  17. +1
    -1
      src/helper/command.h
  18. +13
    -13
      src/helper/ioutil.c
  19. +1
    -1
      src/helper/log.c
  20. +2
    -2
      src/jtag/amt_jtagaccel.c
  21. +1
    -1
      src/jtag/gw16012.c
  22. +1
    -1
      src/jtag/jlink.c
  23. +3
    -3
      src/jtag/parport.c
  24. +21
    -21
      src/jtag/tcl.c
  25. +9
    -9
      src/openocd.c
  26. +7
    -7
      src/pld/pld.c
  27. +4
    -4
      src/pld/virtex2.c
  28. +1
    -1
      src/server/gdb_server.c
  29. +1
    -1
      src/server/server.c
  30. +6
    -6
      src/svf/svf.c
  31. +7
    -7
      src/target/arm720t.c
  32. +24
    -24
      src/target/arm7_9_common.c
  33. +28
    -28
      src/target/arm920t.c
  34. +11
    -11
      src/target/arm926ejs.c
  35. +7
    -7
      src/target/arm966e.c
  36. +4
    -4
      src/target/arm9tdmi.c
  37. +4
    -4
      src/target/arm_adi_v5.c
  38. +14
    -14
      src/target/armv4_5.c
  39. +6
    -6
      src/target/armv7a.c
  40. +7
    -7
      src/target/armv7m.c
  41. +3
    -3
      src/target/cortex_a8.c
  42. +15
    -12
      src/target/cortex_m3.c
  43. +2
    -2
      src/target/etb.c
  44. +97
    -97
      src/target/etm.c
  45. +1
    -1
      src/target/etm_dummy.c
  46. +13
    -13
      src/target/oocd_trace.c
  47. +65
    -65
      src/target/target.c
  48. +6
    -6
      src/target/target_request.c
  49. +7
    -7
      src/target/trace.c
  50. +46
    -46
      src/target/xscale.c
  51. +7
    -7
      src/xsvf/xsvf.c

+ 15
- 15
src/flash/at91sam3.c View File

@@ -2267,7 +2267,7 @@ COMMAND_HANDLER(sam3_handle_info_command)
unsigned x;
int r;

pChip = get_current_sam3(cmd_ctx);
pChip = get_current_sam3(CMD_CTX);
if (!pChip) {
return ERROR_OK;
}
@@ -2278,7 +2278,7 @@ COMMAND_HANDLER(sam3_handle_info_command)
if (pChip->details.bank[0].pBank == NULL) {
x = 0;
need_define:
command_print(cmd_ctx,
command_print(CMD_CTX,
"Please define bank %d via command: flash bank %s ... ",
x,
at91sam3_flash.name);
@@ -2329,7 +2329,7 @@ COMMAND_HANDLER(sam3_handle_info_command)
// print results
cp = membuf_strtok(pChip->mbuf, "\n", &vp);
while (cp) {
command_print(cmd_ctx,"%s", cp);
command_print(CMD_CTX,"%s", cp);
cp = membuf_strtok(NULL, "\n", &vp);
}
return ERROR_OK;
@@ -2341,7 +2341,7 @@ COMMAND_HANDLER(sam3_handle_gpnvm_command)
int r,who;
struct sam3_chip *pChip;

pChip = get_current_sam3(cmd_ctx);
pChip = get_current_sam3(CMD_CTX);
if (!pChip) {
return ERROR_OK;
}
@@ -2353,7 +2353,7 @@ COMMAND_HANDLER(sam3_handle_gpnvm_command)


if (pChip->details.bank[0].pBank == NULL) {
command_print(cmd_ctx, "Bank0 must be defined first via: flash bank %s ...",
command_print(CMD_CTX, "Bank0 must be defined first via: flash bank %s ...",
at91sam3_flash.name);
return ERROR_FAIL;
}
@@ -2367,7 +2367,7 @@ COMMAND_HANDLER(sam3_handle_gpnvm_command)

switch (CMD_ARGC) {
default:
command_print(cmd_ctx,"Too many parameters\n");
command_print(CMD_CTX,"Too many parameters\n");
return ERROR_COMMAND_SYNTAX_ERROR;
break;
case 0:
@@ -2397,22 +2397,22 @@ COMMAND_HANDLER(sam3_handle_gpnvm_command)
if (r != ERROR_OK) {
break;
}
command_print(cmd_ctx, "sam3-gpnvm%u: %u", x, v);
command_print(CMD_CTX, "sam3-gpnvm%u: %u", x, v);
}
return r;
}
if ((who >= 0) && (((unsigned)(who)) < pChip->details.n_gpnvms)) {
r = FLASHD_GetGPNVM(&(pChip->details.bank[0]), who, &v);
command_print(cmd_ctx, "sam3-gpnvm%u: %u", who, v);
command_print(CMD_CTX, "sam3-gpnvm%u: %u", who, v);
return r;
} else {
command_print(cmd_ctx, "sam3-gpnvm invalid GPNVM: %u", who);
command_print(CMD_CTX, "sam3-gpnvm invalid GPNVM: %u", who);
return ERROR_COMMAND_SYNTAX_ERROR;
}
}

if (who == -1) {
command_print(cmd_ctx, "Missing GPNVM number");
command_print(CMD_CTX, "Missing GPNVM number");
return ERROR_COMMAND_SYNTAX_ERROR;
}

@@ -2422,7 +2422,7 @@ COMMAND_HANDLER(sam3_handle_gpnvm_command)
(0 == strcmp("clear", CMD_ARGV[0]))) { // quietly accept both
r = FLASHD_ClrGPNVM(&(pChip->details.bank[0]), who);
} else {
command_print(cmd_ctx, "Unkown command: %s", CMD_ARGV[0]);
command_print(CMD_CTX, "Unkown command: %s", CMD_ARGV[0]);
r = ERROR_COMMAND_SYNTAX_ERROR;
}
return r;
@@ -2432,7 +2432,7 @@ COMMAND_HANDLER(sam3_handle_slowclk_command)
{
struct sam3_chip *pChip;

pChip = get_current_sam3(cmd_ctx);
pChip = get_current_sam3(CMD_CTX);
if (!pChip) {
return ERROR_OK;
}
@@ -2449,7 +2449,7 @@ COMMAND_HANDLER(sam3_handle_slowclk_command)
COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], v);
if (v > 200000) {
// absurd slow clock of 200Khz?
command_print(cmd_ctx,"Absurd/illegal slow clock freq: %d\n", (int)(v));
command_print(CMD_CTX,"Absurd/illegal slow clock freq: %d\n", (int)(v));
return ERROR_COMMAND_SYNTAX_ERROR;
}
pChip->cfg.slow_freq = v;
@@ -2457,11 +2457,11 @@ COMMAND_HANDLER(sam3_handle_slowclk_command)
}
default:
// error
command_print(cmd_ctx,"Too many parameters");
command_print(CMD_CTX,"Too many parameters");
return ERROR_COMMAND_SYNTAX_ERROR;
break;
}
command_print(cmd_ctx, "Slowclk freq: %d.%03dkhz",
command_print(CMD_CTX, "Slowclk freq: %d.%03dkhz",
(int)(pChip->cfg.slow_freq/ 1000),
(int)(pChip->cfg.slow_freq% 1000));
return ERROR_OK;


+ 3
- 3
src/flash/at91sam7.c View File

@@ -1109,7 +1109,7 @@ COMMAND_HANDLER(at91sam7_handle_gpnvm_command)

if (CMD_ARGC != 2)
{
command_print(cmd_ctx, "at91sam7 gpnvm <bit> <set | clear>");
command_print(CMD_CTX, "at91sam7 gpnvm <bit> <set | clear>");
return ERROR_OK;
}

@@ -1120,7 +1120,7 @@ COMMAND_HANDLER(at91sam7_handle_gpnvm_command)
}
if (strcmp(bank->driver->name, "at91sam7"))
{
command_print(cmd_ctx, "not an at91sam7 flash bank '%s'", CMD_ARGV[0]);
command_print(CMD_CTX, "not an at91sam7 flash bank '%s'", CMD_ARGV[0]);
return ERROR_FLASH_BANK_INVALID;
}
if (bank->target->state != TARGET_HALTED)
@@ -1155,7 +1155,7 @@ COMMAND_HANDLER(at91sam7_handle_gpnvm_command)
COMMAND_PARSE_NUMBER(int, CMD_ARGV[0], bit);
if ((bit < 0) || (bit >= at91sam7_info->num_nvmbits))
{
command_print(cmd_ctx, "gpnvm bit '#%s' is out of bounds for target %s", CMD_ARGV[0], at91sam7_info->target_name);
command_print(CMD_CTX, "gpnvm bit '#%s' is out of bounds for target %s", CMD_ARGV[0], at91sam7_info->target_name);
return ERROR_OK;
}



+ 3
- 3
src/flash/avrf.c View File

@@ -421,7 +421,7 @@ COMMAND_HANDLER(avrf_handle_mass_erase_command)

if (CMD_ARGC < 1)
{
command_print(cmd_ctx, "avr mass_erase <bank>");
command_print(CMD_CTX, "avr mass_erase <bank>");
return ERROR_OK;
}

@@ -438,11 +438,11 @@ COMMAND_HANDLER(avrf_handle_mass_erase_command)
bank->sectors[i].is_erased = 1;
}

command_print(cmd_ctx, "avr mass erase complete");
command_print(CMD_CTX, "avr mass erase complete");
}
else
{
command_print(cmd_ctx, "avr mass erase failed");
command_print(CMD_CTX, "avr mass erase failed");
}

LOG_DEBUG("%s", __FUNCTION__);


+ 29
- 29
src/flash/flash.c View File

@@ -208,7 +208,7 @@ COMMAND_HELPER(flash_command_get_bank_by_num,
*bank = get_flash_bank_by_num(bank_num);
if (!*bank)
{
command_print(cmd_ctx, "flash bank '%s' not found", name);
command_print(CMD_CTX, "flash bank '%s' not found", name);
return ERROR_INVALID_ARGUMENTS;
}
return ERROR_OK;
@@ -241,7 +241,7 @@ COMMAND_HANDLER(handle_flash_bank_command)
struct flash_bank *p, *c;

/* register flash specific commands */
if (flash_drivers[i]->register_commands(cmd_ctx) != ERROR_OK)
if (flash_drivers[i]->register_commands(CMD_CTX) != ERROR_OK)
{
LOG_ERROR("couldn't register '%s' commands", CMD_ARGV[0]);
return ERROR_FAIL;
@@ -320,7 +320,7 @@ COMMAND_HANDLER(handle_flash_info_command)
if ((retval = p->driver->auto_probe(p)) != ERROR_OK)
return retval;

command_print(cmd_ctx,
command_print(CMD_CTX,
"#%" PRIi32 " : %s at 0x%8.8" PRIx32 ", size 0x%8.8" PRIx32 ", buswidth %i, chipwidth %i",
i,
p->driver->name,
@@ -339,7 +339,7 @@ COMMAND_HANDLER(handle_flash_info_command)
else
protect_state = "protection state unknown";

command_print(cmd_ctx,
command_print(CMD_CTX,
"\t#%3i: 0x%8.8" PRIx32 " (0x%" PRIx32 " %" PRIi32 "kB) %s",
j,
p->sectors[j].offset,
@@ -350,7 +350,7 @@ COMMAND_HANDLER(handle_flash_info_command)

*buf = '\0'; /* initialize buffer, otherwise it migh contain garbage if driver function fails */
retval = p->driver->info(p, buf, sizeof(buf));
command_print(cmd_ctx, "%s", buf);
command_print(CMD_CTX, "%s", buf);
if (retval != ERROR_OK)
LOG_ERROR("error retrieving flash info (%d)", retval);
}
@@ -374,22 +374,22 @@ COMMAND_HANDLER(handle_flash_probe_command)
{
if ((retval = p->driver->probe(p)) == ERROR_OK)
{
command_print(cmd_ctx, "flash '%s' found at 0x%8.8" PRIx32, p->driver->name, p->base);
command_print(CMD_CTX, "flash '%s' found at 0x%8.8" PRIx32, p->driver->name, p->base);
}
else if (retval == ERROR_FLASH_BANK_INVALID)
{
command_print(cmd_ctx, "probing failed for flash bank '#%s' at 0x%8.8" PRIx32,
command_print(CMD_CTX, "probing failed for flash bank '#%s' at 0x%8.8" PRIx32,
CMD_ARGV[0], p->base);
}
else
{
command_print(cmd_ctx, "unknown error when probing flash bank '#%s' at 0x%8.8" PRIx32,
command_print(CMD_CTX, "unknown error when probing flash bank '#%s' at 0x%8.8" PRIx32,
CMD_ARGV[0], p->base);
}
}
else
{
command_print(cmd_ctx, "flash bank '#%s' is out of bounds", CMD_ARGV[0]);
command_print(CMD_CTX, "flash bank '#%s' is out of bounds", CMD_ARGV[0]);
}

return ERROR_OK;
@@ -410,11 +410,11 @@ COMMAND_HANDLER(handle_flash_erase_check_command)
int j;
if ((retval = p->driver->erase_check(p)) == ERROR_OK)
{
command_print(cmd_ctx, "successfully checked erase state");
command_print(CMD_CTX, "successfully checked erase state");
}
else
{
command_print(cmd_ctx, "unknown error when checking erase state of flash bank #%s at 0x%8.8" PRIx32,
command_print(CMD_CTX, "unknown error when checking erase state of flash bank #%s at 0x%8.8" PRIx32,
CMD_ARGV[0], p->base);
}

@@ -429,7 +429,7 @@ COMMAND_HANDLER(handle_flash_erase_check_command)
else
erase_state = "erase state unknown";

command_print(cmd_ctx,
command_print(CMD_CTX,
"\t#%3i: 0x%8.8" PRIx32 " (0x%" PRIx32 " %" PRIi32 "kB) %s",
j,
p->sectors[j].offset,
@@ -448,7 +448,7 @@ COMMAND_HANDLER(handle_flash_erase_address_command)
int address;
int length;

struct target *target = get_current_target(cmd_ctx);
struct target *target = get_current_target(CMD_CTX);

if (CMD_ARGC != 2)
return ERROR_COMMAND_SYNTAX_ERROR;
@@ -457,7 +457,7 @@ COMMAND_HANDLER(handle_flash_erase_address_command)
COMMAND_PARSE_NUMBER(int, CMD_ARGV[1], length);
if (length <= 0)
{
command_print(cmd_ctx, "Length must be >0");
command_print(CMD_CTX, "Length must be >0");
return ERROR_COMMAND_SYNTAX_ERROR;
}

@@ -477,7 +477,7 @@ COMMAND_HANDLER(handle_flash_erase_address_command)

if ((ERROR_OK == retval) && (duration_measure(&bench) == ERROR_OK))
{
command_print(cmd_ctx, "erased address 0x%8.8x (length %i)"
command_print(CMD_CTX, "erased address 0x%8.8x (length %i)"
" in %fs (%0.3f kb/s)", address, length,
duration_elapsed(&bench), duration_kbps(&bench, length));
}
@@ -497,15 +497,15 @@ COMMAND_HANDLER(handle_flash_protect_check_command)

if ((retval = p->driver->protect_check(p)) == ERROR_OK)
{
command_print(cmd_ctx, "successfully checked protect state");
command_print(CMD_CTX, "successfully checked protect state");
}
else if (retval == ERROR_FLASH_OPERATION_FAILED)
{
command_print(cmd_ctx, "checking protection state failed (possibly unsupported) by flash #%s at 0x%8.8" PRIx32, CMD_ARGV[0], p->base);
command_print(CMD_CTX, "checking protection state failed (possibly unsupported) by flash #%s at 0x%8.8" PRIx32, CMD_ARGV[0], p->base);
}
else
{
command_print(cmd_ctx, "unknown error when checking protection state of flash bank '#%s' at 0x%8.8" PRIx32, CMD_ARGV[0], p->base);
command_print(CMD_CTX, "unknown error when checking protection state of flash bank '#%s' at 0x%8.8" PRIx32, CMD_ARGV[0], p->base);
}

return ERROR_OK;
@@ -550,7 +550,7 @@ COMMAND_HANDLER(handle_flash_erase_command)
COMMAND_PARSE_NUMBER(u32, CMD_ARGV[2], last);

int retval;
if ((retval = flash_check_sector_parameters(cmd_ctx,
if ((retval = flash_check_sector_parameters(CMD_CTX,
first, last, p->num_sectors)) != ERROR_OK)
return retval;

@@ -561,7 +561,7 @@ COMMAND_HANDLER(handle_flash_erase_command)

if ((ERROR_OK == retval) && (duration_measure(&bench) == ERROR_OK))
{
command_print(cmd_ctx, "erased sectors %" PRIu32 " "
command_print(CMD_CTX, "erased sectors %" PRIu32 " "
"through %" PRIu32" on flash bank %" PRIu32 " "
"in %fs", first, last, bank_nr, duration_elapsed(&bench));
}
@@ -598,13 +598,13 @@ COMMAND_HANDLER(handle_flash_protect_command)
return ERROR_COMMAND_SYNTAX_ERROR;

int retval;
if ((retval = flash_check_sector_parameters(cmd_ctx,
if ((retval = flash_check_sector_parameters(CMD_CTX,
first, last, p->num_sectors)) != ERROR_OK)
return retval;

retval = flash_driver_protect(p, set, first, last);
if (retval == ERROR_OK) {
command_print(cmd_ctx, "%s protection for sectors %i "
command_print(CMD_CTX, "%s protection for sectors %i "
"through %i on flash bank %i",
(set) ? "set" : "cleared", (int) first,
(int) last, (int) bank_nr);
@@ -615,7 +615,7 @@ COMMAND_HANDLER(handle_flash_protect_command)

COMMAND_HANDLER(handle_flash_write_image_command)
{
struct target *target = get_current_target(cmd_ctx);
struct target *target = get_current_target(CMD_CTX);

struct image image;
uint32_t written;
@@ -638,13 +638,13 @@ COMMAND_HANDLER(handle_flash_write_image_command)
auto_erase = 1;
CMD_ARGV++;
CMD_ARGC--;
command_print(cmd_ctx, "auto erase enabled");
command_print(CMD_CTX, "auto erase enabled");
} else if (strcmp(CMD_ARGV[0], "unlock") == 0)
{
auto_unlock = true;
CMD_ARGV++;
CMD_ARGC--;
command_print(cmd_ctx, "auto unlock enabled");
command_print(CMD_CTX, "auto unlock enabled");
} else
{
break;
@@ -693,7 +693,7 @@ COMMAND_HANDLER(handle_flash_write_image_command)

if ((ERROR_OK == retval) && (duration_measure(&bench) == ERROR_OK))
{
command_print(cmd_ctx, "wrote %" PRIu32 " byte from file %s "
command_print(CMD_CTX, "wrote %" PRIu32 " byte from file %s "
"in %fs (%0.3f kb/s)", written, CMD_ARGV[0],
duration_elapsed(&bench), duration_kbps(&bench, written));
}
@@ -714,7 +714,7 @@ COMMAND_HANDLER(handle_flash_fill_command)
uint32_t wrote = 0;
uint32_t cur_size = 0;
uint32_t chunk_count;
struct target *target = get_current_target(cmd_ctx);
struct target *target = get_current_target(CMD_CTX);
uint32_t i;
uint32_t wordsize;

@@ -800,7 +800,7 @@ COMMAND_HANDLER(handle_flash_fill_command)

if (duration_measure(&bench) == ERROR_OK)
{
command_print(cmd_ctx, "wrote %" PRIu32 " bytes to 0x%8.8" PRIx32
command_print(CMD_CTX, "wrote %" PRIu32 " bytes to 0x%8.8" PRIx32
" in %fs (%0.3f kb/s)", wrote, address,
duration_elapsed(&bench), duration_kbps(&bench, wrote));
}
@@ -847,7 +847,7 @@ COMMAND_HANDLER(handle_flash_write_bank_command)

if ((ERROR_OK == retval) && (duration_measure(&bench) == ERROR_OK))
{
command_print(cmd_ctx, "wrote %zu byte from file %s to flash bank %u"
command_print(CMD_CTX, "wrote %zu byte from file %s to flash bank %u"
" at offset 0x%8.8" PRIx32 " in %fs (%0.3f kb/s)",
fileio.size, CMD_ARGV[1], p->bank_number, offset,
duration_elapsed(&bench), duration_kbps(&bench, fileio.size));


+ 3
- 3
src/flash/lpc2000.c View File

@@ -764,14 +764,14 @@ COMMAND_HANDLER(lpc2000_handle_part_id_command)
{
if (status_code == ERROR_FLASH_OPERATION_FAILED)
{
command_print(cmd_ctx, "no sufficient working area specified, can't access LPC2000 IAP interface");
command_print(CMD_CTX, "no sufficient working area specified, can't access LPC2000 IAP interface");
return ERROR_OK;
}
command_print(cmd_ctx, "lpc2000 IAP returned status code %i", status_code);
command_print(CMD_CTX, "lpc2000 IAP returned status code %i", status_code);
}
else
{
command_print(cmd_ctx, "lpc2000 part id: 0x%8.8" PRIx32 , result_table[0]);
command_print(CMD_CTX, "lpc2000 part id: 0x%8.8" PRIx32 , result_table[0]);
}

return ERROR_OK;


+ 8
- 8
src/flash/lpc2900.c View File

@@ -564,7 +564,7 @@ COMMAND_HANDLER(lpc2900_handle_signature_command)
return status;
}

command_print( cmd_ctx, "signature: 0x%8.8" PRIx32
command_print( CMD_CTX, "signature: 0x%8.8" PRIx32
":0x%8.8" PRIx32
":0x%8.8" PRIx32
":0x%8.8" PRIx32,
@@ -672,11 +672,11 @@ COMMAND_HANDLER(lpc2900_handle_password_command)

if( !lpc2900_info->risky )
{
command_print(cmd_ctx, "Wrong password (use '%s')", ISS_PASSWORD);
command_print(CMD_CTX, "Wrong password (use '%s')", ISS_PASSWORD);
return ERROR_COMMAND_ARGUMENT_INVALID;
}

command_print(cmd_ctx,
command_print(CMD_CTX,
"Potentially dangerous operation allowed in next command!");

return ERROR_OK;
@@ -704,7 +704,7 @@ COMMAND_HANDLER(lpc2900_handle_write_custom_command)
/* Check if command execution is allowed. */
if( !lpc2900_info->risky )
{
command_print( cmd_ctx, "Command execution not allowed!" );
command_print( CMD_CTX, "Command execution not allowed!" );
return ERROR_COMMAND_ARGUMENT_INVALID;
}
lpc2900_info->risky = 0;
@@ -815,7 +815,7 @@ COMMAND_HANDLER(lpc2900_handle_secure_sector_command)
/* Check if command execution is allowed. */
if( !lpc2900_info->risky )
{
command_print( cmd_ctx, "Command execution not allowed! "
command_print( CMD_CTX, "Command execution not allowed! "
"(use 'password' command first)");
return ERROR_COMMAND_ARGUMENT_INVALID;
}
@@ -829,7 +829,7 @@ COMMAND_HANDLER(lpc2900_handle_secure_sector_command)
(last >= bank->num_sectors) ||
(first > last) )
{
command_print( cmd_ctx, "Illegal sector range" );
command_print( CMD_CTX, "Illegal sector range" );
return ERROR_COMMAND_ARGUMENT_INVALID;
}

@@ -878,7 +878,7 @@ COMMAND_HANDLER(lpc2900_handle_secure_sector_command)
}
}

command_print( cmd_ctx,
command_print( CMD_CTX,
"Sectors security will become effective after next power cycle");

/* Update the sector security status */
@@ -914,7 +914,7 @@ COMMAND_HANDLER(lpc2900_handle_secure_jtag_command)
/* Check if command execution is allowed. */
if( !lpc2900_info->risky )
{
command_print( cmd_ctx, "Command execution not allowed! "
command_print( CMD_CTX, "Command execution not allowed! "
"(use 'password' command first)");
return ERROR_COMMAND_ARGUMENT_INVALID;
}


+ 2
- 2
src/flash/lpc3180_nand_controller.c View File

@@ -846,7 +846,7 @@ COMMAND_HANDLER(handle_lpc3180_select_command)
struct nand_device *nand = get_nand_device_by_num(num);
if (!nand)
{
command_print(cmd_ctx, "nand device '#%s' is out of bounds", CMD_ARGV[0]);
command_print(CMD_CTX, "nand device '#%s' is out of bounds", CMD_ARGV[0]);
return ERROR_OK;
}

@@ -868,7 +868,7 @@ COMMAND_HANDLER(handle_lpc3180_select_command)
}
}

command_print(cmd_ctx, "%s controller selected", selected[lpc3180_info->selected_controller]);
command_print(CMD_CTX, "%s controller selected", selected[lpc3180_info->selected_controller]);

return ERROR_OK;
}


+ 3
- 3
src/flash/mflash.c View File

@@ -416,7 +416,7 @@ COMMAND_HANDLER(mg_probe_cmd)
ret = mg_mflash_probe();

if (ret == ERROR_OK) {
command_print(cmd_ctx, "mflash (total %" PRIu32 " sectors) found at 0x%8.8" PRIx32 "",
command_print(CMD_CTX, "mflash (total %" PRIu32 " sectors) found at 0x%8.8" PRIx32 "",
mflash_bank->drv_info->tot_sects, mflash_bank->base);
}

@@ -751,7 +751,7 @@ COMMAND_HANDLER(mg_write_cmd)

if (duration_measure(&bench) == ERROR_OK)
{
command_print(cmd_ctx, "wrote %zu byte from file %s "
command_print(CMD_CTX, "wrote %zu byte from file %s "
"in %fs (%0.3f kB/s)", fileio.size, CMD_ARGV[1],
duration_elapsed(&bench), duration_kbps(&bench, fileio.size));
}
@@ -817,7 +817,7 @@ COMMAND_HANDLER(mg_dump_cmd)

if (duration_measure(&bench) == ERROR_OK)
{
command_print(cmd_ctx, "dump image (address 0x%8.8" PRIx32 " "
command_print(CMD_CTX, "dump image (address 0x%8.8" PRIx32 " "
"size %" PRIu32 ") to file %s in %fs (%0.3f kB/s)",
address, size, CMD_ARGV[1],
duration_elapsed(&bench), duration_kbps(&bench, size));


+ 33
- 33
src/flash/nand.c View File

@@ -223,7 +223,7 @@ COMMAND_HANDLER(handle_nand_device_command)
if (strcmp(CMD_ARGV[0], nand_flash_controllers[i]->name) == 0)
{
/* register flash specific commands */
if ((retval = nand_flash_controllers[i]->register_commands(cmd_ctx)) != ERROR_OK)
if ((retval = nand_flash_controllers[i]->register_commands(CMD_CTX)) != ERROR_OK)
{
LOG_ERROR("couldn't register '%s' commands", CMD_ARGV[0]);
return retval;
@@ -312,7 +312,7 @@ COMMAND_HELPER(nand_command_get_device_by_num, unsigned name_index,
COMMAND_PARSE_NUMBER(uint, str, num);
*nand = get_nand_device_by_num(num);
if (!*nand) {
command_print(cmd_ctx, "NAND flash device '#%s' is out of bounds", str);
command_print(CMD_CTX, "NAND flash device '#%s' is out of bounds", str);
return ERROR_INVALID_ARGUMENTS;
}
return ERROR_OK;
@@ -1050,21 +1050,21 @@ COMMAND_HANDLER(handle_nand_list_command)

if (!nand_devices)
{
command_print(cmd_ctx, "no NAND flash devices configured");
command_print(CMD_CTX, "no NAND flash devices configured");
return ERROR_OK;
}

for (p = nand_devices, i = 0; p; p = p->next, i++)
{
if (p->device)
command_print(cmd_ctx, "#%i: %s (%s) "
command_print(CMD_CTX, "#%i: %s (%s) "
"pagesize: %i, buswidth: %i,\n\t"
"blocksize: %i, blocks: %i",
i, p->device->name, p->manufacturer->name,
p->page_size, p->bus_width,
p->erase_size, p->num_blocks);
else
command_print(cmd_ctx, "#%i: not probed", i);
command_print(CMD_CTX, "#%i: not probed", i);
}

return ERROR_OK;
@@ -1102,7 +1102,7 @@ COMMAND_HANDLER(handle_nand_info_command)

if (NULL == p->device)
{
command_print(cmd_ctx, "#%s: not probed", CMD_ARGV[0]);
command_print(CMD_CTX, "#%s: not probed", CMD_ARGV[0]);
return ERROR_OK;
}

@@ -1112,7 +1112,7 @@ COMMAND_HANDLER(handle_nand_info_command)
if (last >= p->num_blocks)
last = p->num_blocks - 1;

command_print(cmd_ctx, "#%i: %s (%s) pagesize: %i, buswidth: %i, erasesize: %i",
command_print(CMD_CTX, "#%i: %s (%s) pagesize: %i, buswidth: %i, erasesize: %i",
i++, p->device->name, p->manufacturer->name, p->page_size, p->bus_width, p->erase_size);

for (j = first; j <= last; j++)
@@ -1133,7 +1133,7 @@ COMMAND_HANDLER(handle_nand_info_command)
else
bad_state = " (block condition unknown)";

command_print(cmd_ctx,
command_print(CMD_CTX,
"\t#%i: 0x%8.8" PRIx32 " (%" PRId32 "kB) %s%s",
j,
p->blocks[j].offset,
@@ -1159,15 +1159,15 @@ COMMAND_HANDLER(handle_nand_probe_command)

if ((retval = nand_probe(p)) == ERROR_OK)
{
command_print(cmd_ctx, "NAND flash device '%s' found", p->device->name);
command_print(CMD_CTX, "NAND flash device '%s' found", p->device->name);
}
else if (retval == ERROR_NAND_OPERATION_FAILED)
{
command_print(cmd_ctx, "probing failed for NAND flash device");
command_print(CMD_CTX, "probing failed for NAND flash device");
}
else
{
command_print(cmd_ctx, "unknown error when probing NAND flash device");
command_print(CMD_CTX, "unknown error when probing NAND flash device");
}

return ERROR_OK;
@@ -1212,18 +1212,18 @@ COMMAND_HANDLER(handle_nand_erase_command)
retval = nand_erase(p, offset, offset + length - 1);
if (retval == ERROR_OK)
{
command_print(cmd_ctx, "erased blocks %lu to %lu "
command_print(CMD_CTX, "erased blocks %lu to %lu "
"on NAND flash device #%s '%s'",
offset, offset + length,
CMD_ARGV[0], p->device->name);
}
else if (retval == ERROR_NAND_OPERATION_FAILED)
{
command_print(cmd_ctx, "erase failed");
command_print(CMD_CTX, "erase failed");
}
else
{
command_print(cmd_ctx, "unknown error when erasing NAND flash device");
command_print(CMD_CTX, "unknown error when erasing NAND flash device");
}

return ERROR_OK;
@@ -1269,17 +1269,17 @@ COMMAND_HANDLER(handle_nand_check_bad_blocks_command)
retval = nand_build_bbt(p, first, last);
if (retval == ERROR_OK)
{
command_print(cmd_ctx, "checked NAND flash device for bad blocks, "
command_print(CMD_CTX, "checked NAND flash device for bad blocks, "
"use \"nand info\" command to list blocks");
}
else if (retval == ERROR_NAND_OPERATION_FAILED)
{
command_print(cmd_ctx, "error when checking for bad blocks on "
command_print(CMD_CTX, "error when checking for bad blocks on "
"NAND flash device");
}
else
{
command_print(cmd_ctx, "unknown error when checking for bad "
command_print(CMD_CTX, "unknown error when checking for bad "
"blocks on NAND flash device");
}

@@ -1399,7 +1399,7 @@ static COMMAND_HELPER(nand_fileio_parse_args, struct nand_fileio_state *state,

if (NULL == nand->device)
{
command_print(cmd_ctx, "#%s: not probed", CMD_ARGV[0]);
command_print(CMD_CTX, "#%s: not probed", CMD_ARGV[0]);
return ERROR_OK;
}

@@ -1409,7 +1409,7 @@ static COMMAND_HELPER(nand_fileio_parse_args, struct nand_fileio_state *state,
COMMAND_PARSE_NUMBER(u32, CMD_ARGV[2], state->size);
if (state->size % nand->page_size)
{
command_print(cmd_ctx, "only page-aligned sizes are supported");
command_print(CMD_CTX, "only page-aligned sizes are supported");
return ERROR_COMMAND_SYNTAX_ERROR;
}
}
@@ -1428,13 +1428,13 @@ static COMMAND_HELPER(nand_fileio_parse_args, struct nand_fileio_state *state,
state->oob_format |= NAND_OOB_SW_ECC_KW;
else
{
command_print(cmd_ctx, "unknown option: %s", CMD_ARGV[i]);
command_print(CMD_CTX, "unknown option: %s", CMD_ARGV[i]);
return ERROR_COMMAND_SYNTAX_ERROR;
}
}
}

retval = nand_fileio_start(cmd_ctx, nand, CMD_ARGV[1], filemode, state);
retval = nand_fileio_start(CMD_CTX, nand, CMD_ARGV[1], filemode, state);
if (ERROR_OK != retval)
return retval;

@@ -1517,7 +1517,7 @@ COMMAND_HANDLER(handle_nand_write_command)
int bytes_read = nand_fileio_read(nand, &s);
if (bytes_read <= 0)
{
command_print(cmd_ctx, "error while reading file");
command_print(CMD_CTX, "error while reading file");
return nand_fileio_cleanup(&s);
}
s.size -= bytes_read;
@@ -1526,7 +1526,7 @@ COMMAND_HANDLER(handle_nand_write_command)
s.page, s.page_size, s.oob, s.oob_size);
if (ERROR_OK != retval)
{
command_print(cmd_ctx, "failed writing file %s "
command_print(CMD_CTX, "failed writing file %s "
"to NAND flash %s at offset 0x%8.8" PRIx32,
CMD_ARGV[1], CMD_ARGV[0], s.address);
return nand_fileio_cleanup(&s);
@@ -1536,7 +1536,7 @@ COMMAND_HANDLER(handle_nand_write_command)

if (nand_fileio_finish(&s))
{
command_print(cmd_ctx, "wrote file %s to NAND flash %s up to "
command_print(CMD_CTX, "wrote file %s to NAND flash %s up to "
"offset 0x%8.8" PRIx32 " in %fs (%0.3f kb/s)",
CMD_ARGV[1], CMD_ARGV[0], s.address, duration_elapsed(&s.bench),
duration_kbps(&s.bench, total_bytes));
@@ -1558,7 +1558,7 @@ COMMAND_HANDLER(handle_nand_verify_command)
dev.address = file.address;
dev.size = file.size;
dev.oob_format = file.oob_format;
retval = nand_fileio_start(cmd_ctx, nand, NULL, FILEIO_NONE, &dev);
retval = nand_fileio_start(CMD_CTX, nand, NULL, FILEIO_NONE, &dev);
if (ERROR_OK != retval)
return retval;

@@ -1568,7 +1568,7 @@ COMMAND_HANDLER(handle_nand_verify_command)
dev.page, dev.page_size, dev.oob, dev.oob_size);
if (ERROR_OK != retval)
{
command_print(cmd_ctx, "reading NAND flash page failed");
command_print(CMD_CTX, "reading NAND flash page failed");
nand_fileio_cleanup(&dev);
return nand_fileio_cleanup(&file);
}
@@ -1576,7 +1576,7 @@ COMMAND_HANDLER(handle_nand_verify_command)
int bytes_read = nand_fileio_read(nand, &file);
if (bytes_read <= 0)
{
command_print(cmd_ctx, "error while reading file");
command_print(CMD_CTX, "error while reading file");
nand_fileio_cleanup(&dev);
return nand_fileio_cleanup(&file);
}
@@ -1584,7 +1584,7 @@ COMMAND_HANDLER(handle_nand_verify_command)
if ((dev.page && memcmp(dev.page, file.page, dev.page_size)) ||
(dev.oob && memcmp(dev.oob, file.oob, dev.oob_size)) )
{
command_print(cmd_ctx, "NAND flash contents differ "
command_print(CMD_CTX, "NAND flash contents differ "
"at 0x%8.8" PRIx32, dev.address);
nand_fileio_cleanup(&dev);
return nand_fileio_cleanup(&file);
@@ -1596,7 +1596,7 @@ COMMAND_HANDLER(handle_nand_verify_command)

if (nand_fileio_finish(&file) == ERROR_OK)
{
command_print(cmd_ctx, "verified file %s in NAND flash %s "
command_print(CMD_CTX, "verified file %s in NAND flash %s "
"up to offset 0x%8.8" PRIx32 " in %fs (%0.3f kb/s)",
CMD_ARGV[1], CMD_ARGV[0], dev.address, duration_elapsed(&file.bench),
duration_kbps(&file.bench, dev.size));
@@ -1621,7 +1621,7 @@ COMMAND_HANDLER(handle_nand_dump_command)
s.page, s.page_size, s.oob, s.oob_size);
if (ERROR_OK != retval)
{
command_print(cmd_ctx, "reading NAND flash page failed");
command_print(CMD_CTX, "reading NAND flash page failed");
return nand_fileio_cleanup(&s);
}

@@ -1637,7 +1637,7 @@ COMMAND_HANDLER(handle_nand_dump_command)

if (nand_fileio_finish(&s) == ERROR_OK)
{
command_print(cmd_ctx, "dumped %zu bytes in %fs (%0.3f kb/s)",
command_print(CMD_CTX, "dumped %zu bytes in %fs (%0.3f kb/s)",
s.fileio.size, duration_elapsed(&s.bench),
duration_kbps(&s.bench, s.fileio.size));
}
@@ -1658,7 +1658,7 @@ COMMAND_HANDLER(handle_nand_raw_access_command)

if (NULL == p->device)
{
command_print(cmd_ctx, "#%s: not probed", CMD_ARGV[0]);
command_print(CMD_CTX, "#%s: not probed", CMD_ARGV[0]);
return ERROR_OK;
}

@@ -1673,7 +1673,7 @@ COMMAND_HANDLER(handle_nand_raw_access_command)
}

const char *msg = p->use_raw ? "enabled" : "disabled";
command_print(cmd_ctx, "raw access is %s", msg);
command_print(CMD_CTX, "raw access is %s", msg);

return ERROR_OK;
}


+ 15
- 15
src/flash/pic32mx.c View File

@@ -679,7 +679,7 @@ COMMAND_HANDLER(pic32mx_handle_lock_command)

if (CMD_ARGC < 1)
{
command_print(cmd_ctx, "pic32mx lock <bank>");
command_print(CMD_CTX, "pic32mx lock <bank>");
return ERROR_OK;
}

@@ -700,7 +700,7 @@ COMMAND_HANDLER(pic32mx_handle_lock_command)

if (pic32mx_erase_options(bank) != ERROR_OK)
{
command_print(cmd_ctx, "pic32mx failed to erase options");
command_print(CMD_CTX, "pic32mx failed to erase options");
return ERROR_OK;
}

@@ -709,11 +709,11 @@ COMMAND_HANDLER(pic32mx_handle_lock_command)

if (pic32mx_write_options(bank) != ERROR_OK)
{
command_print(cmd_ctx, "pic32mx failed to lock device");
command_print(CMD_CTX, "pic32mx failed to lock device");
return ERROR_OK;
}

command_print(cmd_ctx, "pic32mx locked");
command_print(CMD_CTX, "pic32mx locked");

return ERROR_OK;
}
@@ -725,7 +725,7 @@ COMMAND_HANDLER(pic32mx_handle_unlock_command)

if (CMD_ARGC < 1)
{
command_print(cmd_ctx, "pic32mx unlock <bank>");
command_print(CMD_CTX, "pic32mx unlock <bank>");
return ERROR_OK;
}

@@ -746,17 +746,17 @@ COMMAND_HANDLER(pic32mx_handle_unlock_command)

if (pic32mx_erase_options(bank) != ERROR_OK)
{
command_print(cmd_ctx, "pic32mx failed to unlock device");
command_print(CMD_CTX, "pic32mx failed to unlock device");
return ERROR_OK;
}

if (pic32mx_write_options(bank) != ERROR_OK)
{
command_print(cmd_ctx, "pic32mx failed to lock device");
command_print(CMD_CTX, "pic32mx failed to lock device");
return ERROR_OK;
}

command_print(cmd_ctx, "pic32mx unlocked");
command_print(CMD_CTX, "pic32mx unlocked");

return ERROR_OK;
}
@@ -815,7 +815,7 @@ COMMAND_HANDLER(pic32mx_handle_chip_erase_command)

if (CMD_ARGC != 0)
{
command_print(cmd_ctx, "pic32mx chip_erase");
command_print(CMD_CTX, "pic32mx chip_erase");
return ERROR_OK;
}

@@ -832,11 +832,11 @@ COMMAND_HANDLER(pic32mx_handle_chip_erase_command)
bank->sectors[i].is_erased = 1;
}

command_print(cmd_ctx, "pic32mx chip erase complete");
command_print(CMD_CTX, "pic32mx chip erase complete");
}
else
{
command_print(cmd_ctx, "pic32mx chip erase failed");
command_print(CMD_CTX, "pic32mx chip erase failed");
}
#endif

@@ -850,7 +850,7 @@ COMMAND_HANDLER(pic32mx_handle_pgm_word_command)

if (CMD_ARGC != 3)
{
command_print(cmd_ctx, "pic32mx pgm_word <addr> <value> <bank>");
command_print(CMD_CTX, "pic32mx pgm_word <addr> <value> <bank>");
return ERROR_OK;
}

@@ -864,7 +864,7 @@ COMMAND_HANDLER(pic32mx_handle_pgm_word_command)

if (address < bank->base || address >= (bank->base + bank->size))
{
command_print(cmd_ctx, "flash address '%s' is out of bounds", CMD_ARGV[0]);
command_print(CMD_CTX, "flash address '%s' is out of bounds", CMD_ARGV[0]);
return ERROR_OK;
}

@@ -876,9 +876,9 @@ COMMAND_HANDLER(pic32mx_handle_pgm_word_command)
res = ERROR_FLASH_OPERATION_FAILED;

if (res == ERROR_OK)
command_print(cmd_ctx, "pic32mx pgm word complete");
command_print(CMD_CTX, "pic32mx pgm word complete");
else
command_print(cmd_ctx, "pic32mx pgm word failed (status = 0x%x)", status);
command_print(CMD_CTX, "pic32mx pgm word failed (status = 0x%x)", status);

return ERROR_OK;
}


+ 3
- 3
src/flash/stellaris.c View File

@@ -1134,7 +1134,7 @@ COMMAND_HANDLER(stellaris_handle_mass_erase_command)

if (CMD_ARGC < 1)
{
command_print(cmd_ctx, "stellaris mass_erase <bank>");
command_print(CMD_CTX, "stellaris mass_erase <bank>");
return ERROR_OK;
}

@@ -1151,11 +1151,11 @@ COMMAND_HANDLER(stellaris_handle_mass_erase_command)
bank->sectors[i].is_erased = 1;
}

command_print(cmd_ctx, "stellaris mass erase complete");
command_print(CMD_CTX, "stellaris mass erase complete");
}
else
{
command_print(cmd_ctx, "stellaris mass erase failed");
command_print(CMD_CTX, "stellaris mass erase failed");
}

return ERROR_OK;


+ 26
- 26
src/flash/stm32x.c View File

@@ -900,7 +900,7 @@ COMMAND_HANDLER(stm32x_handle_lock_command)

if (CMD_ARGC < 1)
{
command_print(cmd_ctx, "stm32x lock <bank>");
command_print(CMD_CTX, "stm32x lock <bank>");
return ERROR_OK;
}

@@ -921,7 +921,7 @@ COMMAND_HANDLER(stm32x_handle_lock_command)

if (stm32x_erase_options(bank) != ERROR_OK)
{
command_print(cmd_ctx, "stm32x failed to erase options");
command_print(CMD_CTX, "stm32x failed to erase options");
return ERROR_OK;
}

@@ -930,11 +930,11 @@ COMMAND_HANDLER(stm32x_handle_lock_command)

if (stm32x_write_options(bank) != ERROR_OK)
{
command_print(cmd_ctx, "stm32x failed to lock device");
command_print(CMD_CTX, "stm32x failed to lock device");
return ERROR_OK;
}

command_print(cmd_ctx, "stm32x locked");
command_print(CMD_CTX, "stm32x locked");

return ERROR_OK;
}
@@ -946,7 +946,7 @@ COMMAND_HANDLER(stm32x_handle_unlock_command)

if (CMD_ARGC < 1)
{
command_print(cmd_ctx, "stm32x unlock <bank>");
command_print(CMD_CTX, "stm32x unlock <bank>");
return ERROR_OK;
}

@@ -967,17 +967,17 @@ COMMAND_HANDLER(stm32x_handle_unlock_command)

if (stm32x_erase_options(bank) != ERROR_OK)
{
command_print(cmd_ctx, "stm32x failed to unlock device");
command_print(CMD_CTX, "stm32x failed to unlock device");
return ERROR_OK;
}

if (stm32x_write_options(bank) != ERROR_OK)
{
command_print(cmd_ctx, "stm32x failed to lock device");
command_print(CMD_CTX, "stm32x failed to lock device");
return ERROR_OK;
}

command_print(cmd_ctx, "stm32x unlocked");
command_print(CMD_CTX, "stm32x unlocked");

return ERROR_OK;
}
@@ -990,7 +990,7 @@ COMMAND_HANDLER(stm32x_handle_options_read_command)

if (CMD_ARGC < 1)
{
command_print(cmd_ctx, "stm32x options_read <bank>");
command_print(CMD_CTX, "stm32x options_read <bank>");
return ERROR_OK;
}

@@ -1010,30 +1010,30 @@ COMMAND_HANDLER(stm32x_handle_options_read_command)
}

target_read_u32(target, STM32_FLASH_OBR, &optionbyte);
command_print(cmd_ctx, "Option Byte: 0x%" PRIx32 "", optionbyte);
command_print(CMD_CTX, "Option Byte: 0x%" PRIx32 "", optionbyte);

if (buf_get_u32((uint8_t*)&optionbyte, OPT_ERROR, 1))
command_print(cmd_ctx, "Option Byte Complement Error");
command_print(CMD_CTX, "Option Byte Complement Error");

if (buf_get_u32((uint8_t*)&optionbyte, OPT_READOUT, 1))
command_print(cmd_ctx, "Readout Protection On");
command_print(CMD_CTX, "Readout Protection On");
else
command_print(cmd_ctx, "Readout Protection Off");
command_print(CMD_CTX, "Readout Protection Off");

if (buf_get_u32((uint8_t*)&optionbyte, OPT_RDWDGSW, 1))
command_print(cmd_ctx, "Software Watchdog");
command_print(CMD_CTX, "Software Watchdog");
else
command_print(cmd_ctx, "Hardware Watchdog");
command_print(CMD_CTX, "Hardware Watchdog");

if (buf_get_u32((uint8_t*)&optionbyte, OPT_RDRSTSTOP, 1))
command_print(cmd_ctx, "Stop: No reset generated");
command_print(CMD_CTX, "Stop: No reset generated");
else
command_print(cmd_ctx, "Stop: Reset generated");
command_print(CMD_CTX, "Stop: Reset generated");

if (buf_get_u32((uint8_t*)&optionbyte, OPT_RDRSTSTDBY, 1))
command_print(cmd_ctx, "Standby: No reset generated");
command_print(CMD_CTX, "Standby: No reset generated");
else
command_print(cmd_ctx, "Standby: Reset generated");
command_print(CMD_CTX, "Standby: Reset generated");

return ERROR_OK;
}
@@ -1046,7 +1046,7 @@ COMMAND_HANDLER(stm32x_handle_options_write_command)

if (CMD_ARGC < 4)
{
command_print(cmd_ctx, "stm32x options_write <bank> <SWWDG | HWWDG> <RSTSTNDBY | NORSTSTNDBY> <RSTSTOP | NORSTSTOP>");
command_print(CMD_CTX, "stm32x options_write <bank> <SWWDG | HWWDG> <RSTSTNDBY | NORSTSTNDBY> <RSTSTOP | NORSTSTOP>");
return ERROR_OK;
}

@@ -1094,7 +1094,7 @@ COMMAND_HANDLER(stm32x_handle_options_write_command)

if (stm32x_erase_options(bank) != ERROR_OK)
{
command_print(cmd_ctx, "stm32x failed to erase options");
command_print(CMD_CTX, "stm32x failed to erase options");
return ERROR_OK;
}

@@ -1102,11 +1102,11 @@ COMMAND_HANDLER(stm32x_handle_options_write_command)

if (stm32x_write_options(bank) != ERROR_OK)
{
command_print(cmd_ctx, "stm32x failed to write options");
command_print(CMD_CTX, "stm32x failed to write options");
return ERROR_OK;
}

command_print(cmd_ctx, "stm32x write options complete");
command_print(CMD_CTX, "stm32x write options complete");

return ERROR_OK;
}
@@ -1155,7 +1155,7 @@ COMMAND_HANDLER(stm32x_handle_mass_erase_command)

if (CMD_ARGC < 1)
{
command_print(cmd_ctx, "stm32x mass_erase <bank>");
command_print(CMD_CTX, "stm32x mass_erase <bank>");
return ERROR_OK;
}

@@ -1172,11 +1172,11 @@ COMMAND_HANDLER(stm32x_handle_mass_erase_command)
bank->sectors[i].is_erased = 1;
}

command_print(cmd_ctx, "stm32x mass erase complete");
command_print(CMD_CTX, "stm32x mass erase complete");
}
else
{
command_print(cmd_ctx, "stm32x mass erase failed");
command_print(CMD_CTX, "stm32x mass erase failed");
}

return ERROR_OK;


+ 1
- 1
src/flash/str7x.c View File

@@ -613,7 +613,7 @@ COMMAND_HANDLER(str7x_handle_disable_jtag_command)

if (CMD_ARGC < 1)
{
command_print(cmd_ctx, "str7x disable_jtag <bank>");
command_print(CMD_CTX, "str7x disable_jtag <bank>");
return ERROR_OK;
}



+ 23
- 23
src/flash/str9xpec.c View File

@@ -759,7 +759,7 @@ COMMAND_HANDLER(str9xpec_handle_part_id_command)

idcode = buf_get_u32(buffer, 0, 32);

command_print(cmd_ctx, "str9xpec part id: 0x%8.8" PRIx32 "", idcode);
command_print(CMD_CTX, "str9xpec part id: 0x%8.8" PRIx32 "", idcode);

free(buffer);

@@ -784,7 +784,7 @@ COMMAND_HANDLER(str9xpec_handle_flash_options_read_command)

if (CMD_ARGC < 1)
{
command_print(cmd_ctx, "str9xpec options_read <bank>");
command_print(CMD_CTX, "str9xpec options_read <bank>");
return ERROR_OK;
}

@@ -802,33 +802,33 @@ COMMAND_HANDLER(str9xpec_handle_flash_options_read_command)

/* boot bank */
if (buf_get_u32(str9xpec_info->options, STR9XPEC_OPT_CSMAPBIT, 1))
command_print(cmd_ctx, "CS Map: bank1");
command_print(CMD_CTX, "CS Map: bank1");
else
command_print(cmd_ctx, "CS Map: bank0");
command_print(CMD_CTX, "CS Map: bank0");

/* OTP lock */
if (buf_get_u32(str9xpec_info->options, STR9XPEC_OPT_OTPBIT, 1))
command_print(cmd_ctx, "OTP Lock: OTP Locked");
command_print(CMD_CTX, "OTP Lock: OTP Locked");
else
command_print(cmd_ctx, "OTP Lock: OTP Unlocked");
command_print(CMD_CTX, "OTP Lock: OTP Unlocked");

/* LVD Threshold */
if (buf_get_u32(str9xpec_info->options, STR9XPEC_OPT_LVDTHRESBIT, 1))
command_print(cmd_ctx, "LVD Threshold: 2.7v");
command_print(CMD_CTX, "LVD Threshold: 2.7v");
else
command_print(cmd_ctx, "LVD Threshold: 2.4v");
command_print(CMD_CTX, "LVD Threshold: 2.4v");

/* LVD reset warning */
if (buf_get_u32(str9xpec_info->options, STR9XPEC_OPT_LVDWARNBIT, 1))
command_print(cmd_ctx, "LVD Reset Warning: VDD or VDDQ Inputs");
command_print(CMD_CTX, "LVD Reset Warning: VDD or VDDQ Inputs");
else
command_print(cmd_ctx, "LVD Reset Warning: VDD Input Only");
command_print(CMD_CTX, "LVD Reset Warning: VDD Input Only");

/* LVD reset select */
if (buf_get_u32(str9xpec_info->options, STR9XPEC_OPT_LVDSELBIT, 1))
command_print(cmd_ctx, "LVD Reset Selection: VDD or VDDQ Inputs");
command_print(CMD_CTX, "LVD Reset Selection: VDD or VDDQ Inputs");
else
command_print(cmd_ctx, "LVD Reset Selection: VDD Input Only");
command_print(CMD_CTX, "LVD Reset Selection: VDD Input Only");

return ERROR_OK;
}
@@ -900,7 +900,7 @@ COMMAND_HANDLER(str9xpec_handle_flash_options_write_command)

if (CMD_ARGC < 1)
{
command_print(cmd_ctx, "str9xpec options_write <bank>");
command_print(CMD_CTX, "str9xpec options_write <bank>");
return ERROR_OK;
}

@@ -923,7 +923,7 @@ COMMAND_HANDLER(str9xpec_handle_flash_options_cmap_command)

if (CMD_ARGC < 2)
{
command_print(cmd_ctx, "str9xpec options_cmap <bank> <bank0 | bank1>");
command_print(CMD_CTX, "str9xpec options_cmap <bank> <bank0 | bank1>");
return ERROR_OK;
}

@@ -952,7 +952,7 @@ COMMAND_HANDLER(str9xpec_handle_flash_options_lvdthd_command)

if (CMD_ARGC < 2)
{
command_print(cmd_ctx, "str9xpec options_lvdthd <bank> <2.4v | 2.7v>");
command_print(CMD_CTX, "str9xpec options_lvdthd <bank> <2.4v | 2.7v>");
return ERROR_OK;
}

@@ -981,7 +981,7 @@ COMMAND_HANDLER(str9xpec_handle_flash_options_lvdsel_command)

if (CMD_ARGC < 2)
{
command_print(cmd_ctx, "str9xpec options_lvdsel <bank> <vdd | vdd_vddq>");
command_print(CMD_CTX, "str9xpec options_lvdsel <bank> <vdd | vdd_vddq>");
return ERROR_OK;
}

@@ -1010,7 +1010,7 @@ COMMAND_HANDLER(str9xpec_handle_flash_options_lvdwarn_command)

if (CMD_ARGC < 2)
{
command_print(cmd_ctx, "str9xpec options_lvdwarn <bank> <vdd | vdd_vddq>");
command_print(CMD_CTX, "str9xpec options_lvdwarn <bank> <vdd | vdd_vddq>");
return ERROR_OK;
}

@@ -1039,7 +1039,7 @@ COMMAND_HANDLER(str9xpec_handle_flash_lock_command)

if (CMD_ARGC < 1)
{
command_print(cmd_ctx, "str9xpec lock <bank>");
command_print(CMD_CTX, "str9xpec lock <bank>");
return ERROR_OK;
}

@@ -1062,7 +1062,7 @@ COMMAND_HANDLER(str9xpec_handle_flash_unlock_command)

if (CMD_ARGC < 1)
{
command_print(cmd_ctx, "str9xpec unlock <bank>");
command_print(CMD_CTX, "str9xpec unlock <bank>");
return ERROR_OK;
}

@@ -1088,7 +1088,7 @@ COMMAND_HANDLER(str9xpec_handle_flash_enable_turbo_command)

if (CMD_ARGC < 1)
{
command_print(cmd_ctx, "str9xpec enable_turbo <bank>");
command_print(CMD_CTX, "str9xpec enable_turbo <bank>");
return ERROR_OK;
}

@@ -1106,14 +1106,14 @@ COMMAND_HANDLER(str9xpec_handle_flash_enable_turbo_command)
if (tap1 == NULL)
{
/* things are *WRONG* */
command_print(cmd_ctx,"**STR9FLASH** (tap1) invalid chain?");
command_print(CMD_CTX,"**STR9FLASH** (tap1) invalid chain?");
return ERROR_OK;
}
tap2 = tap1->next_tap;
if (tap2 == NULL)
{
/* things are *WRONG* */
command_print(cmd_ctx,"**STR9FLASH** (tap2) invalid chain?");
command_print(CMD_CTX,"**STR9FLASH** (tap2) invalid chain?");
return ERROR_OK;
}

@@ -1135,7 +1135,7 @@ COMMAND_HANDLER(str9xpec_handle_flash_disable_turbo_command)

if (CMD_ARGC < 1)
{
command_print(cmd_ctx, "str9xpec disable_turbo <bank>");
command_print(CMD_CTX, "str9xpec disable_turbo <bank>");
return ERROR_OK;
}



+ 10
- 10
src/flash/tms470.c View File

@@ -293,7 +293,7 @@ COMMAND_HANDLER(tms470_handle_flash_keyset_command)
{
if (CMD_ARGC > 4)
{
command_print(cmd_ctx, "tms470 flash_keyset <key0> <key1> <key2> <key3>");
command_print(CMD_CTX, "tms470 flash_keyset <key0> <key1> <key2> <key3>");
return ERROR_INVALID_ARGUMENTS;
}
else if (CMD_ARGC == 4)
@@ -306,7 +306,7 @@ COMMAND_HANDLER(tms470_handle_flash_keyset_command)

if (1 != sscanf(&CMD_ARGV[i][start], "%" SCNx32 "", &flashKeys[i]))
{
command_print(cmd_ctx, "could not process flash key %s", CMD_ARGV[i]);
command_print(CMD_CTX, "could not process flash key %s", CMD_ARGV[i]);
LOG_ERROR("could not process flash key %s", CMD_ARGV[i]);
return ERROR_INVALID_ARGUMENTS;
}
@@ -316,18 +316,18 @@ COMMAND_HANDLER(tms470_handle_flash_keyset_command)
}
else if (CMD_ARGC != 0)
{
command_print(cmd_ctx, "tms470 flash_keyset <key0> <key1> <key2> <key3>");
command_print(CMD_CTX, "tms470 flash_keyset <key0> <key1> <key2> <key3>");
return ERROR_INVALID_ARGUMENTS;
}

if (keysSet)
{
command_print(cmd_ctx, "using flash keys 0x%08" PRIx32 ", 0x%08" PRIx32 ", 0x%08" PRIx32 ", 0x%08" PRIx32 "",
command_print(CMD_CTX, "using flash keys 0x%08" PRIx32 ", 0x%08" PRIx32 ", 0x%08" PRIx32 ", 0x%08" PRIx32 "",
flashKeys[0], flashKeys[1], flashKeys[2], flashKeys[3]);
}
else
{
command_print(cmd_ctx, "flash keys not set");
command_print(CMD_CTX, "flash keys not set");
}

return ERROR_OK;
@@ -357,7 +357,7 @@ COMMAND_HANDLER(tms470_handle_osc_megahertz_command)
{
if (CMD_ARGC > 1)
{
command_print(cmd_ctx, "tms470 osc_megahertz <MHz>");
command_print(CMD_CTX, "tms470 osc_megahertz <MHz>");
return ERROR_INVALID_ARGUMENTS;
}
else if (CMD_ARGC == 1)
@@ -368,12 +368,12 @@ COMMAND_HANDLER(tms470_handle_osc_megahertz_command)
if (oscMHz <= 0)
{
LOG_ERROR("osc_megahertz must be positive and non-zero!");
command_print(cmd_ctx, "osc_megahertz must be positive and non-zero!");
command_print(CMD_CTX, "osc_megahertz must be positive and non-zero!");
oscMHz = 12;
return ERROR_INVALID_ARGUMENTS;
}

command_print(cmd_ctx, "osc_megahertz=%d", oscMHz);
command_print(CMD_CTX, "osc_megahertz=%d", oscMHz);

return ERROR_OK;
}
@@ -386,7 +386,7 @@ COMMAND_HANDLER(tms470_handle_plldis_command)
{
if (CMD_ARGC > 1)
{
command_print(cmd_ctx, "tms470 plldis <0 | 1>");
command_print(CMD_CTX, "tms470 plldis <0 | 1>");
return ERROR_INVALID_ARGUMENTS;
}
else if (CMD_ARGC == 1)
@@ -395,7 +395,7 @@ COMMAND_HANDLER(tms470_handle_plldis_command)
plldis = plldis ? 1 : 0;
}

command_print(cmd_ctx, "plldis=%d", plldis);
command_print(CMD_CTX, "plldis=%d", plldis);

return ERROR_OK;
}


+ 1
- 1
src/hello.c View File

@@ -44,7 +44,7 @@ COMMAND_HANDLER(handle_hello_command)
const char *sep, *name;
int retval = CALL_COMMAND_HANDLER(handle_hello_args, &sep, &name);
if (ERROR_OK == retval)
command_print(cmd_ctx, "Greetings%s%s!", sep, name);
command_print(CMD_CTX, "Greetings%s%s!", sep, name);
return retval;
}



+ 1
- 1
src/helper/command.h View File

@@ -244,7 +244,7 @@ DECLARE_PARSE_WRAPPER(_s8, int8_t);
do { \
int retval = parse_##type(in, &(out)); \
if (ERROR_OK != retval) { \
command_print(cmd_ctx, stringify(out) \
command_print(CMD_CTX, stringify(out) \
" option value ('%s') is not valid", in); \
return retval; \
} \


+ 13
- 13
src/helper/ioutil.c View File

@@ -61,13 +61,13 @@ COMMAND_HANDLER(handle_rm_command)
{
if (CMD_ARGC != 1)
{
command_print(cmd_ctx, "rm <filename>");
command_print(CMD_CTX, "rm <filename>");
return ERROR_INVALID_ARGUMENTS;
}

if (unlink(CMD_ARGV[0]) != 0)
{
command_print(cmd_ctx, "failed: %d", errno);
command_print(CMD_CTX, "failed: %d", errno);
}

return ERROR_OK;
@@ -137,7 +137,7 @@ COMMAND_HANDLER(handle_cat_command)
{
if (CMD_ARGC != 1)
{
command_print(cmd_ctx, "cat <filename>");
command_print(CMD_CTX, "cat <filename>");
return ERROR_INVALID_ARGUMENTS;
}

@@ -148,12 +148,12 @@ COMMAND_HANDLER(handle_cat_command)
int retval = loadFile(CMD_ARGV[0], &data, &len);
if (retval == ERROR_OK)
{
command_print(cmd_ctx, "%s", (char *)data);
command_print(CMD_CTX, "%s", (char *)data);
free(data);
}
else
{
command_print(cmd_ctx, "%s not found %d", CMD_ARGV[0], retval);
command_print(CMD_CTX, "%s not found %d", CMD_ARGV[0], retval);
}

return ERROR_OK;
@@ -163,7 +163,7 @@ COMMAND_HANDLER(handle_trunc_command)
{
if (CMD_ARGC != 1)
{
command_print(cmd_ctx, "trunc <filename>");
command_print(CMD_CTX, "trunc <filename>");
return ERROR_INVALID_ARGUMENTS;
}

@@ -182,7 +182,7 @@ COMMAND_HANDLER(handle_meminfo_command)

if (CMD_ARGC != 0)
{
command_print(cmd_ctx, "meminfo");
command_print(CMD_CTX, "meminfo");
return ERROR_INVALID_ARGUMENTS;
}

@@ -190,11 +190,11 @@ COMMAND_HANDLER(handle_meminfo_command)

if (prev > 0)
{
command_print(cmd_ctx, "Diff: %d", prev - info.fordblks);
command_print(CMD_CTX, "Diff: %d", prev - info.fordblks);
}
prev = info.fordblks;

command_print(cmd_ctx, "Available ram: %d", info.fordblks);
command_print(CMD_CTX, "Available ram: %d", info.fordblks);

return ERROR_OK;
}
@@ -204,7 +204,7 @@ COMMAND_HANDLER(handle_append_command)
{
if (CMD_ARGC < 1)
{
command_print(cmd_ctx,
command_print(CMD_CTX,
"append <filename> [<string1>, [<string2>, ...]]");
return ERROR_INVALID_ARGUMENTS;
}
@@ -276,7 +276,7 @@ COMMAND_HANDLER(handle_cp_command)
break;
}

command_print(cmd_ctx, "%zu", len - pos);
command_print(CMD_CTX, "%zu", len - pos);

pos += chunk;

@@ -286,10 +286,10 @@ COMMAND_HANDLER(handle_cp_command)

if (retval == ERROR_OK)
{
command_print(cmd_ctx, "Copied %s to %s", CMD_ARGV[0], CMD_ARGV[1]);
command_print(CMD_CTX, "Copied %s to %s", CMD_ARGV[0], CMD_ARGV[1]);
} else
{
command_print(cmd_ctx, "Failed: %d", retval);
command_print(CMD_CTX, "Failed: %d", retval);
}

if (data != NULL)


+ 1
- 1
src/helper/log.c View File

@@ -296,7 +296,7 @@ COMMAND_HANDLER(handle_debug_level_command)
}
}

command_print(cmd_ctx, "debug_level: %i", debug_level);
command_print(CMD_CTX, "debug_level: %i", debug_level);

return ERROR_OK;
}


+ 2
- 2
src/jtag/amt_jtagaccel.c View File

@@ -513,7 +513,7 @@ COMMAND_HANDLER(amt_jtagaccel_handle_parport_port_command)
}
}

command_print(cmd_ctx, "parport port = %u", amt_jtagaccel_port);
command_print(CMD_CTX, "parport port = %u", amt_jtagaccel_port);

return ERROR_OK;
}
@@ -522,7 +522,7 @@ COMMAND_HANDLER(amt_jtagaccel_handle_rtck_command)
{
if (CMD_ARGC == 0)
{
command_print(cmd_ctx, "amt_jtagaccel RTCK feature %s", (rtck_enabled) ? "enabled" : "disabled");
command_print(CMD_CTX, "amt_jtagaccel RTCK feature %s", (rtck_enabled) ? "enabled" : "disabled");
return ERROR_OK;
}
else


+ 1
- 1
src/jtag/gw16012.c View File

@@ -557,7 +557,7 @@ COMMAND_HANDLER(gw16012_handle_parport_port_command)
}
}

command_print(cmd_ctx, "parport port = %u", gw16012_port);
command_print(CMD_CTX, "parport port = %u", gw16012_port);

return ERROR_OK;
}


+ 1
- 1
src/jtag/jlink.c View File

@@ -629,7 +629,7 @@ COMMAND_HANDLER(jlink_handle_jlink_hw_jtag_command)
{
switch (CMD_ARGC) {
case 0:
command_print(cmd_ctx, "jlink hw jtag %i", jlink_hw_jtag_version);
command_print(CMD_CTX, "jlink hw jtag %i", jlink_hw_jtag_version);
break;
case 1: {
int request_version = atoi(CMD_ARGV[0]);


+ 3
- 3
src/jtag/parport.c View File

@@ -425,7 +425,7 @@ COMMAND_HANDLER(parport_handle_parport_port_command)
}
}

command_print(cmd_ctx, "parport port = %u", parport_port);
command_print(CMD_CTX, "parport port = %u", parport_port);

return ERROR_OK;
}
@@ -449,7 +449,7 @@ COMMAND_HANDLER(parport_handle_write_on_exit_command)
{
if (CMD_ARGC != 1)
{
command_print(cmd_ctx, "usage: parport_write_on_exit <on | off>");
command_print(CMD_CTX, "usage: parport_write_on_exit <on | off>");
return ERROR_OK;
}

@@ -479,7 +479,7 @@ COMMAND_HANDLER(parport_handle_parport_toggling_time_command)
wait_states = jtag_get_speed();
}

command_print(cmd_ctx, "parport toggling time = %" PRIu32 " ns",
command_print(CMD_CTX, "parport toggling time = %" PRIu32 " ns",
parport_toggling_time_ns);

return ERROR_OK;


+ 21
- 21
src/jtag/tcl.c View File

@@ -608,11 +608,11 @@ COMMAND_HANDLER(handle_interface_list_command)
if (strcmp(CMD_NAME, "interface_list") == 0 && CMD_ARGC > 0)
return ERROR_COMMAND_SYNTAX_ERROR;

command_print(cmd_ctx, "The following JTAG interfaces are available:");
command_print(CMD_CTX, "The following JTAG interfaces are available:");
for (unsigned i = 0; NULL != jtag_interfaces[i]; i++)
{
const char *name = jtag_interfaces[i]->name;
command_print(cmd_ctx, "%u: %s", i + 1, name);
command_print(CMD_CTX, "%u: %s", i + 1, name);
}

return ERROR_OK;
@@ -636,7 +636,7 @@ COMMAND_HANDLER(handle_interface_command)
if (strcmp(CMD_ARGV[0], jtag_interfaces[i]->name) != 0)
continue;

int retval = jtag_interfaces[i]->register_commands(cmd_ctx);
int retval = jtag_interfaces[i]->register_commands(CMD_CTX);
if (ERROR_OK != retval)
return retval;

@@ -667,8 +667,8 @@ COMMAND_HANDLER(handle_scan_chain_command)
struct jtag_tap *tap;

tap = jtag_all_taps();
command_print(cmd_ctx, " TapName | Enabled | IdCode Expected IrLen IrCap IrMask Instr ");
command_print(cmd_ctx, "---|--------------------|---------|------------|------------|------|------|------|---------");
command_print(CMD_CTX, " TapName | Enabled | IdCode Expected IrLen IrCap IrMask Instr ");
command_print(CMD_CTX, "---|--------------------|---------|------------|------------|------|------|------|---------");

while (tap) {
uint32_t expected, expected_mask, cur_instr, ii;
@@ -676,7 +676,7 @@ COMMAND_HANDLER(handle_scan_chain_command)
expected_mask = buf_get_u32(tap->expected_mask, 0, tap->ir_length);
cur_instr = buf_get_u32(tap->cur_instr, 0, tap->ir_length);

command_print(cmd_ctx,
command_print(CMD_CTX,
"%2d | %-18s | %c | 0x%08x | 0x%08x | 0x%02x | 0x%02x | 0x%02x | 0x%02x",
tap->abs_chain_position,
tap->dotted_name,
@@ -689,7 +689,7 @@ COMMAND_HANDLER(handle_scan_chain_command)
(unsigned int)(cur_instr));

for (ii = 1; ii < tap->expected_ids_cnt; ii++) {
command_print(cmd_ctx, " | | | | 0x%08x | | | | ",
command_print(CMD_CTX, " | | | | 0x%08x | | | | ",
(unsigned int)(tap->expected_ids[ii]));
}

@@ -888,7 +888,7 @@ next:
modes[4] = "";
}

command_print(cmd_ctx, "%s %s%s%s%s",
command_print(CMD_CTX, "%s %s%s%s%s",
modes[0], modes[1],
modes[2], modes[3], modes[4]);

@@ -906,7 +906,7 @@ COMMAND_HANDLER(handle_jtag_nsrst_delay_command)

jtag_set_nsrst_delay(delay);
}
command_print(cmd_ctx, "jtag_nsrst_delay: %u", jtag_get_nsrst_delay());
command_print(CMD_CTX, "jtag_nsrst_delay: %u", jtag_get_nsrst_delay());
return ERROR_OK;
}

@@ -921,7 +921,7 @@ COMMAND_HANDLER(handle_jtag_ntrst_delay_command)

jtag_set_ntrst_delay(delay);
}
command_print(cmd_ctx, "jtag_ntrst_delay: %u", jtag_get_ntrst_delay());
command_print(CMD_CTX, "jtag_ntrst_delay: %u", jtag_get_ntrst_delay());
return ERROR_OK;
}

@@ -936,7 +936,7 @@ COMMAND_HANDLER(handle_jtag_nsrst_assert_width_command)

jtag_set_nsrst_assert_width(delay);
}
command_print(cmd_ctx, "jtag_nsrst_assert_width: %u", jtag_get_nsrst_assert_width());
command_print(CMD_CTX, "jtag_nsrst_assert_width: %u", jtag_get_nsrst_assert_width());
return ERROR_OK;
}

@@ -951,7 +951,7 @@ COMMAND_HANDLER(handle_jtag_ntrst_assert_width_command)

jtag_set_ntrst_assert_width(delay);
}
command_print(cmd_ctx, "jtag_ntrst_assert_width: %u", jtag_get_ntrst_assert_width());
command_print(CMD_CTX, "jtag_ntrst_assert_width: %u", jtag_get_ntrst_assert_width());
return ERROR_OK;
}

@@ -977,9 +977,9 @@ COMMAND_HANDLER(handle_jtag_khz_command)
return retval;

if (cur_speed)
command_print(cmd_ctx, "%d kHz", cur_speed);
command_print(CMD_CTX, "%d kHz", cur_speed);
else
command_print(cmd_ctx, "RCLK - adaptive");
command_print(CMD_CTX, "RCLK - adaptive");

return retval;
}
@@ -1006,9 +1006,9 @@ COMMAND_HANDLER(handle_jtag_rclk_command)
return retval;

if (cur_khz)
command_print(cmd_ctx, "RCLK not supported - fallback to %d kHz", cur_khz);
command_print(CMD_CTX, "RCLK not supported - fallback to %d kHz", cur_khz);
else
command_print(cmd_ctx, "RCLK - adaptive");
command_print(CMD_CTX, "RCLK - adaptive");

return retval;
}
@@ -1034,7 +1034,7 @@ COMMAND_HANDLER(handle_jtag_reset_command)
else
return ERROR_COMMAND_SYNTAX_ERROR;

if (jtag_interface_init(cmd_ctx) != ERROR_OK)
if (jtag_interface_init(CMD_CTX) != ERROR_OK)
return ERROR_JTAG_INIT_FAILED;

jtag_add_reset(trst, srst);
@@ -1122,7 +1122,7 @@ COMMAND_HANDLER(handle_irscan_command)
for (j = 0; j < i; j++)
free(fields[j].out_value);
free(fields);
command_print(cmd_ctx, "Tap: %s unknown", CMD_ARGV[i*2]);
command_print(CMD_CTX, "Tap: %s unknown", CMD_ARGV[i*2]);

return ERROR_FAIL;
}
@@ -1366,7 +1366,7 @@ COMMAND_HANDLER(handle_verify_ircapture_command)
}

const char *status = jtag_will_verify_capture_ir() ? "enabled": "disabled";
command_print(cmd_ctx, "verify Capture-IR is %s", status);
command_print(CMD_CTX, "verify Capture-IR is %s", status);

return ERROR_OK;
}
@@ -1387,7 +1387,7 @@ COMMAND_HANDLER(handle_verify_jtag_command)
}

const char *status = jtag_will_verify() ? "enabled": "disabled";
command_print(cmd_ctx, "verify jtag capture is %s", status);
command_print(CMD_CTX, "verify jtag capture is %s", status);

return ERROR_OK;
}
@@ -1410,7 +1410,7 @@ COMMAND_HANDLER(handle_tms_sequence_command)
tap_use_new_tms_table(use_new_table);
}

command_print(cmd_ctx, "tms sequence is %s",
command_print(CMD_CTX, "tms sequence is %s",
tap_uses_new_tms_table() ? "short": "long");

return ERROR_OK;


+ 9
- 9
src/openocd.c View File

@@ -55,7 +55,7 @@ COMMAND_HANDLER(handle_version_command)
if (CMD_ARGC != 0)
return ERROR_COMMAND_SYNTAX_ERROR;

command_print(cmd_ctx, OPENOCD_VERSION);
command_print(CMD_CTX, OPENOCD_VERSION);

return ERROR_OK;
}
@@ -107,11 +107,11 @@ COMMAND_HANDLER(handle_init_command)

atexit(exit_handler);

if (target_init(cmd_ctx) != ERROR_OK)
if (target_init(CMD_CTX) != ERROR_OK)
return ERROR_FAIL;
LOG_DEBUG("target init complete");

if ((retval = jtag_interface_init(cmd_ctx)) != ERROR_OK)
if ((retval = jtag_interface_init(CMD_CTX)) != ERROR_OK)
{
/* we must be able to set up the jtag interface */
return retval;
@@ -120,7 +120,7 @@ COMMAND_HANDLER(handle_init_command)

/* Try to initialize & examine the JTAG chain at this point, but
* continue startup regardless */
if (jtag_init(cmd_ctx) == ERROR_OK)
if (jtag_init(CMD_CTX) == ERROR_OK)