zte's code,first commit
Change-Id: I9a04da59e459a9bc0d67f101f700d9d7dc8d681b
diff --git a/boot/common/src/uboot/downloader/cmd_testusb.c b/boot/common/src/uboot/downloader/cmd_testusb.c
new file mode 100644
index 0000000..921a66d
--- /dev/null
+++ b/boot/common/src/uboot/downloader/cmd_testusb.c
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * Copyright (C) 2016, ZIXC Corporation.
+ *
+ * File Name:cmd_testusb.c
+ * File Mark:
+ * Description:
+ * Others:
+ * Version: 1.0
+ * Author: zangxiaofeng
+ * Date: 2013-4-22
+ * History 1:
+ * Date:
+ * Version:
+ * Author:
+ * Modification:
+ * History 2:
+ ********************************************************************************/
+
+
+/****************************************************************************
+* Include files
+****************************************************************************/
+#include <common.h>
+#include <command.h>
+#include <net.h>
+#include <jffs2/load_kernel.h>
+#include "downloader_nand.h"
+#include "downloader_config.h"
+#include "errno.h"
+/****************************************************************************
+* Global Function Prototypes
+****************************************************************************/
+extern int downloader_serial_write(const char * buffer,unsigned int len);
+extern int downloader_serial_read_actuallen(char * buffer,unsigned int len);
+
+/*******************************************************************************
+ * Function:do_reboot
+ * Description:
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ * Returns:
+ *
+ *
+ * Others:
+ ********************************************************************************/
+int do_testusb(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+ unsigned int size = 0;
+ char ack[64] = {0};
+
+ if(argc < 2)
+ {
+ return cmd_usage(cmdtp);
+ }
+ size = (unsigned int)simple_strtoul (argv[1], NULL, 16);
+
+ sprintf(ack,"DATA %x",size);
+ downloader_serial_write(ack, strlen(ack)+1);
+ downloader_serial_read_actuallen((char *)DOWNLOADER_BUFFER_BASE, size);
+ sprintf(ack,"OKAY");
+ downloader_serial_write(ack, strlen(ack)+1);
+ return 0;
+}
+
+U_BOOT_CMD(
+ testusb, CONFIG_SYS_MAXARGS, 0, do_testusb,
+ "testusb: testusb [size]",
+ ""
+);
+