1 // SPDX-License-Identifier: GPL-2.0+
4 * Dirk Eibach, Guntermann & Drunck GmbH, dirk.eibach@gdsys.cc
8 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
15 #include <gdsys_fpga.h>
17 static uint dp_last_fpga;
18 static uint dp_last_addr;
19 static uint dp_last_length = 0x40;
25 * fpgad {fpga} {addr} {len}
27 #define DISP_LINE_LEN 16
28 int do_fpga_md(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
34 u16 linebuf[DISP_LINE_LEN/sizeof(u16)];
38 * We use the last specified parameters, unless new ones are
43 length = dp_last_length;
48 if ((flag & CMD_FLAG_REPEAT) == 0) {
50 * FPGA is specified since argc > 2
52 fpga = hextoul(argv[1], NULL);
55 * Address is specified since argc > 2
57 addr = hextoul(argv[2], NULL);
60 * If another parameter, it is the length to display.
61 * Length is the number of objects, not number of bytes.
64 length = hextoul(argv[3], NULL);
67 nbytes = length * sizeof(u16);
69 ulong linebytes = (nbytes > DISP_LINE_LEN) ?
70 DISP_LINE_LEN : nbytes;
72 for (k = 0; k < linebytes / sizeof(u16); ++k)
74 (u16 *)fpga_ptr[fpga] + addr
76 addr + k * sizeof(u16),
78 print_buffer(addr, (void *)linebuf, sizeof(u16),
79 linebytes / sizeof(u16),
80 DISP_LINE_LEN / sizeof(u16));
92 dp_last_length = length;
97 fpgad, 4, 1, do_fpga_md,
98 "fpga register display",
99 "fpga address [# of objects]"