3 * Stäubli Faverges - <www.staubli.com>
4 * Pierre AUBERT p.aubert@staubli.com
6 * SPDX-License-Identifier: GPL-2.0+
18 /*-----------------------------------------------------------------------------
20 *-----------------------------------------------------------------------------
22 int do_fdosboot(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
27 int drive = CONFIG_SYS_FDC_DRIVE_NUMBER;
29 /* pre-set load_addr */
30 if ((ep = getenv("loadaddr")) != NULL) {
31 load_addr = simple_strtoul(ep, NULL, 16);
34 /* pre-set Boot file name */
35 if ((name = getenv("bootfile")) == NULL) {
43 /* only one arg - accept two forms:
44 * just load address, or just boot file name.
45 * The latter form must be written "filename" here.
47 if (argv[1][0] == '"') { /* just boot filename */
49 } else { /* load address */
50 load_addr = simple_strtoul(argv[1], NULL, 16);
54 load_addr = simple_strtoul(argv[1], NULL, 16);
61 /* Init physical layer */
62 if (!fdc_fdos_init (drive)) {
67 if (dos_open (name) < 0) {
68 printf ("Unable to open %s\n", name);
71 if ((size = dos_read (load_addr)) < 0) {
72 printf ("boot error\n");
75 flush_cache (load_addr, size);
77 setenv_hex("filesize", size);
79 printf("Floppy DOS load complete: %d bytes loaded to 0x%lx\n",
82 return bootm_maybe_autostart(cmdtp, argv[0]);
85 /*-----------------------------------------------------------------------------
87 *-----------------------------------------------------------------------------
89 int do_fdosls(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
92 int drive = CONFIG_SYS_FDC_DRIVE_NUMBER;
102 /* Init physical layer */
103 if (!fdc_fdos_init (drive)) {
107 if (dos_open (path) < 0) {
108 printf ("Unable to open %s\n", path);
115 fdosboot, 3, 0, do_fdosboot,
116 "boot from a dos floppy file",
117 "[loadAddr] [filename]"
121 fdosls, 2, 0, do_fdosls,
122 "list files in a directory",