3 * Dirk Eibach, Guntermann & Drunck GmbH, dirk.eibach@gdsys.cc
7 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
9 * SPDX-License-Identifier: GPL-2.0+
16 #include <gdsys_fpga.h>
18 static uint dp_last_fpga;
19 static uint dp_last_addr;
20 static uint dp_last_length = 0x40;
26 * fpgad {fpga} {addr} {len}
28 #define DISP_LINE_LEN 16
29 int do_fpga_md(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
35 u16 linebuf[DISP_LINE_LEN/sizeof(u16)];
39 * We use the last specified parameters, unless new ones are
44 length = dp_last_length;
49 if ((flag & CMD_FLAG_REPEAT) == 0) {
51 * FPGA is specified since argc > 2
53 fpga = simple_strtoul(argv[1], NULL, 16);
56 * Address is specified since argc > 2
58 addr = simple_strtoul(argv[2], NULL, 16);
61 * If another parameter, it is the length to display.
62 * Length is the number of objects, not number of bytes.
65 length = simple_strtoul(argv[3], NULL, 16);
68 nbytes = length * sizeof(u16);
70 ulong linebytes = (nbytes > DISP_LINE_LEN) ?
71 DISP_LINE_LEN : nbytes;
73 for (k = 0; k < linebytes / sizeof(u16); ++k)
75 (u16 *)fpga_ptr[fpga] + addr
77 addr + k * sizeof(u16),
79 print_buffer(addr, (void *)linebuf, sizeof(u16),
80 linebytes / sizeof(u16),
81 DISP_LINE_LEN / sizeof(u16));
93 dp_last_length = length;
98 fpgad, 4, 1, do_fpga_md,
99 "fpga register display",
100 "fpga address [# of objects]"