Skip to content
Snippets Groups Projects
Commit c7cfb341 authored by zwelch's avatar zwelch
Browse files

David Brownell <david-b@pacbell.net>:

Minor jtag cleanup:

 - remove hidden assumption about JTAG event numbering
 - move function declarations to a header
 - some end'o'line whitespace
 - use "calloc" not "malloc + memset"


git-svn-id: svn://svn.berlios.de/openocd/trunk@2244 b42882b7-edfa-0310-969c-e2dbd0fdcd60
parent cc948800
No related branches found
No related tags found
No related merge requests found
......@@ -58,9 +58,9 @@ static void jtag_add_scan_check(void (*jtag_add_scan)(int in_num_fields, const s
*/
static int jtag_error = ERROR_OK;
static char* jtag_event_strings[] =
static const char *jtag_event_strings[] =
{
"JTAG controller reset (RESET or TRST)"
[JTAG_TRST_ASSERTED] = "JTAG controller reset (RESET or TRST)",
};
static int jtag_trst = 0;
......
......@@ -175,6 +175,10 @@ struct jtag_tap_s
jtag_tap_t* next_tap;
};
void jtag_tap_init(jtag_tap_t *tap);
void jtag_tap_free(jtag_tap_t *tap);
extern jtag_tap_t* jtag_all_taps(void);
extern const char *jtag_tap_name(const jtag_tap_t *tap);
extern jtag_tap_t* jtag_tap_by_string(const char* dotted_name);
......
......@@ -306,9 +306,6 @@ static int is_bad_irval(int ir_length, jim_wide w)
return (w & v) != 0;
}
extern void jtag_tap_init(jtag_tap_t *tap);
extern void jtag_tap_free(jtag_tap_t *tap);
static int jim_newtap_cmd( Jim_GetOptInfo *goi )
{
jtag_tap_t *pTap;
......@@ -334,12 +331,12 @@ static int jim_newtap_cmd( Jim_GetOptInfo *goi )
{ .name = NULL , .value = -1 },
};
pTap = malloc( sizeof(jtag_tap_t) );
memset( pTap, 0, sizeof(*pTap) );
pTap = calloc(1, sizeof(jtag_tap_t));
if (!pTap) {
Jim_SetResult_sprintf(goi->interp, "no memory");
return JIM_ERR;
}
/*
* we expect CHIP + TAP + OPTIONS
* */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment