2 Star 8 Fork 6

马玉琛/BMCBootLoader

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
ymodem.h 1.09 KB
一键复制 编辑 原始数据 按行查看 历史
马玉琛 提交于 2023-03-28 19:47 . 重构应用启动功能为一个模块
/*
* @Author: Ma Yuchen
* @Date: 2022-11-23 23:30:07
* @LastEditors: Ma YuChen
* @LastEditTime: 2022-11-24 18:51:22
* @Description: Y Modem File Transport Protocol Define func
* this Protocel can be used when uart is only IO interface on MCU
* @FilePath: \BootLoader\ymodem.h
*/
#ifndef Y_MODEM_H
#define Y_MODEM_H
#include <stdint.h>
#include <string.h>
/*Ymodem Frame base on ASCII Encode*/
#define SOH (0x01)
#define STX (0x02)
#define ETX (0x03)
#define EOT (0x04)
#define ENQ (0x05)
#define ACK (0x06)
#define NAK (0x15)
#define CAN (0x18)
#define CRC16 (0x43) // YModem C on hex = 0x43
#define PACKET_HEADER (3)
#define PACKET_TRAILER (2)
#define PACKET_OVERHEAD (PACKET_HEADER+PACKET_TRAILER)
#define PACKET_SIZE (128)
#define PACKET_DATA_LENGTH (1024)
#define FILE_NAME_LENGTH (256)
#define FILE_SIZE_LENGTH (16)
#define PACKET_NO_INDEX (1)
#define PACKET_NO_N_INDEX (2)
//#define NAK_TIMEOUT (0x100000)
#define NAK_TIMEOUT (500)
#define MAX_ERRORS (5)
extern uint8_t FileName[];
int Ymodem_Receive(void);
#endif
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C
1
https://gitee.com/VoldemortCat/bmcboot-loader.git
git@gitee.com:VoldemortCat/bmcboot-loader.git
VoldemortCat
bmcboot-loader
BMCBootLoader
master

搜索帮助