OpenOCD
or1k_tap_mohor.c
Go to the documentation of this file.
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 
3 /***************************************************************************
4  * Copyright (C) 2013 by Franck Jullien *
5  * elec4fun@gmail.com *
6  ***************************************************************************/
7 
8 #ifdef HAVE_CONFIG_H
9 #include "config.h"
10 #endif
11 
12 #include "or1k_tap.h"
13 #include "or1k.h"
14 
15 #include <jtag/jtag.h>
16 
17 #define OR1K_TAP_INST_DEBUG 0x8
18 
19 static int or1k_tap_mohor_init(struct or1k_jtag *jtag_info)
20 {
21  LOG_DEBUG("Initialising OpenCores JTAG TAP");
22 
23  /* Put TAP into state where it can talk to the debug interface
24  * by shifting in correct value to IR.
25  */
26 
27  /* Ensure TAP is reset - maybe not necessary*/
28  jtag_add_tlr();
29 
30  struct jtag_tap *tap = jtag_info->tap;
31  struct scan_field field;
32  uint8_t ir_value = OR1K_TAP_INST_DEBUG;
33 
34  field.num_bits = tap->ir_length;
35  field.out_value = &ir_value;
36  field.in_value = NULL;
37 
38  jtag_add_ir_scan(tap, &field, TAP_IDLE);
39 
40  return jtag_execute_queue();
41 }
42 
43 static struct or1k_tap_ip mohor_tap = {
44  .name = "mohor",
45  .init = or1k_tap_mohor_init,
46 };
47 
49 {
51  return 0;
52 }
int jtag_execute_queue(void)
For software FIFO implementations, the queued commands can be executed during this call or earlier.
Definition: jtag/core.c:1037
void jtag_add_tlr(void)
Run a TAP_RESET reset where the end state is TAP_RESET, regardless of the start state.
Definition: jtag/core.c:478
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.
Definition: jtag/core.c:374
The JTAG interface can be implemented with a software or hardware fifo.
@ TAP_IDLE
Definition: jtag.h:53
static void list_add_tail(struct list_head *new, struct list_head *head)
Definition: list.h:199
#define LOG_DEBUG(expr ...)
Definition: log.h:109
struct list_head tap_list
#define OR1K_TAP_INST_DEBUG
static int or1k_tap_mohor_init(struct or1k_jtag *jtag_info)
static struct or1k_tap_ip mohor_tap
int or1k_tap_mohor_register(void)
Definition: jtag.h:101
unsigned int ir_length
size of instruction register
Definition: jtag.h:110
Definition: or1k.h:77
struct jtag_tap * tap
Definition: or1k.h:78
const char * name
Definition: or1k_tap.h:28
struct list_head list
Definition: or1k_tap.h:26
This structure defines a single scan field in the scan.
Definition: jtag.h:87
uint8_t * in_value
A pointer to a 32-bit memory location for data scanned out.
Definition: jtag.h:93
const uint8_t * out_value
A pointer to value to be scanned into the device.
Definition: jtag.h:91
unsigned int num_bits
The number of bits this field specifies.
Definition: jtag.h:89
#define NULL
Definition: usb.h:16