54 int num_words, uint32_t *words)
61 values = malloc(num_words * 4);
71 for (i = 0; i < num_words; i++)
89 uint8_t *in = (uint8_t *)arg;
94 int num_words, uint32_t *words)
107 while (num_words--) {
126 data[0] = 0xaa995566;
127 data[1] = 0x2800E001;
128 data[2] = 0x20000000;
129 data[3] = 0x20000000;
130 data[4] = 0x20000000;
248 for (i = 0; i < bit_file.
length; i++)
316 if (!pld_device_info || !pld_device_info->
tap)
319 hub->
tap = pld_device_info->
tap;
336 LOG_ERROR(
"code for command 'select user1' is unknown");
365 instr_codes.
bypass = 0xffffffffffffffffULL;
368 for (
unsigned int i = 0; i <
num_user; ++i)
392 unsigned int num_user =
CMD_ARGC - 1;
393 for (
unsigned int i = 0; i < num_user; ++i)
396 memcpy(virtex2_info->
command_set.
user, user, num_user *
sizeof(uint64_t));
405 if (strcmp(
CMD_ARGV[2],
"-chain-position") != 0)
426 pld->driver_priv = virtex2_info;
435 .handler = virtex2_handle_read_stat_command,
436 .help =
"read status register",
439 .name =
"set_instr_codes",
441 .handler = virtex2_handle_set_instuction_codes_command,
442 .help =
"set instructions codes used for loading the bitstream/refreshing/jtag-hub",
443 .usage =
"pld_name cfg_out cfg_in jprogb jstart jshutdown"
444 " [user1 [user2 [user3 [user4]]]]",
446 .name =
"set_user_codes",
448 .handler = virtex2_handle_set_user_codes_command,
449 .help =
"set instructions codes used for jtag-hub",
450 .usage =
"pld_name user1 [user2 [user3 [user4]]]",
454 .handler = virtex2_handle_refresh_command,
455 .help =
"start loading of configuration (program)",
465 .help =
"Virtex-II specific commands",
475 .pld_create_command = &virtex2_pld_create_command,
static const struct device_t * device
uint32_t flip_u32(uint32_t value, unsigned int num)
Inverts the ordering of bits inside a 32-bit word (e.g.
static void buf_set_u32(uint8_t *_buffer, unsigned int first, unsigned int num, uint32_t value)
Sets num bits in _buffer, starting at the first bit, using the bits in value.
static uint64_t buf_get_u64(const uint8_t *_buffer, unsigned int first, unsigned int num)
Retrieves num bits from _buffer, starting at the first bit, returning the bits in a 64-bit word.
static void buf_set_u64(uint8_t *_buffer, unsigned int first, unsigned int num, uint64_t value)
Sets num bits in _buffer, starting at the first bit, using the bits in value.
void command_print(struct command_invocation *cmd, const char *format,...)
#define CMD
Use this macro to access the command being handled, rather than accessing the variable directly.
#define CMD_ARGV
Use this macro to access the arguments for the command being handled, rather than accessing the varia...
#define ERROR_COMMAND_SYNTAX_ERROR
#define CMD_ARGC
Use this macro to access the number of arguments for the command being handled, rather than accessing...
#define COMMAND_PARSE_NUMBER(type, in, out)
parses the string in into out as a type, or prints a command error and passes the error code to the c...
#define COMMAND_REGISTRATION_DONE
Use this as the last entry in an array of command_registration records.
struct jtag_tap * jtag_tap_by_string(const char *s)
void jtag_add_runtest(unsigned int num_cycles, tap_state_t state)
Goes to TAP_IDLE (if we're not already there), cycle precisely num_cycles in the TAP_IDLE state,...
int jtag_execute_queue(void)
For software FIFO implementations, the queued commands can be executed during this call or earlier.
void jtag_add_tlr(void)
Run a TAP_RESET reset where the end state is TAP_RESET, regardless of the start state.
void jtag_add_sleep(uint32_t us)
void jtag_add_ir_scan(struct jtag_tap *active, struct scan_field *in_fields, tap_state_t state)
Generate an IR SCAN with a list of scan fields with one entry for each enabled TAP.
void jtag_add_dr_scan(struct jtag_tap *active, int in_num_fields, const struct scan_field *in_fields, tap_state_t state)
Generate a DR SCAN using the fields passed to the function.
void jtag_add_callback(jtag_callback1_t f, jtag_callback_data_t data0)
A simpler version of jtag_add_callback4().
intptr_t jtag_callback_data_t
Defines the type of data passed to the jtag_callback_t interface.
#define LOG_ERROR(expr ...)
#define LOG_DEBUG(expr ...)
struct pld_device * get_pld_device_by_name(const char *name)
struct pld_device * get_pld_device_by_name_or_numstr(const char *str)
uint8_t * cur_instr
current instruction
unsigned int ir_length
size of instruction register
unsigned int user_ir_code
This structure defines a single scan field in the scan.
uint8_t * in_value
A pointer to a 32-bit memory location for data scanned out.
const uint8_t * out_value
A pointer to value to be scanned into the device.
unsigned int num_bits
The number of bits this field specifies.
uint64_t user[VIRTEX2_MAX_USER_INSTRUCTIONS]
struct virtex2_command_set command_set
#define DIV_ROUND_UP(m, n)
Rounds m up to the nearest multiple of n using division.
static uint32_t le_to_h_u32(const uint8_t *buf)
static int virtex2_set_instr(struct jtag_tap *tap, uint64_t new_instr)
PLD_CREATE_COMMAND_HANDLER(virtex2_pld_create_command)
static int virtex2_program(struct pld_device *pld_device)
static const struct virtex2_command_set virtex2_default_commands
static int virtex2_send_32(struct pld_device *pld_device, int num_words, uint32_t *words)
static int virtex2_load_prepare(struct pld_device *pld_device)
static int virtex2_read_stat(struct pld_device *pld_device, uint32_t *status)
static const struct command_registration virtex2_command_handler[]
static int xilinx_get_jtagspi_userircode(struct pld_device *pld_device, unsigned int *ir)
static int virtex2_load(struct pld_device *pld_device, const char *filename)
static int virtex2_receive_32(struct pld_device *pld_device, int num_words, uint32_t *words)
struct pld_driver virtex2_pld
static int xilinx_get_ipdbg_hub(int user_num, struct pld_device *pld_device, struct pld_ipdbg_hub *hub)
static int virtex2_load_cleanup(struct pld_device *pld_device)
COMMAND_HANDLER(virtex2_handle_refresh_command)
static void virtexflip32(jtag_callback_data_t arg)
static const struct command_registration virtex2_exec_command_handlers[]
#define VIRTEX2_MAX_USER_INSTRUCTIONS
void xilinx_free_bit_file(struct xilinx_bit_file *bit_file)
int xilinx_read_bit_file(struct xilinx_bit_file *bit_file, const char *filename)