]>
git.ipfire.org Git - people/ms/u-boot.git/blob - common/cmd_fpgad.c
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+
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(cmd_tbl_t
*cmdtp
, int flag
, int argc
, char * const argv
[])
34 u16 linebuf
[DISP_LINE_LEN
/sizeof(u16
)];
37 * We use the last specified parameters, unless new ones are
42 length
= dp_last_length
;
47 if ((flag
& CMD_FLAG_REPEAT
) == 0) {
49 * FPGA is specified since argc > 2
51 fpga
= simple_strtoul(argv
[1], NULL
, 16);
54 * Address is specified since argc > 2
56 addr
= simple_strtoul(argv
[2], NULL
, 16);
59 * If another parameter, it is the length to display.
60 * Length is the number of objects, not number of bytes.
63 length
= simple_strtoul(argv
[3], NULL
, 16);
66 /* Print the lines. */
67 for (k
= 0; k
< DISP_LINE_LEN
/ sizeof(u16
); ++k
)
68 fpga_get_reg(fpga
, (u16
*)fpga_ptr
[fpga
] + k
, k
* sizeof(u16
),
70 print_buffer(addr
, (void *)linebuf
, sizeof(u16
),
71 length
, DISP_LINE_LEN
/ sizeof(u16
));
72 addr
+= sizeof(u16
)*length
;
76 dp_last_length
= length
;
81 fpgad
, 4, 1, do_fpga_md
,
82 "fpga register display",
83 "fpga address [# of objects]"