]>
git.ipfire.org Git - thirdparty/u-boot.git/blob - cmd/load.c
1 // SPDX-License-Identifier: GPL-2.0+
3 * (C) Copyright 2000-2004
4 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
8 * Serial up- and download support
14 #include <efi_loader.h>
17 #ifdef CONFIG_MTD_NOR_FLASH
27 #include <asm/cache.h>
28 #include <asm/global_data.h>
29 #include <linux/delay.h>
31 DECLARE_GLOBAL_DATA_PTR
;
33 #if defined(CONFIG_CMD_LOADB)
34 static ulong
load_serial_ymodem(ulong offset
, int mode
);
37 #if defined(CONFIG_CMD_LOADS)
38 static ulong
load_serial(long offset
);
39 static int read_record(char *buf
, ulong len
);
40 # if defined(CONFIG_CMD_SAVES)
41 static int save_serial(ulong offset
, ulong size
);
42 static int write_record(char *buf
);
45 static int do_echo
= 1;
48 /* -------------------------------------------------------------------- */
50 #if defined(CONFIG_CMD_LOADS)
51 static int do_load_serial(struct cmd_tbl
*cmdtp
, int flag
, int argc
,
59 #ifdef CONFIG_SYS_LOADS_BAUD_CHANGE
60 int load_baudrate
, current_baudrate
;
62 load_baudrate
= current_baudrate
= gd
->baudrate
;
65 env_echo
= env_get("loads_echo");
66 if (env_echo
&& *env_echo
== '1')
71 #ifdef CONFIG_SYS_LOADS_BAUD_CHANGE
73 offset
= simple_strtol(argv
[1], NULL
, 16);
76 load_baudrate
= (int)dectoul(argv
[2], NULL
);
78 /* default to current baudrate */
79 if (load_baudrate
== 0)
80 load_baudrate
= current_baudrate
;
82 if (load_baudrate
!= current_baudrate
) {
83 printf("## Switch baudrate to %d bps and press ENTER ...\n",
87 gd
->baudrate
= load_baudrate
;
91 if (getchar() == '\r')
95 #else /* ! CONFIG_SYS_LOADS_BAUD_CHANGE */
97 offset
= simple_strtol(argv
[1], NULL
, 16);
99 #endif /* CONFIG_SYS_LOADS_BAUD_CHANGE */
101 printf("## Ready for S-Record download ...\n");
103 addr
= load_serial(offset
);
106 * Gather any trailing characters (for instance, the ^D which
107 * is sent by 'cu' after sending a file), and give the
108 * box some time (100 * 1 ms)
110 for (i
=0; i
<100; ++i
) {
118 printf("## S-Record download aborted\n");
121 printf("## Start Addr = 0x%08lX\n", addr
);
122 image_load_addr
= addr
;
125 #ifdef CONFIG_SYS_LOADS_BAUD_CHANGE
126 if (load_baudrate
!= current_baudrate
) {
127 printf("## Switch baudrate to %d bps and press ESC ...\n",
131 gd
->baudrate
= current_baudrate
;
135 if (getchar() == 0x1B) /* ESC */
143 static ulong
load_serial(long offset
)
146 char record
[SREC_MAXRECLEN
+ 1]; /* buffer for one S-Record */
147 char binbuf
[SREC_MAXBINLEN
]; /* buffer for binary data */
148 int binlen
; /* no. of data bytes in S-Rec. */
149 int type
; /* return code for record type */
150 ulong addr
; /* load address from S-Record */
151 ulong size
; /* number of bytes transferred */
153 ulong start_addr
= ~0;
158 lmb_init_and_reserve(&lmb
, gd
->bd
, (void *)gd
->fdt_blob
);
160 while (read_record(record
, SREC_MAXRECLEN
+ 1) >= 0) {
161 type
= srec_decode(record
, &binlen
, &addr
, binbuf
);
164 return (~0); /* Invalid S-Record */
171 store_addr
= addr
+ offset
;
172 #ifdef CONFIG_MTD_NOR_FLASH
173 if (addr2info(store_addr
)) {
176 rc
= flash_write((char *)binbuf
,store_addr
,binlen
);
186 ret
= lmb_reserve(&lmb
, store_addr
, binlen
);
188 printf("\nCannot overwrite reserved area (%08lx..%08lx)\n",
189 store_addr
, store_addr
+ binlen
);
192 dst
= map_sysmem(store_addr
, binlen
);
193 memcpy(dst
, binbuf
, binlen
);
195 lmb_free(&lmb
, store_addr
, binlen
);
197 if ((store_addr
) < start_addr
)
198 start_addr
= store_addr
;
199 if ((store_addr
+ binlen
- 1) > end_addr
)
200 end_addr
= store_addr
+ binlen
- 1;
206 size
= end_addr
- start_addr
+ 1;
208 "## First Load Addr = 0x%08lX\n"
209 "## Last Load Addr = 0x%08lX\n"
210 "## Total Size = 0x%08lX = %ld Bytes\n",
211 start_addr
, end_addr
, size
, size
213 flush_cache(start_addr
, size
);
214 env_set_hex("filesize", size
);
221 if (!do_echo
) { /* print a '.' every 100 lines */
222 if ((++line_count
% 100) == 0)
227 return (~0); /* Download aborted */
230 static int read_record(char *buf
, ulong len
)
235 --len
; /* always leave room for terminating '\0' byte */
237 for (p
=buf
; p
< buf
+len
; ++p
) {
238 c
= getchar(); /* read character */
240 putc(c
); /* ... and echo it */
248 case 0x03: /* ^C - Control C */
254 /* Check for the console hangup (if any different from serial) */
255 if (gd
->jt
->getc
!= getchar
) {
261 /* line too long - truncate */
266 #if defined(CONFIG_CMD_SAVES)
268 int do_save_serial(struct cmd_tbl
*cmdtp
, int flag
, int argc
,
273 #ifdef CONFIG_SYS_LOADS_BAUD_CHANGE
274 int save_baudrate
, current_baudrate
;
276 save_baudrate
= current_baudrate
= gd
->baudrate
;
280 offset
= hextoul(argv
[1], NULL
);
282 #ifdef CONFIG_SYS_LOADS_BAUD_CHANGE
284 size
= hextoul(argv
[2], NULL
);
287 save_baudrate
= (int)dectoul(argv
[3], NULL
);
289 /* default to current baudrate */
290 if (save_baudrate
== 0)
291 save_baudrate
= current_baudrate
;
293 if (save_baudrate
!= current_baudrate
) {
294 printf("## Switch baudrate to %d bps and press ENTER ...\n",
297 gd
->baudrate
= save_baudrate
;
301 if (getchar() == '\r')
305 #else /* ! CONFIG_SYS_LOADS_BAUD_CHANGE */
307 size
= hextoul(argv
[2], NULL
);
309 #endif /* CONFIG_SYS_LOADS_BAUD_CHANGE */
311 printf("## Ready for S-Record upload, press ENTER to proceed ...\n");
313 if (getchar() == '\r')
316 if (save_serial(offset
, size
)) {
317 printf("## S-Record upload aborted\n");
319 printf("## S-Record upload complete\n");
321 #ifdef CONFIG_SYS_LOADS_BAUD_CHANGE
322 if (save_baudrate
!= current_baudrate
) {
323 printf("## Switch baudrate to %d bps and press ESC ...\n",
324 (int)current_baudrate
);
327 gd
->baudrate
= current_baudrate
;
331 if (getchar() == 0x1B) /* ESC */
339 #define SREC3_START "S0030000FC\n"
340 #define SREC3_FORMAT "S3%02X%08lX%s%02X\n"
341 #define SREC3_END "S70500000000FA\n"
342 #define SREC_BYTES_PER_RECORD 16
344 static int save_serial(ulong address
, ulong count
)
346 int i
, c
, reclen
, checksum
, length
;
347 char *hex
= "0123456789ABCDEF";
348 char record
[2*SREC_BYTES_PER_RECORD
+16]; /* buffer for one S-Record */
349 char data
[2*SREC_BYTES_PER_RECORD
+1]; /* buffer for hex data */
354 if(write_record(SREC3_START
)) /* write the header */
359 src
= map_sysmem(address
, count
);
360 if (count
) { /* collect hex data in the buffer */
361 c
= src
[reclen
]; /* get one byte */
362 checksum
+= c
; /* accumulate checksum */
363 data
[2*reclen
] = hex
[(c
>>4)&0x0f];
364 data
[2*reclen
+1] = hex
[c
& 0x0f];
365 data
[2*reclen
+2] = '\0';
369 unmap_sysmem((void *)src
);
370 if(reclen
== SREC_BYTES_PER_RECORD
|| count
== 0) {
371 /* enough data collected for one record: dump it */
372 if(reclen
) { /* build & write a data record: */
373 /* address + data + checksum */
374 length
= 4 + reclen
+ 1;
376 /* accumulate length bytes into checksum */
377 for(i
= 0; i
< 2; i
++)
378 checksum
+= (length
>> (8*i
)) & 0xff;
380 /* accumulate address bytes into checksum: */
381 for(i
= 0; i
< 4; i
++)
382 checksum
+= (address
>> (8*i
)) & 0xff;
384 /* make proper checksum byte: */
385 checksum
= ~checksum
& 0xff;
387 /* output one record: */
388 sprintf(record
, SREC3_FORMAT
, length
, address
, data
, checksum
);
389 if(write_record(record
))
392 address
+= reclen
; /* increment address */
398 if(write_record(SREC3_END
)) /* write the final record */
403 static int write_record(char *buf
)
410 /* Check for the console hangup (if any different from serial) */
422 #if defined(CONFIG_CMD_LOADB)
424 * loadb command (load binary) included
428 #define START_CHAR 0x01
429 #define ETX_CHAR 0x03
430 #define END_CHAR 0x0D
432 #define K_ESCAPE 0x23
433 #define SEND_TYPE 'S'
434 #define DATA_TYPE 'D'
436 #define NACK_TYPE 'N'
437 #define BREAK_TYPE 'B'
438 #define tochar(x) ((char) (((x) + SPACE) & 0xff))
439 #define untochar(x) ((int) (((x) - SPACE) & 0xff))
441 static void set_kerm_bin_mode(unsigned long *);
442 static int k_recv(void);
443 static ulong
load_serial_bin(ulong offset
);
446 static char his_eol
; /* character he needs at end of packet */
447 static int his_pad_count
; /* number of pad chars he needs */
448 static char his_pad_char
; /* pad chars he needs */
449 static char his_quote
; /* quote chars he'll use */
451 static int do_load_serial_bin(struct cmd_tbl
*cmdtp
, int flag
, int argc
,
456 int load_baudrate
, current_baudrate
;
460 /* pre-set offset from CONFIG_SYS_LOAD_ADDR */
461 offset
= CONFIG_SYS_LOAD_ADDR
;
463 /* pre-set offset from $loadaddr */
464 s
= env_get("loadaddr");
466 offset
= hextoul(s
, NULL
);
468 load_baudrate
= current_baudrate
= gd
->baudrate
;
471 offset
= hextoul(argv
[1], NULL
);
474 load_baudrate
= (int)dectoul(argv
[2], NULL
);
476 /* default to current baudrate */
477 if (load_baudrate
== 0)
478 load_baudrate
= current_baudrate
;
481 if (load_baudrate
!= current_baudrate
) {
482 printf("## Switch baudrate to %d bps and press ENTER ...\n",
486 gd
->baudrate
= load_baudrate
;
490 if (getchar() == '\r')
495 if (strcmp(argv
[0],"loady")==0) {
496 printf("## Ready for binary (ymodem) download "
497 "to 0x%08lX at %d bps...\n",
501 addr
= load_serial_ymodem(offset
, xyzModem_ymodem
);
505 printf("## Binary (ymodem) download aborted\n");
508 printf("## Start Addr = 0x%08lX\n", addr
);
509 image_load_addr
= addr
;
511 } else if (strcmp(argv
[0],"loadx")==0) {
512 printf("## Ready for binary (xmodem) download "
513 "to 0x%08lX at %d bps...\n",
517 addr
= load_serial_ymodem(offset
, xyzModem_xmodem
);
521 printf("## Binary (xmodem) download aborted\n");
524 printf("## Start Addr = 0x%08lX\n", addr
);
525 image_load_addr
= addr
;
529 printf("## Ready for binary (kermit) download "
530 "to 0x%08lX at %d bps...\n",
533 addr
= load_serial_bin(offset
);
537 printf("## Binary (kermit) download aborted\n");
540 printf("## Start Addr = 0x%08lX\n", addr
);
541 image_load_addr
= addr
;
544 if (load_baudrate
!= current_baudrate
) {
545 printf("## Switch baudrate to %d bps and press ESC ...\n",
549 gd
->baudrate
= current_baudrate
;
553 if (getchar() == 0x1B) /* ESC */
562 static ulong
load_serial_bin(ulong offset
)
566 set_kerm_bin_mode((ulong
*) offset
);
570 * Gather any trailing characters (for instance, the ^D which
571 * is sent by 'cu' after sending a file), and give the
572 * box some time (100 * 1 ms)
574 for (i
=0; i
<100; ++i
) {
582 return ~0; /* Download aborted */
584 flush_cache(offset
, size
);
586 printf("## Total Size = 0x%08x = %d Bytes\n", size
, size
);
587 env_set_hex("filesize", size
);
592 static void send_pad(void)
594 int count
= his_pad_count
;
600 /* converts escaped kermit char to binary char */
601 static char ktrans(char in
)
603 if ((in
& 0x60) == 0x40) {
604 return (char) (in
& ~0x40);
605 } else if ((in
& 0x7f) == 0x3f) {
606 return (char) (in
| 0x40);
611 static int chk1(char *buffer
)
618 return (int) ((total
+ ((total
>> 6) & 0x03)) & 0x3f);
621 static void s1_sendpacket(char *packet
)
630 static void send_ack(int n
)
637 a_b
[4] = tochar(chk1(&a_b
[1]));
643 static void send_nack(int n
)
650 a_b
[4] = tochar(chk1(&a_b
[1]));
657 static void (*os_data_init
)(void);
658 static void (*os_data_char
)(char new_char
);
659 static int os_data_state
, os_data_state_saved
;
660 static char *os_data_addr
, *os_data_addr_saved
;
661 static char *bin_start_address
;
663 static void bin_data_init(void)
666 os_data_addr
= bin_start_address
;
669 static void os_data_save(void)
671 os_data_state_saved
= os_data_state
;
672 os_data_addr_saved
= os_data_addr
;
675 static void os_data_restore(void)
677 os_data_state
= os_data_state_saved
;
678 os_data_addr
= os_data_addr_saved
;
681 static void bin_data_char(char new_char
)
683 switch (os_data_state
) {
685 *os_data_addr
++ = new_char
;
690 static void set_kerm_bin_mode(unsigned long *addr
)
692 bin_start_address
= (char *) addr
;
693 os_data_init
= bin_data_init
;
694 os_data_char
= bin_data_char
;
698 /* k_data_* simply handles the kermit escape translations */
699 static int k_data_escape
, k_data_escape_saved
;
700 static void k_data_init(void)
706 static void k_data_save(void)
708 k_data_escape_saved
= k_data_escape
;
712 static void k_data_restore(void)
714 k_data_escape
= k_data_escape_saved
;
718 static void k_data_char(char new_char
)
721 /* last char was escape - translate this character */
722 os_data_char(ktrans(new_char
));
725 if (new_char
== his_quote
) {
726 /* this char is escape - remember */
729 /* otherwise send this char as-is */
730 os_data_char(new_char
);
735 #define SEND_DATA_SIZE 20
736 static char send_parms
[SEND_DATA_SIZE
];
737 static char *send_ptr
;
739 /* handle_send_packet interprits the protocol info and builds and
740 sends an appropriate ack for what we can do */
741 static void handle_send_packet(int n
)
746 /* initialize some protocol parameters */
747 his_eol
= END_CHAR
; /* default end of line character */
750 his_quote
= K_ESCAPE
;
752 /* ignore last character if it filled the buffer */
753 if (send_ptr
== &send_parms
[SEND_DATA_SIZE
- 1])
755 bytes
= send_ptr
- send_parms
; /* how many bytes we'll process */
759 /* handle MAXL - max length */
760 /* ignore what he says - most I'll take (here) is 94 */
761 a_b
[++length
] = tochar(94);
764 /* handle TIME - time you should wait for my packets */
765 /* ignore what he says - don't wait for my ack longer than 1 second */
766 a_b
[++length
] = tochar(1);
769 /* handle NPAD - number of pad chars I need */
770 /* remember what he says - I need none */
771 his_pad_count
= untochar(send_parms
[2]);
772 a_b
[++length
] = tochar(0);
775 /* handle PADC - pad chars I need */
776 /* remember what he says - I need none */
777 his_pad_char
= ktrans(send_parms
[3]);
778 a_b
[++length
] = 0x40; /* He should ignore this */
781 /* handle EOL - end of line he needs */
782 /* remember what he says - I need CR */
783 his_eol
= untochar(send_parms
[4]);
784 a_b
[++length
] = tochar(END_CHAR
);
787 /* handle QCTL - quote control char he'll use */
788 /* remember what he says - I'll use '#' */
789 his_quote
= send_parms
[5];
793 /* handle QBIN - 8-th bit prefixing */
794 /* ignore what he says - I refuse */
798 /* handle CHKT - the clock check type */
799 /* ignore what he says - I do type 1 (for now) */
803 /* handle REPT - the repeat prefix */
804 /* ignore what he says - I refuse (for now) */
808 /* handle CAPAS - the capabilities mask */
809 /* ignore what he says - I only do long packets - I don't do windows */
810 a_b
[++length
] = tochar(2); /* only long packets */
811 a_b
[++length
] = tochar(0); /* no windows */
812 a_b
[++length
] = tochar(94); /* large packet msb */
813 a_b
[++length
] = tochar(94); /* large packet lsb */
817 a_b
[1] = tochar(length
);
820 a_b
[++length
] = '\0';
821 a_b
[length
] = tochar(chk1(&a_b
[1]));
822 a_b
[++length
] = his_eol
;
823 a_b
[++length
] = '\0';
827 /* k_recv receives a OS Open image file over kermit line */
828 static int k_recv(void)
831 char k_state
, k_state_saved
;
838 /* initialize some protocol parameters */
839 his_eol
= END_CHAR
; /* default end of line character */
842 his_quote
= K_ESCAPE
;
844 /* initialize the k_recv and k_data state machine */
848 k_state_saved
= k_state
;
850 n
= 0; /* just to get rid of a warning */
853 /* expect this "type" sequence (but don't check):
858 B: break transmission
861 /* enter main loop */
863 /* set the send packet pointer to begining of send packet parms */
864 send_ptr
= send_parms
;
866 /* With each packet, start summing the bytes starting with the length.
867 Save the current sequence number.
868 Note the type of the packet.
869 If a character less than SPACE (0x20) is received - error.
873 /* OLD CODE, Prior to checking sequence numbers */
874 /* first have all state machines save current states */
875 k_state_saved
= k_state
;
880 /* wait for the starting character or ^C */
883 case START_CHAR
: /* start packet */
885 case ETX_CHAR
: /* ^C waiting for packet */
892 /* get length of packet */
894 new_char
= getchar();
895 if ((new_char
& 0xE0) == 0)
897 sum
+= new_char
& 0xff;
898 length
= untochar(new_char
);
899 /* get sequence number */
900 new_char
= getchar();
901 if ((new_char
& 0xE0) == 0)
903 sum
+= new_char
& 0xff;
904 n
= untochar(new_char
);
907 /* NEW CODE - check sequence numbers for retried packets */
908 /* Note - this new code assumes that the sequence number is correctly
909 * received. Handling an invalid sequence number adds another layer
910 * of complexity that may not be needed - yet! At this time, I'm hoping
911 * that I don't need to buffer the incoming data packets and can write
912 * the data into memory in real time.
915 /* same sequence number, restore the previous state */
916 k_state
= k_state_saved
;
919 /* new sequence number, checkpoint the download */
921 k_state_saved
= k_state
;
926 /* get packet type */
927 new_char
= getchar();
928 if ((new_char
& 0xE0) == 0)
930 sum
+= new_char
& 0xff;
933 /* check for extended length */
935 /* (length byte was 0, decremented twice) */
936 /* get the two length bytes */
937 new_char
= getchar();
938 if ((new_char
& 0xE0) == 0)
940 sum
+= new_char
& 0xff;
941 len_hi
= untochar(new_char
);
942 new_char
= getchar();
943 if ((new_char
& 0xE0) == 0)
945 sum
+= new_char
& 0xff;
946 len_lo
= untochar(new_char
);
947 length
= len_hi
* 95 + len_lo
;
948 /* check header checksum */
949 new_char
= getchar();
950 if ((new_char
& 0xE0) == 0)
952 if (new_char
!= tochar((sum
+ ((sum
>> 6) & 0x03)) & 0x3f))
954 sum
+= new_char
& 0xff;
955 /* --length; */ /* new length includes only data and block check to come */
957 /* bring in rest of packet */
959 new_char
= getchar();
960 if ((new_char
& 0xE0) == 0)
962 sum
+= new_char
& 0xff;
964 if (k_state
== DATA_TYPE
) {
965 /* pass on the data if this is a data packet */
966 k_data_char (new_char
);
967 } else if (k_state
== SEND_TYPE
) {
968 /* save send pack in buffer as is */
969 *send_ptr
++ = new_char
;
970 /* if too much data, back off the pointer */
971 if (send_ptr
>= &send_parms
[SEND_DATA_SIZE
])
975 /* get and validate checksum character */
976 new_char
= getchar();
977 if ((new_char
& 0xE0) == 0)
979 if (new_char
!= tochar((sum
+ ((sum
>> 6) & 0x03)) & 0x3f))
982 new_char
= getchar();
983 if (new_char
!= END_CHAR
) {
985 /* restore state machines */
986 k_state
= k_state_saved
;
988 /* send a negative acknowledge packet in */
990 } else if (k_state
== SEND_TYPE
) {
991 /* crack the protocol parms, build an appropriate ack packet */
992 handle_send_packet(n
);
994 /* send simple acknowledge packet in */
996 /* quit if end of transmission */
997 if (k_state
== BREAK_TYPE
)
1001 return ((ulong
) os_data_addr
- (ulong
) bin_start_address
);
1004 static int getcxmodem(void) {
1009 static ulong
load_serial_ymodem(ulong offset
, int mode
)
1014 connection_info_t info
;
1015 char ymodemBuf
[1024];
1016 ulong store_addr
= ~0;
1021 res
= xyzModem_stream_open(&info
, &err
);
1026 xyzModem_stream_read(ymodemBuf
, 1024, &err
)) > 0) {
1027 store_addr
= addr
+ offset
;
1030 #ifdef CONFIG_MTD_NOR_FLASH
1031 if (addr2info(store_addr
)) {
1034 rc
= flash_write((char *) ymodemBuf
,
1037 xyzModem_stream_terminate(true, &getcxmodem
);
1038 xyzModem_stream_close(&err
);
1046 memcpy((char *)(store_addr
), ymodemBuf
,
1052 xyzModem_stream_terminate((err
== xyzModem_cancel
) ? false : true, &getcxmodem
);
1053 xyzModem_stream_close(&err
);
1054 printf("\n%s\n", xyzModem_error(err
));
1055 return (~0); /* Download aborted */
1058 if (IS_ENABLED(CONFIG_CMD_BOOTEFI
))
1059 efi_set_bootdev("Uart", "", "",
1060 map_sysmem(offset
, 0), size
);
1063 printf("\n%s\n", xyzModem_error(err
));
1064 return (~0); /* Download aborted */
1067 xyzModem_stream_terminate(false, &getcxmodem
);
1068 xyzModem_stream_close(&err
);
1071 flush_cache(offset
, ALIGN(size
, ARCH_DMA_MINALIGN
));
1073 printf("## Total Size = 0x%08x = %d Bytes\n", size
, size
);
1074 env_set_hex("filesize", size
);
1081 #if defined(CONFIG_CMD_LOADM)
1082 static int do_load_memory_bin(struct cmd_tbl
*cmdtp
, int flag
, int argc
,
1085 ulong addr
, dest
, size
;
1089 return CMD_RET_USAGE
;
1091 addr
= simple_strtoul(argv
[1], NULL
, 16);
1093 dest
= simple_strtoul(argv
[2], NULL
, 16);
1095 size
= simple_strtoul(argv
[3], NULL
, 16);
1098 printf("loadm: can not load zero bytes\n");
1102 src
= map_sysmem(addr
, size
);
1103 dst
= map_sysmem(dest
, size
);
1105 memcpy(dst
, src
, size
);
1110 if (IS_ENABLED(CONFIG_CMD_BOOTEFI
))
1111 efi_set_bootdev("Mem", "", "", map_sysmem(dest
, 0), size
);
1113 printf("loaded bin to memory: size: %lu\n", size
);
1119 /* -------------------------------------------------------------------- */
1121 #if defined(CONFIG_CMD_LOADS)
1123 #ifdef CONFIG_SYS_LOADS_BAUD_CHANGE
1125 loads
, 3, 0, do_load_serial
,
1126 "load S-Record file over serial line",
1127 "[ off ] [ baud ]\n"
1128 " - load S-Record file over serial line"
1129 " with offset 'off' and baudrate 'baud'"
1132 #else /* ! CONFIG_SYS_LOADS_BAUD_CHANGE */
1134 loads
, 2, 0, do_load_serial
,
1135 "load S-Record file over serial line",
1137 " - load S-Record file over serial line with offset 'off'"
1139 #endif /* CONFIG_SYS_LOADS_BAUD_CHANGE */
1142 * SAVES always requires LOADS support, but not vice versa
1146 #if defined(CONFIG_CMD_SAVES)
1147 #ifdef CONFIG_SYS_LOADS_BAUD_CHANGE
1149 saves
, 4, 0, do_save_serial
,
1150 "save S-Record file over serial line",
1151 "[ off ] [size] [ baud ]\n"
1152 " - save S-Record file over serial line"
1153 " with offset 'off', size 'size' and baudrate 'baud'"
1155 #else /* ! CONFIG_SYS_LOADS_BAUD_CHANGE */
1157 saves
, 3, 0, do_save_serial
,
1158 "save S-Record file over serial line",
1160 " - save S-Record file over serial line with offset 'off' and size 'size'"
1162 #endif /* CONFIG_SYS_LOADS_BAUD_CHANGE */
1163 #endif /* CONFIG_CMD_SAVES */
1164 #endif /* CONFIG_CMD_LOADS */
1167 #if defined(CONFIG_CMD_LOADB)
1169 loadb
, 3, 0, do_load_serial_bin
,
1170 "load binary file over serial line (kermit mode)",
1171 "[ addr [ baud ] ]\n"
1172 " - load binary file over serial line"
1173 " at address 'addr' with baudrate 'baud'"
1177 loadx
, 3, 0, do_load_serial_bin
,
1178 "load binary file over serial line (xmodem mode)",
1179 "[ addr [ baud ] ]\n"
1180 " - load binary file over serial line"
1181 " at address 'addr' with baudrate 'baud'"
1185 loady
, 3, 0, do_load_serial_bin
,
1186 "load binary file over serial line (ymodem mode)",
1187 "[ addr [ baud ] ]\n"
1188 " - load binary file over serial line"
1189 " at address 'addr' with baudrate 'baud'"
1192 #endif /* CONFIG_CMD_LOADB */
1194 #if defined(CONFIG_CMD_LOADM)
1196 loadm
, 4, 0, do_load_memory_bin
,
1197 "load binary blob from source address to destination address",
1198 "[src_addr] [dst_addr] [size]\n"
1199 " - load a binary blob from one memory location to other"
1200 " from src_addr to dst_addr by size bytes"
1202 #endif /* CONFIG_CMD_LOADM */