0565edafb098953d8f84d75d10d7c2b0e705bfee
[fw/openocd] / src / jtag / dummy.c
1 /***************************************************************************\r
2  *   Copyright (C) 2008 by Ã˜yvind Harboe                                   *\r
3  *   oyvind.harboe@zylin.com                                               *\r
4  *                                                                         *\r
5  *   This program is free software; you can redistribute it and/or modify  *\r
6  *   it under the terms of the GNU General Public License as published by  *\r
7  *   the Free Software Foundation; either version 2 of the License, or     *\r
8  *   (at your option) any later version.                                   *\r
9  *                                                                         *\r
10  *   This program is distributed in the hope that it will be useful,       *\r
11  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *\r
12  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *\r
13  *   GNU General Public License for more details.                          *\r
14  *                                                                         *\r
15  *   You should have received a copy of the GNU General Public License     *\r
16  *   along with this program; if not, write to the                         *\r
17  *   Free Software Foundation, Inc.,                                       *\r
18  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *\r
19  ***************************************************************************/\r
20 #ifdef HAVE_CONFIG_H\r
21 #include "config.h"\r
22 #endif\r
23 \r
24 #include "replacements.h"\r
25 \r
26 #include "jtag.h"\r
27 #include "bitbang.h"\r
28 \r
29 int dummy_speed(int speed);\r
30 int dummy_register_commands(struct command_context_s *cmd_ctx);\r
31 int dummy_init(void);\r
32 int dummy_quit(void);\r
33 \r
34 /* The dummy driver is used to easily check the code path \r
35  * where the target is unresponsive.\r
36  */\r
37 jtag_interface_t dummy_interface = \r
38 {\r
39         .name = "dummy",\r
40         \r
41         .execute_queue = bitbang_execute_queue,\r
42 \r
43         .speed = dummy_speed,   \r
44         .register_commands = dummy_register_commands,\r
45         .init = dummy_init,\r
46         .quit = dummy_quit,\r
47 };\r
48 \r
49 int dummy_read(void);\r
50 void dummy_write(int tck, int tms, int tdi);\r
51 void dummy_reset(int trst, int srst);\r
52 void dummy_led(int on);\r
53 \r
54 bitbang_interface_t dummy_bitbang =\r
55 {\r
56         .read = dummy_read,\r
57         .write = dummy_write,\r
58         .reset = dummy_reset,\r
59         .blink = dummy_led\r
60 };\r
61 \r
62 int dummy_read(void)\r
63 {\r
64         return 1;\r
65 }\r
66 \r
67 void dummy_write(int tck, int tms, int tdi)\r
68 {\r
69 }\r
70 \r
71 void dummy_reset(int trst, int srst)\r
72 {\r
73 }\r
74 \r
75 int dummy_speed(int speed)\r
76 {\r
77         return ERROR_OK;\r
78 }\r
79 \r
80 int dummy_register_commands(struct command_context_s *cmd_ctx)\r
81 {\r
82         return ERROR_OK;\r
83 }\r
84 \r
85 int dummy_init(void)\r
86 {\r
87         bitbang_interface = &dummy_bitbang;     \r
88 \r
89         return ERROR_OK;\r
90 }\r
91 \r
92 int dummy_quit(void)\r
93 {\r
94         return ERROR_OK;\r
95 }\r
96 \r
97 void dummy_led(int on)\r
98 {\r
99 }\r