Skip to content

Commit dd312f2

Browse files
vigneshraja123717root
authored andcommitted
graph working for eye
1 parent ace290c commit dd312f2

File tree

4 files changed

+32
-10
lines changed

4 files changed

+32
-10
lines changed

cli/diag.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -933,7 +933,7 @@ static int crosshair(int argc, char **argv)
933933
.y_range.step = 5,
934934
};
935935
const struct argconfig_options opts[] = {
936-
DEVICE_OPTION_OPTIONAL,
936+
DEVICE_OPTION,
937937
{"all", 'a', "", CFG_NONE, &cfg.all, no_argument,
938938
"capture all lanes, format must be csv"},
939939
{"crosshair", 'C', "FILE", CFG_FILE_R, &cfg.crosshair_file,
@@ -1094,7 +1094,6 @@ int eye_observe_dev(struct switchtec_dev *dev, unsigned int error_threshold,
10941094
switchtec_perror("eye_start");
10951095
}
10961096

1097-
printf("started\n");
10981097
ret = switchtec_diag_eye_fetch(dev, &data_out);
10991098

11001099
memcpy(&eye_data[0], &data_out, sizeof(struct switchtec_diag_port_eye_data));
@@ -1127,7 +1126,7 @@ static int eye(int argc, char **argv)
11271126
.v_step = 1,
11281127
};
11291128
const struct argconfig_options opts[] = {
1130-
DEVICE_OPTION_OPTIONAL,
1129+
DEVICE_OPTION,
11311130
{"format", 'f', "FMT", CFG_CHOICES, &cfg.fmt, required_argument,
11321131
"output format (default: " FMT_DEFAULT_STR ")",
11331132
.choices=output_fmt_choices},
@@ -1143,8 +1142,8 @@ static int eye(int argc, char **argv)
11431142

11441143
argconfig_parse(argc, argv, CMD_DESC_EYE, opts, &cfg,
11451144
sizeof(cfg));
1146-
1147-
ret = eye_observe_dev(cfg.dev, cfg.lane_id, cfg.error_threshold, &gen);
1145+
1146+
ret = eye_observe_dev(cfg.dev, cfg.error_threshold, cfg.lane_id, &gen);
11481147

11491148
return ret;
11501149
}

cli/graph.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,6 @@ void get_screen_coords(int x, int y, int *sx, int *sy) {
381381

382382
void plot_point(int x, int y)
383383
{
384-
printf("X %d Y %d\n", x, y);
385384
mvprintw(y/Y_SCALE, x*X_SCALE, "O (%d,%d)", x-Y_PRINT_OFFSET, y-X_PRINT_OFFSET);
386385
}
387386

inc/switchtec/diag.h

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,5 +279,30 @@ struct switchtec_diag_cross_hair_get {
279279
};
280280
};
281281

282+
typedef enum {
283+
/* command error code for Start, fetch and cancel */
284+
EOM_SUCCESS, /* EOM general result, means no error */
285+
286+
/* Error codes for EOM Start sub command */
287+
EOM_FAILED_TO_START, /* EOM Failed to Start*/
288+
EOM_INVALID_PARAMETER, /* EOM parameter error */
289+
EOM_PREV_CMD_NOT_FINISHED, /* EOM cmd error, the previous cmd has not finished */
290+
291+
/* Error codes for EOM Fetch Sub command */
292+
EOM_IN_PROGRESS, /* EOM in progress, but no output data yet */
293+
EOM_NOT_RUNNING, /*EOM Not running*/
294+
295+
/* Error codes for EOM Cancel sub command*/
296+
EOM_FAILED_TO_CANCEL, /*EOM Failed to cancel*/
297+
298+
/* error codes for EOM Running state machine*/
299+
EOM_SPEED_IS_NOT_GEN3_OR_4, /* EOM Speed is not Gen3 or 4*/
300+
EOM_MARGIN_CODE_OUT_OF_RANGE, /* EOM Margin code out of range*/
301+
EOM_WAITING_FOR_HARDWARE, /* EOM waiting for hardware*/
302+
303+
/*Invalid error code*/
304+
EOM_ERROR = 0xFF,
305+
} mrpc_stat_eom_enum;
306+
282307
#endif
283308
/**@}*/

lib/diag.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -231,17 +231,16 @@ int switchtec_diag_eye_fetch(struct switchtec_dev *dev, struct switchtec_diag_po
231231
if (ret)
232232
return ret;
233233

234-
printf("status %d\n", out.status);
235-
if(out.status > 9)
234+
if(out.status > EOM_WAITING_FOR_HARDWARE)
236235
{
237236
return ret;
238237
}
239238

240-
if (out.status == 4) {
239+
if (out.status == EOM_IN_PROGRESS) {
241240
usleep(5000);
242241
goto retry;
243242
}
244-
else if(out.status == 0)
243+
else if(out.status == EOM_SUCCESS)
245244
{
246245
printf("Eye Left %d\n", out.eye_left);
247246
printf("Eye Right %d\n", out.eye_right);

0 commit comments

Comments
 (0)