]> git.sur5r.net Git - openocd/blob - src/target/openrisc/or1k_tap_xilinx_bscan.c
tcl/target: ti_tms570.cfg restructure dap support
[openocd] / src / target / openrisc / or1k_tap_xilinx_bscan.c
1 /***************************************************************************
2  *   Copyright (C) 2013 by Sergio Chico                                    *
3  *   sergio.chico@gmail.com                                                *
4  *                                                                         *
5  *   This program is free software; you can redistribute it and/or modify  *
6  *   it under the terms of the GNU General Public License as published by  *
7  *   the Free Software Foundation; either version 2 of the License, or     *
8  *   (at your option) any later version.                                   *
9  *                                                                         *
10  *   This program is distributed in the hope that it will be useful,       *
11  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
12  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
13  *   GNU General Public License for more details.                          *
14  *                                                                         *
15  *   You should have received a copy of the GNU General Public License     *
16  *   along with this program.  If not, see <http://www.gnu.org/licenses/>. *
17  ***************************************************************************/
18
19 #ifdef HAVE_CONFIG_H
20 #include "config.h"
21 #endif
22
23 #include "or1k_tap.h"
24 #include "or1k.h"
25
26 #include <jtag/jtag.h>
27
28 #define OR1K_XILINX_TAP_INST_USER1      0x02
29
30 static int or1k_tap_xilinx_bscan_init(struct or1k_jtag *jtag_info)
31 {
32         LOG_DEBUG("Initialising Xilinx Internal JTAG TAP");
33
34         /* Put TAP into state where it can talk to the debug interface
35          * by shifting in correct value to IR.
36          */
37
38         /* Ensure TAP is reset - maybe not necessary*/
39         jtag_add_tlr();
40
41         struct jtag_tap *tap = jtag_info->tap;
42         struct scan_field field;
43         uint8_t ir_value = OR1K_XILINX_TAP_INST_USER1;
44
45         field.num_bits = tap->ir_length;
46         field.out_value = &ir_value;
47         field.in_value = NULL;
48
49         jtag_add_ir_scan(tap, &field, TAP_IDLE);
50
51         return jtag_execute_queue();
52 }
53
54 static struct or1k_tap_ip xilinx_bscan_tap = {
55         .name = "xilinx_bscan",
56         .init = or1k_tap_xilinx_bscan_init,
57 };
58
59 int or1k_tap_xilinx_bscan_register(void)
60 {
61         list_add_tail(&xilinx_bscan_tap.list, &tap_list);
62         return 0;
63 }