#include "config.h"
#endif
-#include "jtag.h"
+#include <jtag/jtag.h>
#include "svf.h"
-#include "time_support.h"
+#include <helper/time_support.h>
// SVF command
#define SVFP_CMD_INC_CNT 1024
static int svf_read_command_from_file(int fd)
{
- char ch, *tmp_buffer = NULL;
+ unsigned char ch;
+ char *tmp_buffer = NULL;
int cmd_pos = 0, cmd_ok = 0, slash = 0, comment = 0;
while (!cmd_ok && (read(fd, &ch, 1) > 0))
return ERROR_FAIL;
}
}
- // no need to keep this memory, in jtag_add_pathmove, path will be duplicated
- if (NULL != path)
- {
- free(path);
- path = NULL;
- }
+
+ free(path);
+ path = NULL;
}
else
{
return ERROR_OK;
}
+static const struct command_registration svf_command_handlers[] = {
+ {
+ .name = "svf",
+ .handler = &handle_svf_command,
+ .mode = COMMAND_EXEC,
+ .help = "Runs a SVF file.",
+ .usage = "<file>",
+ },
+ COMMAND_REGISTRATION_DONE
+};
+
int svf_register_commands(struct command_context *cmd_ctx)
{
- register_command(cmd_ctx, NULL, "svf",
- &handle_svf_command, COMMAND_EXEC,
- "run svf <file>");
-
- return ERROR_OK;
+ return register_commands(cmd_ctx, NULL, svf_command_handlers);
}