mirror of
https://github.com/linux-msm/openocd.git
synced 2026-02-25 13:15:07 -08:00
- Replace '){' with ') {'.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2378 b42882b7-edfa-0310-969c-e2dbd0fdcd60
This commit is contained in:
@@ -273,7 +273,7 @@ static int str7x_erase(struct flash_bank_s *bank, int first, int last)
|
||||
cmd = FLASH_SER | FLASH_WMS;
|
||||
target_write_u32(target, str7x_get_flash_adr(bank, FLASH_CR0), cmd);
|
||||
|
||||
while (((retval = str7x_status(bank)) & str7x_info->busy_bits)){
|
||||
while (((retval = str7x_status(bank)) & str7x_info->busy_bits)) {
|
||||
alive_sleep(1);
|
||||
}
|
||||
|
||||
@@ -329,7 +329,7 @@ static int str7x_protect(struct flash_bank_s *bank, int set, int first, int last
|
||||
cmd = FLASH_SPR | FLASH_WMS;
|
||||
target_write_u32(target, str7x_get_flash_adr(bank, FLASH_CR0), cmd);
|
||||
|
||||
while (((retval = str7x_status(bank)) & str7x_info->busy_bits)){
|
||||
while (((retval = str7x_status(bank)) & str7x_info->busy_bits)) {
|
||||
alive_sleep(1);
|
||||
}
|
||||
|
||||
|
||||
@@ -101,7 +101,7 @@ static int str9xpec_register_commands(struct command_context_s *cmd_ctx)
|
||||
|
||||
int str9xpec_set_instr(jtag_tap_t *tap, uint32_t new_instr, tap_state_t end_state)
|
||||
{
|
||||
if (tap == NULL){
|
||||
if (tap == NULL) {
|
||||
return ERROR_TARGET_INVALID;
|
||||
}
|
||||
|
||||
@@ -671,11 +671,11 @@ static int str9xpec_write(struct flash_bank_s *bank, uint8_t *buffer, uint32_t o
|
||||
check_address = sec_end;
|
||||
}
|
||||
|
||||
if ((offset >= sec_start) && (offset < sec_end)){
|
||||
if ((offset >= sec_start) && (offset < sec_end)) {
|
||||
first_sector = i;
|
||||
}
|
||||
|
||||
if ((offset + count >= sec_start) && (offset + count < sec_end)){
|
||||
if ((offset + count >= sec_start) && (offset + count < sec_end)) {
|
||||
last_sector = i;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -348,7 +348,7 @@ int unregister_command(command_context_t *context, char *name)
|
||||
|
||||
void command_output_text(command_context_t *context, const char *data)
|
||||
{
|
||||
if (context && context->output_handler && data){
|
||||
if (context && context->output_handler && data) {
|
||||
context->output_handler(context, data);
|
||||
}
|
||||
}
|
||||
|
||||
128
src/helper/jim.c
128
src/helper/jim.c
@@ -544,7 +544,7 @@ void Jim_Panic(Jim_Interp *interp, const char *fmt, ...)
|
||||
#endif
|
||||
|
||||
/* This may actually crash... we do it last */
|
||||
if (interp && interp->cookie_stderr){
|
||||
if (interp && interp->cookie_stderr) {
|
||||
Jim_fprintf(interp, interp->cookie_stderr, JIM_NL "JIM INTERPRETER PANIC: ");
|
||||
Jim_vfprintf(interp, interp->cookie_stderr, fmt, ap);
|
||||
Jim_fprintf(interp, interp->cookie_stderr, JIM_NL JIM_NL);
|
||||
@@ -2064,7 +2064,7 @@ void Jim_AppendString_sprintf(Jim_Interp *interp, Jim_Obj *objPtr, const char *f
|
||||
buf = jim_vasprintf(fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
if (buf){
|
||||
if (buf) {
|
||||
Jim_AppendString(interp, objPtr, buf, -1);
|
||||
jim_vasprintf_done(buf);
|
||||
}
|
||||
@@ -2283,10 +2283,10 @@ static Jim_Obj *Jim_FormatString_Inner(Jim_Interp *interp, Jim_Obj *fmtObjPtr,
|
||||
haveprec = 0;
|
||||
prec = -1; /* not found yet */
|
||||
next_fmt:
|
||||
if (fmtLen <= 0){
|
||||
if (fmtLen <= 0) {
|
||||
break;
|
||||
}
|
||||
switch (*fmt){
|
||||
switch (*fmt) {
|
||||
/* terminals */
|
||||
case 'b': /* binary - not all printfs() do this */
|
||||
case 's': /* string */
|
||||
@@ -2341,11 +2341,11 @@ static Jim_Obj *Jim_FormatString_Inner(Jim_Interp *interp, Jim_Obj *fmtObjPtr,
|
||||
case '8':
|
||||
case '9':
|
||||
accum = 0;
|
||||
while (isdigit(*fmt) && (fmtLen > 0)){
|
||||
while (isdigit(*fmt) && (fmtLen > 0)) {
|
||||
accum = (accum * 10) + (*fmt - '0');
|
||||
fmt++; fmtLen--;
|
||||
}
|
||||
if (inprec){
|
||||
if (inprec) {
|
||||
haveprec = 1;
|
||||
prec = accum;
|
||||
} else {
|
||||
@@ -2356,24 +2356,24 @@ static Jim_Obj *Jim_FormatString_Inner(Jim_Interp *interp, Jim_Obj *fmtObjPtr,
|
||||
/* suck up the next item as an integer */
|
||||
fmt++; fmtLen--;
|
||||
objc--;
|
||||
if (objc <= 0){
|
||||
if (objc <= 0) {
|
||||
goto not_enough_args;
|
||||
}
|
||||
if (Jim_GetWide(interp,objv[0],&wideValue)== JIM_ERR){
|
||||
if (Jim_GetWide(interp,objv[0],&wideValue)== JIM_ERR) {
|
||||
Jim_FreeNewObj(interp, resObjPtr);
|
||||
return NULL;
|
||||
}
|
||||
if (inprec){
|
||||
if (inprec) {
|
||||
haveprec = 1;
|
||||
prec = wideValue;
|
||||
if (prec < 0){
|
||||
if (prec < 0) {
|
||||
/* man 3 printf says */
|
||||
/* if prec is negative, it is zero */
|
||||
prec = 0;
|
||||
}
|
||||
} else {
|
||||
width = wideValue;
|
||||
if (width < 0){
|
||||
if (width < 0) {
|
||||
ljust = 1;
|
||||
width = -width;
|
||||
}
|
||||
@@ -2402,32 +2402,32 @@ static Jim_Obj *Jim_FormatString_Inner(Jim_Interp *interp, Jim_Obj *fmtObjPtr,
|
||||
*/
|
||||
cp = fmt_str;
|
||||
*cp++ = '%';
|
||||
if (altfm){
|
||||
if (altfm) {
|
||||
*cp++ = '#';
|
||||
}
|
||||
if (forceplus){
|
||||
if (forceplus) {
|
||||
*cp++ = '+';
|
||||
} else if (spad){
|
||||
} else if (spad) {
|
||||
/* PLUS overrides */
|
||||
*cp++ = ' ';
|
||||
}
|
||||
if (ljust){
|
||||
if (ljust) {
|
||||
*cp++ = '-';
|
||||
}
|
||||
if (zpad){
|
||||
if (zpad) {
|
||||
*cp++ = '0';
|
||||
}
|
||||
if (width > 0){
|
||||
if (width > 0) {
|
||||
sprintf(cp, "%d", width);
|
||||
/* skip ahead */
|
||||
cp = strchr(cp,0);
|
||||
}
|
||||
/* did we find a period? */
|
||||
if (inprec){
|
||||
if (inprec) {
|
||||
/* then add it */
|
||||
*cp++ = '.';
|
||||
/* did something occur after the period? */
|
||||
if (haveprec){
|
||||
if (haveprec) {
|
||||
sprintf(cp, "%d", prec);
|
||||
}
|
||||
cp = strchr(cp,0);
|
||||
@@ -2461,7 +2461,7 @@ static Jim_Obj *Jim_FormatString_Inner(Jim_Interp *interp, Jim_Obj *fmtObjPtr,
|
||||
case 'E':
|
||||
*cp++ = *fmt;
|
||||
*cp = 0;
|
||||
if (Jim_GetDouble(interp, objv[0], &doubleValue) == JIM_ERR){
|
||||
if (Jim_GetDouble(interp, objv[0], &doubleValue) == JIM_ERR) {
|
||||
Jim_FreeNewObj(interp, resObjPtr);
|
||||
return NULL;
|
||||
}
|
||||
@@ -2475,7 +2475,7 @@ static Jim_Obj *Jim_FormatString_Inner(Jim_Interp *interp, Jim_Obj *fmtObjPtr,
|
||||
case 'x':
|
||||
case 'X':
|
||||
/* jim widevaluse are 64bit */
|
||||
if (sizeof(jim_wide) == sizeof(long long)){
|
||||
if (sizeof(jim_wide) == sizeof(long long)) {
|
||||
*cp++ = 'l';
|
||||
*cp++ = 'l';
|
||||
} else {
|
||||
@@ -2627,12 +2627,12 @@ int Jim_GetNvp(Jim_Interp *interp,
|
||||
int e;
|
||||
|
||||
e = Jim_Nvp_name2value_obj(interp, nvp_table, objPtr, &n);
|
||||
if (e == JIM_ERR){
|
||||
if (e == JIM_ERR) {
|
||||
return e;
|
||||
}
|
||||
|
||||
/* Success? found? */
|
||||
if (n->name){
|
||||
if (n->name) {
|
||||
/* remove const */
|
||||
*result = (Jim_Nvp *)n;
|
||||
return JIM_OK;
|
||||
@@ -8894,7 +8894,7 @@ int Jim_Eval_Named(Jim_Interp *interp, const char *script, const char *filename,
|
||||
Jim_IncrRefCount(scriptObjPtr);
|
||||
|
||||
|
||||
if (filename){
|
||||
if (filename) {
|
||||
JimSetSourceInfo(interp, scriptObjPtr, filename, lineno);
|
||||
}
|
||||
|
||||
@@ -12412,7 +12412,7 @@ int Jim_fprintf(Jim_Interp *interp, void *cookie, const char *fmt, ...)
|
||||
|
||||
int Jim_vfprintf(Jim_Interp *interp, void *cookie, const char *fmt, va_list ap)
|
||||
{
|
||||
if ((interp == NULL) || (interp->cb_vfprintf == NULL)){
|
||||
if ((interp == NULL) || (interp->cb_vfprintf == NULL)) {
|
||||
errno = ENOTSUP;
|
||||
return -1;
|
||||
}
|
||||
@@ -12421,7 +12421,7 @@ int Jim_vfprintf(Jim_Interp *interp, void *cookie, const char *fmt, va_list ap)
|
||||
|
||||
size_t Jim_fwrite(Jim_Interp *interp, const void *ptr, size_t size, size_t n, void *cookie)
|
||||
{
|
||||
if ((interp == NULL) || (interp->cb_fwrite == NULL)){
|
||||
if ((interp == NULL) || (interp->cb_fwrite == NULL)) {
|
||||
errno = ENOTSUP;
|
||||
return 0;
|
||||
}
|
||||
@@ -12430,7 +12430,7 @@ size_t Jim_fwrite(Jim_Interp *interp, const void *ptr, size_t size, size_t n, vo
|
||||
|
||||
size_t Jim_fread(Jim_Interp *interp, void *ptr, size_t size, size_t n, void *cookie)
|
||||
{
|
||||
if ((interp == NULL) || (interp->cb_fread == NULL)){
|
||||
if ((interp == NULL) || (interp->cb_fread == NULL)) {
|
||||
errno = ENOTSUP;
|
||||
return 0;
|
||||
}
|
||||
@@ -12439,7 +12439,7 @@ size_t Jim_fread(Jim_Interp *interp, void *ptr, size_t size, size_t n, void *coo
|
||||
|
||||
int Jim_fflush(Jim_Interp *interp, void *cookie)
|
||||
{
|
||||
if ((interp == NULL) || (interp->cb_fflush == NULL)){
|
||||
if ((interp == NULL) || (interp->cb_fflush == NULL)) {
|
||||
/* pretend all is well */
|
||||
return 0;
|
||||
}
|
||||
@@ -12448,7 +12448,7 @@ int Jim_fflush(Jim_Interp *interp, void *cookie)
|
||||
|
||||
char* Jim_fgets(Jim_Interp *interp, char *s, int size, void *cookie)
|
||||
{
|
||||
if ((interp == NULL) || (interp->cb_fgets == NULL)){
|
||||
if ((interp == NULL) || (interp->cb_fgets == NULL)) {
|
||||
errno = ENOTSUP;
|
||||
return NULL;
|
||||
}
|
||||
@@ -12457,8 +12457,8 @@ char* Jim_fgets(Jim_Interp *interp, char *s, int size, void *cookie)
|
||||
Jim_Nvp *
|
||||
Jim_Nvp_name2value_simple(const Jim_Nvp *p, const char *name)
|
||||
{
|
||||
while (p->name){
|
||||
if (0 == strcmp(name, p->name)){
|
||||
while (p->name) {
|
||||
if (0 == strcmp(name, p->name)) {
|
||||
break;
|
||||
}
|
||||
p++;
|
||||
@@ -12469,8 +12469,8 @@ Jim_Nvp_name2value_simple(const Jim_Nvp *p, const char *name)
|
||||
Jim_Nvp *
|
||||
Jim_Nvp_name2value_nocase_simple(const Jim_Nvp *p, const char *name)
|
||||
{
|
||||
while (p->name){
|
||||
if (0 == strcasecmp(name, p->name)){
|
||||
while (p->name) {
|
||||
if (0 == strcasecmp(name, p->name)) {
|
||||
break;
|
||||
}
|
||||
p++;
|
||||
@@ -12499,12 +12499,12 @@ Jim_Nvp_name2value(Jim_Interp *interp,
|
||||
p = Jim_Nvp_name2value_simple(_p, name);
|
||||
|
||||
/* result */
|
||||
if (result){
|
||||
if (result) {
|
||||
*result = (Jim_Nvp *)(p);
|
||||
}
|
||||
|
||||
/* found? */
|
||||
if (p->name){
|
||||
if (p->name) {
|
||||
return JIM_OK;
|
||||
} else {
|
||||
return JIM_ERR;
|
||||
@@ -12524,11 +12524,11 @@ Jim_Nvp_name2value_nocase(Jim_Interp *interp, const Jim_Nvp *_p, const char *nam
|
||||
|
||||
p = Jim_Nvp_name2value_nocase_simple(_p, name);
|
||||
|
||||
if (puthere){
|
||||
if (puthere) {
|
||||
*puthere = (Jim_Nvp *)(p);
|
||||
}
|
||||
/* found */
|
||||
if (p->name){
|
||||
if (p->name) {
|
||||
return JIM_OK;
|
||||
} else {
|
||||
return JIM_ERR;
|
||||
@@ -12543,7 +12543,7 @@ Jim_Nvp_value2name_obj(Jim_Interp *interp, const Jim_Nvp *p, Jim_Obj *o, Jim_Nvp
|
||||
jim_wide w;
|
||||
|
||||
e = Jim_GetWide(interp, o, &w);
|
||||
if (e != JIM_OK){
|
||||
if (e != JIM_OK) {
|
||||
return e;
|
||||
}
|
||||
|
||||
@@ -12553,8 +12553,8 @@ Jim_Nvp_value2name_obj(Jim_Interp *interp, const Jim_Nvp *p, Jim_Obj *o, Jim_Nvp
|
||||
Jim_Nvp *
|
||||
Jim_Nvp_value2name_simple(const Jim_Nvp *p, int value)
|
||||
{
|
||||
while (p->name){
|
||||
if (value == p->value){
|
||||
while (p->name) {
|
||||
if (value == p->value) {
|
||||
break;
|
||||
}
|
||||
p++;
|
||||
@@ -12570,11 +12570,11 @@ Jim_Nvp_value2name(Jim_Interp *interp, const Jim_Nvp *_p, int value, Jim_Nvp **r
|
||||
|
||||
p = Jim_Nvp_value2name_simple(_p, value);
|
||||
|
||||
if (result){
|
||||
if (result) {
|
||||
*result = (Jim_Nvp *)(p);
|
||||
}
|
||||
|
||||
if (p->name){
|
||||
if (p->name) {
|
||||
return JIM_OK;
|
||||
} else {
|
||||
return JIM_ERR;
|
||||
@@ -12599,7 +12599,7 @@ Jim_GetOpt_Debug(Jim_GetOptInfo *p)
|
||||
int x;
|
||||
|
||||
Jim_fprintf(p->interp, p->interp->cookie_stderr, "---args---\n");
|
||||
for (x = 0 ; x < p->argc ; x++){
|
||||
for (x = 0 ; x < p->argc ; x++) {
|
||||
Jim_fprintf(p->interp, p->interp->cookie_stderr,
|
||||
"%2d) %s\n",
|
||||
x,
|
||||
@@ -12615,16 +12615,16 @@ Jim_GetOpt_Obj(Jim_GetOptInfo *goi, Jim_Obj **puthere)
|
||||
Jim_Obj *o;
|
||||
|
||||
o = NULL; // failure
|
||||
if (goi->argc){
|
||||
if (goi->argc) {
|
||||
// success
|
||||
o = goi->argv[0];
|
||||
goi->argc -= 1;
|
||||
goi->argv += 1;
|
||||
}
|
||||
if (puthere){
|
||||
if (puthere) {
|
||||
*puthere = o;
|
||||
}
|
||||
if (o != NULL){
|
||||
if (o != NULL) {
|
||||
return JIM_OK;
|
||||
} else {
|
||||
return JIM_ERR;
|
||||
@@ -12640,9 +12640,9 @@ Jim_GetOpt_String(Jim_GetOptInfo *goi, char **puthere, int *len)
|
||||
|
||||
|
||||
r = Jim_GetOpt_Obj(goi, &o);
|
||||
if (r == JIM_OK){
|
||||
if (r == JIM_OK) {
|
||||
cp = Jim_GetString(o, len);
|
||||
if (puthere){
|
||||
if (puthere) {
|
||||
/* remove const */
|
||||
*puthere = (char *)(cp);
|
||||
}
|
||||
@@ -12657,14 +12657,14 @@ Jim_GetOpt_Double(Jim_GetOptInfo *goi, double *puthere)
|
||||
Jim_Obj *o;
|
||||
double _safe;
|
||||
|
||||
if (puthere == NULL){
|
||||
if (puthere == NULL) {
|
||||
puthere = &_safe;
|
||||
}
|
||||
|
||||
r = Jim_GetOpt_Obj(goi, &o);
|
||||
if (r == JIM_OK){
|
||||
if (r == JIM_OK) {
|
||||
r = Jim_GetDouble(goi->interp, o, puthere);
|
||||
if (r != JIM_OK){
|
||||
if (r != JIM_OK) {
|
||||
Jim_SetResult_sprintf(goi->interp,
|
||||
"not a number: %s",
|
||||
Jim_GetString(o, NULL));
|
||||
@@ -12680,12 +12680,12 @@ Jim_GetOpt_Wide(Jim_GetOptInfo *goi, jim_wide *puthere)
|
||||
Jim_Obj *o;
|
||||
jim_wide _safe;
|
||||
|
||||
if (puthere == NULL){
|
||||
if (puthere == NULL) {
|
||||
puthere = &_safe;
|
||||
}
|
||||
|
||||
r = Jim_GetOpt_Obj(goi, &o);
|
||||
if (r == JIM_OK){
|
||||
if (r == JIM_OK) {
|
||||
r = Jim_GetWide(goi->interp, o, puthere);
|
||||
}
|
||||
return r;
|
||||
@@ -12699,12 +12699,12 @@ int Jim_GetOpt_Nvp(Jim_GetOptInfo *goi,
|
||||
Jim_Obj *o;
|
||||
int e;
|
||||
|
||||
if (puthere == NULL){
|
||||
if (puthere == NULL) {
|
||||
puthere = &_safe;
|
||||
}
|
||||
|
||||
e = Jim_GetOpt_Obj(goi, &o);
|
||||
if (e == JIM_OK){
|
||||
if (e == JIM_OK) {
|
||||
e = Jim_Nvp_name2value_obj(goi->interp,
|
||||
nvp,
|
||||
o,
|
||||
@@ -12719,7 +12719,7 @@ Jim_GetOpt_NvpUnknown(Jim_GetOptInfo *goi,
|
||||
const Jim_Nvp *nvptable,
|
||||
int hadprefix)
|
||||
{
|
||||
if (hadprefix){
|
||||
if (hadprefix) {
|
||||
Jim_SetResult_NvpUnknown(goi->interp,
|
||||
goi->argv[-2],
|
||||
goi->argv[-1],
|
||||
@@ -12742,11 +12742,11 @@ Jim_GetOpt_Enum(Jim_GetOptInfo *goi,
|
||||
Jim_Obj *o;
|
||||
int e;
|
||||
|
||||
if (puthere == NULL){
|
||||
if (puthere == NULL) {
|
||||
puthere = &_safe;
|
||||
}
|
||||
e = Jim_GetOpt_Obj(goi, &o);
|
||||
if (e == JIM_OK){
|
||||
if (e == JIM_OK) {
|
||||
e = Jim_GetEnum(goi->interp,
|
||||
o,
|
||||
lookup,
|
||||
@@ -12768,7 +12768,7 @@ Jim_SetResult_sprintf(Jim_Interp *interp, const char *fmt,...)
|
||||
va_start(ap,fmt);
|
||||
buf = jim_vasprintf(fmt, ap);
|
||||
va_end(ap);
|
||||
if (buf){
|
||||
if (buf) {
|
||||
Jim_SetResultString(interp, buf, -1);
|
||||
jim_vasprintf_done(buf);
|
||||
}
|
||||
@@ -12782,7 +12782,7 @@ Jim_SetResult_NvpUnknown(Jim_Interp *interp,
|
||||
Jim_Obj *param_value,
|
||||
const Jim_Nvp *nvp)
|
||||
{
|
||||
if (param_name){
|
||||
if (param_name) {
|
||||
Jim_SetResult_sprintf(interp,
|
||||
"%s: Unknown: %s, try one of: ",
|
||||
Jim_GetString(param_name, NULL),
|
||||
@@ -12792,11 +12792,11 @@ Jim_SetResult_NvpUnknown(Jim_Interp *interp,
|
||||
"Unknown param: %s, try one of: ",
|
||||
Jim_GetString(param_value, NULL));
|
||||
}
|
||||
while (nvp->name){
|
||||
while (nvp->name) {
|
||||
const char *a;
|
||||
const char *b;
|
||||
|
||||
if ((nvp + 1)->name){
|
||||
if ((nvp + 1)->name) {
|
||||
a = nvp->name;
|
||||
b = ", ";
|
||||
} else {
|
||||
@@ -12818,12 +12818,12 @@ Jim_Debug_ArgvString(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
|
||||
{
|
||||
int x;
|
||||
|
||||
if (debug_string_obj){
|
||||
if (debug_string_obj) {
|
||||
Jim_FreeObj(interp, debug_string_obj);
|
||||
}
|
||||
|
||||
debug_string_obj = Jim_NewEmptyStringObj(interp);
|
||||
for (x = 0 ; x < argc ; x++){
|
||||
for (x = 0 ; x < argc ; x++) {
|
||||
Jim_AppendStrings(interp,
|
||||
debug_string_obj,
|
||||
Jim_GetString(argv[x], NULL),
|
||||
|
||||
@@ -985,19 +985,19 @@ typedef struct jim_getopt {
|
||||
*
|
||||
* Jim_GetOpt_Setup(&goi, interp, argc, argv);
|
||||
*
|
||||
* while (goi.argc){
|
||||
* while (goi.argc) {
|
||||
* e = Jim_GetOpt_Nvp(&goi, nvp_options, &n);
|
||||
* if (e != JIM_OK){
|
||||
* if (e != JIM_OK) {
|
||||
* Jim_GetOpt_NvpUnknown(&goi, nvp_options, 0);
|
||||
* return e;
|
||||
* }
|
||||
*
|
||||
* switch (n->value){
|
||||
* switch (n->value) {
|
||||
* case ALIVE:
|
||||
* printf("Option ALIVE specified\n");
|
||||
* break;
|
||||
* case FIRST:
|
||||
* if (goi.argc < 1){
|
||||
* if (goi.argc < 1) {
|
||||
* .. not enough args error ..
|
||||
* }
|
||||
* Jim_GetOpt_String(&goi, &cp, NULL);
|
||||
@@ -1008,7 +1008,7 @@ typedef struct jim_getopt {
|
||||
* break;
|
||||
* case POLITICS:
|
||||
* e = Jim_GetOpt_Nvp(&goi, nvp_politics, &n);
|
||||
* if (e != JIM_OK){
|
||||
* if (e != JIM_OK) {
|
||||
* Jim_GetOpt_NvpUnknown(&goi, nvp_politics, 1);
|
||||
* return e;
|
||||
* }
|
||||
@@ -1102,21 +1102,21 @@ JIM_STATIC int JIM_API(Jim_GetOpt_Nvp)(Jim_GetOptInfo *goi, const Jim_Nvp *looku
|
||||
* Example:
|
||||
* \code
|
||||
*
|
||||
* while (goi.argc){
|
||||
* while (goi.argc) {
|
||||
* // Get the next option
|
||||
* e = Jim_GetOpt_Nvp(&goi, cmd_options, &n);
|
||||
* if (e != JIM_OK){
|
||||
* if (e != JIM_OK) {
|
||||
* // option was not recognized
|
||||
* // pass 'hadprefix = 0' because there is no prefix
|
||||
* Jim_GetOpt_NvpUnknown(&goi, cmd_options, 0);
|
||||
* return e;
|
||||
* }
|
||||
*
|
||||
* switch (n->value){
|
||||
* switch (n->value) {
|
||||
* case OPT_SEX:
|
||||
* // handle: --sex male | female | lots | needmore
|
||||
* e = Jim_GetOpt_Nvp(&goi, &nvp_sex, &n);
|
||||
* if (e != JIM_OK){
|
||||
* if (e != JIM_OK) {
|
||||
* Jim_GetOpt_NvpUnknown(&ogi, nvp_sex, 1);
|
||||
* return e;
|
||||
* }
|
||||
|
||||
@@ -704,7 +704,7 @@ int jtag_check_value_inner(uint8_t *captured, uint8_t *in_check_value, uint8_t *
|
||||
else
|
||||
compare_failed = buf_cmp(captured, in_check_value, num_bits);
|
||||
|
||||
if (compare_failed){
|
||||
if (compare_failed) {
|
||||
/* An error handler could have caught the failing check
|
||||
* only report a problem when there wasn't a handler, or if the handler
|
||||
* acknowledged the error
|
||||
@@ -1024,9 +1024,9 @@ int jtag_validate_chain(void)
|
||||
|
||||
tap = NULL;
|
||||
total_ir_length = 0;
|
||||
for (;;){
|
||||
for (;;) {
|
||||
tap = jtag_tap_next_enabled(tap);
|
||||
if (tap == NULL){
|
||||
if (tap == NULL) {
|
||||
break;
|
||||
}
|
||||
total_ir_length += tap->ir_length;
|
||||
@@ -1048,9 +1048,9 @@ int jtag_validate_chain(void)
|
||||
tap = NULL;
|
||||
chain_pos = 0;
|
||||
int val;
|
||||
for (;;){
|
||||
for (;;) {
|
||||
tap = jtag_tap_next_enabled(tap);
|
||||
if (tap == NULL){
|
||||
if (tap == NULL) {
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1151,7 +1151,7 @@ static int jtag_init_inner(struct command_context_s *cmd_ctx)
|
||||
LOG_DEBUG("Init JTAG chain");
|
||||
|
||||
tap = jtag_tap_next_enabled(NULL);
|
||||
if (tap == NULL){
|
||||
if (tap == NULL) {
|
||||
LOG_ERROR("There are no enabled taps?");
|
||||
return ERROR_JTAG_INIT_FAILED;
|
||||
}
|
||||
|
||||
@@ -359,9 +359,9 @@ tap_state_t tap_state_by_name(const char *name)
|
||||
{
|
||||
tap_state_t x;
|
||||
|
||||
for (x = 0 ; x < TAP_NUM_STATES ; x++){
|
||||
for (x = 0 ; x < TAP_NUM_STATES ; x++) {
|
||||
/* be nice to the human */
|
||||
if (0 == strcasecmp(name, tap_state_name(x))){
|
||||
if (0 == strcasecmp(name, tap_state_name(x))) {
|
||||
return x;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -340,7 +340,7 @@ static int jim_newtap_cmd(Jim_GetOptInfo *goi)
|
||||
/*
|
||||
* we expect CHIP + TAP + OPTIONS
|
||||
* */
|
||||
if (goi->argc < 3){
|
||||
if (goi->argc < 3) {
|
||||
Jim_SetResult_sprintf(goi->interp, "Missing CHIP TAP OPTIONS ....");
|
||||
return JIM_ERR;
|
||||
}
|
||||
@@ -367,14 +367,14 @@ static int jim_newtap_cmd(Jim_GetOptInfo *goi)
|
||||
/* clear them as we find them */
|
||||
reqbits = (NTREQ_IRLEN | NTREQ_IRCAPTURE | NTREQ_IRMASK);
|
||||
|
||||
while (goi->argc){
|
||||
while (goi->argc) {
|
||||
e = Jim_GetOpt_Nvp(goi, opts, &n);
|
||||
if (e != JIM_OK){
|
||||
if (e != JIM_OK) {
|
||||
Jim_GetOpt_NvpUnknown(goi, opts, 0);
|
||||
return e;
|
||||
}
|
||||
LOG_DEBUG("Processing option: %s", n->name);
|
||||
switch (n->value){
|
||||
switch (n->value) {
|
||||
case NTAP_OPT_ENABLED:
|
||||
pTap->disabled_after_reset = false;
|
||||
break;
|
||||
@@ -410,11 +410,11 @@ static int jim_newtap_cmd(Jim_GetOptInfo *goi)
|
||||
case NTAP_OPT_IRMASK:
|
||||
case NTAP_OPT_IRCAPTURE:
|
||||
e = Jim_GetOpt_Wide(goi, &w);
|
||||
if (e != JIM_OK){
|
||||
if (e != JIM_OK) {
|
||||
Jim_SetResult_sprintf(goi->interp, "option: %s bad parameter", n->name);
|
||||
return e;
|
||||
}
|
||||
switch (n->value){
|
||||
switch (n->value) {
|
||||
case NTAP_OPT_IRLEN:
|
||||
if (w > (jim_wide) (8 * sizeof(pTap->ir_capture_value)))
|
||||
LOG_WARNING("huge IR length %d", (int) w);
|
||||
@@ -535,29 +535,29 @@ static int jim_jtag_command(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
|
||||
Jim_GetOpt_Setup(&goi, interp, argc-1, argv + 1);
|
||||
|
||||
e = Jim_GetOpt_Nvp(&goi, jtag_cmds, &n);
|
||||
if (e != JIM_OK){
|
||||
if (e != JIM_OK) {
|
||||
Jim_GetOpt_NvpUnknown(&goi, jtag_cmds, 0);
|
||||
return e;
|
||||
}
|
||||
Jim_SetEmptyResult(goi.interp);
|
||||
switch (n->value){
|
||||
switch (n->value) {
|
||||
case JTAG_CMD_INTERFACE:
|
||||
/* return the name of the interface */
|
||||
/* TCL code might need to know the exact type... */
|
||||
/* FUTURE: we allow this as a means to "set" the interface. */
|
||||
if (goi.argc != 0){
|
||||
if (goi.argc != 0) {
|
||||
Jim_WrongNumArgs(goi.interp, 1, goi.argv-1, "(no params)");
|
||||
return JIM_ERR;
|
||||
}
|
||||
Jim_SetResultString(goi.interp, jtag_interface->name, -1);
|
||||
return JIM_OK;
|
||||
case JTAG_CMD_INIT_RESET:
|
||||
if (goi.argc != 0){
|
||||
if (goi.argc != 0) {
|
||||
Jim_WrongNumArgs(goi.interp, 1, goi.argv-1, "(no params)");
|
||||
return JIM_ERR;
|
||||
}
|
||||
e = jtag_init_reset(context);
|
||||
if (e != ERROR_OK){
|
||||
if (e != ERROR_OK) {
|
||||
Jim_SetResult_sprintf(goi.interp, "error: %d", e);
|
||||
return JIM_ERR;
|
||||
}
|
||||
@@ -568,7 +568,7 @@ static int jim_jtag_command(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
|
||||
case JTAG_CMD_TAPISENABLED:
|
||||
case JTAG_CMD_TAPENABLE:
|
||||
case JTAG_CMD_TAPDISABLE:
|
||||
if (goi.argc != 1){
|
||||
if (goi.argc != 1) {
|
||||
Jim_SetResultString(goi.interp, "Too many parameters",-1);
|
||||
return JIM_ERR;
|
||||
}
|
||||
@@ -619,7 +619,7 @@ static int jim_jtag_command(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
|
||||
break;
|
||||
|
||||
case JTAG_CMD_CGET:
|
||||
if (goi.argc < 2){
|
||||
if (goi.argc < 2) {
|
||||
Jim_WrongNumArgs(goi.interp, 0, NULL, "?tap-name? -option ...");
|
||||
return JIM_ERR;
|
||||
}
|
||||
@@ -629,7 +629,7 @@ static int jim_jtag_command(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
|
||||
|
||||
Jim_GetOpt_Obj(&goi, &o);
|
||||
t = jtag_tap_by_jim_obj(goi.interp, o);
|
||||
if (t == NULL){
|
||||
if (t == NULL) {
|
||||
return JIM_ERR;
|
||||
}
|
||||
|
||||
@@ -639,7 +639,7 @@ static int jim_jtag_command(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
|
||||
break;
|
||||
|
||||
case JTAG_CMD_CONFIGURE:
|
||||
if (goi.argc < 3){
|
||||
if (goi.argc < 3) {
|
||||
Jim_WrongNumArgs(goi.interp, 0, NULL, "?tap-name? -option ?VALUE? ...");
|
||||
return JIM_ERR;
|
||||
}
|
||||
@@ -649,7 +649,7 @@ static int jim_jtag_command(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
|
||||
|
||||
Jim_GetOpt_Obj(&goi, &o);
|
||||
t = jtag_tap_by_jim_obj(goi.interp, o);
|
||||
if (t == NULL){
|
||||
if (t == NULL) {
|
||||
return JIM_ERR;
|
||||
}
|
||||
|
||||
@@ -806,7 +806,7 @@ static int handle_jtag_device_command(struct command_context_s *cmd_ctx, char *c
|
||||
* argv[ 3] = not actually used by anything but in the docs
|
||||
*/
|
||||
|
||||
if (argc < 4){
|
||||
if (argc < 4) {
|
||||
command_print(cmd_ctx, "OLD DEPRECATED SYNTAX: Please use the NEW syntax");
|
||||
return ERROR_OK;
|
||||
}
|
||||
@@ -847,7 +847,7 @@ static int handle_jtag_device_command(struct command_context_s *cmd_ctx, char *c
|
||||
Jim_GetString(newargs[9], NULL));
|
||||
|
||||
e = jim_jtag_command(interp, 10, newargs);
|
||||
if (e != JIM_OK){
|
||||
if (e != JIM_OK) {
|
||||
command_print(cmd_ctx, "%s", Jim_GetString(Jim_GetResult(interp), NULL));
|
||||
}
|
||||
return e;
|
||||
@@ -861,7 +861,7 @@ static int handle_scan_chain_command(struct command_context_s *cmd_ctx, char *cm
|
||||
command_print(cmd_ctx, " TapName | Enabled | IdCode Expected IrLen IrCap IrMask Instr ");
|
||||
command_print(cmd_ctx, "---|--------------------|---------|------------|------------|------|------|------|---------");
|
||||
|
||||
while (tap){
|
||||
while (tap) {
|
||||
uint32_t expected, expected_mask, cur_instr, ii;
|
||||
expected = buf_get_u32(tap->expected, 0, tap->ir_length);
|
||||
expected_mask = buf_get_u32(tap->expected_mask, 0, tap->ir_length);
|
||||
@@ -1174,20 +1174,20 @@ static int handle_irscan_command(struct command_context_s *cmd_ctx, char *cmd, c
|
||||
*/
|
||||
endstate = TAP_IDLE;
|
||||
|
||||
if (argc >= 4){
|
||||
if (argc >= 4) {
|
||||
/* have at least one pair of numbers. */
|
||||
/* is last pair the magic text? */
|
||||
if (0 == strcmp("-endstate", args[ argc - 2 ])){
|
||||
if (0 == strcmp("-endstate", args[ argc - 2 ])) {
|
||||
const char *cpA;
|
||||
const char *cpS;
|
||||
cpA = args[ argc-1 ];
|
||||
for (endstate = 0 ; endstate < TAP_NUM_STATES ; endstate++){
|
||||
for (endstate = 0 ; endstate < TAP_NUM_STATES ; endstate++) {
|
||||
cpS = tap_state_name(endstate);
|
||||
if (0 == strcmp(cpA, cpS)){
|
||||
if (0 == strcmp(cpA, cpS)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (endstate >= TAP_NUM_STATES){
|
||||
if (endstate >= TAP_NUM_STATES) {
|
||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||
} else {
|
||||
if (!scan_is_safe(endstate))
|
||||
@@ -1281,12 +1281,12 @@ static int Jim_Command_drscan(Jim_Interp *interp, int argc, Jim_Obj *const *args
|
||||
|
||||
e = Jim_GetLong(interp, args[i], &bits);
|
||||
/* If valid - try next arg */
|
||||
if (e == JIM_OK){
|
||||
if (e == JIM_OK) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Not valid.. are we at the end? */
|
||||
if (((i + 2) != argc)){
|
||||
if (((i + 2) != argc)) {
|
||||
/* nope, then error */
|
||||
return e;
|
||||
}
|
||||
@@ -1299,13 +1299,13 @@ static int Jim_Command_drscan(Jim_Interp *interp, int argc, Jim_Obj *const *args
|
||||
/* get arg as a string. */
|
||||
cp = Jim_GetString(args[i], NULL);
|
||||
/* is it the magic? */
|
||||
if (0 == strcmp("-endstate", cp)){
|
||||
if (0 == strcmp("-endstate", cp)) {
|
||||
/* is the statename valid? */
|
||||
cp = Jim_GetString(args[i + 1], NULL);
|
||||
|
||||
/* see if it is a valid state name */
|
||||
endstate = tap_state_by_name(cp);
|
||||
if (endstate < 0){
|
||||
if (endstate < 0) {
|
||||
/* update the error message */
|
||||
Jim_SetResult_sprintf(interp,"endstate: %s invalid", cp);
|
||||
} else {
|
||||
@@ -1321,13 +1321,13 @@ static int Jim_Command_drscan(Jim_Interp *interp, int argc, Jim_Obj *const *args
|
||||
}
|
||||
|
||||
/* Still an error? */
|
||||
if (e != JIM_OK){
|
||||
if (e != JIM_OK) {
|
||||
return e; /* too bad */
|
||||
}
|
||||
} /* validate args */
|
||||
|
||||
tap = jtag_tap_by_jim_obj(interp, args[1]);
|
||||
if (tap == NULL){
|
||||
if (tap == NULL) {
|
||||
return JIM_ERR;
|
||||
}
|
||||
|
||||
|
||||
@@ -96,7 +96,7 @@ int xilinx_read_bit_file(xilinx_bit_file_t *bit_file, char *filename)
|
||||
return ERROR_PLD_FILE_LOAD_FAILED;
|
||||
}
|
||||
|
||||
if (input_stat.st_size == 0){
|
||||
if (input_stat.st_size == 0) {
|
||||
LOG_ERROR("Empty file %s", filename);
|
||||
return ERROR_PLD_FILE_LOAD_FAILED;
|
||||
}
|
||||
|
||||
@@ -319,7 +319,7 @@ int gdb_put_packet_inner(connection_t *connection, char *buffer, int len)
|
||||
break;
|
||||
if ((retval = gdb_get_char(connection, &reply)) != ERROR_OK)
|
||||
return retval;
|
||||
if (reply == '$'){
|
||||
if (reply == '$') {
|
||||
/* fix a problem with some IAR tools */
|
||||
gdb_putback_char(connection, reply);
|
||||
LOG_DEBUG("Unexpected start of new packet");
|
||||
@@ -402,7 +402,7 @@ int gdb_put_packet_inner(connection_t *connection, char *buffer, int len)
|
||||
log_remove_callback(gdb_log_callback, connection);
|
||||
LOG_WARNING("negative reply, retrying");
|
||||
}
|
||||
else if (reply == '$'){
|
||||
else if (reply == '$') {
|
||||
LOG_ERROR("GDB missing ack(1) - assumed good");
|
||||
gdb_putback_char(connection, reply);
|
||||
return ERROR_OK;
|
||||
@@ -413,7 +413,7 @@ int gdb_put_packet_inner(connection_t *connection, char *buffer, int len)
|
||||
return ERROR_SERVER_REMOTE_CLOSED;
|
||||
}
|
||||
}
|
||||
else if (reply == '$'){
|
||||
else if (reply == '$') {
|
||||
LOG_ERROR("GDB missing ack(2) - assumed good");
|
||||
gdb_putback_char(connection, reply);
|
||||
return ERROR_OK;
|
||||
@@ -2036,12 +2036,12 @@ int gdb_input_inner(connection_t *connection)
|
||||
/* terminate with zero */
|
||||
packet[packet_size] = 0;
|
||||
|
||||
if (LOG_LEVEL_IS(LOG_LVL_DEBUG)){
|
||||
if (packet[0] == 'X'){
|
||||
if (LOG_LEVEL_IS(LOG_LVL_DEBUG)) {
|
||||
if (packet[0] == 'X') {
|
||||
// binary packets spew junk into the debug log stream
|
||||
char buf[ 50 ];
|
||||
int x;
|
||||
for (x = 0 ; (x < 49) && (packet[x] != ':') ; x++){
|
||||
for (x = 0 ; (x < 49) && (packet[x] != ':') ; x++) {
|
||||
buf[x] = packet[x];
|
||||
}
|
||||
buf[x] = 0;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user