e60e832e9c2423f7c85e65432e1066615267b9b3
[openocd.git] / src / jtag / minidummy / minidummy.c
1 /***************************************************************************
2 * Copyright (C) 2007-2008 by √ėyvind Harboe *
3 * *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
8 * *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
13 * *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program; if not, write to the *
16 * Free Software Foundation, Inc., *
17 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
18 ***************************************************************************/
19 #ifdef HAVE_CONFIG_H
20 #include "config.h"
21 #endif
22
23 #include <target/embeddedice.h>
24 #include <jtag/minidriver.h>
25 #include <jtag/interface.h>
26
27 struct jtag_interface minidummy_interface =
28 {
29 .name = "minidummy",
30 .execute_queue = NULL,
31 .speed = NULL,
32 .commands = NULL,
33 .init = NULL,
34 .quit = NULL,
35 .khz = NULL,
36 .speed_div = NULL,
37 .power_dropout = NULL,
38 .srst_asserted = NULL,
39 };
40
41 int interface_jtag_execute_queue(void)
42 {
43 /* synchronously do the operation here */
44
45 return ERROR_OK;
46 }
47
48 int interface_jtag_add_ir_scan(int num_fields, const struct scan_field *fields, tap_state_t state)
49 {
50 /* synchronously do the operation here */
51
52 return ERROR_OK;
53
54 }
55
56 int interface_jtag_add_plain_ir_scan(int num_fields, const struct scan_field *fields, tap_state_t state)
57 {
58 /* synchronously do the operation here */
59
60 return ERROR_OK;
61 }
62
63 int interface_jtag_add_dr_scan(int num_fields, const struct scan_field *fields, tap_state_t state)
64 {
65 /* synchronously do the operation here */
66
67 return ERROR_OK;
68 }
69
70 int interface_jtag_add_plain_dr_scan(int num_fields, const struct scan_field *fields, tap_state_t state)
71 {
72 /* synchronously do the operation here */
73
74 return ERROR_OK;
75 }
76
77 int interface_jtag_add_tlr()
78 {
79 /* synchronously do the operation here */
80
81 return ERROR_OK;
82 }
83
84 int interface_jtag_add_reset(int req_trst, int req_srst)
85 {
86 /* synchronously do the operation here */
87
88 return ERROR_OK;
89 }
90
91 int interface_jtag_add_runtest(int num_cycles, tap_state_t state)
92 {
93 /* synchronously do the operation here */
94
95 return ERROR_OK;
96 }
97
98 int interface_jtag_add_clocks(int num_cycles)
99 {
100 /* synchronously do the operation here */
101
102 return ERROR_OK;
103 }
104
105 int interface_jtag_add_sleep(uint32_t us)
106 {
107 jtag_sleep(us);
108 return ERROR_OK;
109 }
110
111 int interface_jtag_add_pathmove(int num_states, const tap_state_t *path)
112 {
113 int state_count;
114 int tms = 0;
115
116 state_count = 0;
117
118 tap_state_t cur_state = cmd_queue_cur_state;
119
120 while (num_states)
121 {
122 if (tap_state_transition(cur_state, false) == path[state_count])
123 {
124 tms = 0;
125 }
126 else if (tap_state_transition(cur_state, true) == path[state_count])
127 {
128 tms = 1;
129 }
130 else
131 {
132 LOG_ERROR("BUG: %s -> %s isn't a valid TAP transition", tap_state_name(cur_state), tap_state_name(path[state_count]));
133 exit(-1);
134 }
135
136 /* synchronously do the operation here */
137
138 cur_state = path[state_count];
139 state_count++;
140 num_states--;
141 }
142
143
144 /* synchronously do the operation here */
145
146 return ERROR_OK;
147 }
148
149 void embeddedice_write_dcc(struct jtag_tap *tap, int reg_addr, uint8_t *buffer, int little, int count)
150 {
151 int i;
152 for (i = 0; i < count; i++)
153 {
154 embeddedice_write_reg_inner(tap, reg_addr, fast_target_buffer_get_u32(buffer, little));
155 buffer += 4;
156 }
157 }