1 // SPDX-License-Identifier: GPL-2.0+
4 * Ramon Fried <rfried.dev@gmail.com>
12 static int do_pcap_init(struct cmd_tbl *cmdtp, int flag, int argc,
21 addr = simple_strtoul(argv[1], NULL, 16);
22 size = simple_strtoul(argv[2], NULL, 10);
24 return pcap_init(addr, size) ? CMD_RET_FAILURE : CMD_RET_SUCCESS;
27 static int do_pcap_start(struct cmd_tbl *cmdtp, int flag, int argc,
30 return pcap_start_stop(true) ? CMD_RET_FAILURE : CMD_RET_SUCCESS;
33 static int do_pcap_stop(struct cmd_tbl *cmdtp, int flag, int argc,
36 return pcap_start_stop(false) ? CMD_RET_FAILURE : CMD_RET_SUCCESS;
39 static int do_pcap_status(struct cmd_tbl *cmdtp, int flag, int argc,
42 return pcap_print_status() ? CMD_RET_FAILURE : CMD_RET_SUCCESS;
45 static int do_pcap_clear(struct cmd_tbl *cmdtp, int flag, int argc,
48 return pcap_clear() ? CMD_RET_FAILURE : CMD_RET_SUCCESS;
51 static char pcap_help_text[] =
52 "- network packet capture\n\n"
54 "pcap init\t\t\t<addr> <max_size>\n"
55 "pcap start\t\t\tstart capture\n"
56 "pcap stop\t\t\tstop capture\n"
57 "pcap status\t\t\tprint status\n"
58 "pcap clear\t\t\tclear capture buffer\n"
61 "\t<addr>: user address to which pcap will be stored (hexedcimal)\n"
62 "\t<max_size>: Maximum size of pcap file (decimal)\n"
65 U_BOOT_CMD_WITH_SUBCMDS(pcap, "pcap", pcap_help_text,
66 U_BOOT_SUBCMD_MKENT(init, 3, 0, do_pcap_init),
67 U_BOOT_SUBCMD_MKENT(start, 1, 0, do_pcap_start),
68 U_BOOT_SUBCMD_MKENT(stop, 1, 0, do_pcap_stop),
69 U_BOOT_SUBCMD_MKENT(status, 1, 0, do_pcap_status),
70 U_BOOT_SUBCMD_MKENT(clear, 1, 0, do_pcap_clear),