]> git.sur5r.net Git - openocd/commitdiff
jtag_khz simulation
authoroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>
Tue, 16 Dec 2008 11:49:14 +0000 (11:49 +0000)
committeroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>
Tue, 16 Dec 2008 11:49:14 +0000 (11:49 +0000)
git-svn-id: svn://svn.berlios.de/openocd/trunk@1248 b42882b7-edfa-0310-969c-e2dbd0fdcd60

src/jtag/dummy.c

index 0565edafb098953d8f84d75d10d7c2b0e705bfee..f6ca87c2488b5d09b086b5037bbf5763de5f3d8d 100644 (file)
@@ -30,18 +30,24 @@ int dummy_speed(int speed);
 int dummy_register_commands(struct command_context_s *cmd_ctx);\r
 int dummy_init(void);\r
 int dummy_quit(void);\r
+static int dummy_khz(int khz, int *jtag_speed);\r
+static int dummy_speed_div(int speed, int *khz);\r
 \r
-/* The dummy driver is used to easily check the code path \r
+\r
+/* The dummy driver is used to easily check the code path\r
  * where the target is unresponsive.\r
  */\r
-jtag_interface_t dummy_interface = \r
+jtag_interface_t dummy_interface =\r
 {\r
        .name = "dummy",\r
-       \r
+\r
        .execute_queue = bitbang_execute_queue,\r
 \r
-       .speed = dummy_speed,   \r
+       .speed = dummy_speed,\r
        .register_commands = dummy_register_commands,\r
+       .khz = dummy_khz,\r
+       .speed_div = dummy_speed_div,\r
+\r
        .init = dummy_init,\r
        .quit = dummy_quit,\r
 };\r
@@ -72,6 +78,33 @@ void dummy_reset(int trst, int srst)
 {\r
 }\r
 \r
+static int dummy_khz(int khz, int *jtag_speed)\r
+{\r
+       if (khz==0)\r
+       {\r
+               *jtag_speed=0;\r
+       }\r
+       else\r
+       {\r
+               *jtag_speed=64000/khz;\r
+       }\r
+       return ERROR_OK;\r
+}\r
+\r
+static int dummy_speed_div(int speed, int *khz)\r
+{\r
+       if (speed==0)\r
+       {\r
+               *khz = 0;\r
+       }\r
+       else\r
+       {\r
+               *khz=64000/speed;\r
+       }\r
+\r
+       return ERROR_OK;\r
+}\r
+\r
 int dummy_speed(int speed)\r
 {\r
        return ERROR_OK;\r
@@ -84,7 +117,7 @@ int dummy_register_commands(struct command_context_s *cmd_ctx)
 \r
 int dummy_init(void)\r
 {\r
-       bitbang_interface = &dummy_bitbang;     \r
+       bitbang_interface = &dummy_bitbang;\r
 \r
        return ERROR_OK;\r
 }\r