3 * Dirk Eibach, Guntermann & Drunck GmbH, dirk.eibach@gdsys.cc
7 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
9 * See file CREDITS for list of people who contributed to this
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License as
14 * published by the Free Software Foundation; either version 2 of
15 * the License, or (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
31 #include <gdsys_fpga.h>
33 static uint dp_last_fpga;
34 static uint dp_last_addr;
35 static uint dp_last_length = 0x40;
41 * fpgad {fpga} {addr} {len}
43 #define DISP_LINE_LEN 16
44 int do_fpga_md(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
50 u16 linebuf[DISP_LINE_LEN/sizeof(u16)];
53 * We use the last specified parameters, unless new ones are
58 length = dp_last_length;
63 if ((flag & CMD_FLAG_REPEAT) == 0) {
65 * FPGA is specified since argc > 2
67 fpga = simple_strtoul(argv[1], NULL, 16);
70 * Address is specified since argc > 2
72 addr = simple_strtoul(argv[2], NULL, 16);
75 * If another parameter, it is the length to display.
76 * Length is the number of objects, not number of bytes.
79 length = simple_strtoul(argv[3], NULL, 16);
82 /* Print the lines. */
83 for (k = 0; k < DISP_LINE_LEN / sizeof(u16); ++k)
84 fpga_get_reg(fpga, (u16 *)fpga_ptr[fpga] + k, k * sizeof(u16),
86 print_buffer(addr, (void *)linebuf, sizeof(u16),
87 length, DISP_LINE_LEN / sizeof(u16));
88 addr += sizeof(u16)*length;
92 dp_last_length = length;
97 fpgad, 4, 1, do_fpga_md,
98 "fpga register display",
99 "fpga address [# of objects]"