⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 _zmodem.h

📁 DOS下采用中断接收数据的串口通讯的例子,很难找到的好东西!
💻 H
字号:
// ********************* START OF _ZMODEM.H *********************
//
//
// This header file has various constants used by the 
// Zmodem class.

#ifndef __ZMODEM_DOT_H
#define __ZMODEM_DOT_H

const int ZPAD      = '*';  // ZPAD starts every header
const int ZDLE      = 24;   // The general purpose escape code
const int ZBIN      = 'A';  // Starts a binary CRC-16 frame
const int ZHEX      = 'B';  // Starts a hex CRC-16 frame
const int ZBIN32    = 'C';  // Starts a binary CRC-32 frame
const int ZMAXSPLEN = 1024; // Max subpacket length

// These constants define all the various frame types

const int ZRQINIT   = 0;    // Request for receiver init frame
const int ZRINIT    = 1;    // A receiver init frame
const int ZSINIT    = 2;    // A sender init frame
const int ZACK      = 3;    // General purpose Acknowledge frame
const int ZFILE     = 4;    // File name and data
const int ZSKIP     = 5;    // Skip the incoming file
const int ZNAK      = 6;    // General purpose Not Acknowledge
const int ZABORT    = 7;    // Abort session
const int ZFIN      = 8;    // Session is complete
const int ZRPOS     = 9;    // Request to start sending from a
                            // specific address
const int ZDATA     = 10;   // Start of a data frame
const int ZEOF      = 11;   // End of file
const int ZFERR     = 12;   // Fatal Read or Write error D
const int ZCRC      = 13;   // Request for CRC value of a file
const int ZCHALLENGE= 14;   // Challenge frame
const int ZCOMPL    = 15;   // Request is complete
const int ZCAN      = 16;   // Remote end canceled
const int ZFREECNT  = 17;   // Request for free bytes 
                            // available on the target filesystem
const int ZCOMMAND  = 18;   // Command from sending program
const int ZSTDERR   = 19;   // Output to stderr data follows

// Escape sequences in binary data

const int ZCRCE     = 'h';  // CRC next, frame ends, header 
                            // follows
const int ZCRCG     = 'i';  // CRC next, frame continues nonstop
const int ZCRCQ     = 'j';  // CRC next, frame conts., expect ZACK
const int ZCRCW     = 'k';  // CRC next, ZACK expected, 
                            // end of frame
const int ZRUB0     = 'l';  // Translate to rubout, 0x7f
const int ZRUB1     = 'm';  // Translate to rubout, 0xff

// ReadDataFrame() return values

const int GOTFLAG   = 0x100;
const int GOTCRCE   = ZCRCE | GOTFLAG;  // ZDLE-ZCRCE received
const int GOTCRCG   = ZCRCG | GOTFLAG;  // ZDLE-ZCRCG received
const int GOTCRCQ   = ZCRCQ | GOTFLAG;  // ZDLE-ZCRCQ received
const int GOTCRCW   = ZCRCW | GOTFLAG;  // ZDLE-ZCRCW received
const int GOTCAN    = CAN   | GOTFLAG;  // CAN*5 seen

// Byte positions within header array

const int ZF0       = 3;        // Position 0 in the flags array
const int ZF1       = 2;
const int ZF2       = 1;
const int ZF3       = 0;
const int ZP0       = 0;       // Low order 8 bits of position
const int ZP1       = 1;
const int ZP2       = 2;
const int ZP3       = 3;

// Bit Masks for ZRINIT flags byte ZF0

const int CANFDX    = 0x01; // Rx can send and receive true 
                            // full duplex
const int CANOVIO   = 0x02; // Rx can receive data during disk I/O
const int CANBRK    = 0x04; // Rx can send a break signal
const int CANRLE    = 0x08; // Receiver can decode RLE
const int CANLZW    = 0x10; // Receiver can uncompress
const int CANFC32   = 0x20; // Receiver can use 32 bit CRC
const int ESCCTL    = 0x40; // Receiver expects ctl chars 
                            // to be escaped
const int ESC8      = 0x80; // Receiver expects 8th bit 
                            // to be escaped

// Miscellaneous constants

const int OK            =  0;
const int ERROR         = -1;
const int TIMEOUT       = -2;
const int GARBAGE_COUNT = -3;

#endif // #ifdef __ZMODEM_DOT_H

// ********************** END OF _ZMODEM.H **********************

⌨️ 快捷键说明

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