Skip to content

Commit

Permalink
utils: Support resetting RX and TX separately
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Forencich <alex@alexforencich.com>
  • Loading branch information
alexforencich committed Dec 7, 2023
1 parent a1843c6 commit 7686f72
Showing 1 changed file with 23 additions and 6 deletions.
29 changes: 23 additions & 6 deletions utils/mqnic-xcvr.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ static void usage(char *name)
" -m number GT channel mask\n"
" -p preset Load channel preset\n"
" -r Read registers\n"
" -t Reset channels\n"
" -t [side] Reset channels (tx, rx, txrx, default txrx)\n"
" -c file Run eye scan and write CSV\n",
name);
}
Expand All @@ -44,7 +44,7 @@ int main(int argc, char *argv[])
name = strrchr(argv[0], '/');
name = name ? 1+name : argv[0];

while ((opt = getopt(argc, argv, "d:i:m:p:rtc:h?")) != EOF)
while ((opt = getopt(argc, argv, ":d:i:m:p:rt:c:h?")) != EOF)
{
switch (opt)
{
Expand All @@ -64,16 +64,31 @@ int main(int argc, char *argv[])
channel_read_regs = 1;
break;
case 't':
channel_reset = 1;
if (strstr(optarg, "tx"))
channel_reset |= 1;
if (strstr(optarg, "rx"))
channel_reset |= 2;
break;
case 'c':
csv_file_name = optarg;
break;
case ':':
switch (optopt)
{
case 't':
channel_reset = 3;
break;
default:
fprintf(stderr, "%s: option requires an argument -- '%c'\n", argv[0], optopt);
usage(name);
return -1;
}
case 'h':
case '?':
usage(name);
return 0;
case '?':
default:
fprintf(stderr, "%s: invalid option: -- '%c'\n", argv[0], optopt);
usage(name);
return -1;
}
Expand Down Expand Up @@ -239,8 +254,10 @@ int main(int argc, char *argv[])
if (channel_reset)
{
printf("Resetting channel %d\n", index);
gt_ch_rx_reset(ch);
gt_ch_tx_reset(ch);
if (channel_reset & 1)
gt_ch_tx_reset(ch);
if (channel_reset & 2)
gt_ch_rx_reset(ch);
}
}
}
Expand Down

0 comments on commit 7686f72

Please sign in to comment.