24 #define ALTERA_CYCLONE_CMD_USER1 0x0E
25 #define ALTERA_CYCLONE_CMD_USER0 0x0C
31 #define ALT_VJTAG_IR_SIZE 4
32 #define ALT_VJTAG_CMD_DEBUG 0x8
35 #define JTAG_TO_AVALON_NODE_ID 0x84
36 #define VJTAG_NODE_ID 0x08
37 #define SIGNAL_TAP_NODE_ID 0x00
38 #define SERIAL_FLASH_LOADER_NODE_ID 0x04
40 #define VER(x) ((x >> 27) & 0x1f)
41 #define NB_NODES(x) ((x >> 19) & 0xff)
42 #define ID(x) ((x >> 19) & 0xff)
43 #define MANUF(x) ((x >> 8) & 0x7ff)
44 #define M_WIDTH(x) ((x >> 0) & 0xff)
45 #define INST_ID(x) ((x >> 0) & 0xff)
48 #define OR1K_TAP_INST_IDCODE 0x2
49 #define OR1K_TAP_INST_DEBUG 0x8
55 return "Virtual JTAG";
57 return "JTAG to avalon bridge";
61 return "Serial Flash Loader";
68 unsigned char width = 0;
70 while (number_of_nodes) {
71 number_of_nodes >>= 1;
80 LOG_DEBUG(
"Initialising Altera Virtual JTAG TAP");
141 uint8_t t[4] = { 0 };
189 uint32_t hub_info = 0;
191 for (
int i = 0; i < 8; i++) {
199 hub_info = ((hub_info >> 4) | ((nibble & 0xf) << 28));
203 int m_width =
M_WIDTH(hub_info);
205 LOG_DEBUG(
"SLD HUB Configuration register");
206 LOG_DEBUG(
"------------------------------");
231 int vjtag_node_address = -1;
233 uint32_t node_info = 0;
234 for (node_index = 0; node_index < nb_nodes; node_index++) {
236 for (
int i = 0; i < 8; i++) {
244 node_info = ((node_info >> 4) | ((nibble & 0xf) << 28));
249 LOG_DEBUG(
"instance_id = %" PRIu32,
ID(node_info));
251 LOG_DEBUG(
"node_id = %" PRIu32
" (%s)",
ID(node_info),
256 vjtag_node_address = node_index + 1;
259 if (vjtag_node_address < 0) {
260 LOG_ERROR(
"No VJTAG TAP instance found !");
static void buf_set_u32(uint8_t *_buffer, unsigned first, unsigned num, uint32_t value)
Sets num bits in _buffer, starting at the first bit, using the bits in value.
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_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.
The JTAG interface can be implemented with a software or hardware fifo.
static void list_add_tail(struct list_head *new, struct list_head *head)
list_add_tail - add a new entry
#define LOG_ERROR(expr ...)
#define LOG_DEBUG(expr ...)
struct list_head tap_list
static const char * id_to_string(unsigned char id)
#define SIGNAL_TAP_NODE_ID
#define SERIAL_FLASH_LOADER_NODE_ID
#define ALTERA_CYCLONE_CMD_USER0
static unsigned char guess_addr_width(unsigned char number_of_nodes)
static struct or1k_tap_ip vjtag_tap
static int or1k_tap_vjtag_init(struct or1k_jtag *jtag_info)
#define ALT_VJTAG_CMD_DEBUG
int or1k_tap_vjtag_register(void)
#define ALTERA_CYCLONE_CMD_USER1
#define JTAG_TO_AVALON_NODE_ID
int ir_length
size of instruction register
This structure defines a single scan field in the scan.
int num_bits
The number of bits this field specifies.
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.