Run indent again over the renamed code. ToDo: indent the bison and flex files

git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@1521 b68d4a1b-bc3d-0410-92ed-d4ac073336b7
master
Rutger Hofman 16 years ago
parent d715fae138
commit 2dc3c156f5

@ -1,3 +1,10 @@
2009-04-23 Rutger Hofman <rfhh>
Expand tabs also in #defines -- indent skips them.
Run indent again. Since many identifiers have changed, line wraps have to
be redone.
* affects the complete code base.
2009-04-23 Rutger Hofman <rfhh>
Mechanically replace all global function/variable names w/ a prefix

@ -35,7 +35,7 @@
#ifndef URJ_BITMASK_H
#define URJ_BITMASK_H
#ifdef UNUSED /* RFHH */
#ifdef UNUSED /* RFHH */
#ifndef LANGUAGE
# ifdef __ASSEMBLY__
# define LANGUAGE ASM
@ -51,7 +51,7 @@
#ifndef C
#define C 1
#endif
#endif /* def UNUSED */
#endif /* def UNUSED */
#define URJ_MAX_BITS_ABS_VAL 1024
#define URJ_BITS_ABS(a) (((((a) + URJ_MAX_BITS_ABS_VAL) / URJ_MAX_BITS_ABS_VAL) * 2 - 1) * (a))

@ -49,8 +49,8 @@ struct urj_bsbit
int control_state;
};
urj_bsbit_t *urj_part_bsbit_alloc (int bit, const char *name, int type, urj_part_signal_t *signal,
int safe);
urj_bsbit_t *urj_part_bsbit_alloc (int bit, const char *name, int type,
urj_part_signal_t *signal, int safe);
void urj_part_bsbit_free (urj_bsbit_t *b);
#endif /* URJ_BSBIT_BSBIT_H */

@ -51,7 +51,8 @@ struct urj_part_salias
urj_part_signal_t *urj_part_signal_alloc (const char *name);
void urj_part_signal_free (urj_part_signal_t *s);
urj_part_salias_t *urj_part_salias_alloc (const char *name, const urj_part_signal_t *signal);
urj_part_salias_t *urj_part_salias_alloc (const char *name,
const urj_part_signal_t *signal);
void urj_part_salias_free (urj_part_salias_t *salias);
#endif /* URJ_BSSIGNAL_H */

@ -54,8 +54,9 @@ struct urj_bus_driver
{
const char *name;
const char *description;
urj_bus_t *(*new_bus) (urj_chain_t *chain, const urj_bus_driver_t *driver,
char *cmd_params[]);
urj_bus_t *(*new_bus) (urj_chain_t *chain,
const urj_bus_driver_t *driver,
char *cmd_params[]);
void (*free_bus) (urj_bus_t *bus);
void (*printinfo) (urj_bus_t *bus);
void (*prepare) (urj_bus_t *bus);

@ -148,14 +148,17 @@ int urj_tap_cable_get_signal_late (urj_cable_t *cable, urj_pod_sigsel_t sig);
int urj_tap_cable_defer_get_signal (urj_cable_t *cable, urj_pod_sigsel_t sig);
int urj_tap_cable_transfer (urj_cable_t *cable, int len, char *in, char *out);
int urj_tap_cable_transfer_late (urj_cable_t *cable, char *out);
int urj_tap_cable_defer_transfer (urj_cable_t *cable, int len, char *in, char *out);
int urj_tap_cable_defer_transfer (urj_cable_t *cable, int len, char *in,
char *out);
void urj_tap_cable_set_frequency (urj_cable_t *cable, uint32_t frequency);
uint32_t urj_tap_cable_get_frequency (urj_cable_t *cable);
void urj_tap_cable_wait (urj_cable_t *cable);
void urj_tap_cable_purge_queue (urj_cable_queue_info_t *q, int io);
int urj_tap_cable_add_queue_item (urj_cable_t *cable, urj_cable_queue_info_t *q);
int urj_tap_cable_get_queue_item (urj_cable_t *cable, urj_cable_queue_info_t *q);
int urj_tap_cable_add_queue_item (urj_cable_t *cable,
urj_cable_queue_info_t *q);
int urj_tap_cable_get_queue_item (urj_cable_t *cable,
urj_cable_queue_info_t *q);
extern urj_cable_driver_t *cable_drivers[];

@ -56,11 +56,14 @@ void urj_tap_chain_defer_clock (urj_chain_t *chain, int tms, int tdi, int n);
int urj_tap_chain_set_trst (urj_chain_t *chain, int trst);
int urj_tap_chain_get_trst (urj_chain_t *chain);
void urj_tap_chain_shift_instructions (urj_chain_t *chain);
void urj_tap_chain_shift_instructions_mode (urj_chain_t *chain, int capture_output,
int capture, int chain_exit);
void urj_tap_chain_shift_data_registers (urj_chain_t *chain, int capture_output);
void urj_tap_chain_shift_data_registers_mode (urj_chain_t *chain, int capture_output,
int capture, int chain_exit);
void urj_tap_chain_shift_instructions_mode (urj_chain_t *chain,
int capture_output, int capture,
int chain_exit);
void urj_tap_chain_shift_data_registers (urj_chain_t *chain,
int capture_output);
void urj_tap_chain_shift_data_registers_mode (urj_chain_t *chain,
int capture_output, int capture,
int chain_exit);
void urj_tap_chain_flush (urj_chain_t *chain);
int urj_tap_chain_set_pod_signal (urj_chain_t *chain, int mask, int val);
int urj_tap_chain_get_pod_signal (urj_chain_t *chain, urj_pod_sigsel_t sig);

@ -33,9 +33,9 @@ typedef struct urj_data_register urj_data_register_t;
struct urj_data_register
{
char name[URJ_DATA_REGISTER_MAXLEN + 1]; /* (public) register name */
urj_tap_register_t *in; /* (public) register value clocked in */
urj_tap_register_t *out; /* (public) register value clocked out */
char name[URJ_DATA_REGISTER_MAXLEN + 1]; /* (public) register name */
urj_tap_register_t *in; /* (public) register value clocked in */
urj_tap_register_t *out; /* (public) register value clocked out */
urj_data_register_t *next;
};

@ -32,11 +32,11 @@ extern "C"
# ifndef CVOID
# define CVOID
# endif
#else /* def __cplusplus */
#else /* def __cplusplus */
# ifndef CVOID
# define CVOID void
# endif
#endif /* def __cplusplus */
#endif /* def __cplusplus */
/* return real time in seconds starting at some arbitrary point in

@ -58,7 +58,8 @@ typedef struct
} urj_flash_cfi_array_t;
void urj_flash_cfi_array_free (urj_flash_cfi_array_t *cfi_array);
int urj_flash_cfi_detect (urj_bus_t *bus, uint32_t adr, urj_flash_cfi_array_t **cfi_array);
int urj_flash_cfi_detect (urj_bus_t *bus, uint32_t adr,
urj_flash_cfi_array_t **cfi_array);
/* End of brux/cfi.h */
@ -71,8 +72,8 @@ typedef struct
void (*print_info) (urj_flash_cfi_array_t *cfi_array);
int (*erase_block) (urj_flash_cfi_array_t *cfi_array, uint32_t adr);
int (*unlock_block) (urj_flash_cfi_array_t *cfi_array, uint32_t adr);
int (*program) (urj_flash_cfi_array_t *cfi_array, uint32_t adr, uint32_t *buffer,
int count);
int (*program) (urj_flash_cfi_array_t *cfi_array, uint32_t adr,
uint32_t *buffer, int count);
void (*readarray) (urj_flash_cfi_array_t *cfi_array);
} urj_flash_driver_t;
@ -84,8 +85,8 @@ typedef struct
void urj_flash_detectflash (urj_bus_t *bus, uint32_t adr);
void urj_flashmem (urj_bus_t *bus, FILE *f, uint32_t addr, int);
void urj_flashmsbin (urj_bus_t *bus, FILE *f, int);
void urj_flashmem (urj_bus_t *bus, FILE * f, uint32_t addr, int);
void urj_flashmsbin (urj_bus_t *bus, FILE * f, int);
/* end of original brux/flash.h */

@ -64,14 +64,14 @@
/* Intel CFI Status Register bits - see Table 6. in [1] and Table 7. in [2] */
#define CFI_INTEL_SR_READY URJ_BIT (7) /* 28FxxxJ3A, 28FxxxK3, 28FxxxK18 */
#define CFI_INTEL_SR_ERASE_SUSPEND URJ_BIT (6) /* 28FxxxJ3A, 28FxxxK3, 28FxxxK18 */
#define CFI_INTEL_SR_ERASE_ERROR URJ_BIT (5) /* 28FxxxJ3A, 28FxxxK3, 28FxxxK18 */
#define CFI_INTEL_SR_PROGRAM_ERROR URJ_BIT (4) /* 28FxxxJ3A, 28FxxxK3, 28FxxxK18 */
#define CFI_INTEL_SR_VPEN_ERROR URJ_BIT (3) /* 28FxxxJ3A, 28FxxxK3, 28FxxxK18 */
#define CFI_INTEL_SR_PROGRAM_SUSPEND URJ_BIT (2) /* 28FxxxJ3A, 28FxxxK3, 28FxxxK18 */
#define CFI_INTEL_SR_BLOCK_LOCKED URJ_BIT (1) /* 28FxxxJ3A, 28FxxxK3, 28FxxxK18 */
#define CFI_INTEL_SR_BEFP URJ_BIT (0) /* 28FxxxK3, 28FxxxK18 */
#define CFI_INTEL_SR_READY URJ_BIT (7) /* 28FxxxJ3A, 28FxxxK3, 28FxxxK18 */
#define CFI_INTEL_SR_ERASE_SUSPEND URJ_BIT (6) /* 28FxxxJ3A, 28FxxxK3, 28FxxxK18 */
#define CFI_INTEL_SR_ERASE_ERROR URJ_BIT (5) /* 28FxxxJ3A, 28FxxxK3, 28FxxxK18 */
#define CFI_INTEL_SR_PROGRAM_ERROR URJ_BIT (4) /* 28FxxxJ3A, 28FxxxK3, 28FxxxK18 */
#define CFI_INTEL_SR_VPEN_ERROR URJ_BIT (3) /* 28FxxxJ3A, 28FxxxK3, 28FxxxK18 */
#define CFI_INTEL_SR_PROGRAM_SUSPEND URJ_BIT (2) /* 28FxxxJ3A, 28FxxxK3, 28FxxxK18 */
#define CFI_INTEL_SR_BLOCK_LOCKED URJ_BIT (1) /* 28FxxxJ3A, 28FxxxK3, 28FxxxK18 */
#define CFI_INTEL_SR_BEFP URJ_BIT (0) /* 28FxxxK3, 28FxxxK18 */
/* Intel flash device ID codes for 28FxxxJ3A - see Table 5. in [1] */

@ -41,7 +41,8 @@ struct urj_instruction
urj_instruction_t *next;
};
urj_instruction_t *urj_part_instruction_alloc (const char *name, int len, const char *val);
urj_instruction_t *urj_part_instruction_alloc (const char *name, int len,
const char *val);
void urj_part_instruction_free (urj_instruction_t *i);
#endif /* URJ_INSTRUCTION_H */

@ -30,4 +30,4 @@
void urj_jim_some_cpu_tck_rise (urj_jim_device_t *dev);
urj_jim_device_t *urj_jim_some_cpu (void);
#endif /* ndef URJ_JIM_SOME_CPU_H */
#endif /* ndef URJ_JIM_SOME_CPU_H */

@ -47,7 +47,7 @@ const char *urj_cmd_jtag_get_data_dir (void);
int urj_cmd_jtag_parse_file (urj_chain_t *chain, const char *filename);
int urj_cmd_jtag_parse_line (urj_chain_t *chain, char *line);
int urj_cmd_jtag_parse_stream (urj_chain_t *chain, FILE *f);
int urj_cmd_jtag_parse_stream (urj_chain_t *chain, FILE * f);
int urj_tap_detect_parts (urj_chain_t *chain, const char *db_path);
int urj_tap_manual_add (urj_chain_t *chain, int instr_len);
@ -55,8 +55,8 @@ int urj_tap_detect_register_size (urj_chain_t *chain);
void urj_tap_discovery (urj_chain_t *chain);
void urj_tap_urj_tap_idcode (urj_chain_t *chain, unsigned int bytes);
void urj_bus_readmem (urj_bus_t *bus, FILE *f, uint32_t addr, uint32_t len);
void urj_bus_writemem (urj_bus_t *bus, FILE *f, uint32_t addr, uint32_t len);
void urj_bus_readmem (urj_bus_t *bus, FILE * f, uint32_t addr, uint32_t len);
void urj_bus_writemem (urj_bus_t *bus, FILE * f, uint32_t addr, uint32_t len);
void urj_flasherase (urj_bus_t *bus, uint32_t addr, int number);

@ -57,12 +57,16 @@ 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_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, const char *signalname);
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_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,
const char *signalname);
void urj_part_set_instruction (urj_part_t *p, const char *iname);
void urj_part_set_signal (urj_part_t *p, urj_part_signal_t *s, int out, int val);
void urj_part_set_signal (urj_part_t *p, urj_part_signal_t *s, int out,
int val);
int urj_part_get_signal (urj_part_t *p, urj_part_signal_t *s);
void urj_part_print (urj_part_t *p);

@ -26,15 +26,15 @@
typedef enum
{
URJ_POD_CS_NONE = 0, // no/invalid signal
URJ_POD_CS_TDI = (1 << 0), // out: JTAG/SPI data in
URJ_POD_CS_TCK = (1 << 1), // out: JTAG/SPI clock
URJ_POD_CS_TMS = (1 << 2), // out: JTAG test mode select/SPI slave select
URJ_POD_CS_TRST = (1 << 3), // out: JTAG TAP reset
URJ_POD_CS_NONE = 0, // no/invalid signal
URJ_POD_CS_TDI = (1 << 0), // out: JTAG/SPI data in
URJ_POD_CS_TCK = (1 << 1), // out: JTAG/SPI clock
URJ_POD_CS_TMS = (1 << 2), // out: JTAG test mode select/SPI slave select
URJ_POD_CS_TRST = (1 << 3), // out: JTAG TAP reset
URJ_POD_CS_RESET = (1 << 4), // out: system reset
URJ_POD_CS_SCK = (1 << 5), // out: I2C clock (not yet used)
URJ_POD_CS_SDA = (1 << 6), // inout: I2C data (not yet used)
URJ_POD_CS_SS = (1 << 7), // out: SPI slave select (not yet used)
URJ_POD_CS_SCK = (1 << 5), // out: I2C clock (not yet used)
URJ_POD_CS_SDA = (1 << 6), // inout: I2C data (not yet used)
URJ_POD_CS_SS = (1 << 7), // out: SPI slave select (not yet used)
}
urj_pod_sigsel_t;

@ -38,12 +38,16 @@ void urj_tap_register_free (urj_tap_register_t *tr);
urj_tap_register_t *urj_tap_register_fill (urj_tap_register_t *tr, int val);
const char *urj_tap_register_get_string (const urj_tap_register_t *tr);
int urj_tap_register_all_bits_same_value (const urj_tap_register_t *tr);
urj_tap_register_t *urj_tap_register_init (urj_tap_register_t *tr, const char *value);
int urj_tap_register_compare (const urj_tap_register_t *tr, const urj_tap_register_t *tr2);
urj_tap_register_t *urj_tap_register_init (urj_tap_register_t *tr,
const char *value);
int urj_tap_register_compare (const urj_tap_register_t *tr,
const urj_tap_register_t *tr2);
int urj_tap_register_match (const urj_tap_register_t *tr, const char *expr);
urj_tap_register_t *urj_tap_register_inc (urj_tap_register_t *tr);
urj_tap_register_t *urj_tap_register_dec (urj_tap_register_t *tr);
urj_tap_register_t *urj_tap_register_shift_right (urj_tap_register_t *tr, int shift);
urj_tap_register_t *urj_tap_register_shift_left (urj_tap_register_t *tr, int shift);
urj_tap_register_t *urj_tap_register_shift_right (urj_tap_register_t *tr,
int shift);
urj_tap_register_t *urj_tap_register_shift_left (urj_tap_register_t *tr,
int shift);
#endif /* URJ_REGISTER_H */

@ -32,11 +32,14 @@ void urj_tap_reset (urj_chain_t *chain);
void urj_tap_reset_bypass (urj_chain_t *chain);
void urj_tap_capture_dr (urj_chain_t *chain);
void urj_tap_capture_ir (urj_chain_t *chain);
void urj_tap_defer_shift_register (urj_chain_t *chain, const urj_tap_register_t *in,
urj_tap_register_t *out, int tap_exit);
void urj_tap_shift_register_output (urj_chain_t *chain, const urj_tap_register_t *in,
urj_tap_register_t *out, int tap_exit);
void urj_tap_shift_register (urj_chain_t *chain, const urj_tap_register_t *in,
urj_tap_register_t *out, int tap_exit);
void urj_tap_defer_shift_register (urj_chain_t *chain,
const urj_tap_register_t *in,
urj_tap_register_t *out, int tap_exit);
void urj_tap_shift_register_output (urj_chain_t *chain,
const urj_tap_register_t *in,
urj_tap_register_t *out, int tap_exit);
void urj_tap_shift_register (urj_chain_t *chain,
const urj_tap_register_t *in,
urj_tap_register_t *out, int tap_exit);
#endif /* URJ_TAP_H */

@ -31,12 +31,12 @@
#define URJ_TAP_STATE_DR URJ_BIT (0)
#define URJ_TAP_STATE_IR URJ_BIT (1)
#define URJ_TAP_STATE_SHIFT URJ_BIT (2) /* register shift with TMS = 0 */
#define URJ_TAP_STATE_IDLE URJ_BIT (3) /* to Run-Test/Idle with TMS = 0 */
#define URJ_TAP_STATE_CAPTURE URJ_BIT (4) /* Capture state */
#define URJ_TAP_STATE_UPDATE URJ_BIT (5) /* to Update with TMS = 1 */
#define URJ_TAP_STATE_PAUSE URJ_BIT (6) /* to Pause with TMS = 0 */
#define URJ_TAP_STATE_RESET URJ_BIT (7) /* Test-Logic-Reset or unknown state */
#define URJ_TAP_STATE_SHIFT URJ_BIT (2) /* register shift with TMS = 0 */
#define URJ_TAP_STATE_IDLE URJ_BIT (3) /* to Run-Test/Idle with TMS = 0 */
#define URJ_TAP_STATE_CAPTURE URJ_BIT (4) /* Capture state */
#define URJ_TAP_STATE_UPDATE URJ_BIT (5) /* to Update with TMS = 1 */
#define URJ_TAP_STATE_PAUSE URJ_BIT (6) /* to Pause with TMS = 0 */
#define URJ_TAP_STATE_RESET URJ_BIT (7) /* Test-Logic-Reset or unknown state */
#define URJ_TAP_STATE_UNKNOWN_STATE URJ_TAP_STATE_RESET
#define URJ_TAP_STATE_TEST_LOGIC_RESET (URJ_TAP_STATE_RESET | URJ_TAP_STATE_IDLE)

@ -65,7 +65,8 @@ int usbconn_free (urj_usbconn_t *conn);
int urj_tap_usbconn_open (urj_usbconn_t *conn);
int urj_tap_usbconn_close (urj_usbconn_t *conn);
int urj_tap_usbconn_read (urj_usbconn_t *conn, uint8_t *buf, int len);
int urj_tap_usbconn_write (urj_usbconn_t *conn, uint8_t *buf, int len, int recv);
int urj_tap_usbconn_write (urj_usbconn_t *conn, uint8_t *buf, int len,
int recv);
extern urj_usbconn_driver_t *usbconn_drivers[];
#endif /* URJ_USBCONN_H */

@ -117,8 +117,8 @@ urj_bsdl_msg (int proc_mode, int type, const char *format, ...)
*
****************************************************************************/
int
urj_bsdl_read_file (urj_chain_t *chain, const char *BSDL_File_Name, int proc_mode,
const char *idcode)
urj_bsdl_read_file (urj_chain_t *chain, const char *BSDL_File_Name,
int proc_mode, const char *idcode)
{
urj_bsdl_globs_t *globs = &(chain->bsdl);
FILE *BSDL_File;
@ -138,13 +138,13 @@ urj_bsdl_read_file (urj_chain_t *chain, const char *BSDL_File_Name, int proc_mod
if (chain == NULL)
{
urj_bsdl_msg (proc_mode, BSDL_MSG_ERR,
_("No JTAG chain available\n"));
_("No JTAG chain available\n"));
return -1;
}
if (chain->parts == NULL)
{
urj_bsdl_msg (proc_mode, BSDL_MSG_ERR,
_("Chain without any parts\n"));
_("Chain without any parts\n"));
return -1;
}
if (!(chain && chain->parts))
@ -162,13 +162,13 @@ urj_bsdl_read_file (urj_chain_t *chain, const char *BSDL_File_Name, int proc_mod
BSDL_File = fopen (BSDL_File_Name, "r");
urj_bsdl_msg (proc_mode, BSDL_MSG_NOTE, _("Reading file '%s'\n"),
BSDL_File_Name);
BSDL_File_Name);
if (BSDL_File == NULL)
{
urj_bsdl_msg (proc_mode,
BSDL_MSG_ERR, _("Unable to open BSDL file '%s'\n"),
BSDL_File_Name);
BSDL_MSG_ERR, _("Unable to open BSDL file '%s'\n"),
BSDL_File_Name);
return -1;
}
@ -183,26 +183,27 @@ urj_bsdl_read_file (urj_chain_t *chain, const char *BSDL_File_Name, int proc_mod
if (Compile_Errors == 0)
{
urj_bsdl_msg (proc_mode,
BSDL_MSG_NOTE,
_("BSDL file '%s' passed VHDL stage correctly\n"),
BSDL_File_Name);
BSDL_MSG_NOTE,
_("BSDL file '%s' passed VHDL stage correctly\n"),
BSDL_File_Name);
result = urj_bsdl_process_elements (&jtag_ctrl, idcode);
if (result >= 0)
urj_bsdl_msg (proc_mode,
BSDL_MSG_NOTE,
_("BSDL file '%s' passed BSDL stage correctly\n"),
BSDL_File_Name);
BSDL_MSG_NOTE,
_
("BSDL file '%s' passed BSDL stage correctly\n"),
BSDL_File_Name);
}
else
{
urj_bsdl_msg (proc_mode,
BSDL_MSG_ERR,
_
("BSDL file '%s' contains errors in VHDL stage, stopping\n"),
BSDL_File_Name);
BSDL_MSG_ERR,
_
("BSDL file '%s' contains errors in VHDL stage, stopping\n"),
BSDL_File_Name);
}
@ -275,7 +276,7 @@ urj_bsdl_set_path (urj_chain_t *chain, const char *pathlist)
if (globs->debug)
for (num = 0; globs->path_list[num] != NULL; num++)
urj_bsdl_msg (URJ_BSDL_MODE_MSG_ALL,
BSDL_MSG_NOTE, "%s\n", globs->path_list[num]);
BSDL_MSG_NOTE, "%s\n", globs->path_list[num]);
}
@ -339,7 +340,7 @@ urj_bsdl_scan_files (urj_chain_t *chain, const char *idcode, int proc_mode)
{
result =
urj_bsdl_read_file (chain, name, proc_mode,
idcode);
idcode);
if (result == 1)
printf (_(" Filename: %s\n"), name);
}
@ -353,8 +354,8 @@ urj_bsdl_scan_files (urj_chain_t *chain, const char *idcode, int proc_mode)
}
else
urj_bsdl_msg (proc_mode,
BSDL_MSG_WARN, _("Cannot open directory %s\n"),
globs->path_list[idx]);
BSDL_MSG_WARN, _("Cannot open directory %s\n"),
globs->path_list[idx]);
idx++;
}

@ -174,8 +174,9 @@ urj_bsdl_emit_ports (urj_bsdl_jtag_ctrl_t *jc)
}
else
urj_bsdl_msg (jc->proc_mode,
BSDL_MSG_FATAL, _("Out of memory, %s line %i\n"),
__FILE__, __LINE__);
BSDL_MSG_FATAL,
_("Out of memory, %s line %i\n"), __FILE__,
__LINE__);
name = name->next;
}
@ -247,7 +248,7 @@ urj_bsdl_process_idcode (urj_bsdl_jtag_ctrl_t *jc)
create_register (jc, "DIR", strlen (jc->idcode));
else
urj_bsdl_msg (jc->proc_mode,
BSDL_MSG_WARN, _("No IDCODE specification found.\n"));
BSDL_MSG_WARN, _("No IDCODE specification found.\n"));
return 1;
}
@ -580,8 +581,8 @@ parse_vhdl_elem (urj_bsdl_parser_priv_t *priv, urj_bsdl_vhdl_elem_t *elem)
if (!buf)
{
urj_bsdl_msg (priv->jtag_ctrl->proc_mode,
BSDL_MSG_FATAL, _("Out of memory, %s line %i\n"), __FILE__,
__LINE__);
BSDL_MSG_FATAL, _("Out of memory, %s line %i\n"),
__FILE__, __LINE__);
return -1;
}
buf[0] = '\0';
@ -679,10 +680,10 @@ compare_idcode (urj_bsdl_jtag_ctrl_t *jc, const char *idcode)
if (idcode_match)
urj_bsdl_msg (jc->proc_mode,
BSDL_MSG_NOTE, _("IDCODE matched\n"));
BSDL_MSG_NOTE, _("IDCODE matched\n"));
else
urj_bsdl_msg (jc->proc_mode,
BSDL_MSG_NOTE, _("IDCODE mismatch\n"));
BSDL_MSG_NOTE, _("IDCODE mismatch\n"));
}
}
@ -730,8 +731,8 @@ urj_bsdl_process_elements (urj_bsdl_jtag_ctrl_t *jc, const char *idcode)
if (!(result & URJ_BSDL_MODE_SYN_CHECK))
{
urj_bsdl_msg (jc->proc_mode,
BSDL_MSG_ERR,
_("BSDL stage reported errors, aborting.\n"));
BSDL_MSG_ERR,
_("BSDL stage reported errors, aborting.\n"));
urj_bsdl_parser_deinit (priv);
return -1;
}
@ -739,19 +740,21 @@ urj_bsdl_process_elements (urj_bsdl_jtag_ctrl_t *jc, const char *idcode)
if (jc->idcode)
urj_bsdl_msg (jc->proc_mode,
BSDL_MSG_NOTE, _("Got IDCODE: %s\n"), jc->idcode);
BSDL_MSG_NOTE, _("Got IDCODE: %s\n"), jc->idcode);
if (jc->proc_mode & URJ_BSDL_MODE_IDCODE_CHECK)
result |= compare_idcode (jc, idcode);
if (jc->proc_mode & (URJ_BSDL_MODE_INSTR_EXEC | URJ_BSDL_MODE_INSTR_PRINT))
if (jc->
proc_mode & (URJ_BSDL_MODE_INSTR_EXEC | URJ_BSDL_MODE_INSTR_PRINT))
/* IDCODE check positive if requested? */
if (((jc->proc_mode & URJ_BSDL_MODE_IDCODE_CHECK) &&
(result & URJ_BSDL_MODE_IDCODE_CHECK))
|| (!(jc->proc_mode & URJ_BSDL_MODE_IDCODE_CHECK)))
result |= build_commands (priv);
if ((result & jc->proc_mode) == (jc->proc_mode & URJ_BSDL_MODE_ACTION_ALL))
if ((result & jc->proc_mode) ==
(jc->proc_mode & URJ_BSDL_MODE_ACTION_ALL))
if (jc->proc_mode & URJ_BSDL_MODE_IDCODE_CHECK)
result = 1;
else

@ -36,7 +36,8 @@ int urj_vhdl_flex_postinc_compile_errors (void *);
int urj_vhdl_flex_get_lineno (void *);
/* VHDL parser declarations */
urj_bsdl_vhdl_parser_priv_t *urj_vhdl_parser_init (FILE *, urj_bsdl_jtag_ctrl_t *);
urj_bsdl_vhdl_parser_priv_t *urj_vhdl_parser_init (FILE *,
urj_bsdl_jtag_ctrl_t *);
void urj_vhdl_parser_deinit (urj_bsdl_vhdl_parser_priv_t *);
int urj_vhdl_parse (urj_bsdl_vhdl_parser_priv_t *);

@ -147,7 +147,9 @@ au1500_bus_area (urj_bus_t *bus, uint32_t addr, urj_bus_area_t *area)
area->length = UINT64_C (0x00100000000);
// area->width = 16;
area->width =
urj_part_get_signal (bus->part, urj_part_find_signal (bus->part, "ROMSIZ")) ? 16 : 32;
urj_part_get_signal (bus->part,
urj_part_find_signal (bus->part,
"ROMSIZ")) ? 16 : 32;
return URJ_STATUS_OK;

@ -130,7 +130,8 @@ typedef struct
/* ------------------------------------------------------------------------- */
static inline void
register_set_bit (urj_tap_register_t *tr, unsigned int bitno, unsigned int val)
register_set_bit (urj_tap_register_t *tr, unsigned int bitno,
unsigned int val)
{
tr->data[bitno] = (val) ? 1 : 0;
}
@ -149,8 +150,10 @@ shift_instr (urj_bus_t *bus, unsigned int bit)
do
{
DBG (DBG_SHIFT, _("%s: instr=%s\n"), __FUNCTION__,
urj_tap_register_get_string (bus->part->active_instruction->value));
urj_tap_chain_shift_instructions_mode (bus->chain, 1, 1, URJ_CHAIN_EXITMODE_IDLE);
urj_tap_register_get_string (bus->part->active_instruction->
value));
urj_tap_chain_shift_instructions_mode (bus->chain, 1, 1,
URJ_CHAIN_EXITMODE_IDLE);
DBG (DBG_SHIFT, _("%s: ret=%s\n"), __FUNCTION__,
urj_tap_register_get_string (r));
/* TODO: add timeout checking */
@ -245,7 +248,8 @@ mwa_scan_out_data (urj_bus_t *bus, uint32_t *pdata)
}
static inline void
mwa_read_word (urj_bus_t *bus, unsigned int slave, uint32_t addr, uint32_t *data)
mwa_read_word (urj_bus_t *bus, unsigned int slave, uint32_t addr,
uint32_t *data)
{
mwa_scan_in_instr (bus);
mwa_scan_in_addr (bus, slave, addr, ACCESS_MODE_READ);
@ -253,7 +257,8 @@ mwa_read_word (urj_bus_t *bus, unsigned int slave, uint32_t addr, uint32_t *data
}
static inline void
mwa_write_word (urj_bus_t *bus, unsigned int slave, uint32_t addr, uint32_t data)
mwa_write_word (urj_bus_t *bus, unsigned int slave, uint32_t addr,
uint32_t data)
{
mwa_scan_in_instr (bus);
mwa_scan_in_addr (bus, slave, addr, ACCESS_MODE_WRITE);
@ -387,7 +392,8 @@ nexus_memacc_read (urj_bus_t *bus, uint32_t *data)
}
static int
nexus_memacc_write (urj_bus_t *bus, uint32_t addr, uint32_t data, uint32_t rwcs)
nexus_memacc_write (urj_bus_t *bus, uint32_t addr, uint32_t data,
uint32_t rwcs)
{
uint32_t status;
int ret;
@ -414,7 +420,8 @@ nexus_memacc_write (urj_bus_t *bus, uint32_t addr, uint32_t data, uint32_t rwcs)
/* ------------------------------------------------------------------------- */
static void
avr32_bus_setup (urj_bus_t *bus, urj_chain_t *chain, urj_part_t *part, unsigned int mode)
avr32_bus_setup (urj_bus_t *bus, urj_chain_t *chain, urj_part_t *part,
unsigned int mode)
{
bus->chain = chain;
bus->part = part;
@ -474,7 +481,8 @@ check_instruction (urj_part_t *part, const char *instr)
*
*/
static urj_bus_t *
avr32_bus_new (urj_chain_t *chain, const urj_bus_driver_t *driver, char *cmd_params[])
avr32_bus_new (urj_chain_t *chain, const urj_bus_driver_t *driver,
char *cmd_params[])
{
urj_bus_t *bus;
urj_part_t *part;

@ -302,8 +302,8 @@ static int addr;
static uint64_t base = 0x1fc00000;
static int
bcm1250_ejtag_do (urj_bus_t *bus, uint64_t ad, uint64_t da, int read, int type,
unsigned char *buf, int verbose)
bcm1250_ejtag_do (urj_bus_t *bus, uint64_t ad, uint64_t da, int read,
int type, unsigned char *buf, int verbose)
{
urj_part_t *p = bus->part;
@ -438,7 +438,7 @@ bcm1250_ejtag_do (urj_bus_t *bus, uint64_t ad, uint64_t da, int read, int type,
urj_tap_chain_shift_data_registers (chain, 1);
while ((p->active_instruction->data_register->out->data[276 - 17] ==
0) &&to--)
0) && to--)
{
urj_tap_chain_shift_data_registers (chain, 1);
}

@ -185,8 +185,8 @@ flashbscoach_bus_init (urj_bus_t *bus)
urj_part_set_signal (p, DECA, 1, 1);
urj_part_set_signal (p, DECB, 1, 1);
urj_part_set_signal (p, DECC, 1, 1);
urj_part_set_signal (p, OE_F, 1, 1); //OE_F low aktiv
urj_part_set_signal (p, WE_F, 1, 1); //WE_F low aktiv
urj_part_set_signal (p, OE_F, 1, 1); //OE_F low aktiv
urj_part_set_signal (p, WE_F, 1, 1); //WE_F low aktiv
for (i = 0; i < 15; i++)
urj_part_set_signal (p, ADR[i], 1, 1);
@ -300,8 +300,8 @@ flashbscoach_bus_read_start (urj_bus_t *bus, uint32_t adr)
urj_part_set_signal (p, DECA, 1, 0);
urj_part_set_signal (p, DECB, 1, 1);
urj_part_set_signal (p, DECC, 1, 1);
urj_part_set_signal (p, OE_F, 1, 0); //OE_F low aktiv
urj_part_set_signal (p, WE_F, 1, 1); //WE_F low aktiv
urj_part_set_signal (p, OE_F, 1, 0); //OE_F low aktiv
urj_part_set_signal (p, WE_F, 1, 1); //WE_F low aktiv
setup_address (bus, adr);
set_data_in (bus);
@ -345,8 +345,8 @@ flashbscoach_bus_read_end (urj_bus_t *bus)
urj_part_set_signal (p, DECA, 1, 1);
urj_part_set_signal (p, DECB, 1, 1);
urj_part_set_signal (p, DECC, 1, 1);
urj_part_set_signal (p, OE_F, 1, 1); //OE_F low aktiv
urj_part_set_signal (p, WE_F, 1, 1); //WE_F low aktiv
urj_part_set_signal (p, OE_F, 1, 1); //OE_F low aktiv
urj_part_set_signal (p, WE_F, 1, 1); //WE_F low aktiv
urj_tap_chain_shift_data_registers (chain, 1);
@ -366,8 +366,8 @@ flashbscoach_bus_write (urj_bus_t *bus, uint32_t adr, uint32_t data)
urj_part_set_signal (p, DECA, 1, 0);
urj_part_set_signal (p, DECB, 1, 1);
urj_part_set_signal (p, DECC, 1, 1);
urj_part_set_signal (p, OE_F, 1, 1); //OE_F low aktiv
urj_part_set_signal (p, WE_F, 1, 1); //WE_F low aktiv
urj_part_set_signal (p, OE_F, 1, 1); //OE_F low aktiv
urj_part_set_signal (p, WE_F, 1, 1); //WE_F low aktiv
setup_address (bus, adr);
setup_data (bus, data);
@ -380,8 +380,8 @@ flashbscoach_bus_write (urj_bus_t *bus, uint32_t adr, uint32_t data)
urj_part_set_signal (p, DECA, 1, 1);
urj_part_set_signal (p, DECB, 1, 1);
urj_part_set_signal (p, DECC, 1, 1);
urj_part_set_signal (p, OE_F, 1, 1); //OE_F low aktiv
urj_part_set_signal (p, WE_F, 1, 1); //WE_F low aktiv
urj_part_set_signal (p, OE_F, 1, 1); //OE_F low aktiv
urj_part_set_signal (p, WE_F, 1, 1); //WE_F low aktiv
urj_tap_chain_shift_data_registers (chain, 0);
}

@ -114,7 +114,8 @@ typedef struct
*
*/
static urj_bus_t *
ejtag_bus_new (urj_chain_t *chain, const urj_bus_driver_t *driver, char *cmd_params[])
ejtag_bus_new (urj_chain_t *chain, const urj_bus_driver_t *driver,
char *cmd_params[])
{
urj_bus_t *bus;
@ -201,14 +202,16 @@ ejtag_run_pracc (urj_bus_t *bus, const uint32_t *code, unsigned int len)
if (ejctrl->out->data[Rocc])
{
printf (_("%s(%d) Reset occurred, ctrl=%s\n"),
__FILE__, __LINE__, urj_tap_register_get_string (ejctrl->out));
__FILE__, __LINE__,
urj_tap_register_get_string (ejctrl->out));
bus->initialized = 0;
break;
}
if (!ejctrl->out->data[PrAcc])
{
printf (_("%s(%d) No processor access, ctrl=%s\n"),
__FILE__, __LINE__, urj_tap_register_get_string (ejctrl->out));
__FILE__, __LINE__,
urj_tap_register_get_string (ejctrl->out));
bus->initialized = 0;
break;
}
@ -312,8 +315,8 @@ ejtag_bus_init (urj_bus_t *bus)
urj_part_set_instruction (bus->part, "EJTAG_IMPCODE");
urj_tap_chain_shift_instructions (bus->chain);
urj_tap_chain_shift_data_registers (bus->chain, 0); //Write
urj_tap_chain_shift_data_registers (bus->chain, 1); //Read
urj_tap_chain_shift_data_registers (bus->chain, 0); //Write
urj_tap_chain_shift_data_registers (bus->chain, 1); //Read
printf ("ImpCode=%s %08X\n", urj_tap_register_get_string (ejimpl->out),
reg_value (ejimpl->out));
BP->impcode = reg_value (ejimpl->out);
@ -355,10 +358,10 @@ ejtag_bus_init (urj_bus_t *bus)
urj_tap_register_fill (ejctrl->in, 0);
ejctrl->in->data[PrRst] = 1;
ejctrl->in->data[PerRst] = 1;
urj_tap_chain_shift_data_registers (bus->chain, 0); //Write
urj_tap_chain_shift_data_registers (bus->chain, 0); //Write
ejctrl->in->data[PrRst] = 0;
ejctrl->in->data[PerRst] = 0;
urj_tap_chain_shift_data_registers (bus->chain, 0); //Write
urj_tap_chain_shift_data_registers (bus->chain, 0); //Write
//
if (EJTAG_VER == EJTAG_20)
{
@ -370,9 +373,10 @@ ejtag_bus_init (urj_bus_t *bus)
urj_part_set_instruction (bus->part, "EJTAG_ADDRESS");
urj_tap_chain_shift_instructions (bus->chain);
//Set to Debug Control Register Address, 0xFF300000
urj_tap_register_init (ejaddr->in, "11111111001100000000000000000000");
urj_tap_register_init (ejaddr->in,
"11111111001100000000000000000000");
// printf("Write to ejaddr->in =%s %08X\n",urj_tap_register_get_string( ejaddr->in),reg_value( ejaddr->in ) );
urj_tap_chain_shift_data_registers (bus->chain, 0); //Write
urj_tap_chain_shift_data_registers (bus->chain, 0); //Write
// printf("Select EJTAG CONTROL Register\n");
urj_part_set_instruction (bus->part, "EJTAG_CONTROL");
urj_tap_chain_shift_instructions (bus->chain);
@ -384,7 +388,7 @@ ejtag_bus_init (urj_bus_t *bus)
ejctrl->in->data[DStrt] = 1; // 11------|
ejctrl->in->data[DrWn] = 1; // 9-------|
ejctrl->in->data[Dsz1] = 1; // 8-------| DMA_WORD = 0x00000100 = Bit8
urj_tap_chain_shift_data_registers (bus->chain, 1); //WriteRead
urj_tap_chain_shift_data_registers (bus->chain, 1); //WriteRead
// printf("Write To ejctrl->in =%s %08X\n",urj_tap_register_get_string( ejctrl->in), reg_value( ejctrl->in ) );
// printf("Read From ejctrl->out =%s %08X\n",urj_tap_register_get_string( ejctrl->out),reg_value( ejctrl->out ) );
do
@ -397,7 +401,7 @@ ejtag_bus_init (urj_bus_t *bus)
ejctrl->in->data[PrAcc] = 1; // 18----||
ejctrl->in->data[DmaAcc] = 1; // 17----||
ejctrl->in->data[ProbEn] = 1; // 15-----|
urj_tap_chain_shift_data_registers (bus->chain, 1); //WriteRead
urj_tap_chain_shift_data_registers (bus->chain, 1); //WriteRead
// printf("Write To ejctrl->in =%s %08X\n",urj_tap_register_get_string( ejctrl->in), reg_value( ejctrl->in ) );
// printf("Read From ejctrl->out =%s %08X\n",urj_tap_register_get_string( ejctrl->out),reg_value( ejctrl->out ) );
}
@ -406,7 +410,7 @@ ejtag_bus_init (urj_bus_t *bus)
urj_part_set_instruction (bus->part, "EJTAG_DATA");
urj_tap_chain_shift_instructions (bus->chain);
urj_tap_register_fill (ejdata->in, 0); // Clear Register
urj_tap_chain_shift_data_registers (bus->chain, 1); //WriteRead
urj_tap_chain_shift_data_registers (bus->chain, 1); //WriteRead
// printf( "Write To ejdata->in =%s %08X\n", urj_tap_register_get_string( ejdata->in), reg_value( ejdata->in ) );
// printf( "Read From ejdata->out =%s %08X\n", urj_tap_register_get_string( ejdata->out),reg_value( ejdata->out ) );
// printf("Select EJTAG CONTROL Register\n");
@ -416,7 +420,7 @@ ejtag_bus_init (urj_bus_t *bus)
//Set some bits in CONTROL Register 0x00048000
ejctrl->in->data[PrAcc] = 1; // 18----||
ejctrl->in->data[ProbEn] = 1; // 15-----|
urj_tap_chain_shift_data_registers (bus->chain, 1); //WriteRead
urj_tap_chain_shift_data_registers (bus->chain, 1); //WriteRead
// printf("Write To ejctrl->in =%s %08X\n",urj_tap_register_get_string( ejctrl->in), reg_value( ejctrl->in ) );
// printf("Read From ejctrl->out =%s %08X\n",urj_tap_register_get_string( ejctrl->out),reg_value( ejctrl->out ) );
if (ejctrl->out->data[DeRR] == 1)
@ -424,7 +428,8 @@ ejtag_bus_init (urj_bus_t *bus)
printf ("DMA READ ERROR\n");
}
//Now have data from DCR, need to reset the MP Bit (2) and write it back out
urj_tap_register_init (ejdata->in, urj_tap_register_get_string (ejdata->out));
urj_tap_register_init (ejdata->in,
urj_tap_register_get_string (ejdata->out));
ejdata->in->data[MemProt] = 0;
// printf( "Need to Write ejdata-> =%s %08X\n", urj_tap_register_get_string( ejdata->in),reg_value( ejdata->in ) );
@ -433,16 +438,17 @@ ejtag_bus_init (urj_bus_t *bus)
// printf("Select EJTAG ADDRESS Register\n");
urj_part_set_instruction (bus->part, "EJTAG_ADDRESS");
urj_tap_chain_shift_instructions (bus->chain);
urj_tap_register_init (ejaddr->in, "11111111001100000000000000000000");
urj_tap_register_init (ejaddr->in,
"11111111001100000000000000000000");
// printf("Write to ejaddr->in =%s %08X\n",urj_tap_register_get_string( ejaddr->in), reg_value( ejaddr->in ) );
//This appears to be a write with NO Read
urj_tap_chain_shift_data_registers (bus->chain, 0); //Write
urj_tap_chain_shift_data_registers (bus->chain, 0); //Write
// printf("Select EJTAG DATA Register\n");
urj_part_set_instruction (bus->part, "EJTAG_DATA");
urj_tap_chain_shift_instructions (bus->chain);
//The value is already in ejdata->in, so write it
// printf("Write To ejdata->in =%s %08X\n", urj_tap_register_get_string( ejdata->in),reg_value( ejdata->in ) );
urj_tap_chain_shift_data_registers (bus->chain, 0); //Write
urj_tap_chain_shift_data_registers (bus->chain, 0); //Write
// printf("Select EJTAG CONTROL Register\n");
urj_part_set_instruction (bus->part, "EJTAG_CONTROL");
urj_tap_chain_shift_instructions (bus->chain);
@ -454,7 +460,7 @@ ejtag_bus_init (urj_bus_t *bus)
ejctrl->in->data[DStrt] = 1; // 11
ejctrl->in->data[ProbEn] = 1; // 15
ejctrl->in->data[PrAcc] = 1; // 18
urj_tap_chain_shift_data_registers (bus->chain, 1); //Write/Read
urj_tap_chain_shift_data_registers (bus->chain, 1); //Write/Read
// printf("Write to ejctrl->in =%s %08X\n",urj_tap_register_get_string( ejctrl->in), reg_value( ejctrl->in ) );
// printf("Read from ejctrl->out =%s %08X\n",urj_tap_register_get_string( ejctrl->out), reg_value( ejctrl->out ) );
do
@ -466,7 +472,7 @@ ejtag_bus_init (urj_bus_t *bus)
ejctrl->in->data[DmaAcc] = 1; // 17
ejctrl->in->data[ProbEn] = 1; // 15
ejctrl->in->data[PrAcc] = 1; // 18
urj_tap_chain_shift_data_registers (bus->chain, 1); //Write/Read
urj_tap_chain_shift_data_registers (bus->chain, 1); //Write/Read
// printf("Write to ejctrl->in =%s %08X\n",urj_tap_register_get_string( ejctrl->in), reg_value( ejctrl->in ) );
// printf("Read from ejctrl->out =%s %08X\n",urj_tap_register_get_string( ejctrl->out), reg_value( ejctrl->out ) );
}
@ -478,7 +484,7 @@ ejtag_bus_init (urj_bus_t *bus)
//Set some bits in CONTROL Register 0x00048000
ejctrl->in->data[PrAcc] = 1; // 18----||
ejctrl->in->data[ProbEn] = 1; // 15-----|
urj_tap_chain_shift_data_registers (bus->chain, 1); //Write/Read
urj_tap_chain_shift_data_registers (bus->chain, 1); //Write/Read
// printf("Write To ejctrl->in =%s %08X\n",urj_tap_register_get_string( ejctrl->in),reg_value( ejctrl->in ) );
// printf("Read From ejctrl->out =%s %08X\n",urj_tap_register_get_string( ejctrl->out),reg_value( ejctrl->out ) );
if (ejctrl->out->data[DeRR] == 1)
@ -513,7 +519,8 @@ ejtag_bus_init (urj_bus_t *bus)
if (!ejctrl->out->data[BrkSt])
{
printf (_("%s(%d) Failed to enter debug mode, ctrl=%s\n"),
__FILE__, __LINE__, urj_tap_register_get_string (ejctrl->out));
__FILE__, __LINE__,
urj_tap_register_get_string (ejctrl->out));
return URJ_STATUS_FAIL;
}
else

@ -201,7 +201,7 @@ ejtag_dma_write (unsigned int addr, unsigned int data, int sz)
urj_tap_chain_shift_instructions (bus->chain);
for (i = 0; i < 32; i++)
ejaddr->in->data[i] = (addr >> i) & 1;
urj_tap_chain_shift_data_registers (bus->chain, 0); /* Push the address to write */
urj_tap_chain_shift_data_registers (bus->chain, 0); /* Push the address to write */
#ifdef PRINT_DATA_DEBUG
printf ("Wrote to ejaddr->in =%s %08X\n",
urj_tap_register_get_string (ejaddr->in), reg_value (ejaddr->in));
@ -210,7 +210,7 @@ ejtag_dma_write (unsigned int addr, unsigned int data, int sz)
urj_tap_chain_shift_instructions (bus->chain);
for (i = 0; i < 32; i++)
ejdata->in->data[i] = (data >> i) & 1;
urj_tap_chain_shift_data_registers (bus->chain, 0); /* Push the data to write */
urj_tap_chain_shift_data_registers (bus->chain, 0); /* Push the data to write */
#ifdef PRINT_DATA_DEBUG
printf ("Wrote to edata->in(%c) =%s %08X\n", siz_ (sz),
urj_tap_register_get_string (ejdata->in), reg_value (ejdata->in));
@ -224,7 +224,7 @@ ejtag_dma_write (unsigned int addr, unsigned int data, int sz)
ejctrl->in->data[DstRt] = 1;
if (sz)
ejctrl->in->data[sz] = 1; // Size : can be WORD/HALFWORD or nothing for byte
urj_tap_chain_shift_data_registers (bus->chain, 0); /* Do the operation */
urj_tap_chain_shift_data_registers (bus->chain, 0); /* Do the operation */
//printf("Wrote to ejctrl->in =%s %08X\n",urj_tap_register_get_string( ejctrl->in),reg_value( ejctrl->in ) );
do
@ -247,7 +247,7 @@ ejtag_dma_write (unsigned int addr, unsigned int data, int sz)
urj_tap_register_fill (ejctrl->in, 0);
ejctrl->in->data[PrAcc] = 1;
ejctrl->in->data[ProbEn] = 1;
urj_tap_chain_shift_data_registers (bus->chain, 1); // Disable DMA, reset state to previous one.
urj_tap_chain_shift_data_registers (bus->chain, 1); // Disable DMA, reset state to previous one.
if (ejctrl->out->data[Derr] == 1)
{ // Check for DMA error, i.e. incorrect address
printf (_("%s(%d) Error on dma write (dma transaction failed)\n"),
@ -281,7 +281,7 @@ ejtag_dma_read (unsigned int addr, int sz)
urj_tap_chain_shift_instructions (bus->chain);
for (i = 0; i < 32; i++)
ejaddr->in->data[i] = (addr >> i) & 1;
urj_tap_chain_shift_data_registers (bus->chain, 0); /* Push the address to read */
urj_tap_chain_shift_data_registers (bus->chain, 0); /* Push the address to read */
#ifdef PRINT_DATA_DEBUG
printf ("Wrote to ejaddr->in =%s %08X\n",
urj_tap_register_get_string (ejaddr->in), reg_value (ejaddr->in));
@ -296,7 +296,7 @@ ejtag_dma_read (unsigned int addr, int sz)
if (sz)
ejctrl->in->data[sz] = 1; // Size : can be WORD/HALFWORD or nothing for byte
ejctrl->in->data[DmaRwn] = 1; // This is a read
urj_tap_chain_shift_data_registers (bus->chain, 0); /* Do the operation */
urj_tap_chain_shift_data_registers (bus->chain, 0); /* Do the operation */
//printf("Wrote to ejctrl->in =%s %08X\n",urj_tap_register_get_string( ejctrl->in),reg_value( ejctrl->in ) );
do
@ -324,14 +324,15 @@ ejtag_dma_read (unsigned int addr, int sz)
ret = reg_value (ejdata->out);
#ifdef PRINT_DATA_DEBUG
printf ("Read from ejdata->out(%c) =%s %08X\n", siz_ (sz),
urj_tap_register_get_string (ejdata->out), reg_value (ejdata->out));
urj_tap_register_get_string (ejdata->out),
reg_value (ejdata->out));
#endif
urj_part_set_instruction (bus->part, "EJTAG_CONTROL");
urj_tap_chain_shift_instructions (bus->chain);
urj_tap_register_fill (ejctrl->in, 0);
ejctrl->in->data[PrAcc] = 1;
ejctrl->in->data[ProbEn] = 1;
urj_tap_chain_shift_data_registers (bus->chain, 1); // Disable DMA, reset state to previous one.
urj_tap_chain_shift_data_registers (bus->chain, 1); // Disable DMA, reset state to previous one.
// printf("Wrote to ejctrl->in =%s %08X\n",urj_tap_register_get_string( ejctrl->in),reg_value( ejctrl->in ) );
// printf("Read from ejctrl->out =%s %08X\n",urj_tap_register_get_string( ejctrl->out),reg_value( ejctrl->out ) );
@ -365,8 +366,8 @@ ejtag_dma_read (unsigned int addr, int sz)
static int
ejtag_dma_bus_init (urj_bus_t *bus)
{
urj_data_register_t *ejctrl = NULL, *ejimpl = NULL, *ejaddr = NULL, *ejdata =
NULL;
urj_data_register_t *ejctrl = NULL, *ejimpl = NULL, *ejaddr =
NULL, *ejdata = NULL;
int timeout = 100;
if (urj_tap_state (bus->chain) != URJ_TAP_STATE_RUN_TEST_IDLE)
@ -479,7 +480,8 @@ ejtag_dma_bus_init (urj_bus_t *bus)
if (timeout == 0)
{
printf (_("%s(%d) Failed to enter debug mode, ctrl=%s\n"),
__FILE__, __LINE__, urj_tap_register_get_string (ejctrl->out));
__FILE__, __LINE__,
urj_tap_register_get_string (ejctrl->out));
return URJ_STATUS_FAIL;
}

@ -81,7 +81,8 @@ typedef struct
#define BLOCK_DESC ((bus_params_t *) bus->params)->block_desc
static int
fjmem_detect_reg_len (urj_chain_t *chain, urj_part_t *part, char *opcode, int len)
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;
@ -106,7 +107,8 @@ fjmem_detect_reg_len (urj_chain_t *chain, urj_part_t *part, char *opcode, int le
printf (_("invalid instruction length\n"));
return 0;
}
i = urj_part_instruction_alloc (FJMEM_INST_NAME, part->instruction_length, opcode);
i = urj_part_instruction_alloc (FJMEM_INST_NAME, part->instruction_length,
opcode);
if (!i)
{
printf (_("out of memory\n"));
@ -126,7 +128,8 @@ fjmem_detect_reg_len (urj_chain_t *chain, urj_part_t *part, char *opcode, int le
urj_tap_register_fill (dr->in, 0);
urj_tap_capture_dr (chain);
for (l = 0; l < chain->parts->len; l++)
urj_tap_shift_register (chain, dr->in, NULL, URJ_CHAIN_EXITMODE_SHIFT);
urj_tap_shift_register (chain, dr->in, NULL,
URJ_CHAIN_EXITMODE_SHIFT);
/* shift once more and return to idle state */
urj_tap_shift_register (chain, dr->in, NULL, URJ_CHAIN_EXITMODE_IDLE);
@ -155,7 +158,8 @@ fjmem_detect_reg_len (urj_chain_t *chain, urj_part_t *part, char *opcode, int le
while ((tdo_bit[0] == 0) && (fjmem_reg_len < FJMEM_MAX_REG_LEN))
{
/* read current TDO and then shift once */
urj_tap_shift_register (chain, dr->in, dr->out, URJ_CHAIN_EXITMODE_SHIFT);
urj_tap_shift_register (chain, dr->in, dr->out,
URJ_CHAIN_EXITMODE_SHIFT);
tdo_bit = dr->out->data;
fjmem_reg_len++;
}
@ -368,7 +372,8 @@ fjmem_query_blocks (urj_chain_t *chain, urj_part_t *part, urj_bus_t *bus)
*
*/
static urj_bus_t *
fjmem_bus_new (urj_chain_t *chain, const urj_bus_driver_t *driver, char *params[])
fjmem_bus_new (urj_chain_t *chain, const urj_bus_driver_t *driver,
char *params[])
{
urj_bus_t *bus = NULL;
int failed = 0;

@ -31,7 +31,8 @@
#include "generic_bus.h"
int
urj_bus_generic_attach_sig (urj_part_t *part, urj_part_signal_t **sig, char *id)
urj_bus_generic_attach_sig (urj_part_t *part, urj_part_signal_t **sig,
char *id)
{
int failed = URJ_STATUS_OK;

@ -27,7 +27,8 @@
#include "bus.h"
int urj_bus_generic_attach_sig (urj_part_t *part, urj_part_signal_t **sig, char *id);
int urj_bus_generic_attach_sig (urj_part_t *part, urj_part_signal_t **sig,
char *id);
void urj_bus_generic_free (urj_bus_t *bus);
int urj_bus_generic_no_init (urj_bus_t *bus);

@ -57,7 +57,8 @@ typedef struct
*
*/
static urj_bus_t *
h7202_bus_new (urj_chain_t *chain, const urj_bus_driver_t *driver, char *cmd_params[])
h7202_bus_new (urj_chain_t *chain, const urj_bus_driver_t *driver,
char *cmd_params[])
{
urj_bus_t *bus;
urj_part_t *part;

@ -500,7 +500,8 @@ jopcyc_bus_init (urj_bus_t *bus)
}
static int
comp_bus_area (urj_bus_t *bus, uint32_t adr, urj_bus_area_t *area, component_t **comp)
comp_bus_area (urj_bus_t *bus, uint32_t adr, urj_bus_area_t *area,
component_t **comp)
{
if (adr < RAMB_START)
{

@ -166,8 +166,12 @@ lh7a400_bus_area (urj_bus_t *bus, uint32_t adr, urj_bus_area_t *area)
area->length = UINT64_C (0x10000000);
/* we determine the size of the flash that was booted from [1] table 3.1 */
width = urj_part_get_signal (bus->part, urj_part_find_signal (bus->part, "WIDTH0"));
width |= urj_part_get_signal (bus->part, urj_part_find_signal (bus->part, "WIDTH1")) << 1;
width =
urj_part_get_signal (bus->part,
urj_part_find_signal (bus->part, "WIDTH0"));
width |=
urj_part_get_signal (bus->part,
urj_part_find_signal (bus->part, "WIDTH1")) << 1;
if (width < 0)
return URJ_STATUS_FAIL;

@ -223,7 +223,7 @@ setup_data (urj_bus_t *bus, uint32_t adr, uint32_t d)
for (i = 0; i < area.width; i++)
urj_part_set_signal (p, AD[i + (LPC_NUM_AD - bp->lpc_num_d)], 1,
(d >> i) & 1);
(d >> i) & 1);
}
static uint32_t

@ -402,7 +402,8 @@ setup_data (urj_bus_t *bus, uint32_t adr, uint32_t d)
for (i = 0; i < area.width; i++)
urj_part_set_signal (p, D[i], 1,
(d >> ((REVBITS == 1) ? BUS_WIDTH - 1 - i : i)) & 1);
(d >> ((REVBITS == 1) ? BUS_WIDTH - 1 - i : i)) &
1);
/* Just for debugging */
if (dbgData)

@ -149,7 +149,7 @@ setup_address (urj_bus_t *bus, uint32_t a)
for (i = 0; i < PPC440GX_ADDR_LINES; i++)
urj_part_set_signal (p, A[i], 1,
(a >> (PPC440GX_ADDR_LINES - 1 - i)) & 1);
(a >> (PPC440GX_ADDR_LINES - 1 - i)) & 1);
}
static void
@ -175,7 +175,8 @@ setup_data (urj_bus_t *bus, uint32_t d)
ppc440gx_ebc8_bus_area (bus, 0, &area);
for (i = 0; i < area.width; i++)
urj_part_set_signal (p, D[PPC440GX_DATA_LINES - 1 - i], 1, (d >> i) & 1);
urj_part_set_signal (p, D[PPC440GX_DATA_LINES - 1 - i], 1,
(d >> i) & 1);
}
/**
@ -217,8 +218,8 @@ ppc440gx_ebc8_bus_read_next (urj_bus_t *bus, uint32_t adr)
urj_tap_chain_shift_data_registers (chain, 1);
for (i = 0; i < area.width; i++)
d |= (uint32_t) (urj_part_get_signal (p, D[PPC440GX_DATA_LINES - 1 - i])
<< i);
d |= (uint32_t) (urj_part_get_signal
(p, D[PPC440GX_DATA_LINES - 1 - i]) << i);
return d;
}
@ -243,8 +244,8 @@ ppc440gx_ebc8_bus_read_end (urj_bus_t *bus)
urj_tap_chain_shift_data_registers (chain, 1);
for (i = 0; i < area.width; i++)
d |= (uint32_t) (urj_part_get_signal (p, D[PPC440GX_DATA_LINES - 1 - i])
<< i);
d |= (uint32_t) (urj_part_get_signal
(p, D[PPC440GX_DATA_LINES - 1 - i]) << i);
return d;
}

@ -211,7 +211,8 @@ pxa2xx_bus_new (urj_chain_t *chain, const urj_bus_driver_t *driver,
if (ncs_map[i].enabled > 0)
{
failed |=
urj_bus_generic_attach_sig (part, &(nCS[i]), ncs_map[i].sig_name);
urj_bus_generic_attach_sig (part, &(nCS[i]),
ncs_map[i].sig_name);
}
else // disabled - this GPIO pin is unused or used for some other function
{
@ -287,13 +288,14 @@ pxa2xx_bus_init (urj_bus_t *bus)
BOOT_DEF_BOOT_SEL (urj_part_get_signal
(p,
urj_part_find_signal (p,
"BOOT_SEL[2]")) << 2 |
"BOOT_SEL[2]")) << 2 |
urj_part_get_signal (p,
urj_part_find_signal (p,
"BOOT_SEL[1]"))
urj_part_find_signal (p,
"BOOT_SEL[1]"))
<< 1 | urj_part_get_signal (p,
urj_part_find_signal (p,
"BOOT_SEL[0]")));
urj_part_find_signal
(p,
"BOOT_SEL[0]")));
}
else if (PROC == PROC_PXA27x)
{

@ -32,7 +32,7 @@
#include <stdint.h>
#include <string.h>
#ifdef UNUSED /* RFHH */
#ifdef UNUSED /* RFHH */
#include <flash/cfi.h>
#include <flash/intel.h>
#include <flash/mic.h>
@ -43,7 +43,7 @@
#include "jtag.h"
void
urj_bus_readmem (urj_bus_t *bus, FILE *f, uint32_t addr, uint32_t len)
urj_bus_readmem (urj_bus_t *bus, FILE * f, uint32_t addr, uint32_t len)
{
uint32_t step;
uint32_t a;

@ -236,8 +236,12 @@ s3c4510_bus_area (urj_bus_t *bus, uint32_t adr, urj_bus_area_t *area)
area->length = UINT64_C (0x100000000);
// endian = urj_part_get_signal( bus->part, urj_part_find_signal( bus->part, "LITTLE" ));
b0size0 = urj_part_get_signal (bus->part, urj_part_find_signal (bus->part, "B0SIZE0"));
b0size1 = urj_part_get_signal (bus->part, urj_part_find_signal (bus->part, "B0SIZE1"));
b0size0 =
urj_part_get_signal (bus->part,
urj_part_find_signal (bus->part, "B0SIZE0"));
b0size1 =
urj_part_get_signal (bus->part,
urj_part_find_signal (bus->part, "B0SIZE1"));
switch ((b0size1 << 1) | b0size0)
{
@ -427,8 +431,7 @@ s3c4510_bus_write (urj_bus_t *bus, uint32_t adr, uint32_t data)
s3c4510_bus_setup_ctrl (bus, 0x01ffff); /* nOE=1, nRCS0 =1 */
urj_tap_chain_shift_data_registers (chain, 0);
DEBUG_LVL2 (printf ("URJ_BUS_WRITE %08x @ %08x\n", data, adr);
)}
DEBUG_LVL2 (printf ("URJ_BUS_WRITE %08x @ %08x\n", data, adr);)}
const urj_bus_driver_t s3c4510_bus = {
"s3c4510x",

@ -148,7 +148,9 @@ sa1110_bus_area (urj_bus_t *bus, uint32_t adr, urj_bus_area_t *area)
area->start = UINT32_C (0x00000000);
area->length = UINT64_C (0x100000000);
area->width =
urj_part_get_signal (bus->part, urj_part_find_signal (bus->part, "ROM_SEL")) ? 32 : 16;
urj_part_get_signal (bus->part,
urj_part_find_signal (bus->part,
"ROM_SEL")) ? 32 : 16;
return URJ_STATUS_OK;
}

@ -45,9 +45,9 @@
typedef struct
{
uint32_t last_adr;
urj_part_signal_t *ma[19]; //19 - 512K flash address are used
urj_part_signal_t *md[8]; //8 bit data bus connected to Flash are used
urj_part_signal_t *bms; //boot memory select
urj_part_signal_t *ma[19]; //19 - 512K flash address are used
urj_part_signal_t *md[8]; //8 bit data bus connected to Flash are used
urj_part_signal_t *bms; //boot memory select
urj_part_signal_t *nwe;
urj_part_signal_t *noe;
} bus_params_t;

@ -254,7 +254,7 @@ setup_address (urj_bus_t *bus, uint32_t a)
urj_part_set_signal (p, nSRce, 1, 0);
for (i = 0; i < 20; i++)
urj_part_set_signal (p, AD[i], 1,
(a >> (i + (area.width / 8) - 1)) & 1);
(a >> (i + (area.width / 8) - 1)) & 1);
}
else
urj_part_set_signal (p, nSRce, 1, 1);
@ -321,7 +321,7 @@ slsup3_bus_read_start (urj_bus_t *bus, uint32_t adr)
LAST_ADR = adr;
urj_part_set_signal (p, nSDce, 1, 1); /* Inihibit SDRAM */
urj_part_set_signal (p, nSDce, 1, 1); /* Inihibit SDRAM */
urj_part_set_signal (p, nOE, 1, 0);
urj_part_set_signal (p, nSRce, 1, 1);
urj_part_set_signal (p, nFLce, 1, 1);
@ -411,7 +411,7 @@ slsup3_bus_write (urj_bus_t *bus, uint32_t adr, uint32_t data)
urj_part_t *p = bus->part;
urj_chain_t *chain = bus->chain;
urj_part_set_signal (p, nSDce, 1, 1); /* Inihibit SDRAM */
urj_part_set_signal (p, nSDce, 1, 1); /* Inihibit SDRAM */
urj_part_set_signal (p, nOE, 1, 1);
urj_part_set_signal (p, nSRce, 1, 1);
urj_part_set_signal (p, nFLce, 1, 1);

@ -25,7 +25,7 @@
#include <stdint.h>
#include <string.h>
#ifdef UNUSED /* RFHH */
#ifdef UNUSED /* RFHH */
#include <flash/cfi.h>
#include <flash/intel.h>
#include <flash/mic.h>
@ -36,7 +36,7 @@
#include "jtag.h"
void
urj_bus_writemem (urj_bus_t *bus, FILE *f, uint32_t addr, uint32_t len)
urj_bus_writemem (urj_bus_t *bus, FILE * f, uint32_t addr, uint32_t len)
{
uint32_t step;
uint32_t a;

@ -519,7 +519,8 @@ setup_data (urj_bus_t *bus, uint32_t d, component_t *comp)
}
static uint8_t
eeprom_shift_byte (urj_chain_t *chain, urj_part_t *p, component_t *comp, uint8_t byte)
eeprom_shift_byte (urj_chain_t *chain, urj_part_t *p, component_t *comp,
uint8_t byte)
{
int pos;
uint8_t so_data = 0x00;
@ -632,7 +633,8 @@ zefant_xs3_bus_init (urj_bus_t *bus)
}
static int
comp_bus_area (urj_bus_t *bus, uint32_t adr, urj_bus_area_t *area, component_t **comp)
comp_bus_area (urj_bus_t *bus, uint32_t adr, urj_bus_area_t *area,
component_t **comp)
{
if (adr < RAM0_START)
{

@ -162,8 +162,8 @@ cmd_bit_run (urj_chain_t *chain, char *params[])
/* allocate bsbit */
part->bsbits[bit] =
urj_part_bsbit_alloc (bit, params[4], type, urj_part_find_signal (part, params[4]),
safe);
urj_part_bsbit_alloc (bit, params[4], type,
urj_part_find_signal (part, params[4]), safe);
if (part->bsbits[bit] == NULL)
{
printf (_("%s: out of memory for command '%s'\n"), "bit", command);

@ -51,7 +51,7 @@ cmd_bsdl_run (urj_chain_t *chain, char *params[])
{
result =
urj_bsdl_read_file (chain, params[2], URJ_BSDL_MODE_TEST,
NULL) >= 0 ? 1 : -1;
NULL) >= 0 ? 1 : -1;
}
else if (num_params == 2)
{
@ -67,7 +67,7 @@ cmd_bsdl_run (urj_chain_t *chain, char *params[])
{
result =
urj_bsdl_read_file (chain, params[2], URJ_BSDL_MODE_DUMP,
NULL) >= 0 ? 1 : -1;
NULL) >= 0 ? 1 : -1;
}
else if (num_params == 2)
{

@ -57,7 +57,8 @@ cmd_detectflash_help (void)
printf (_("Usage: %s ADDRESS\n"
"Detect flash memory type connected to a part.\n"
"\n"
"ADDRESS Base address for memory region\n"), "urj_flash_detectflash");
"ADDRESS Base address for memory region\n"),
"urj_flash_detectflash");
}
urj_cmd_t cmd_detectflash = {

@ -56,7 +56,8 @@ cmd_discovery_help (void)
" 2. DR (data register) length for all possible instructions\n"
"\n"
"Warning: This may be dangerous for some parts (especially if the\n"
"part doesn't have TRST signal).\n"), "urj_tap_discovery", "urj_tap_discovery");
"part doesn't have TRST signal).\n"), "urj_tap_discovery",
"urj_tap_discovery");
}
urj_cmd_t cmd_discovery = {

@ -91,8 +91,8 @@ cmd_flashmem_help (void)
"\n"
"ADDR could be in decimal or hexadecimal (prefixed with 0x) form.\n"
"\n"
"Supported Flash Memories:\n"), "urj_flashmem", "urj_flashmem msbin",
"msbin", "noverify");
"Supported Flash Memories:\n"), "urj_flashmem",
"urj_flashmem msbin", "msbin", "noverify");
for (i = 0; flash_drivers[i]; i++)
printf (_("%s\n %s\n"), _(flash_drivers[i]->name),

@ -60,7 +60,8 @@ cmd_get_run (urj_chain_t *chain, char *params[])
return 1;
}
s = urj_part_find_signal (chain->parts->parts[chain->active_part], params[2]);
s = urj_part_find_signal (chain->parts->parts[chain->active_part],
params[2]);
if (!s)
{
printf (_("signal '%s' not found\n"), params[2]);

@ -100,7 +100,7 @@ cmd_instruction_run (urj_chain_t *chain, char *params[])
}
i = urj_part_instruction_alloc (params[1], part->instruction_length,
params[2]);
params[2]);
if (!i)
{
printf (_("out of memory\n"));

@ -119,7 +119,7 @@ urj_cmd_jtag_parse_line (urj_chain_t *chain, char *line)
int
urj_cmd_jtag_parse_stream (urj_chain_t *chain, FILE *f)
urj_cmd_jtag_parse_stream (urj_chain_t *chain, FILE * f)
{
char inputline[MAXINPUTLINE + 1];
int go = 1, i, c, lnr, clip, found_comment;

@ -107,7 +107,8 @@ cmd_print_run (urj_chain_t *chain, char *params[])
urj_instruction_t *inst;
snprintf (format, 128, _(" Active %%-%ds %%-%ds"),
URJ_INSTRUCTION_MAXLEN_INSTRUCTION, URJ_DATA_REGISTER_MAXLEN);
URJ_INSTRUCTION_MAXLEN_INSTRUCTION,
URJ_DATA_REGISTER_MAXLEN);
#if HAVE_SWPRINTF
if (mbstowcs (wformat, format, 128) == -1)
printf (_("(%d) String conversion failed!\n"), __LINE__);
@ -126,7 +127,8 @@ cmd_print_run (urj_chain_t *chain, char *params[])
putchar ('\n');
snprintf (format, 128, _(" %%c %%-%ds %%-%ds\n"),
URJ_INSTRUCTION_MAXLEN_INSTRUCTION, URJ_DATA_REGISTER_MAXLEN);
URJ_INSTRUCTION_MAXLEN_INSTRUCTION,
URJ_DATA_REGISTER_MAXLEN);
part = chain->parts->parts[chain->active_part];
for (inst = part->instructions; inst != NULL; inst = inst->next)
@ -142,8 +144,10 @@ cmd_print_run (urj_chain_t *chain, char *params[])
if (noheader == 0)
{
snprintf (format, 128, _(" No. %%-%ds %%-%ds %%-%ds %%-%ds %%-%ds"),
URJ_PART_MANUFACTURER_MAXLEN, URJ_PART_PART_MAXLEN, URJ_PART_STEPPING_MAXLEN,
URJ_INSTRUCTION_MAXLEN_INSTRUCTION, URJ_DATA_REGISTER_MAXLEN);
URJ_PART_MANUFACTURER_MAXLEN, URJ_PART_PART_MAXLEN,
URJ_PART_STEPPING_MAXLEN,
URJ_INSTRUCTION_MAXLEN_INSTRUCTION,
URJ_DATA_REGISTER_MAXLEN);
#if HAVE_SWPRINTF
if (mbstowcs (wformat, format, 128) == -1)
printf (_("(%d) String conversion failed!\n"), __LINE__);
@ -193,7 +197,8 @@ cmd_print_run (urj_chain_t *chain, char *params[])
{
if (URJ_BUS_AREA (bus, a, &area) != URJ_STATUS_OK)
{
printf (_("Error in bus area urj_tap_discovery at 0x%08llX\n"),
printf (_
("Error in bus area urj_tap_discovery at 0x%08llX\n"),
(long long unsigned int) a);
break;
}

@ -47,7 +47,8 @@ cmd_readmem_run (urj_chain_t *chain, char *params[])
return 1;
}
if (urj_cmd_get_number (params[1], &adr) || urj_cmd_get_number (params[2], &len))
if (urj_cmd_get_number (params[1], &adr)
|| urj_cmd_get_number (params[2], &len))
return -1;
f = fopen (params[3], "w");

@ -97,7 +97,8 @@ cmd_register_run (urj_chain_t *chain, char *params[])
/* Device Identification Register */
if (strcasecmp (dr->name, "DIR") == 0)
urj_tap_register_init (dr->out, urj_tap_register_get_string (part->id));
urj_tap_register_init (dr->out,
urj_tap_register_get_string (part->id));
return 1;
}

@ -76,13 +76,15 @@ cmd_set_run (urj_chain_t *chain, char *params[])
return -1;
}
s = urj_part_find_signal (chain->parts->parts[chain->active_part], params[2]);
s = urj_part_find_signal (chain->parts->parts[chain->active_part],
params[2]);
if (!s)
{
printf (_("signal '%s' not found\n"), params[2]);
return 1;
}
urj_part_set_signal (chain->parts->parts[chain->active_part], s, dir, data);
urj_part_set_signal (chain->parts->parts[chain->active_part], s, dir,
data);
return 1;
}

@ -62,7 +62,8 @@ cmd_test_run (urj_chain_t *chain, char *params[])
return 1;
}
s = urj_part_find_signal (chain->parts->parts[chain->active_part], params[2]);
s = urj_part_find_signal (chain->parts->parts[chain->active_part],
params[2]);
if (!s)
{
printf (_("signal '%s' not found\n"), params[2]);

@ -45,7 +45,8 @@ cmd_writemem_run (urj_chain_t *chain, char *params[])
return 1;
}
if (urj_cmd_get_number (params[1], &adr) || urj_cmd_get_number (params[2], &len))
if (urj_cmd_get_number (params[1], &adr)
|| urj_cmd_get_number (params[2], &len))
return -1;
f = fopen (params[3], "r");

@ -47,16 +47,19 @@
static int dbg = 0;
static int amd_flash_erase_block (urj_flash_cfi_array_t *cfi_array, uint32_t adr);
static int amd_flash_unlock_block (urj_flash_cfi_array_t *cfi_array, uint32_t adr);
static int amd_flash_program_single (urj_flash_cfi_array_t *cfi_array, uint32_t adr,
uint32_t data);
static int amd_flash_program_buffer (urj_flash_cfi_array_t *cfi_array, uint32_t adr,
uint32_t *buffer, int count);
static int amd_flash_erase_block (urj_flash_cfi_array_t *cfi_array,
uint32_t adr);
static int amd_flash_unlock_block (urj_flash_cfi_array_t *cfi_array,
uint32_t adr);
static int amd_flash_program_single (urj_flash_cfi_array_t *cfi_array,
uint32_t adr, uint32_t data);
static int amd_flash_program_buffer (urj_flash_cfi_array_t *cfi_array,
uint32_t adr, uint32_t *buffer,
int count);
static int amd_flash_program (urj_flash_cfi_array_t *cfi_array, uint32_t adr,
uint32_t *buffer, int count);
static int amd_flash_program32 (urj_flash_cfi_array_t *cfi_array, uint32_t adr,
uint32_t *buffer, int count);
static int amd_flash_program32 (urj_flash_cfi_array_t *cfi_array,
uint32_t adr, uint32_t *buffer, int count);
static void amd_flash_read_array (urj_flash_cfi_array_t *cfi_array);
/* The code below assumes a connection of the flash chip address LSB (A0)
@ -268,7 +271,7 @@ amdisprotected (parts * ps, urj_flash_cfi_array_t *cfi_array, uint32_t adr)
uint32_t data;
int o = amd_flash_address_shift (cfi_array);
URJ_BUS_WRITE (ps, cfi_array->address + (0x0555 << o), 0x00aa00aa); /* autoselect p29, sector erase */
URJ_BUS_WRITE (ps, cfi_array->address + (0x0555 << o), 0x00aa00aa); /* autoselect p29, sector erase */
URJ_BUS_WRITE (ps, cfi_array->address + (0x02aa << o), 0x00550055);
URJ_BUS_WRITE (ps, cfi_array->address + (0x0555 << o), 0x00900090);
@ -287,7 +290,7 @@ amd_flash_print_info (urj_flash_cfi_array_t *cfi_array)
urj_bus_t *bus = cfi_array->bus;
int o = amd_flash_address_shift (cfi_array);
URJ_BUS_WRITE (bus, cfi_array->address + (0x0555 << o), 0x00aa00aa); /* autoselect p29 */
URJ_BUS_WRITE (bus, cfi_array->address + (0x0555 << o), 0x00aa00aa); /* autoselect p29 */
URJ_BUS_WRITE (bus, cfi_array->address + (0x02aa << o), 0x00550055);
URJ_BUS_WRITE (bus, cfi_array->address + (0x0555 << o), 0x00900090);
mid = URJ_BUS_READ (bus, cfi_array->address + (0x00 << o)) & 0xFFFF;
@ -398,7 +401,7 @@ amd_flash_erase_block (urj_flash_cfi_array_t *cfi_array, uint32_t adr)
/* printf("protected: %d\n", amdisprotected(ps, cfi_array, adr)); */
URJ_BUS_WRITE (bus, cfi_array->address + (0x0555 << o), 0x00aa00aa); /* autoselect p29, sector erase */
URJ_BUS_WRITE (bus, cfi_array->address + (0x0555 << o), 0x00aa00aa); /* autoselect p29, sector erase */
URJ_BUS_WRITE (bus, cfi_array->address + (0x02aa << o), 0x00550055);
URJ_BUS_WRITE (bus, cfi_array->address + (0x0555 << o), 0x00800080);
URJ_BUS_WRITE (bus, cfi_array->address + (0x0555 << o), 0x00aa00aa);
@ -426,7 +429,8 @@ amd_flash_unlock_block (urj_flash_cfi_array_t *cfi_array, uint32_t adr)
}
static int
amd_flash_program_single (urj_flash_cfi_array_t *cfi_array, uint32_t adr, uint32_t data)
amd_flash_program_single (urj_flash_cfi_array_t *cfi_array, uint32_t adr,
uint32_t data)
{
int status;
urj_bus_t *bus = cfi_array->bus;
@ -435,7 +439,7 @@ amd_flash_program_single (urj_flash_cfi_array_t *cfi_array, uint32_t adr, uint32
if (dbg)
printf ("\nflash_program 0x%08X = 0x%08X\n", adr, data);
URJ_BUS_WRITE (bus, cfi_array->address + (0x0555 << o), 0x00aa00aa); /* autoselect p29, program */
URJ_BUS_WRITE (bus, cfi_array->address + (0x0555 << o), 0x00aa00aa); /* autoselect p29, program */
URJ_BUS_WRITE (bus, cfi_array->address + (0x02aa << o), 0x00550055);
URJ_BUS_WRITE (bus, cfi_array->address + (0x0555 << o), 0x00A000A0);
@ -538,8 +542,8 @@ amd_flash_program_buffer (urj_flash_cfi_array_t *cfi_array, uint32_t adr,
}
static int
amd_flash_program (urj_flash_cfi_array_t *cfi_array, uint32_t adr, uint32_t *buffer,
int count)
amd_flash_program (urj_flash_cfi_array_t *cfi_array, uint32_t adr,
uint32_t *buffer, int count)
{
urj_flash_cfi_query_structure_t *cfi = &(cfi_array->cfi_chips[0]->cfi);
int max_bytes_write = cfi->device_geometry.max_bytes_write;
@ -571,8 +575,8 @@ amd_flash_program (urj_flash_cfi_array_t *cfi_array, uint32_t adr, uint32_t *buf
}
static int
amd_flash_program32 (urj_flash_cfi_array_t *cfi_array, uint32_t adr, uint32_t *buffer,
int count)
amd_flash_program32 (urj_flash_cfi_array_t *cfi_array, uint32_t adr,
uint32_t *buffer, int count)
{
/* Single byte programming is forced for 32 bit (2x16) flash configuration.
a) lack of testing capbilities for 2x16 multi-byte write operation
@ -597,7 +601,7 @@ static void
amd_flash_read_array (urj_flash_cfi_array_t *cfi_array)
{
/* Read Array */
URJ_BUS_WRITE (cfi_array->bus, cfi_array->address, 0x00F000F0); /* AMD reset */
URJ_BUS_WRITE (cfi_array->bus, cfi_array->address, 0x00F000F0); /* AMD reset */
}
urj_flash_driver_t amd_32_flash_driver = {

@ -74,20 +74,25 @@ static struct
}
var_forced_detection;
int urj_flash_amd_detect (urj_bus_t *bus, uint32_t adr, urj_flash_cfi_array_t **cfi_array);
int urj_flash_amd_detect (urj_bus_t *bus, uint32_t adr,
urj_flash_cfi_array_t **cfi_array);
static int amd_29xx040_autodetect (urj_flash_cfi_array_t *cfi_array);
static int amd_29xx040_status (urj_bus_t *bus, uint32_t adr, unsigned short data);
static int amd_29xx040_status (urj_bus_t *bus, uint32_t adr,
unsigned short data);
static void amd_29xx040_print_info (urj_flash_cfi_array_t *cfi_array);
static void amd_29xx040_read_array (urj_flash_cfi_array_t *cfi_array);
static int amd_29xx040_erase_block (urj_flash_cfi_array_t *cfi_array, uint32_t adr);
static int amd_29xx040_program_single (urj_flash_cfi_array_t *cfi_array, uint32_t adr,
uint32_t data);
static int amd_29xx040_program (urj_flash_cfi_array_t *cfi_array, uint32_t adr,
uint32_t *buffer, int count);
static int amd_29xx040_unlock_block (urj_flash_cfi_array_t *cfi_array, uint32_t adr);
static int amd_29xx040_erase_block (urj_flash_cfi_array_t *cfi_array,
uint32_t adr);
static int amd_29xx040_program_single (urj_flash_cfi_array_t *cfi_array,
uint32_t adr, uint32_t data);
static int amd_29xx040_program (urj_flash_cfi_array_t *cfi_array,
uint32_t adr, uint32_t *buffer, int count);
static int amd_29xx040_unlock_block (urj_flash_cfi_array_t *cfi_array,
uint32_t adr);
int
urj_flash_amd_detect (urj_bus_t *bus, uint32_t adr, urj_flash_cfi_array_t **cfi_array)
urj_flash_amd_detect (urj_bus_t *bus, uint32_t adr,
urj_flash_cfi_array_t **cfi_array)
{
int mid;
int did;
@ -140,7 +145,8 @@ urj_flash_amd_detect (urj_bus_t *bus, uint32_t adr, urj_flash_cfi_array_t **cfi_
return -2;
for (i = 0; i < ba; i++)
{
(*cfi_array)->cfi_chips[i] = calloc (1, sizeof (urj_flash_cfi_chip_t));
(*cfi_array)->cfi_chips[i] =
calloc (1, sizeof (urj_flash_cfi_chip_t));
if (!(*cfi_array)->cfi_chips[i])
return -2; /* out of memory */
(*cfi_array)->cfi_chips[i]->width = 1; //ba;
@ -271,7 +277,7 @@ amd_29xx040_read_array (urj_flash_cfi_array_t *cfi_array)
usleep (100);
var_forced_detection.unlock_bypass = AMD_STANDARD_MODE;
}
URJ_BUS_WRITE (cfi_array->bus, cfi_array->address + 0x0, 0x0F0); /* AMD reset */
URJ_BUS_WRITE (cfi_array->bus, cfi_array->address + 0x0, 0x0F0); /* AMD reset */
}
@ -300,7 +306,7 @@ amd_29xx040_erase_block (urj_flash_cfi_array_t *cfi_array, uint32_t adr)
URJ_BUS_WRITE (bus, cfi_array->address + 0x555, 0xaa);
URJ_BUS_WRITE (bus, cfi_array->address + 0x2AA, 0x55);
// URJ_BUS_WRITE( bus, cfi_array->address + 0x555, 0x10 ); //Chip Erase
URJ_BUS_WRITE (bus, adr, 0x30); //Sector erase
URJ_BUS_WRITE (bus, adr, 0x30); //Sector erase
if (amd_29xx040_status (bus, adr, 0xff))
@ -351,8 +357,8 @@ amd_29xx040_program_single (urj_flash_cfi_array_t *cfi_array, uint32_t adr,
}
static int
amd_29xx040_program (urj_flash_cfi_array_t *cfi_array, uint32_t adr, uint32_t *buffer,
int count)
amd_29xx040_program (urj_flash_cfi_array_t *cfi_array, uint32_t adr,
uint32_t *buffer, int count)
{
int idx;

@ -68,7 +68,8 @@ urj_flash_cfi_array_free (urj_flash_cfi_array_t *cfi_array)
}
int
urj_flash_cfi_detect (urj_bus_t *bus, uint32_t adr, urj_flash_cfi_array_t **cfi_array)
urj_flash_cfi_detect (urj_bus_t *bus, uint32_t adr,
urj_flash_cfi_array_t **cfi_array)
{
unsigned int bw; /* bus width */
unsigned int d; /* data offset */
@ -133,7 +134,8 @@ urj_flash_cfi_detect (urj_bus_t *bus, uint32_t adr, urj_flash_cfi_array_t **cfi_
return -6; /* CFI not detected (Y) */
}
(*cfi_array)->cfi_chips[d / 8] = calloc (1, sizeof (urj_flash_cfi_chip_t));
(*cfi_array)->cfi_chips[d / 8] =
calloc (1, sizeof (urj_flash_cfi_chip_t));
if (!(*cfi_array)->cfi_chips[d / 8])
{
write1 (0, CFI_CMD_READ_ARRAY1);
@ -264,9 +266,15 @@ urj_flash_cfi_detect (urj_bus_t *bus, uint32_t adr, urj_flash_cfi_array_t **cfi_
num_of_banks = read1 (BANK_ORGANIZATION_OFFSET);
else
num_of_banks = 0;
pri_vendor_tbl = (urj_flash_cfi_amd_pri_extened_query_structure_t *)
calloc (1, sizeof (urj_flash_cfi_amd_pri_extened_query_structure_t)
+ num_of_banks * sizeof (uint8_t));
pri_vendor_tbl =
(urj_flash_cfi_amd_pri_extened_query_structure_t *) calloc (1,
sizeof
(urj_flash_cfi_amd_pri_extened_query_structure_t)
+
num_of_banks
*
sizeof
(uint8_t));
if (!pri_vendor_tbl)
{
write1 (0, CFI_CMD_READ_ARRAY1);

@ -52,7 +52,7 @@ extern urj_flash_driver_t amd_8_flash_driver;
extern urj_flash_driver_t intel_32_flash_driver;
extern urj_flash_driver_t intel_16_flash_driver;
extern urj_flash_driver_t intel_8_flash_driver;
extern urj_flash_driver_t amd_29xx040_flash_driver; //20/09/2006
extern urj_flash_driver_t amd_29xx040_flash_driver; //20/09/2006
urj_flash_driver_t *flash_drivers[] = {
&amd_32_flash_driver,
@ -95,7 +95,7 @@ set_flash_driver (void)
}
void
urj_flashmsbin (urj_bus_t *bus, FILE *f, int noverify)
urj_flashmsbin (urj_bus_t *bus, FILE * f, int noverify)
{
uint32_t adr;
urj_flash_cfi_query_structure_t *cfi;
@ -283,7 +283,7 @@ find_block (urj_flash_cfi_query_structure_t *cfi, int adr, int bus_width,
}
void
urj_flashmem (urj_bus_t *bus, FILE *f, uint32_t addr, int noverify)
urj_flashmem (urj_bus_t *bus, FILE * f, uint32_t addr, int noverify)
{
uint32_t adr;
urj_flash_cfi_query_structure_t *cfi;

@ -48,20 +48,25 @@
#include <flash.h>
#include <bus.h>
static int intel_flash_erase_block (urj_flash_cfi_array_t *cfi_array, uint32_t adr);
static int intel_flash_unlock_block (urj_flash_cfi_array_t *cfi_array, uint32_t adr);
static int intel_flash_program_single (urj_flash_cfi_array_t *cfi_array, uint32_t adr,
uint32_t data);
static int intel_flash_program_buffer (urj_flash_cfi_array_t *cfi_array, uint32_t adr,
uint32_t *buffer, int count);
static int intel_flash_program (urj_flash_cfi_array_t *cfi_array, uint32_t adr,
uint32_t *buffer, int count);
static int intel_flash_erase_block32 (urj_flash_cfi_array_t *cfi_array, uint32_t adr);
static int intel_flash_unlock_block32 (urj_flash_cfi_array_t *cfi_array, uint32_t adr);
static int intel_flash_erase_block (urj_flash_cfi_array_t *cfi_array,
uint32_t adr);
static int intel_flash_unlock_block (urj_flash_cfi_array_t *cfi_array,
uint32_t adr);
static int intel_flash_program_single (urj_flash_cfi_array_t *cfi_array,
uint32_t adr, uint32_t data);
static int intel_flash_program_buffer (urj_flash_cfi_array_t *cfi_array,
uint32_t adr, uint32_t *buffer,
int count);
static int intel_flash_program (urj_flash_cfi_array_t *cfi_array,
uint32_t adr, uint32_t *buffer, int count);
static int intel_flash_erase_block32 (urj_flash_cfi_array_t *cfi_array,
uint32_t adr);
static int intel_flash_unlock_block32 (urj_flash_cfi_array_t *cfi_array,
uint32_t adr);
static int intel_flash_program32_single (urj_flash_cfi_array_t *cfi_array,
uint32_t adr, uint32_t data);
static int intel_flash_program32 (urj_flash_cfi_array_t *cfi_array, uint32_t adr,
uint32_t *buffer, int count);
static int intel_flash_program32 (urj_flash_cfi_array_t *cfi_array,
uint32_t adr, uint32_t *buffer, int count);
/* autodetect, we can handle this chip */
static int
@ -246,11 +251,12 @@ intel_flash_erase_block (urj_flash_cfi_array_t *cfi_array, uint32_t adr)
uint16_t sr;
urj_bus_t *bus = cfi_array->bus;
URJ_BUS_WRITE (bus, cfi_array->address, CFI_INTEL_CMD_CLEAR_STATUS_REGISTER);
URJ_BUS_WRITE (bus, cfi_array->address,
CFI_INTEL_CMD_CLEAR_STATUS_REGISTER);
URJ_BUS_WRITE (bus, adr, CFI_INTEL_CMD_BLOCK_ERASE);
URJ_BUS_WRITE (bus, adr, CFI_INTEL_CMD_CONFIRM);
while (!((sr = URJ_BUS_READ (bus, cfi_array->address) & 0xFE) & CFI_INTEL_SR_READY)); /* TODO: add timeout */
while (!((sr = URJ_BUS_READ (bus, cfi_array->address) & 0xFE) & CFI_INTEL_SR_READY)); /* TODO: add timeout */
switch (sr & ~CFI_INTEL_SR_READY)
{
@ -278,11 +284,12 @@ intel_flash_unlock_block (urj_flash_cfi_array_t *cfi_array, uint32_t adr)
uint16_t sr;
urj_bus_t *bus = cfi_array->bus;
URJ_BUS_WRITE (bus, cfi_array->address, CFI_INTEL_CMD_CLEAR_STATUS_REGISTER);
URJ_BUS_WRITE (bus, cfi_array->address,
CFI_INTEL_CMD_CLEAR_STATUS_REGISTER);
URJ_BUS_WRITE (bus, adr, CFI_INTEL_CMD_LOCK_SETUP);
URJ_BUS_WRITE (bus, adr, CFI_INTEL_CMD_UNLOCK_BLOCK);
while (!((sr = URJ_BUS_READ (bus, cfi_array->address) & 0xFE) & CFI_INTEL_SR_READY)); /* TODO: add timeout */
while (!((sr = URJ_BUS_READ (bus, cfi_array->address) & 0xFE) & CFI_INTEL_SR_READY)); /* TODO: add timeout */
if (sr != CFI_INTEL_SR_READY)
{
@ -300,11 +307,12 @@ intel_flash_program_single (urj_flash_cfi_array_t *cfi_array, uint32_t adr,
uint16_t sr;
urj_bus_t *bus = cfi_array->bus;
URJ_BUS_WRITE (bus, cfi_array->address, CFI_INTEL_CMD_CLEAR_STATUS_REGISTER);
URJ_BUS_WRITE (bus, cfi_array->address,
CFI_INTEL_CMD_CLEAR_STATUS_REGISTER);
URJ_BUS_WRITE (bus, adr, CFI_INTEL_CMD_PROGRAM1);
URJ_BUS_WRITE (bus, adr, data);
while (!((sr = URJ_BUS_READ (bus, cfi_array->address) & 0xFE) & CFI_INTEL_SR_READY)); /* TODO: add timeout */
while (!((sr = URJ_BUS_READ (bus, cfi_array->address) & 0xFE) & CFI_INTEL_SR_READY)); /* TODO: add timeout */
if (sr != CFI_INTEL_SR_READY)
{
@ -340,10 +348,10 @@ intel_flash_program_buffer (urj_flash_cfi_array_t *cfi_array, uint32_t adr,
/* issue command WRITE_TO_BUFFER */
URJ_BUS_WRITE (bus, cfi_array->address,
CFI_INTEL_CMD_CLEAR_STATUS_REGISTER);
CFI_INTEL_CMD_CLEAR_STATUS_REGISTER);
URJ_BUS_WRITE (bus, adr, CFI_INTEL_CMD_WRITE_TO_BUFFER);
/* poll XSR7 == 1 */
while (!((sr = URJ_BUS_READ (bus, cfi_array->address) & 0xFE) & CFI_INTEL_SR_READY)); /* TODO: add timeout */
while (!((sr = URJ_BUS_READ (bus, cfi_array->address) & 0xFE) & CFI_INTEL_SR_READY)); /* TODO: add timeout */
/* write count value (number of upcoming writes - 1) */
URJ_BUS_WRITE (bus, adr, wcount - 1);
@ -363,7 +371,7 @@ intel_flash_program_buffer (urj_flash_cfi_array_t *cfi_array, uint32_t adr,
}
/* poll SR7 == 1 */
while (!((sr = URJ_BUS_READ (bus, cfi_array->address) & 0xFE) & CFI_INTEL_SR_READY)); /* TODO: add timeout */
while (!((sr = URJ_BUS_READ (bus, cfi_array->address) & 0xFE) & CFI_INTEL_SR_READY)); /* TODO: add timeout */
if (sr != CFI_INTEL_SR_READY)
{
printf (_("flash: unknown error while programming\n"));
@ -374,8 +382,8 @@ intel_flash_program_buffer (urj_flash_cfi_array_t *cfi_array, uint32_t adr,
}
static int
intel_flash_program (urj_flash_cfi_array_t *cfi_array, uint32_t adr, uint32_t *buffer,
int count)
intel_flash_program (urj_flash_cfi_array_t *cfi_array, uint32_t adr,
uint32_t *buffer, int count)
{
urj_flash_cfi_query_structure_t *cfi = &(cfi_array->cfi_chips[0]->cfi);
int max_bytes_write = cfi->device_geometry.max_bytes_write;
@ -413,14 +421,15 @@ intel_flash_erase_block32 (urj_flash_cfi_array_t *cfi_array, uint32_t adr)
urj_bus_t *bus = cfi_array->bus;
URJ_BUS_WRITE (bus, cfi_array->address,
(CFI_INTEL_CMD_CLEAR_STATUS_REGISTER << 16) |
CFI_INTEL_CMD_CLEAR_STATUS_REGISTER);
(CFI_INTEL_CMD_CLEAR_STATUS_REGISTER << 16) |
CFI_INTEL_CMD_CLEAR_STATUS_REGISTER);
URJ_BUS_WRITE (bus, adr,
(CFI_INTEL_CMD_BLOCK_ERASE << 16) | CFI_INTEL_CMD_BLOCK_ERASE);
(CFI_INTEL_CMD_BLOCK_ERASE << 16) |
CFI_INTEL_CMD_BLOCK_ERASE);
URJ_BUS_WRITE (bus, adr,
(CFI_INTEL_CMD_CONFIRM << 16) | CFI_INTEL_CMD_CONFIRM);
(CFI_INTEL_CMD_CONFIRM << 16) | CFI_INTEL_CMD_CONFIRM);
while (((sr = URJ_BUS_READ (bus, cfi_array->address) & 0x00FE00FE) & ((CFI_INTEL_SR_READY << 16) | CFI_INTEL_SR_READY)) != ((CFI_INTEL_SR_READY << 16) | CFI_INTEL_SR_READY)); /* TODO: add timeout */
while (((sr = URJ_BUS_READ (bus, cfi_array->address) & 0x00FE00FE) & ((CFI_INTEL_SR_READY << 16) | CFI_INTEL_SR_READY)) != ((CFI_INTEL_SR_READY << 16) | CFI_INTEL_SR_READY)); /* TODO: add timeout */
if (sr != ((CFI_INTEL_SR_READY << 16) | CFI_INTEL_SR_READY))
{
@ -438,15 +447,16 @@ intel_flash_unlock_block32 (urj_flash_cfi_array_t *cfi_array, uint32_t adr)
urj_bus_t *bus = cfi_array->bus;
URJ_BUS_WRITE (bus, cfi_array->address,
(CFI_INTEL_CMD_CLEAR_STATUS_REGISTER << 16) |
CFI_INTEL_CMD_CLEAR_STATUS_REGISTER);
(CFI_INTEL_CMD_CLEAR_STATUS_REGISTER << 16) |
CFI_INTEL_CMD_CLEAR_STATUS_REGISTER);
URJ_BUS_WRITE (bus, adr,
(CFI_INTEL_CMD_LOCK_SETUP << 16) | CFI_INTEL_CMD_LOCK_SETUP);
(CFI_INTEL_CMD_LOCK_SETUP << 16) |
CFI_INTEL_CMD_LOCK_SETUP);
URJ_BUS_WRITE (bus, adr,
(CFI_INTEL_CMD_UNLOCK_BLOCK << 16) |
CFI_INTEL_CMD_UNLOCK_BLOCK);
(CFI_INTEL_CMD_UNLOCK_BLOCK << 16) |
CFI_INTEL_CMD_UNLOCK_BLOCK);
while (((sr = URJ_BUS_READ (bus, cfi_array->address) & 0x00FE00FE) & ((CFI_INTEL_SR_READY << 16) | CFI_INTEL_SR_READY)) != ((CFI_INTEL_SR_READY << 16) | CFI_INTEL_SR_READY)); /* TODO: add timeout */
while (((sr = URJ_BUS_READ (bus, cfi_array->address) & 0x00FE00FE) & ((CFI_INTEL_SR_READY << 16) | CFI_INTEL_SR_READY)) != ((CFI_INTEL_SR_READY << 16) | CFI_INTEL_SR_READY)); /* TODO: add timeout */
if (sr != ((CFI_INTEL_SR_READY << 16) | CFI_INTEL_SR_READY))
{
@ -465,13 +475,13 @@ intel_flash_program32_single (urj_flash_cfi_array_t *cfi_array, uint32_t adr,
urj_bus_t *bus = cfi_array->bus;
URJ_BUS_WRITE (bus, cfi_array->address,
(CFI_INTEL_CMD_CLEAR_STATUS_REGISTER << 16) |
CFI_INTEL_CMD_CLEAR_STATUS_REGISTER);
(CFI_INTEL_CMD_CLEAR_STATUS_REGISTER << 16) |
CFI_INTEL_CMD_CLEAR_STATUS_REGISTER);
URJ_BUS_WRITE (bus, adr,
(CFI_INTEL_CMD_PROGRAM1 << 16) | CFI_INTEL_CMD_PROGRAM1);
(CFI_INTEL_CMD_PROGRAM1 << 16) | CFI_INTEL_CMD_PROGRAM1);
URJ_BUS_WRITE (bus, adr, data);
while (((sr = URJ_BUS_READ (bus, cfi_array->address) & 0x00FE00FE) & ((CFI_INTEL_SR_READY << 16) | CFI_INTEL_SR_READY)) != ((CFI_INTEL_SR_READY << 16) | CFI_INTEL_SR_READY)); /* TODO: add timeout */
while (((sr = URJ_BUS_READ (bus, cfi_array->address) & 0x00FE00FE) & ((CFI_INTEL_SR_READY << 16) | CFI_INTEL_SR_READY)) != ((CFI_INTEL_SR_READY << 16) | CFI_INTEL_SR_READY)); /* TODO: add timeout */
if (sr != ((CFI_INTEL_SR_READY << 16) | CFI_INTEL_SR_READY))
{

@ -708,7 +708,8 @@ static const struct amd_flash_info table[] = {
};
int
urj_flash_jedec_detect (urj_bus_t *bus, uint32_t adr, urj_flash_cfi_array_t **cfi_array)
urj_flash_jedec_detect (urj_bus_t *bus, uint32_t adr,
urj_flash_cfi_array_t **cfi_array)
{
/* Temporary containers for manufacturer and device id while
probing with different Autoselect methods. */
@ -732,7 +733,8 @@ urj_flash_jedec_detect (urj_bus_t *bus, uint32_t adr, urj_flash_cfi_array_t **cf
return -3; /* invalid bus width */
(*cfi_array)->bus_width = ba = bw / 8;
(*cfi_array)->cfi_chips = calloc (1, sizeof (urj_flash_cfi_chip_t *) * ba);
(*cfi_array)->cfi_chips =
calloc (1, sizeof (urj_flash_cfi_chip_t *) * ba);
if (!(*cfi_array)->cfi_chips)
return -2; /* out of memory */

@ -28,10 +28,13 @@
#include <bus_driver.h>
#include <flash.h>
int urj_flash_jedec_detect (urj_bus_t *bus, uint32_t adr, urj_flash_cfi_array_t **cfi_array);
int urj_flash_jedec_detect (urj_bus_t *bus, uint32_t adr,
urj_flash_cfi_array_t **cfi_array);
#ifdef JEDEC_EXP
int urj_flash_jedec_exp_detect (urj_bus_t *bus, uint32_t adr, urj_flash_cfi_array_t **cfi_array);
int urj_flash_jedec_exp_detect (urj_bus_t *bus, uint32_t adr,
urj_flash_cfi_array_t **cfi_array);
#endif
int urj_flash_amd_detect (urj_bus_t *bus, uint32_t adr, urj_flash_cfi_array_t **cfi_array);
int urj_flash_amd_detect (urj_bus_t *bus, uint32_t adr,
urj_flash_cfi_array_t **cfi_array);
#endif /* ndef URJ_FLASH_JEDEC_H */
#endif /* ndef URJ_FLASH_JEDEC_H */

@ -37,9 +37,9 @@
void
urj_flash_jedec_exp_read_id (urj_bus_t *bus, uint32_t adr, uint32_t dmask,
uint32_t pata, uint32_t patb, uint32_t dcmd,
int det_addroffset, int det_dataoffset,
uint32_t det_addrpat)
uint32_t pata, uint32_t patb, uint32_t dcmd,
int det_addroffset, int det_dataoffset,
uint32_t det_addrpat)
{
int locofs;
@ -52,15 +52,16 @@ urj_flash_jedec_exp_read_id (urj_bus_t *bus, uint32_t adr, uint32_t dmask,
for (locofs = 0; locofs <= 2; locofs++)
{
printf (" %08x",
(dmask & URJ_BUS_READ (bus, adr + (locofs << det_addroffset))) >>
det_dataoffset);
(dmask & URJ_BUS_READ (bus, adr + (locofs << det_addroffset)))
>> det_dataoffset);
}
printf ("\n");
}
int
urj_flash_jedec_exp_detect (urj_bus_t *bus, uint32_t adr, urj_flash_cfi_array_t **cfi_array)
urj_flash_jedec_exp_detect (urj_bus_t *bus, uint32_t adr,
urj_flash_cfi_array_t **cfi_array)
{
/* Temporary containers for manufacturer and device id while
probing with different Autoselect methods. */
@ -109,8 +110,9 @@ urj_flash_jedec_exp_detect (urj_bus_t *bus, uint32_t adr, urj_flash_cfi_array_t
det_dataoffset += 8)
{
int det_addroffset;
uint32_t dmask =
URJ_BITS (det_dataoffset, det_datawidth + det_dataoffset - 1);
uint32_t dmask = URJ_BITS (det_dataoffset,
det_datawidth + det_dataoffset -
1);
uint32_t pata = ~dmask | (0xAA << det_dataoffset);
uint32_t patb = ~dmask | (0x55 << det_dataoffset);
uint32_t dcmd = ~dmask | (0x90 << det_dataoffset);
@ -122,12 +124,12 @@ urj_flash_jedec_exp_detect (urj_bus_t *bus, uint32_t adr, urj_flash_cfi_array_t
for (det_addroffset = 0; det_addroffset <= 2;
det_addroffset++)
{
urj_flash_jedec_exp_read_id (bus, adr, dmask, pata, patb, dcmd,
det_addroffset, det_dataoffset,
0x5555);
urj_flash_jedec_exp_read_id (bus, adr, dmask, pata, patb, dcmd,
det_addroffset, det_dataoffset,
0x0555);
urj_flash_jedec_exp_read_id (bus, adr, dmask, pata, patb,
dcmd, det_addroffset,
det_dataoffset, 0x5555);
urj_flash_jedec_exp_read_id (bus, adr, dmask, pata, patb,
dcmd, det_addroffset,
det_dataoffset, 0x0555);
}
}
}

@ -106,7 +106,8 @@ typedef struct
intel_f28xxxb3_state_t;
void
urj_jim_intel_28fxxxb3_init (urj_jim_bus_device_t *d, uint16_t id, b3_boot_type_t bt)
urj_jim_intel_28fxxxb3_init (urj_jim_bus_device_t *d, uint16_t id,
b3_boot_type_t bt)
{
d->state = malloc (sizeof (intel_f28xxxb3_state_t));
if (d->state != NULL)
@ -136,8 +137,8 @@ urj_jim_intel_28fxxxb3_free (urj_jim_bus_device_t *d)
uint32_t
urj_jim_intel_28fxxxb3_capture (urj_jim_bus_device_t *d,
uint32_t address, uint32_t control,
uint8_t *shmem, size_t shmem_size)
uint32_t address, uint32_t control,
uint8_t *shmem, size_t shmem_size)
{
uint32_t data = 0;
@ -192,8 +193,9 @@ urj_jim_intel_28fxxxb3_capture (urj_jim_bus_device_t *d,
void
urj_jim_intel_28fxxxb3_update (urj_jim_bus_device_t *d,
uint32_t address, uint32_t data, uint32_t control,
uint8_t *shmem, size_t shmem_size)
uint32_t address, uint32_t data,
uint32_t control, uint8_t *shmem,
size_t shmem_size)
{
#if 0
printf ("update A=%08X, D=%08X%s%s%s\n", address, data,
@ -416,5 +418,5 @@ urj_jim_bus_device_t intel_28f800b3b = {
urj_jim_intel_28f800b3b_init, /* init() */
urj_jim_intel_28fxxxb3_capture, /* access() */
urj_jim_intel_28fxxxb3_update, /* access() */
urj_jim_intel_28fxxxb3_free /* free() */
urj_jim_intel_28fxxxb3_free /* free() */
};

@ -55,7 +55,8 @@ urj_jim_some_cpu_report_idcode (urj_jim_device_t *dev)
void
urj_jim_some_cpu_tck_rise (urj_jim_device_t *dev,
int tms, int tdi, uint8_t *shmem, size_t shmem_size)
int tms, int tdi, uint8_t *shmem,
size_t shmem_size)
{
int i;
@ -143,7 +144,8 @@ urj_jim_some_cpu_tck_rise (urj_jim_device_t *dev,
}
void
urj_jim_some_cpu_tck_fall (urj_jim_device_t *dev, uint8_t *shmem, size_t shmem_size)
urj_jim_some_cpu_tck_fall (urj_jim_device_t *dev, uint8_t *shmem,
size_t shmem_size)
{
int i;
@ -198,7 +200,8 @@ urj_jim_some_cpu_free (urj_jim_device_t *dev)
for (i = 0; some_cpu_attached[i].part; i++)
{
urj_jim_bus_device_t *b = ((urj_jim_attached_part_t *) (dev->state))[i].part;
urj_jim_bus_device_t *b =
((urj_jim_attached_part_t *) (dev->state))[i].part;
if (b->free != NULL)
b->free (b);
free (b);

@ -66,7 +66,8 @@ urj_jim_print_tap_state (char *rof, urj_jim_device_t *dev)
switch (dev->tap_state & 7)
{
case 0:
printf ((dev->tap_state == URJ_JIM_RESET) ? "URJ_JIM_RESET" : "URJ_JIM_IDLE");
printf ((dev->tap_state ==
URJ_JIM_RESET) ? "URJ_JIM_RESET" : "URJ_JIM_IDLE");
break;
case 1:
printf ("SELECT");
@ -177,7 +178,8 @@ urj_jim_tck_rise (urj_jim_state_t *s, int tms, int tdi)
{
reg = sr->reg;
if (dev->tap_state == URJ_JIM_SHIFT_IR || dev->tap_state == URJ_JIM_SHIFT_DR)
if (dev->tap_state == URJ_JIM_SHIFT_IR
|| dev->tap_state == URJ_JIM_SHIFT_DR)
{
/* Start with LSW of shift register at index 0 */
@ -231,7 +233,8 @@ urj_jim_alloc_device (int num_sregs, const int reg_size[])
{
int i, r;
urj_jim_device_t *dev = (urj_jim_device_t *) malloc (sizeof (urj_jim_device_t));
urj_jim_device_t *dev =
(urj_jim_device_t *) malloc (sizeof (urj_jim_device_t));
if (dev == NULL)
{
@ -239,7 +242,9 @@ urj_jim_alloc_device (int num_sregs, const int reg_size[])
return NULL;
}
dev->sreg = (urj_jim_shift_reg_t *) malloc (num_sregs * sizeof (urj_jim_shift_reg_t));
dev->sreg =
(urj_jim_shift_reg_t *) malloc (num_sregs *
sizeof (urj_jim_shift_reg_t));
if (dev->sreg == NULL)
{

@ -52,7 +52,7 @@
#include "jtag.h"
#ifndef HAVE_GETLINE
ssize_t urj_lib_getline (char **lineptr, size_t * n, FILE *stream);
ssize_t urj_lib_getline (char **lineptr, size_t *n, FILE * stream);
#endif
int debug_mode = 0;
@ -148,7 +148,7 @@ jtag_save_history (void)
#endif
static int
jtag_readline_multiple_commands_support (urj_chain_t *chain, char *line) /* multiple commands should be separated with '::' */
jtag_readline_multiple_commands_support (urj_chain_t *chain, char *line) /* multiple commands should be separated with '::' */
{
int r;
char *nextcmd = line;

@ -33,7 +33,7 @@
#define GETDELIM_BUFFER 128
ssize_t
urj_lib_getdelim (char **lineptr, size_t * n, int delimiter, FILE *stream)
urj_lib_getdelim (char **lineptr, size_t *n, int delimiter, FILE * stream)
{
char *p;
int c;

@ -30,11 +30,12 @@
#ifndef HAVE_GETLINE
#ifndef HAVE_GETDELIM
ssize_t urj_lib_getdelim (char **lineptr, size_t * n, int delimiter, FILE *stream);
ssize_t urj_lib_getdelim (char **lineptr, size_t *n, int delimiter,
FILE * stream);
#endif /* HAVE_GETDELIM */
ssize_t
urj_lib_getline (char **lineptr, size_t * n, FILE *stream)
urj_lib_getline (char **lineptr, size_t *n, FILE * stream)
{
return urj_lib_getdelim (lineptr, n, '\n', stream);
}

@ -28,7 +28,8 @@
#include "bsbit.h"
urj_bsbit_t *
urj_part_bsbit_alloc (int bit, const char *name, int type, urj_part_signal_t *signal, int safe)
urj_part_bsbit_alloc (int bit, const char *name, int type,
urj_part_signal_t *signal, int safe)
{
urj_bsbit_t *b = malloc (sizeof *b);
if (!b)

@ -264,13 +264,14 @@ urj_part_print (urj_part_t *p)
return;
snprintf (format, 100, _("%%-%ds %%-%ds %%-%ds %%-%ds %%-%ds\n"),
URJ_PART_MANUFACTURER_MAXLEN, URJ_PART_PART_MAXLEN, URJ_PART_STEPPING_MAXLEN,
URJ_INSTRUCTION_MAXLEN_INSTRUCTION, URJ_DATA_REGISTER_MAXLEN);
URJ_PART_MANUFACTURER_MAXLEN, URJ_PART_PART_MAXLEN,
URJ_PART_STEPPING_MAXLEN, URJ_INSTRUCTION_MAXLEN_INSTRUCTION,
URJ_DATA_REGISTER_MAXLEN);
if (p->active_instruction)
{
instruction = p->active_instruction->name;
if (p->active_instruction->data_register !=NULL)
if (p->active_instruction->data_register != NULL)
dr = p->active_instruction->data_register->name;
}
if (instruction == NULL)

@ -46,10 +46,10 @@
#include <tap_state.h>
#if 0
#include <urjtag/svf.h> /* two include files w/ the same name
* this will be resolved when we will have
* include/urjtag/svf.h
* RFHH */
#include <urjtag/svf.h> /* two include files w/ the same name
* this will be resolved when we will have
* include/urjtag/svf.h
* RFHH */
#endif
#include <cmd.h>
@ -123,8 +123,9 @@ urj_svf_goto_state (urj_chain_t *chain, int new_state)
case URJ_TAP_STATE_SELECT_IR_SCAN:
if (new_state == URJ_TAP_STATE_TEST_LOGIC_RESET ||
new_state == URJ_TAP_STATE_RUN_TEST_IDLE ||
(current_state & URJ_TAP_STATE_DR && new_state & URJ_TAP_STATE_IR) ||
(current_state & URJ_TAP_STATE_IR && new_state & URJ_TAP_STATE_DR))
(current_state & URJ_TAP_STATE_DR && new_state & URJ_TAP_STATE_IR)
|| (current_state & URJ_TAP_STATE_IR
&& new_state & URJ_TAP_STATE_DR))
/* progress in select-idle/reset loop */
urj_tap_chain_clock (chain, 1, 0, 1);
else
@ -381,8 +382,8 @@ urj_svf_build_bit_string (char *hex_string, int len)
*bit_string_pos =
urj_svf_hex2dec (hex_string_idx >=
0 ? *hex_string_pos : '0') & (1 << nibble) ? '1' :
'0';
0 ? *hex_string_pos : '0') & (1 << nibble) ? '1'
: '0';
}
while (bit_string_pos != bit_string);
@ -443,7 +444,7 @@ urj_svf_copy_hex_to_register (char *hex_string, urj_tap_register_t *reg)
*/
static int
urj_svf_compare_tdo (urj_svf_parser_priv_t *priv, char *tdo, char *mask,
urj_tap_register_t *reg, YYLTYPE * loc)
urj_tap_register_t *reg, YYLTYPE *loc)
{
char *tdo_bit, *mask_bit;
int pos, mismatch, result = 1;
@ -573,7 +574,8 @@ urj_svf_all_care (char **string, double number)
* state : required end state (SVF parser encoding)
* ***************************************************************************/
void
urj_svf_endxr (urj_svf_parser_priv_t *priv, enum URJ_SVF_generic_irdr_coding ir_dr, int state)
urj_svf_endxr (urj_svf_parser_priv_t *priv,
enum URJ_SVF_generic_irdr_coding ir_dr, int state)
{
switch (ir_dr)
{
@ -619,7 +621,8 @@ urj_svf_frequency (urj_chain_t *chain, double freq)
* 0 : error occurred
* ***************************************************************************/
int
urj_svf_hxr (enum URJ_SVF_generic_irdr_coding ir_dr, struct ths_params *params)
urj_svf_hxr (enum URJ_SVF_generic_irdr_coding ir_dr,
struct ths_params *params)
{
if (params->number != 0.0)
printf (_("Warning %s: command %s not implemented\n"), "svf",
@ -650,7 +653,8 @@ sigalrm_handler (int signal)
* 0 : error occurred
* ***************************************************************************/
int
urj_svf_runtest (urj_chain_t *chain, urj_svf_parser_priv_t *priv, struct runtest *params)
urj_svf_runtest (urj_chain_t *chain, urj_svf_parser_priv_t *priv,
struct runtest *params)
{
uint32_t run_count, frequency;
@ -800,14 +804,15 @@ urj_svf_runtest (urj_chain_t *chain, urj_svf_parser_priv_t *priv, struct runtest
* ***************************************************************************/
int
urj_svf_state (urj_chain_t *chain, urj_svf_parser_priv_t *priv,
struct path_states *path_states, int stable_state)
struct path_states *path_states, int stable_state)
{
int i;
priv->svf_state_executed = 1;
for (i = 0; i < path_states->num_states; i++)
urj_svf_goto_state (chain, urj_svf_map_state (path_states->states[i]));
urj_svf_goto_state (chain,
urj_svf_map_state (path_states->states[i]));
if (stable_state)
urj_svf_goto_state (chain, urj_svf_map_state (stable_state));
@ -831,14 +836,15 @@ urj_svf_state (urj_chain_t *chain, urj_svf_parser_priv_t *priv,
* ***************************************************************************/
int
urj_svf_sxr (urj_chain_t *chain, urj_svf_parser_priv_t *priv,
enum URJ_SVF_generic_irdr_coding ir_dr, struct ths_params *params,
YYLTYPE * loc)
enum URJ_SVF_generic_irdr_coding ir_dr,
struct ths_params *params, YYLTYPE *loc)
{
urj_svf_sxr_t *sxr_params;
int len, result = 1;
sxr_params =
ir_dr == URJ_SVF_generic_ir ? &(priv->sir_params) : &(priv->sdr_params);
ir_dr ==
URJ_SVF_generic_ir ? &(priv->sir_params) : &(priv->sdr_params);
/* remember parameters */
urj_svf_remember_param (&sxr_params->params.tdi, params->tdi);
@ -938,8 +944,9 @@ urj_svf_sxr (urj_chain_t *chain, urj_svf_parser_priv_t *priv,
/* fill register with value of TDI parameter */
if (!urj_svf_copy_hex_to_register (sxr_params->params.tdi,
ir_dr == URJ_SVF_generic_ir ? priv->ir->value :
priv->dr->in))
ir_dr ==
URJ_SVF_generic_ir ? priv->ir->
value : priv->dr->in))
return (0);
@ -949,27 +956,30 @@ urj_svf_sxr (urj_chain_t *chain, urj_svf_parser_priv_t *priv,
case URJ_SVF_generic_ir:
urj_svf_goto_state (chain, URJ_TAP_STATE_SHIFT_IR);
urj_tap_chain_shift_instructions_mode (chain,
sxr_params->params.tdo ? 1 : 0,
0, URJ_CHAIN_EXITMODE_EXIT1);
sxr_params->params.tdo ? 1 : 0,
0, URJ_CHAIN_EXITMODE_EXIT1);
urj_svf_goto_state (chain, priv->endir);
if (sxr_params->params.tdo)
result =
urj_svf_compare_tdo (priv, sxr_params->params.tdo,
sxr_params->params.mask, priv->ir->out, loc);
sxr_params->params.mask, priv->ir->out,
loc);
break;
case URJ_SVF_generic_dr:
urj_svf_goto_state (chain, URJ_TAP_STATE_SHIFT_DR);
urj_tap_chain_shift_data_registers_mode (chain,
sxr_params->params.tdo ? 1 : 0,
0, URJ_CHAIN_EXITMODE_EXIT1);
sxr_params->params.
tdo ? 1 : 0, 0,
URJ_CHAIN_EXITMODE_EXIT1);
urj_svf_goto_state (chain, priv->enddr);
if (sxr_params->params.tdo)
result =
urj_svf_compare_tdo (priv, sxr_params->params.tdo,
sxr_params->params.mask, priv->dr->out, loc);
sxr_params->params.mask, priv->dr->out,
loc);
break;
}
@ -1051,7 +1061,8 @@ urj_svf_trst (urj_chain_t *chain, urj_svf_parser_priv_t *priv, int trst_mode)
printf (_("Warning %s: unimplemented mode '%s' for TRST\n"), "svf",
unimplemented_mode);
else
urj_tap_cable_set_signal (chain->cable, URJ_POD_CS_TRST, trst_cable ? URJ_POD_CS_TRST : 0);
urj_tap_cable_set_signal (chain->cable, URJ_POD_CS_TRST,
trst_cable ? URJ_POD_CS_TRST : 0);
return (1);
}
@ -1074,7 +1085,8 @@ urj_svf_trst (urj_chain_t *chain, urj_svf_parser_priv_t *priv, int trst_mode)
* 0 : error occurred
* ***************************************************************************/
int
urj_svf_txr (enum URJ_SVF_generic_irdr_coding ir_dr, struct ths_params *params)
urj_svf_txr (enum URJ_SVF_generic_irdr_coding ir_dr,
struct ths_params *params)
{
if (params->number != 0.0)
printf (_("Warning %s: command %s not implemented\n"), "svf",
@ -1107,8 +1119,8 @@ urj_svf_txr (enum URJ_SVF_generic_irdr_coding ir_dr, struct ths_params *params)
* 0 : error occurred
* ***************************************************************************/
void
urj_svf_run (urj_chain_t *chain, FILE *SVF_FILE, int stop_on_mismatch,
int print_progress, uint32_t ref_freq)
urj_svf_run (urj_chain_t *chain, FILE * SVF_FILE, int stop_on_mismatch,
int print_progress, uint32_t ref_freq)
{
const urj_svf_sxr_t sxr_default = { {0.0, NULL, NULL, NULL, NULL},
1, 1
@ -1214,7 +1226,8 @@ urj_svf_run (urj_chain_t *chain, FILE *SVF_FILE, int stop_on_mismatch,
priv.endir = priv.enddr = URJ_TAP_STATE_RUN_TEST_IDLE;
priv.runtest_run_state = priv.runtest_end_state = URJ_TAP_STATE_RUN_TEST_IDLE;
priv.runtest_run_state = priv.runtest_end_state =
URJ_TAP_STATE_RUN_TEST_IDLE;
priv.svf_trst_absent = 0;
priv.svf_state_executed = 0;

@ -130,12 +130,16 @@ void urj_svf_flex_deinit (void *);
int urj_svf_bison_init (urj_svf_parser_priv_t *, FILE *, int, int);
void urj_svf_bison_deinit (urj_svf_parser_priv_t *);
void urj_svf_endxr (urj_svf_parser_priv_t *, enum URJ_SVF_generic_irdr_coding, int);
void urj_svf_endxr (urj_svf_parser_priv_t *, enum URJ_SVF_generic_irdr_coding,
int);
void urj_svf_frequency (urj_chain_t *, double);
int urj_svf_hxr (enum URJ_SVF_generic_irdr_coding, struct ths_params *);
int urj_svf_runtest (urj_chain_t *, urj_svf_parser_priv_t *, struct runtest *);
int urj_svf_state (urj_chain_t *, urj_svf_parser_priv_t *, struct path_states *, int);
int urj_svf_sxr (urj_chain_t *, urj_svf_parser_priv_t *, enum URJ_SVF_generic_irdr_coding,
struct ths_params *, struct YYLTYPE *);
int urj_svf_runtest (urj_chain_t *, urj_svf_parser_priv_t *,
struct runtest *);
int urj_svf_state (urj_chain_t *, urj_svf_parser_priv_t *,
struct path_states *, int);
int urj_svf_sxr (urj_chain_t *, urj_svf_parser_priv_t *,
enum URJ_SVF_generic_irdr_coding, struct ths_params *,
struct YYLTYPE *);
int urj_svf_trst (urj_chain_t *, urj_svf_parser_priv_t *, int);
int urj_svf_txr (enum URJ_SVF_generic_irdr_coding, struct ths_params *);

@ -219,7 +219,8 @@ urj_tap_cable_add_queue_item (urj_cable_t *cable, urj_cable_queue_info_t *q)
#endif
new_max_items = q->max_items + 128;
resized = realloc (q->data, new_max_items * sizeof (urj_cable_queue_t));
resized =
realloc (q->data, new_max_items * sizeof (urj_cable_queue_t));
if (resized == NULL)
{
printf (_
@ -561,7 +562,8 @@ urj_tap_cable_transfer_late (urj_cable_t *cable, char *out)
}
int
urj_tap_cable_defer_transfer (urj_cable_t *cable, int len, char *in, char *out)
urj_tap_cable_defer_transfer (urj_cable_t *cable, int len, char *in,
char *out)
{
char *ibuf, *obuf = NULL;
int i;

@ -81,12 +81,12 @@ arcom_clock (urj_cable_t *cable, int tms, int tdi, int n)
for (i = 0; i < n; i++)
{
urj_tap_parport_set_data (cable->link.port,
(trst << TRST) | (0 << TCK) | (tms << TMS) | (tdi <<
TDI));
(trst << TRST) | (0 << TCK) | (tms << TMS) |
(tdi << TDI));
urj_tap_cable_wait (cable);
urj_tap_parport_set_data (cable->link.port,
(trst << TRST) | (1 << TCK) | (tms << TMS) | (tdi <<
TDI));
(trst << TRST) | (1 << TCK) | (tms << TMS) |
(tdi << TDI));
urj_tap_cable_wait (cable);
}
@ -102,7 +102,8 @@ arcom_get_tdo (urj_cable_t *cable)
int trst = (PARAM_SIGNALS (cable) & URJ_POD_CS_TRST) ? 1 : 0;
urj_tap_parport_set_data (cable->link.port, (trst << TRST) | (0 << TCK));
PARAM_SIGNALS (cable) &= ~(URJ_POD_CS_TDI | URJ_POD_CS_TCK | URJ_POD_CS_TMS);
PARAM_SIGNALS (cable) &=
~(URJ_POD_CS_TDI | URJ_POD_CS_TCK | URJ_POD_CS_TMS);
urj_tap_cable_wait (cable);

@ -87,7 +87,8 @@ byteblaster_init (urj_cable_t *cable)
/* check if the power supply is ok (only for ByteBlaster II) */
/* if no ByteBlaster at all is connected this check will fail, too */
if ((BB_II) && ((urj_tap_parport_get_status (cable->link.port) >> VCC_OK_N) & 1))
if ((BB_II)
&& ((urj_tap_parport_get_status (cable->link.port) >> VCC_OK_N) & 1))
return -1;
/* Enable ByteBlaster */
@ -107,10 +108,10 @@ byteblaster_clock (urj_cable_t *cable, int tms, int tdi, int n)
for (i = 0; i < n; i++)
{
urj_tap_parport_set_data (cable->link.port,
(0 << TCK) | (tms << TMS) | (tdi << TDI));
(0 << TCK) | (tms << TMS) | (tdi << TDI));
urj_tap_cable_wait (cable);
urj_tap_parport_set_data (cable->link.port,
(1 << TCK) | (tms << TMS) | (tdi << TDI));
(1 << TCK) | (tms << TMS) | (tdi << TDI));
urj_tap_cable_wait (cable);
}
@ -124,7 +125,8 @@ static int
byteblaster_get_tdo (urj_cable_t *cable)
{
urj_tap_parport_set_data (cable->link.port, 0 << TCK);
PARAM_SIGNALS (cable) &= ~(URJ_POD_CS_TDI | URJ_POD_CS_TCK | URJ_POD_CS_TMS);
PARAM_SIGNALS (cable) &=
~(URJ_POD_CS_TDI | URJ_POD_CS_TCK | URJ_POD_CS_TMS);
urj_tap_cable_wait (cable);

@ -77,7 +77,8 @@ extend_cmd_buffer (urj_tap_cable_cmd_xfer_cx_cmd_t *cmd)
*
****************************************************************************/
int
urj_tap_cable_cx_cmd_space (urj_tap_cable_cmd_xfer_cx_cmd_root_t *cmd_root, int max_len)
urj_tap_cable_cx_cmd_space (urj_tap_cable_cmd_xfer_cx_cmd_root_t *cmd_root,
int max_len)
{
int n;
urj_tap_cable_cmd_xfer_cx_cmd_t *cmd = cmd_root->last;
@ -107,7 +108,8 @@ urj_tap_cable_cx_cmd_space (urj_tap_cable_cmd_xfer_cx_cmd_root_t *cmd_root, int
*
****************************************************************************/
int
urj_tap_cable_cx_cmd_push (urj_tap_cable_cmd_xfer_cx_cmd_root_t *cmd_root, uint8_t d)
urj_tap_cable_cx_cmd_push (urj_tap_cable_cmd_xfer_cx_cmd_root_t *cmd_root,
uint8_t d)
{
urj_tap_cable_cmd_xfer_cx_cmd_t *cmd = cmd_root->last;
@ -190,9 +192,12 @@ urj_tap_cable_cx_cmd_free (urj_tap_cable_cmd_xfer_cx_cmd_t *cmd)
*
****************************************************************************/
urj_tap_cable_cmd_xfer_cx_cmd_t *
urj_tap_cable_cx_cmd_queue (urj_tap_cable_cmd_xfer_cx_cmd_root_t *cmd_root, uint32_t to_recv)
urj_tap_cable_cx_cmd_queue (urj_tap_cable_cmd_xfer_cx_cmd_root_t *cmd_root,
uint32_t to_recv)
{
urj_tap_cable_cmd_xfer_cx_cmd_t *cmd = (urj_tap_cable_cmd_xfer_cx_cmd_t *) malloc (sizeof (urj_tap_cable_cmd_xfer_cx_cmd_t));
urj_tap_cable_cmd_xfer_cx_cmd_t *cmd =
(urj_tap_cable_cmd_xfer_cx_cmd_t *)
malloc (sizeof (urj_tap_cable_cmd_xfer_cx_cmd_t));
if (cmd)
{
@ -283,10 +288,12 @@ urj_tap_cable_cx_cmd_deinit (urj_tap_cable_cmd_xfer_cx_cmd_root_t *cmd_root)
*
****************************************************************************/
void
urj_tap_cable_cx_xfer (urj_tap_cable_cmd_xfer_cx_cmd_root_t *cmd_root, const urj_tap_cable_cmd_xfer_cx_cmd_t *out_cmd,
urj_cable_t *cable, urj_cable_flush_amount_t how_much)
urj_tap_cable_cx_xfer (urj_tap_cable_cmd_xfer_cx_cmd_root_t *cmd_root,
const urj_tap_cable_cmd_xfer_cx_cmd_t *out_cmd,
urj_cable_t *cable, urj_cable_flush_amount_t how_much)
{
urj_tap_cable_cmd_xfer_cx_cmd_t *cmd = urj_tap_cable_cx_cmd_dequeue (cmd_root);
urj_tap_cable_cmd_xfer_cx_cmd_t *cmd =
urj_tap_cable_cx_cmd_dequeue (cmd_root);
uint32_t bytes_to_recv;
bytes_to_recv = 0;
@ -297,7 +304,8 @@ urj_tap_cable_cx_xfer (urj_tap_cable_cmd_xfer_cx_cmd_root_t *cmd_root, const urj
through the usbconn driver */
bytes_to_recv += cmd->to_recv;
/* write command data (buffered) */
urj_tap_usbconn_write (cable->link.usb, cmd->buf, cmd->buf_pos, cmd->to_recv);
urj_tap_usbconn_write (cable->link.usb, cmd->buf, cmd->buf_pos,
cmd->to_recv);
urj_tap_cable_cx_cmd_free (cmd);
cmd = urj_tap_cable_cx_cmd_dequeue (cmd_root);
}
@ -307,8 +315,8 @@ urj_tap_cable_cx_xfer (urj_tap_cable_cmd_xfer_cx_cmd_root_t *cmd_root, const urj
data is expected */
if (bytes_to_recv && out_cmd)
{
urj_tap_usbconn_write (cable->link.usb, out_cmd->buf, out_cmd->buf_pos,
out_cmd->to_recv);
urj_tap_usbconn_write (cable->link.usb, out_cmd->buf,
out_cmd->buf_pos, out_cmd->to_recv);
bytes_to_recv += out_cmd->to_recv;
}

@ -49,16 +49,26 @@ struct cx_cmd_root
};
typedef struct cx_cmd_root urj_tap_cable_cmd_xfer_cx_cmd_root_t;
int urj_tap_cable_cx_cmd_space (urj_tap_cable_cmd_xfer_cx_cmd_root_t *cmd_root, int max_len);
int urj_tap_cable_cx_cmd_push (urj_tap_cable_cmd_xfer_cx_cmd_root_t *cmd_root, uint8_t d);
urj_tap_cable_cmd_xfer_cx_cmd_t *urj_tap_cable_cx_cmd_dequeue (urj_tap_cable_cmd_xfer_cx_cmd_root_t *cmd_root);
int urj_tap_cable_cx_cmd_space (urj_tap_cable_cmd_xfer_cx_cmd_root_t
*cmd_root, int max_len);
int urj_tap_cable_cx_cmd_push (urj_tap_cable_cmd_xfer_cx_cmd_root_t *cmd_root,
uint8_t d);
urj_tap_cable_cmd_xfer_cx_cmd_t
*urj_tap_cable_cx_cmd_dequeue (urj_tap_cable_cmd_xfer_cx_cmd_root_t
*cmd_root);
void urj_tap_cable_cx_cmd_free (urj_tap_cable_cmd_xfer_cx_cmd_t *cmd);
urj_tap_cable_cmd_xfer_cx_cmd_t *urj_tap_cable_cx_cmd_queue (urj_tap_cable_cmd_xfer_cx_cmd_root_t *cmd_root, uint32_t to_recv);
void urj_tap_cable_cx_cmd_init (urj_tap_cable_cmd_xfer_cx_cmd_root_t *cmd_root);
void urj_tap_cable_cx_cmd_deinit (urj_tap_cable_cmd_xfer_cx_cmd_root_t *cmd_root);
urj_tap_cable_cmd_xfer_cx_cmd_t
*urj_tap_cable_cx_cmd_queue (urj_tap_cable_cmd_xfer_cx_cmd_root_t
*cmd_root, uint32_t to_recv);
void urj_tap_cable_cx_cmd_init (urj_tap_cable_cmd_xfer_cx_cmd_root_t
*cmd_root);
void urj_tap_cable_cx_cmd_deinit (urj_tap_cable_cmd_xfer_cx_cmd_root_t
*cmd_root);
void urj_tap_cable_cx_xfer (urj_tap_cable_cmd_xfer_cx_cmd_root_t *cmd_root, const urj_tap_cable_cmd_xfer_cx_cmd_t *out_cmd,
urj_cable_t *cable, urj_cable_flush_amount_t how_much);
void urj_tap_cable_cx_xfer (urj_tap_cable_cmd_xfer_cx_cmd_root_t *cmd_root,
const urj_tap_cable_cmd_xfer_cx_cmd_t *out_cmd,
urj_cable_t *cable,
urj_cable_flush_amount_t how_much);
uint8_t urj_tap_cable_cx_xfer_recv (urj_cable_t *cable);
#endif /* URJ_TAP_CABLE_CMD_XFER_H */

@ -78,12 +78,12 @@ dlc5_clock (urj_cable_t *cable, int tms, int tdi, int n)
for (i = 0; i < n; i++)
{
urj_tap_parport_set_data (cable->link.port,
(1 << PROG) | (0 << TCK) | (tms << TMS) | (tdi <<
TDI));
(1 << PROG) | (0 << TCK) | (tms << TMS) |
(tdi << TDI));
urj_tap_cable_wait (cable);
urj_tap_parport_set_data (cable->link.port,
(1 << PROG) | (1 << TCK) | (tms << TMS) | (tdi <<
TDI));
(1 << PROG) | (1 << TCK) | (tms << TMS) |
(tdi << TDI));
urj_tap_cable_wait (cable);
}
@ -97,7 +97,8 @@ static int
dlc5_get_tdo (urj_cable_t *cable)
{
urj_tap_parport_set_data (cable->link.port, (1 << PROG) | (0 << TCK));
PARAM_SIGNALS (cable) &= ~(URJ_POD_CS_TDI | URJ_POD_CS_TCK | URJ_POD_CS_TMS);
PARAM_SIGNALS (cable) &=
~(URJ_POD_CS_TDI | URJ_POD_CS_TCK | URJ_POD_CS_TMS);
urj_tap_cable_wait (cable);

@ -81,12 +81,12 @@ ea253_clock (urj_cable_t *cable, int tms, int tdi, int n)
for (i = 0; i < n; i++)
{
urj_tap_parport_set_data (cable->link.port,
(trst << TRST) | (0 << TCK) | (tms << TMS) | (tdi <<
TDI));
(trst << TRST) | (0 << TCK) | (tms << TMS) |
(tdi << TDI));
urj_tap_cable_wait (cable);
urj_tap_parport_set_data (cable->link.port,
(trst << TRST) | (1 << TCK) | (tms << TMS) | (tdi <<
TDI));
(trst << TRST) | (1 << TCK) | (tms << TMS) |
(tdi << TDI));
urj_tap_cable_wait (cable);
}
@ -102,7 +102,8 @@ ea253_get_tdo (urj_cable_t *cable)
int trst = (PARAM_SIGNALS (cable) & URJ_POD_CS_TRST) ? 1 : 0;
urj_tap_parport_set_data (cable->link.port, (trst << TRST) | (0 << TCK));
PARAM_SIGNALS (cable) &= ~(URJ_POD_CS_TDI | URJ_POD_CS_TCK | URJ_POD_CS_TMS);
PARAM_SIGNALS (cable) &=
~(URJ_POD_CS_TDI | URJ_POD_CS_TCK | URJ_POD_CS_TMS);
urj_tap_cable_wait (cable);

@ -83,12 +83,12 @@ ei012_clock (urj_cable_t *cable, int tms, int tdi, int n)
for (i = 0; i < n; i++)
{
urj_tap_parport_set_data (cable->link.port,
(trst << TRST) | (0 << TCK) | (tms << TMS) | (tdi <<
TDI));
(trst << TRST) | (0 << TCK) | (tms << TMS) |
(tdi << TDI));
urj_tap_cable_wait (cable);
urj_tap_parport_set_data (cable->link.port,
(trst << TRST) | (1 << TCK) | (tms << TMS) | (tdi <<
TDI));
(trst << TRST) | (1 << TCK) | (tms << TMS) |
(tdi << TDI));
urj_tap_cable_wait (cable);
}
@ -104,7 +104,8 @@ ei012_get_tdo (urj_cable_t *cable)
int trst = (PARAM_SIGNALS (cable) & URJ_POD_CS_TRST) ? 1 : 0;
urj_tap_parport_set_data (cable->link.port, (trst << TRST) | (0 << TCK));
PARAM_SIGNALS (cable) &= ~(URJ_POD_CS_TDI | URJ_POD_CS_TCK | URJ_POD_CS_TMS);
PARAM_SIGNALS (cable) &=
~(URJ_POD_CS_TDI | URJ_POD_CS_TCK | URJ_POD_CS_TMS);
urj_tap_cable_wait (cable);

@ -222,7 +222,8 @@ typedef struct
static const uint8_t imm_buf[1] = { SEND_IMMEDIATE };
static const urj_tap_cable_cmd_xfer_cx_cmd_t imm_cmd = { NULL, 1, 1, (uint8_t *) imm_buf, 0 };
static const urj_tap_cable_cmd_xfer_cx_cmd_t imm_cmd =
{ NULL, 1, 1, (uint8_t *) imm_buf, 0 };
static void
@ -258,7 +259,8 @@ ft2232_set_frequency (urj_cable_t *cable, uint32_t new_frequency)
urj_tap_cable_cx_cmd_push (cmd_root, div & 0xff);
urj_tap_cable_cx_cmd_push (cmd_root, (div >> 8) & 0xff);
urj_tap_cable_cx_xfer (cmd_root, &imm_cmd, cable, URJ_TAP_CABLE_COMPLETELY);
urj_tap_cable_cx_xfer (cmd_root, &imm_cmd, cable,
URJ_TAP_CABLE_COMPLETELY);
params->mpsse_frequency = FT2232_MAX_TCK_FREQ / (div + 1);
cable->frequency = params->mpsse_frequency;
@ -283,10 +285,12 @@ ft2232_generic_init (urj_cable_t *cable)
TCK = 0, TMS = 1, TDI = 0 */
urj_tap_cable_cx_cmd_queue (cmd_root, 0);
urj_tap_cable_cx_cmd_push (cmd_root, SET_BITS_LOW);
urj_tap_cable_cx_cmd_push (cmd_root, params->low_byte_value | BITMASK_TMS);
urj_tap_cable_cx_cmd_push (cmd_root,
params->
low_byte_dir | BITMASK_TCK | BITMASK_TDI | BITMASK_TMS);
params->low_byte_value | BITMASK_TMS);
urj_tap_cable_cx_cmd_push (cmd_root,
params->
low_byte_dir | BITMASK_TCK | BITMASK_TDI |
BITMASK_TMS);
/* Set Data Bits High Byte */
params->high_byte_value = 0;
@ -325,10 +329,12 @@ ft2232_jtagkey_init (urj_cable_t *cable)
TCK = 0, TMS = 1, TDI = 0, nOE = 0 */
urj_tap_cable_cx_cmd_queue (cmd_root, 0);
urj_tap_cable_cx_cmd_push (cmd_root, SET_BITS_LOW);
urj_tap_cable_cx_cmd_push (cmd_root, params->low_byte_value | BITMASK_TMS);
urj_tap_cable_cx_cmd_push (cmd_root,
params->
low_byte_dir | BITMASK_TCK | BITMASK_TDI | BITMASK_TMS);
params->low_byte_value | BITMASK_TMS);
urj_tap_cable_cx_cmd_push (cmd_root,
params->
low_byte_dir | BITMASK_TCK | BITMASK_TDI |
BITMASK_TMS);
/* Set Data Bits High Byte
default:
@ -378,10 +384,12 @@ ft2232_armusbocd_init (urj_cable_t *cable)
TCK = 0, TMS = 1, TDI = 0, nOE = 0 */
urj_tap_cable_cx_cmd_queue (cmd_root, 0);
urj_tap_cable_cx_cmd_push (cmd_root, SET_BITS_LOW);
urj_tap_cable_cx_cmd_push (cmd_root, params->low_byte_value | BITMASK_TMS);
urj_tap_cable_cx_cmd_push (cmd_root,
params->
low_byte_dir | BITMASK_TCK | BITMASK_TDI | BITMASK_TMS);
params->low_byte_value | BITMASK_TMS);
urj_tap_cable_cx_cmd_push (cmd_root,
params->
low_byte_dir | BITMASK_TCK | BITMASK_TDI |
BITMASK_TMS);
/* Set Data Bits High Byte
default:
@ -430,10 +438,12 @@ ft2232_gnice_init (urj_cable_t *cable)
TCK = 0, TMS = 1, TDI = 0 */
urj_tap_cable_cx_cmd_queue (cmd_root, 0);
urj_tap_cable_cx_cmd_push (cmd_root, SET_BITS_LOW);
urj_tap_cable_cx_cmd_push (cmd_root, params->low_byte_value | BITMASK_TMS);
urj_tap_cable_cx_cmd_push (cmd_root,
params->
low_byte_dir | BITMASK_TCK | BITMASK_TDI | BITMASK_TMS);
params->low_byte_value | BITMASK_TMS);
urj_tap_cable_cx_cmd_push (cmd_root,
params->
low_byte_dir | BITMASK_TCK | BITMASK_TDI |
BITMASK_TMS);
/* Set Data Bits High Byte */
params->high_byte_value = BITMASK_GNICE_nTRST;
@ -474,10 +484,12 @@ ft2232_oocdlinks_init (urj_cable_t *cable)
TCK = 0, TMS = 1, TDI = 0 */
urj_tap_cable_cx_cmd_queue (cmd_root, 0);
urj_tap_cable_cx_cmd_push (cmd_root, SET_BITS_LOW);
urj_tap_cable_cx_cmd_push (cmd_root, params->low_byte_value | BITMASK_TMS);
urj_tap_cable_cx_cmd_push (cmd_root,
params->
low_byte_dir | BITMASK_TCK | BITMASK_TDI | BITMASK_TMS);
params->low_byte_value | BITMASK_TMS);
urj_tap_cable_cx_cmd_push (cmd_root,
params->
low_byte_dir | BITMASK_TCK | BITMASK_TDI |
BITMASK_TMS);
/* Set Data Bits High Byte
default:
@ -529,10 +541,12 @@ ft2232_turtelizer2_init (urj_cable_t *cable)
TCK = 0, TMS = 1, TDI = 0 */
urj_tap_cable_cx_cmd_queue (cmd_root, 0);
urj_tap_cable_cx_cmd_push (cmd_root, SET_BITS_LOW);
urj_tap_cable_cx_cmd_push (cmd_root, params->low_byte_value | BITMASK_TMS);
urj_tap_cable_cx_cmd_push (cmd_root,
params->
low_byte_dir | BITMASK_TCK | BITMASK_TDI | BITMASK_TMS);
params->low_byte_value | BITMASK_TMS);
urj_tap_cable_cx_cmd_push (cmd_root,
params->
low_byte_dir | BITMASK_TCK | BITMASK_TDI |
BITMASK_TMS);
/* Set Data Bits High Byte
default:
@ -578,10 +592,12 @@ ft2232_usbtojtagif_init (urj_cable_t *cable)
TCK = 0, TMS = 1, TDI = 0 */
urj_tap_cable_cx_cmd_queue (cmd_root, 0);
urj_tap_cable_cx_cmd_push (cmd_root, SET_BITS_LOW);
urj_tap_cable_cx_cmd_push (cmd_root, params->low_byte_value | BITMASK_TMS);
urj_tap_cable_cx_cmd_push (cmd_root,
params->
low_byte_dir | BITMASK_TCK | BITMASK_TDI | BITMASK_TMS);
params->low_byte_value | BITMASK_TMS);
urj_tap_cable_cx_cmd_push (cmd_root,
params->
low_byte_dir | BITMASK_TCK | BITMASK_TDI |
BITMASK_TMS);
/* Set Data Bits High Byte
default:
@ -629,10 +645,12 @@ ft2232_signalyzer_init (urj_cable_t *cable)
TCK = 0, TMS = 1, TDI = 0 */
urj_tap_cable_cx_cmd_queue (cmd_root, 0);
urj_tap_cable_cx_cmd_push (cmd_root, SET_BITS_LOW);
urj_tap_cable_cx_cmd_push (cmd_root, params->low_byte_value | BITMASK_TMS);
urj_tap_cable_cx_cmd_push (cmd_root,
params->
low_byte_dir | BITMASK_TCK | BITMASK_TDI | BITMASK_TMS);
params->low_byte_value | BITMASK_TMS);
urj_tap_cable_cx_cmd_push (cmd_root,
params->
low_byte_dir | BITMASK_TCK | BITMASK_TDI |
BITMASK_TMS);
/* Set Data Bits High Byte */
params->high_byte_value = 0;
@ -673,10 +691,12 @@ ft2232_flyswatter_init (urj_cable_t *cable)
TCK = 0, TMS = 1, TDI = 0 */
urj_tap_cable_cx_cmd_queue (cmd_root, 0);
urj_tap_cable_cx_cmd_push (cmd_root, SET_BITS_LOW);
urj_tap_cable_cx_cmd_push (cmd_root, params->low_byte_value | BITMASK_TMS);
urj_tap_cable_cx_cmd_push (cmd_root,
params->
low_byte_dir | BITMASK_TCK | BITMASK_TDI | BITMASK_TMS);
params->low_byte_value | BITMASK_TMS);
urj_tap_cable_cx_cmd_push (cmd_root,
params->
low_byte_dir | BITMASK_TCK | BITMASK_TDI |
BITMASK_TMS);
/* Set Data Bits High Byte */
/* Turn LED2 on */
@ -710,8 +730,10 @@ ft2232_usbscarab2_init (urj_cable_t *cable)
/* Check if cable is connected to the target and the target is powered on */
urj_tap_cable_cx_cmd_queue (cmd_root, 1);
urj_tap_cable_cx_cmd_push (cmd_root, GET_BITS_LOW);
urj_tap_cable_cx_xfer (&(params->cmd_root), &imm_cmd, cable, URJ_TAP_CABLE_COMPLETELY);
if ((urj_tap_cable_cx_xfer_recv (cable) & BITMASK_USBSCARAB2_nCONNECTED) != 0)
urj_tap_cable_cx_xfer (&(params->cmd_root), &imm_cmd, cable,
URJ_TAP_CABLE_COMPLETELY);
if ((urj_tap_cable_cx_xfer_recv (cable) & BITMASK_USBSCARAB2_nCONNECTED)
!= 0)
{
printf (_
("Error: Please power on the TARGET board and connect VCC signal!\n"));
@ -726,10 +748,12 @@ ft2232_usbscarab2_init (urj_cable_t *cable)
TCK = 0, TMS = 1, TDI = 0 */
urj_tap_cable_cx_cmd_queue (cmd_root, 0);
urj_tap_cable_cx_cmd_push (cmd_root, SET_BITS_LOW);
urj_tap_cable_cx_cmd_push (cmd_root, params->low_byte_value | BITMASK_TMS);
urj_tap_cable_cx_cmd_push (cmd_root,
params->
low_byte_dir | BITMASK_TCK | BITMASK_TDI | BITMASK_TMS);
params->low_byte_value | BITMASK_TMS);
urj_tap_cable_cx_cmd_push (cmd_root,
params->
low_byte_dir | BITMASK_TCK | BITMASK_TDI |
BITMASK_TMS);
/* Set Data Bits High Byte */
/* nLED=0 */
@ -772,7 +796,8 @@ ft2232_generic_done (urj_cable_t *cable)
urj_tap_cable_cx_cmd_push (cmd_root, SET_BITS_HIGH);
urj_tap_cable_cx_cmd_push (cmd_root, 0);
urj_tap_cable_cx_cmd_push (cmd_root, 0);
urj_tap_cable_cx_xfer (cmd_root, &imm_cmd, cable, URJ_TAP_CABLE_COMPLETELY);
urj_tap_cable_cx_xfer (cmd_root, &imm_cmd, cable,
URJ_TAP_CABLE_COMPLETELY);
urj_tap_cable_generic_usbconn_done (cable);
}
@ -801,23 +826,27 @@ ft2232_jtagkey_done (urj_cable_t *cable)
disable output drivers */
urj_tap_cable_cx_cmd_push (cmd_root, SET_BITS_HIGH);
urj_tap_cable_cx_cmd_push (cmd_root,
BITMASK_JTAGKEY_TRST_N_OUT
| BITMASK_JTAGKEY_TRST_N_OE_N
| BITMASK_JTAGKEY_SRST_N_OUT | BITMASK_JTAGKEY_SRST_N_OE_N);
BITMASK_JTAGKEY_TRST_N_OUT
| BITMASK_JTAGKEY_TRST_N_OE_N
| BITMASK_JTAGKEY_SRST_N_OUT |
BITMASK_JTAGKEY_SRST_N_OE_N);
urj_tap_cable_cx_cmd_push (cmd_root,
BITMASK_JTAGKEY_TRST_N_OUT
| BITMASK_JTAGKEY_TRST_N_OE_N
| BITMASK_JTAGKEY_SRST_N_OUT | BITMASK_JTAGKEY_SRST_N_OE_N);
BITMASK_JTAGKEY_TRST_N_OUT |
BITMASK_JTAGKEY_TRST_N_OE_N |
BITMASK_JTAGKEY_SRST_N_OUT |
BITMASK_JTAGKEY_SRST_N_OE_N);
/* Set Data Bits High Byte
set all to input */
urj_tap_cable_cx_cmd_push (cmd_root, SET_BITS_HIGH);
urj_tap_cable_cx_cmd_push (cmd_root,
BITMASK_JTAGKEY_TRST_N_OUT
| BITMASK_JTAGKEY_TRST_N_OE_N
| BITMASK_JTAGKEY_SRST_N_OUT | BITMASK_JTAGKEY_SRST_N_OE_N);
BITMASK_JTAGKEY_TRST_N_OUT
| BITMASK_JTAGKEY_TRST_N_OE_N
| BITMASK_JTAGKEY_SRST_N_OUT |
BITMASK_JTAGKEY_SRST_N_OE_N);
urj_tap_cable_cx_cmd_push (cmd_root, 0);
urj_tap_cable_cx_xfer (cmd_root, &imm_cmd, cable, URJ_TAP_CABLE_COMPLETELY);
urj_tap_cable_cx_xfer (cmd_root, &imm_cmd, cable,
URJ_TAP_CABLE_COMPLETELY);
urj_tap_cable_generic_usbconn_done (cable);
}
@ -846,21 +875,25 @@ ft2232_armusbocd_done (urj_cable_t *cable)
disable output drivers */
urj_tap_cable_cx_cmd_push (cmd_root, SET_BITS_HIGH);
urj_tap_cable_cx_cmd_push (cmd_root,
BITMASK_ARMUSBOCD_nTRST
| BITMASK_ARMUSBOCD_nTRST_nOE | BITMASK_ARMUSBOCD_nTSRST);
BITMASK_ARMUSBOCD_nTRST
| BITMASK_ARMUSBOCD_nTRST_nOE |
BITMASK_ARMUSBOCD_nTSRST);
urj_tap_cable_cx_cmd_push (cmd_root,
BITMASK_ARMUSBOCD_nTRST
| BITMASK_ARMUSBOCD_nTRST_nOE
| BITMASK_ARMUSBOCD_nTSRST | BITMASK_ARMUSBOCD_RED_LED);
BITMASK_ARMUSBOCD_nTRST |
BITMASK_ARMUSBOCD_nTRST_nOE |
BITMASK_ARMUSBOCD_nTSRST |
BITMASK_ARMUSBOCD_RED_LED);
/* Set Data Bits High Byte
set all to input */
urj_tap_cable_cx_cmd_push (cmd_root, SET_BITS_HIGH);
urj_tap_cable_cx_cmd_push (cmd_root,
BITMASK_ARMUSBOCD_nTRST
| BITMASK_ARMUSBOCD_nTRST_nOE | BITMASK_ARMUSBOCD_nTSRST);
BITMASK_ARMUSBOCD_nTRST
| BITMASK_ARMUSBOCD_nTRST_nOE |
BITMASK_ARMUSBOCD_nTSRST);
urj_tap_cable_cx_cmd_push (cmd_root, 0);
urj_tap_cable_cx_xfer (cmd_root, &imm_cmd, cable, URJ_TAP_CABLE_COMPLETELY);
urj_tap_cable_cx_xfer (cmd_root, &imm_cmd, cable,
URJ_TAP_CABLE_COMPLETELY);
urj_tap_cable_generic_usbconn_done (cable);
}
@ -882,14 +915,16 @@ ft2232_gnice_done (urj_cable_t *cable)
disable output drivers */
urj_tap_cable_cx_cmd_push (cmd_root, SET_BITS_HIGH);
urj_tap_cable_cx_cmd_push (cmd_root, BITMASK_GNICE_nTRST);
urj_tap_cable_cx_cmd_push (cmd_root, BITMASK_GNICE_nTRST | BITMASK_GNICE_nLED);
urj_tap_cable_cx_cmd_push (cmd_root,
BITMASK_GNICE_nTRST | BITMASK_GNICE_nLED);
/* Set Data Bits High Byte
set all to input */
urj_tap_cable_cx_cmd_push (cmd_root, SET_BITS_HIGH);
urj_tap_cable_cx_cmd_push (cmd_root, BITMASK_GNICE_nTRST);
urj_tap_cable_cx_cmd_push (cmd_root, 0);
urj_tap_cable_cx_xfer (cmd_root, &imm_cmd, cable, URJ_TAP_CABLE_COMPLETELY);
urj_tap_cable_cx_xfer (cmd_root, &imm_cmd, cable,
URJ_TAP_CABLE_COMPLETELY);
urj_tap_cable_generic_usbconn_done (cable);
}
@ -911,23 +946,27 @@ ft2232_oocdlinks_done (urj_cable_t *cable)
disable output drivers */
urj_tap_cable_cx_cmd_push (cmd_root, SET_BITS_HIGH);
urj_tap_cable_cx_cmd_push (cmd_root,
BITMASK_OOCDLINKS_nTRST
| BITMASK_OOCDLINKS_nTRST_nOE
| BITMASK_OOCDLINKS_nSRST | BITMASK_OOCDLINKS_nSRST_nOE);
BITMASK_OOCDLINKS_nTRST
| BITMASK_OOCDLINKS_nTRST_nOE
| BITMASK_OOCDLINKS_nSRST |
BITMASK_OOCDLINKS_nSRST_nOE);
urj_tap_cable_cx_cmd_push (cmd_root,
BITMASK_OOCDLINKS_nTRST
| BITMASK_OOCDLINKS_nTRST_nOE
| BITMASK_OOCDLINKS_nSRST | BITMASK_OOCDLINKS_nSRST_nOE);
BITMASK_OOCDLINKS_nTRST |
BITMASK_OOCDLINKS_nTRST_nOE |
BITMASK_OOCDLINKS_nSRST |
BITMASK_OOCDLINKS_nSRST_nOE);
/* Set Data Bits High Byte
set all to input */
urj_tap_cable_cx_cmd_push (cmd_root, SET_BITS_HIGH);
urj_tap_cable_cx_cmd_push (cmd_root,
BITMASK_OOCDLINKS_nTRST
| BITMASK_OOCDLINKS_nTRST_nOE
| BITMASK_OOCDLINKS_nSRST | BITMASK_OOCDLINKS_nSRST_nOE);
BITMASK_OOCDLINKS_nTRST
| BITMASK_OOCDLINKS_nTRST_nOE
| BITMASK_OOCDLINKS_nSRST |
BITMASK_OOCDLINKS_nSRST_nOE);
urj_tap_cable_cx_cmd_push (cmd_root, 0);
urj_tap_cable_cx_xfer (cmd_root, &imm_cmd, cable, URJ_TAP_CABLE_COMPLETELY);
urj_tap_cable_cx_xfer (cmd_root, &imm_cmd, cable,
URJ_TAP_CABLE_COMPLETELY);
urj_tap_cable_generic_usbconn_done (cable);
}
@ -956,16 +995,19 @@ ft2232_turtelizer2_done (urj_cable_t *cable)
switch off LEDs */
urj_tap_cable_cx_cmd_push (cmd_root, SET_BITS_HIGH);
urj_tap_cable_cx_cmd_push (cmd_root,
BITMASK_TURTELIZER2_nTX1LED | BITMASK_TURTELIZER2_nRX1LED);
BITMASK_TURTELIZER2_nTX1LED |
BITMASK_TURTELIZER2_nRX1LED);
urj_tap_cable_cx_cmd_push (cmd_root,
BITMASK_TURTELIZER2_nTX1LED | BITMASK_TURTELIZER2_nRX1LED);
BITMASK_TURTELIZER2_nTX1LED |
BITMASK_TURTELIZER2_nRX1LED);
/* Set Data Bits High Byte
set all to input */
urj_tap_cable_cx_cmd_push (cmd_root, SET_BITS_HIGH);
urj_tap_cable_cx_cmd_push (cmd_root, 0);
urj_tap_cable_cx_cmd_push (cmd_root, 0);
urj_tap_cable_cx_xfer (cmd_root, &imm_cmd, cable, URJ_TAP_CABLE_COMPLETELY);
urj_tap_cable_cx_xfer (cmd_root, &imm_cmd, cable,
URJ_TAP_CABLE_COMPLETELY);
urj_tap_cable_generic_usbconn_done (cable);
}
@ -982,24 +1024,29 @@ ft2232_usbtojtagif_done (urj_cable_t *cable)
urj_tap_cable_cx_cmd_queue (cmd_root, 0);
urj_tap_cable_cx_cmd_push (cmd_root, SET_BITS_LOW);
urj_tap_cable_cx_cmd_push (cmd_root,
BITMASK_USBTOJTAGIF_nTRST | BITMASK_USBTOJTAGIF_RST);
BITMASK_USBTOJTAGIF_nTRST |
BITMASK_USBTOJTAGIF_RST);
urj_tap_cable_cx_cmd_push (cmd_root, 0);
/* Set Data Bits High Byte
disable output drivers */
urj_tap_cable_cx_cmd_push (cmd_root, SET_BITS_HIGH);
urj_tap_cable_cx_cmd_push (cmd_root,
BITMASK_USBTOJTAGIF_nRxLED | BITMASK_USBTOJTAGIF_nTxLED);
BITMASK_USBTOJTAGIF_nRxLED |
BITMASK_USBTOJTAGIF_nTxLED);
urj_tap_cable_cx_cmd_push (cmd_root,
BITMASK_USBTOJTAGIF_nRxLED | BITMASK_USBTOJTAGIF_nTxLED);
BITMASK_USBTOJTAGIF_nRxLED |
BITMASK_USBTOJTAGIF_nTxLED);
/* Set Data Bits High Byte
set all to input */
urj_tap_cable_cx_cmd_push (cmd_root, SET_BITS_HIGH);
urj_tap_cable_cx_cmd_push (cmd_root,
BITMASK_USBTOJTAGIF_nRxLED | BITMASK_USBTOJTAGIF_nTxLED);
BITMASK_USBTOJTAGIF_nRxLED |
BITMASK_USBTOJTAGIF_nTxLED);
urj_tap_cable_cx_cmd_push (cmd_root, 0);
urj_tap_cable_cx_xfer (cmd_root, &imm_cmd, cable, URJ_TAP_CABLE_COMPLETELY);
urj_tap_cable_cx_xfer (cmd_root, &imm_cmd, cable,
URJ_TAP_CABLE_COMPLETELY);
urj_tap_cable_generic_usbconn_done (cable);
}
@ -1016,23 +1063,27 @@ ft2232_signalyzer_done (urj_cable_t *cable)
urj_tap_cable_cx_cmd_queue (cmd_root, 0);
urj_tap_cable_cx_cmd_push (cmd_root, SET_BITS_LOW);
urj_tap_cable_cx_cmd_push (cmd_root,
BITMASK_SIGNALYZER_nTRST | BITMASK_SIGNALYZER_nSRST);
BITMASK_SIGNALYZER_nTRST |
BITMASK_SIGNALYZER_nSRST);
urj_tap_cable_cx_cmd_push (cmd_root, 0);
/* Set Data Bits High Byte
disable output drivers */
urj_tap_cable_cx_cmd_push (cmd_root, SET_BITS_HIGH);
urj_tap_cable_cx_cmd_push (cmd_root,
BITMASK_SIGNALYZER_nTRST | BITMASK_SIGNALYZER_nSRST);
BITMASK_SIGNALYZER_nTRST |
BITMASK_SIGNALYZER_nSRST);
urj_tap_cable_cx_cmd_push (cmd_root,
BITMASK_SIGNALYZER_nTRST | BITMASK_SIGNALYZER_nSRST);
BITMASK_SIGNALYZER_nTRST |
BITMASK_SIGNALYZER_nSRST);
/* Set Data Bits High Byte
set all to input */
urj_tap_cable_cx_cmd_push (cmd_root, SET_BITS_HIGH);
urj_tap_cable_cx_cmd_push (cmd_root, 0);
urj_tap_cable_cx_cmd_push (cmd_root, 0);
urj_tap_cable_cx_xfer (cmd_root, &imm_cmd, cable, URJ_TAP_CABLE_COMPLETELY);
urj_tap_cable_cx_xfer (cmd_root, &imm_cmd, cable,
URJ_TAP_CABLE_COMPLETELY);
urj_tap_cable_generic_usbconn_done (cable);
}
@ -1048,13 +1099,19 @@ ft2232_flyswatter_done (urj_cable_t *cable)
disable output drivers */
urj_tap_cable_cx_cmd_queue (cmd_root, 0);
urj_tap_cable_cx_cmd_push (cmd_root, SET_BITS_LOW);
urj_tap_cable_cx_cmd_push (cmd_root, BITMASK_FLYSWATTER_nOE1 | BITMASK_FLYSWATTER_nOE2);
urj_tap_cable_cx_cmd_push (cmd_root, BITMASK_FLYSWATTER_nOE1 | BITMASK_FLYSWATTER_nOE2);
urj_tap_cable_cx_cmd_push (cmd_root,
BITMASK_FLYSWATTER_nOE1 |
BITMASK_FLYSWATTER_nOE2);
urj_tap_cable_cx_cmd_push (cmd_root,
BITMASK_FLYSWATTER_nOE1 |
BITMASK_FLYSWATTER_nOE2);
/* Set Data Bits Low Byte
set all to input */
urj_tap_cable_cx_cmd_push (cmd_root, SET_BITS_LOW);
urj_tap_cable_cx_cmd_push (cmd_root, BITMASK_FLYSWATTER_nOE1 | BITMASK_FLYSWATTER_nOE2);
urj_tap_cable_cx_cmd_push (cmd_root,
BITMASK_FLYSWATTER_nOE1 |
BITMASK_FLYSWATTER_nOE2);
urj_tap_cable_cx_cmd_push (cmd_root, 0);
/* Set Data Bits High Byte
@ -1062,7 +1119,8 @@ ft2232_flyswatter_done (urj_cable_t *cable)
urj_tap_cable_cx_cmd_push (cmd_root, SET_BITS_HIGH);
urj_tap_cable_cx_cmd_push (cmd_root, BITMASK_FLYSWATTER_nLED2);
urj_tap_cable_cx_cmd_push (cmd_root, 0);
urj_tap_cable_cx_xfer (cmd_root, &imm_cmd, cable, URJ_TAP_CABLE_COMPLETELY);
urj_tap_cable_cx_xfer (cmd_root, &imm_cmd, cable,
URJ_TAP_CABLE_COMPLETELY);
urj_tap_cable_generic_usbconn_done (cable);
}
@ -1086,7 +1144,8 @@ ft2232_usbscarab2_done (urj_cable_t *cable)
urj_tap_cable_cx_cmd_push (cmd_root, 0);
urj_tap_cable_cx_cmd_push (cmd_root, 0);
urj_tap_cable_cx_xfer (cmd_root, &imm_cmd, cable, URJ_TAP_CABLE_COMPLETELY);
urj_tap_cable_cx_xfer (cmd_root, &imm_cmd, cable,
URJ_TAP_CABLE_COMPLETELY);
urj_tap_cable_generic_usbconn_done (cable);
}
@ -1104,18 +1163,21 @@ ft2232_clock_schedule (urj_cable_t *cable, int tms, int tdi, int n)
urj_tap_cable_cx_cmd_queue (cmd_root, 0);
while (n > 0)
{
if (urj_tap_cable_cx_cmd_space (cmd_root, URJ_USBCONN_FTDX_MAXSEND_MPSSE) < 4)
if (urj_tap_cable_cx_cmd_space
(cmd_root, URJ_USBCONN_FTDX_MAXSEND_MPSSE) < 4)
{
/* no space left for Clock Data plus Send Immediate
transfer queued commands to device and read receive data
to internal buffer */
urj_tap_cable_cx_xfer (cmd_root, &imm_cmd, cable, URJ_TAP_CABLE_COMPLETELY);
urj_tap_cable_cx_xfer (cmd_root, &imm_cmd, cable,
URJ_TAP_CABLE_COMPLETELY);
urj_tap_cable_cx_cmd_queue (cmd_root, 0);
}
/* Clock Data to TMS/CS Pin (no Read) */
urj_tap_cable_cx_cmd_push (cmd_root, MPSSE_WRITE_TMS |
MPSSE_LSB | MPSSE_BITMODE | MPSSE_WRITE_NEG);
MPSSE_LSB | MPSSE_BITMODE |
MPSSE_WRITE_NEG);
if (n <= 7)
{
urj_tap_cable_cx_cmd_push (cmd_root, n - 1);
@ -1144,7 +1206,8 @@ ft2232_clock (urj_cable_t *cable, int tms, int tdi, int n)
params_t *params = (params_t *) cable->params;
ft2232_clock_schedule (cable, tms, tdi, n);
urj_tap_cable_cx_xfer (&(params->cmd_root), &imm_cmd, cable, URJ_TAP_CABLE_COMPLETELY);
urj_tap_cable_cx_xfer (&(params->cmd_root), &imm_cmd, cable,
URJ_TAP_CABLE_COMPLETELY);
params->last_tdo_valid = 0;
}
@ -1182,7 +1245,8 @@ ft2232_get_tdo (urj_cable_t *cable)
params_t *params = (params_t *) cable->params;
ft2232_get_tdo_schedule (cable);
urj_tap_cable_cx_xfer (&(params->cmd_root), &imm_cmd, cable, URJ_TAP_CABLE_COMPLETELY);
urj_tap_cable_cx_xfer (&(params->cmd_root), &imm_cmd, cable,
URJ_TAP_CABLE_COMPLETELY);
return ft2232_get_tdo_finish (cable);
}
@ -1194,7 +1258,9 @@ ft2232_set_signal_schedule (params_t *params, int mask, int val,
urj_tap_cable_cmd_xfer_cx_cmd_root_t *cmd_root = &(params->cmd_root);
/* filter for supported signals */
mask &= URJ_POD_CS_TCK | URJ_POD_CS_TDI | URJ_POD_CS_TMS | URJ_POD_CS_TRST | URJ_POD_CS_RESET;
mask &=
URJ_POD_CS_TCK | URJ_POD_CS_TDI | URJ_POD_CS_TMS | URJ_POD_CS_TRST |
URJ_POD_CS_RESET;
if (mask != 0)
{
int sigs = (params->signals & ~mask) | (val & mask);
@ -1241,18 +1307,20 @@ ft2232_set_signal_schedule (params_t *params, int mask, int val,
urj_tap_cable_cx_cmd_queue (cmd_root, 0);
urj_tap_cable_cx_cmd_push (cmd_root, SET_BITS_LOW);
urj_tap_cable_cx_cmd_push (cmd_root,
(params->low_byte_value | low_or) ^ low_xor);
(params->
low_byte_value | low_or) ^ low_xor);
urj_tap_cable_cx_cmd_push (cmd_root,
params->
low_byte_dir | BITMASK_TCK | BITMASK_TDI |
BITMASK_TMS);
params->
low_byte_dir | BITMASK_TCK |
BITMASK_TDI | BITMASK_TMS);
}
if (set_high)
{
urj_tap_cable_cx_cmd_queue (cmd_root, 0);
urj_tap_cable_cx_cmd_push (cmd_root, SET_BITS_HIGH);
urj_tap_cable_cx_cmd_push (cmd_root, params->high_byte_value ^ high_xor);
urj_tap_cable_cx_cmd_push (cmd_root,
params->high_byte_value ^ high_xor);
urj_tap_cable_cx_cmd_push (cmd_root, params->high_byte_dir);
}
@ -1269,7 +1337,8 @@ ft2232_set_signal (urj_cable_t *cable, int mask, int val)
int prev_sigs = params->signals;
ft2232_set_signal_schedule (params, mask, val, 1, 1);
urj_tap_cable_cx_xfer (&(params->cmd_root), &imm_cmd, cable, URJ_TAP_CABLE_COMPLETELY);
urj_tap_cable_cx_xfer (&(params->cmd_root), &imm_cmd, cable,
URJ_TAP_CABLE_COMPLETELY);
params->last_tdo_valid = 0;
return prev_sigs;
@ -1287,7 +1356,8 @@ ft2232_transfer_schedule (urj_cable_t *cable, int len, char *in, char *out)
/* lower TMS for transfer
also lower TCK to ensure correct clocking */
ft2232_set_signal_schedule (params, URJ_POD_CS_TCK | URJ_POD_CS_TMS, 0, 1, 0);
ft2232_set_signal_schedule (params, URJ_POD_CS_TCK | URJ_POD_CS_TMS, 0, 1,
0);
chunkbytes = len >> 3;
while (chunkbytes > 0)
@ -1316,15 +1386,16 @@ ft2232_transfer_schedule (urj_cable_t *cable, int len, char *in, char *out)
urj_tap_cable_cx_cmd_queue (cmd_root, chunkbytes);
/* Clock Data Bytes In and Out LSB First
out on negative edge, in on positive edge */
urj_tap_cable_cx_cmd_push (cmd_root, MPSSE_DO_READ | MPSSE_DO_WRITE |
MPSSE_LSB | MPSSE_WRITE_NEG);
urj_tap_cable_cx_cmd_push (cmd_root,
MPSSE_DO_READ | MPSSE_DO_WRITE |
MPSSE_LSB | MPSSE_WRITE_NEG);
}
else
{
urj_tap_cable_cx_cmd_queue (cmd_root, 0);
/* Clock Data Bytes Out on -ve Clock Edge LSB First (no Read) */
urj_tap_cable_cx_cmd_push (cmd_root, MPSSE_DO_WRITE |
MPSSE_LSB | MPSSE_WRITE_NEG);
MPSSE_LSB | MPSSE_WRITE_NEG);
}
/* set byte count */
urj_tap_cable_cx_cmd_push (cmd_root, (chunkbytes - 1) & 0xff);
@ -1363,15 +1434,18 @@ ft2232_transfer_schedule (urj_cable_t *cable, int len, char *in, char *out)
urj_tap_cable_cx_cmd_queue (cmd_root, 1);
/* Clock Data Bytes In and Out LSB First
out on negative edge, in on positive edge */
urj_tap_cable_cx_cmd_push (cmd_root, MPSSE_DO_READ | MPSSE_DO_WRITE |
MPSSE_LSB | MPSSE_BITMODE | MPSSE_WRITE_NEG);
urj_tap_cable_cx_cmd_push (cmd_root,
MPSSE_DO_READ | MPSSE_DO_WRITE |
MPSSE_LSB | MPSSE_BITMODE |
MPSSE_WRITE_NEG);
}
else
{
urj_tap_cable_cx_cmd_queue (cmd_root, 0);
/* Clock Data Bytes Out on -ve Clock Edge LSB First (no Read) */
urj_tap_cable_cx_cmd_push (cmd_root, MPSSE_DO_WRITE |
MPSSE_LSB | MPSSE_BITMODE | MPSSE_WRITE_NEG);
MPSSE_LSB | MPSSE_BITMODE |
MPSSE_WRITE_NEG);
}
/* determine bit count */
urj_tap_cable_cx_cmd_push (cmd_root, bitwise_len - 1);
@ -1455,7 +1529,8 @@ ft2232_transfer_finish (urj_cable_t *cable, int len, char *out)
}
/* gather current TDO */
params->last_tdo = (urj_tap_cable_cx_xfer_recv (cable) & BITMASK_TDO) ? 1 : 0;
params->last_tdo =
(urj_tap_cable_cx_xfer_recv (cable) & BITMASK_TDO) ? 1 : 0;
params->last_tdo_valid = 1;
}
else
@ -1471,7 +1546,8 @@ ft2232_transfer (urj_cable_t *cable, int len, char *in, char *out)
params_t *params = (params_t *) cable->params;
ft2232_transfer_schedule (cable, len, in, out);
urj_tap_cable_cx_xfer (&(params->cmd_root), &imm_cmd, cable, URJ_TAP_CABLE_COMPLETELY);
urj_tap_cable_cx_xfer (&(params->cmd_root), &imm_cmd, cable,
URJ_TAP_CABLE_COMPLETELY);
return ft2232_transfer_finish (cable, len, out);
}
@ -1485,7 +1561,8 @@ ft2232_flush (urj_cable_t *cable, urj_cable_flush_amount_t how_much)
return;
if (cable->todo.num_items == 0)
urj_tap_cable_cx_xfer (&(params->cmd_root), &imm_cmd, cable, how_much);
urj_tap_cable_cx_xfer (&(params->cmd_root), &imm_cmd, cable,
how_much);
while (cable->todo.num_items > 0)
{
@ -1544,7 +1621,8 @@ ft2232_flush (urj_cable_t *cable, urj_cable_flush_amount_t how_much)
i = 0;
}
urj_tap_cable_cx_xfer (&(params->cmd_root), &imm_cmd, cable, how_much);
urj_tap_cable_cx_xfer (&(params->cmd_root), &imm_cmd, cable,
how_much);
while (j != i)
{
@ -1552,11 +1630,14 @@ ft2232_flush (urj_cable_t *cable, urj_cable_flush_amount_t how_much)
{
case URJ_TAP_CABLE_CLOCK:
{
post_signals &= ~(URJ_POD_CS_TCK | URJ_POD_CS_TDI | URJ_POD_CS_TMS);
post_signals &=
~(URJ_POD_CS_TCK | URJ_POD_CS_TDI | URJ_POD_CS_TMS);
post_signals |=
(cable->todo.data[j].arg.clock.tms ? URJ_POD_CS_TMS : 0);
(cable->todo.data[j].arg.clock.
tms ? URJ_POD_CS_TMS : 0);
post_signals |=
(cable->todo.data[j].arg.clock.tdi ? URJ_POD_CS_TDI : 0);
(cable->todo.data[j].arg.clock.
tdi ? URJ_POD_CS_TDI : 0);
params->last_tdo_valid = last_tdo_valid_finish = 0;
break;
}
@ -1576,14 +1657,16 @@ ft2232_flush (urj_cable_t *cable, urj_cable_flush_amount_t how_much)
}
case URJ_TAP_CABLE_SET_SIGNAL:
{
int m = urj_tap_cable_add_queue_item (cable, &(cable->done));
int m =
urj_tap_cable_add_queue_item (cable, &(cable->done));
cable->done.data[m].action = URJ_TAP_CABLE_SET_SIGNAL;
cable->done.data[m].arg.value.mask =
cable->todo.data[j].arg.value.mask;
cable->done.data[m].arg.value.val = post_signals;
int mask =
cable->todo.data[j].arg.value.
mask & ~(URJ_POD_CS_TCK | URJ_POD_CS_TDI | URJ_POD_CS_TMS | URJ_POD_CS_TRST |
mask & ~(URJ_POD_CS_TCK | URJ_POD_CS_TDI |
URJ_POD_CS_TMS | URJ_POD_CS_TRST |
URJ_POD_CS_RESET);
post_signals =
(post_signals & ~mask) | (cable->todo.data[j].arg.
@ -1591,7 +1674,8 @@ ft2232_flush (urj_cable_t *cable, urj_cable_flush_amount_t how_much)
}
case URJ_TAP_CABLE_GET_SIGNAL:
{
int m = urj_tap_cable_add_queue_item (cable, &(cable->done));
int m =
urj_tap_cable_add_queue_item (cable, &(cable->done));
cable->done.data[m].action = URJ_TAP_CABLE_GET_SIGNAL;
cable->done.data[m].arg.value.sig =
cable->todo.data[j].arg.value.sig;
@ -1611,7 +1695,8 @@ ft2232_flush (urj_cable_t *cable, urj_cable_flush_amount_t how_much)
free (cable->todo.data[j].arg.transfer.in);
if (cable->todo.data[j].arg.transfer.out)
{
int m = urj_tap_cable_add_queue_item (cable, &(cable->done));
int m = urj_tap_cable_add_queue_item (cable,
&(cable->done));
if (m < 0)
printf ("out of memory!\n");
cable->done.data[m].action = URJ_TAP_CABLE_TRANSFER;

@ -66,7 +66,8 @@ urj_tap_cable_generic_disconnect (urj_cable_t *cable)
}
int
urj_tap_cable_generic_transfer (urj_cable_t *cable, int len, char *in, char *out)
urj_tap_cable_generic_transfer (urj_cable_t *cable, int len, char *in,
char *out)
{
int i;
@ -125,8 +126,8 @@ do_one_queued_action (urj_cable_t *cable)
break;
case URJ_TAP_CABLE_SET_SIGNAL:
urj_tap_cable_set_signal (cable,
cable->todo.data[i].arg.value.sig,
cable->todo.data[i].arg.value.val);
cable->todo.data[i].arg.value.sig,
cable->todo.data[i].arg.value.val);
break;
case URJ_TAP_CABLE_TRANSFER:
{
@ -193,7 +194,8 @@ do_one_queued_action (urj_cable_t *cable)
}
void
urj_tap_cable_generic_flush_one_by_one (urj_cable_t *cable, urj_cable_flush_amount_t how_much)
urj_tap_cable_generic_flush_one_by_one (urj_cable_t *cable,
urj_cable_flush_amount_t how_much)
{
/* This will flush always, even if how_much == URJ_TAP_CABLE_OPTIONALLY,
* because there is no reason to let the queue grow */
@ -202,7 +204,8 @@ urj_tap_cable_generic_flush_one_by_one (urj_cable_t *cable, urj_cable_flush_amou
}
void
urj_tap_cable_generic_flush_using_transfer (urj_cable_t *cable, urj_cable_flush_amount_t how_much)
urj_tap_cable_generic_flush_using_transfer (urj_cable_t *cable,
urj_cable_flush_amount_t how_much)
{
int i, j, n;
char *in, *out;
@ -344,7 +347,8 @@ urj_tap_cable_generic_flush_using_transfer (urj_cable_t *cable, urj_cable_flush_
}
else if (cable->todo.data[i].action == URJ_TAP_CABLE_GET_TDO)
{
int c = urj_tap_cable_add_queue_item (cable, &(cable->done));
int c =
urj_tap_cable_add_queue_item (cable, &(cable->done));
#ifdef VERBOSE
printf ("add result from transfer to %p.%d\n",
&(cable->done), c);
@ -359,7 +363,8 @@ urj_tap_cable_generic_flush_using_transfer (urj_cable_t *cable, urj_cable_flush_
free (cable->todo.data[i].arg.transfer.in);
if (p != NULL)
{
int c = urj_tap_cable_add_queue_item (cable, &(cable->done));
int c = urj_tap_cable_add_queue_item (cable,
&(cable->done));
#ifdef VERBOSE
printf ("add result from transfer to %p.%d\n",
&(cable->done), c);
@ -392,7 +397,8 @@ urj_tap_cable_generic_flush_using_transfer (urj_cable_t *cable, urj_cable_flush_
}
void
urj_tap_cable_generic_set_frequency (urj_cable_t *cable, uint32_t new_frequency)
urj_tap_cable_generic_set_frequency (urj_cable_t *cable,
uint32_t new_frequency)
{
if (new_frequency == 0)
{

@ -36,10 +36,15 @@ typedef struct
#define PARAM_SIGNALS(cable) ((urj_tap_cable_generic_params_t *) (cable)->params)->signals
void urj_tap_cable_generic_disconnect (urj_cable_t *cable);
void urj_tap_cable_generic_set_frequency (urj_cable_t *cable, uint32_t new_freq);
int urj_tap_cable_generic_transfer (urj_cable_t *cable, int len, char *in, char *out);
int urj_tap_cable_generic_get_signal (urj_cable_t *cable, urj_pod_sigsel_t sig);
void urj_tap_cable_generic_flush_one_by_one (urj_cable_t *cable, urj_cable_flush_amount_t hm);
void urj_tap_cable_generic_flush_using_transfer (urj_cable_t *cable, urj_cable_flush_amount_t hm);
void urj_tap_cable_generic_set_frequency (urj_cable_t *cable,
uint32_t new_freq);
int urj_tap_cable_generic_transfer (urj_cable_t *cable, int len, char *in,
char *out);
int urj_tap_cable_generic_get_signal (urj_cable_t *cable,
urj_pod_sigsel_t sig);
void urj_tap_cable_generic_flush_one_by_one (urj_cable_t *cable,
urj_cable_flush_amount_t hm);
void urj_tap_cable_generic_flush_using_transfer (urj_cable_t *cable,
urj_cable_flush_amount_t hm);
#endif /* URJ_TAP_CABLE_GENERIC_H */

@ -28,7 +28,8 @@
#include "cable.h"
#include "parport.h"
int urj_tap_cable_generic_parport_connect (char *params[], urj_cable_t *cable);
int urj_tap_cable_generic_parport_connect (char *params[],
urj_cable_t *cable);
void urj_tap_cable_generic_parport_free (urj_cable_t *cable);
void urj_tap_cable_generic_parport_done (urj_cable_t *cable);
void urj_tap_cable_generic_parport_help (const char *name);

@ -28,7 +28,8 @@
#include "cable.h"
#include "usbconn.h"
int urj_tap_cable_generic_usbconn_connect (char *params[], urj_cable_t *cable);
int urj_tap_cable_generic_usbconn_connect (char *params[],
urj_cable_t *cable);
void urj_tap_cable_generic_usbconn_done (urj_cable_t *cable);
void urj_tap_cable_generic_usbconn_help (const char *name);
void urj_tap_cable_generic_usbconn_free (urj_cable_t *cable);

@ -96,8 +96,10 @@ jlink_usbconn_data_t;
#define JLINK_MAX_SPEED 12000
/* Queue command functions */
static void urj_tap_cable_jlink_reset (urj_usbconn_libusb_param_t *params, int trst, int srst);
static void jlink_simple_command (urj_usbconn_libusb_param_t *params, uint8_t command);
static void urj_tap_cable_jlink_reset (urj_usbconn_libusb_param_t *params,
int trst, int srst);
static void jlink_simple_command (urj_usbconn_libusb_param_t *params,
uint8_t command);
/* J-Link tap buffer functions */
@ -114,13 +116,15 @@ static void jlink_debug_buffer (char *buffer, int length);
/* API functions */
void urj_tap_cable_jlink_set_frequency (urj_cable_t *cable, uint32_t frequency);
void urj_tap_cable_jlink_set_frequency (urj_cable_t *cable,
uint32_t frequency);
/***************************************************************************/
/* J-Link tap functions */
void
urj_tap_cable_jlink_reset (urj_usbconn_libusb_param_t *params, int trst, int srst)
urj_tap_cable_jlink_reset (urj_usbconn_libusb_param_t *params, int trst,
int srst)
{
DEBUG ("trst: %i, srst: %i\n", trst, srst);
@ -293,7 +297,8 @@ jlink_tap_execute (urj_usbconn_libusb_param_t *params)
/* Send a message and receive the reply. */
static int
jlink_usb_message (urj_usbconn_libusb_param_t *params, int out_length, int in_length)
jlink_usb_message (urj_usbconn_libusb_param_t *params, int out_length,
int in_length)
{
int result;

@ -86,10 +86,10 @@ keithkoep_clock (urj_cable_t *cable, int tms, int tdi, int n)
for (i = 0; i < n; i++)
{
urj_tap_parport_set_data (cable->link.port,
(0 << TCK) | (tms << TMS) | (tdi << TDI));
(0 << TCK) | (tms << TMS) | (tdi << TDI));
urj_tap_cable_wait (cable);
urj_tap_parport_set_data (cable->link.port,
(1 << TCK) | (tms << TMS) | (tdi << TDI));
(1 << TCK) | (tms << TMS) | (tdi << TDI));
urj_tap_cable_wait (cable);
}
@ -103,7 +103,8 @@ static int
keithkoep_get_tdo (urj_cable_t *cable)
{
urj_tap_parport_set_data (cable->link.port, 0 << TCK);
PARAM_SIGNALS (cable) &= ~(URJ_POD_CS_TDI | URJ_POD_CS_TCK | URJ_POD_CS_TMS);
PARAM_SIGNALS (cable) &=
~(URJ_POD_CS_TDI | URJ_POD_CS_TCK | URJ_POD_CS_TMS);
urj_tap_cable_wait (cable);
@ -132,7 +133,9 @@ keithkoep_set_signal (urj_cable_t *cable, int mask, int val)
if ((mask & URJ_POD_CS_TRST) != 0)
{
urj_tap_parport_set_control (cable->link.port,
(sigs & URJ_POD_CS_TRST) ? (1 << TRST) : 0);
(sigs & URJ_POD_CS_TRST) ? (1 <<
TRST) :
0);
}
PARAM_SIGNALS (cable) = sigs;
}

@ -83,12 +83,12 @@ lattice_clock (urj_cable_t *cable, int tms, int tdi, int n)
for (i = 0; i < n; i++)
{
urj_tap_parport_set_data (cable->link.port,
(trst << TRST) | (0 << TCK) | (tms << TMS) | (tdi <<
TDI));
(trst << TRST) | (0 << TCK) | (tms << TMS) |
(tdi << TDI));
urj_tap_cable_wait (cable);
urj_tap_parport_set_data (cable->link.port,
(trst << TRST) | (1 << TCK) | (tms << TMS) | (tdi <<
TDI));
(trst << TRST) | (1 << TCK) | (tms << TMS) |
(tdi << TDI));
urj_tap_cable_wait (cable);
}
@ -104,7 +104,8 @@ lattice_get_tdo (urj_cable_t *cable)
int trst = (PARAM_SIGNALS (cable) & URJ_POD_CS_TRST) ? 1 : 0;
urj_tap_parport_set_data (cable->link.port, (trst << TRST) | (0 << TCK));
PARAM_SIGNALS (cable) &= ~(URJ_POD_CS_TDI | URJ_POD_CS_TCK | URJ_POD_CS_TMS);
PARAM_SIGNALS (cable) &=
~(URJ_POD_CS_TDI | URJ_POD_CS_TCK | URJ_POD_CS_TMS);
urj_tap_cable_wait (cable);

@ -84,10 +84,10 @@ mpcbdm_clock (urj_cable_t *cable, int tms, int tdi, int n)
for (i = 0; i < n; i++)
{
urj_tap_parport_set_data (cable->link.port,
(0 << TCK) | (tms << TMS) | (tdi << TDI));
(0 << TCK) | (tms << TMS) | (tdi << TDI));
urj_tap_cable_wait (cable);
urj_tap_parport_set_data (cable->link.port,
(1 << TCK) | (tms << TMS) | (tdi << TDI));
(1 << TCK) | (tms << TMS) | (tdi << TDI));
urj_tap_cable_wait (cable);
}
@ -101,7 +101,8 @@ static int
mpcbdm_get_tdo (urj_cable_t *cable)
{
urj_tap_parport_set_data (cable->link.port, 0 << TCK);
PARAM_SIGNALS (cable) &= ~(URJ_POD_CS_TDI | URJ_POD_CS_TCK | URJ_POD_CS_TMS);
PARAM_SIGNALS (cable) &=
~(URJ_POD_CS_TDI | URJ_POD_CS_TCK | URJ_POD_CS_TMS);
urj_tap_cable_wait (cable);

@ -91,12 +91,14 @@ triton_clock (urj_cable_t *cable, int tms, int tdi, int n)
for (i = 0; i < n; i++)
{
urj_tap_parport_set_data (cable->link.port,
(trst << TRST) | (sreset << SRESET) | (0 << TCK) |
(tms << TMS) | (tdi << TDI));
(trst << TRST) | (sreset << SRESET) | (0 <<
TCK)
| (tms << TMS) | (tdi << TDI));
urj_tap_cable_wait (cable);
urj_tap_parport_set_data (cable->link.port,
(trst << TRST) | (sreset << SRESET) | (1 << TCK) |
(tms << TMS) | (tdi << TDI));
(trst << TRST) | (sreset << SRESET) | (1 <<
TCK)
| (tms << TMS) | (tdi << TDI));
urj_tap_cable_wait (cable);
}
@ -113,8 +115,10 @@ triton_get_tdo (urj_cable_t *cable)
int sreset = (PARAM_SIGNALS (cable) & URJ_POD_CS_RESET) ? 1 : 0;
urj_tap_parport_set_data (cable->link.port,
(trst << TRST) | (sreset << SRESET) | (0 << TCK));
PARAM_SIGNALS (cable) &= ~(URJ_POD_CS_TDI | URJ_POD_CS_TCK | URJ_POD_CS_TMS);
(trst << TRST) | (sreset << SRESET) | (0 <<
TCK));
PARAM_SIGNALS (cable) &=
~(URJ_POD_CS_TDI | URJ_POD_CS_TCK | URJ_POD_CS_TMS);
urj_tap_cable_wait (cable);

@ -247,7 +247,8 @@ ts7800_current_signals (urj_cable_t *cable)
{
ts7800_params_t *p = cable->params;
int sigs = p->signals & ~(URJ_POD_CS_TMS | URJ_POD_CS_TDI | URJ_POD_CS_TCK);
int sigs =
p->signals & ~(URJ_POD_CS_TMS | URJ_POD_CS_TDI | URJ_POD_CS_TCK);
if (p->lastout & (1 << TCK))
sigs |= URJ_POD_CS_TCK;
if (p->lastout & (1 << TDI))

@ -162,17 +162,21 @@ usbblaster_clock_schedule (urj_cable_t *cable, int tms, int tdi, int n)
if (chunkbytes > 63)
chunkbytes = 63;
if (urj_tap_cable_cx_cmd_space (cmd_root, URJ_USBCONN_FTDX_MAXSEND) < chunkbytes + 1)
if (urj_tap_cable_cx_cmd_space
(cmd_root, URJ_USBCONN_FTDX_MAXSEND) < chunkbytes + 1)
{
/* no space left for next clocking command
transfer queued commands to device and read receive data
to internal buffer */
urj_tap_cable_cx_xfer (cmd_root, NULL, cable, URJ_TAP_CABLE_COMPLETELY);
urj_tap_cable_cx_xfer (cmd_root, NULL, cable,
URJ_TAP_CABLE_COMPLETELY);
urj_tap_cable_cx_cmd_queue (cmd_root, 0);
}
urj_tap_cable_cx_cmd_push (cmd_root, (1 << SHMODE) | (0 << READ) | chunkbytes);
urj_tap_cable_cx_cmd_push (cmd_root,
(1 << SHMODE) | (0 << READ) |
chunkbytes);
for (i = 0; i < chunkbytes; i++)
{
@ -197,7 +201,8 @@ usbblaster_clock (urj_cable_t *cable, int tms, int tdi, int n)
params_t *params = (params_t *) cable->params;
usbblaster_clock_schedule (cable, tms, tdi, n);
urj_tap_cable_cx_xfer (&(params->cmd_root), NULL, cable, URJ_TAP_CABLE_COMPLETELY);
urj_tap_cable_cx_xfer (&(params->cmd_root), NULL, cable,
URJ_TAP_CABLE_COMPLETELY);
}
static void
@ -207,8 +212,8 @@ usbblaster_get_tdo_schedule (urj_cable_t *cable)
urj_tap_cable_cmd_xfer_cx_cmd_root_t *cmd_root = &(params->cmd_root);
urj_tap_cable_cx_cmd_queue (cmd_root, 1);
urj_tap_cable_cx_cmd_push (cmd_root, OTHERS); /* TCK low */
urj_tap_cable_cx_cmd_push (cmd_root, OTHERS | (1 << READ)); /* TCK low */
urj_tap_cable_cx_cmd_push (cmd_root, OTHERS); /* TCK low */
urj_tap_cable_cx_cmd_push (cmd_root, OTHERS | (1 << READ)); /* TCK low */
}
static int
@ -229,7 +234,8 @@ usbblaster_get_tdo (urj_cable_t *cable)
params_t *params = (params_t *) cable->params;
usbblaster_get_tdo_schedule (cable);
urj_tap_cable_cx_xfer (&(params->cmd_root), NULL, cable, URJ_TAP_CABLE_COMPLETELY);
urj_tap_cable_cx_xfer (&(params->cmd_root), NULL, cable,
URJ_TAP_CABLE_COMPLETELY);
return usbblaster_get_tdo_finish (cable);
}
@ -240,14 +246,15 @@ usbblaster_set_signal (urj_cable_t *cable, int mask, int val)
}
static void
usbblaster_transfer_schedule (urj_cable_t *cable, int len, char *in, char *out)
usbblaster_transfer_schedule (urj_cable_t *cable, int len, char *in,
char *out)
{
params_t *params = (params_t *) cable->params;
urj_tap_cable_cmd_xfer_cx_cmd_root_t *cmd_root = &(params->cmd_root);
int in_offset = 0;
urj_tap_cable_cx_cmd_queue (cmd_root, 0);
urj_tap_cable_cx_cmd_push (cmd_root, OTHERS); /* TCK low */
urj_tap_cable_cx_cmd_push (cmd_root, OTHERS); /* TCK low */
#if 0
{
@ -269,12 +276,16 @@ usbblaster_transfer_schedule (urj_cable_t *cable, int len, char *in, char *out)
if (out)
{
urj_tap_cable_cx_cmd_queue (cmd_root, chunkbytes);
urj_tap_cable_cx_cmd_push (cmd_root, (1 << SHMODE) | (1 << READ) | chunkbytes);
urj_tap_cable_cx_cmd_push (cmd_root,
(1 << SHMODE) | (1 << READ) |
chunkbytes);
}
else
{
urj_tap_cable_cx_cmd_queue (cmd_root, 0);
urj_tap_cable_cx_cmd_push (cmd_root, (1 << SHMODE) | (0 << READ) | chunkbytes);
urj_tap_cable_cx_cmd_push (cmd_root,
(1 << SHMODE) | (0 << READ) |
chunkbytes);
}
for (i = 0; i < chunkbytes; i++)
@ -293,10 +304,11 @@ usbblaster_transfer_schedule (urj_cable_t *cable, int len, char *in, char *out)
char tdi = in[in_offset++] ? 1 : 0;
urj_tap_cable_cx_cmd_queue (cmd_root, out ? 1 : 0);
urj_tap_cable_cx_cmd_push (cmd_root, OTHERS | (tdi << TDI)); /* TCK low */
urj_tap_cable_cx_cmd_push (cmd_root, OTHERS | (tdi << TDI)); /* TCK low */
urj_tap_cable_cx_cmd_push (cmd_root,
OTHERS | ((out) ? (1 << READ) : 0) | (1 << TCK) | (tdi <<
TDI));
OTHERS | ((out) ? (1 << READ) : 0) | (1 <<
TCK)
| (tdi << TDI));
}
}
@ -319,7 +331,8 @@ usbblaster_transfer_finish (urj_cable_t *cable, int len, char *out)
if (out)
{
urj_tap_cable_cx_xfer (cmd_root, NULL, cable, URJ_TAP_CABLE_COMPLETELY);
urj_tap_cable_cx_xfer (cmd_root, NULL, cable,
URJ_TAP_CABLE_COMPLETELY);
for (i = 0; i < chunkbytes; i++)
{
@ -336,7 +349,8 @@ usbblaster_transfer_finish (urj_cable_t *cable, int len, char *out)
}
while (len > out_offset)
out[out_offset++] = (urj_tap_cable_cx_xfer_recv (cable) & (1 << TDO)) ? 1 : 0;
out[out_offset++] =
(urj_tap_cable_cx_xfer_recv (cable) & (1 << TDO)) ? 1 : 0;
#if 0
{
@ -357,7 +371,8 @@ usbblaster_transfer (urj_cable_t *cable, int len, char *in, char *out)
params_t *params = (params_t *) cable->params;
usbblaster_transfer_schedule (cable, len, in, out);
urj_tap_cable_cx_xfer (&(params->cmd_root), NULL, cable, URJ_TAP_CABLE_COMPLETELY);
urj_tap_cable_cx_xfer (&(params->cmd_root), NULL, cable,
URJ_TAP_CABLE_COMPLETELY);
return usbblaster_transfer_finish (cable, len, out);
}
@ -429,7 +444,8 @@ usbblaster_flush (urj_cable_t *cable, urj_cable_flush_amount_t how_much)
}
case URJ_TAP_CABLE_GET_SIGNAL:
{
int m = urj_tap_cable_add_queue_item (cable, &(cable->done));
int m =
urj_tap_cable_add_queue_item (cable, &(cable->done));
cable->done.data[m].action = URJ_TAP_CABLE_GET_SIGNAL;
cable->done.data[m].arg.value.sig =
cable->todo.data[j].arg.value.sig;
@ -449,7 +465,8 @@ usbblaster_flush (urj_cable_t *cable, urj_cable_flush_amount_t how_much)
free (cable->todo.data[j].arg.transfer.in);
if (cable->todo.data[j].arg.transfer.out)
{
int m = urj_tap_cable_add_queue_item (cable, &(cable->done));
int m = urj_tap_cable_add_queue_item (cable,
&(cable->done));
if (m < 0)
printf ("out of memory!\n");
cable->done.data[m].action = URJ_TAP_CABLE_TRANSFER;

@ -290,7 +290,10 @@ ep9307_current_signals (urj_cable_t *cable)
{
ep9307_params_t *p = cable->params;
int sigs = p->signals & ~(URJ_POD_CS_TMS | URJ_POD_CS_TDI | URJ_POD_CS_TCK | URJ_POD_CS_TRST);
int sigs =
p->
signals & ~(URJ_POD_CS_TMS | URJ_POD_CS_TDI | URJ_POD_CS_TCK |
URJ_POD_CS_TRST);
if (p->lastout & (1 << TCK))
sigs |= URJ_POD_CS_TCK;
if (p->lastout & (1 << TDI))

@ -68,26 +68,30 @@
#define xstr(s) str(s)
#define str(s) #s
static const char *std_wgl_map = xstr (TDO) ","
xstr (nTRST) ","
xstr (TDI) ","
xstr (TCK) ","
xstr (TMS) "," "#"
xstr (nSRESET);
xstr (nTRST)
","
xstr (TDI)
","
xstr (TCK)
","
xstr (TMS)
"," "#"
xstr (nSRESET);
/* private parameters of this cable driver */
typedef struct
{
int signals;
int trst_lvl;
int srst_act, srst_inact;
int tms_act, tms_inact;
int tck_act, tck_inact;
int tdi_act, tdi_inact;
int tdo_act, tdo_inact;
int trst_act, trst_inact;
int unused_bits;
} wiggler_params_t;
typedef struct
{
int signals;
int trst_lvl;
int srst_act, srst_inact;
int tms_act, tms_inact;
int tck_act, tck_inact;
int tdi_act, tdi_inact;
int tdo_act, tdo_inact;
int trst_act, trst_inact;
int unused_bits;
} wiggler_params_t;
/* access macros for the parameters */
@ -109,7 +113,7 @@ typedef struct
static int map_pin (char *pin, int *act, int *inact)
static int map_pin (char *pin, int *act, int *inact)
{
int bitnum;
int inverted = 0;
@ -290,18 +294,24 @@ wiggler_clock (urj_cable_t *cable, int tms, int tdi, int n)
for (i = 0; i < n; i++)
{
urj_tap_parport_set_data (cable->link.port, PRM_TRST_LVL (cable) |
PRM_TCK_INACT (cable) |
(tms ? PRM_TMS_ACT (cable) : PRM_TMS_INACT (cable))
| (tdi ? PRM_TDI_ACT (cable) :
PRM_TDI_INACT (cable)) |
PRM_UNUSED_BITS (cable));
PRM_TCK_INACT (cable) |
(tms ? PRM_TMS_ACT (cable) :
PRM_TMS_INACT (cable)) | (tdi ?
PRM_TDI_ACT
(cable) :
PRM_TDI_INACT
(cable)) |
PRM_UNUSED_BITS (cable));
urj_tap_cable_wait (cable);
urj_tap_parport_set_data (cable->link.port, PRM_TRST_LVL (cable) |
PRM_TCK_ACT (cable) |
(tms ? PRM_TMS_ACT (cable) : PRM_TMS_INACT (cable))
| (tdi ? PRM_TDI_ACT (cable) :
PRM_TDI_INACT (cable)) |
PRM_UNUSED_BITS (cable));
PRM_TCK_ACT (cable) |
(tms ? PRM_TMS_ACT (cable) :
PRM_TMS_INACT (cable)) | (tdi ?
PRM_TDI_ACT
(cable) :
PRM_TDI_INACT
(cable)) |
PRM_UNUSED_BITS (cable));
urj_tap_cable_wait (cable);
}
@ -316,7 +326,8 @@ static int
wiggler_get_tdo (urj_cable_t *cable)
{
urj_tap_parport_set_data (cable->link.port, PRM_TRST_LVL (cable) |
PRM_TCK_INACT (cable) | PRM_UNUSED_BITS (cable));
PRM_TCK_INACT (cable) |
PRM_UNUSED_BITS (cable));
urj_tap_cable_wait (cable);
return (urj_tap_parport_get_status (cable->link.port) &
@ -339,11 +350,14 @@ wiggler_set_signal (urj_cable_t *cable, int mask, int val)
PRM_TRST_INACT (cable));
int data = PRM_UNUSED_BITS (cable) | PRM_TRST_LVL (cable);
data |=
((sigs & URJ_POD_CS_TCK) ? PRM_TCK_ACT (cable) : PRM_TCK_INACT (cable));
((sigs & URJ_POD_CS_TCK) ? PRM_TCK_ACT (cable) :
PRM_TCK_INACT (cable));
data |=
((sigs & URJ_POD_CS_TMS) ? PRM_TMS_ACT (cable) : PRM_TMS_INACT (cable));
((sigs & URJ_POD_CS_TMS) ? PRM_TMS_ACT (cable) :
PRM_TMS_INACT (cable));
data |=
((sigs & URJ_POD_CS_TDI) ? PRM_TDI_ACT (cable) : PRM_TDI_INACT (cable));
((sigs & URJ_POD_CS_TDI) ? PRM_TDI_ACT (cable) :
PRM_TDI_INACT (cable));
urj_tap_parport_set_data (cable->link.port, data);
PRM_SIGNALS (cable) = sigs;
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save