Rename a few globals that had escaped; rename register.h to tap_register.h, instruction.h to part_instruction.h PART I -- does not compile\!

git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@1528 b68d4a1b-bc3d-0410-92ed-d4ac073336b7
master
Rutger Hofman 16 years ago
parent 6634b563fe
commit 970893163c

@ -1,6 +1,6 @@
$Id$
The subdirectory urjtag/ or the UrJTAG package contains a branch that is used
The subdirectory urjtag/ of the UrJTAG package contains a branch that is used
for the conversion of UrJTAG to a library plus a separate command shell.
Changes and commits to this branch will be frequent, and will affect nearly
every aspect of the source tree, like file names, file locations, code layout,

@ -39,10 +39,10 @@ noinst_HEADERS = \
flash/mic.h \
flash/intel.h \
gettext.h \
instruction.h \
part_instruction.h \
parport.h \
part.h \
register.h \
tap_register.h \
bssignal.h \
tap_state.h \
jtag.h \

@ -46,7 +46,6 @@ typedef struct
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[]);
int urj_cmd_params (char *params[]);
int urj_cmd_get_number (char *s, unsigned int *i);

@ -25,7 +25,7 @@
#ifndef URJ_DATA_REGISTER_H
#define URJ_DATA_REGISTER_H
#include "register.h"
#include "tap_register.h"
#define URJ_DATA_REGISTER_MAXLEN 32

@ -85,6 +85,8 @@ typedef struct
#define URJ_FLASH_ERROR_BLOCK_LOCKED 3
#define URJ_FLASH_ERROR_UNKNOWN 99
extern urj_flash_cfi_array_t *urj_flash_cfi_array;
void urj_flash_detectflash (urj_bus_t *bus, uint32_t adr);
void urj_flashmem (urj_bus_t *bus, FILE * f, uint32_t addr, int);

@ -22,27 +22,27 @@
*
*/
#ifndef URJ_INSTRUCTION_H
#define URJ_INSTRUCTION_H
#ifndef URJ_PART_INSTRUCTION_H
#define URJ_PART_INSTRUCTION_H
#include "register.h"
#include "tap_register.h"
#include "data_register.h"
#define URJ_INSTRUCTION_MAXLEN_INSTRUCTION 20
typedef struct urj_instruction urj_instruction_t;
typedef struct urj_part_instruction urj_part_instruction_t;
struct urj_instruction
struct urj_part_instruction
{
char name[URJ_INSTRUCTION_MAXLEN_INSTRUCTION + 1];
urj_tap_register_t *value;
urj_tap_register_t *out;
urj_data_register_t *data_register;
urj_instruction_t *next;
urj_part_instruction_t *next;
};
urj_instruction_t *urj_part_instruction_alloc (const char *name, int len,
const char *val);
void urj_part_instruction_free (urj_instruction_t *i);
urj_part_instruction_t *urj_part_instruction_alloc (const char *name, int len,
const char *val);
void urj_part_instruction_free (urj_part_instruction_t *i);
#endif /* URJ_INSTRUCTION_H */

@ -40,8 +40,8 @@
extern urj_bus_t *urj_bus;
extern int big_endian;
extern int debug_mode;
extern int urj_big_endian;
extern int urj_debug_mode;
const char *urj_cmd_jtag_get_data_dir (void);

@ -28,7 +28,7 @@
#include <stdio.h>
#include "bssignal.h"
#include "instruction.h"
#include "part_instruction.h"
#include "data_register.h"
#include "bsbit.h"
@ -48,8 +48,8 @@ struct urj_part
urj_part_signal_t *signals;
urj_part_salias_t *saliases;
int instruction_length;
urj_instruction_t *instructions;
urj_instruction_t *active_instruction;
urj_part_instruction_t *instructions;
urj_part_instruction_t *active_instruction;
urj_data_register_t *data_registers;
int boundary_length;
urj_bsbit_t **bsbits;
@ -58,8 +58,8 @@ struct urj_part
urj_part_t *urj_part_alloc (const urj_tap_register_t *id);
void urj_part_free (urj_part_t *p);
urj_part_t *read_part (FILE * f, urj_tap_register_t *idr);
urj_instruction_t *urj_part_find_instruction (urj_part_t *p,
const char *iname);
urj_part_instruction_t *urj_part_find_instruction (urj_part_t *p,
const char *iname);
urj_data_register_t *urj_part_find_data_register (urj_part_t *p,
const char *drname);
urj_part_signal_t *urj_part_find_signal (urj_part_t *p,

@ -25,7 +25,7 @@
#ifndef URJ_TAP_H
#define URJ_TAP_H
#include "register.h"
#include "tap_register.h"
#include "chain.h"
void urj_tap_reset (urj_chain_t *chain);

@ -22,8 +22,8 @@
*
*/
#ifndef URJ_REGISTER_H
#define URJ_REGISTER_H
#ifndef URJ_TAP_REGISTER_H
#define URJ_TAP_REGISTER_H
typedef struct urj_tap_register
{

@ -85,7 +85,7 @@ fjmem_detect_reg_len (urj_chain_t *chain, urj_part_t *part, char *opcode,
int len)
{
urj_data_register_t *dr;
urj_instruction_t *i;
urj_part_instruction_t *i;
int l, fjmem_reg_len;
char *tdo_bit;

@ -101,7 +101,7 @@ urj_bus_readmem (urj_bus_t *bus, FILE * f, uint32_t addr, uint32_t len)
data = URJ_BUS_READ_END (bus);
for (j = step; j > 0; j--)
if (big_endian)
if (urj_big_endian)
b[bc++] = (data >> ((j - 1) * 8)) & 0xFF;
else
{

@ -116,7 +116,7 @@ urj_bus_writemem (urj_bus_t *bus, FILE * f, uint32_t addr, uint32_t len)
data = 0;
for (j = step; j > 0; j--)
{
if (big_endian)
if (urj_big_endian)
{
data |= b[bidx++];
data <<= 8;

@ -26,9 +26,6 @@
#include <stdio.h>
#include <string.h>
#ifdef HAVE_LIBREADLINE
#include <readline/readline.h>
#endif
#include "jtag.h"
@ -127,42 +124,6 @@ const urj_cmd_t *urj_cmds[] = {
NULL /* last must be NULL */
};
#ifdef HAVE_LIBREADLINE
static char *
cmd_find_next (const char *text, int state)
{
static size_t cmd_idx, len;
if (!state)
{
cmd_idx = 0;
len = strlen (text);
}
while (urj_cmds[cmd_idx])
{
char *name = urj_cmds[cmd_idx++]->name;
if (!strncmp (name, text, len))
return strdup (name);
}
return NULL;
}
#ifdef HAVE_READLINE_COMPLETION
char **
urj_cmd_completion (const char *text, int start, int end)
{
char **ret = NULL;
if (start == 0)
ret = rl_completion_matches (text, cmd_find_next);
return ret;
}
#endif
#endif
int
urj_cmd_test_cable (urj_chain_t *chain)
{

@ -45,7 +45,7 @@ cmd_debug_run (urj_chain_t *chain, char *params[])
if (urj_cmd_get_number (params[1], &i))
return 1;
debug_mode = i;
urj_debug_mode = i;
return 1;
}

@ -27,7 +27,7 @@
#include <stdio.h>
#include <string.h>
#include "register.h"
#include "tap_register.h"
#include "jtag.h"
#include "cmd.h"

@ -39,7 +39,7 @@ cmd_endian_run (urj_chain_t *chain, char *params[])
if (!params[1])
{
if (big_endian)
if (urj_big_endian)
printf (_("Endianess for external files: big\n"));
else
printf (_("Endianess for external files: little\n"));
@ -49,12 +49,12 @@ cmd_endian_run (urj_chain_t *chain, char *params[])
if (strcasecmp (params[1], "little") == 0)
{
big_endian = 0;
urj_big_endian = 0;
return 1;
}
if (strcasecmp (params[1], "big") == 0)
{
big_endian = 1;
urj_big_endian = 1;
return 1;
}

@ -85,7 +85,7 @@ cmd_instruction_run (urj_chain_t *chain, char *params[])
if (urj_cmd_params (params) == 4)
{
urj_instruction_t *i;
urj_part_instruction_t *i;
if (strlen (params[2]) != part->instruction_length)
{

@ -110,7 +110,7 @@ urj_cmd_jtag_parse_line (urj_chain_t *chain, char *line)
a[tcnt] = NULL;
r = urj_cmd_run (chain, a);
if (debug_mode & 1)
if (urj_debug_mode & 1)
printf ("Return in urj_cmd_jtag_parse_line r=%d\n", r);
free (a);
free (sline);
@ -172,7 +172,7 @@ urj_cmd_jtag_parse_file (urj_chain_t *chain, const char *filename)
go = urj_cmd_jtag_parse_stream (chain, f);
fclose (f);
if (debug_mode & 1)
if (urj_debug_mode & 1)
printf ("File Closed gp=%d\n", go);
return go;
}

@ -104,7 +104,7 @@ cmd_print_run (urj_chain_t *chain, char *params[])
if (strcasecmp (params[1], "instructions") == 0)
{
urj_part_t *part;
urj_instruction_t *inst;
urj_part_instruction_t *inst;
snprintf (format, 128, _(" Active %%-%ds %%-%ds"),
URJ_INSTRUCTION_MAXLEN_INSTRUCTION,

@ -65,7 +65,6 @@ urj_flash_driver_t *urj_flash_flash_drivers[] = {
NULL
};
extern urj_flash_cfi_array_t *urj_flash_cfi_array;
static urj_flash_driver_t *flash_driver = NULL;
static void
@ -363,7 +362,7 @@ urj_flashmem (urj_bus_t *bus, FILE * f, uint32_t addr, int noverify)
data = 0;
for (j = 0; j < flash_driver->bus_width; j++)
if (big_endian)
if (urj_big_endian)
data = (data << 8) | b[bc + j];
else
data |= b[bc + j] << (j * 8);
@ -420,7 +419,7 @@ urj_flashmem (urj_bus_t *bus, FILE * f, uint32_t addr, int noverify)
data = 0;
for (j = 0; j < flash_driver->bus_width; j++)
if (big_endian)
if (urj_big_endian)
data = (data << 8) | b[bc + j];
else
data |= b[bc + j] << (j * 8);

@ -50,15 +50,15 @@
#include "bus.h"
#include "cmd.h"
#include "jtag.h"
#include "flash.h"
#ifndef HAVE_GETLINE
ssize_t urj_lib_getline (char **lineptr, size_t *n, FILE * stream);
#endif
int debug_mode = 0;
int big_endian = 0;
int interactive = 0;
extern urj_flash_cfi_array_t *urj_flash_cfi_array;
int urj_debug_mode = 0;
int urj_big_endian = 0;
static int urj_interactive = 0;
#define JTAGDIR ".jtag"
#define HISTORYFILE "history"
@ -92,6 +92,41 @@ jtag_create_jtagdir (void)
}
#ifdef HAVE_LIBREADLINE
static char *
cmd_find_next (const char *text, int state)
{
static size_t cmd_idx, len;
if (!state)
{
cmd_idx = 0;
len = strlen (text);
}
while (urj_cmds[cmd_idx])
{
char *name = urj_cmds[cmd_idx++]->name;
if (!strncmp (name, text, len))
return strdup (name);
}
return NULL;
}
#ifdef HAVE_READLINE_COMPLETION
static char **
urj_cmd_completion (const char *text, int start, int end)
{
char **ret = NULL;
if (start == 0)
ret = rl_completion_matches (text, cmd_find_next);
return ret;
}
#endif /* def HAVE_READLINE_COMPLETION */
#ifdef HAVE_READLINE_HISTORY
static void
@ -145,7 +180,8 @@ jtag_save_history (void)
}
#endif /* HAVE_READLINE_HISTORY */
#endif
#endif /* HAVE_READLINE */
static int
jtag_readline_multiple_commands_support (urj_chain_t *chain, char *line) /* multiple commands should be separated with '::' */
@ -345,7 +381,7 @@ main (int argc, char *const argv[])
break;
case 'i':
interactive = 1;
urj_interactive = 1;
break;
case 'h':
@ -433,7 +469,7 @@ main (int argc, char *const argv[])
}
}
if (!interactive)
if (!urj_interactive)
return 0;
}

@ -28,12 +28,12 @@
#include <stdio.h>
#include <string.h>
#include "instruction.h"
#include "part_instruction.h"
urj_instruction_t *
urj_part_instruction_t *
urj_part_instruction_alloc (const char *name, int len, const char *val)
{
urj_instruction_t *i;
urj_part_instruction_t *i;
if (!name || !val)
return NULL;
@ -69,7 +69,7 @@ urj_part_instruction_alloc (const char *name, int len, const char *val)
}
void
urj_part_instruction_free (urj_instruction_t *i)
urj_part_instruction_free (urj_part_instruction_t *i)
{
if (!i)
return;

@ -87,7 +87,7 @@ urj_part_free (urj_part_t *p)
/* instructions */
while (p->instructions)
{
urj_instruction_t *i = p->instructions;
urj_part_instruction_t *i = p->instructions;
p->instructions = i->next;
urj_part_instruction_free (i);
}
@ -108,10 +108,10 @@ urj_part_free (urj_part_t *p)
free (p);
}
urj_instruction_t *
urj_part_instruction_t *
urj_part_find_instruction (urj_part_t *p, const char *iname)
{
urj_instruction_t *i;
urj_part_instruction_t *i;
if (!p || !iname)
return NULL;

@ -95,7 +95,7 @@ struct parser_priv
struct svf_parser_params parser_params;
void *scanner;
urj_part_t *part;
urj_instruction_t *ir;
urj_part_instruction_t *ir;
urj_data_register_t *dr;
urj_svf_sxr_t sir_params;
urj_svf_sxr_t sdr_params;

@ -34,7 +34,7 @@
#include <bsdl.h>
#include "register.h"
#include "tap_register.h"
#include "tap.h"
#include "cable.h"
#include "part.h"

@ -25,7 +25,7 @@
#include <stdlib.h>
#include <string.h>
#include "register.h"
#include "tap_register.h"
urj_tap_register_t *
urj_tap_register_alloc (int len)

@ -26,7 +26,7 @@
#include <stdio.h>
#include "register.h"
#include "tap_register.h"
#include "tap.h"
#include "tap_state.h"
#include "chain.h"

Loading…
Cancel
Save