static int hexMode = HEXMODE;
-static const char trbcmd_version[] = "$Revision: 2.37 $";
+static const char trbcmd_version[] = "$Revision: 2.38 $";
/* ---- User Buffer Size ----------------------------------------------- */
"reload FPGA\n");
printf(" reset -> "
"reset TRBNetwork\n");
+ printf(" comreset -> "
+ "reset Etrax-FIFO Logic\n");
printf(" f <channel> -> "
"flush FIFO of channel\n");
printf(" R <register> -> "
fprintf(stderr, "Command: RESET:\n");
}
- if (fpga_register_write(0x10, 0x0000) == -1) {
+ if (network_reset() == -1) {
if (scriptFile != NULL) {
fprintf(stderr, "Line #%d: ", lineCtr);
}
- trb_error("fpga_register_write failed");
+ trb_error("TRBNet RESET failed");
exit(EXIT_FAILURE);
}
+
+ } else if (strncmp(cmd[0], "reset", CMD_SIZE) == 0) {
- if (fpga_register_write(0x10, 0x8000) == -1) {
+ /*******************************************/
+ /* Etrax-FIFO Reset */
+ /*******************************************/
+
+ if (cmdLen != 1) {
if (scriptFile != NULL) {
- fprintf(stderr, "Line #%d: ", lineCtr);
+ fprintf(stderr, "Line #%d: Invalid command\n", lineCtr);
+ } else {
+ usage(basename(argv[0]));
}
- trb_error("fpga_register_write failed");
exit(EXIT_FAILURE);
- } else {
- if (fpga_register_write(0x10, 0x0000) == -1) {
- if (scriptFile != NULL) {
- fprintf(stderr, "Line #%d: ", lineCtr);
- }
- trb_error("fpga_register_write failed");
- exit(EXIT_FAILURE);
- }
}
+ /* DEBUG Info */
+ if (trb_debug > 0) {
+ fprintf(stderr, "Command: COMRESET:\n");
+ }
+
+ if (com_reset() == -1) {
+ if (scriptFile != NULL) {
+ fprintf(stderr, "Line #%d: ", lineCtr);
+ }
+ trb_error("Etrax RESET failed");
+ exit(EXIT_FAILURE);
+ }
+
} else if (strncmp(cmd[0], "reload", CMD_SIZE) == 0) {
/*********************************************/
-const char trbnet_version[] = "$Revision: 2.49 $";
+const char trbnet_version[] = "$Revision: 2.50 $";
#include <stdio.h>
#include <stdlib.h>
return -1;
}
-static void com_reset()
-{
- setbitsPC(0x30000);
- clrbitsPC(0x30000);
-}
-
/* ------ Internal Functions -------------------------------------------- */
static void TRB_Package_dump(const TRB_Package* pkg)
return 0;
}
+
+int network_reset()
+{
+ trb_errno = TRB_NONE;
+
+ if (lockPorts() == -1) return -1;
+
+ /* DEBUG INFO */
+ if (trb_debug > 0) {
+ fprintf(stderr, "network_reset started.\n");
+ }
+
+ if (fpga_register_write(0x10, 0x0000) == -1) return -1;
+ if (fpga_register_write(0x10, 0x8000) == -1) return -1;
+ if (fpga_register_write(0x10, 0x0000) == -1) return -1;
+
+ if (unlockPorts() == -1) return -1;
+
+ return 0;
+}
+
+int com_reset()
+{
+ trb_errno = TRB_NONE;
+
+ if (lockPorts() == -1) return -1;
+
+ /* DEBUG INFO */
+ if (trb_debug > 0) {
+ fprintf(stderr, "com_reset started.\n");
+ }
+
+ setbitsPC(0x30000);
+ clrbitsPC(0x30000);
+
+ if (unlockPorts() == -1) return -1;
+
+ return 0;
+}