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

📄 i2cmd.h

📁 h内核
💻 H
📖 第 1 页 / 共 2 页
字号:
/*********************************************************************************   (c) 1999 by Computone Corporation************************************************************************************   PACKAGE:     Linux tty Device Driver for IntelliPort II family of multiport*                serial I/O controllers.**   DESCRIPTION: Definitions and support for In-line and Bypass commands.*                Applicable only when the standard loadware is active.********************************************************************************///------------------------------------------------------------------------------// Revision History://// 10 October 1991   MAG First Draft//  7 November 1991  MAG Reflects some new commands// 20 February 1992  MAG CMD_HOTACK corrected: no argument.// 24 February 1992  MAG Support added for new commands for 1.4.x loadware.// 11 March 1992     MAG Additional commands.// 16 March 1992     MAG Additional commands.// 30 March 1992     MAG Additional command: CMD_DSS_NOW// 18 May   1992     MAG Changed CMD_OPOST////------------------------------------------------------------------------------#ifndef I2CMD_H      // To prevent multiple includes#define I2CMD_H   1#include "ip2types.h"// This module is designed to provide a uniform method of sending commands to// the board through command packets. The difficulty is, some commands take// parameters, others do not. Furthermore, it is often useful to send several// commands to the same channel as part of the same packet. (See also i2pack.h.)//// This module is designed so that the caller should not be responsible for// remembering the exact syntax of each command, or at least so that the// compiler could check things somewhat. I'll explain as we go...//// First, a structure which can embody the syntax of each type of command.//typedef struct _cmdSyntax{	UCHAR length;   // Number of bytes in the command	UCHAR flags;    // Information about the command (see below)	// The command and its parameters, which may be of arbitrary length. Don't	// worry yet how the parameters will be initialized; macros later take care	// of it. Also, don't worry about the arbitrary length issue; this structure	// is never used to allocate space (see i2cmd.c).	UCHAR cmd[2];} cmdSyntax, *cmdSyntaxPtr;// Bit assignments for flags#define INL 1           // Set if suitable for inline commands#define BYP 2           // Set if suitable for bypass commands#define BTH (INL|BYP)   // suitable for either!#define END 4           // Set if this must be the last command in a block#define VIP 8           // Set if this command is special in some way and really						// should only be sent from the library-level and not						// directly from user-level#define VAR 0x10        // This command is of variable length!//-----------------------------------// External declarations for i2cmd.c//-----------------------------------// Routine to set up parameters for the "define hot-key sequence" command. Since// there is more than one parameter to assign, we must use a function rather// than a macro (used usually).//extern cmdSyntaxPtr i2cmdUnixFlags(USHORT iflag,USHORT cflag,USHORT lflag);extern cmdSyntaxPtr i2cmdBaudDef(int which, USHORT rate);// Declarations for the global arrays used to bear the commands and their// arguments.//// Note: Since these are globals and the arguments might change, it is important// that the library routine COPY these into buffers from whence they would be// sent, rather than merely storing the pointers. In multi-threaded// environments, important that the copy should obtain before any context switch// is allowed. Also, for parameterized commands, DO NOT ISSUE THE SAME COMMAND// MORE THAN ONCE WITH THE SAME PARAMETERS in the same call.//static UCHAR ct02[];static UCHAR ct03[];static UCHAR ct04[];static UCHAR ct05[];static UCHAR ct06[];static UCHAR ct07[];static UCHAR ct08[];static UCHAR ct09[];static UCHAR ct10[];static UCHAR ct11[];static UCHAR ct12[];static UCHAR ct13[];static UCHAR ct14[];static UCHAR ct15[];static UCHAR ct16[];static UCHAR ct17[];static UCHAR ct18[];static UCHAR ct19[];static UCHAR ct20[];static UCHAR ct21[];static UCHAR ct22[];static UCHAR ct23[];static UCHAR ct24[];static UCHAR ct25[];static UCHAR ct26[];static UCHAR ct27[];static UCHAR ct28[];static UCHAR ct29[];static UCHAR ct30[];static UCHAR ct31[];static UCHAR ct32[];static UCHAR ct33[];static UCHAR ct34[];static UCHAR ct35[];static UCHAR ct36[];static UCHAR ct36a[];static UCHAR ct41[];static UCHAR ct42[];static UCHAR ct43[];static UCHAR ct44[];static UCHAR ct45[];static UCHAR ct46[];static UCHAR ct48[];static UCHAR ct49[];static UCHAR ct50[];static UCHAR ct51[];static UCHAR ct52[];static UCHAR ct56[];static UCHAR ct57[];static UCHAR ct58[];static UCHAR ct59[];static UCHAR ct60[];static UCHAR ct61[];static UCHAR ct62[];static UCHAR ct63[];static UCHAR ct64[];static UCHAR ct65[];static UCHAR ct66[];static UCHAR ct67[];static UCHAR ct68[];static UCHAR ct69[];static UCHAR ct70[];static UCHAR ct71[];static UCHAR ct72[];static UCHAR ct73[];static UCHAR ct74[];static UCHAR ct75[];static UCHAR ct76[];static UCHAR ct77[];static UCHAR ct78[];static UCHAR ct79[];static UCHAR ct80[];static UCHAR ct81[];static UCHAR ct82[];static UCHAR ct83[];static UCHAR ct84[];static UCHAR ct85[];static UCHAR ct86[];static UCHAR ct87[];static UCHAR ct88[];static UCHAR ct89[];static UCHAR ct90[];static UCHAR ct91[];static UCHAR cc01[];static UCHAR cc02[];// Now, refer to i2cmd.c, and see the character arrays defined there. They are// cast here to cmdSyntaxPtr.//// There are library functions for issuing bypass or inline commands. These// functions take one or more arguments of the type cmdSyntaxPtr. The routine// then can figure out how long each command is supposed to be and easily add it// to the list.//// For ease of use, we define manifests which return pointers to appropriate// cmdSyntaxPtr things. But some commands also take arguments. If a single// argument is used, we define a macro which performs the single assignment and// (through the expedient of a comma expression) references the appropriate// pointer. For commands requiring several arguments, we actually define a// function to perform the assignments.#define CMD_DTRUP	(cmdSyntaxPtr)(ct02)	// Raise DTR#define CMD_DTRDN	(cmdSyntaxPtr)(ct03)	// Lower DTR#define CMD_RTSUP	(cmdSyntaxPtr)(ct04)	// Raise RTS#define CMD_RTSDN	(cmdSyntaxPtr)(ct05)	// Lower RTS#define CMD_STARTFL	(cmdSyntaxPtr)(ct06)	// Start Flushing Data#define CMD_DTRRTS_UP (cmdSyntaxPtr)(cc01)	// Raise DTR and RTS#define CMD_DTRRTS_DN (cmdSyntaxPtr)(cc02)	// Lower DTR and RTS// Set Baud Rate for transmit and receive#define CMD_SETBAUD(arg) \	(((cmdSyntaxPtr)(ct07))->cmd[1] = (arg),(cmdSyntaxPtr)(ct07))#define CBR_50       1#define CBR_75       2#define CBR_110      3#define CBR_134      4#define CBR_150      5#define CBR_200      6#define CBR_300      7#define CBR_600      8#define CBR_1200     9#define CBR_1800     10#define CBR_2400     11#define CBR_4800     12#define CBR_9600     13#define CBR_19200    14#define CBR_38400    15#define CBR_2000     16#define CBR_3600     17#define CBR_7200     18#define CBR_56000    19#define CBR_57600    20#define CBR_64000    21#define CBR_76800    22#define CBR_115200   23#define CBR_C1       24    // Custom baud rate 1#define CBR_C2       25    // Custom baud rate 2#define CBR_153600   26#define CBR_230400   27#define CBR_307200   28#define CBR_460800   29#define CBR_921600   30// Set Character size//#define CMD_SETBITS(arg) \	(((cmdSyntaxPtr)(ct08))->cmd[1] = (arg),(cmdSyntaxPtr)(ct08))#define CSZ_5  0#define CSZ_6  1#define CSZ_7  2#define CSZ_8  3// Set number of stop bits//#define CMD_SETSTOP(arg) \	(((cmdSyntaxPtr)(ct09))->cmd[1] = (arg),(cmdSyntaxPtr)(ct09))#define CST_1  0#define CST_15 1  // 1.5 stop bits#define CST_2  2// Set parity option//#define CMD_SETPAR(arg) \	(((cmdSyntaxPtr)(ct10))->cmd[1] = (arg),(cmdSyntaxPtr)(ct10))#define CSP_NP 0  // no parity#define CSP_OD 1  // odd parity#define CSP_EV 2  // Even parity#define CSP_SP 3  // Space parity#define CSP_MK 4  // Mark parity// Define xon char for transmitter flow control//#define CMD_DEF_IXON(arg) \	(((cmdSyntaxPtr)(ct11))->cmd[1] = (arg),(cmdSyntaxPtr)(ct11))// Define xoff char for transmitter flow control//#define CMD_DEF_IXOFF(arg) \	(((cmdSyntaxPtr)(ct12))->cmd[1] = (arg),(cmdSyntaxPtr)(ct12))#define CMD_STOPFL   (cmdSyntaxPtr)(ct13) // Stop Flushing data// Acknowledge receipt of hotkey signal//#define CMD_HOTACK   (cmdSyntaxPtr)(ct14)// Define irq level to use. Should actually be sent by library-level code, not// directly from user...//#define CMDVALUE_IRQ 15 // For library use at initialization. Until this command						// is sent, board processing doesn't really start.#define CMD_SET_IRQ(arg) \	(((cmdSyntaxPtr)(ct15))->cmd[1] = (arg),(cmdSyntaxPtr)(ct15))#define CIR_POLL  0  // No IRQ - Poll#define CIR_3     3  // IRQ 3#define CIR_4     4  // IRQ 4#define CIR_5     5  // IRQ 5#define CIR_7     7  // IRQ 7#define CIR_10    10 // IRQ 10#define CIR_11    11 // IRQ 11#define CIR_12    12 // IRQ 12#define CIR_15    15 // IRQ 15// Select transmit flow xon/xoff options//#define CMD_IXON_OPT(arg) \	(((cmdSyntaxPtr)(ct16))->cmd[1] = (arg),(cmdSyntaxPtr)(ct16))#define CIX_NONE  0  // Incoming Xon/Xoff characters not special#define CIX_XON   1  // Xoff disable, Xon enable#define CIX_XANY  2  // Xoff disable, any key enable// Select receive flow xon/xoff options//#define CMD_OXON_OPT(arg) \	(((cmdSyntaxPtr)(ct17))->cmd[1] = (arg),(cmdSyntaxPtr)(ct17))#define COX_NONE  0  // Don't send Xon/Xoff#define COX_XON   1  // Send xon/xoff to start/stop incoming data#define CMD_CTS_REP  (cmdSyntaxPtr)(ct18) // Enable  CTS reporting#define CMD_CTS_NREP (cmdSyntaxPtr)(ct19) // Disable CTS reporting#define CMD_DCD_REP  (cmdSyntaxPtr)(ct20) // Enable  DCD reporting#define CMD_DCD_NREP (cmdSyntaxPtr)(ct21) // Disable DCD reporting#define CMD_DSR_REP  (cmdSyntaxPtr)(ct22) // Enable  DSR reporting#define CMD_DSR_NREP (cmdSyntaxPtr)(ct23) // Disable DSR reporting

⌨️ 快捷键说明

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