📄 diti.h
字号:
/*---------------------------------------------------------------------*/#define TERMPUTDEFTERM 0x0000000C/*---------------------------------------------------------------------*//* TERMTNMAPALLIO will redirect all serial I/O to a telnet session. arg *//* will point to a TERM_TN_MAP_PARAMS structure: *//*---------------------------------------------------------------------*/typedef struct { unsigned short flag; /* 1 - read 2 - write 3 - r/w */ unsigned short fd; /* file (socket) descriptor */ unsigned long tid; /* task ID */ int (*read)(); /* pointer to receive function */ int (*write)(); /* pointer to send function */ int (*close)(); /* (not used) */} TERM_TN_MAP_PARAMS;/*---------------------------------------------------------------------*//* flag can be one or both of the following: *//*---------------------------------------------------------------------*/#define TERM_TN_READ 1#define TERM_TN_WRITE 2/*---------------------------------------------------------------------*//* This command will store the values of flag, fd, read, and write in *//* global variables to be referenced in the TermRead and TermWrite *//* calls when reading and writing to the console. *//* *//* If the TERM_TN_READ is set in flag and TermRead is called then the *//* read function pointer will be used to call the correct read *//* function. This function is called with the following arguments: *//* *//* (*read) (fd, buffp, length, flag); *//* *//* If the TERM_TN_WRITE it is set in flag and TermWrite is called then *//* the write function pointer will be used to call the correct write *//* function. This function is called with the following arguments: *//* *//* (*write) (fd, buffp, length, flag); *//* *//* Both the read and write functions must be protected from multiple *//* access. (In other words both need semaphore control.) *//*---------------------------------------------------------------------*/#define TERMTNMAPALLIO 0x00000003/*---------------------------------------------------------------------*//* CONTNMAPTASKIO will redirect per task serial I/O to a telnet *//* session. arg is a pointer to a TERM_TN_MAP_PARAMS structure (same *//* as used in CONTNMAPALLIO). This command will store the value of fd *//* in the tasks TERM_IO_REG if flag is set. In this case the fd will *//* be used for both the read and write file descriptor. The register *//* will be set as follows: *//* *//* task_register = (fd << 12) | fd; *//* *//* If flag is not set then the TERM_IO_REG both the read fd and write *//* fd will be marked stale *//*---------------------------------------------------------------------*/#define FD_STALE_BIT 0x0800/*---------------------------------------------------------------------*//* When a TermRead call is made the tasks TERM_IO_REG will be checked. *//* If it is set the read fd will be checked for the FD_STALE_BIT bit. *//* If the stale bit is on then the read fd will be cleared and the *//* read will revert back to the Treminal channel. (If the write fd is *//* the same as the read fd the TERM_IO_REG will be cleared.). *//* *//* If the read fd is not stale then it will be checked to see what *//* type of fd its. The fd can be of two types, a pHILE type or a *//* socket type. A pHILE type has the FD_TYPE_BIT set: *//*---------------------------------------------------------------------*/#define FD_TYPE_BIT 0x0400#define FD_VALUE_BITS 0x03ff/*---------------------------------------------------------------------*//* A socket type does not have this bit set. *//* *//* If this is a pHILE type of redirection the pHILE read_f function *//* will be called: *//* *//* read_f ((long) read_fd, buffp, length, &parms->out_retval) *//* *//* If this is a socket read then the TermReadS call is made: *//* *//* TermReadS (data_pointer???, recv, read_fd, buffp, length, mode); *//* *//* TermReadS will be covered later in this document. *//* *//* When a TermWrite call is made the tasks TERM_IO_REG will be checked.*//* If it is set the write fd will be checked for the stale bit. If the *//* stale bit is on then the write fd will be cleared and the write *//* will revert back to the Treminal channel. (If the read fd is the *//* same as the write fd the TERM_IO_REG will be cleared.). *//* *//* If the write fd is not stale then it will be checked to see what *//* type of fd its. The fd can be of two types, a pHILE type or a *//* socket type. A pHILE type has the FD_TYPE_BIT set. *//* A socket type does not have this bit set. *//* If this is a pHILE type of redirection the pHILE write_f function *//* will be called: *//* *//* write_f ((long) write_fd, buffp, length); *//* *//* If this is a socket read then the TermReadS call is made: *//*---------------------------------------------------------------------*//* TermWriteS (send, write_fd, buffp, length, mode); *//*---------------------------------------------------------------------*//* The TERM_IO_REG is defined as: *//*---------------------------------------------------------------------*/#define TERM_IO_REG 15#define TERMTNMAPTASKIO 0x00000004/*---------------------------------------------------------------------*//* CONIOMAP will redirect serial I/O on a per task basis. arg will *//* point to a TERM_IO_MAO_PARMS type structure: *//*---------------------------------------------------------------------*/typedef struct { unsigned char direction; /* 0 - read 1 - write */ unsigned char type; /* file or socket */ unsigned short fd; /* file or socket descriptor */ unsigned long tid; /* ID of the task to be redirected*/} TERM_IO_MAP_PARMS;/*---------------------------------------------------------------------*//* type can be one of the following: *//*---------------------------------------------------------------------*/#define TERM_IO_SOCKET 0#define TERM_IO_FILE 1/*---------------------------------------------------------------------*//* This command will store the value of fd in the TERM_IO_REG of the *//* task who's task ID is tid. The TERM_IO_REG will be referenced in *//* the TermRead and TermWrite calls when reading and writing to the *//* console. direction will be used to determine if the fd is a read or *//* write file or socket descriptor. type will be used to set the file *//* type bit in the fd. If the type is TERM_IO_FILE then the *//* FD_TYPE_BIT will be set in the fd. The bit is left clear if the *//* type is TERM_IO_SOCKET. *//* *//* Reads and writes by this task will be handled in the same way as in *//* the case of TERMTNMAPTASKIO. *//*---------------------------------------------------------------------*/#define TERMIOMAP 0x00000005#define TERMHWFC 0x00000006#define TERMGETASYNCSTAT 0x00000007#define TERMGETSYNCSTAT 0x00000008#define TERMNUMOFCHANNELS 0x00000009#define TERMAUTOBAUD 0x0000000A/*---------------------------------------------------------------------*//* TermIoctl will return in parms->err zero on success or one of the *//* following error codes: *//* *//* TERM_NOPEN minor device has not been opened *//* TERM_NINIT driver not initialized *//* TERM_BAUD Invalid baud rate *//* TERM_CHARSIZE bad character size *//* TERM_BADFLAG flag not defined *//* TERM_MINOR Invalid minor device *//*---------------------------------------------------------------------*//*---------------------------------------------------------------------*//* TermClose will close the minor device (serial channel). This will *//* flush all transmit buffers, discard *//* all pending receive buffers and disable the receiver and *//* transmitter of the channel. All buffers associated with the channel *//* will be released (freed) and the device will hang up the line. All *//* further TermRead, TermWrite or TermIoctl calls to the channel will *//* return with the error TERM_NOPEN. *//*---------------------------------------------------------------------*/void TermClose (struct ioparms *parms);/*---------------------------------------------------------------------*//* *//* TermClose will return in parms->err zero on success or one of the *//* following error codes: *//* *//* TERM_NOPEN 0x10010212 minor device has not been opened *//* TERM_NINIT driver not initialized *//* TERM_MINOR Invalid minor device *//*---------------------------------------------------------------------*/#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -