summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2009-06-26 12:57:56 +0000
committeroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2009-06-26 12:57:56 +0000
commit92db0c58b02d2a2cbc90a6e04a50ab97cb3e59a1 (patch)
tree0b101e8eb0881de0e498b1e9e8f58afad67546d5 /src
parent37b15fb2c4c1a0d8968d42bcc1a25ac8cf81ebb2 (diff)
downloadopenocd_libswd-92db0c58b02d2a2cbc90a6e04a50ab97cb3e59a1.tar.gz
openocd_libswd-92db0c58b02d2a2cbc90a6e04a50ab97cb3e59a1.tar.bz2
openocd_libswd-92db0c58b02d2a2cbc90a6e04a50ab97cb3e59a1.tar.xz
openocd_libswd-92db0c58b02d2a2cbc90a6e04a50ab97cb3e59a1.zip
zy1000 rev C work
git-svn-id: svn://svn.berlios.de/openocd/trunk@2405 b42882b7-edfa-0310-969c-e2dbd0fdcd60
Diffstat (limited to 'src')
-rw-r--r--src/jtag/zy1000/zy1000.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/src/jtag/zy1000/zy1000.c b/src/jtag/zy1000/zy1000.c
index 33947332..495ff48e 100644
--- a/src/jtag/zy1000/zy1000.c
+++ b/src/jtag/zy1000/zy1000.c
@@ -283,6 +283,14 @@ static int jim_zy1000_version(Jim_Interp *interp, int argc, Jim_Obj *const *argv
{
version_str = ZYLIN_DATE;
}
+ else if (strcmp("pcb", str) == 0)
+ {
+#ifdef CYGPKG_HAL_NIOS2
+ version_str="c";
+#else
+ version_str="b";
+#endif
+ }
else
{
return JIM_ERR;
@@ -295,6 +303,37 @@ static int jim_zy1000_version(Jim_Interp *interp, int argc, Jim_Obj *const *argv
}
+#ifdef CYGPKG_HAL_NIOS2
+static int jim_zy1000_writefirmware(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
+{
+ if (argc != 2)
+ return JIM_ERR;
+
+ int length;
+ int stat;
+ const char *str = Jim_GetString(argv[1], &length);
+
+ /* BUG!!!! skip header! */
+ void *firmware_address=0x4000000;
+ int firmware_length=0x100000;
+
+ if (length>firmware_length)
+ return JIM_ERR;
+
+ void *err_addr;
+
+ if ((stat = flash_erase((void *)firmware_address, firmware_length, (void **)&err_addr)) != 0)
+ {
+ return JIM_ERR;
+ }
+
+ if ((stat = flash_program(firmware_address, str, length, (void **)&err_addr)) != 0)
+ return JIM_ERR;
+
+ return JIM_OK;
+}
+#endif
+
static int
zylinjtag_Jim_Command_powerstatus(Jim_Interp *interp,
int argc,
@@ -324,6 +363,11 @@ int zy1000_register_commands(struct command_context_s *cmd_ctx)
Jim_CreateCommand(interp, "powerstatus", zylinjtag_Jim_Command_powerstatus, NULL, NULL);
+#ifdef CYGPKG_HAL_NIOS2
+ Jim_CreateCommand(interp, "updatezy1000firmware", jim_zy1000_writefirmware, NULL, NULL);
+#endif
+
+
return ERROR_OK;
}