| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720 |
- #define LOG_TAG "usb_ota" // 该模块对应的标签。不定义时,默认:NO_TAG
- #define LOG_LVL LOG_LVL_ASSERT // 该模块对应的日志输出级别。不定义时,默认:调试级别
- #include <ulog.h> // 必须在 LOG_TAG 与 LOG_LVL 下面
- #include <stdio.h>
- #include <stdint.h>
- #include <stdlib.h>
- #include <rtthread.h>
- #include <finsh.h>
- #include <fal.h>
- #include "sys_config.h"
- #include "CH376HFT.h"
- #include "protocol.h"
- #define USB_OTA_BUFF_LEN 8192
- #define USB_OTA_DL_DELAY (10 * RT_TICK_PER_SECOND)
- #define DEFAULT_DOWNLOAD_PART "fm_area"
- #define STATUS_DIS_LEN 100 //显示缓冲区长度
- #define DIS_POS "reset.t3.txt=\"%s\""
- #define DIS_POS_value "reset.t3.txt=\"%s%d\%\""
- #define DIS_POS_progress "reset.j0.val=\%d"
- #define pagebootloader "page bootloader"
- #define u_succ "U盘检测成功"
- #define u_fail "U盘检测失败"
- //#define reboot_5s "配置成功,5秒后重启"
- #define reboot_5s "系统将在5秒后重启"
- #define find_file "检测到文件"
- #define find_file_1 "检测到文件1"
- #define find_file_2 "检测到文件2"
- #define find_file_3 "检测到文件3"
- #define find_file_4 "检测到文件4"
- #define notfound_file "未找到文件"
- #define notfound_file_1 "未找到文件1"
- #define notfound_file_2 "未找到文件2"
- #define notfound_file_3 "未找到文件3"
- #define notfound_file_4 "未找到文件4"
- #define filesize "升级文件大小:"
- #define startwritfw "准备写入固件"
- #define writingfw "正在写入固件"
- #define finddownload_part "找到固件分区,准备格式化"
- #define nodownload_part "未找到固件分区"
- #define erase_fail "固件分区格式化失败"
- #define erase_succ "固件分区格式化成功"
- #define malloc_fail "分配内存失败"
- #define write_error "固件写入错误"
- #define writefail "固件写入失败"
- #define writesucc "固件写入成功"
- #define file_size_i "文件超过限定大小"
- #define file_size_0 "文件大小为0"
- #define ch_config_succ "通道配置成功"
- #define ch_config_fail "通道配置失败"
- #define eleconfig_succ "要素模型写入成功"
- #define eleconfig_fail "要素模型写入失败"
- #define gbk_succ "中文支持库写入成功"
- #define gbk_fail "中文支持库写入失败"
- extern int16_t CH376_Init(void);
- extern rt_err_t HMI_Display(void *Data, rt_size_t length);
- /*屏幕显示相应的操作状态*/
- static void Status_Display(const char *content, uint16_t value)
- {
- char *dis_buf = RT_NULL;
- dis_buf = rt_malloc(STATUS_DIS_LEN);
- rt_memset(dis_buf, '\0', STATUS_DIS_LEN);
- if ((value == RT_NULL) && (content != RT_NULL)) //显示文字
- {
- rt_sprintf(dis_buf, DIS_POS, content);
- }
- else if ((value != RT_NULL) && (content != RT_NULL)) //显示百分比状态
- {
- rt_sprintf(dis_buf, DIS_POS_value, content, value);
- }
- else if ((value != RT_NULL) && (content == RT_NULL)) //显示进度条
- {
- rt_sprintf(dis_buf, DIS_POS_progress, value);
- // LOG_I("%s\r\n",dis_buf);
- }
- else //切换到BootLoader页面
- {
- rt_sprintf(dis_buf, pagebootloader);
- }
- HMI_Display(dis_buf, rt_strlen(dis_buf)); //存入队列
- rt_free(dis_buf);
- dis_buf = RT_NULL;
- }
- static void print_progress(size_t cur_size, size_t total_size)
- {
- static unsigned char progress_sign[100 + 1];
- uint8_t i, per = cur_size * 100 / total_size;
- if (per > 100)
- {
- per = 100;
- }
- for (i = 0; i < 100; i++)
- {
- if (i < per)
- {
- progress_sign[i] = '=';
- }
- else if (per == i)
- {
- progress_sign[i] = '>';
- }
- else
- {
- progress_sign[i] = ' ';
- }
- }
- Status_Display(writingfw, per);
- Status_Display(RT_NULL, per);
- progress_sign[sizeof(progress_sign) - 1] = '\0';
- LOG_I("\033[2A");
- LOG_I("Download: [%s] %d%%", progress_sign, per);
- }
- int usb_read(unsigned char *buffer, size_t length) //
- {
- int s = 0;
- uint32_t RealCount = 0;
- s = CH376ByteRead(buffer, length, (PUINT16)&RealCount);
- if (s != USB_INT_SUCCESS)
- {
- mStopIfError(s);
- return 0;
- }
- return RealCount;
- }
- #include "hc_ctl.h"
- static int usb_ota_fw_download(void)
- {
- int ret = 0, s = 0, resp_status;
- uint32_t file_size = 0, length, total_length = 0;
- rt_uint8_t *buffer_read = RT_NULL;
- const struct fal_partition *dl_part = RT_NULL;
- uint8_t filename[20];
- if (CH376_Init() != 1)
- {
- Status_Display(u_fail, RT_NULL);
- LOG_E("the usb drive init fail!");
- return ret;
- }
- if (CH376DiskConnect() == USB_INT_SUCCESS) /* 检查U盘是否连接 */
- {
- Status_Display(u_succ, RT_NULL);
- }
- else
- {
- Status_Display(u_fail, RT_NULL);
- LOG_E("the usb drive is not read!");
- return ret;
- }
- rt_sprintf((char *)filename, "/QXZ.RBL");
- s = CH376FileOpen(filename); /* 打开文件,该文件在根目录下 */
- if (s == ERR_MISS_FILE) /* 文件不存在*/
- {
- Status_Display(notfound_file, RT_NULL);
- LOG_E("the ota file is not find!");
- return ret;
- }
- else if (s == USB_INT_SUCCESS)
- {
- Status_Display(find_file, RT_NULL);
- file_size = CH376GetFileSize();
- rt_kprintf("File size = %ld\n", file_size);
- }
- Status_Display(DIS_POS_value, file_size);
- /* Get download partition information and erase download partition data */
- if ((dl_part = fal_partition_find(DEFAULT_DOWNLOAD_PART)) == RT_NULL)
- {
- Status_Display(nodownload_part, RT_NULL);
- LOG_E("Firmware download failed! Partition (%s) find error!", DEFAULT_DOWNLOAD_PART);
- ret = -RT_ERROR;
- return ret;
- }
- LOG_I("Start erase flash (%s) partition!", dl_part->name);
- Status_Display(finddownload_part, RT_NULL);
- if (fal_partition_erase(dl_part, 0, file_size) < 0)
- {
- Status_Display(erase_fail, RT_NULL);
- LOG_E("Firmware download failed! Partition (%s) erase error!", dl_part->name);
- ret = -RT_ERROR;
- return ret;
- }
- Status_Display(erase_succ, RT_NULL);
- LOG_I("Erase flash (%s) partition success!", dl_part->name);
- buffer_read = rt_malloc(USB_OTA_BUFF_LEN);
- if (buffer_read == RT_NULL)
- {
- Status_Display(malloc_fail, RT_NULL);
- LOG_E("No memory for usb ota!");
- ret = -RT_ERROR;
- return ret;
- }
- rt_memset(buffer_read, 0x00, USB_OTA_BUFF_LEN);
- // list_mem();
- Status_Display(startwritfw, RT_NULL);
- do
- {
- length = usb_read(buffer_read, file_size - total_length > USB_OTA_BUFF_LEN ? USB_OTA_BUFF_LEN : file_size - total_length);
- if (length > 0)
- {
- /* Write the data to the corresponding partition address */
- if (fal_partition_write(dl_part, total_length, buffer_read, length) < 0)
- {
- Status_Display(write_error, RT_NULL);
- LOG_E("Firmware download failed! Partition (%s) write data error!", dl_part->name);
- ret = -RT_ERROR;
- goto __exit;
- }
- total_length += length;
- print_progress(total_length, file_size);
- // list_mem();
- }
- else
- {
- Status_Display(writefail, RT_NULL);
- LOG_E("Exit: USB OTA return err (%d)!", length);
- ret = -RT_ERROR;
- goto __exit;
- }
- } while (total_length != file_size);
- ret = RT_EOK;
- if (total_length == file_size)
- {
- if (buffer_read)
- {
- rt_free(buffer_read);
- buffer_read = RT_NULL;
- }
- Status_Display(writesucc, RT_NULL);
- LOG_I("Download firmware to flash success.");
- LOG_I("System now will restart...");
- rt_thread_delay(rt_tick_from_millisecond(500));
- Status_Display("\0", RT_NULL); //显示状态清空
- Status_Display(RT_NULL, RT_NULL); //切换到bootloader页面
- /* Reset the device, Start new firmware */
- // extern void rt_hw_cpu_reset(void);
- // rt_hw_cpu_reset();
- extern void RESET_SYSTEM(void);
- RESET_SYSTEM();
- }
- __exit:
- if (buffer_read)
- {
- rt_free(buffer_read);
- buffer_read = RT_NULL;
- }
- return ret;
- }
- #include "hc_ctl.h"
- static int usb_ele_config_download(void)
- {
- int ret = 0, s = 0, i, resp_status;
- uint32_t file_size = 0, length, total_length = 0;
- char *buffer_read = RT_NULL;
- char *file_buffer = RT_NULL;
- char *file_buffer_temp = RT_NULL;
- const struct fal_partition *dl_part = RT_NULL;
- uint8_t filename[20];
- if (CH376_Init() != 1)
- {
- Status_Display(u_fail, RT_NULL);
- LOG_E("the usb drive init fail!");
- return ret;
- }
- if (CH376DiskConnect() == USB_INT_SUCCESS) /* 检查U盘是否连接 */
- {
- Status_Display(u_succ, RT_NULL);
- }
- else
- {
- Status_Display(u_fail, RT_NULL);
- LOG_E("the usb drive is not read!");
- goto __exit;
- }
- for (i = 0; i < 4; i++)
- { //文件有两个,名称为CONFIG01.C,CONFIG02.C,CONFIG03.C
- rt_sprintf((char *)filename, "/CONFIG%02d.C", i + 1);
- s = CH376FileOpen(filename); /* 打开文件,该文件在根目录下 */
- LOG_I("the opening config file :%s", filename);
- if (s == ERR_MISS_FILE) /* 文件不存在*/
- {
- if (i == 0)
- Status_Display(notfound_file_1, RT_NULL);
- else if (i == 1)
- Status_Display(notfound_file_2, RT_NULL);
- else if (i == 2)
- Status_Display(notfound_file_3, RT_NULL);
- else if (i == 3)
- Status_Display(notfound_file_4, RT_NULL);
- LOG_I("the config file :%s is not find!", filename);
- rt_thread_delay(rt_tick_from_millisecond(2000)); //状态显示维持2s
- Status_Display("\0", RT_NULL); //显示状态清空
- goto __exit;
- }
- else if (s == USB_INT_SUCCESS)
- {
- if (i == 0)
- Status_Display(find_file_1, RT_NULL);
- else if (i == 1)
- Status_Display(find_file_2, RT_NULL);
- else if (i == 2)
- Status_Display(find_file_3, RT_NULL);
- else if (i == 3)
- Status_Display(find_file_4, RT_NULL);
- file_size = CH376GetFileSize();
- LOG_I("File size = %ld\n", file_size);
- if (file_size == 0)
- {
- ret = -RT_ERROR;
- Status_Display(file_size_0, RT_NULL); //屏幕显示模型文件超过限定大小
- LOG_I("File size is 0");
- goto __exit;
- }
- if (file_size > 6 * 1024)
- {
- ret = -RT_ERROR;
- Status_Display(file_size_i, RT_NULL); //屏幕显示模型文件超过限定大小
- LOG_I("File size to large");
- goto __exit;
- } //文件过大直接退出
- }
- Status_Display(DIS_POS_value, file_size);
- file_buffer = (char *)rt_malloc(file_size);
- if (file_buffer == RT_NULL)
- {
- Status_Display(malloc_fail, RT_NULL);
- LOG_E("No memory for file_buffer!");
- ret = -RT_ERROR;
- goto __exit;
- }
- buffer_read = (char *)rt_malloc(USB_OTA_BUFF_LEN);
- if (buffer_read == RT_NULL)
- {
- Status_Display(malloc_fail, RT_NULL);
- LOG_E("No memory for buffer_read!");
- ret = -RT_ERROR;
- goto __exit;
- }
- rt_memset(buffer_read, 0, USB_OTA_BUFF_LEN);
- rt_memset(file_buffer, 0, file_size);
- file_buffer_temp = file_buffer;
- total_length = 0; //清零文件读取位置,准备再次读取
- do
- {
- length = usb_read((uint8_t *)buffer_read, file_size - total_length > USB_OTA_BUFF_LEN ? USB_OTA_BUFF_LEN : file_size - total_length);
- if (length > 0)
- {
- rt_memcpy(file_buffer_temp, buffer_read, length);
- total_length += length;
- file_buffer_temp += length;
- }
- else
- {
- Status_Display(writefail, RT_NULL);
- LOG_E("Exit: USB CONFIG return err (%d)!", length);
- ret = -RT_ERROR;
- break;
- }
- } while (total_length != file_size);
- CH376FileClose(0); //关闭文件
- //要素模型下发解析
- if (cJSON_to_struct_array((char *)file_buffer) == 1)
- {
- Status_Display(eleconfig_succ, RT_NULL);
- LOG_I("ELEMENT CONFIG SUCUCC");
- rt_thread_delay(rt_tick_from_millisecond(1000)); //状态显示维持2s
- }
- else
- {
- Status_Display(eleconfig_fail, RT_NULL);
- LOG_I("ELEMENT CONFIG FAIL");
- rt_thread_delay(rt_tick_from_millisecond(1000)); //状态显示维持2s
- }
- if (file_buffer)
- {
- rt_free(file_buffer);
- file_buffer = RT_NULL;
- } //每个文件解析完成后先释放
- if (buffer_read)
- {
- rt_free(buffer_read);
- buffer_read = RT_NULL;
- }
- }
- rt_thread_delay(rt_tick_from_millisecond(2000)); //状态显示维持2s
- Status_Display("\0", RT_NULL); //显示状态清空
- ret = RT_EOK;
- __exit:
- return ret;
- }
- static int usb_ch_config(void)
- {
- int ret = 0, s = 0, resp_status;
- uint32_t file_size = 0, length, total_length = 0;
- char *buffer_read = RT_NULL;
- char *file_buffer = RT_NULL;
- char *file_buffer_temp = RT_NULL;
- const struct fal_partition *dl_part = RT_NULL;
- uint8_t filename[20];
- if (CH376_Init() != 1)
- {
- Status_Display(u_fail, RT_NULL);
- LOG_E("the usb drive init fail!");
- return ret;
- }
- if (CH376DiskConnect() == USB_INT_SUCCESS) /* 检查U盘是否连接 */
- {
- Status_Display(u_succ, RT_NULL);
- }
- else
- {
- Status_Display(u_fail, RT_NULL);
- LOG_E("the usb drive is not read!");
- goto __exit;
- }
- rt_sprintf((char *)filename, "/CONFIGCH.C");
- s = CH376FileOpen(filename); /* 打开文件,该文件在根目录下 */
- LOG_I("the opening config file :%s", filename);
- if (s == ERR_MISS_FILE) /* 文件不存在*/
- {
- Status_Display(notfound_file, RT_NULL);
- LOG_I("the CONFIG file :%s is not find!", filename);
- goto __exit;
- }
- else if (s == USB_INT_SUCCESS)
- {
- Status_Display(find_file, RT_NULL);
- file_size = CH376GetFileSize();
- LOG_I("File size = %ld\n", file_size);
- if (file_size > 6 * 1024)
- {
- ret = -RT_ERROR;
- Status_Display(file_size_i, RT_NULL); //屏幕显示模型文件超过限定大小
- LOG_I("File size to large");
- goto __exit;
- } //文件过大直接退出
- }
- Status_Display(DIS_POS_value, file_size);
- file_buffer = rt_malloc(file_size);
- if (file_buffer == RT_NULL)
- {
- Status_Display(malloc_fail, RT_NULL);
- LOG_E("No memory for file_buffer!");
- ret = -RT_ERROR;
- goto __exit;
- }
- buffer_read = rt_malloc(USB_OTA_BUFF_LEN);
- if (buffer_read == RT_NULL)
- {
- Status_Display(malloc_fail, RT_NULL);
- LOG_E("No memory for buffer_read!");
- ret = -RT_ERROR;
- goto __exit;
- }
- rt_memset(buffer_read, 0, USB_OTA_BUFF_LEN);
- rt_memset(file_buffer, 0, file_size);
- file_buffer_temp = file_buffer;
- total_length = 0; //清零文件读取位置,准备再次读取
- do
- {
- length = usb_read((uint8_t *)buffer_read, file_size - total_length > USB_OTA_BUFF_LEN ? USB_OTA_BUFF_LEN : file_size - total_length);
- if (length > 0)
- {
- rt_memcpy(file_buffer_temp, buffer_read, length);
- total_length += length;
- file_buffer_temp += length;
- }
- else
- {
- Status_Display(writefail, RT_NULL);
- LOG_E("Exit: USB CONFIG return err (%d)!", length);
- ret = -RT_ERROR;
- break;
- }
- } while (total_length != file_size);
- CH376FileClose(0); //关闭文件
- //通道配置解析保存
- if (ch_config_parse((char *)file_buffer) == 1)
- {
- Status_Display(ch_config_succ, RT_NULL); //显示配置通道成功
- }
- else
- {
- Status_Display(ch_config_fail, RT_NULL); //显示配置通道失败
- }
- rt_thread_delay(rt_tick_from_millisecond(2000)); //状态显示维持2s
- if (buffer_read)
- {
- rt_free(buffer_read);
- buffer_read = RT_NULL;
- }
- if (file_buffer)
- {
- rt_free(file_buffer);
- file_buffer = RT_NULL;
- }
- ret = RT_EOK;
- Status_Display(reboot_5s, RT_NULL); //显示配置通道成功
- rt_thread_delay(rt_tick_from_millisecond(5000));
- Status_Display(RT_NULL, RT_NULL); //切换到bootloader页面
- Status_Display("\0", RT_NULL); //显示状态清空
- extern void RESET_SYSTEM(void);
- extern uint8_t reflash_elem(void);
- extern uint8_t bak_para(uint8_t type, uint8_t num);
- rt_kprintf("usb up ch bak in here\n\n");
- //bak_para(One, ch_bak_part);
- Mark_up_elem();
- Alarm_report(12 , 0 , 0);
- RESET_SYSTEM();
- __exit:
- return ret;
- }
- #define ZK_DOWNLOAD_PART "zk_area"
- // gbk数组文件写入
- static int usb_gbk_download(void)
- {
- int ret = 0, s = 0, resp_status;
- uint32_t file_size = 0, length, total_length = 0;
- rt_uint8_t *buffer_read = RT_NULL;
- const struct fal_partition *dl_part = RT_NULL;
- uint8_t filename[20];
- if (CH376_Init() != 1)
- {
- Status_Display(u_fail, RT_NULL);
- LOG_E("the usb drive init fail!");
- return ret;
- }
- if (CH376DiskConnect() == USB_INT_SUCCESS) /* 检查U盘是否连接 */
- {
- Status_Display(u_succ, RT_NULL);
- }
- else
- {
- Status_Display(u_fail, RT_NULL);
- LOG_E("the usb drive is not read!");
- goto __exit;
- }
- rt_sprintf((char *)filename, "/HEXC.BIN");
- s = CH376FileOpen(filename); /* 打开文件,该文件在根目录下 */
- if (s == ERR_MISS_FILE) /* 文件不存在*/
- {
- Status_Display(notfound_file, RT_NULL);
- LOG_E("the ota file is not find!");
- goto __exit;
- }
- else if (s == USB_INT_SUCCESS)
- {
- Status_Display(find_file, RT_NULL);
- file_size = CH376GetFileSize();
- rt_kprintf("File size = %ld\n", file_size);
- }
- Status_Display(DIS_POS_value, file_size);
- /* Get download partition information and erase download partition data */
- if ((dl_part = fal_partition_find("zk_area")) == RT_NULL)
- {
- Status_Display(nodownload_part, RT_NULL);
- LOG_E("Firmware download failed! Partition (%s) find error!", "fm_area");
- ret = -RT_ERROR;
- goto __exit;
- }
- LOG_I("Start erase flash (%s) partition!", dl_part->name);
- Status_Display(finddownload_part, RT_NULL);
- if (fal_partition_erase(dl_part, 0, file_size) < 0)
- {
- Status_Display(erase_fail, RT_NULL);
- LOG_E("Firmware download failed! Partition (%s) erase error!", dl_part->name);
- ret = -RT_ERROR;
- goto __exit;
- }
- Status_Display(erase_succ, RT_NULL);
- LOG_I("Erase flash (%s) partition success!", dl_part->name);
- buffer_read = rt_malloc(USB_OTA_BUFF_LEN);
- if (buffer_read == RT_NULL)
- {
- Status_Display(malloc_fail, RT_NULL);
- LOG_E("No memory for usb ota!");
- ret = -RT_ERROR;
- goto __exit;
- }
- rt_memset(buffer_read, 0x00, USB_OTA_BUFF_LEN);
- // list_mem();
- Status_Display(startwritfw, RT_NULL);
- do
- {
- length = usb_read(buffer_read, file_size - total_length > USB_OTA_BUFF_LEN ? USB_OTA_BUFF_LEN : file_size - total_length);
- if (length > 0)
- {
- /* Write the data to the corresponding partition address */
- if (fal_partition_write(dl_part, total_length, buffer_read, length) < 0)
- {
- Status_Display(write_error, RT_NULL);
- LOG_E("Firmware download failed! Partition (%s) write data error!", dl_part->name);
- ret = -RT_ERROR;
- goto __exit;
- }
- total_length += length;
- print_progress(total_length, file_size);
- // list_mem();
- }
- else
- {
- Status_Display(writefail, RT_NULL);
- LOG_E("Exit: USB OTA return err (%d)!", length);
- ret = -RT_ERROR;
- goto __exit;
- }
- } while (total_length != file_size);
- ret = RT_EOK;
- if (total_length == file_size)
- {
- Status_Display(gbk_succ, RT_NULL);
- LOG_I("GBK_BIN write to flash success.");
- }
- else
- {
- Status_Display(gbk_fail, RT_NULL);
- LOG_I("GBK_BIN write to flash failed.");
- }
- rt_thread_delay(rt_tick_from_millisecond(2000)); //状态显示维持2s
- Status_Display("\0", RT_NULL); //显示状态清空
- __exit:
- if (buffer_read)
- {
- rt_free(buffer_read);
- buffer_read = RT_NULL;
- }
- return ret;
- }
- void usb_ota(uint8_t argc, char **argv)
- {
- if (argc == 0)
- usb_ota_fw_download();
- else if (argc == 1)
- usb_ele_config_download();
- else if (argc == 2)
- usb_ch_config();
- else if (argc == 3)
- usb_gbk_download();
- }
- #if defined(RT_USING_FINSH) && defined(FINSH_USING_MSH)
- #include <finsh.h>
- MSH_CMD_EXPORT(usb_ota, Use HTTP to download the firmware);
- MSH_CMD_EXPORT(usb_ota_fw_download, Use HTTP to download the firmware);
- MSH_CMD_EXPORT(usb_ele_config_download, Use HTTP to download the firmware);
- MSH_CMD_EXPORT(usb_ch_config, Use HTTP to download the firmware);
- MSH_CMD_EXPORT(usb_gbk_download, Use HTTP to download the firmware);
- #endif /* defined(RT_USING_FINSH) && defined(FINSH_USING_MSH) */
|