3 * Stäubli Faverges - <www.staubli.com>
4 * Pierre AUBERT p.aubert@staubli.com
6 * See file CREDITS for list of people who contributed to this
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License as
11 * published by the Free Software Foundation; either version 2 of
12 * the License, or (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
34 /*-----------------------------------------------------------------------------
36 *-----------------------------------------------------------------------------
38 int do_fdosboot(cmd_tbl_t
*cmdtp
, int flag
, int argc
, char * const argv
[])
43 int drive
= CONFIG_SYS_FDC_DRIVE_NUMBER
;
45 /* pre-set load_addr */
46 if ((ep
= getenv("loadaddr")) != NULL
) {
47 load_addr
= simple_strtoul(ep
, NULL
, 16);
50 /* pre-set Boot file name */
51 if ((name
= getenv("bootfile")) == NULL
) {
59 /* only one arg - accept two forms:
60 * just load address, or just boot file name.
61 * The latter form must be written "filename" here.
63 if (argv
[1][0] == '"') { /* just boot filename */
65 } else { /* load address */
66 load_addr
= simple_strtoul(argv
[1], NULL
, 16);
70 load_addr
= simple_strtoul(argv
[1], NULL
, 16);
77 /* Init physical layer */
78 if (!fdc_fdos_init (drive
)) {
83 if (dos_open (name
) < 0) {
84 printf ("Unable to open %s\n", name
);
87 if ((size
= dos_read (load_addr
)) < 0) {
88 printf ("boot error\n");
91 flush_cache (load_addr
, size
);
93 setenv_hex("filesize", size
);
95 printf("Floppy DOS load complete: %d bytes loaded to 0x%lx\n",
98 return bootm_maybe_autostart(cmdtp
, argv
[0]);
101 /*-----------------------------------------------------------------------------
103 *-----------------------------------------------------------------------------
105 int do_fdosls(cmd_tbl_t
*cmdtp
, int flag
, int argc
, char * const argv
[])
108 int drive
= CONFIG_SYS_FDC_DRIVE_NUMBER
;
118 /* Init physical layer */
119 if (!fdc_fdos_init (drive
)) {
123 if (dos_open (path
) < 0) {
124 printf ("Unable to open %s\n", path
);
131 fdosboot
, 3, 0, do_fdosboot
,
132 "boot from a dos floppy file",
133 "[loadAddr] [filename]"
137 fdosls
, 2, 0, do_fdosls
,
138 "list files in a directory",