📄 disi.h
字号:
/***********************************************************************//* *//* MODULE: disi.h 1.3 *//* DATE: 17:19:23 - 98/10/20 *//* PURPOSE: This include file defines prototypes and templates used *//* in the DISI. *//* *//*---------------------------------------------------------------------*//* *//* Copyright 1994, Integrated Systems, Inc. *//* ALL RIGHTS RESERVED *//* *//* Permission is hereby granted to licensees of Integrated Systems, *//* Inc. products to use or abstract this computer program for the *//* sole purpose of implementing a product based on Integrated *//* Systems, Inc. products. No other rights to reproduce, use, *//* or disseminate this computer program, whether in part or in *//* whole, are granted. *//* *//* Integrated Systems, Inc. makes no representation or warranties *//* with respect to the performance of this computer program, and *//* specifically disclaims any responsibility for any damages, *//* special or consequential, connected with the use of this program. *//* *//*---------------------------------------------------------------------*//* *//* *//* *//***********************************************************************/#ifndef _DISI_H#define _DISI_H 1#ifdef GHS#pragma pack(1)#endif/*---------------------------------------------------------------------*//* Must include gsblk.h before this file *//*---------------------------------------------------------------------*/#ifndef _GSBLK_H #include "gsblk.h"#endif/*---------------------------------------------------------------------*//* Must include pna.h before this file *//*---------------------------------------------------------------------*/#ifndef _PNA_H #include "pna.h"#endiftypedef void *Lid;typedef void *Uid;/*---------------------------------------------------------------------*//* Data Structures *//* Following are templates of data structures used in the following *//* sections. *//*---------------------------------------------------------------------*/typedef struct { unsigned char LChar; unsigned char LFlags;} LineD;/*---------------------------------------------------------------------*//* The Mode will decide which structure to use: HdlcCfg should be used *//* for SIOCSYNC mode and UartCfg for non SIOCSYNC mode *//*---------------------------------------------------------------------*/struct HdlcCfg{ unsigned char TxClock; /* Type of TxC (int/ext/dpll)*/ unsigned char RxClock; /* Type of RxC (int/ext/dpll)*/ unsigned short MaxFrameSize; /* largest frame to Rx */ unsigned char Modulation; /* NRZ/NRZI/FM0/FM1/Manchester.*/ unsigned char Flags; /* Number of interframe flags */ unsigned short Crc32Bits; /* TRUE for 32 bits CRC */ unsigned short Address[4]; /* Addresses to recognize*/ unsigned short AddressMask; /* Address Mask */ unsigned long FrameCheckErrs; /* frame check errors */ unsigned long TramsmitUnderrunErrs; /* transmit underrun errors */ unsigned long ReceiveOverrunErrs; /* receive overruns errors */ unsigned long InterruptedFrames; /* frames that were stopped */ unsigned long AbortedFrames; /* frames that were aborted */ unsigned long Reserve[4]; /* Reserved field */};struct UartCfg{ unsigned long CharSize; /* # of bits in the character */ unsigned long Flags; /* Various settings */ LineD LineD[2]; /* line delimiters */ unsigned char XOnCharacter; /* XON Character (SW Flow) */ unsigned char XOffCharacter; /* XOFF Character (SW Flow) */ unsigned short MinChar; /* Min characters to receive */ unsigned short MaxTime; /* Max time between characters */ unsigned long ParityErrs; /* number of parity errors */ unsigned long FramingErrs; /* number of framing errors */ unsigned long OverrunErrs; /* number of overrun errors */ unsigned long AutoBaudEnb; /* is auto baud enabled */ unsigned long Reserve[4]; /* Reserved field */};typedef union { struct HdlcCfg Hdlc; struct UartCfg Uart;} ModeCfg;typedef struct { unsigned long Mode; /* Channel configuration */ ModeCfg Cfg; /* mode dependent configuration*/ unsigned long RBuffSize; /* Size of receive buffers */ unsigned long OutQLen; /* Max # of outstanding bufs */ unsigned long Baud; /* Baud Rate */ unsigned long LineMode; /* line mode */ void (*dataind)(Uid, mblk_t *, /* Data Indication routine */ unsigned long); void (*expind)(Uid, /* Exception indication routine*/ unsigned long); void (*datacnf)(Uid, mblk_t *, /* data confirmation routine */ unsigned long); void (*ctlcnf)(Uid, /* control confirmation routine*/ unsigned long); mblk_t *(*allocb)(int, int); /* allocate msg block routine */ void(*freemsg)(mblk_t *); /* free message list routine */ mblk_t *(*esballoc)(unsigned char *,/* attach msg block routine */ int, int, frtn_t *); Uid uid; /* Upper level ID */ unsigned long Reserve[4]; /* Reserved fields */} ChannelCfg;/*---------------------------------------------------------------------*//* SerialInit *//*---------------------------------------------------------------------*/void SerialInit(void);/*---------------------------------------------------------------------*//* SerialOpen *//*---------------------------------------------------------------------*/long SerialOpen( unsigned long channel, /* Channel to be initialized */ ChannelCfg *cfg, /* Configuration table */ Lid *lid, /* Lower layer reference pointer */ unsigned long *hdwflags /* Various hardware flags */ /* supported by the chip */);/*---------------------------------------------------------------------*//* This call is used to open a channel for a particular mode of *//* operation. The parameter channel indicates the serial channel to be *//* opened. cfg points to the configuration table that defines various *//* configurable parameters like baud rate and various line parameters. *//* See the Data Structures section for more details on the *//* configuration table. uid is a pointer to a user defined structure *//* The lower level will pass the uid pointer when making call-outs *//* that concern this channel. lid is returned by the DISI. lid is *//* the lower level's reference structure for this channel. All future *//* calls such as SerialSend, to the DISI by the upper layer will pass *//* lid. hdwflags is returned by the DISI to indicate the capability *//* of the serial chip set. *//* *//* hdwflags can be: *//*---------------------------------------------------------------------*/#define SIOCHDWHDLC 0x00000001 /* HDLC supported */#define SIOCHDWRXPOOL 0x00000002 /* has receive buffer pool *//*---------------------------------------------------------------------*//* If SIOCHDWRXPOOL is set then the lower level contains a buffer pool *//* to receive characters into and as buffers are sent up through the *//* DISI these buffers will need to be replenished. See the SerialIoctl *//* command SIOCREPLENISH and UDataInd call for more information. *//* *//*---------------------------------------------------------------------*//* SerialSend *//*---------------------------------------------------------------------*/long SerialSend( Lid lid, /* Lower layer reference */ mblk_t* mbp /* Message block pointer */);/*---------------------------------------------------------------------*//* SerialSend is used by the upper level serial driver to transfer *//* data through the DISI. lid is the lower level reference pointer *//* that was acquired during SerialOpen operation for the channel this *//* send is directed to. mbp is a pointer to the message block that *//* contains the data to be transmitted on the serial interface. *//* *//*---------------------------------------------------------------------*//* SerialIoctl *//*---------------------------------------------------------------------*/long SerialIoctl( Lid lid, /* Lower layer reference */ unsigned long cmd, /* Ioctl command */ void *arg /* Argument pointer */);/*---------------------------------------------------------------------*//* This call is used for specify various control operations which *//* modify the behavior of the DISI. Not all operations need be *//* supported by the Lower Layer chip set code. Any non supported *//* operation will return with the error code SIOCOPERATIONNOTSUP. *//* lid is the lower level reference pointer that was acquired during *//* SerialOpen operation for the channel that this ioctl command is *//* intended for. cmd specifies the type of control operation. arg *//* contains information which is specific to the operation. *//* *//*---------------------------------------------------------------------*//* The SerialIoctl commands are: *//*---------------------------------------------------------------------*//*---------------------------------------------------------------------*//* SIOCPOLL This calls is used to poll the serial device for *//* asynchronous events like data indication and exception indication. *//* It provides an ability to perform call-back functions without *//* interrupts or when interrupts are disabled. For example when pROBE *//* is in control, the processor operates with interrupts turned off. *//* This command will check for data received and exceptions and *//* trigger the call-back function for this condition as needed. *//*---------------------------------------------------------------------*/#define SIOCPOLL 0x00000001/*---------------------------------------------------------------------*//* SIOCGETA is used to get the channel's configuration. arg is a *//* pointer to a ChannelCfg structure. The current parameters are *//* copied to that structure. No callback is made. *//*---------------------------------------------------------------------*/#define SIOCGETA 0x00000002/*---------------------------------------------------------------------*//* SIOCPUTA is used to change the channel's configuration. arg is a *//* pointer to a ChannelCfg structure. The current parameters are set *//* from the values stored in that structure. No callback is made. *//*---------------------------------------------------------------------*/#define SIOCPUTA 0x00000003/*---------------------------------------------------------------------*//* SIOCBREAK A break character is sent out the channel. The argument *//* is ignored. No callback is made. *//*---------------------------------------------------------------------*/#define SIOCBREAK 0x00000004/*---------------------------------------------------------------------*//* SIOCMQRY is use to determine the modem controls supported by the *//* channel. arg is a pointer to a long int. A mask representing the */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -