ahdlc.h

来自「MCS51产单片机上实现的tcp/ip,很全的哦,需要的可以参考一下.」· C头文件 代码 · 共 29 行

H
29
字号
#ifndef	_AHDLC_H
#define	_AHDLC_H
#include "global.h"
#include "mbuf.h"

/* Asynch HDLC receiver control block */
struct ahdlc {
	int escaped;		/* Escape char (0x7d) just seen */
	int hunt;		/* Flushing input until next flag */
	struct mbuf *inframe;	/* Current frame being reassembled */
	int maxsize;		/* Maximum packet size */
	uint16 fcs;		/* current CRC value */
	int32 rxframes;		/* Valid frames received */
	int32 aborts;		/* Aborts seen */
	int32 toobigs;		/* Frames larger than maxsize */
	int32 crcerrs;		/* Frames with CRC errors */
	int32 runts;		/* Frames shorter than 2 bytes */
};
#define	HDLC_ESC_ASYNC	0x7d	/* Escapes special chars (0x7d, 0x7e) */
#define	HDLC_FLAG	0x7e	/* Ends each frame */
#define	HDLC_ESC_COMPL	0x20	/* XORed with special chars in data */

void init_hdlc(struct ahdlc *,int);
struct mbuf *ahdlcrx(struct ahdlc *,uint8);
struct mbuf *ahdlctx(struct mbuf *);

#endif	/* _AHDLC_H */

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?