diff --git a/urjtag/ChangeLog b/urjtag/ChangeLog index 8a181c5b..78c24139 100644 --- a/urjtag/ChangeLog +++ b/urjtag/ChangeLog @@ -3,6 +3,8 @@ Expand tabs also in #defines -- indent skips them. Run indent again. Since many identifiers have changed, line wraps have to be redone. + Public typedefs of enums follow the same naming scheme as structs: + typedef enum urj_bla { ... } urj_bla_t; * affects the complete code base. 2009-04-23 Rutger Hofman diff --git a/urjtag/include/bus.h b/urjtag/include/bus.h index e9a92187..4fad6a13 100644 --- a/urjtag/include/bus.h +++ b/urjtag/include/bus.h @@ -36,7 +36,7 @@ typedef struct urj_bus_t **buses; } urj_buses_t; -extern urj_buses_t buses; +extern urj_buses_t urj_buses; extern const urj_bus_driver_t *bus_drivers[]; void urj_bus_buses_free (void); diff --git a/urjtag/include/bus_driver.h b/urjtag/include/bus_driver.h index d7694efc..7063c8eb 100644 --- a/urjtag/include/bus_driver.h +++ b/urjtag/include/bus_driver.h @@ -78,8 +78,6 @@ struct urj_bus const urj_bus_driver_t *driver; }; -extern urj_bus_t *bus; - #define URJ_BUS_PRINTINFO(bus) (bus)->driver->printinfo(bus) #define URJ_BUS_PREPARE(bus) (bus)->driver->prepare(bus) #define URJ_BUS_AREA(bus,adr,a) (bus)->driver->area(bus,adr,a) diff --git a/urjtag/include/cmd.h b/urjtag/include/cmd.h index 64a687fb..820f0173 100644 --- a/urjtag/include/cmd.h +++ b/urjtag/include/cmd.h @@ -44,7 +44,7 @@ typedef struct int (*run) (urj_chain_t *chain, char *params[]); } urj_cmd_t; -extern const urj_cmd_t *cmds[]; +extern const urj_cmd_t *urj_cmds[]; char **urj_cmd_completion (const char *text, int start, int end); int urj_cmd_run (urj_chain_t *chain, char *params[]); diff --git a/urjtag/include/jtag.h b/urjtag/include/jtag.h index e70f5343..78bc7b65 100644 --- a/urjtag/include/jtag.h +++ b/urjtag/include/jtag.h @@ -39,7 +39,7 @@ #define URJ_STATUS_SYNTAX_ERROR (-1) -extern urj_bus_t *bus; +extern urj_bus_t *urj_bus; extern int big_endian; extern int debug_mode; diff --git a/urjtag/src/bus/buses.c b/urjtag/src/bus/buses.c index 45ae563f..472ac2db 100644 --- a/urjtag/src/bus/buses.c +++ b/urjtag/src/bus/buses.c @@ -139,21 +139,21 @@ const urj_bus_driver_t *bus_drivers[] = { NULL /* last must be NULL */ }; -urj_bus_t *bus = NULL; -urj_buses_t buses = { 0, NULL }; +urj_bus_t *urj_bus = NULL; +urj_buses_t urj_buses = { 0, NULL }; void urj_bus_buses_free (void) { int i; - for (i = 0; i < buses.len; i++) - URJ_BUS_FREE (buses.buses[i]); + for (i = 0; i < urj_buses.len; i++) + URJ_BUS_FREE (urj_buses.buses[i]); - free (buses.buses); - buses.len = 0; - buses.buses = NULL; - bus = NULL; + free (urj_buses.buses); + urj_buses.len = 0; + urj_buses.buses = NULL; + urj_bus = NULL; } void @@ -164,16 +164,16 @@ urj_bus_buses_add (urj_bus_t *abus) if (abus == NULL) return; - b = realloc (buses.buses, (buses.len + 1) * sizeof (urj_bus_t *)); + b = realloc (urj_buses.buses, (urj_buses.len + 1) * sizeof (urj_bus_t *)); if (b == NULL) { printf (_("Out of memory\n")); return; } - buses.buses = b; - buses.buses[buses.len++] = abus; - if (bus == NULL) - bus = abus; + urj_buses.buses = b; + urj_buses.buses[urj_buses.len++] = abus; + if (urj_bus == NULL) + urj_bus = abus; } void @@ -182,25 +182,25 @@ urj_bus_buses_delete (urj_bus_t *abus) int i; urj_bus_t **b; - for (i = 0; i < buses.len; i++) - if (abus == buses.buses[i]) + for (i = 0; i < urj_buses.len; i++) + if (abus == urj_buses.buses[i]) break; - if (i >= buses.len) + if (i >= urj_buses.len) return; - while (i + 1 < buses.len) + while (i + 1 < urj_buses.len) { - buses.buses[i] = buses.buses[i + 1]; + urj_buses.buses[i] = urj_buses.buses[i + 1]; i++; } - buses.len--; - b = realloc (buses.buses, buses.len * sizeof (urj_bus_t *)); - if ((b != NULL) || (buses.len == 0)) - buses.buses = b; + urj_buses.len--; + b = realloc (urj_buses.buses, urj_buses.len * sizeof (urj_bus_t *)); + if ((b != NULL) || (urj_buses.len == 0)) + urj_buses.buses = b; - if (bus != abus) + if (urj_bus != abus) return; - if (buses.len > 0) - bus = buses.buses[0]; + if (urj_buses.len > 0) + urj_bus = urj_buses.buses[0]; } diff --git a/urjtag/src/bus/ejtag.c b/urjtag/src/bus/ejtag.c index 4c4b2715..34b1f51b 100644 --- a/urjtag/src/bus/ejtag.c +++ b/urjtag/src/bus/ejtag.c @@ -593,8 +593,10 @@ ejtag_bus_area (urj_bus_t *bus, uint32_t adr, urj_bus_area_t *area) return URJ_STATUS_OK; } +/* @@@@ RFHH Added a parameter bus on the assumption it doesn't really + * want to access the global urj_bus_t *bus */ static int -ejtag_gen_read (uint32_t *code, uint32_t adr) +ejtag_gen_read (urj_bus_t *bus, uint32_t *code, uint32_t adr) { uint16_t adr_hi, adr_lo; uint32_t *p = code; @@ -640,7 +642,7 @@ ejtag_bus_read_start (urj_bus_t *bus, uint32_t adr) { uint32_t code[3]; - ejtag_run_pracc (bus, code, ejtag_gen_read (code, adr)); + ejtag_run_pracc (bus, code, ejtag_gen_read (bus, code, adr)); // printf("URJ_BUS_READ_START: adr=0x%08x\n", adr); } @@ -655,7 +657,7 @@ ejtag_bus_read_next (urj_bus_t *bus, uint32_t adr) uint32_t code[4], *p = code; *p++ = 0xac820000; // sw $2,0($4) - p += ejtag_gen_read (p, adr); + p += ejtag_gen_read (bus, p, adr); d = ejtag_run_pracc (bus, code, p - code); diff --git a/urjtag/src/bus/ejtag_dma.c b/urjtag/src/bus/ejtag_dma.c index ca92c784..0e05df31 100644 --- a/urjtag/src/bus/ejtag_dma.c +++ b/urjtag/src/bus/ejtag_dma.c @@ -167,8 +167,10 @@ siz_ (int sz) * low-level dma write * */ +/* @@@@ RFHH Add a parameter bus on the assumption that the code doesn't + * really want to access the global variable urj_bus_t *bus */ static void -ejtag_dma_write (unsigned int addr, unsigned int data, int sz) +ejtag_dma_write (urj_bus_t *bus, unsigned int addr, unsigned int data, int sz) { static urj_data_register_t *ejctrl = NULL; static urj_data_register_t *ejaddr = NULL; @@ -260,8 +262,10 @@ ejtag_dma_write (unsigned int addr, unsigned int data, int sz) * low level dma read operation * */ +/* @@@@ RFHH Add a parameter bus on the assumption that the code doesn't + * really want to access the global variable urj_bus_t *bus */ static unsigned int -ejtag_dma_read (unsigned int addr, int sz) +ejtag_dma_read (urj_bus_t *bus, unsigned int addr, int sz) { static urj_data_register_t *ejctrl = NULL; static urj_data_register_t *ejaddr = NULL; @@ -497,16 +501,16 @@ ejtag_dma_bus_init (urj_bus_t *bus) // Clear Memory Protection Bit in DCR printf (_("Clear memory protection bit in DCR\n")); - unsigned int val = ejtag_dma_read (0xff300000, DMA_WORD); - ejtag_dma_write (0xff300000, val & ~(1 << 2), DMA_WORD); + unsigned int val = ejtag_dma_read (bus, 0xff300000, DMA_WORD); + ejtag_dma_write (bus, 0xff300000, val & ~(1 << 2), DMA_WORD); // Clear watchdog, if any printf (_("Clear Watchdog\n")); - ejtag_dma_write (0xb8000080, 0, DMA_WORD); + ejtag_dma_write (bus, 0xb8000080, 0, DMA_WORD); printf (_("Potential flash base address: [0x%x], [0x%x]\n"), - ejtag_dma_read (0xfffe2000, DMA_WORD), ejtag_dma_read (0xfffe1000, - DMA_WORD)); + ejtag_dma_read (bus, 0xfffe2000, DMA_WORD), + ejtag_dma_read (bus, 0xfffe1000, DMA_WORD)); printf (_("Processor successfully switched in debug mode.\n")); @@ -617,7 +621,7 @@ static void ejtag_dma_bus_write (urj_bus_t *bus, uint32_t adr, uint32_t data) { //printf("%s:adr=0x%x,data=0x%x\n",__FUNCTION__,adr,data); - ejtag_dma_write (adr, data, get_sz (adr)); + ejtag_dma_write (bus, adr, data, get_sz (adr)); } /** @@ -627,7 +631,7 @@ ejtag_dma_bus_write (urj_bus_t *bus, uint32_t adr, uint32_t data) static unsigned int ejtag_dma_bus_read (urj_bus_t *bus, uint32_t adr) { - int data = ejtag_dma_read (adr, get_sz (adr)); + int data = ejtag_dma_read (bus, adr, get_sz (adr)); //printf("%s:adr=0x%x,got=0x%x\n",__FUNCTION__,adr,data); return data; } @@ -640,7 +644,7 @@ static unsigned int _data_read; static void ejtag_dma_bus_read_start (urj_bus_t *bus, uint32_t adr) { - _data_read = ejtag_dma_read (adr, get_sz (adr)); + _data_read = ejtag_dma_read (bus, adr, get_sz (adr)); //printf("%s:adr=0x%x, got=0x%x\n",__FUNCTION__,adr,_data_read); return; } @@ -653,7 +657,7 @@ static unsigned int ejtag_dma_bus_read_next (urj_bus_t *bus, uint32_t adr) { unsigned int tmp_value = _data_read; - _data_read = ejtag_dma_read (adr, get_sz (adr)); + _data_read = ejtag_dma_read (bus, adr, get_sz (adr)); //printf("%s:adr=0x%x, got=0x%x\n",__FUNCTION__,adr,_data_read); return tmp_value; } diff --git a/urjtag/src/cmd/cmd_bit.c b/urjtag/src/cmd/cmd_bit.c index a2a6e913..dfe99a8a 100644 --- a/urjtag/src/cmd/cmd_bit.c +++ b/urjtag/src/cmd/cmd_bit.c @@ -24,6 +24,7 @@ #include "sysdep.h" +#include #include #include @@ -32,15 +33,17 @@ #include "cmd.h" static void -cmd_bit_print_params (char *params[], unsigned int parameters, char *command) +cmd_bit_print_params (char *params[], unsigned int parameters, char *command, + size_t command_size) { unsigned int i; - strcpy (command, params[0]); + command[0] = '\0'; + strncat (command, params[0], command_size); for (i = 1; i < parameters; i++) { - strcat (command, " "); - strcat (command, params[i]); + strncat (command, " ", command_size); + strncat (command, params[i], command_size); } } @@ -56,7 +59,7 @@ cmd_bit_run (urj_chain_t *chain, char *params[]) unsigned int parameters = urj_cmd_params (params); char command[1024]; - cmd_bit_print_params (params, parameters, command); + cmd_bit_print_params (params, parameters, command, sizeof command); if ((parameters != 5) && (parameters != 8)) { @@ -157,7 +160,7 @@ cmd_bit_run (urj_chain_t *chain, char *params[]) return -1; } - safe = (params[3][0] == '1') ? 1 : 0; + safe = (params[3][0] == '1'); bsr->in->data[bit] = safe; /* allocate bsbit */ diff --git a/urjtag/src/cmd/cmd_bus.c b/urjtag/src/cmd/cmd_bus.c index 89fb4bc2..1addc10c 100644 --- a/urjtag/src/cmd/cmd_bus.c +++ b/urjtag/src/cmd/cmd_bus.c @@ -51,13 +51,13 @@ cmd_bus_run (urj_chain_t *chain, char *params[]) if (urj_cmd_get_number (params[1], &n)) return -1; - if (n >= buses.len) + if (n >= urj_buses.len) { printf (_("%s: invalid bus number\n"), "bus"); return 1; } - bus = buses.buses[n]; + urj_bus = urj_buses.buses[n]; return 1; } diff --git a/urjtag/src/cmd/cmd_cable.c b/urjtag/src/cmd/cmd_cable.c index 503f4d59..294ff05f 100644 --- a/urjtag/src/cmd/cmd_cable.c +++ b/urjtag/src/cmd/cmd_cable.c @@ -89,10 +89,10 @@ cmd_cable_run (urj_chain_t *chain, char *params[]) } } - if (bus) + if (urj_bus) { - URJ_BUS_FREE (bus); - bus = NULL; + URJ_BUS_FREE (urj_bus); + urj_bus = NULL; } urj_tap_chain_disconnect (chain); diff --git a/urjtag/src/cmd/cmd_cmd.c b/urjtag/src/cmd/cmd_cmd.c index d378c39e..cea7a301 100644 --- a/urjtag/src/cmd/cmd_cmd.c +++ b/urjtag/src/cmd/cmd_cmd.c @@ -79,7 +79,7 @@ extern urj_cmd_t cmd_bsdl; #endif extern urj_cmd_t cmd_debug; -const urj_cmd_t *cmds[] = { +const urj_cmd_t *urj_cmds[] = { &cmd_quit, &cmd_help, &cmd_frequency, @@ -139,9 +139,9 @@ cmd_find_next (const char *text, int state) len = strlen (text); } - while (cmds[cmd_idx]) + while (urj_cmds[cmd_idx]) { - char *name = cmds[cmd_idx++]->name; + char *name = urj_cmds[cmd_idx++]->name; if (!strncmp (name, text, len)) return strdup (name); } @@ -189,18 +189,18 @@ urj_cmd_run (urj_chain_t *chain, char *params[]) pidx = -1; len = strlen (params[0]); - for (i = 0; cmds[i]; ++i) + for (i = 0; urj_cmds[i]; ++i) { - if (strcasecmp (cmds[i]->name, params[0]) == 0) + if (strcasecmp (urj_cmds[i]->name, params[0]) == 0) { int r; run_cmd: - r = cmds[i]->run (chain, params); + r = urj_cmds[i]->run (chain, params); if (r < 0) printf (_("%s: syntax error!\n"), params[0]); return r; } - else if (strncasecmp (cmds[i]->name, params[0], len) == 0) + else if (strncasecmp (urj_cmds[i]->name, params[0], len) == 0) { if (pidx == -1) pidx = i; diff --git a/urjtag/src/cmd/cmd_detect.c b/urjtag/src/cmd/cmd_detect.c index 34bb4ce2..12bf32ee 100644 --- a/urjtag/src/cmd/cmd_detect.c +++ b/urjtag/src/cmd/cmd_detect.c @@ -64,9 +64,9 @@ cmd_detect_run (urj_chain_t *chain, char *params[]) urj_tap_chain_shift_instructions (chain); // Initialize all the buses - for (i = 0; i < buses.len; i++) + for (i = 0; i < urj_buses.len; i++) { - abus = buses.buses[i]; + abus = urj_buses.buses[i]; if (abus->driver->init) { if (abus->driver->init (abus) != URJ_STATUS_OK) diff --git a/urjtag/src/cmd/cmd_detectflash.c b/urjtag/src/cmd/cmd_detectflash.c index ea1b3e96..c90808db 100644 --- a/urjtag/src/cmd/cmd_detectflash.c +++ b/urjtag/src/cmd/cmd_detectflash.c @@ -26,6 +26,7 @@ #include +#include #include #include @@ -37,7 +38,7 @@ cmd_detectflash_run (urj_chain_t *chain, char *params[]) if (urj_cmd_params (params) != 2) return -1; - if (!bus) + if (!urj_bus) { printf (_("Error: Bus driver missing.\n")); return 1; @@ -46,7 +47,7 @@ cmd_detectflash_run (urj_chain_t *chain, char *params[]) if (urj_cmd_get_number (params[1], &adr)) return -1; - urj_flash_detectflash (bus, adr); + urj_flash_detectflash (urj_bus, adr); return 1; } diff --git a/urjtag/src/cmd/cmd_eraseflash.c b/urjtag/src/cmd/cmd_eraseflash.c index b4069a16..df6256c3 100644 --- a/urjtag/src/cmd/cmd_eraseflash.c +++ b/urjtag/src/cmd/cmd_eraseflash.c @@ -43,7 +43,7 @@ cmd_eraseflash_run (urj_chain_t *chain, char *params[]) return -1; if (!urj_cmd_test_cable (chain)) return 1; - if (!bus) + if (!urj_bus) { printf (_("Error: Bus driver missing.\n")); return 1; @@ -52,7 +52,7 @@ cmd_eraseflash_run (urj_chain_t *chain, char *params[]) return -1; if (urj_cmd_get_number (params[2], &number)) return -1; - urj_flasherase (bus, adr, number); + urj_flasherase (urj_bus, adr, number); return 1; } diff --git a/urjtag/src/cmd/cmd_flashmem.c b/urjtag/src/cmd/cmd_flashmem.c index efe466d5..980b624b 100644 --- a/urjtag/src/cmd/cmd_flashmem.c +++ b/urjtag/src/cmd/cmd_flashmem.c @@ -45,7 +45,7 @@ cmd_flashmem_run (urj_chain_t *chain, char *params[]) if (paramc < 3) return -1; - if (!bus) + if (!urj_bus) { printf (_("Error: Bus driver missing.\n")); return 1; @@ -67,9 +67,9 @@ cmd_flashmem_run (urj_chain_t *chain, char *params[]) return 1; } if (msbin) - urj_flashmsbin (bus, f, noverify); + urj_flashmsbin (urj_bus, f, noverify); else - urj_flashmem (bus, f, adr, noverify); + urj_flashmem (urj_bus, f, adr, noverify); fclose (f); return 1; diff --git a/urjtag/src/cmd/cmd_help.c b/urjtag/src/cmd/cmd_help.c index b0a2bce4..eba19bc6 100644 --- a/urjtag/src/cmd/cmd_help.c +++ b/urjtag/src/cmd/cmd_help.c @@ -38,10 +38,9 @@ cmd_help_run (urj_chain_t *chain, char *params[]) if (!params[1]) { printf (_("Command list:\n\n")); - for (i = 0; cmds[i]; i++) - printf (_("%-13s %s\n"), cmds[i]->name, - cmds[i]->desc ? _(cmds[i]-> - desc) : + for (i = 0; urj_cmds[i]; i++) + printf (_("%-13s %s\n"), urj_cmds[i]->name, + urj_cmds[i]->desc ? _(urj_cmds[i]->desc) : _("(no description available)")); printf (_ ("\nType \"help COMMAND\" for details about a particular command.\n")); @@ -52,11 +51,11 @@ cmd_help_run (urj_chain_t *chain, char *params[]) return -1; /* search and print help for a particular command */ - for (i = 0; cmds[i]; i++) - if (strcasecmp (cmds[i]->name, params[1]) == 0) + for (i = 0; urj_cmds[i]; i++) + if (strcasecmp (urj_cmds[i]->name, params[1]) == 0) { - if (cmds[i]->help) - cmds[i]->help (); + if (urj_cmds[i]->help) + urj_cmds[i]->help (); return 1; } diff --git a/urjtag/src/cmd/cmd_initbus.c b/urjtag/src/cmd/cmd_initbus.c index 2efea00b..32d5b601 100644 --- a/urjtag/src/cmd/cmd_initbus.c +++ b/urjtag/src/cmd/cmd_initbus.c @@ -69,12 +69,12 @@ cmd_initbus_run (urj_chain_t *chain, char *params[]) if (URJ_BUS_INIT (abus) != URJ_STATUS_OK) printf (_("bus initialization failed!\n")); - for (i = 0; i < buses.len; i++) - if (buses.buses[i] == bus) + for (i = 0; i < urj_buses.len; i++) + if (urj_buses.buses[i] == urj_bus) break; - if (i != buses.len - 1) + if (i != urj_buses.len - 1) printf (_("Initialized bus %d, active bus %d\n"), - buses.len - 1, i); + urj_buses.len - 1, i); return 1; } diff --git a/urjtag/src/cmd/cmd_peekpoke.c b/urjtag/src/cmd/cmd_peekpoke.c index a332aca8..00cf19ad 100644 --- a/urjtag/src/cmd/cmd_peekpoke.c +++ b/urjtag/src/cmd/cmd_peekpoke.c @@ -43,7 +43,7 @@ cmd_peek_run (urj_chain_t *chain, char *params[]) if ((pars = urj_cmd_params (params)) < 2) return -1; - if (!bus) + if (!urj_bus) { printf (_("Error: Bus driver missing.\n")); return 1; @@ -53,9 +53,9 @@ cmd_peek_run (urj_chain_t *chain, char *params[]) if (urj_cmd_get_number (params[j], &adr)) return -1; - URJ_BUS_PREPARE (bus); - URJ_BUS_AREA (bus, adr, &area); - val = URJ_BUS_READ (bus, adr); + URJ_BUS_PREPARE (urj_bus); + URJ_BUS_AREA (urj_bus, adr, &area); + val = URJ_BUS_READ (urj_bus, adr); switch (area.width) { @@ -106,22 +106,22 @@ cmd_poke_run (urj_chain_t *chain, char *params[]) if (pars < 3 || !(pars & 1)) return -1; - if (!bus) + if (!urj_bus) { printf (_("Error: Bus driver missing.\n")); return 1; } - URJ_BUS_PREPARE (bus); + URJ_BUS_PREPARE (urj_bus); while (k < pars) { if (urj_cmd_get_number (params[k], &adr) || urj_cmd_get_number (params[k + 1], &val)) return -1; - URJ_BUS_AREA (bus, adr, &area); - URJ_BUS_WRITE (bus, adr, val); + URJ_BUS_AREA (urj_bus, adr, &area); + URJ_BUS_WRITE (urj_bus, adr, val); k += 2; } diff --git a/urjtag/src/cmd/cmd_print.c b/urjtag/src/cmd/cmd_print.c index 2374e2ab..f307a7aa 100644 --- a/urjtag/src/cmd/cmd_print.c +++ b/urjtag/src/cmd/cmd_print.c @@ -180,22 +180,22 @@ cmd_print_run (urj_chain_t *chain, char *params[]) urj_part_print (chain->parts->parts[chain->active_part]); } - if (bus != NULL) + if (urj_bus != NULL) { int i; uint64_t a; urj_bus_area_t area; - for (i = 0; i < buses.len; i++) - if (buses.buses[i] == bus) + for (i = 0; i < urj_buses.len; i++) + if (urj_buses.buses[i] == urj_bus) break; printf (_("\nActive bus:\n*%d: "), i); - URJ_BUS_PRINTINFO (bus); + URJ_BUS_PRINTINFO (urj_bus); for (a = 0; a < UINT64_C (0x100000000); a = area.start + area.length) { - if (URJ_BUS_AREA (bus, a, &area) != URJ_STATUS_OK) + if (URJ_BUS_AREA (urj_bus, a, &area) != URJ_STATUS_OK) { printf (_ ("Error in bus area urj_tap_discovery at 0x%08llX\n"), @@ -229,13 +229,13 @@ cmd_print_run (urj_chain_t *chain, char *params[]) return 1; } - for (i = 0; i < buses.len; i++) + for (i = 0; i < urj_buses.len; i++) { - if (buses.buses[i] == bus) + if (urj_buses.buses[i] == urj_bus) printf (_("*%d: "), i); else printf (_("%d: "), i); - URJ_BUS_PRINTINFO (buses.buses[i]); + URJ_BUS_PRINTINFO (urj_buses.buses[i]); } return 1; diff --git a/urjtag/src/cmd/cmd_readmem.c b/urjtag/src/cmd/cmd_readmem.c index 20358673..1a6de512 100644 --- a/urjtag/src/cmd/cmd_readmem.c +++ b/urjtag/src/cmd/cmd_readmem.c @@ -41,7 +41,7 @@ cmd_readmem_run (urj_chain_t *chain, char *params[]) if (urj_cmd_params (params) != 4) return -1; - if (!bus) + if (!urj_bus) { printf (_("Error: Bus driver missing.\n")); return 1; @@ -57,7 +57,7 @@ cmd_readmem_run (urj_chain_t *chain, char *params[]) printf (_("Unable to create file `%s'!\n"), params[3]); return 1; } - urj_bus_readmem (bus, f, adr, len); + urj_bus_readmem (urj_bus, f, adr, len); fclose (f); return 1; diff --git a/urjtag/src/cmd/cmd_writemem.c b/urjtag/src/cmd/cmd_writemem.c index 2a772035..27ac42bb 100644 --- a/urjtag/src/cmd/cmd_writemem.c +++ b/urjtag/src/cmd/cmd_writemem.c @@ -39,7 +39,7 @@ cmd_writemem_run (urj_chain_t *chain, char *params[]) if (urj_cmd_params (params) != 4) return -1; - if (!bus) + if (!urj_bus) { printf (_("Error: Bus driver missing.\n")); return 1; @@ -55,7 +55,7 @@ cmd_writemem_run (urj_chain_t *chain, char *params[]) printf (_("Unable to open file `%s'!\n"), params[3]); return 1; } - urj_bus_writemem (bus, f, adr, len); + urj_bus_writemem (urj_bus, f, adr, len); fclose (f); return 1; diff --git a/urjtag/src/flash/amd_flash.c b/urjtag/src/flash/amd_flash.c index 6d1e7cf6..6765609c 100644 --- a/urjtag/src/flash/amd_flash.c +++ b/urjtag/src/flash/amd_flash.c @@ -272,8 +272,9 @@ amd_29xx040_read_array (urj_flash_cfi_array_t *cfi_array) /* Read Array */ if (var_forced_detection.unlock_bypass == AMD_BYPASS_UNLOCK_MODE) { - URJ_BUS_WRITE (bus, cfi_array->address + 0x555, 0x90); - URJ_BUS_WRITE (bus, cfi_array->address + 0x2AA, 0x00); + /* @@@@ RFHH: changed this without understanding */ + URJ_BUS_WRITE (cfi_array->bus, cfi_array->address + 0x555, 0x90); + URJ_BUS_WRITE (cfi_array->bus, cfi_array->address + 0x2AA, 0x00); usleep (100); var_forced_detection.unlock_bypass = AMD_STANDARD_MODE; } diff --git a/urjtag/src/jtag.c b/urjtag/src/jtag.c index adece48e..1887ce2e 100644 --- a/urjtag/src/jtag.c +++ b/urjtag/src/jtag.c @@ -277,10 +277,10 @@ cleanup (urj_chain_t *chain) urj_flash_cfi_array_free (cfi_array); cfi_array = NULL; - if (bus) + if (urj_bus) { - URJ_BUS_FREE (bus); - bus = NULL; + URJ_BUS_FREE (urj_bus); + urj_bus = NULL; } urj_tap_chain_free (chain); chain = NULL;