diff options
author | mifi <mifi@b42882b7-edfa-0310-969c-e2dbd0fdcd60> | 2007-12-18 21:20:28 +0000 |
---|---|---|
committer | mifi <mifi@b42882b7-edfa-0310-969c-e2dbd0fdcd60> | 2007-12-18 21:20:28 +0000 |
commit | 02f3765351c9e25185b745b84f1a2604fb2149c7 (patch) | |
tree | 81331db01e68baf67bc2cc271b1f1ed2a6962d76 /src/jtag/parport.c | |
parent | ed1e9d6abdece4fbf6251a11f0eca3c921221048 (diff) | |
download | riscv-openocd-02f3765351c9e25185b745b84f1a2604fb2149c7.zip riscv-openocd-02f3765351c9e25185b745b84f1a2604fb2149c7.tar.gz riscv-openocd-02f3765351c9e25185b745b84f1a2604fb2149c7.tar.bz2 |
- added patch for new flash functionality like:
flash verify_image and flash erase_address.
- added patch for new parport_write_on_exit command.
Even this patch will fix some memory leaks.
(thanks too oyvind and Spen for these patches)
git-svn-id: svn://svn.berlios.de/openocd/trunk@240 b42882b7-edfa-0310-969c-e2dbd0fdcd60
Diffstat (limited to 'src/jtag/parport.c')
-rw-r--r-- | src/jtag/parport.c | 38 |
1 files changed, 33 insertions, 5 deletions
diff --git a/src/jtag/parport.c b/src/jtag/parport.c index b666eb1..7ed95d8 100644 --- a/src/jtag/parport.c +++ b/src/jtag/parport.c @@ -120,8 +120,9 @@ cable_t cables[] = }; /* configuration */ -char* parport_cable; +char* parport_cable = NULL; unsigned long parport_port; +static int parport_exit = 0; /* interface variables */ @@ -150,6 +151,7 @@ int parport_quit(void); /* interface commands */ int parport_handle_parport_port_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); int parport_handle_parport_cable_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); +int parport_handle_write_on_exit_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); jtag_interface_t parport_interface = { @@ -249,7 +251,6 @@ void parport_reset(int trst, int srst) /* turn LED on parport adapter on (1) or off (0) */ void parport_led(int on) { - u8 output; if (on) dataport_value |= cable->LED_MASK; else @@ -271,6 +272,8 @@ int parport_register_commands(struct command_context_s *cmd_ctx) COMMAND_CONFIG, NULL); register_command(cmd_ctx, NULL, "parport_cable", parport_handle_parport_cable_command, COMMAND_CONFIG, NULL); + register_command(cmd_ctx, NULL, "parport_write_on_exit", parport_handle_write_on_exit_command, + COMMAND_CONFIG, NULL); return ERROR_OK; } @@ -429,11 +432,20 @@ int parport_init(void) int parport_quit(void) { - u8 output; parport_led(0); - dataport_value = cable->PORT_EXIT; - parport_write_data(); + if (parport_exit) + { + dataport_value = cable->PORT_EXIT; + parport_write_data(); + } + + if (parport_cable) + { + free(parport_cable); + parport_cable = NULL; + } + return ERROR_OK; } @@ -463,3 +475,19 @@ int parport_handle_parport_cable_command(struct command_context_s *cmd_ctx, char return ERROR_OK; } + +int parport_handle_write_on_exit_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +{ + if (argc != 1) + { + command_print(cmd_ctx, "usage: parport_write_on_exit <on|off>"); + return ERROR_OK; + } + + if (strcmp(args[0], "on") == 0) + parport_exit = 1; + else if (strcmp(args[0], "off") == 0) + parport_exit = 0; + + return ERROR_OK; +} |