]>
git.ipfire.org Git - people/ms/u-boot.git/blob - common/cmd_dcr.c
3 * Erik Theisen, Wave 7 Optics, etheisen@mindspring.com.
5 * See file CREDITS for list of people who contributed to this
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
25 * AMCC 4XX DCR Functions
32 #if defined(CONFIG_4xx) && (CONFIG_COMMANDS & CFG_CMD_SETGETDCR)
34 /* =======================================================================
35 * Interpreter command to retrieve an AMCC PPC 4xx Device Control Register
36 * =======================================================================
38 int do_getdcr ( cmd_tbl_t
*cmdtp
, int flag
, int argc
, char *argv
[] )
40 unsigned short dcrn
; /* Device Control Register Num */
41 unsigned long value
; /* DCR's value */
43 unsigned long get_dcr (unsigned short);
45 /* Validate arguments */
47 printf ("Usage:\n%s\n", cmdtp
->usage
);
52 dcrn
= (unsigned short) simple_strtoul (argv
[1], NULL
, 16);
53 value
= get_dcr (dcrn
);
55 printf ("%04x: %08lx\n", dcrn
, value
);
61 /* ======================================================================
62 * Interpreter command to set an AMCC PPC 4xx Device Control Register
63 * ======================================================================
65 int do_setdcr (cmd_tbl_t
* cmdtp
, int flag
, int argc
, char *argv
[])
67 unsigned long get_dcr (unsigned short);
68 unsigned long set_dcr (unsigned short, unsigned long);
69 unsigned short dcrn
; /* Device Control Register Num */
74 extern char console_buffer
[];
76 /* Validate arguments */
78 printf ("Usage:\n%s\n", cmdtp
->usage
);
83 dcrn
= (unsigned short) simple_strtoul (argv
[1], NULL
, 16);
85 value
= get_dcr (dcrn
);
86 printf ("%04x: %08lx", dcrn
, value
);
87 nbytes
= readline (" ? ");
90 * <CR> pressed as only input, don't modify current
91 * location and exit command.
99 i
= simple_strtoul (console_buffer
, &endp
, 16);
100 nbytes
= endp
- console_buffer
;
109 /***************************************************/
112 getdcr
, 2, 1, do_getdcr
,
113 "getdcr - Get an AMCC PPC 4xx DCR's value\n",
114 "dcrn - return a DCR's value.\n"
117 setdcr
, 2, 1, do_setdcr
,
118 "setdcr - Set an AMCC PPC 4xx DCR's value\n",
119 "dcrn - set a DCR's value.\n"
122 #endif /* CONFIG_4xx & CFG_CMD_SETGETDCR */