This patch converts all instances of 'args' in COMMAND_HANDLER routines
to use CMD_ARGV macro.
63 files changed:
- if ((0 == strcmp(args[0], "show")) && (0 == strcmp(args[1], "all"))) {
+ if ((0 == strcmp(CMD_ARGV[0], "show")) && (0 == strcmp(CMD_ARGV[1], "all"))) {
who = -1;
} else {
uint32_t v32;
who = -1;
} else {
uint32_t v32;
- COMMAND_PARSE_NUMBER(u32, args[1], v32);
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[1], v32);
- if (0 == strcmp("show", args[0])) {
+ if (0 == strcmp("show", CMD_ARGV[0])) {
if (who == -1) {
showall:
r = ERROR_OK;
if (who == -1) {
showall:
r = ERROR_OK;
return ERROR_COMMAND_SYNTAX_ERROR;
}
return ERROR_COMMAND_SYNTAX_ERROR;
}
- if (0 == strcmp("set", args[0])) {
+ if (0 == strcmp("set", CMD_ARGV[0])) {
r = FLASHD_SetGPNVM(&(pChip->details.bank[0]), who);
r = FLASHD_SetGPNVM(&(pChip->details.bank[0]), who);
- } else if ((0 == strcmp("clr", args[0])) ||
- (0 == strcmp("clear", args[0]))) { // quietly accept both
+ } else if ((0 == strcmp("clr", CMD_ARGV[0])) ||
+ (0 == strcmp("clear", CMD_ARGV[0]))) { // quietly accept both
r = FLASHD_ClrGPNVM(&(pChip->details.bank[0]), who);
} else {
r = FLASHD_ClrGPNVM(&(pChip->details.bank[0]), who);
} else {
- command_print(cmd_ctx, "Unkown command: %s", args[0]);
+ command_print(cmd_ctx, "Unkown command: %s", CMD_ARGV[0]);
r = ERROR_COMMAND_SYNTAX_ERROR;
}
return r;
r = ERROR_COMMAND_SYNTAX_ERROR;
}
return r;
- COMMAND_PARSE_NUMBER(u32, args[0], v);
+ 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));
if (v > 200000) {
// absurd slow clock of 200Khz?
command_print(cmd_ctx,"Absurd/illegal slow clock freq: %d\n", (int)(v));
- COMMAND_PARSE_NUMBER(u32, args[1], base_address);
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[1], base_address);
- COMMAND_PARSE_NUMBER(int, args[3], chip_width);
- COMMAND_PARSE_NUMBER(int, args[4], bus_width);
+ COMMAND_PARSE_NUMBER(int, CMD_ARGV[3], chip_width);
+ COMMAND_PARSE_NUMBER(int, CMD_ARGV[4], bus_width);
- COMMAND_PARSE_NUMBER(int, args[8], banks_num);
- COMMAND_PARSE_NUMBER(int, args[9], num_sectors);
- COMMAND_PARSE_NUMBER(u16, args[10], pages_per_sector);
- COMMAND_PARSE_NUMBER(u16, args[11], page_size);
- COMMAND_PARSE_NUMBER(u16, args[12], num_nvmbits);
+ COMMAND_PARSE_NUMBER(int, CMD_ARGV[8], banks_num);
+ COMMAND_PARSE_NUMBER(int, CMD_ARGV[9], num_sectors);
+ COMMAND_PARSE_NUMBER(u16, CMD_ARGV[10], pages_per_sector);
+ COMMAND_PARSE_NUMBER(u16, CMD_ARGV[11], page_size);
+ COMMAND_PARSE_NUMBER(u16, CMD_ARGV[12], num_nvmbits);
if (CMD_ARGC == 14) {
unsigned long freq;
if (CMD_ARGC == 14) {
unsigned long freq;
- COMMAND_PARSE_NUMBER(ulong, args[13], freq);
+ COMMAND_PARSE_NUMBER(ulong, CMD_ARGV[13], freq);
ext_freq = freq * 1000;
at91sam7_info->ext_freq = ext_freq;
}
ext_freq = freq * 1000;
at91sam7_info->ext_freq = ext_freq;
}
- target_name = calloc(strlen(args[7]) + 1, sizeof(char));
- strcpy(target_name, args[7]);
+ target_name = calloc(strlen(CMD_ARGV[7]) + 1, sizeof(char));
+ strcpy(target_name, CMD_ARGV[7]);
/* calculate bank size */
bank_size = num_sectors * pages_per_sector * page_size;
/* calculate bank size */
bank_size = num_sectors * pages_per_sector * page_size;
}
if (strcmp(bank->driver->name, "at91sam7"))
{
}
if (strcmp(bank->driver->name, "at91sam7"))
{
- command_print(cmd_ctx, "not an at91sam7 flash bank '%s'", args[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)
return ERROR_FLASH_BANK_INVALID;
}
if (bank->target->state != TARGET_HALTED)
return ERROR_TARGET_NOT_HALTED;
}
return ERROR_TARGET_NOT_HALTED;
}
- if (strcmp(args[1], "set") == 0)
+ if (strcmp(CMD_ARGV[1], "set") == 0)
- else if (strcmp(args[1], "clear") == 0)
+ else if (strcmp(CMD_ARGV[1], "clear") == 0)
- COMMAND_PARSE_NUMBER(int, args[0], bit);
+ COMMAND_PARSE_NUMBER(int, CMD_ARGV[0], bit);
if ((bit < 0) || (bit >= at91sam7_info->num_nvmbits))
{
if ((bit < 0) || (bit >= at91sam7_info->num_nvmbits))
{
- command_print(cmd_ctx, "gpnvm bit '#%s' is out of bounds for target %s", args[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);
}
uint16_t chip_width, bus_width;
}
uint16_t chip_width, bus_width;
- COMMAND_PARSE_NUMBER(u16, args[3], bus_width);
- COMMAND_PARSE_NUMBER(u16, args[4], chip_width);
+ COMMAND_PARSE_NUMBER(u16, CMD_ARGV[3], bus_width);
+ COMMAND_PARSE_NUMBER(u16, CMD_ARGV[4], chip_width);
if ((chip_width > CFI_MAX_CHIP_WIDTH)
|| (bus_width > CFI_MAX_BUS_WIDTH))
if ((chip_width > CFI_MAX_CHIP_WIDTH)
|| (bus_width > CFI_MAX_BUS_WIDTH))
for (unsigned i = 6; i < CMD_ARGC; i++)
{
for (unsigned i = 6; i < CMD_ARGC; i++)
{
- if (strcmp(args[i], "x16_as_x8") == 0)
+ if (strcmp(CMD_ARGV[i], "x16_as_x8") == 0)
{
cfi_info->x16_as_x8 = 1;
}
{
cfi_info->x16_as_x8 = 1;
}
- else if (strcmp(args[i], "jedec_probe") == 0)
+ else if (strcmp(CMD_ARGV[i], "jedec_probe") == 0)
{
cfi_info->jedec_probe = 1;
}
{
cfi_info->jedec_probe = 1;
}
if (CMD_ARGC < 5) {
LOG_ERROR("parameters: %s target "
"chip_addr hwecc_mode aemif_addr",
if (CMD_ARGC < 5) {
LOG_ERROR("parameters: %s target "
"chip_addr hwecc_mode aemif_addr",
- target = get_target(args[1]);
+ target = get_target(CMD_ARGV[1]);
- LOG_ERROR("invalid target %s", args[1]);
+ LOG_ERROR("invalid target %s", CMD_ARGV[1]);
- COMMAND_PARSE_NUMBER(ulong, args[2], chip);
+ COMMAND_PARSE_NUMBER(ulong, CMD_ARGV[2], chip);
- LOG_ERROR("Invalid NAND chip address %s", args[2]);
+ LOG_ERROR("Invalid NAND chip address %s", CMD_ARGV[2]);
- if (strcmp(args[3], "hwecc1") == 0)
+ if (strcmp(CMD_ARGV[3], "hwecc1") == 0)
- else if (strcmp(args[3], "hwecc4") == 0)
+ else if (strcmp(CMD_ARGV[3], "hwecc4") == 0)
- else if (strcmp(args[3], "hwecc4_infix") == 0)
+ else if (strcmp(CMD_ARGV[3], "hwecc4_infix") == 0)
eccmode = HWECC4_INFIX;
else {
eccmode = HWECC4_INFIX;
else {
- LOG_ERROR("Invalid ecc mode %s", args[3]);
+ LOG_ERROR("Invalid ecc mode %s", CMD_ARGV[3]);
- COMMAND_PARSE_NUMBER(ulong, args[4], aemif);
+ COMMAND_PARSE_NUMBER(ulong, CMD_ARGV[4], aemif);
- LOG_ERROR("Invalid AEMIF controller address %s", args[4]);
+ LOG_ERROR("Invalid AEMIF controller address %s", CMD_ARGV[4]);
exit(-1);
}
bank->driver_priv = info;
exit(-1);
}
bank->driver_priv = info;
- info->driverPath = strdup(args[6]);
+ info->driverPath = strdup(CMD_ARGV[6]);
/* eCos flash sector sizes are not exposed to OpenOCD, use 0x10000 as
* a way to improve impedance match between OpenOCD and eCos flash
/* eCos flash sector sizes are not exposed to OpenOCD, use 0x10000 as
* a way to improve impedance match between OpenOCD and eCos flash
bank->sectors[i].is_protected = 0;
}
bank->sectors[i].is_protected = 0;
}
- info->target = get_target(args[5]);
+ info->target = get_target(CMD_ARGV[5]);
if (info->target == NULL)
{
if (info->target == NULL)
{
- LOG_ERROR("target '%s' not defined", args[5]);
+ LOG_ERROR("target '%s' not defined", CMD_ARGV[5]);
return ERROR_FAIL;
}
return ERROR_OK;
return ERROR_FAIL;
}
return ERROR_OK;
bank->sectors[i].is_protected = 0;
}
bank->sectors[i].is_protected = 0;
}
- info->target = get_target(args[5]);
+ info->target = get_target(CMD_ARGV[5]);
if (info->target == NULL)
{
if (info->target == NULL)
{
- LOG_ERROR("target '%s' not defined", args[5]);
+ LOG_ERROR("target '%s' not defined", CMD_ARGV[5]);
free(info->memory);
free(info);
return ERROR_FAIL;
free(info->memory);
free(info);
return ERROR_FAIL;
COMMAND_HELPER(flash_command_get_bank_by_num,
unsigned name_index, struct flash_bank **bank)
{
COMMAND_HELPER(flash_command_get_bank_by_num,
unsigned name_index, struct flash_bank **bank)
{
+ const char *name = CMD_ARGV[name_index];
- COMMAND_PARSE_NUMBER(uint, args[name_index], bank_num);
+ COMMAND_PARSE_NUMBER(uint, name, bank_num);
*bank = get_flash_bank_by_num(bank_num);
if (!*bank)
{
*bank = get_flash_bank_by_num(bank_num);
if (!*bank)
{
- command_print(cmd_ctx,
- "flash bank '#%u' not found", bank_num);
+ command_print(cmd_ctx, "flash bank '%s' not found", name);
return ERROR_INVALID_ARGUMENTS;
}
return ERROR_OK;
return ERROR_INVALID_ARGUMENTS;
}
return ERROR_OK;
return ERROR_COMMAND_SYNTAX_ERROR;
}
return ERROR_COMMAND_SYNTAX_ERROR;
}
- if ((target = get_target(args[5])) == NULL)
+ if ((target = get_target(CMD_ARGV[5])) == NULL)
- LOG_ERROR("target '%s' not defined", args[5]);
+ LOG_ERROR("target '%s' not defined", CMD_ARGV[5]);
return ERROR_FAIL;
}
for (i = 0; flash_drivers[i]; i++)
{
return ERROR_FAIL;
}
for (i = 0; flash_drivers[i]; i++)
{
- if (strcmp(args[0], flash_drivers[i]->name) != 0)
+ if (strcmp(CMD_ARGV[0], flash_drivers[i]->name) != 0)
continue;
struct flash_bank *p, *c;
continue;
struct flash_bank *p, *c;
/* register flash specific commands */
if (flash_drivers[i]->register_commands(cmd_ctx) != ERROR_OK)
{
/* register flash specific commands */
if (flash_drivers[i]->register_commands(cmd_ctx) != ERROR_OK)
{
- LOG_ERROR("couldn't register '%s' commands", args[0]);
+ LOG_ERROR("couldn't register '%s' commands", CMD_ARGV[0]);
c->target = target;
c->driver = flash_drivers[i];
c->driver_priv = NULL;
c->target = target;
c->driver = flash_drivers[i];
c->driver_priv = NULL;
- COMMAND_PARSE_NUMBER(u32, args[1], c->base);
- COMMAND_PARSE_NUMBER(u32, args[2], c->size);
- COMMAND_PARSE_NUMBER(int, args[3], c->chip_width);
- COMMAND_PARSE_NUMBER(int, args[4], c->bus_width);
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[1], c->base);
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[2], c->size);
+ COMMAND_PARSE_NUMBER(int, CMD_ARGV[3], c->chip_width);
+ COMMAND_PARSE_NUMBER(int, CMD_ARGV[4], c->bus_width);
c->num_sectors = 0;
c->sectors = NULL;
c->next = NULL;
c->num_sectors = 0;
c->sectors = NULL;
c->next = NULL;
retval = CALL_COMMAND_HANDLER(flash_drivers[i]->flash_bank_command, c);
if (ERROR_OK != retval)
{
retval = CALL_COMMAND_HANDLER(flash_drivers[i]->flash_bank_command, c);
if (ERROR_OK != retval)
{
- LOG_ERROR("'%s' driver rejected flash bank at 0x%8.8" PRIx32 , args[0], c->base);
+ LOG_ERROR("'%s' driver rejected flash bank at 0x%8.8" PRIx32 , CMD_ARGV[0], c->base);
free(c);
return retval;
}
free(c);
return retval;
}
/* no matching flash driver found */
if (!found)
{
/* no matching flash driver found */
if (!found)
{
- LOG_ERROR("flash driver '%s' not found", args[0]);
+ LOG_ERROR("flash driver '%s' not found", CMD_ARGV[0]);
return ERROR_COMMAND_SYNTAX_ERROR;
unsigned bank_nr;
return ERROR_COMMAND_SYNTAX_ERROR;
unsigned bank_nr;
- COMMAND_PARSE_NUMBER(uint, args[0], bank_nr);
+ COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], bank_nr);
for (p = flash_banks; p; p = p->next, i++)
{
for (p = flash_banks; p; p = p->next, i++)
{
- COMMAND_PARSE_NUMBER(uint, args[0], bank_nr);
+ COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], bank_nr);
struct flash_bank *p = get_flash_bank_by_num_noprobe(bank_nr);
if (p)
{
struct flash_bank *p = get_flash_bank_by_num_noprobe(bank_nr);
if (p)
{
else if (retval == ERROR_FLASH_BANK_INVALID)
{
command_print(cmd_ctx, "probing failed for flash bank '#%s' at 0x%8.8" PRIx32,
else if (retval == ERROR_FLASH_BANK_INVALID)
{
command_print(cmd_ctx, "probing failed for flash bank '#%s' at 0x%8.8" PRIx32,
}
else
{
command_print(cmd_ctx, "unknown error when probing flash bank '#%s' at 0x%8.8" PRIx32,
}
else
{
command_print(cmd_ctx, "unknown error when probing flash bank '#%s' at 0x%8.8" PRIx32,
- command_print(cmd_ctx, "flash bank '#%s' is out of bounds", args[0]);
+ command_print(cmd_ctx, "flash bank '#%s' is out of bounds", CMD_ARGV[0]);
else
{
command_print(cmd_ctx, "unknown error when checking erase state of flash bank #%s at 0x%8.8" PRIx32,
else
{
command_print(cmd_ctx, "unknown error when checking erase state of flash bank #%s at 0x%8.8" PRIx32,
}
for (j = 0; j < p->num_sectors; j++)
}
for (j = 0; j < p->num_sectors; j++)
if (CMD_ARGC != 2)
return ERROR_COMMAND_SYNTAX_ERROR;
if (CMD_ARGC != 2)
return ERROR_COMMAND_SYNTAX_ERROR;
- COMMAND_PARSE_NUMBER(int, args[0], address);
- COMMAND_PARSE_NUMBER(int, args[1], length);
+ COMMAND_PARSE_NUMBER(int, CMD_ARGV[0], address);
+ COMMAND_PARSE_NUMBER(int, CMD_ARGV[1], length);
if (length <= 0)
{
command_print(cmd_ctx, "Length must be >0");
if (length <= 0)
{
command_print(cmd_ctx, "Length must be >0");
}
else if (retval == ERROR_FLASH_OPERATION_FAILED)
{
}
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, args[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);
- command_print(cmd_ctx, "unknown error when checking protection state of flash bank '#%s' at 0x%8.8" PRIx32, args[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);
uint32_t first;
uint32_t last;
uint32_t first;
uint32_t last;
- COMMAND_PARSE_NUMBER(u32, args[0], bank_nr);
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], bank_nr);
struct flash_bank *p = get_flash_bank_by_num(bank_nr);
if (!p)
return ERROR_OK;
struct flash_bank *p = get_flash_bank_by_num(bank_nr);
if (!p)
return ERROR_OK;
- COMMAND_PARSE_NUMBER(u32, args[1], first);
- if (strcmp(args[2], "last") == 0)
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[1], first);
+ if (strcmp(CMD_ARGV[2], "last") == 0)
last = p->num_sectors - 1;
else
last = p->num_sectors - 1;
else
- COMMAND_PARSE_NUMBER(u32, args[2], last);
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[2], last);
int retval;
if ((retval = flash_check_sector_parameters(cmd_ctx,
int retval;
if ((retval = flash_check_sector_parameters(cmd_ctx,
- COMMAND_PARSE_NUMBER(u32, args[0], bank_nr);
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], bank_nr);
struct flash_bank *p = get_flash_bank_by_num(bank_nr);
if (!p)
return ERROR_OK;
struct flash_bank *p = get_flash_bank_by_num(bank_nr);
if (!p)
return ERROR_OK;
- COMMAND_PARSE_NUMBER(u32, args[1], first);
- if (strcmp(args[2], "last") == 0)
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[1], first);
+ if (strcmp(CMD_ARGV[2], "last") == 0)
last = p->num_sectors - 1;
else
last = p->num_sectors - 1;
else
- COMMAND_PARSE_NUMBER(u32, args[2], last);
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[2], last);
- if (strcmp(args[3], "on") == 0)
+ if (strcmp(CMD_ARGV[3], "on") == 0)
- else if (strcmp(args[3], "off") == 0)
+ else if (strcmp(CMD_ARGV[3], "off") == 0)
set = 0;
else
return ERROR_COMMAND_SYNTAX_ERROR;
set = 0;
else
return ERROR_COMMAND_SYNTAX_ERROR;
- if (strcmp(args[0], "erase") == 0)
+ if (strcmp(CMD_ARGV[0], "erase") == 0)
CMD_ARGC--;
command_print(cmd_ctx, "auto erase enabled");
CMD_ARGC--;
command_print(cmd_ctx, "auto erase enabled");
- } else if (strcmp(args[0], "unlock") == 0)
+ } else if (strcmp(CMD_ARGV[0], "unlock") == 0)
CMD_ARGC--;
command_print(cmd_ctx, "auto unlock enabled");
} else
CMD_ARGC--;
command_print(cmd_ctx, "auto unlock enabled");
} else
if (CMD_ARGC >= 2)
{
image.base_address_set = 1;
if (CMD_ARGC >= 2)
{
image.base_address_set = 1;
- COMMAND_PARSE_NUMBER(int, args[1], image.base_address);
+ COMMAND_PARSE_NUMBER(int, CMD_ARGV[1], image.base_address);
image.start_address_set = 0;
image.start_address_set = 0;
- retval = image_open(&image, args[0], (CMD_ARGC == 3) ? args[2] : NULL);
+ retval = image_open(&image, CMD_ARGV[0], (CMD_ARGC == 3) ? CMD_ARGV[2] : NULL);
if (retval != ERROR_OK)
{
return retval;
if (retval != ERROR_OK)
{
return retval;
if ((ERROR_OK == retval) && (duration_measure(&bench) == ERROR_OK))
{
command_print(cmd_ctx, "wrote %" PRIu32 " byte from file %s "
if ((ERROR_OK == retval) && (duration_measure(&bench) == ERROR_OK))
{
command_print(cmd_ctx, "wrote %" PRIu32 " byte from file %s "
- "in %fs (%0.3f kb/s)", written, args[0],
+ "in %fs (%0.3f kb/s)", written, CMD_ARGV[0],
duration_elapsed(&bench), duration_kbps(&bench, written));
}
duration_elapsed(&bench), duration_kbps(&bench, written));
}
if (CMD_ARGC != 3)
return ERROR_COMMAND_SYNTAX_ERROR;
if (CMD_ARGC != 3)
return ERROR_COMMAND_SYNTAX_ERROR;
- COMMAND_PARSE_NUMBER(u32, args[0], address);
- COMMAND_PARSE_NUMBER(u32, args[1], pattern);
- COMMAND_PARSE_NUMBER(u32, args[2], count);
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], address);
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[1], pattern);
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[2], count);
if (count == 0)
return ERROR_OK;
if (count == 0)
return ERROR_OK;
if (ERROR_OK != retval)
return retval;
if (ERROR_OK != retval)
return retval;
- COMMAND_PARSE_NUMBER(u32, args[2], offset);
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[2], offset);
- if (fileio_open(&fileio, args[1], FILEIO_READ, FILEIO_BINARY) != ERROR_OK)
+ if (fileio_open(&fileio, CMD_ARGV[1], FILEIO_READ, FILEIO_BINARY) != ERROR_OK)
{
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)",
{
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, args[1], p->bank_number, offset,
+ fileio.size, CMD_ARGV[1], p->bank_number, offset,
duration_elapsed(&bench), duration_kbps(&bench, fileio.size));
}
duration_elapsed(&bench), duration_kbps(&bench, fileio.size));
}
* layer when this routine is called, and the driver can store
* additional information in its struct flash_bank::driver_priv field.
*
* layer when this routine is called, and the driver can store
* additional information in its struct flash_bank::driver_priv field.
*
+ * The CMD_ARGV are: @par
- * args[0] = bank
- * args[1] = drivername {name above}
- * args[2] = baseaddress
- * args[3] = lengthbytes
- * args[4] = chip_width_in bytes
- * args[5] = bus_width_bytes
- * args[6] = driver-specific parameters
+ * CMD_ARGV[0] = bank
+ * CMD_ARGV[1] = drivername {name above}
+ * CMD_ARGV[2] = baseaddress
+ * CMD_ARGV[3] = lengthbytes
+ * CMD_ARGV[4] = chip_width_in bytes
+ * CMD_ARGV[5] = bus_width_bytes
+ * CMD_ARGV[6] = driver-specific parameters
- * For example, args[4] = 16 bit flash, args[5] = 32bit bus.
+ * For example, CMD_ARGV[4] = 16 bit flash, CMD_ARGV[5] = 32bit bus.
*
* If extra arguments are provided (@a CMD_ARGC > 6), they will
*
* If extra arguments are provided (@a CMD_ARGC > 6), they will
- * start in @a args[6]. These can be used to implement
+ * start in @a CMD_ARGV[6]. These can be used to implement
* driver-specific extensions.
*
* @returns ERROR_OK if successful; otherwise, an error code.
* driver-specific extensions.
*
* @returns ERROR_OK if successful; otherwise, an error code.
lpc2000_info = malloc(sizeof(struct lpc2000_flash_bank));
bank->driver_priv = lpc2000_info;
lpc2000_info = malloc(sizeof(struct lpc2000_flash_bank));
bank->driver_priv = lpc2000_info;
- if (strcmp(args[6], "lpc2000_v1") == 0)
+ if (strcmp(CMD_ARGV[6], "lpc2000_v1") == 0)
{
lpc2000_info->variant = lpc2000_v1;
lpc2000_info->cmd51_dst_boundary = 512;
{
lpc2000_info->variant = lpc2000_v1;
lpc2000_info->cmd51_dst_boundary = 512;
lpc2000_info->cmd51_can_8192b = 1;
lpc2000_info->checksum_vector = 5;
}
lpc2000_info->cmd51_can_8192b = 1;
lpc2000_info->checksum_vector = 5;
}
- else if (strcmp(args[6], "lpc2000_v2") == 0)
+ else if (strcmp(CMD_ARGV[6], "lpc2000_v2") == 0)
{
lpc2000_info->variant = lpc2000_v2;
lpc2000_info->cmd51_dst_boundary = 256;
{
lpc2000_info->variant = lpc2000_v2;
lpc2000_info->cmd51_dst_boundary = 256;
lpc2000_info->cmd51_can_8192b = 0;
lpc2000_info->checksum_vector = 5;
}
lpc2000_info->cmd51_can_8192b = 0;
lpc2000_info->checksum_vector = 5;
}
- else if (strcmp(args[6], "lpc1700") == 0)
+ else if (strcmp(CMD_ARGV[6], "lpc1700") == 0)
{
lpc2000_info->variant = lpc1700;
lpc2000_info->cmd51_dst_boundary = 256;
{
lpc2000_info->variant = lpc1700;
lpc2000_info->cmd51_dst_boundary = 256;
- LOG_ERROR("unknown LPC2000 variant: %s", args[6]);
+ LOG_ERROR("unknown LPC2000 variant: %s", CMD_ARGV[6]);
free(lpc2000_info);
return ERROR_FLASH_BANK_INVALID;
}
lpc2000_info->iap_working_area = NULL;
free(lpc2000_info);
return ERROR_FLASH_BANK_INVALID;
}
lpc2000_info->iap_working_area = NULL;
- COMMAND_PARSE_NUMBER(u32, args[7], lpc2000_info->cclk);
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[7], lpc2000_info->cclk);
lpc2000_info->calc_checksum = 0;
lpc2000_build_sector_list(bank);
if (CMD_ARGC >= 9)
{
lpc2000_info->calc_checksum = 0;
lpc2000_build_sector_list(bank);
if (CMD_ARGC >= 9)
{
- if (strcmp(args[8], "calc_checksum") == 0)
+ if (strcmp(CMD_ARGV[8], "calc_checksum") == 0)
lpc2000_info->calc_checksum = 1;
}
lpc2000_info->calc_checksum = 1;
}
/* part wasn't probed for info yet */
lpc288x_info->cidr = 0;
/* part wasn't probed for info yet */
lpc288x_info->cidr = 0;
- COMMAND_PARSE_NUMBER(u32, args[6], lpc288x_info->cclk);
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[6], lpc288x_info->cclk);
/* Try and open the file */
struct fileio fileio;
/* Try and open the file */
struct fileio fileio;
- const char *filename = args[1];
+ const char *filename = CMD_ARGV[1];
int ret = fileio_open( &fileio, filename, FILEIO_WRITE, FILEIO_BINARY );
if( ret != ERROR_OK )
{
int ret = fileio_open( &fileio, filename, FILEIO_WRITE, FILEIO_BINARY );
if( ret != ERROR_OK )
{
#define ISS_PASSWORD "I_know_what_I_am_doing"
#define ISS_PASSWORD "I_know_what_I_am_doing"
- lpc2900_info->risky = !strcmp( args[1], ISS_PASSWORD );
+ lpc2900_info->risky = !strcmp( CMD_ARGV[1], ISS_PASSWORD );
if( !lpc2900_info->risky )
{
if( !lpc2900_info->risky )
{
image.base_address = 0;
image.start_address_set = 0;
image.base_address = 0;
image.start_address_set = 0;
- const char *filename = args[1];
- const char *type = (CMD_ARGC >= 3) ? args[2] : NULL;
+ const char *filename = CMD_ARGV[1];
+ const char *type = (CMD_ARGC >= 3) ? CMD_ARGV[2] : NULL;
retval = image_open(&image, filename, type);
if (retval != ERROR_OK)
{
retval = image_open(&image, filename, type);
if (retval != ERROR_OK)
{
/* Read sector range, and do a sanity check. */
int first, last;
/* Read sector range, and do a sanity check. */
int first, last;
- COMMAND_PARSE_NUMBER(int, args[1], first);
- COMMAND_PARSE_NUMBER(int, args[2], last);
+ COMMAND_PARSE_NUMBER(int, CMD_ARGV[1], first);
+ COMMAND_PARSE_NUMBER(int, CMD_ARGV[2], last);
if( (first >= bank->num_sectors) ||
(last >= bank->num_sectors) ||
(first > last) )
if( (first >= bank->num_sectors) ||
(last >= bank->num_sectors) ||
(first > last) )
* (if clock too slow), or for erase time (clock too fast).
*/
uint32_t clk_sys_fmc;
* (if clock too slow), or for erase time (clock too fast).
*/
uint32_t clk_sys_fmc;
- COMMAND_PARSE_NUMBER(u32, args[6], clk_sys_fmc);
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[6], clk_sys_fmc);
lpc2900_info->clk_sys_fmc = clk_sys_fmc * 1000;
uint32_t clock_limit;
lpc2900_info->clk_sys_fmc = clk_sys_fmc * 1000;
uint32_t clock_limit;
return ERROR_FLASH_BANK_INVALID;
}
return ERROR_FLASH_BANK_INVALID;
}
- struct target *target = get_target(args[1]);
+ struct target *target = get_target(CMD_ARGV[1]);
- LOG_ERROR("target '%s' not defined", args[1]);
+ LOG_ERROR("target '%s' not defined", CMD_ARGV[1]);
return ERROR_NAND_DEVICE_INVALID;
}
uint32_t osc_freq;
return ERROR_NAND_DEVICE_INVALID;
}
uint32_t osc_freq;
- COMMAND_PARSE_NUMBER(u32, args[2], osc_freq);
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[2], osc_freq);
struct lpc3180_nand_controller *lpc3180_info;
lpc3180_info = malloc(sizeof(struct lpc3180_nand_controller));
struct lpc3180_nand_controller *lpc3180_info;
lpc3180_info = malloc(sizeof(struct lpc3180_nand_controller));
- COMMAND_PARSE_NUMBER(uint, args[1], num);
+ COMMAND_PARSE_NUMBER(uint, CMD_ARGV[1], num);
struct nand_device *nand = get_nand_device_by_num(num);
if (!nand)
{
struct nand_device *nand = get_nand_device_by_num(num);
if (!nand)
{
- command_print(cmd_ctx, "nand device '#%s' is out of bounds", args[0]);
+ command_print(cmd_ctx, "nand device '#%s' is out of bounds", CMD_ARGV[0]);
- if (strcmp(args[1], "mlc") == 0)
+ if (strcmp(CMD_ARGV[1], "mlc") == 0)
{
lpc3180_info->selected_controller = LPC3180_MLC_CONTROLLER;
}
{
lpc3180_info->selected_controller = LPC3180_MLC_CONTROLLER;
}
- else if (strcmp(args[1], "slc") == 0)
+ else if (strcmp(CMD_ARGV[1], "slc") == 0)
{
lpc3180_info->selected_controller = LPC3180_SLC_CONTROLLER;
}
{
lpc3180_info->selected_controller = LPC3180_SLC_CONTROLLER;
}
return ERROR_COMMAND_SYNTAX_ERROR;
}
return ERROR_COMMAND_SYNTAX_ERROR;
}
- COMMAND_PARSE_NUMBER(u32, args[2], address);
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[2], address);
- ret = fileio_open(&fileio, args[1], FILEIO_READ, FILEIO_BINARY);
+ ret = fileio_open(&fileio, CMD_ARGV[1], FILEIO_READ, FILEIO_BINARY);
if (ret != ERROR_OK)
return ret;
if (ret != ERROR_OK)
return ret;
if (duration_measure(&bench) == ERROR_OK)
{
command_print(cmd_ctx, "wrote %zu byte from file %s "
if (duration_measure(&bench) == ERROR_OK)
{
command_print(cmd_ctx, "wrote %zu byte from file %s "
- "in %fs (%0.3f kB/s)", fileio.size, args[1],
+ "in %fs (%0.3f kB/s)", fileio.size, CMD_ARGV[1],
duration_elapsed(&bench), duration_kbps(&bench, fileio.size));
}
duration_elapsed(&bench), duration_kbps(&bench, fileio.size));
}
return ERROR_COMMAND_SYNTAX_ERROR;
}
return ERROR_COMMAND_SYNTAX_ERROR;
}
- COMMAND_PARSE_NUMBER(u32, args[2], address);
- COMMAND_PARSE_NUMBER(u32, args[3], size);
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[2], address);
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[3], size);
- ret = fileio_open(&fileio, args[1], FILEIO_WRITE, FILEIO_BINARY);
+ ret = fileio_open(&fileio, CMD_ARGV[1], FILEIO_WRITE, FILEIO_BINARY);
if (ret != ERROR_OK)
return ret;
if (ret != ERROR_OK)
return ret;
{
command_print(cmd_ctx, "dump image (address 0x%8.8" PRIx32 " "
"size %" PRIu32 ") to file %s in %fs (%0.3f kB/s)",
{
command_print(cmd_ctx, "dump image (address 0x%8.8" PRIx32 " "
"size %" PRIu32 ") to file %s in %fs (%0.3f kB/s)",
- address, size, args[1],
+ address, size, CMD_ARGV[1],
duration_elapsed(&bench), duration_kbps(&bench, size));
}
duration_elapsed(&bench), duration_kbps(&bench, size));
}
switch (CMD_ARGC) {
case 2:
switch (CMD_ARGC) {
case 2:
- if (!strcmp(args[1], "boot"))
+ if (!strcmp(CMD_ARGV[1], "boot"))
- else if (!strcmp(args[1], "storage"))
+ else if (!strcmp(CMD_ARGV[1], "storage"))
return mg_storage_config();
else
return ERROR_COMMAND_NOTFOUND;
break;
case 3:
return mg_storage_config();
else
return ERROR_COMMAND_NOTFOUND;
break;
case 3:
- if (!strcmp(args[1], "pll")) {
+ if (!strcmp(CMD_ARGV[1], "pll")) {
- COMMAND_PARSE_NUMBER(ulong, args[2], freq);
+ COMMAND_PARSE_NUMBER(ulong, CMD_ARGV[2], freq);
fin = freq;
if (fin > MG_PLL_CLK_OUT) {
fin = freq;
if (fin > MG_PLL_CLK_OUT) {
return ERROR_COMMAND_SYNTAX_ERROR;
}
return ERROR_COMMAND_SYNTAX_ERROR;
}
- if ((target = get_target(args[3])) == NULL)
+ if ((target = get_target(CMD_ARGV[3])) == NULL)
- LOG_ERROR("target '%s' not defined", args[3]);
+ LOG_ERROR("target '%s' not defined", CMD_ARGV[3]);
return ERROR_FAIL;
}
mflash_bank = calloc(sizeof(struct mflash_bank), 1);
return ERROR_FAIL;
}
mflash_bank = calloc(sizeof(struct mflash_bank), 1);
- COMMAND_PARSE_NUMBER(u32, args[1], mflash_bank->base);
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[1], mflash_bank->base);
/// @todo Verify how this parsing should work, then document it.
char *str;
/// @todo Verify how this parsing should work, then document it.
char *str;
- mflash_bank->rst_pin.num = strtoul(args[2], &str, 0);
+ mflash_bank->rst_pin.num = strtoul(CMD_ARGV[2], &str, 0);
if (*str)
mflash_bank->rst_pin.port[0] = (uint16_t)tolower(str[0]);
mflash_bank->target = target;
for (i = 0; mflash_gpio[i] ; i++) {
if (*str)
mflash_bank->rst_pin.port[0] = (uint16_t)tolower(str[0]);
mflash_bank->target = target;
for (i = 0; mflash_gpio[i] ; i++) {
- if (! strcmp(mflash_gpio[i]->name, args[0])) {
+ if (! strcmp(mflash_gpio[i]->name, CMD_ARGV[0])) {
mflash_bank->gpio_drv = mflash_gpio[i];
}
}
if (! mflash_bank->gpio_drv) {
mflash_bank->gpio_drv = mflash_gpio[i];
}
}
if (! mflash_bank->gpio_drv) {
- LOG_ERROR("%s is unsupported soc", args[0]);
+ LOG_ERROR("%s is unsupported soc", CMD_ARGV[0]);
return ERROR_MG_UNSUPPORTED_SOC;
}
return ERROR_MG_UNSUPPORTED_SOC;
}
nand->controller_priv = mx3_nf_info;
nand->controller_priv = mx3_nf_info;
- mx3_nf_info->target = get_target (args[1]);
+ mx3_nf_info->target = get_target (CMD_ARGV[1]);
if (mx3_nf_info->target == NULL)
{
if (mx3_nf_info->target == NULL)
{
- LOG_ERROR ("target '%s' not defined", args[1]);
+ LOG_ERROR ("target '%s' not defined", CMD_ARGV[1]);
return ERROR_FAIL;
}
if (CMD_ARGC < 3)
return ERROR_FAIL;
}
if (CMD_ARGC < 3)
- hwecc_needed = strcmp (args[2], "hwecc");
+ hwecc_needed = strcmp (CMD_ARGV[2], "hwecc");
if (hwecc_needed == 0)
{
mx3_nf_info->flags.hw_ecc_enabled = 1;
if (hwecc_needed == 0)
{
mx3_nf_info->flags.hw_ecc_enabled = 1;
{
struct nand_device *p, *c;
{
struct nand_device *p, *c;
- if (strcmp(args[0], nand_flash_controllers[i]->name) == 0)
+ 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)
{
{
/* register flash specific commands */
if ((retval = nand_flash_controllers[i]->register_commands(cmd_ctx)) != ERROR_OK)
{
- LOG_ERROR("couldn't register '%s' commands", args[0]);
+ LOG_ERROR("couldn't register '%s' commands", CMD_ARGV[0]);
/* no valid NAND controller was found (i.e. the configuration option,
* didn't match one of the compiled-in controllers)
*/
/* no valid NAND controller was found (i.e. the configuration option,
* didn't match one of the compiled-in controllers)
*/
- LOG_ERROR("No valid NAND flash controller found (%s)", args[0]);
+ LOG_ERROR("No valid NAND flash controller found (%s)", CMD_ARGV[0]);
LOG_ERROR("compiled-in NAND flash controllers:");
for (i = 0; nand_flash_controllers[i]; i++)
{
LOG_ERROR("compiled-in NAND flash controllers:");
for (i = 0; nand_flash_controllers[i]; i++)
{
COMMAND_HELPER(nand_command_get_device_by_num, unsigned name_index,
struct nand_device **nand)
{
COMMAND_HELPER(nand_command_get_device_by_num, unsigned name_index,
struct nand_device **nand)
{
- const char *str = args[name_index];
+ const char *str = CMD_ARGV[name_index];
unsigned num;
COMMAND_PARSE_NUMBER(uint, str, num);
*nand = get_nand_device_by_num(num);
unsigned num;
COMMAND_PARSE_NUMBER(uint, str, num);
*nand = get_nand_device_by_num(num);
last = INT32_MAX;
break;
case 2:
last = INT32_MAX;
break;
case 2:
- COMMAND_PARSE_NUMBER(int, args[1], i);
+ COMMAND_PARSE_NUMBER(int, CMD_ARGV[1], i);
first = last = i;
i = 0;
break;
case 3:
first = last = i;
i = 0;
break;
case 3:
- COMMAND_PARSE_NUMBER(int, args[1], first);
- COMMAND_PARSE_NUMBER(int, args[2], last);
+ COMMAND_PARSE_NUMBER(int, CMD_ARGV[1], first);
+ COMMAND_PARSE_NUMBER(int, CMD_ARGV[2], last);
break;
}
if (NULL == p->device)
{
break;
}
if (NULL == p->device)
{
- command_print(cmd_ctx, "#%s: not probed", args[0]);
+ command_print(cmd_ctx, "#%s: not probed", CMD_ARGV[0]);
if (CMD_ARGC == 3) {
unsigned long size = p->erase_size * p->num_blocks;
if (CMD_ARGC == 3) {
unsigned long size = p->erase_size * p->num_blocks;
- COMMAND_PARSE_NUMBER(ulong, args[1], offset);
+ COMMAND_PARSE_NUMBER(ulong, CMD_ARGV[1], offset);
if ((offset % p->erase_size) != 0 || offset >= size)
return ERROR_INVALID_ARGUMENTS;
if ((offset % p->erase_size) != 0 || offset >= size)
return ERROR_INVALID_ARGUMENTS;
- COMMAND_PARSE_NUMBER(ulong, args[2], length);
+ COMMAND_PARSE_NUMBER(ulong, CMD_ARGV[2], length);
if ((length == 0) || (length % p->erase_size) != 0
|| (length + offset) > size)
return ERROR_INVALID_ARGUMENTS;
if ((length == 0) || (length % p->erase_size) != 0
|| (length + offset) > size)
return ERROR_INVALID_ARGUMENTS;
command_print(cmd_ctx, "erased blocks %lu to %lu "
"on NAND flash device #%s '%s'",
offset, offset + length,
command_print(cmd_ctx, "erased blocks %lu to %lu "
"on NAND flash device #%s '%s'",
offset, offset + length,
- args[0], p->device->name);
+ CMD_ARGV[0], p->device->name);
}
else if (retval == ERROR_NAND_OPERATION_FAILED)
{
}
else if (retval == ERROR_NAND_OPERATION_FAILED)
{
unsigned long offset;
unsigned long length;
unsigned long offset;
unsigned long length;
- COMMAND_PARSE_NUMBER(ulong, args[1], offset);
+ COMMAND_PARSE_NUMBER(ulong, CMD_ARGV[1], offset);
if (offset % p->erase_size)
return ERROR_INVALID_ARGUMENTS;
offset /= p->erase_size;
if (offset % p->erase_size)
return ERROR_INVALID_ARGUMENTS;
offset /= p->erase_size;
- COMMAND_PARSE_NUMBER(ulong, args[2], length);
+ COMMAND_PARSE_NUMBER(ulong, CMD_ARGV[2], length);
if (length % p->erase_size)
return ERROR_INVALID_ARGUMENTS;
if (length % p->erase_size)
return ERROR_INVALID_ARGUMENTS;
if (NULL == nand->device)
{
if (NULL == nand->device)
{
- command_print(cmd_ctx, "#%s: not probed", args[0]);
+ command_print(cmd_ctx, "#%s: not probed", CMD_ARGV[0]);
- COMMAND_PARSE_NUMBER(u32, args[2], state->address);
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[2], state->address);
- COMMAND_PARSE_NUMBER(u32, args[2], state->size);
+ 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");
if (state->size % nand->page_size)
{
command_print(cmd_ctx, "only page-aligned sizes are supported");
{
for (unsigned i = minargs; i < CMD_ARGC; i++)
{
{
for (unsigned i = minargs; i < CMD_ARGC; i++)
{
- if (!strcmp(args[i], "oob_raw"))
+ if (!strcmp(CMD_ARGV[i], "oob_raw"))
state->oob_format |= NAND_OOB_RAW;
state->oob_format |= NAND_OOB_RAW;
- else if (!strcmp(args[i], "oob_only"))
+ else if (!strcmp(CMD_ARGV[i], "oob_only"))
state->oob_format |= NAND_OOB_RAW | NAND_OOB_ONLY;
state->oob_format |= NAND_OOB_RAW | NAND_OOB_ONLY;
- else if (sw_ecc && !strcmp(args[i], "oob_softecc"))
+ else if (sw_ecc && !strcmp(CMD_ARGV[i], "oob_softecc"))
state->oob_format |= NAND_OOB_SW_ECC;
state->oob_format |= NAND_OOB_SW_ECC;
- else if (sw_ecc && !strcmp(args[i], "oob_softecc_kw"))
+ else if (sw_ecc && !strcmp(CMD_ARGV[i], "oob_softecc_kw"))
state->oob_format |= NAND_OOB_SW_ECC_KW;
else
{
state->oob_format |= NAND_OOB_SW_ECC_KW;
else
{
- command_print(cmd_ctx, "unknown option: %s", args[i]);
+ command_print(cmd_ctx, "unknown option: %s", CMD_ARGV[i]);
return ERROR_COMMAND_SYNTAX_ERROR;
}
}
}
return ERROR_COMMAND_SYNTAX_ERROR;
}
}
}
- retval = nand_fileio_start(cmd_ctx, nand, args[1], filemode, state);
+ retval = nand_fileio_start(cmd_ctx, nand, CMD_ARGV[1], filemode, state);
if (ERROR_OK != retval)
return retval;
if (ERROR_OK != retval)
return retval;
{
command_print(cmd_ctx, "failed writing file %s "
"to NAND flash %s at offset 0x%8.8" PRIx32,
{
command_print(cmd_ctx, "failed writing file %s "
"to NAND flash %s at offset 0x%8.8" PRIx32,
- args[1], args[0], s.address);
+ CMD_ARGV[1], CMD_ARGV[0], s.address);
return nand_fileio_cleanup(&s);
}
s.address += s.page_size;
return nand_fileio_cleanup(&s);
}
s.address += s.page_size;
{
command_print(cmd_ctx, "wrote file %s to NAND flash %s up to "
"offset 0x%8.8" PRIx32 " in %fs (%0.3f kb/s)",
{
command_print(cmd_ctx, "wrote file %s to NAND flash %s up to "
"offset 0x%8.8" PRIx32 " in %fs (%0.3f kb/s)",
- args[1], args[0], s.address, duration_elapsed(&s.bench),
+ CMD_ARGV[1], CMD_ARGV[0], s.address, duration_elapsed(&s.bench),
duration_kbps(&s.bench, total_bytes));
}
return ERROR_OK;
duration_kbps(&s.bench, total_bytes));
}
return ERROR_OK;
{
command_print(cmd_ctx, "verified file %s in NAND flash %s "
"up to offset 0x%8.8" PRIx32 " in %fs (%0.3f kb/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)",
- args[1], args[0], dev.address, duration_elapsed(&file.bench),
+ CMD_ARGV[1], CMD_ARGV[0], dev.address, duration_elapsed(&file.bench),
duration_kbps(&file.bench, dev.size));
}
duration_kbps(&file.bench, dev.size));
}
- command_print(cmd_ctx, "#%s: not probed", args[0]);
+ command_print(cmd_ctx, "#%s: not probed", CMD_ARGV[0]);
return ERROR_OK;
}
if (CMD_ARGC == 2)
{
return ERROR_OK;
}
if (CMD_ARGC == 2)
{
- if (strcmp("enable", args[1]) == 0)
+ if (strcmp("enable", CMD_ARGV[1]) == 0)
- else if (strcmp("disable", args[1]) == 0)
+ else if (strcmp("disable", CMD_ARGV[1]) == 0)
p->use_raw = 0;
else
return ERROR_COMMAND_SYNTAX_ERROR;
p->use_raw = 0;
else
return ERROR_COMMAND_SYNTAX_ERROR;
}
nand->controller_priv = hw;
}
nand->controller_priv = hw;
- hw->target = get_target(args[1]);
+ hw->target = get_target(CMD_ARGV[1]);
- LOG_ERROR("target '%s' not defined", args[1]);
+ LOG_ERROR("target '%s' not defined", CMD_ARGV[1]);
free(hw);
return ERROR_NAND_DEVICE_INVALID;
}
free(hw);
return ERROR_NAND_DEVICE_INVALID;
}
- COMMAND_PARSE_NUMBER(u32, args[2], base);
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[2], base);
- COMMAND_PARSE_NUMBER(u32, args[0], address);
- COMMAND_PARSE_NUMBER(u32, args[1], value);
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], address);
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[1], value);
struct flash_bank *bank;
int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 2, &bank);
struct flash_bank *bank;
int retval = CALL_COMMAND_HANDLER(flash_command_get_bank_by_num, 2, &bank);
if (address < bank->base || address >= (bank->base + bank->size))
{
if (address < bank->base || address >= (bank->base + bank->size))
{
- command_print(cmd_ctx, "flash address '%s' is out of bounds", args[0]);
+ command_print(cmd_ctx, "flash address '%s' is out of bounds", CMD_ARGV[0]);
nand->controller_priv = s3c24xx_info;
nand->controller_priv = s3c24xx_info;
- s3c24xx_info->target = get_target(args[1]);
+ s3c24xx_info->target = get_target(CMD_ARGV[1]);
if (s3c24xx_info->target == NULL) {
if (s3c24xx_info->target == NULL) {
- LOG_ERROR("target '%s' not defined", args[1]);
+ LOG_ERROR("target '%s' not defined", CMD_ARGV[1]);
return ERROR_COMMAND_SYNTAX_ERROR;
}
return ERROR_COMMAND_SYNTAX_ERROR;
}
return ERROR_TARGET_NOT_HALTED;
}
return ERROR_TARGET_NOT_HALTED;
}
- if (strcmp(args[1], "SWWDG") == 0)
+ if (strcmp(CMD_ARGV[1], "SWWDG") == 0)
{
optionbyte |= (1 << 0);
}
{
optionbyte |= (1 << 0);
}
optionbyte &= ~(1 << 0);
}
optionbyte &= ~(1 << 0);
}
- if (strcmp(args[2], "NORSTSTNDBY") == 0)
+ if (strcmp(CMD_ARGV[2], "NORSTSTNDBY") == 0)
{
optionbyte |= (1 << 1);
}
{
optionbyte |= (1 << 1);
}
optionbyte &= ~(1 << 1);
}
optionbyte &= ~(1 << 1);
}
- if (strcmp(args[3], "NORSTSTOP") == 0)
+ if (strcmp(CMD_ARGV[3], "NORSTSTOP") == 0)
{
optionbyte |= (1 << 2);
}
{
optionbyte |= (1 << 2);
}
str7x_info->busy_bits = (FLASH_LOCK | FLASH_BSYA1 | FLASH_BSYA0);
str7x_info->disable_bit = (1 << 1);
str7x_info->busy_bits = (FLASH_LOCK | FLASH_BSYA1 | FLASH_BSYA0);
str7x_info->disable_bit = (1 << 1);
- if (strcmp(args[6], "STR71x") == 0)
+ if (strcmp(CMD_ARGV[6], "STR71x") == 0)
{
str7x_info->register_base = 0x40100000;
}
{
str7x_info->register_base = 0x40100000;
}
- else if (strcmp(args[6], "STR73x") == 0)
+ else if (strcmp(CMD_ARGV[6], "STR73x") == 0)
{
str7x_info->register_base = 0x80100000;
str7x_info->busy_bits = (FLASH_LOCK | FLASH_BSYA0);
}
{
str7x_info->register_base = 0x80100000;
str7x_info->busy_bits = (FLASH_LOCK | FLASH_BSYA0);
}
- else if (strcmp(args[6], "STR75x") == 0)
+ else if (strcmp(CMD_ARGV[6], "STR75x") == 0)
{
str7x_info->register_base = 0x20100000;
str7x_info->disable_bit = (1 << 0);
}
else
{
{
str7x_info->register_base = 0x20100000;
str7x_info->disable_bit = (1 << 0);
}
else
{
- LOG_ERROR("unknown STR7x variant: '%s'", args[6]);
+ LOG_ERROR("unknown STR7x variant: '%s'", CMD_ARGV[6]);
free(str7x_info);
return ERROR_FLASH_BANK_INVALID;
}
free(str7x_info);
return ERROR_FLASH_BANK_INVALID;
}
return retval;
uint32_t bbsr, nbbsr, bbadr, nbbadr;
return retval;
uint32_t bbsr, nbbsr, bbadr, nbbadr;
- COMMAND_PARSE_NUMBER(u32, args[1], bbsr);
- COMMAND_PARSE_NUMBER(u32, args[2], nbbsr);
- COMMAND_PARSE_NUMBER(u32, args[3], bbadr);
- COMMAND_PARSE_NUMBER(u32, args[4], nbbadr);
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[1], bbsr);
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[2], nbbsr);
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[3], bbadr);
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[4], nbbadr);
str9x_info = bank->driver_priv;
str9x_info = bank->driver_priv;
str9xpec_info = bank->driver_priv;
str9xpec_info = bank->driver_priv;
- if (strcmp(args[1], "bank1") == 0)
+ if (strcmp(CMD_ARGV[1], "bank1") == 0)
{
buf_set_u32(str9xpec_info->options, STR9XPEC_OPT_CSMAPBIT, 1, 1);
}
{
buf_set_u32(str9xpec_info->options, STR9XPEC_OPT_CSMAPBIT, 1, 1);
}
str9xpec_info = bank->driver_priv;
str9xpec_info = bank->driver_priv;
- if (strcmp(args[1], "2.7v") == 0)
+ if (strcmp(CMD_ARGV[1], "2.7v") == 0)
{
buf_set_u32(str9xpec_info->options, STR9XPEC_OPT_LVDTHRESBIT, 1, 1);
}
{
buf_set_u32(str9xpec_info->options, STR9XPEC_OPT_LVDTHRESBIT, 1, 1);
}
str9xpec_info = bank->driver_priv;
str9xpec_info = bank->driver_priv;
- if (strcmp(args[1], "vdd_vddq") == 0)
+ if (strcmp(CMD_ARGV[1], "vdd_vddq") == 0)
{
buf_set_u32(str9xpec_info->options, STR9XPEC_OPT_LVDSELBIT, 1, 1);
}
{
buf_set_u32(str9xpec_info->options, STR9XPEC_OPT_LVDSELBIT, 1, 1);
}
str9xpec_info = bank->driver_priv;
str9xpec_info = bank->driver_priv;
- if (strcmp(args[1], "vdd_vddq") == 0)
+ if (strcmp(CMD_ARGV[1], "vdd_vddq") == 0)
{
buf_set_u32(str9xpec_info->options, STR9XPEC_OPT_LVDWARNBIT, 1, 1);
}
{
buf_set_u32(str9xpec_info->options, STR9XPEC_OPT_LVDWARNBIT, 1, 1);
}
for (i = 0; i < 4; i++)
{
for (i = 0; i < 4; i++)
{
- int start = (0 == strncmp(args[i], "0x", 2)) ? 2 : 0;
+ int start = (0 == strncmp(CMD_ARGV[i], "0x", 2)) ? 2 : 0;
- if (1 != sscanf(&args[i][start], "%" SCNx32 "", &flashKeys[i]))
+ if (1 != sscanf(&CMD_ARGV[i][start], "%" SCNx32 "", &flashKeys[i]))
- command_print(cmd_ctx, "could not process flash key %s", args[i]);
- LOG_ERROR("could not process flash key %s", args[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;
}
}
return ERROR_INVALID_ARGUMENTS;
}
}
}
else if (CMD_ARGC == 1)
{
}
else if (CMD_ARGC == 1)
{
- sscanf(args[0], "%d", &oscMHz);
+ sscanf(CMD_ARGV[0], "%d", &oscMHz);
}
else if (CMD_ARGC == 1)
{
}
else if (CMD_ARGC == 1)
{
- sscanf(args[0], "%d", &plldis);
+ sscanf(CMD_ARGV[0], "%d", &plldis);
plldis = plldis ? 1 : 0;
}
plldis = plldis ? 1 : 0;
}
if (1 == CMD_ARGC)
{
*sep = " ";
if (1 == CMD_ARGC)
{
*sep = " ";
}
else
*sep = *name = "";
}
else
*sep = *name = "";
log_add_callback(tcl_output, tclOutput);
log_add_callback(tcl_output, tclOutput);
- // turn words[0] into args[-1] with this cast
+ // turn words[0] into CMD_ARGV[-1] with this cast
retval = run_command(context, c, (const char **)words + 1, nwords);
log_remove_callback(tcl_output, tclOutput);
retval = run_command(context, c, (const char **)words + 1, nwords);
log_remove_callback(tcl_output, tclOutput);
bool busy = false;
if (CMD_ARGC == 2)
{
bool busy = false;
if (CMD_ARGC == 2)
{
- if (strcmp(args[1], "busy") == 0)
+ if (strcmp(CMD_ARGV[1], "busy") == 0)
busy = true;
else
return ERROR_COMMAND_SYNTAX_ERROR;
busy = true;
else
return ERROR_COMMAND_SYNTAX_ERROR;
return ERROR_COMMAND_SYNTAX_ERROR;
unsigned long duration = 0;
return ERROR_COMMAND_SYNTAX_ERROR;
unsigned long duration = 0;
- int retval = parse_ulong(args[0], &duration);
+ int retval = parse_ulong(CMD_ARGV[0], &duration);
if (ERROR_OK != retval)
return retval;
if (ERROR_OK != retval)
return retval;
if (CMD_ARGC != 1)
return ERROR_COMMAND_SYNTAX_ERROR;
if (CMD_ARGC != 1)
return ERROR_COMMAND_SYNTAX_ERROR;
- fast_and_dangerous = strcmp("enable", args[0]) == 0;
+ fast_and_dangerous = strcmp("enable", CMD_ARGV[0]) == 0;
return ERROR_INVALID_ARGUMENTS;
}
return ERROR_INVALID_ARGUMENTS;
}
- if (unlink(args[0]) != 0)
+ if (unlink(CMD_ARGV[0]) != 0)
{
command_print(cmd_ctx, "failed: %d", errno);
}
{
command_print(cmd_ctx, "failed: %d", errno);
}
- int retval = loadFile(args[0], &data, &len);
+ int retval = loadFile(CMD_ARGV[0], &data, &len);
if (retval == ERROR_OK)
{
command_print(cmd_ctx, "%s", (char *)data);
if (retval == ERROR_OK)
{
command_print(cmd_ctx, "%s", (char *)data);
- command_print(cmd_ctx, "%s not found %d", args[0], retval);
+ command_print(cmd_ctx, "%s not found %d", CMD_ARGV[0], retval);
}
FILE *config_file = NULL;
}
FILE *config_file = NULL;
- config_file = fopen(args[0], "w");
+ config_file = fopen(CMD_ARGV[0], "w");
if (config_file != NULL)
fclose(config_file);
if (config_file != NULL)
fclose(config_file);
int retval = ERROR_FAIL;
FILE *config_file = NULL;
int retval = ERROR_FAIL;
FILE *config_file = NULL;
- config_file = fopen(args[0], "a");
+ config_file = fopen(CMD_ARGV[0], "a");
if (config_file != NULL)
{
fseek(config_file, 0, SEEK_END);
if (config_file != NULL)
{
fseek(config_file, 0, SEEK_END);
unsigned i;
for (i = 1; i < CMD_ARGC; i++)
{
unsigned i;
for (i = 1; i < CMD_ARGC; i++)
{
- if (fwrite(args[i], 1, strlen(args[i]), config_file) != strlen(args[i]))
+ if (fwrite(CMD_ARGV[i], 1, strlen(CMD_ARGV[i]), config_file) != strlen(CMD_ARGV[i]))
break;
if (i != CMD_ARGC - 1)
{
break;
if (i != CMD_ARGC - 1)
{
- int retval = loadFile(args[0], &data, &len);
+ int retval = loadFile(CMD_ARGV[0], &data, &len);
if (retval != ERROR_OK)
return retval;
if (retval != ERROR_OK)
return retval;
- FILE *f = fopen(args[1], "wb");
+ FILE *f = fopen(CMD_ARGV[1], "wb");
if (f == NULL)
retval = ERROR_INVALID_ARGUMENTS;
if (f == NULL)
retval = ERROR_INVALID_ARGUMENTS;
if (retval == ERROR_OK)
{
if (retval == ERROR_OK)
{
- command_print(cmd_ctx, "Copied %s to %s", args[0], args[1]);
+ command_print(cmd_ctx, "Copied %s to %s", CMD_ARGV[0], CMD_ARGV[1]);
} else
{
command_print(cmd_ctx, "Failed: %d", retval);
} else
{
command_print(cmd_ctx, "Failed: %d", retval);
fclose(f);
if (retval != ERROR_OK)
fclose(f);
if (retval != ERROR_OK)
if (CMD_ARGC == 1)
{
unsigned new_level;
if (CMD_ARGC == 1)
{
unsigned new_level;
- COMMAND_PARSE_NUMBER(uint, args[0], new_level);
+ COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], new_level);
debug_level = MIN(new_level, LOG_LVL_DEBUG);
}
else if (CMD_ARGC > 1)
debug_level = MIN(new_level, LOG_LVL_DEBUG);
}
else if (CMD_ARGC > 1)
- FILE* file = fopen(args[0], "w");
+ FILE* file = fopen(CMD_ARGV[0], "w");
if (amt_jtagaccel_port == 0)
{
uint16_t port;
if (amt_jtagaccel_port == 0)
{
uint16_t port;
- COMMAND_PARSE_NUMBER(u16, args[0], port);
+ COMMAND_PARSE_NUMBER(u16, CMD_ARGV[0], port);
amt_jtagaccel_port = port;
}
else
amt_jtagaccel_port = port;
}
else
- if (strcmp(args[0], "enabled") == 0)
+ if (strcmp(CMD_ARGV[0], "enabled") == 0)
-static int at91rm9200_handle_device_command(struct command_context *cmd_ctx, char *cmd, char **args, int argc)
+static int at91rm9200_handle_device_command(struct command_context *cmd_ctx, char *cmd, char **CMD_ARGV, int argc)
{
if (CMD_ARGC == 0)
return ERROR_OK;
{
if (CMD_ARGC == 0)
return ERROR_OK;
/* only if the device name wasn't overwritten by cmdline */
if (at91rm9200_device == 0)
{
/* only if the device name wasn't overwritten by cmdline */
if (at91rm9200_device == 0)
{
- at91rm9200_device = malloc(strlen(args[0]) + sizeof(char));
- strcpy(at91rm9200_device, args[0]);
+ at91rm9200_device = malloc(strlen(CMD_ARGV[0]) + sizeof(char));
+ strcpy(at91rm9200_device, CMD_ARGV[0]);
char buf[200];
if (CMD_ARGC == 1)
{
char buf[200];
if (CMD_ARGC == 1)
{
- ft2232_device_desc = strdup(args[0]);
+ ft2232_device_desc = strdup(CMD_ARGV[0]);
cp = strchr(ft2232_device_desc, 0);
/* under Win32, the FTD2XX driver appends an "A" to the end
* of the description, this examines the given desc
cp = strchr(ft2232_device_desc, 0);
/* under Win32, the FTD2XX driver appends an "A" to the end
* of the description, this examines the given desc
- ft2232_serial = strdup(args[0]);
+ ft2232_serial = strdup(CMD_ARGV[0]);
if (CMD_ARGC == 0)
return ERROR_OK;
if (CMD_ARGC == 0)
return ERROR_OK;
- ft2232_layout = malloc(strlen(args[0]) + 1);
- strcpy(ft2232_layout, args[0]);
+ ft2232_layout = malloc(strlen(CMD_ARGV[0]) + 1);
+ strcpy(ft2232_layout, CMD_ARGV[0]);
unsigned i;
for (i = 0; i < CMD_ARGC; i += 2)
{
unsigned i;
for (i = 0; i < CMD_ARGC; i += 2)
{
- COMMAND_PARSE_NUMBER(u16, args[i], ft2232_vid[i >> 1]);
- COMMAND_PARSE_NUMBER(u16, args[i + 1], ft2232_pid[i >> 1]);
+ COMMAND_PARSE_NUMBER(u16, CMD_ARGV[i], ft2232_vid[i >> 1]);
+ COMMAND_PARSE_NUMBER(u16, CMD_ARGV[i + 1], ft2232_pid[i >> 1]);
- ft2232_latency = atoi(args[0]);
+ ft2232_latency = atoi(CMD_ARGV[0]);
/* only if the port wasn't overwritten by cmdline */
if (gw16012_port == 0)
{
/* only if the port wasn't overwritten by cmdline */
if (gw16012_port == 0)
{
- COMMAND_PARSE_NUMBER(u16, args[0], gw16012_port);
+ COMMAND_PARSE_NUMBER(u16, CMD_ARGV[0], gw16012_port);
command_print(cmd_ctx, "jlink hw jtag %i", jlink_hw_jtag_version);
break;
case 1: {
command_print(cmd_ctx, "jlink hw jtag %i", jlink_hw_jtag_version);
break;
case 1: {
- int request_version = atoi(args[0]);
+ int request_version = atoi(CMD_ARGV[0]);
switch (request_version) {
case 2: case 3:
jlink_hw_jtag_version = request_version;
switch (request_version) {
case 2: case 3:
jlink_hw_jtag_version = request_version;
/* only if the port wasn't overwritten by cmdline */
if (parport_port == 0)
{
/* only if the port wasn't overwritten by cmdline */
if (parport_port == 0)
{
- COMMAND_PARSE_NUMBER(u16, args[0], parport_port);
+ COMMAND_PARSE_NUMBER(u16, CMD_ARGV[0], parport_port);
/* only if the cable name wasn't overwritten by cmdline */
if (parport_cable == 0)
{
/* only if the cable name wasn't overwritten by cmdline */
if (parport_cable == 0)
{
- parport_cable = malloc(strlen(args[0]) + sizeof(char));
- strcpy(parport_cable, args[0]);
+ parport_cable = malloc(strlen(CMD_ARGV[0]) + sizeof(char));
+ strcpy(parport_cable, CMD_ARGV[0]);
- if (strcmp(args[0], "on") == 0)
+ if (strcmp(CMD_ARGV[0], "on") == 0)
- else if (strcmp(args[0], "off") == 0)
+ else if (strcmp(CMD_ARGV[0], "off") == 0)
parport_exit = 0;
return ERROR_OK;
parport_exit = 0;
return ERROR_OK;
{
if (CMD_ARGC == 1) {
uint32_t ns;
{
if (CMD_ARGC == 1) {
uint32_t ns;
- int retval = parse_u32(args[0], &ns);
+ int retval = parse_u32(CMD_ARGV[0], &ns);
if (ERROR_OK != retval)
return retval;
if (ERROR_OK != retval)
return retval;
{
if (presto_serial)
free(presto_serial);
{
if (presto_serial)
free(presto_serial);
- presto_serial = strdup(args[0]);
+ presto_serial = strdup(CMD_ARGV[0]);
}
/* interface name is a mandatory argument */
}
/* interface name is a mandatory argument */
- if (CMD_ARGC != 1 || args[0][0] == '\0')
+ if (CMD_ARGC != 1 || CMD_ARGV[0][0] == '\0')
return ERROR_COMMAND_SYNTAX_ERROR;
for (unsigned i = 0; NULL != jtag_interfaces[i]; i++)
{
return ERROR_COMMAND_SYNTAX_ERROR;
for (unsigned i = 0; NULL != jtag_interfaces[i]; i++)
{
- if (strcmp(args[0], jtag_interfaces[i]->name) != 0)
+ if (strcmp(CMD_ARGV[0], jtag_interfaces[i]->name) != 0)
continue;
int retval = jtag_interfaces[i]->register_commands(cmd_ctx);
continue;
int retval = jtag_interfaces[i]->register_commands(cmd_ctx);
/* no valid interface was found (i.e. the configuration option,
* didn't match one of the compiled-in interfaces
*/
/* no valid interface was found (i.e. the configuration option,
* didn't match one of the compiled-in interfaces
*/
- LOG_ERROR("The specified JTAG interface was not found (%s)", args[0]);
+ LOG_ERROR("The specified JTAG interface was not found (%s)", CMD_ARGV[0]);
CALL_COMMAND_HANDLER(handle_interface_list_command);
return ERROR_JTAG_INVALID_INTERFACE;
}
CALL_COMMAND_HANDLER(handle_interface_list_command);
return ERROR_JTAG_INVALID_INTERFACE;
}
* Here we don't care about the order, and only change values
* which have been explicitly specified.
*/
* Here we don't care about the order, and only change values
* which have been explicitly specified.
*/
- for (; CMD_ARGC; CMD_ARGC--, args++) {
+ for (; CMD_ARGC; CMD_ARGC--, CMD_ARGV++) {
int tmp = 0;
int m;
/* gating */
m = RESET_SRST_NO_GATING;
int tmp = 0;
int m;
/* gating */
m = RESET_SRST_NO_GATING;
- if (strcmp(*args, "srst_gates_jtag") == 0)
+ if (strcmp(*CMD_ARGV, "srst_gates_jtag") == 0)
/* default: don't use JTAG while SRST asserted */;
/* default: don't use JTAG while SRST asserted */;
- else if (strcmp(*args, "srst_nogate") == 0)
+ else if (strcmp(*CMD_ARGV, "srst_nogate") == 0)
tmp = RESET_SRST_NO_GATING;
else
m = 0;
if (mask & m) {
LOG_ERROR("extra reset_config %s spec (%s)",
tmp = RESET_SRST_NO_GATING;
else
m = 0;
if (mask & m) {
LOG_ERROR("extra reset_config %s spec (%s)",
return ERROR_INVALID_ARGUMENTS;
}
if (m)
return ERROR_INVALID_ARGUMENTS;
}
if (m)
/* signals */
m = RESET_HAS_TRST | RESET_HAS_SRST;
/* signals */
m = RESET_HAS_TRST | RESET_HAS_SRST;
- if (strcmp(*args, "none") == 0)
+ if (strcmp(*CMD_ARGV, "none") == 0)
- else if (strcmp(*args, "trst_only") == 0)
+ else if (strcmp(*CMD_ARGV, "trst_only") == 0)
- else if (strcmp(*args, "srst_only") == 0)
+ else if (strcmp(*CMD_ARGV, "srst_only") == 0)
- else if (strcmp(*args, "trst_and_srst") == 0)
+ else if (strcmp(*CMD_ARGV, "trst_and_srst") == 0)
tmp = RESET_HAS_TRST | RESET_HAS_SRST;
else
m = 0;
if (mask & m) {
LOG_ERROR("extra reset_config %s spec (%s)",
tmp = RESET_HAS_TRST | RESET_HAS_SRST;
else
m = 0;
if (mask & m) {
LOG_ERROR("extra reset_config %s spec (%s)",
return ERROR_INVALID_ARGUMENTS;
}
if (m)
return ERROR_INVALID_ARGUMENTS;
}
if (m)
/* combination (options for broken wiring) */
m = RESET_SRST_PULLS_TRST | RESET_TRST_PULLS_SRST;
/* combination (options for broken wiring) */
m = RESET_SRST_PULLS_TRST | RESET_TRST_PULLS_SRST;
- if (strcmp(*args, "separate") == 0)
+ if (strcmp(*CMD_ARGV, "separate") == 0)
/* separate reset lines - default */;
/* separate reset lines - default */;
- else if (strcmp(*args, "srst_pulls_trst") == 0)
+ else if (strcmp(*CMD_ARGV, "srst_pulls_trst") == 0)
tmp |= RESET_SRST_PULLS_TRST;
tmp |= RESET_SRST_PULLS_TRST;
- else if (strcmp(*args, "trst_pulls_srst") == 0)
+ else if (strcmp(*CMD_ARGV, "trst_pulls_srst") == 0)
tmp |= RESET_TRST_PULLS_SRST;
tmp |= RESET_TRST_PULLS_SRST;
- else if (strcmp(*args, "combined") == 0)
+ else if (strcmp(*CMD_ARGV, "combined") == 0)
tmp |= RESET_SRST_PULLS_TRST | RESET_TRST_PULLS_SRST;
else
m = 0;
if (mask & m) {
LOG_ERROR("extra reset_config %s spec (%s)",
tmp |= RESET_SRST_PULLS_TRST | RESET_TRST_PULLS_SRST;
else
m = 0;
if (mask & m) {
LOG_ERROR("extra reset_config %s spec (%s)",
+ "combination", *CMD_ARGV);
return ERROR_INVALID_ARGUMENTS;
}
if (m)
return ERROR_INVALID_ARGUMENTS;
}
if (m)
/* trst_type (NOP without HAS_TRST) */
m = RESET_TRST_OPEN_DRAIN;
/* trst_type (NOP without HAS_TRST) */
m = RESET_TRST_OPEN_DRAIN;
- if (strcmp(*args, "trst_open_drain") == 0)
+ if (strcmp(*CMD_ARGV, "trst_open_drain") == 0)
tmp |= RESET_TRST_OPEN_DRAIN;
tmp |= RESET_TRST_OPEN_DRAIN;
- else if (strcmp(*args, "trst_push_pull") == 0)
+ else if (strcmp(*CMD_ARGV, "trst_push_pull") == 0)
/* push/pull from adapter - default */;
else
m = 0;
if (mask & m) {
LOG_ERROR("extra reset_config %s spec (%s)",
/* push/pull from adapter - default */;
else
m = 0;
if (mask & m) {
LOG_ERROR("extra reset_config %s spec (%s)",
+ "trst_type", *CMD_ARGV);
return ERROR_INVALID_ARGUMENTS;
}
if (m)
return ERROR_INVALID_ARGUMENTS;
}
if (m)
/* srst_type (NOP without HAS_SRST) */
m |= RESET_SRST_PUSH_PULL;
/* srst_type (NOP without HAS_SRST) */
m |= RESET_SRST_PUSH_PULL;
- if (strcmp(*args, "srst_push_pull") == 0)
+ if (strcmp(*CMD_ARGV, "srst_push_pull") == 0)
tmp |= RESET_SRST_PUSH_PULL;
tmp |= RESET_SRST_PUSH_PULL;
- else if (strcmp(*args, "srst_open_drain") == 0)
+ else if (strcmp(*CMD_ARGV, "srst_open_drain") == 0)
/* open drain from adapter - default */;
else
m = 0;
if (mask & m) {
LOG_ERROR("extra reset_config %s spec (%s)",
/* open drain from adapter - default */;
else
m = 0;
if (mask & m) {
LOG_ERROR("extra reset_config %s spec (%s)",
+ "srst_type", *CMD_ARGV);
return ERROR_INVALID_ARGUMENTS;
}
if (m)
goto next;
/* caller provided nonsense; fail */
return ERROR_INVALID_ARGUMENTS;
}
if (m)
goto next;
/* caller provided nonsense; fail */
- LOG_ERROR("unknown reset_config flag (%s)", *args);
+ LOG_ERROR("unknown reset_config flag (%s)", *CMD_ARGV);
return ERROR_INVALID_ARGUMENTS;
next:
return ERROR_INVALID_ARGUMENTS;
next:
if (CMD_ARGC == 1)
{
unsigned delay;
if (CMD_ARGC == 1)
{
unsigned delay;
- COMMAND_PARSE_NUMBER(uint, args[0], delay);
+ COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], delay);
jtag_set_nsrst_delay(delay);
}
jtag_set_nsrst_delay(delay);
}
if (CMD_ARGC == 1)
{
unsigned delay;
if (CMD_ARGC == 1)
{
unsigned delay;
- COMMAND_PARSE_NUMBER(uint, args[0], delay);
+ COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], delay);
jtag_set_ntrst_delay(delay);
}
jtag_set_ntrst_delay(delay);
}
if (CMD_ARGC == 1)
{
unsigned delay;
if (CMD_ARGC == 1)
{
unsigned delay;
- COMMAND_PARSE_NUMBER(uint, args[0], delay);
+ COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], delay);
jtag_set_nsrst_assert_width(delay);
}
jtag_set_nsrst_assert_width(delay);
}
if (CMD_ARGC == 1)
{
unsigned delay;
if (CMD_ARGC == 1)
{
unsigned delay;
- COMMAND_PARSE_NUMBER(uint, args[0], delay);
+ COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], delay);
jtag_set_ntrst_assert_width(delay);
}
jtag_set_ntrst_assert_width(delay);
}
if (CMD_ARGC == 1)
{
unsigned khz = 0;
if (CMD_ARGC == 1)
{
unsigned khz = 0;
- COMMAND_PARSE_NUMBER(uint, args[0], khz);
+ COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], khz);
retval = jtag_config_khz(khz);
if (ERROR_OK != retval)
retval = jtag_config_khz(khz);
if (ERROR_OK != retval)
if (CMD_ARGC == 1)
{
unsigned khz = 0;
if (CMD_ARGC == 1)
{
unsigned khz = 0;
- COMMAND_PARSE_NUMBER(uint, args[0], khz);
+ COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], khz);
retval = jtag_config_rclk(khz);
if (ERROR_OK != retval)
retval = jtag_config_rclk(khz);
if (ERROR_OK != retval)
return ERROR_COMMAND_SYNTAX_ERROR;
int trst = -1;
return ERROR_COMMAND_SYNTAX_ERROR;
int trst = -1;
+ if (CMD_ARGV[0][0] == '1')
- else if (args[0][0] == '0')
+ else if (CMD_ARGV[0][0] == '0')
trst = 0;
else
return ERROR_COMMAND_SYNTAX_ERROR;
int srst = -1;
trst = 0;
else
return ERROR_COMMAND_SYNTAX_ERROR;
int srst = -1;
+ if (CMD_ARGV[1][0] == '1')
- else if (args[1][0] == '0')
+ else if (CMD_ARGV[1][0] == '0')
srst = 0;
else
return ERROR_COMMAND_SYNTAX_ERROR;
srst = 0;
else
return ERROR_COMMAND_SYNTAX_ERROR;
return ERROR_COMMAND_SYNTAX_ERROR;
unsigned num_clocks;
return ERROR_COMMAND_SYNTAX_ERROR;
unsigned num_clocks;
- COMMAND_PARSE_NUMBER(uint, args[0], num_clocks);
+ COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], num_clocks);
jtag_add_runtest(num_clocks, TAP_IDLE);
return jtag_execute_queue();
jtag_add_runtest(num_clocks, TAP_IDLE);
return jtag_execute_queue();
if (CMD_ARGC >= 4) {
/* have at least one pair of numbers. */
/* is last pair the magic text? */
if (CMD_ARGC >= 4) {
/* have at least one pair of numbers. */
/* is last pair the magic text? */
- if (strcmp("-endstate", args[CMD_ARGC - 2]) == 0) {
- endstate = tap_state_by_name(args[CMD_ARGC - 1]);
+ if (strcmp("-endstate", CMD_ARGV[CMD_ARGC - 2]) == 0) {
+ endstate = tap_state_by_name(CMD_ARGV[CMD_ARGC - 1]);
if (endstate == TAP_INVALID)
return ERROR_COMMAND_SYNTAX_ERROR;
if (!scan_is_safe(endstate))
LOG_WARNING("unstable irscan endstate \"%s\"",
if (endstate == TAP_INVALID)
return ERROR_COMMAND_SYNTAX_ERROR;
if (!scan_is_safe(endstate))
LOG_WARNING("unstable irscan endstate \"%s\"",
+ CMD_ARGV[CMD_ARGC - 1]);
int retval;
for (i = 0; i < num_fields; i++)
{
int retval;
for (i = 0; i < num_fields; i++)
{
- tap = jtag_tap_by_string(args[i*2]);
+ tap = jtag_tap_by_string(CMD_ARGV[i*2]);
if (tap == NULL)
{
int j;
for (j = 0; j < i; j++)
free(fields[j].out_value);
free(fields);
if (tap == NULL)
{
int j;
for (j = 0; j < i; j++)
free(fields[j].out_value);
free(fields);
- command_print(cmd_ctx, "Tap: %s unknown", args[i*2]);
+ command_print(cmd_ctx, "Tap: %s unknown", CMD_ARGV[i*2]);
fields[i].out_value = malloc(DIV_ROUND_UP(field_size, 8));
uint32_t value;
fields[i].out_value = malloc(DIV_ROUND_UP(field_size, 8));
uint32_t value;
- retval = parse_u32(args[i * 2 + 1], &value);
+ retval = parse_u32(CMD_ARGV[i * 2 + 1], &value);
if (ERROR_OK != retval)
goto error_return;
buf_set_u32(fields[i].out_value, 0, field_size, value);
if (ERROR_OK != retval)
goto error_return;
buf_set_u32(fields[i].out_value, 0, field_size, value);
- if (strcmp(args[0], "enable") == 0)
+ if (strcmp(CMD_ARGV[0], "enable") == 0)
jtag_set_verify_capture_ir(true);
jtag_set_verify_capture_ir(true);
- else if (strcmp(args[0], "disable") == 0)
+ else if (strcmp(CMD_ARGV[0], "disable") == 0)
jtag_set_verify_capture_ir(false);
else
return ERROR_COMMAND_SYNTAX_ERROR;
jtag_set_verify_capture_ir(false);
else
return ERROR_COMMAND_SYNTAX_ERROR;
- if (strcmp(args[0], "enable") == 0)
+ if (strcmp(CMD_ARGV[0], "enable") == 0)
- else if (strcmp(args[0], "disable") == 0)
+ else if (strcmp(CMD_ARGV[0], "disable") == 0)
jtag_set_verify(false);
else
return ERROR_COMMAND_SYNTAX_ERROR;
jtag_set_verify(false);
else
return ERROR_COMMAND_SYNTAX_ERROR;
if (CMD_ARGC == 1)
{
bool use_new_table;
if (CMD_ARGC == 1)
{
bool use_new_table;
- if (strcmp(args[0], "short") == 0)
+ if (strcmp(CMD_ARGV[0], "short") == 0)
- else if (strcmp(args[0], "long") == 0)
+ else if (strcmp(CMD_ARGV[0], "long") == 0)
use_new_table = false;
else
return ERROR_COMMAND_SYNTAX_ERROR;
use_new_table = false;
else
return ERROR_COMMAND_SYNTAX_ERROR;
- if (!strcmp(args[0], "normal"))
+ if (!strcmp(CMD_ARGV[0], "normal"))
{
vsllink_mode = VSLLINK_MODE_NORMAL;
}
{
vsllink_mode = VSLLINK_MODE_NORMAL;
}
- else if (!strcmp(args[0], "dma"))
+ else if (!strcmp(CMD_ARGV[0], "dma"))
{
vsllink_mode = VSLLINK_MODE_DMA;
}
else
{
{
vsllink_mode = VSLLINK_MODE_DMA;
}
else
{
- LOG_ERROR("invalid vsllink_mode: %s", args[0]);
+ LOG_ERROR("invalid vsllink_mode: %s", CMD_ARGV[0]);
- COMMAND_PARSE_NUMBER(u16, args[0], vsllink_usb_vid);
+ COMMAND_PARSE_NUMBER(u16, CMD_ARGV[0], vsllink_usb_vid);
LOG_ERROR("parameter error, should be one parameter for PID");
return ERROR_OK;
}
LOG_ERROR("parameter error, should be one parameter for PID");
return ERROR_OK;
}
- COMMAND_PARSE_NUMBER(u16, args[0], vsllink_usb_pid);
+ COMMAND_PARSE_NUMBER(u16, CMD_ARGV[0], vsllink_usb_pid);
- COMMAND_PARSE_NUMBER(u8, args[0], vsllink_usb_bulkin);
+ COMMAND_PARSE_NUMBER(u8, CMD_ARGV[0], vsllink_usb_bulkin);
vsllink_usb_bulkin |= 0x80;
vsllink_usb_bulkin |= 0x80;
- COMMAND_PARSE_NUMBER(u8, args[0], vsllink_usb_bulkout);
+ COMMAND_PARSE_NUMBER(u8, CMD_ARGV[0], vsllink_usb_bulkout);
vsllink_usb_bulkout &= ~0x80;
vsllink_usb_bulkout &= ~0x80;
- COMMAND_PARSE_NUMBER(u8, args[0], vsllink_usb_interface);
+ COMMAND_PARSE_NUMBER(u8, CMD_ARGV[0], vsllink_usb_interface);
for (i = 0; pld_drivers[i]; i++)
{
for (i = 0; pld_drivers[i]; i++)
{
- if (strcmp(args[0], pld_drivers[i]->name) == 0)
+ if (strcmp(CMD_ARGV[0], pld_drivers[i]->name) == 0)
{
struct pld_device *p, *c;
/* register pld specific commands */
if (pld_drivers[i]->register_commands(cmd_ctx) != ERROR_OK)
{
{
struct pld_device *p, *c;
/* register pld specific commands */
if (pld_drivers[i]->register_commands(cmd_ctx) != ERROR_OK)
{
- LOG_ERROR("couldn't register '%s' commands", args[0]);
+ LOG_ERROR("couldn't register '%s' commands", CMD_ARGV[0]);
int retval = CALL_COMMAND_HANDLER(pld_drivers[i]->pld_device_command, c);
if (ERROR_OK != retval)
{
int retval = CALL_COMMAND_HANDLER(pld_drivers[i]->pld_device_command, c);
if (ERROR_OK != retval)
{
- LOG_ERROR("'%s' driver rejected pld device", args[0]);
+ LOG_ERROR("'%s' driver rejected pld device", CMD_ARGV[0]);
free(c);
return ERROR_OK;
}
free(c);
return ERROR_OK;
}
/* no matching pld driver found */
if (!found)
{
/* no matching pld driver found */
if (!found)
{
- LOG_ERROR("pld driver '%s' not found", args[0]);
+ LOG_ERROR("pld driver '%s' not found", CMD_ARGV[0]);
- COMMAND_PARSE_NUMBER(uint, args[0], dev_id);
+ COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], dev_id);
p = get_pld_device_by_num(dev_id);
if (!p)
{
p = get_pld_device_by_num(dev_id);
if (!p)
{
- command_print(cmd_ctx, "pld device '#%s' is out of bounds", args[0]);
+ command_print(cmd_ctx, "pld device '#%s' is out of bounds", CMD_ARGV[0]);
- if ((retval = p->driver->load(p, args[1])) != ERROR_OK)
+ if ((retval = p->driver->load(p, CMD_ARGV[1])) != ERROR_OK)
{
command_print(cmd_ctx, "failed loading file %s to pld device %u",
{
command_print(cmd_ctx, "failed loading file %s to pld device %u",
timeval_subtract(&duration, &end, &start);
command_print(cmd_ctx, "loaded file %s to pld device %u in %jis %jius",
timeval_subtract(&duration, &end, &start);
command_print(cmd_ctx, "loaded file %s to pld device %u in %jis %jius",
(intmax_t)duration.tv_sec, (intmax_t)duration.tv_usec);
}
(intmax_t)duration.tv_sec, (intmax_t)duration.tv_usec);
}
- COMMAND_PARSE_NUMBER(uint, args[0], dev_id);
+ COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], dev_id);
device = get_pld_device_by_num(dev_id);
if (!device)
{
device = get_pld_device_by_num(dev_id);
if (!device)
{
- command_print(cmd_ctx, "pld device '#%s' is out of bounds", args[0]);
+ command_print(cmd_ctx, "pld device '#%s' is out of bounds", CMD_ARGV[0]);
return ERROR_PLD_DEVICE_INVALID;
}
return ERROR_PLD_DEVICE_INVALID;
}
- tap = jtag_tap_by_string(args[1]);
+ tap = jtag_tap_by_string(CMD_ARGV[1]);
- command_print(cmd_ctx, "Tap: %s does not exist", args[1]);
+ command_print(cmd_ctx, "Tap: %s does not exist", CMD_ARGV[1]);
- if (strcmp(args[0], "enable") == 0)
+ if (strcmp(CMD_ARGV[0], "enable") == 0)
{
gdb_use_memory_map = 1;
return ERROR_OK;
}
{
gdb_use_memory_map = 1;
return ERROR_OK;
}
- else if (strcmp(args[0], "disable") == 0)
+ else if (strcmp(CMD_ARGV[0], "disable") == 0)
{
gdb_use_memory_map = 0;
return ERROR_OK;
}
else
{
gdb_use_memory_map = 0;
return ERROR_OK;
}
else
- LOG_WARNING("invalid gdb_memory_map configuration directive %s", args[0]);
+ LOG_WARNING("invalid gdb_memory_map configuration directive %s", CMD_ARGV[0]);
}
return ERROR_COMMAND_SYNTAX_ERROR;
}
return ERROR_COMMAND_SYNTAX_ERROR;
- if (strcmp(args[0], "enable") == 0)
+ if (strcmp(CMD_ARGV[0], "enable") == 0)
{
gdb_flash_program = 1;
return ERROR_OK;
}
{
gdb_flash_program = 1;
return ERROR_OK;
}
- else if (strcmp(args[0], "disable") == 0)
+ else if (strcmp(CMD_ARGV[0], "disable") == 0)
{
gdb_flash_program = 0;
return ERROR_OK;
}
else
{
gdb_flash_program = 0;
return ERROR_OK;
}
else
- LOG_WARNING("invalid gdb_flash_program configuration directive: %s", args[0]);
+ LOG_WARNING("invalid gdb_flash_program configuration directive: %s", CMD_ARGV[0]);
}
return ERROR_COMMAND_SYNTAX_ERROR;
}
return ERROR_COMMAND_SYNTAX_ERROR;
- if (strcmp(args[0], "enable") == 0)
+ if (strcmp(CMD_ARGV[0], "enable") == 0)
{
gdb_report_data_abort = 1;
return ERROR_OK;
}
{
gdb_report_data_abort = 1;
return ERROR_OK;
}
- else if (strcmp(args[0], "disable") == 0)
+ else if (strcmp(CMD_ARGV[0], "disable") == 0)
{
gdb_report_data_abort = 0;
return ERROR_OK;
}
else
{
gdb_report_data_abort = 0;
return ERROR_OK;
}
else
- LOG_WARNING("invalid gdb_report_data_abort configuration directive: %s", args[0]);
+ LOG_WARNING("invalid gdb_report_data_abort configuration directive: %s", CMD_ARGV[0]);
}
return ERROR_COMMAND_SYNTAX_ERROR;
}
return ERROR_COMMAND_SYNTAX_ERROR;
} else if (CMD_ARGC == 1)
{
gdb_breakpoint_override = 1;
} else if (CMD_ARGC == 1)
{
gdb_breakpoint_override = 1;
- if (strcmp(args[0], "hard") == 0)
+ if (strcmp(CMD_ARGV[0], "hard") == 0)
{
gdb_breakpoint_override_type = BKPT_HARD;
{
gdb_breakpoint_override_type = BKPT_HARD;
- } else if (strcmp(args[0], "soft") == 0)
+ } else if (strcmp(CMD_ARGV[0], "soft") == 0)
{
gdb_breakpoint_override_type = BKPT_SOFT;
{
gdb_breakpoint_override_type = BKPT_SOFT;
- } else if (strcmp(args[0], "disable") == 0)
+ } else if (strcmp(CMD_ARGV[0], "disable") == 0)
{
gdb_breakpoint_override = 0;
}
{
gdb_breakpoint_override = 0;
}
- Jim_WrongNumArgs(interp, 1, argv, "method ?args ...?");
+ Jim_WrongNumArgs(interp, 1, argv, "method ?CMD_ARGV ...?");
return JIM_ERR;
}
char *name = (char*) Jim_GetString(argv[1], NULL);
return JIM_ERR;
}
char *name = (char*) Jim_GetString(argv[1], NULL);
- Jim_WrongNumArgs(interp, 1, argv, "method ?args ...?");
+ Jim_WrongNumArgs(interp, 1, argv, "method ?CMD_ARGV ...?");
return JIM_ERR;
}
char *name = (char*)Jim_GetString(argv[1], NULL);
return JIM_ERR;
}
char *name = (char*)Jim_GetString(argv[1], NULL);
- COMMAND_PARSE_NUMBER(u16, args[0], port);
+ COMMAND_PARSE_NUMBER(u16, CMD_ARGV[0], port);
svf_quiet = 0;
for (unsigned i = 1; i < CMD_ARGC; i++)
{
svf_quiet = 0;
for (unsigned i = 1; i < CMD_ARGC; i++)
{
- if (!strcmp(args[i], "quiet"))
+ if (!strcmp(CMD_ARGV[i], "quiet"))
{
svf_quiet = 1;
}
else
{
{
svf_quiet = 1;
}
else
{
- LOG_ERROR("unknown variant for svf: %s", args[i]);
+ LOG_ERROR("unknown variant for svf: %s", CMD_ARGV[i]);
// no need to free anything now
return ERROR_FAIL;
}
}
// no need to free anything now
return ERROR_FAIL;
}
}
- if ((svf_fd = open(args[0], O_RDONLY)) < 0)
+ if ((svf_fd = open(CMD_ARGV[0], O_RDONLY)) < 0)
- command_print(cmd_ctx, "file \"%s\" not found", args[0]);
+ command_print(cmd_ctx, "file \"%s\" not found", CMD_ARGV[0]);
// no need to free anything now
return ERROR_FAIL;
}
// no need to free anything now
return ERROR_FAIL;
}
- LOG_USER("svf processing file: \"%s\"", args[0]);
+ LOG_USER("svf processing file: \"%s\"", CMD_ARGV[0]);
// get time
time_ago = timeval_ms();
// get time
time_ago = timeval_ms();
if (CMD_ARGC != 1)
return ERROR_COMMAND_SYNTAX_ERROR;
if (CMD_ARGC != 1)
return ERROR_COMMAND_SYNTAX_ERROR;
+ switch (CMD_ARGV[0][0])
{
case '0': /* 0 */
case 'f': /* false */
{
case '0': /* 0 */
case 'f': /* false */
- COMMAND_PARSE_NUMBER(u32, args[0], arm11_vcr);
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], arm11_vcr);
break;
default:
return ERROR_COMMAND_SYNTAX_ERROR;
break;
default:
return ERROR_COMMAND_SYNTAX_ERROR;
if (CMD_ARGC >= 1)
{
uint32_t opcode;
if (CMD_ARGC >= 1)
{
uint32_t opcode;
- COMMAND_PARSE_NUMBER(u32, args[0], opcode);
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], opcode);
else if (CMD_ARGC == 2)
{
uint32_t value;
else if (CMD_ARGC == 2)
{
uint32_t value;
- COMMAND_PARSE_NUMBER(u32, args[1], value);
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[1], value);
if ((retval = arm720t_write_cp15(target, opcode, value)) != ERROR_OK)
{
if ((retval = arm720t_write_cp15(target, opcode, value)) != ERROR_OK)
{
- COMMAND_PARSE_NUMBER(u32, args[0], value);
- COMMAND_PARSE_NUMBER(int, args[1], spsr);
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], value);
+ COMMAND_PARSE_NUMBER(int, CMD_ARGV[1], spsr);
/* if we're writing the CPSR, mask the T bit */
if (!spsr)
/* if we're writing the CPSR, mask the T bit */
if (!spsr)
- COMMAND_PARSE_NUMBER(u32, args[0], value);
- COMMAND_PARSE_NUMBER(int, args[1], rotate);
- COMMAND_PARSE_NUMBER(int, args[2], spsr);
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], value);
+ COMMAND_PARSE_NUMBER(int, CMD_ARGV[1], rotate);
+ COMMAND_PARSE_NUMBER(int, CMD_ARGV[2], spsr);
arm7_9->write_xpsr_im8(target, value, rotate, spsr);
if ((retval = jtag_execute_queue()) != ERROR_OK)
arm7_9->write_xpsr_im8(target, value, rotate, spsr);
if ((retval = jtag_execute_queue()) != ERROR_OK)
- COMMAND_PARSE_NUMBER(int, args[0], num);
- COMMAND_PARSE_NUMBER(u32, args[1], mode);
- COMMAND_PARSE_NUMBER(u32, args[2], value);
+ COMMAND_PARSE_NUMBER(int, CMD_ARGV[0], num);
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[1], mode);
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[2], value);
return arm7_9_write_core_reg(target, num, mode, value);
}
return arm7_9_write_core_reg(target, num, mode, value);
}
- if (strcmp("enable", args[0]) == 0)
+ if (strcmp("enable", CMD_ARGV[0]) == 0)
{
arm7_9->use_dbgrq = 1;
}
{
arm7_9->use_dbgrq = 1;
}
- else if (strcmp("disable", args[0]) == 0)
+ else if (strcmp("disable", CMD_ARGV[0]) == 0)
{
arm7_9->use_dbgrq = 0;
}
{
arm7_9->use_dbgrq = 0;
}
- if (strcmp("enable", args[0]) == 0)
+ if (strcmp("enable", CMD_ARGV[0]) == 0)
{
arm7_9->fast_memory_access = 1;
}
{
arm7_9->fast_memory_access = 1;
}
- else if (strcmp("disable", args[0]) == 0)
+ else if (strcmp("disable", CMD_ARGV[0]) == 0)
{
arm7_9->fast_memory_access = 0;
}
{
arm7_9->fast_memory_access = 0;
}
- if (strcmp("enable", args[0]) == 0)
+ if (strcmp("enable", CMD_ARGV[0]) == 0)
{
arm7_9->dcc_downloads = 1;
}
{
arm7_9->dcc_downloads = 1;
}
- else if (strcmp("disable", args[0]) == 0)
+ else if (strcmp("disable", CMD_ARGV[0]) == 0)
{
arm7_9->dcc_downloads = 0;
}
{
arm7_9->dcc_downloads = 0;
}
- if ((output = fopen(args[0], "w")) == NULL)
+ if ((output = fopen(CMD_ARGV[0], "w")) == NULL)
{
LOG_DEBUG("error opening cache content file");
return ERROR_OK;
{
LOG_DEBUG("error opening cache content file");
return ERROR_OK;
/* restore CP15 MMU and Cache settings */
arm920t_write_cp15_physical(target, ARM920T_CP15_PHYS_ADDR(0, 0x1, 0), cp15_ctrl_saved);
/* restore CP15 MMU and Cache settings */
arm920t_write_cp15_physical(target, ARM920T_CP15_PHYS_ADDR(0, 0x1, 0), cp15_ctrl_saved);
- command_print(cmd_ctx, "cache content successfully output to %s", args[0]);
+ command_print(cmd_ctx, "cache content successfully output to %s", CMD_ARGV[0]);
- if ((output = fopen(args[0], "w")) == NULL)
+ if ((output = fopen(CMD_ARGV[0], "w")) == NULL)
{
LOG_DEBUG("error opening mmu content file");
return ERROR_OK;
{
LOG_DEBUG("error opening mmu content file");
return ERROR_OK;
fprintf(output, "%i: 0x%8.8" PRIx32 " 0x%8.8" PRIx32 " 0x%8.8" PRIx32 " %s\n", i, i_tlb[i].cam, i_tlb[i].ram1, i_tlb[i].ram2, (i_tlb[i].cam & 0x20) ? "(valid)" : "(invalid)");
}
fprintf(output, "%i: 0x%8.8" PRIx32 " 0x%8.8" PRIx32 " 0x%8.8" PRIx32 " %s\n", i, i_tlb[i].cam, i_tlb[i].ram1, i_tlb[i].ram2, (i_tlb[i].cam & 0x20) ? "(valid)" : "(invalid)");
}
- command_print(cmd_ctx, "mmu content successfully output to %s", args[0]);
+ command_print(cmd_ctx, "mmu content successfully output to %s", CMD_ARGV[0]);
if (CMD_ARGC >= 1)
{
int address;
if (CMD_ARGC >= 1)
{
int address;
- COMMAND_PARSE_NUMBER(int, args[0], address);
+ COMMAND_PARSE_NUMBER(int, CMD_ARGV[0], address);
else if (CMD_ARGC == 2)
{
uint32_t value;
else if (CMD_ARGC == 2)
{
uint32_t value;
- COMMAND_PARSE_NUMBER(u32, args[1], value);
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[1], value);
if ((retval = arm920t_write_cp15_physical(target, address, value)) != ERROR_OK)
{
command_print(cmd_ctx, "couldn't access reg %i", address);
if ((retval = arm920t_write_cp15_physical(target, address, value)) != ERROR_OK)
{
command_print(cmd_ctx, "couldn't access reg %i", address);
if (CMD_ARGC >= 1)
{
uint32_t opcode;
if (CMD_ARGC >= 1)
{
uint32_t opcode;
- COMMAND_PARSE_NUMBER(u32, args[0], opcode);
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], opcode);
else if (CMD_ARGC == 2)
{
uint32_t value;
else if (CMD_ARGC == 2)
{
uint32_t value;
- COMMAND_PARSE_NUMBER(u32, args[1], value);
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[1], value);
if ((retval = arm920t_write_cp15_interpreted(target, opcode, value, 0)) != ERROR_OK)
{
command_print(cmd_ctx, "couldn't execute %8.8" PRIx32 "", opcode);
if ((retval = arm920t_write_cp15_interpreted(target, opcode, value, 0)) != ERROR_OK)
{
command_print(cmd_ctx, "couldn't execute %8.8" PRIx32 "", opcode);
else if (CMD_ARGC == 3)
{
uint32_t value;
else if (CMD_ARGC == 3)
{
uint32_t value;
- COMMAND_PARSE_NUMBER(u32, args[1], value);
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[1], value);
- COMMAND_PARSE_NUMBER(u32, args[2], address);
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[2], address);
if ((retval = arm920t_write_cp15_interpreted(target, opcode, value, address)) != ERROR_OK)
{
command_print(cmd_ctx, "couldn't execute %8.8" PRIx32 "", opcode);
if ((retval = arm920t_write_cp15_interpreted(target, opcode, value, address)) != ERROR_OK)
{
command_print(cmd_ctx, "couldn't execute %8.8" PRIx32 "", opcode);
- COMMAND_PARSE_NUMBER(int, args[0], opcode_1);
- COMMAND_PARSE_NUMBER(int, args[1], opcode_2);
- COMMAND_PARSE_NUMBER(int, args[2], CRn);
- COMMAND_PARSE_NUMBER(int, args[3], CRm);
+ COMMAND_PARSE_NUMBER(int, CMD_ARGV[0], opcode_1);
+ COMMAND_PARSE_NUMBER(int, CMD_ARGV[1], opcode_2);
+ COMMAND_PARSE_NUMBER(int, CMD_ARGV[2], CRn);
+ COMMAND_PARSE_NUMBER(int, CMD_ARGV[3], CRm);
retval = arm926ejs_verify_pointer(cmd_ctx, arm926ejs);
if (retval != ERROR_OK)
retval = arm926ejs_verify_pointer(cmd_ctx, arm926ejs);
if (retval != ERROR_OK)
- COMMAND_PARSE_NUMBER(u32, args[4], value);
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[4], value);
if ((retval = arm926ejs->write_cp15(target, opcode_1, opcode_2, CRn, CRm, value)) != ERROR_OK)
{
command_print(cmd_ctx, "couldn't access register");
if ((retval = arm926ejs->write_cp15(target, opcode_1, opcode_2, CRn, CRm, value)) != ERROR_OK)
{
command_print(cmd_ctx, "couldn't access register");
if (CMD_ARGC >= 1)
{
uint32_t address;
if (CMD_ARGC >= 1)
{
uint32_t address;
- COMMAND_PARSE_NUMBER(u32, args[0], address);
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], address);
else if (CMD_ARGC == 2)
{
uint32_t value;
else if (CMD_ARGC == 2)
{
uint32_t value;
- COMMAND_PARSE_NUMBER(u32, args[1], value);
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[1], value);
if ((retval = arm966e_write_cp15(target, address, value)) != ERROR_OK)
{
command_print(cmd_ctx,
if ((retval = arm966e_write_cp15(target, address, value)) != ERROR_OK)
{
command_print(cmd_ctx,
if (CMD_ARGC > 0)
{
vector_catch_value = 0x0;
if (CMD_ARGC > 0)
{
vector_catch_value = 0x0;
- if (strcmp(args[0], "all") == 0)
+ if (strcmp(CMD_ARGV[0], "all") == 0)
{
vector_catch_value = 0xdf;
}
{
vector_catch_value = 0xdf;
}
- else if (strcmp(args[0], "none") == 0)
+ else if (strcmp(CMD_ARGV[0], "none") == 0)
unsigned j;
for (j = 0; arm9tdmi_vectors[j].name; j++)
{
unsigned j;
for (j = 0; arm9tdmi_vectors[j].name; j++)
{
- if (strcmp(args[i], arm9tdmi_vectors[j].name) == 0)
+ if (strcmp(CMD_ARGV[i], arm9tdmi_vectors[j].name) == 0)
{
vector_catch_value |= arm9tdmi_vectors[j].value;
break;
{
vector_catch_value |= arm9tdmi_vectors[j].value;
break;
/* complain if vector wasn't found */
if (!arm9tdmi_vectors[j].name)
{
/* complain if vector wasn't found */
if (!arm9tdmi_vectors[j].name)
{
- command_print(cmd_ctx, "vector '%s' not found, leaving current setting unchanged", args[i]);
+ command_print(cmd_ctx, "vector '%s' not found, leaving current setting unchanged", CMD_ARGV[i]);
/* reread current setting */
vector_catch_value = buf_get_u32(
/* reread current setting */
vector_catch_value = buf_get_u32(
apsel = swjdp->apsel;
break;
case 1:
apsel = swjdp->apsel;
break;
case 1:
- COMMAND_PARSE_NUMBER(u32, args[0], apsel);
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], apsel);
break;
default:
return ERROR_COMMAND_SYNTAX_ERROR;
break;
default:
return ERROR_COMMAND_SYNTAX_ERROR;
memaccess_tck = swjdp->memaccess_tck;
break;
case 1:
memaccess_tck = swjdp->memaccess_tck;
break;
case 1:
- COMMAND_PARSE_NUMBER(u32, args[0], memaccess_tck);
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], memaccess_tck);
break;
default:
return ERROR_COMMAND_SYNTAX_ERROR;
break;
default:
return ERROR_COMMAND_SYNTAX_ERROR;
apsel = 0;
break;
case 1:
apsel = 0;
break;
case 1:
- COMMAND_PARSE_NUMBER(u32, args[0], apsel);
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], apsel);
break;
default:
return ERROR_COMMAND_SYNTAX_ERROR;
break;
default:
return ERROR_COMMAND_SYNTAX_ERROR;
apsel = swjdp->apsel;
break;
case 1:
apsel = swjdp->apsel;
break;
case 1:
- COMMAND_PARSE_NUMBER(u32, args[0], apsel);
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], apsel);
break;
default:
return ERROR_COMMAND_SYNTAX_ERROR;
break;
default:
return ERROR_COMMAND_SYNTAX_ERROR;
- if (strcmp(args[0], "arm") == 0)
+ if (strcmp(CMD_ARGV[0], "arm") == 0)
{
armv4_5->core_state = ARMV4_5_STATE_ARM;
}
{
armv4_5->core_state = ARMV4_5_STATE_ARM;
}
- if (strcmp(args[0], "thumb") == 0)
+ if (strcmp(CMD_ARGV[0], "thumb") == 0)
{
armv4_5->core_state = ARMV4_5_STATE_THUMB;
}
{
armv4_5->core_state = ARMV4_5_STATE_THUMB;
}
switch (CMD_ARGC) {
case 3:
switch (CMD_ARGC) {
case 3:
- if (strcmp(args[2], "thumb") != 0)
+ if (strcmp(CMD_ARGV[2], "thumb") != 0)
goto usage;
thumb = 1;
/* FALL THROUGH */
case 2:
goto usage;
thumb = 1;
/* FALL THROUGH */
case 2:
- COMMAND_PARSE_NUMBER(int, args[1], count);
+ COMMAND_PARSE_NUMBER(int, CMD_ARGV[1], count);
/* FALL THROUGH */
case 1:
/* FALL THROUGH */
case 1:
- COMMAND_PARSE_NUMBER(u32, args[0], address);
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], address);
if (address & 0x01) {
if (!thumb) {
command_print(cmd_ctx, "Disassemble as Thumb");
if (address & 0x01) {
if (!thumb) {
command_print(cmd_ctx, "Disassemble as Thumb");
apsel = swjdp->apsel;
break;
case 1:
apsel = swjdp->apsel;
break;
case 1:
- COMMAND_PARSE_NUMBER(u32, args[0], apsel);
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], apsel);
break;
default:
return ERROR_COMMAND_SYNTAX_ERROR;
break;
default:
return ERROR_COMMAND_SYNTAX_ERROR;
apsel = swjdp->apsel;
break;
case 1:
apsel = swjdp->apsel;
break;
case 1:
- COMMAND_PARSE_NUMBER(u32, args[0], apsel);
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], apsel);
break;
default:
return ERROR_COMMAND_SYNTAX_ERROR;
break;
default:
return ERROR_COMMAND_SYNTAX_ERROR;
apsel = swjdp->apsel;
break;
case 1:
apsel = swjdp->apsel;
break;
case 1:
- COMMAND_PARSE_NUMBER(u32, args[0], apsel);
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], apsel);
break;
default:
return ERROR_COMMAND_SYNTAX_ERROR;
break;
default:
return ERROR_COMMAND_SYNTAX_ERROR;
errno = 0;
switch (CMD_ARGC) {
case 2:
errno = 0;
switch (CMD_ARGC) {
case 2:
- COMMAND_PARSE_NUMBER(ulong, args[1], count);
+ COMMAND_PARSE_NUMBER(ulong, CMD_ARGV[1], count);
/* FALL THROUGH */
case 1:
/* FALL THROUGH */
case 1:
- COMMAND_PARSE_NUMBER(u32, args[0], address);
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], address);
break;
default:
command_print(cmd_ctx,
break;
default:
command_print(cmd_ctx,
unsigned catch = 0;
if (CMD_ARGC == 1) {
unsigned catch = 0;
if (CMD_ARGC == 1) {
- if (strcmp(args[0], "all") == 0) {
+ if (strcmp(CMD_ARGV[0], "all") == 0) {
catch = VC_HARDERR | VC_INTERR | VC_BUSERR
| VC_STATERR | VC_CHKERR | VC_NOCPERR
| VC_MMERR | VC_CORERESET;
goto write;
catch = VC_HARDERR | VC_INTERR | VC_BUSERR
| VC_STATERR | VC_CHKERR | VC_NOCPERR
| VC_MMERR | VC_CORERESET;
goto write;
- } else if (strcmp(args[0], "none") == 0) {
+ } else if (strcmp(CMD_ARGV[0], "none") == 0) {
goto write;
}
}
while (CMD_ARGC-- > 0) {
unsigned i;
for (i = 0; i < ARRAY_SIZE(vec_ids); i++) {
goto write;
}
}
while (CMD_ARGC-- > 0) {
unsigned i;
for (i = 0; i < ARRAY_SIZE(vec_ids); i++) {
- if (strcmp(args[CMD_ARGC], vec_ids[i].name) != 0)
+ if (strcmp(CMD_ARGV[CMD_ARGC], vec_ids[i].name) != 0)
continue;
catch |= vec_ids[i].mask;
break;
}
if (i == ARRAY_SIZE(vec_ids)) {
continue;
catch |= vec_ids[i].mask;
break;
}
if (i == ARRAY_SIZE(vec_ids)) {
- LOG_ERROR("No CM3 vector '%s'", args[CMD_ARGC]);
+ LOG_ERROR("No CM3 vector '%s'", CMD_ARGV[CMD_ARGC]);
return ERROR_INVALID_ARGUMENTS;
}
}
return ERROR_INVALID_ARGUMENTS;
}
}
- if (!strcmp(args[0], "on"))
+ if (!strcmp(CMD_ARGV[0], "on"))
{
cortex_m3_write_debug_halt_mask(target, C_HALT | C_MASKINTS, 0);
}
{
cortex_m3_write_debug_halt_mask(target, C_HALT | C_MASKINTS, 0);
}
- else if (!strcmp(args[0], "off"))
+ else if (!strcmp(CMD_ARGV[0], "off"))
{
cortex_m3_write_debug_halt_mask(target, C_HALT, C_MASKINTS);
}
{
cortex_m3_write_debug_halt_mask(target, C_HALT, C_MASKINTS);
}
return ERROR_COMMAND_SYNTAX_ERROR;
}
return ERROR_COMMAND_SYNTAX_ERROR;
}
- target = get_target(args[0]);
+ target = get_target(CMD_ARGV[0]);
- LOG_ERROR("ETB: target '%s' not defined", args[0]);
+ LOG_ERROR("ETB: target '%s' not defined", CMD_ARGV[0]);
return ERROR_FAIL;
}
arm = target_to_arm(target);
if (!is_arm(arm))
{
return ERROR_FAIL;
}
arm = target_to_arm(target);
if (!is_arm(arm))
{
- command_print(cmd_ctx, "ETB: '%s' isn't an ARM", args[0]);
+ command_print(cmd_ctx, "ETB: '%s' isn't an ARM", CMD_ARGV[0]);
- tap = jtag_tap_by_string(args[1]);
+ tap = jtag_tap_by_string(CMD_ARGV[1]);
- command_print(cmd_ctx, "ETB: TAP %s does not exist", args[1]);
+ command_print(cmd_ctx, "ETB: TAP %s does not exist", CMD_ARGV[1]);
etmv1_tracemode_t tracemode;
/* what parts of data access are traced? */
etmv1_tracemode_t tracemode;
/* what parts of data access are traced? */
- if (strcmp(args[0], "none") == 0)
+ if (strcmp(CMD_ARGV[0], "none") == 0)
tracemode = ETMV1_TRACE_NONE;
tracemode = ETMV1_TRACE_NONE;
- else if (strcmp(args[0], "data") == 0)
+ else if (strcmp(CMD_ARGV[0], "data") == 0)
tracemode = ETMV1_TRACE_DATA;
tracemode = ETMV1_TRACE_DATA;
- else if (strcmp(args[0], "address") == 0)
+ else if (strcmp(CMD_ARGV[0], "address") == 0)
tracemode = ETMV1_TRACE_ADDR;
tracemode = ETMV1_TRACE_ADDR;
- else if (strcmp(args[0], "all") == 0)
+ else if (strcmp(CMD_ARGV[0], "all") == 0)
tracemode = ETMV1_TRACE_DATA | ETMV1_TRACE_ADDR;
else
{
tracemode = ETMV1_TRACE_DATA | ETMV1_TRACE_ADDR;
else
{
- command_print(cmd_ctx, "invalid option '%s'", args[0]);
+ command_print(cmd_ctx, "invalid option '%s'", CMD_ARGV[0]);
return ERROR_INVALID_ARGUMENTS;
}
uint8_t context_id;
return ERROR_INVALID_ARGUMENTS;
}
uint8_t context_id;
- COMMAND_PARSE_NUMBER(u8, args[1], context_id);
+ COMMAND_PARSE_NUMBER(u8, CMD_ARGV[1], context_id);
switch (context_id)
{
case 0:
switch (context_id)
{
case 0:
tracemode |= ETMV1_CONTEXTID_32;
break;
default:
tracemode |= ETMV1_CONTEXTID_32;
break;
default:
- command_print(cmd_ctx, "invalid option '%s'", args[1]);
+ command_print(cmd_ctx, "invalid option '%s'", CMD_ARGV[1]);
return ERROR_INVALID_ARGUMENTS;
}
return ERROR_INVALID_ARGUMENTS;
}
- if (strcmp(args[2], "enable") == 0)
+ if (strcmp(CMD_ARGV[2], "enable") == 0)
tracemode |= ETMV1_CYCLE_ACCURATE;
tracemode |= ETMV1_CYCLE_ACCURATE;
- else if (strcmp(args[2], "disable") == 0)
+ else if (strcmp(CMD_ARGV[2], "disable") == 0)
- command_print(cmd_ctx, "invalid option '%s'", args[2]);
+ command_print(cmd_ctx, "invalid option '%s'", CMD_ARGV[2]);
return ERROR_INVALID_ARGUMENTS;
}
return ERROR_INVALID_ARGUMENTS;
}
- if (strcmp(args[3], "enable") == 0)
+ if (strcmp(CMD_ARGV[3], "enable") == 0)
tracemode |= ETMV1_BRANCH_OUTPUT;
tracemode |= ETMV1_BRANCH_OUTPUT;
- else if (strcmp(args[3], "disable") == 0)
+ else if (strcmp(CMD_ARGV[3], "disable") == 0)
- command_print(cmd_ctx, "invalid option '%s'", args[3]);
+ command_print(cmd_ctx, "invalid option '%s'", CMD_ARGV[3]);
return ERROR_INVALID_ARGUMENTS;
}
return ERROR_INVALID_ARGUMENTS;
}
if (CMD_ARGC != 5)
return ERROR_COMMAND_SYNTAX_ERROR;
if (CMD_ARGC != 5)
return ERROR_COMMAND_SYNTAX_ERROR;
- target = get_target(args[0]);
+ target = get_target(CMD_ARGV[0]);
- LOG_ERROR("target '%s' not defined", args[0]);
+ LOG_ERROR("target '%s' not defined", CMD_ARGV[0]);
* "normal full" ...
*/
uint8_t port_width;
* "normal full" ...
*/
uint8_t port_width;
- COMMAND_PARSE_NUMBER(u8, args[1], port_width);
+ COMMAND_PARSE_NUMBER(u8, CMD_ARGV[1], port_width);
switch (port_width)
{
/* before ETMv3.0 */
switch (port_width)
{
/* before ETMv3.0 */
break;
default:
command_print(cmd_ctx,
break;
default:
command_print(cmd_ctx,
- "unsupported ETM port width '%s'", args[1]);
+ "unsupported ETM port width '%s'", CMD_ARGV[1]);
- if (strcmp("normal", args[2]) == 0)
+ if (strcmp("normal", CMD_ARGV[2]) == 0)
{
portmode |= ETM_PORT_NORMAL;
}
{
portmode |= ETM_PORT_NORMAL;
}
- else if (strcmp("multiplexed", args[2]) == 0)
+ else if (strcmp("multiplexed", CMD_ARGV[2]) == 0)
{
portmode |= ETM_PORT_MUXED;
}
{
portmode |= ETM_PORT_MUXED;
}
- else if (strcmp("demultiplexed", args[2]) == 0)
+ else if (strcmp("demultiplexed", CMD_ARGV[2]) == 0)
{
portmode |= ETM_PORT_DEMUXED;
}
else
{
{
portmode |= ETM_PORT_DEMUXED;
}
else
{
- command_print(cmd_ctx, "unsupported ETM port mode '%s', must be 'normal', 'multiplexed' or 'demultiplexed'", args[2]);
+ command_print(cmd_ctx, "unsupported ETM port mode '%s', must be 'normal', 'multiplexed' or 'demultiplexed'", CMD_ARGV[2]);
- if (strcmp("half", args[3]) == 0)
+ if (strcmp("half", CMD_ARGV[3]) == 0)
{
portmode |= ETM_PORT_HALF_CLOCK;
}
{
portmode |= ETM_PORT_HALF_CLOCK;
}
- else if (strcmp("full", args[3]) == 0)
+ else if (strcmp("full", CMD_ARGV[3]) == 0)
{
portmode |= ETM_PORT_FULL_CLOCK;
}
else
{
{
portmode |= ETM_PORT_FULL_CLOCK;
}
else
{
- command_print(cmd_ctx, "unsupported ETM port clocking '%s', must be 'full' or 'half'", args[3]);
+ command_print(cmd_ctx, "unsupported ETM port clocking '%s', must be 'full' or 'half'", CMD_ARGV[3]);
for (i = 0; etm_capture_drivers[i]; i++)
{
for (i = 0; etm_capture_drivers[i]; i++)
{
- if (strcmp(args[4], etm_capture_drivers[i]->name) == 0)
+ if (strcmp(CMD_ARGV[4], etm_capture_drivers[i]->name) == 0)
{
int retval;
if ((retval = etm_capture_drivers[i]->register_commands(cmd_ctx)) != ERROR_OK)
{
int retval;
if ((retval = etm_capture_drivers[i]->register_commands(cmd_ctx)) != ERROR_OK)
{
/* no supported capture driver found, don't register an ETM */
free(etm_ctx);
{
/* no supported capture driver found, don't register an ETM */
free(etm_ctx);
- LOG_ERROR("trace capture driver '%s' not found", args[4]);
+ LOG_ERROR("trace capture driver '%s' not found", CMD_ARGV[4]);
if (CMD_ARGC >= 2)
{
etm_ctx->image->base_address_set = 1;
if (CMD_ARGC >= 2)
{
etm_ctx->image->base_address_set = 1;
- COMMAND_PARSE_NUMBER(int, args[1], etm_ctx->image->base_address);
+ COMMAND_PARSE_NUMBER(int, CMD_ARGV[1], etm_ctx->image->base_address);
}
else
{
etm_ctx->image->base_address_set = 0;
}
}
else
{
etm_ctx->image->base_address_set = 0;
}
- if (image_open(etm_ctx->image, args[0], (CMD_ARGC >= 3) ? args[2] : NULL) != ERROR_OK)
+ if (image_open(etm_ctx->image, CMD_ARGV[0], (CMD_ARGC >= 3) ? CMD_ARGV[2] : NULL) != ERROR_OK)
{
free(etm_ctx->image);
etm_ctx->image = NULL;
{
free(etm_ctx->image);
etm_ctx->image = NULL;
if (etm_ctx->trace_depth == 0)
etm_ctx->capture_driver->read_trace(etm_ctx);
if (etm_ctx->trace_depth == 0)
etm_ctx->capture_driver->read_trace(etm_ctx);
- if (fileio_open(&file, args[0], FILEIO_WRITE, FILEIO_BINARY) != ERROR_OK)
+ if (fileio_open(&file, CMD_ARGV[0], FILEIO_WRITE, FILEIO_BINARY) != ERROR_OK)
- if (fileio_open(&file, args[0], FILEIO_READ, FILEIO_BINARY) != ERROR_OK)
+ if (fileio_open(&file, CMD_ARGV[0], FILEIO_READ, FILEIO_BINARY) != ERROR_OK)
if (CMD_ARGC > 0)
{
uint32_t new_value;
if (CMD_ARGC > 0)
{
uint32_t new_value;
- COMMAND_PARSE_NUMBER(u32, args[0], new_value);
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], new_value);
if ((new_value < 2) || (new_value > 100))
{
if ((new_value < 2) || (new_value > 100))
{
struct target *target;
struct arm *arm;
struct target *target;
struct arm *arm;
- target = get_target(args[0]);
+ target = get_target(CMD_ARGV[0]);
- LOG_ERROR("target '%s' not defined", args[0]);
+ LOG_ERROR("target '%s' not defined", CMD_ARGV[0]);
return ERROR_FAIL;
}
arm = target_to_arm(target);
if (!is_arm(arm))
{
return ERROR_FAIL;
}
arm = target_to_arm(target);
if (!is_arm(arm))
{
- command_print(cmd_ctx, "target '%s' isn't an ARM", args[0]);
+ command_print(cmd_ctx, "target '%s' isn't an ARM", CMD_ARGV[0]);
oocd_trace->etm_ctx = arm->etm;
/* copy name of TTY device used to communicate with OpenOCD + trace */
oocd_trace->etm_ctx = arm->etm;
/* copy name of TTY device used to communicate with OpenOCD + trace */
- oocd_trace->tty = strndup(args[1], 256);
+ oocd_trace->tty = strndup(CMD_ARGV[1], 256);
- target = get_target(args[0]);
+ target = get_target(CMD_ARGV[0]);
- command_print(cmd_ctx,"Target: %s is unknown, try one of:\n", args[0]);
+ command_print(cmd_ctx,"Target: %s is unknown, try one of:\n", CMD_ARGV[0]);
goto DumpTargets;
}
if (!target->tap->enabled) {
goto DumpTargets;
}
if (!target->tap->enabled) {
}
/* access a single register by its ordinal number */
}
/* access a single register by its ordinal number */
- if ((args[0][0] >= '0') && (args[0][0] <= '9'))
+ if ((CMD_ARGV[0][0] >= '0') && (CMD_ARGV[0][0] <= '9'))
- COMMAND_PARSE_NUMBER(uint, args[0], num);
+ COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], num);
struct reg_cache *cache = target->reg_cache;
count = 0;
struct reg_cache *cache = target->reg_cache;
count = 0;
}
} else /* access a single register by its name */
{
}
} else /* access a single register by its name */
{
- reg = register_get_by_name(target->reg_cache, args[0], 1);
+ reg = register_get_by_name(target->reg_cache, CMD_ARGV[0], 1);
- command_print(cmd_ctx, "register %s not found in current target", args[0]);
+ command_print(cmd_ctx, "register %s not found in current target", CMD_ARGV[0]);
return ERROR_OK;
}
}
/* display a register */
return ERROR_OK;
}
}
/* display a register */
- if ((CMD_ARGC == 1) || ((CMD_ARGC == 2) && !((args[1][0] >= '0') && (args[1][0] <= '9'))))
+ if ((CMD_ARGC == 1) || ((CMD_ARGC == 2) && !((CMD_ARGV[1][0] >= '0') && (CMD_ARGV[1][0] <= '9'))))
- if ((CMD_ARGC == 2) && (strcmp(args[1], "force") == 0))
+ if ((CMD_ARGC == 2) && (strcmp(CMD_ARGV[1], "force") == 0))
reg->valid = 0;
if (reg->valid == 0)
reg->valid = 0;
if (reg->valid == 0)
if (CMD_ARGC == 2)
{
uint8_t *buf = malloc(DIV_ROUND_UP(reg->size, 8));
if (CMD_ARGC == 2)
{
uint8_t *buf = malloc(DIV_ROUND_UP(reg->size, 8));
- str_to_buf(args[1], strlen(args[1]), buf, reg->size, 0);
+ str_to_buf(CMD_ARGV[1], strlen(CMD_ARGV[1]), buf, reg->size, 0);
reg->type->set(reg, buf);
reg->type->set(reg, buf);
}
else if (CMD_ARGC == 1)
{
}
else if (CMD_ARGC == 1)
{
- if (strcmp(args[0], "on") == 0)
+ if (strcmp(CMD_ARGV[0], "on") == 0)
{
jtag_poll_set_enabled(true);
}
{
jtag_poll_set_enabled(true);
}
- else if (strcmp(args[0], "off") == 0)
+ else if (strcmp(CMD_ARGV[0], "off") == 0)
{
jtag_poll_set_enabled(false);
}
{
jtag_poll_set_enabled(false);
}
unsigned ms = 5000;
if (1 == CMD_ARGC)
{
unsigned ms = 5000;
if (1 == CMD_ARGC)
{
- int retval = parse_uint(args[0], &ms);
+ int retval = parse_uint(CMD_ARGV[0], &ms);
if (ERROR_OK != retval)
{
command_print(cmd_ctx, "usage: %s [seconds]", CMD_NAME);
if (ERROR_OK != retval)
{
command_print(cmd_ctx, "usage: %s [seconds]", CMD_NAME);
if (CMD_ARGC == 1)
{
unsigned wait;
if (CMD_ARGC == 1)
{
unsigned wait;
- retval = parse_uint(args[0], &wait);
+ retval = parse_uint(CMD_ARGV[0], &wait);
if (ERROR_OK != retval)
return ERROR_COMMAND_SYNTAX_ERROR;
if (!wait)
if (ERROR_OK != retval)
return ERROR_COMMAND_SYNTAX_ERROR;
if (!wait)
if (CMD_ARGC == 1)
{
const Jim_Nvp *n;
if (CMD_ARGC == 1)
{
const Jim_Nvp *n;
- n = Jim_Nvp_name2value_simple(nvp_reset_modes, args[0]);
+ n = Jim_Nvp_name2value_simple(nvp_reset_modes, CMD_ARGV[0]);
if ((n->name == NULL) || (n->value == RESET_UNKNOWN)) {
return ERROR_COMMAND_SYNTAX_ERROR;
}
if ((n->name == NULL) || (n->value == RESET_UNKNOWN)) {
return ERROR_COMMAND_SYNTAX_ERROR;
}
struct target *target = get_current_target(cmd_ctx);
target_handle_event(target, TARGET_EVENT_OLD_pre_resume);
struct target *target = get_current_target(cmd_ctx);
target_handle_event(target, TARGET_EVENT_OLD_pre_resume);
- /* with no args, resume from current pc, addr = 0,
- * with one arguments, addr = args[0],
+ /* with no CMD_ARGV, resume from current pc, addr = 0,
+ * with one arguments, addr = CMD_ARGV[0],
* handle breakpoints, not debugging */
uint32_t addr = 0;
if (CMD_ARGC == 1)
{
* handle breakpoints, not debugging */
uint32_t addr = 0;
if (CMD_ARGC == 1)
{
- COMMAND_PARSE_NUMBER(u32, args[0], addr);
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], addr);
- /* with no args, step from current pc, addr = 0,
- * with one argument addr = args[0],
+ /* with no CMD_ARGV, step from current pc, addr = 0,
+ * with one argument addr = CMD_ARGV[0],
* handle breakpoints, debugging */
uint32_t addr = 0;
int current_pc = 1;
if (CMD_ARGC == 1)
{
* handle breakpoints, debugging */
uint32_t addr = 0;
int current_pc = 1;
if (CMD_ARGC == 1)
{
- COMMAND_PARSE_NUMBER(u32, args[0], addr);
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], addr);
default: return ERROR_COMMAND_SYNTAX_ERROR;
}
default: return ERROR_COMMAND_SYNTAX_ERROR;
}
- bool physical=strcmp(args[0], "phys")==0;
+ bool physical=strcmp(CMD_ARGV[0], "phys")==0;
int (*fn)(struct target *target,
uint32_t address, uint32_t size, uint32_t count, uint8_t *buffer);
if (physical)
{
CMD_ARGC--;
int (*fn)(struct target *target,
uint32_t address, uint32_t size, uint32_t count, uint8_t *buffer);
if (physical)
{
CMD_ARGC--;
fn=target_read_phys_memory;
} else
{
fn=target_read_phys_memory;
} else
{
- COMMAND_PARSE_NUMBER(u32, args[0], address);
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], address);
unsigned count = 1;
if (CMD_ARGC == 2)
unsigned count = 1;
if (CMD_ARGC == 2)
- COMMAND_PARSE_NUMBER(uint, args[1], count);
+ COMMAND_PARSE_NUMBER(uint, CMD_ARGV[1], count);
uint8_t *buffer = calloc(count, size);
uint8_t *buffer = calloc(count, size);
{
return ERROR_COMMAND_SYNTAX_ERROR;
}
{
return ERROR_COMMAND_SYNTAX_ERROR;
}
- bool physical=strcmp(args[0], "phys")==0;
+ bool physical=strcmp(CMD_ARGV[0], "phys")==0;
int (*fn)(struct target *target,
uint32_t address, uint32_t size, uint32_t count, uint8_t *buffer);
const char *cmd_name = CMD_NAME;
if (physical)
{
CMD_ARGC--;
int (*fn)(struct target *target,
uint32_t address, uint32_t size, uint32_t count, uint8_t *buffer);
const char *cmd_name = CMD_NAME;
if (physical)
{
CMD_ARGC--;
fn=target_write_phys_memory;
} else
{
fn=target_write_phys_memory;
} else
{
return ERROR_COMMAND_SYNTAX_ERROR;
uint32_t address;
return ERROR_COMMAND_SYNTAX_ERROR;
uint32_t address;
- COMMAND_PARSE_NUMBER(u32, args[0], address);
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], address);
- COMMAND_PARSE_NUMBER(u32, args[1], value);
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[1], value);
unsigned count = 1;
if (CMD_ARGC == 3)
unsigned count = 1;
if (CMD_ARGC == 3)
- COMMAND_PARSE_NUMBER(uint, args[2], count);
+ COMMAND_PARSE_NUMBER(uint, CMD_ARGV[2], count);
struct target *target = get_current_target(cmd_ctx);
unsigned wordsize;
struct target *target = get_current_target(cmd_ctx);
unsigned wordsize;
-static COMMAND_HELPER(parse_load_image_command_args, struct image *image,
+static COMMAND_HELPER(parse_load_image_command_CMD_ARGV, struct image *image,
uint32_t *min_address, uint32_t *max_address)
{
if (CMD_ARGC < 1 || CMD_ARGC > 5)
uint32_t *min_address, uint32_t *max_address)
{
if (CMD_ARGC < 1 || CMD_ARGC > 5)
if (CMD_ARGC >= 2)
{
uint32_t addr;
if (CMD_ARGC >= 2)
{
uint32_t addr;
- COMMAND_PARSE_NUMBER(u32, args[1], addr);
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[1], addr);
image->base_address = addr;
image->base_address_set = 1;
}
image->base_address = addr;
image->base_address_set = 1;
}
- COMMAND_PARSE_NUMBER(u32, args[3], *min_address);
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[3], *min_address);
- COMMAND_PARSE_NUMBER(u32, args[4], *max_address);
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[4], *max_address);
// use size (given) to find max (required)
*max_address += *min_address;
}
// use size (given) to find max (required)
*max_address += *min_address;
}
int i;
struct image image;
int i;
struct image image;
- int retval = CALL_COMMAND_HANDLER(parse_load_image_command_args,
+ int retval = CALL_COMMAND_HANDLER(parse_load_image_command_CMD_ARGV,
&image, &min_address, &max_address);
if (ERROR_OK != retval)
return retval;
&image, &min_address, &max_address);
if (ERROR_OK != retval)
return retval;
struct duration bench;
duration_start(&bench);
struct duration bench;
duration_start(&bench);
- if (image_open(&image, args[0], (CMD_ARGC >= 3) ? args[2] : NULL) != ERROR_OK)
+ if (image_open(&image, CMD_ARGV[0], (CMD_ARGC >= 3) ? CMD_ARGV[2] : NULL) != ERROR_OK)
- COMMAND_PARSE_NUMBER(u32, args[1], address);
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[1], address);
- COMMAND_PARSE_NUMBER(u32, args[2], size);
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[2], size);
- if (fileio_open(&fileio, args[0], FILEIO_WRITE, FILEIO_BINARY) != ERROR_OK)
+ if (fileio_open(&fileio, CMD_ARGV[0], FILEIO_WRITE, FILEIO_BINARY) != ERROR_OK)
if (CMD_ARGC >= 2)
{
uint32_t addr;
if (CMD_ARGC >= 2)
{
uint32_t addr;
- COMMAND_PARSE_NUMBER(u32, args[1], addr);
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[1], addr);
image.base_address = addr;
image.base_address_set = 1;
}
image.base_address = addr;
image.base_address_set = 1;
}
image.start_address_set = 0;
image.start_address_set = 0;
- if ((retval = image_open(&image, args[0], (CMD_ARGC == 3) ? args[2] : NULL)) != ERROR_OK)
+ if ((retval = image_open(&image, CMD_ARGV[0], (CMD_ARGC == 3) ? CMD_ARGV[2] : NULL)) != ERROR_OK)
- COMMAND_PARSE_NUMBER(u32, args[0], addr);
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], addr);
- COMMAND_PARSE_NUMBER(u32, args[1], length);
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[1], length);
int hw = BKPT_SOFT;
if (CMD_ARGC == 3)
{
int hw = BKPT_SOFT;
if (CMD_ARGC == 3)
{
- if (strcmp(args[2], "hw") == 0)
+ if (strcmp(CMD_ARGV[2], "hw") == 0)
hw = BKPT_HARD;
else
return ERROR_COMMAND_SYNTAX_ERROR;
hw = BKPT_HARD;
else
return ERROR_COMMAND_SYNTAX_ERROR;
return ERROR_COMMAND_SYNTAX_ERROR;
uint32_t addr;
return ERROR_COMMAND_SYNTAX_ERROR;
uint32_t addr;
- COMMAND_PARSE_NUMBER(u32, args[0], addr);
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], addr);
struct target *target = get_current_target(cmd_ctx);
breakpoint_remove(target, addr);
struct target *target = get_current_target(cmd_ctx);
breakpoint_remove(target, addr);
switch (CMD_ARGC)
{
case 5:
switch (CMD_ARGC)
{
case 5:
- COMMAND_PARSE_NUMBER(u32, args[4], data_mask);
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[4], data_mask);
- COMMAND_PARSE_NUMBER(u32, args[3], data_value);
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[3], data_value);
+ switch (CMD_ARGV[2][0])
{
case 'r':
type = WPT_READ;
{
case 'r':
type = WPT_READ;
type = WPT_ACCESS;
break;
default:
type = WPT_ACCESS;
break;
default:
- LOG_ERROR("invalid watchpoint mode ('%c')", args[2][0]);
+ LOG_ERROR("invalid watchpoint mode ('%c')", CMD_ARGV[2][0]);
return ERROR_COMMAND_SYNTAX_ERROR;
}
// fall through
case 2:
return ERROR_COMMAND_SYNTAX_ERROR;
}
// fall through
case 2:
- COMMAND_PARSE_NUMBER(u32, args[1], length);
- COMMAND_PARSE_NUMBER(u32, args[0], addr);
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[1], length);
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], addr);
return ERROR_COMMAND_SYNTAX_ERROR;
uint32_t addr;
return ERROR_COMMAND_SYNTAX_ERROR;
uint32_t addr;
- COMMAND_PARSE_NUMBER(u32, args[0], addr);
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], addr);
struct target *target = get_current_target(cmd_ctx);
watchpoint_remove(target, addr);
struct target *target = get_current_target(cmd_ctx);
watchpoint_remove(target, addr);
return ERROR_COMMAND_SYNTAX_ERROR;
uint32_t va;
return ERROR_COMMAND_SYNTAX_ERROR;
uint32_t va;
- COMMAND_PARSE_NUMBER(u32, args[0], va);
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], va);
uint32_t pa;
struct target *target = get_current_target(cmd_ctx);
uint32_t pa;
struct target *target = get_current_target(cmd_ctx);
return ERROR_COMMAND_SYNTAX_ERROR;
}
unsigned offset;
return ERROR_COMMAND_SYNTAX_ERROR;
}
unsigned offset;
- COMMAND_PARSE_NUMBER(uint, args[0], offset);
+ COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], offset);
timeval_add_time(&timeout, offset, 0);
timeval_add_time(&timeout, offset, 0);
free(samples);
return retval;
}
free(samples);
return retval;
}
- writeGmon(samples, numSamples, args[1]);
- command_print(cmd_ctx, "Wrote %s", args[1]);
+ writeGmon(samples, numSamples, CMD_ARGV[1]);
+ command_print(cmd_ctx, "Wrote %s", CMD_ARGV[1]);
- int retval = CALL_COMMAND_HANDLER(parse_load_image_command_args,
+ int retval = CALL_COMMAND_HANDLER(parse_load_image_command_CMD_ARGV,
&image, &min_address, &max_address);
if (ERROR_OK != retval)
return retval;
&image, &min_address, &max_address);
if (ERROR_OK != retval)
return retval;
struct duration bench;
duration_start(&bench);
struct duration bench;
duration_start(&bench);
- if (image_open(&image, args[0], (CMD_ARGC >= 3) ? args[2] : NULL) != ERROR_OK)
+ if (image_open(&image, CMD_ARGV[0], (CMD_ARGC >= 3) ? CMD_ARGV[2] : NULL) != ERROR_OK)
register_command(cmd_ctx, NULL, "fast_load_image",
handle_fast_load_image_command, COMMAND_ANY,
register_command(cmd_ctx, NULL, "fast_load_image",
handle_fast_load_image_command, COMMAND_ANY,
- "same args as load_image, image stored in memory "
+ "same CMD_ARGV as load_image, image stored in memory "
"- mainly for profiling purposes");
register_command(cmd_ctx, NULL, "fast_load",
"- mainly for profiling purposes");
register_command(cmd_ctx, NULL, "fast_load",
- if (!strcmp(args[0], "enable") || !strcmp(args[0], "charmsg"))
+ if (!strcmp(CMD_ARGV[0], "enable") || !strcmp(CMD_ARGV[0], "charmsg"))
{
/* don't register if this command context is already receiving */
if (!receiving)
{
/* don't register if this command context is already receiving */
if (!receiving)
receiving = 1;
add_debug_msg_receiver(cmd_ctx, target);
}
receiving = 1;
add_debug_msg_receiver(cmd_ctx, target);
}
- charmsg_mode = !strcmp(args[0], "charmsg");
+ charmsg_mode = !strcmp(CMD_ARGV[0], "charmsg");
- else if (!strcmp(args[0], "disable"))
+ else if (!strcmp(CMD_ARGV[0], "disable"))
{
/* no need to delete a receiver if none is registered */
if (receiving)
{
/* no need to delete a receiver if none is registered */
if (receiving)
- if (!strcmp(args[0], "clear"))
+ if (!strcmp(CMD_ARGV[0], "clear"))
{
if (trace->trace_points)
{
{
if (trace->trace_points)
{
- COMMAND_PARSE_NUMBER(u32, args[0], address);
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], address);
trace->trace_points[trace->num_trace_points].address = address;
trace->trace_points[trace->num_trace_points].hit_counter = 0;
trace->num_trace_points++;
trace->trace_points[trace->num_trace_points].address = address;
trace->trace_points[trace->num_trace_points].hit_counter = 0;
trace->num_trace_points++;
trace->trace_history_pos = 0;
trace->trace_history_overflowed = 0;
trace->trace_history_pos = 0;
trace->trace_history_overflowed = 0;
- if (!strcmp(args[0], "clear"))
+ if (!strcmp(CMD_ARGV[0], "clear"))
{
/* clearing is implicit, we've just reset position anyway */
return ERROR_OK;
{
/* clearing is implicit, we've just reset position anyway */
return ERROR_OK;
if (trace->trace_history)
free(trace->trace_history);
if (trace->trace_history)
free(trace->trace_history);
- COMMAND_PARSE_NUMBER(u32, args[0], trace->trace_history_size);
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], trace->trace_history_size);
trace->trace_history = malloc(sizeof(uint32_t) * trace->trace_history_size);
command_print(cmd_ctx, "new trace history size: %i", (int)(trace->trace_history_size));
trace->trace_history = malloc(sizeof(uint32_t) * trace->trace_history_size);
command_print(cmd_ctx, "new trace history size: %i", (int)(trace->trace_history_size));
- if ((target = get_target(args[0])) == NULL)
+ if ((target = get_target(CMD_ARGV[0])) == NULL)
- LOG_ERROR("target '%s' not defined", args[0]);
+ LOG_ERROR("target '%s' not defined", CMD_ARGV[0]);
if (retval != ERROR_OK)
return retval;
if (retval != ERROR_OK)
return retval;
- COMMAND_PARSE_NUMBER(u32, args[1], handler_address);
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[1], handler_address);
if (((handler_address >= 0x800) && (handler_address <= 0x1fef800)) ||
((handler_address >= 0xfe000800) && (handler_address <= 0xfffff800)))
if (((handler_address >= 0x800) && (handler_address <= 0x1fef800)) ||
((handler_address >= 0xfe000800) && (handler_address <= 0xfffff800)))
return ERROR_COMMAND_SYNTAX_ERROR;
}
return ERROR_COMMAND_SYNTAX_ERROR;
}
- target = get_target(args[0]);
+ target = get_target(CMD_ARGV[0]);
- LOG_ERROR("target '%s' not defined", args[0]);
+ LOG_ERROR("target '%s' not defined", CMD_ARGV[0]);
return ERROR_FAIL;
}
xscale = target_to_xscale(target);
return ERROR_FAIL;
}
xscale = target_to_xscale(target);
if (retval != ERROR_OK)
return retval;
if (retval != ERROR_OK)
return retval;
- COMMAND_PARSE_NUMBER(u32, args[1], cache_clean_address);
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[1], cache_clean_address);
if (cache_clean_address & 0xffff)
{
if (cache_clean_address & 0xffff)
{
- if (strcmp("enable", args[0]) == 0)
+ if (strcmp("enable", CMD_ARGV[0]) == 0)
{
xscale_enable_mmu_caches(target, 1, 0, 0);
xscale->armv4_5_mmu.mmu_enabled = 1;
}
{
xscale_enable_mmu_caches(target, 1, 0, 0);
xscale->armv4_5_mmu.mmu_enabled = 1;
}
- else if (strcmp("disable", args[0]) == 0)
+ else if (strcmp("disable", CMD_ARGV[0]) == 0)
{
xscale_disable_mmu_caches(target, 1, 0, 0);
xscale->armv4_5_mmu.mmu_enabled = 0;
{
xscale_disable_mmu_caches(target, 1, 0, 0);
xscale->armv4_5_mmu.mmu_enabled = 0;
- if (strcmp("enable", args[0]) == 0)
+ if (strcmp("enable", CMD_ARGV[0]) == 0)
{
xscale_enable_mmu_caches(target, 0, dcache, icache);
{
xscale_enable_mmu_caches(target, 0, dcache, icache);
else if (dcache)
xscale->armv4_5_mmu.armv4_5_cache.d_u_cache_enabled = 1;
}
else if (dcache)
xscale->armv4_5_mmu.armv4_5_cache.d_u_cache_enabled = 1;
}
- else if (strcmp("disable", args[0]) == 0)
+ else if (strcmp("disable", CMD_ARGV[0]) == 0)
{
xscale_disable_mmu_caches(target, 0, dcache, icache);
{
xscale_disable_mmu_caches(target, 0, dcache, icache);
- COMMAND_PARSE_NUMBER(u8, args[0], xscale->vector_catch);
+ COMMAND_PARSE_NUMBER(u8, CMD_ARGV[0], xscale->vector_catch);
buf_set_u32(xscale->reg_cache->reg_list[XSCALE_DCSR].value, 16, 8, xscale->vector_catch);
xscale_write_dcsr(target, -1, -1);
}
buf_set_u32(xscale->reg_cache->reg_list[XSCALE_DCSR].value, 16, 8, xscale->vector_catch);
xscale_write_dcsr(target, -1, -1);
}
- COMMAND_PARSE_NUMBER(int, args[1], idx);
+ COMMAND_PARSE_NUMBER(int, CMD_ARGV[1], idx);
- COMMAND_PARSE_NUMBER(u32, args[2], vec);
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[2], vec);
if (idx < 1 || idx >= 8)
err = 1;
if (idx < 1 || idx >= 8)
err = 1;
- if (!err && strcmp(args[0], "low") == 0)
+ if (!err && strcmp(CMD_ARGV[0], "low") == 0)
{
xscale->static_low_vectors_set |= (1<<idx);
xscale->static_low_vectors[idx] = vec;
}
{
xscale->static_low_vectors_set |= (1<<idx);
xscale->static_low_vectors[idx] = vec;
}
- else if (!err && (strcmp(args[0], "high") == 0))
+ else if (!err && (strcmp(CMD_ARGV[0], "high") == 0))
{
xscale->static_high_vectors_set |= (1<<idx);
xscale->static_high_vectors[idx] = vec;
{
xscale->static_high_vectors_set |= (1<<idx);
xscale->static_high_vectors[idx] = vec;
- if ((CMD_ARGC >= 1) && (strcmp("enable", args[0]) == 0))
+ if ((CMD_ARGC >= 1) && (strcmp("enable", CMD_ARGV[0]) == 0))
{
struct xscale_trace_data *td, *next_td;
xscale->trace.buffer_enabled = 1;
{
struct xscale_trace_data *td, *next_td;
xscale->trace.buffer_enabled = 1;
}
xscale->trace.data = NULL;
}
}
xscale->trace.data = NULL;
}
- else if ((CMD_ARGC >= 1) && (strcmp("disable", args[0]) == 0))
+ else if ((CMD_ARGC >= 1) && (strcmp("disable", CMD_ARGV[0]) == 0))
{
xscale->trace.buffer_enabled = 0;
}
{
xscale->trace.buffer_enabled = 0;
}
- if ((CMD_ARGC >= 2) && (strcmp("fill", args[1]) == 0))
+ if ((CMD_ARGC >= 2) && (strcmp("fill", CMD_ARGV[1]) == 0))
{
uint32_t fill = 1;
if (CMD_ARGC >= 3)
{
uint32_t fill = 1;
if (CMD_ARGC >= 3)
- COMMAND_PARSE_NUMBER(u32, args[2], fill);
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[2], fill);
xscale->trace.buffer_fill = fill;
}
xscale->trace.buffer_fill = fill;
}
- else if ((CMD_ARGC >= 2) && (strcmp("wrap", args[1]) == 0))
+ else if ((CMD_ARGC >= 2) && (strcmp("wrap", CMD_ARGV[1]) == 0))
{
xscale->trace.buffer_fill = -1;
}
{
xscale->trace.buffer_fill = -1;
}
if (CMD_ARGC >= 2)
{
xscale->trace.image->base_address_set = 1;
if (CMD_ARGC >= 2)
{
xscale->trace.image->base_address_set = 1;
- COMMAND_PARSE_NUMBER(int, args[1], xscale->trace.image->base_address);
+ COMMAND_PARSE_NUMBER(int, CMD_ARGV[1], xscale->trace.image->base_address);
}
else
{
xscale->trace.image->base_address_set = 0;
}
}
else
{
xscale->trace.image->base_address_set = 0;
}
- if (image_open(xscale->trace.image, args[0], (CMD_ARGC >= 3) ? args[2] : NULL) != ERROR_OK)
+ if (image_open(xscale->trace.image, CMD_ARGV[0], (CMD_ARGC >= 3) ? CMD_ARGV[2] : NULL) != ERROR_OK)
{
free(xscale->trace.image);
xscale->trace.image = NULL;
{
free(xscale->trace.image);
xscale->trace.image = NULL;
- if (fileio_open(&file, args[0], FILEIO_WRITE, FILEIO_BINARY) != ERROR_OK)
+ if (fileio_open(&file, CMD_ARGV[0], FILEIO_WRITE, FILEIO_BINARY) != ERROR_OK)
struct reg *reg = NULL;
if (CMD_ARGC > 0)
{
struct reg *reg = NULL;
if (CMD_ARGC > 0)
{
- COMMAND_PARSE_NUMBER(u32, args[0], reg_no);
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], reg_no);
/*translate from xscale cp15 register no to openocd register*/
switch (reg_no)
{
/*translate from xscale cp15 register no to openocd register*/
switch (reg_no)
{
else if (CMD_ARGC == 2)
{
uint32_t value;
else if (CMD_ARGC == 2)
{
uint32_t value;
- COMMAND_PARSE_NUMBER(u32, args[1], value);
+ COMMAND_PARSE_NUMBER(u32, CMD_ARGV[1], value);
/* send CP write request (command 0x41) */
xscale_send_u32(target, 0x41);
/* send CP write request (command 0x41) */
xscale_send_u32(target, 0x41);
- /* we mess with args starting point below, snapshot filename here */
- const char *filename = args[1];
+ /* we mess with CMD_ARGV starting point below, snapshot filename here */
+ const char *filename = CMD_ARGV[1];
- if (strcmp(args[0], "plain") != 0)
+ if (strcmp(CMD_ARGV[0], "plain") != 0)
- tap = jtag_tap_by_string(args[0]);
+ tap = jtag_tap_by_string(CMD_ARGV[0]);
- command_print(cmd_ctx, "Tap: %s unknown", args[0]);
+ command_print(cmd_ctx, "Tap: %s unknown", CMD_ARGV[0]);
}
/* if this argument is present, then interpret xruntest counts as TCK cycles rather than as usecs */
}
/* if this argument is present, then interpret xruntest counts as TCK cycles rather than as usecs */
- if ((CMD_ARGC > 2) && (strcmp(args[2], "virt2") == 0))
+ if ((CMD_ARGC > 2) && (strcmp(CMD_ARGV[2], "virt2") == 0))
{
runtest_requires_tck = 1;
--CMD_ARGC;
{
runtest_requires_tck = 1;
--CMD_ARGC;
- if ((CMD_ARGC > 2) && (strcmp(args[2], "quiet") == 0))
+ if ((CMD_ARGC > 2) && (strcmp(CMD_ARGV[2], "quiet") == 0))
Linking to existing account procedure
If you already have an account and want to add another login method
you
MUST first sign in with your existing account and
then change URL to read
https://review.openocd.org/login/?link
to get to this page again but this time it'll work for linking. Thank you.
SSH host keys fingerprints
1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=.. |
|+o.. . |
|*.o . . |
|+B . . . |
|Bo. = o S |
|Oo.+ + = |
|oB=.* = . o |
| =+=.+ + E |
|. .=o . o |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)