Files
chrg/apps/boot/include/transfer.h
T
2025-08-16 22:58:22 +08:00

37 lines
909 B
C

#ifndef __TRANSFER_H__
#define __TRANSFER_H__
#include "bsp_common.h"
/* 是否使能断帧检测 */
#define DT_ENABLE_BROKEN_FRAME_DETECT 0
#define BROKEN_FRAME_INTERVAL_TIME 100 /* 断帧间隔时间判断,单位 ms */
typedef enum {
X_RESULT_RECV_FRAME = 0x00, /* 收到了一帧数据 */
X_RESULT_NO_DATA = 0x01, /* 未收到数据 */
X_RESULT_JUST_RECV = 0x02, /* 刚收到一帧数据(可能是断帧) */
X_RESULT_WAIT_DECTECT = 0x03 /* 等待断帧判断 */
} exRESULT;
struct transfer_t {
uint8_t if_id;
uint8_t *rx_buff;
uint16_t *rx_len;
uint32_t rx_buff_size;
};
extern void DT_Init (struct transfer_t *xfer, uint8_t if_id, uint8_t *buff, uint16_t *len, uint32_t buff_size);
extern void DT_Send (struct transfer_t *xfer, uint8_t *data, uint32_t len);
extern exRESULT DT_PollingReceive (struct transfer_t *xfer);
#endif /* __TRANSFER_H__ */