#include <jtag/jtag.h>
#include <helper/ioutil.h>
#include <helper/configuration.h>
-#include <xsvf/xsvf.h>
-#include <svf/svf.h>
-#include <flash/nand.h>
-#include <pld/pld.h>
#include <server/server.h>
#include <server/telnet_server.h>
#include <openocd.h>
#include <helper/time_support.h>
+
#include <sys/time.h>
#include <stdio.h>
#include <stdlib.h>
#include <cyg/athttpd/cgi.h>
#include <cyg/athttpd/forms.h>
#include <cyg/discover/discover.h>
-#include <cyg/hal/hal_diag.h>
-#include <cyg/kernel/kapi.h>
-#include <cyg/io/serialio.h>
#include <cyg/io/io.h>
+#include <cyg/io/serialio.h>
#include <netinet/tcp.h>
-#include "rom.h"
-#include <sys/ioctl.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <net/if.h>
-#include <arpa/inet.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netdb.h>
-#include <netinet/in.h>
-#include <unistd.h>
-#include <arpa/inet.h>
-#include <stdio.h>
-#include <ifaddrs.h>
-#include <string.h>
-
-#include <unistd.h>
-#include <stdio.h>
+#include <cyg/hal/hal_diag.h>
-#include <openocd.h>
+#include "rom.h"
#ifdef CYGPKG_HAL_NIOS2
+#include <cyg/hal/io.h>
#define ZY1000_SER_DEV "/dev/uart_0"
#else
#define ZY1000_SER_DEV "/dev/ser0"
diag_printf("Unmounting /config..\n");
umount("/config");
diag_printf("Rebooting..\n");
+#ifdef CYGPKG_HAL_NIOS2
+ /* This will reboot & reconfigure the FPGA from the bootloader
+ * and on.
+ */
+ IOWR(REMOTE_UPDATE_BASE, 0x20, 0x1);
+#else
HAL_PLATFORM_RESET();
+#endif
}
static cyg_thread zylinjtag_thread_object;
static cyg_handle_t zylinjtag_thread_handle;
}
#ifdef CYGPKG_PROFILE_GPROF
+//extern int64_t totaltime;
-int eCosBoard_handle_eCosBoard_profile_command(struct command_context *cmd_ctx, char *cmd, char **args, int argc)
+static int zylinjtag_Jim_Command_profile(Jim_Interp *interp, int argc,
+ Jim_Obj * const *argv)
{
- command_print(cmd_ctx, "Profiling started");
- start_profile();
+ if ((argc == 2) && (strcmp(Jim_GetString(argv[1], NULL), "stats")==0))
+ {
+// profile_off();
+ //LOG_USER("Stats %dms sleeping in select()", (int)totaltime);
+ } else
+ {
+ LOG_USER("Profiling started");
+ start_profile();
+ //totaltime = 0;
+ }
return ERROR_OK;
}
copydir("/rom", "/ram/cgi");
+#ifdef CYGPKG_HAL_NIOS2
+ cyg_flashaddr_t err_address;
+#define UNCACHED_EXT_FLASH_BASE (0x80000000 + EXT_FLASH_BASE)
+ /* The revc flash is locked upon reset, unlock it */
+#ifdef CYGHWR_IO_FLASH_BLOCK_LOCKING
+ if ((err = flash_unlock((void *) UNCACHED_EXT_FLASH_BASE, EXT_FLASH_SPAN,
+ (void **) &err_address)) != 0)
+ {
+ diag_printf("Error: could not unlock flash\n");
+ }
+#endif
+#endif
+
+
err = mount("/dev/flash1", "/config", "jffs2");
if (err < 0)
{
return EXIT_FAILURE;
#ifdef CYGPKG_PROFILE_GPROF
- COMMAND_REGISTER(cmd_ctx, NULL, "ecosboard_profile", eCosBoard_handle_eCosBoard_profile_command,
- COMMAND_ANY, NULL);
+ Jim_CreateCommand(httpstate.jim_interp, "zy1000_profile", zylinjtag_Jim_Command_profile,
+ NULL, NULL);
#endif
- Jim_CreateCommand(httpstate.jim_interp, "uart", zylinjtag_Jim_Command_uart, NULL, NULL);
+ Jim_CreateCommand(httpstate.jim_interp, "zy1000_uart", zylinjtag_Jim_Command_uart, NULL, NULL);
log_init();