OpenOCD
arm_jtag.c
Go to the documentation of this file.
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 
3 /***************************************************************************
4  * Copyright (C) 2005 by Dominic Rath *
5  * Dominic.Rath@gmx.de *
6  * *
7  * Copyright (C) 2007,2008 Øyvind Harboe *
8  * oyvind.harboe@zylin.com *
9  ***************************************************************************/
10 
11 #ifdef HAVE_CONFIG_H
12 #include "config.h"
13 #endif
14 
15 #include "arm_jtag.h"
16 
17 #if 0
18 #define _ARM_JTAG_SCAN_N_CHECK_
19 #endif
20 
22  uint32_t new_instr, void *no_verify_capture, tap_state_t end_state)
23 {
24  struct scan_field field;
25  uint8_t t[4] = { 0 };
26 
27  field.num_bits = tap->ir_length;
28  field.out_value = t;
29  buf_set_u32(t, 0, field.num_bits, new_instr);
30  field.in_value = NULL;
31 
32  if (!no_verify_capture)
33  jtag_add_ir_scan(tap, &field, end_state);
34  else {
35  /* FIX!!!! this is a kludge!!! arm926ejs.c should reimplement this arm_jtag_set_instr to
36  * have special verification code.
37  */
38  jtag_add_ir_scan_noverify(tap, &field, end_state);
39  }
40 
41  return ERROR_OK;
42 }
43 
44 int arm_jtag_scann_inner(struct arm_jtag *jtag_info, uint32_t new_scan_chain, tap_state_t end_state)
45 {
46  int retval = ERROR_OK;
47 
48  uint8_t out_value[4] = { 0 };
49  buf_set_u32(out_value, 0, jtag_info->scann_size, new_scan_chain);
50  struct scan_field field = { .num_bits = jtag_info->scann_size, .out_value = out_value, };
51 
52  retval = arm_jtag_set_instr(jtag_info->tap, jtag_info->scann_instr, NULL, end_state);
53  if (retval != ERROR_OK)
54  return retval;
55 
56  jtag_add_dr_scan(jtag_info->tap,
57  1,
58  &field,
59  end_state);
60 
61  jtag_info->cur_scan_chain = new_scan_chain;
62 
63  return retval;
64 }
65 
66 static int arm_jtag_reset_callback(enum jtag_event event, void *priv)
67 {
68  struct arm_jtag *jtag_info = priv;
69 
70  if (event == JTAG_TRST_ASSERTED)
71  jtag_info->cur_scan_chain = 0;
72 
73  return ERROR_OK;
74 }
75 
76 int arm_jtag_setup_connection(struct arm_jtag *jtag_info)
77 {
78  jtag_info->scann_instr = 0x2;
79  jtag_info->cur_scan_chain = 0;
80  jtag_info->intest_instr = 0xc;
81 
83 }
84 
85 int arm_jtag_close_connection(struct arm_jtag *jtag_info)
86 {
88 }
int arm_jtag_setup_connection(struct arm_jtag *jtag_info)
Definition: arm_jtag.c:76
int arm_jtag_close_connection(struct arm_jtag *jtag_info)
Definition: arm_jtag.c:85
int arm_jtag_scann_inner(struct arm_jtag *jtag_info, uint32_t new_scan_chain, tap_state_t end_state)
Definition: arm_jtag.c:44
int arm_jtag_set_instr_inner(struct jtag_tap *tap, uint32_t new_instr, void *no_verify_capture, tap_state_t end_state)
Definition: arm_jtag.c:21
static int arm_jtag_reset_callback(enum jtag_event event, void *priv)
Definition: arm_jtag.c:66
static int arm_jtag_set_instr(struct jtag_tap *tap, uint32_t new_instr, void *no_verify_capture, tap_state_t end_state)
Definition: arm_jtag.h:31
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.
Definition: binarybuffer.h:30
static struct esp_usb_jtag * priv
Definition: esp_usb_jtag.c:219
int jtag_unregister_event_callback(jtag_event_handler_t callback, void *priv)
Definition: jtag/core.c:303
int jtag_register_event_callback(jtag_event_handler_t callback, void *priv)
Definition: jtag/core.c:282
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
void jtag_add_ir_scan_noverify(struct jtag_tap *active, const struct scan_field *in_fields, tap_state_t state)
The same as jtag_add_ir_scan except no verification is performed out the output values.
Definition: jtag/core.c:356
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.
Definition: jtag/core.c:451
jtag_event
Definition: jtag.h:176
@ JTAG_TRST_ASSERTED
Definition: jtag.h:177
enum tap_state tap_state_t
Defines JTAG Test Access Port states.
#define ERROR_OK
Definition: log.h:155
uint32_t scann_size
Definition: arm_jtag.h:20
uint32_t scann_instr
Definition: arm_jtag.h:21
uint32_t intest_instr
Definition: arm_jtag.h:24
struct jtag_tap * tap
Definition: arm_jtag.h:18
uint32_t cur_scan_chain
Definition: arm_jtag.h:22
Definition: jtag.h:100
int ir_length
size of instruction register
Definition: jtag.h:109
This structure defines a single scan field in the scan.
Definition: jtag.h:86
int num_bits
The number of bits this field specifies.
Definition: jtag.h:88
uint8_t * in_value
A pointer to a 32-bit memory location for data scanned out.
Definition: jtag.h:92
const uint8_t * out_value
A pointer to value to be scanned into the device.
Definition: jtag.h:90
#define NULL
Definition: usb.h:16