aboutsummaryrefslogtreecommitdiff
path: root/src/server
diff options
context:
space:
mode:
authorFranck Jullien <franck.jullien@gmail.com>2014-05-30 16:49:42 +0200
committerAndreas Fritiofson <andreas.fritiofson@gmail.com>2014-06-22 08:39:08 +0000
commit712165f4831afed3a1410579d2e708581e4356fb (patch)
tree7c7309d12057aaa79d8701a862a134c37780c2b0 /src/server
parentfd9f27bfac1dd9a661913c31774edf4f8cd0798c (diff)
downloadriscv-openocd-712165f4831afed3a1410579d2e708581e4356fb.zip
riscv-openocd-712165f4831afed3a1410579d2e708581e4356fb.tar.gz
riscv-openocd-712165f4831afed3a1410579d2e708581e4356fb.tar.bz2
openrisc: add support for JTAG Serial Port
Change-Id: I623a8c74bcca2edb5f996b69c02d73a6f67b7d34 Signed-off-by: Franck Jullien <franck.jullien@gmail.com> Reviewed-on: http://openocd.zylin.com/2162 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Diffstat (limited to 'src/server')
-rw-r--r--src/server/server.c31
1 files changed, 29 insertions, 2 deletions
diff --git a/src/server/server.c b/src/server/server.c
index 5169319..7fbceb1 100644
--- a/src/server/server.c
+++ b/src/server/server.c
@@ -31,6 +31,7 @@
#include "server.h"
#include <target/target.h>
#include <target/target_request.h>
+#include <target/openrisc/jsp_server.h>
#include "openocd.h"
#include "tcl_server.h"
#include "telnet_server.h"
@@ -46,6 +47,9 @@ static struct service *services;
/* shutdown_openocd == 1: exit the main event loop, and quit the debugger */
static int shutdown_openocd;
+/* set the polling period to 100ms */
+static int polling_period = 100;
+
static int add_connection(struct service *service, struct command_context *cmd_ctx)
{
socklen_t address_size;
@@ -380,8 +384,8 @@ int server_loop(struct command_context *command_context)
tv.tv_usec = 0;
retval = socket_select(fd_max + 1, &read_fds, NULL, NULL, &tv);
} else {
- /* Every 100ms */
- tv.tv_usec = 100000;
+ /* Every 100ms, can be changed with "poll_period" command */
+ tv.tv_usec = polling_period * 1000;
/* Only while we're sleeping we'll let others run */
openocd_sleep_prelude();
kept_alive();
@@ -588,6 +592,18 @@ COMMAND_HANDLER(handle_shutdown_command)
return ERROR_OK;
}
+COMMAND_HANDLER(handle_poll_period_command)
+{
+ if (CMD_ARGC == 0)
+ LOG_WARNING("You need to set a period value");
+ else
+ COMMAND_PARSE_NUMBER(int, CMD_ARGV[0], polling_period);
+
+ LOG_INFO("set servers polling period to %ums", polling_period);
+
+ return ERROR_OK;
+}
+
static const struct command_registration server_command_handlers[] = {
{
.name = "shutdown",
@@ -596,6 +612,13 @@ static const struct command_registration server_command_handlers[] = {
.usage = "",
.help = "shut the server down",
},
+ {
+ .name = "poll_period",
+ .handler = &handle_poll_period_command,
+ .mode = COMMAND_ANY,
+ .usage = "",
+ .help = "set the servers polling period",
+ },
COMMAND_REGISTRATION_DONE
};
@@ -609,6 +632,10 @@ int server_register_commands(struct command_context *cmd_ctx)
if (ERROR_OK != retval)
return retval;
+ retval = jsp_register_commands(cmd_ctx);
+ if (ERROR_OK != retval)
+ return retval;
+
return register_commands(cmd_ctx, NULL, server_command_handlers);
}