📄 rocket_int.h
字号:
/***************************************************************************Function: sGetTxCntPurpose: Get the number of data bytes in the Tx FIFOCall: sGetTxCnt(ChP) CHANNEL_T *ChP; Ptr to channel structureReturn: Byte_t: The number of data bytes in the Tx FIFO.Comments: Byte read of count register is required to obtain Tx count.*/#define sGetTxCnt(ChP) sInB((ByteIO_t)(ChP)->TxRxCount)/*****************************************************************************Function: sGetTxRxDataIOPurpose: Get the I/O address of a channel's TxRx Data registerCall: sGetTxRxDataIO(ChP) CHANNEL_T *ChP; Ptr to channel structureReturn: WordIO_t: I/O address of a channel's TxRx Data register*/#define sGetTxRxDataIO(ChP) (ChP)->TxRxData/***************************************************************************Function: sInitChanDefaultsPurpose: Initialize a channel structure to it's default state.Call: sInitChanDefaults(ChP) CHANNEL_T *ChP; Ptr to the channel structureComments: This function must be called once for every channel structure that exists before any other SSCI calls can be made.*/#define sInitChanDefaults(ChP) \{ \ (ChP)->CtlP = NULLCTLPTR; \ (ChP)->AiopNum = NULLAIOP; \ (ChP)->ChanID = AIOPID_NULL; \ (ChP)->ChanNum = NULLCHAN; \}/***************************************************************************Function: sResetAiopByNumPurpose: Reset the AIOP by numberCall: sResetAiopByNum(CTLP,AIOPNUM) CONTROLLER_T CTLP; Ptr to controller structure AIOPNUM; AIOP index */#define sResetAiopByNum(CTLP,AIOPNUM) \{ \ sOutB((CTLP)->AiopIO[(AIOPNUM)]+_CMD_REG,RESET_ALL); \ sOutB((CTLP)->AiopIO[(AIOPNUM)]+_CMD_REG,0x0); \}/***************************************************************************Function: sSendBreakPurpose: Send a transmit BREAK signalCall: sSendBreak(ChP) CHANNEL_T *ChP; Ptr to channel structure*/#define sSendBreak(ChP) \{ \ (ChP)->TxControl[3] |= SETBREAK; \ sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->TxControl[0]); \}/***************************************************************************Function: sSetBaudPurpose: Set baud rateCall: sSetBaud(ChP,Divisor) CHANNEL_T *ChP; Ptr to channel structure Word_t Divisor; 16 bit baud rate divisor for channel*/#define sSetBaud(ChP,DIVISOR) \{ \ (ChP)->BaudDiv[2] = (Byte_t)(DIVISOR); \ (ChP)->BaudDiv[3] = (Byte_t)((DIVISOR) >> 8); \ sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->BaudDiv[0]); \}/***************************************************************************Function: sSetData7Purpose: Set data bits to 7Call: sSetData7(ChP) CHANNEL_T *ChP; Ptr to channel structure*/#define sSetData7(ChP) \{ \ (ChP)->TxControl[2] &= ~DATA8BIT; \ sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->TxControl[0]); \}/***************************************************************************Function: sSetData8Purpose: Set data bits to 8Call: sSetData8(ChP) CHANNEL_T *ChP; Ptr to channel structure*/#define sSetData8(ChP) \{ \ (ChP)->TxControl[2] |= DATA8BIT; \ sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->TxControl[0]); \}/***************************************************************************Function: sSetDTRPurpose: Set the DTR outputCall: sSetDTR(ChP) CHANNEL_T *ChP; Ptr to channel structure*/#define sSetDTR(ChP) \{ \ (ChP)->TxControl[3] |= SET_DTR; \ sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->TxControl[0]); \}/***************************************************************************Function: sSetEvenParityPurpose: Set even parityCall: sSetEvenParity(ChP) CHANNEL_T *ChP; Ptr to channel structureComments: Function sSetParity() can be used in place of functions sEnParity(), sDisParity(), sSetOddParity(), and sSetEvenParity().Warnings: This function has no effect unless parity is enabled with function sEnParity().*/#define sSetEvenParity(ChP) \{ \ (ChP)->TxControl[2] |= EVEN_PAR; \ sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->TxControl[0]); \}/***************************************************************************Function: sSetOddParityPurpose: Set odd parityCall: sSetOddParity(ChP) CHANNEL_T *ChP; Ptr to channel structureComments: Function sSetParity() can be used in place of functions sEnParity(), sDisParity(), sSetOddParity(), and sSetEvenParity().Warnings: This function has no effect unless parity is enabled with function sEnParity().*/#define sSetOddParity(ChP) \{ \ (ChP)->TxControl[2] &= ~EVEN_PAR; \ sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->TxControl[0]); \}/***************************************************************************Function: sSetRTSPurpose: Set the RTS outputCall: sSetRTS(ChP) CHANNEL_T *ChP; Ptr to channel structure*/#define sSetRTS(ChP) \{ \ (ChP)->TxControl[3] |= SET_RTS; \ sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->TxControl[0]); \}/***************************************************************************Function: sSetRxTriggerPurpose: Set the Rx FIFO trigger levelCall: sSetRxProcessor(ChP,Level) CHANNEL_T *ChP; Ptr to channel structure Byte_t Level; Number of characters in Rx FIFO at which the interrupt will be generated. Can be any of the following flags: TRIG_NO: no trigger TRIG_1: 1 character in FIFO TRIG_1_2: FIFO 1/2 full TRIG_7_8: FIFO 7/8 fullComments: An interrupt will be generated when the trigger level is reached only if function sEnInterrupt() has been called with flag RXINT_EN set. The RXF_TRIG flag in the Interrupt Idenfification register will be set whenever the trigger level is reached regardless of the setting of RXINT_EN.*/#define sSetRxTrigger(ChP,LEVEL) \{ \ (ChP)->RxControl[2] &= ~TRIG_MASK; \ (ChP)->RxControl[2] |= LEVEL; \ sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->RxControl[0]); \}/***************************************************************************Function: sSetStop1Purpose: Set stop bits to 1Call: sSetStop1(ChP) CHANNEL_T *ChP; Ptr to channel structure*/#define sSetStop1(ChP) \{ \ (ChP)->TxControl[2] &= ~STOP2; \ sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->TxControl[0]); \}/***************************************************************************Function: sSetStop2Purpose: Set stop bits to 2Call: sSetStop2(ChP) CHANNEL_T *ChP; Ptr to channel structure*/#define sSetStop2(ChP) \{ \ (ChP)->TxControl[2] |= STOP2; \ sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->TxControl[0]); \}/***************************************************************************Function: sSetTxXOFFCharPurpose: Set the Tx XOFF flow control characterCall: sSetTxXOFFChar(ChP,Ch) CHANNEL_T *ChP; Ptr to channel structure Byte_t Ch; The value to set the Tx XOFF character to*/#define sSetTxXOFFChar(ChP,CH) \{ \ (ChP)->R[0x07] = (CH); \ sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->R[0x04]); \}/***************************************************************************Function: sSetTxXONCharPurpose: Set the Tx XON flow control characterCall: sSetTxXONChar(ChP,Ch) CHANNEL_T *ChP; Ptr to channel structure Byte_t Ch; The value to set the Tx XON character to*/#define sSetTxXONChar(ChP,CH) \{ \ (ChP)->R[0x0b] = (CH); \ sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->R[0x08]); \}/***************************************************************************Function: sStartRxProcessorPurpose: Start a channel's receive processorCall: sStartRxProcessor(ChP) CHANNEL_T *ChP; Ptr to channel structureComments: This function is used to start a Rx processor after it was stopped with sStopRxProcessor() or sStopSWInFlowCtl(). It will restart both the Rx processor and software input flow control.*/#define sStartRxProcessor(ChP) sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->R[0])/***************************************************************************Function: sWriteTxBytePurpose: Write a transmit data byte to a channel. ByteIO_t io: Channel transmit register I/O address. This can be obtained with sGetTxRxDataIO(). Byte_t Data; The transmit data byte.Warnings: This function writes the data byte without checking to see if sMaxTxSize is exceeded in the Tx FIFO.*/#define sWriteTxByte(IO,DATA) sOutB(IO,DATA)int sInitController( CONTROLLER_T *CtlP, int CtlNum, ByteIO_t MudbacIO, ByteIO_t *AiopIOList, int AiopIOListSize, int IRQNum, Byte_t Frequency, int PeriodicOnly);int sPCIInitController( CONTROLLER_T *CtlP, int CtlNum, ByteIO_t *AiopIOList, int AiopIOListSize, int IRQNum, Byte_t Frequency, int PeriodicOnly);int sReadAiopID(ByteIO_t io);int sReadAiopNumChan(WordIO_t io);int sInitChan( CONTROLLER_T *CtlP, CHANNEL_T *ChP, int AiopNum, int ChanNum);Byte_t sGetRxErrStatus(CHANNEL_T *ChP);void sStopRxProcessor(CHANNEL_T *ChP);void sStopSWInFlowCtl(CHANNEL_T *ChP);void sFlushRxFIFO(CHANNEL_T *ChP);void sFlushTxFIFO(CHANNEL_T *ChP);int sWriteTxPrioByte(CHANNEL_T *ChP, Byte_t Data);void sEnInterrupts(CHANNEL_T *ChP,Word_t Flags);void sDisInterrupts(CHANNEL_T *ChP,Word_t Flags);extern Byte_t R[RDATASIZE];extern CONTROLLER_T sController[CTL_SIZE];extern Byte_t sIRQMap[16];extern Byte_t sBitMapClrTbl[8];extern Byte_t sBitMapSetTbl[8];extern int sClockPrescale;/* * Begin Linux specific definitions for the Rocketport driver * * This code is Copyright Theodore Ts'o, 1995-1997 */struct r_port { int magic; int line; int flags; int count; int blocked_open; struct tty_struct *tty; int board:2; int aiop:2; int chan:3; CONTROLLER_t *ctlp; CHANNEL_t channel; int closing_wait; int close_delay; int intmask; int xmit_fifo_room; /* room in xmit fifo */ unsigned char *xmit_buf; int xmit_head; int xmit_tail; int xmit_cnt; int session; int pgrp; int cd_status; int ignore_status_mask; int read_status_mask; int cps; struct termios normal_termios; struct termios callout_termios; struct tq_struct tqueue; struct wait_queue *open_wait; struct wait_queue *close_wait;}; #define RPORT_MAGIC 0x525001#define NUM_BOARDS 8#define MAX_RP_PORTS (32*NUM_BOARDS)/* * The size of the xmit buffer is 1 page, or 4096 bytes */#define XMIT_BUF_SIZE 4096/* number of characters left in xmit buffer before we ask for more */#define WAKEUP_CHARS 256/* Internal flags used only by the rocketport driver */#define ROCKET_INITIALIZED 0x80000000 /* Port is active */#define ROCKET_CLOSING 0x40000000 /* Serial port is closing */#define ROCKET_NORMAL_ACTIVE 0x20000000 /* Normal port is active */#define ROCKET_CALLOUT_ACTIVE 0x10000000 /* Callout port is active *//* * tty subtypes * */#define SERIAL_TYPE_NORMAL 1#define SERIAL_TYPE_CALLOUT 2/* * Assigned major numbers for the Comtrol Rocketport */#define TTY_ROCKET_MAJOR 46#define CUA_ROCKET_MAJOR 47/* * Utility function. */#ifndef MIN#define MIN(a,b) ((a) < (b) ? (a) : (b))#endif#ifdef PCI_VENDOR_ID_RP#undef PCI_VENDOR_ID_RP#undef PCI_DEVICE_ID_RP8OCTA#undef PCI_DEVICE_ID_RP8INTF#undef PCI_DEVICE_ID_RP16INTF#undef PCI_DEVICE_ID_RP32INTF#endif#define PCI_VENDOR_ID_RP 0x11fe#define PCI_DEVICE_ID_RP32INTF 0x0001#define PCI_DEVICE_ID_RP8INTF 0x0002#define PCI_DEVICE_ID_RP16INTF 0x0003#define PCI_DEVICE_ID_RP8OCTA 0x0005#ifndef PCI_DEVICE_ID_RP4QUAD#define PCI_DEVICE_ID_RP4QUAD 0x0004#endif#ifndef PCI_DEVICE_ID_RP8J#define PCI_DEVICE_ID_RP8J 0x0006#endif#ifndef PCI_DEVICE_ID_RPP4#define PCI_DEVICE_ID_RPP4 0x000A#endif#ifndef PCI_DEVICE_ID_RPP8#define PCI_DEVICE_ID_RPP8 0x000B#endif#ifndef PCI_DEVICE_ID_RP8M#define PCI_DEVICE_ID_RP8M 0x000C#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -