Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2018 lines
85 KiB

  1. /*-------------------------------------------------------------------
  2. ssci.h - Whole slew of macros for talking to RocketPort hardware.
  3. Copyright 1993-96 Comtrol Corporation. All rights reserved.
  4. |--------------------------------------------------------------------*/
  5. //#include "ntddk.h"
  6. //#include <conio.h> i hate includes of includes
  7. #define CHANPTR_T CHANNEL_T *
  8. #define ULONGPTR_T unsigned long *
  9. #define CTL_SIZE 4 /* max number of controllers in system */
  10. typedef PUCHAR BIOA_T; /* byte I/O address */
  11. typedef PUSHORT WIOA_T; /* word I/O address */
  12. typedef PULONG DWIOA_T; /* double word I/O address */
  13. #define _CDECL
  14. #define TRUE 1
  15. #define FALSE 0
  16. #define MCODE1_SIZE 72 /* number of bytes in microcode array */
  17. #define MCODE1REG_SIZE 52 /* number bytes in microcode reg array */
  18. #define AIOP_CTL_SIZE 4 /* max number AIOPs per controller */
  19. #define CHAN_AIOP_SIZE 8 /* max number channels per AIOP */
  20. // #define NULLDEV -1 /* identifies non-existant device */
  21. // #define NULLCTL -1 /* identifies non-existant controller */
  22. // #define NULLCTLPTR (CONTROLLER_T *)0 /* identifies non-existant controller */
  23. // #define NULLAIOP -1 /* identifies non-existant AIOP */
  24. // #define NULLCHAN -1 /* identifies non-existant channel */
  25. #define MAXTX_SIZE 250 /* max number of bytes allowed in Tx FIFO */
  26. #define CHANINT_EN 0x0100 /* flags to enable/disable channel ints */
  27. /*
  28. the revision field is used to extend the PCI device identifications...
  29. */
  30. #define PCI_REVISION_RMODEM_SOC 0x00
  31. #define PCI_REVISION_RMODEM_II 0x01
  32. /* Controller ID numbers */
  33. // #define CTLID_NULL -1 /* no controller exists */
  34. #define CTLID_0001 0x0001 /* controller release 1 */
  35. /* PCI Defines(have moved to opstr.h) */
  36. /* AIOP ID numbers, identifies AIOP type implementing channel */
  37. #define AIOPID_NULL -1 /* no AIOP or channel exists */
  38. #define AIOPID_0001 0x0001 /* AIOP release 1 */
  39. #define RX_HIWATER 512 /* sw input flow ctl high water mark */
  40. #define RX_LOWATER 256 /* sw input flow ctl low water mark */
  41. #define OFF 0
  42. #define ON 1
  43. #define NOCHANGE 2
  44. /* Error flags for RocketPort */
  45. #define ERR_PARITY 0x01 /* parity error */
  46. //Status
  47. /* Open type and TX and RX identifier flags (unsigned int) */
  48. #define COM_OPEN 0x0001 /* device open */
  49. #define COM_TX 0x0002 /* transmit */
  50. #define COM_RX 0x0004 /* receive */
  51. //Status
  52. /* Flow control flags (unsigned int) */
  53. #define COM_FLOW_NONE 0x0000
  54. #define COM_FLOW_IS 0x0008 /* input software flow control */
  55. #define COM_FLOW_IH 0x0010 /* input hardware flow control */
  56. #define COM_FLOW_OS 0x0020 /* output software flow control */
  57. #define COM_FLOW_OH 0x0040 /* output hardware flow control */
  58. #define COM_FLOW_OXANY 0x0080 /* restart output on any Rx char */
  59. #define COM_RXFLOW_ON 0x0100 /* Rx data flow is ON */
  60. #define COM_TXFLOW_ON 0x0200 /* Tx data flow is ON */
  61. //Status ... State flags
  62. #define COM_REQUEST_BREAK 0x0400
  63. /* Modem control flags (unsigned char) */
  64. #define COM_MDM_RTS 0x02 /* request to send */
  65. #define COM_MDM_DTR 0x04 /* data terminal ready */
  66. #define COM_MDM_CD CD_ACT /* carrier detect (0x08) */
  67. #define COM_MDM_DSR DSR_ACT /* data set ready (0x10) */
  68. #define COM_MDM_CTS CTS_ACT /* clear to send (0x20) */
  69. /* Stop bit flags (unsigned char) */
  70. #define COM_STOPBIT_1 0x01 /* 1 stop bit */
  71. #define COM_STOPBIT_2 0x02 /* 2 stop bits */
  72. /* Data bit flags (unsigned char) */
  73. #define COM_DATABIT_7 0x01 /* 7 data bits */
  74. #define COM_DATABIT_8 0x02 /* 8 data bits */
  75. /* Parity flags (unsigned char) */
  76. #define COM_PAR_NONE 0x00 /* no parity */
  77. #define COM_PAR_EVEN 0x02 /* even parity */
  78. #define COM_PAR_ODD 0x01 /* odd parity */
  79. /* Detection enable flags (unsigned int) */
  80. #define COM_DEN_NONE 0 /* no event detection enabled */
  81. #define COM_DEN_MDM 0x0001 /* enable modem control change detection */
  82. #define COM_DEN_RDA 0x0002 /* enable Rx data available detection */
  83. // Driver controller information
  84. #define DEV_SIZE 128 /* maximum number devices */
  85. #define SPANOFMUDBAC 0x04 // 4 bytes
  86. #define SPANOFAIOP 0x40 // 64 bytes
  87. #ifdef COMMENT_OUT
  88. /* Configuration information for all controllers */
  89. typedef struct
  90. {
  91. int Irq; /* IRQ number */
  92. int NumCtl; /* number of controllers in system */
  93. // int NumDev; /* number of devices in the system */
  94. // int InterruptingCtl; /* indicates the ctl that interrupts */
  95. int FirstISA; /* first isa so know where to start mudbacks */
  96. CFCTL_T CfCtl[CTL_SIZE];
  97. } CF_T;
  98. #endif
  99. /* Controller level information structure */
  100. /* The interrupt strobe bit of MUDBAC register 2 is never stored in Reg2
  101. because it is write only */
  102. typedef struct
  103. {
  104. int CtlID; /* controller ID */
  105. //int CtlNum; /* controller number */
  106. INTERFACE_TYPE BusType; /* PCIBus or Isa */
  107. unsigned char PCI_Slot;
  108. unsigned char BusNumber;
  109. USHORT PCI1;
  110. WIOA_T PCI1IO; /* I/O address for Pci register */
  111. BIOA_T MBaseIO; /* I/O address for MUDBAC */
  112. BIOA_T MReg1IO; /* I/O address for MUDBAC register 1 */
  113. BIOA_T MReg2IO; /* I/O address for MUDBAC register 2 */
  114. BIOA_T MReg3IO; /* I/O address for MUDBAC register 3 */
  115. unsigned char MReg2; /* copy of MUDBAC register 2 */
  116. unsigned char MReg3; /* copy of MUDBAC register 3 */
  117. int NumAiop; /* number of AIOPs on the controller */
  118. WIOA_T AiopIO[AIOP_CTL_SIZE]; /* AIOP's base I/O address */
  119. BIOA_T AiopIntChanIO[AIOP_CTL_SIZE]; /* AIOP's Int Chan Reg I/O add */
  120. int AiopID[AIOP_CTL_SIZE]; /* AIOP ID, or -1 if no AIOP exists */
  121. int AiopNumChan[AIOP_CTL_SIZE]; /* number of channels in AIOP */
  122. BYTE PortsPerAiop; // normally 8, but rplus this is 4
  123. BYTE ClkPrescaler;
  124. ULONG ClkRate;
  125. int PCI_DevID;
  126. int PCI_RevID; // due to odd PCI controller design, must use RevID to extend device IDs...
  127. int PCI_SVID;
  128. int PCI_SID;
  129. } CONTROLLER_T;
  130. /* Channel level information structure */
  131. typedef struct
  132. {
  133. /* Channel, AIOP, and controller identifiers */
  134. CONTROLLER_T *CtlP; /* ptr to controller information structure */
  135. int AiopNum; /* AIOP number on the controller */
  136. int ChanID; /* channel ID - indentifies type of AIOP */
  137. int ChanNum; /* channel within AIOP */
  138. /* Maximum number bytes allowed in Tx FIFO */
  139. int TxSize;
  140. /* AIOP's global direct register addresses */
  141. BIOA_T Cmd; /* AIOP's Command register */
  142. BIOA_T IntChan; /* AIOP's Interrupt channel register */
  143. BIOA_T IntMask; /* AIOP's Interrupt mask register */
  144. DWIOA_T IndexAddr; /* AIOP's Index Register */
  145. WIOA_T IndexData; /* AIOP's Index Register Data */
  146. /* Channel's direct register addresses */
  147. WIOA_T TxRxData; /* Transmit and Receive register address */
  148. WIOA_T ChanStat; /* Channel Status register address */
  149. WIOA_T TxRxCount; /* Tx and Rx FIFO count register address */
  150. BIOA_T IntID; /* Interrupt ID register address */
  151. /* Channel indirect register addresses */
  152. unsigned int TxFIFO; /* transmit FIFO */
  153. unsigned int TxFIFOPtrs; /* transmit FIFO out and in ptrs */
  154. unsigned int RxFIFO; /* receive FIFO */
  155. unsigned int RxFIFOPtrs; /* receive FIFO out and in ptrs */
  156. unsigned int TxPrioCnt; /* transmit priority count */
  157. unsigned int TxPrioPtr; /* transmit priority ptr */
  158. unsigned int TxPrioBuf; /* transmit priority buffer */
  159. /* Copy of channel's microcode */
  160. unsigned char MCode[MCODE1REG_SIZE]; /* channel's microcode registers */
  161. /* Control register save values */
  162. unsigned char BaudDiv[4]; /* baud rate divisor for channel */
  163. unsigned char TxControl[4]; /* transmit control register vals */
  164. unsigned char RxControl[4]; /* receive control register vals */
  165. unsigned char TxEnables[4]; /* transmit processor enable vals */
  166. unsigned char TxCompare[4]; /* transmit compare values 1 & 2 */
  167. unsigned char TxReplace1[4]; /* transmit replace value 1 - bytes 1 & 2 */
  168. unsigned char TxReplace2[4]; /* transmit replace value 2 */
  169. } CHANNEL_T;
  170. //--------------------------- Function prototypes
  171. int sInitController(CONTROLLER_T *CtlP,
  172. //int CtlNum,
  173. BIOA_T MudbacIO,
  174. BIOA_T *AiopIOList,
  175. unsigned int *PhyAiopIOList,
  176. int AiopIOListSize,
  177. int IRQNum,
  178. unsigned char Frequency,
  179. int PeriodicOnly,
  180. int BusType,
  181. int prescaler);
  182. int _CDECL sReadAiopID(BIOA_T io);
  183. int _CDECL sReadAiopNumChan(WIOA_T io);
  184. int _CDECL sInitChan(CONTROLLER_T *CtlP,
  185. CHANPTR_T ChP,
  186. int AiopNum,
  187. int ChanNum);
  188. unsigned char _CDECL sGetRxErrStatus(CHANPTR_T ChP);
  189. void _CDECL sSetParity(CHANPTR_T ChP,int Parity);
  190. void _CDECL sStopRxProcessor(CHANPTR_T ChP);
  191. void _CDECL sStopSWInFlowCtl(CHANPTR_T ChP);
  192. void _CDECL sFlushRxFIFO(CHANPTR_T ChP);
  193. void _CDECL sFlushTxFIFO(CHANPTR_T ChP);
  194. int _CDECL sFlushTxPriorityBuf(CHANPTR_T ChP,unsigned char *Data);
  195. unsigned char _CDECL sGetTxPriorityCnt(CHANPTR_T ChP);
  196. int _CDECL sReadRxBlk(CHANPTR_T ChP,unsigned char *Buffer,int Count);
  197. ULONG _CDECL sWriteTxBlk(CHANPTR_T ChP,PUCHAR Buffer,ULONG Count);
  198. int _CDECL sWriteTxPrioBlk(CHANPTR_T ChP,unsigned char *Buffer,int Count);
  199. int _CDECL sWriteTxPrioByte(CHANPTR_T ChP,unsigned char Data);
  200. void _CDECL sEnInterrupts(CHANPTR_T ChP,unsigned int Flags);
  201. void _CDECL sDisInterrupts(CHANPTR_T ChP,unsigned int Flags);
  202. void _CDECL sReadMicrocode(CHANPTR_T ChP,char *Buffer,int Count);
  203. int sSetBaudRate(CHANNEL_T *ChP,
  204. ULONG desired_baud,
  205. USHORT SetHardware);
  206. void sChanOutWI(CHANNEL_T *ChP, USHORT RegNum, ULONG val);
  207. void sModemReset(CHANNEL_T *ChP, int on);
  208. void sModemWriteROW(CHANNEL_T *ChP, USHORT CountryCode);
  209. void sModemWriteDelay(CHANNEL_T *ChP,char *string, int length);
  210. void sModemWrite(CHANNEL_T *ChP,char *string,int length);
  211. void sModemSpeakerEnable(CHANNEL_T *ChP);
  212. int sModemRead(CHANNEL_T *ChP,char *string,int length,int poll_retries);
  213. int sModemReadChoice(CHANNEL_T *ChP,char *string0,int length0,char *string1,int length1,int poll_retries);
  214. int sTxFIFOReady(CHANNEL_T *ChP);
  215. int sTxFIFOStatus(CHANNEL_T *ChP);
  216. int sRxFIFOReady(CHANNEL_T *ChP);
  217. /*-------------------------------------------------------------------
  218. Function: sClrBreak
  219. Purpose: Stop sending a transmit BREAK signal
  220. Call: sClrBreak(ChP)
  221. CHANPTR_T ChP; Ptr to channel structure
  222. Return: void
  223. ---------------------------------------------------------------------*/
  224. #define sClrBreak(CHP) \
  225. { \
  226. (CHP)->TxControl[3] &= ~SETBREAK; \
  227. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->TxControl[0]); \
  228. }
  229. /*-------------------------------------------------------------------
  230. Function: sClrDTR
  231. Purpose: Clr the DTR output
  232. Call: sClrDTR(ChP)
  233. CHANPTR_T ChP; Ptr to channel structure
  234. Return: void
  235. ---------------------------------------------------------------------*/
  236. #define sClrDTR(CHP) \
  237. { \
  238. (CHP)->TxControl[3] &= ~SET_DTR; \
  239. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->TxControl[0]); \
  240. }
  241. /*-------------------------------------------------------------------
  242. Function: sClrNextInBitMap
  243. Purpose: Clear the bit within a bit map of the next number needing service.
  244. Call: sGetNextInBitMap(BitMap,Number)
  245. unsigned char BitMap; The bit map. Since this is a macro, the
  246. variable holding the bit map can be passed directly, rather
  247. than a pointer to the variable.
  248. int Number; Next number needing service. This is the same number
  249. returned from the preceeding call to sGetNextInBitMap().
  250. Return: void
  251. Comments: This function should be called immediately after calling
  252. sGetNextInBitMap().
  253. ---------------------------------------------------------------------*/
  254. //#define sClrNextInBitMap(BITMAP,NUMBER) (BITMAP) &= sBitMapClrTbl[NUMBER]
  255. /*-------------------------------------------------------------------
  256. Function: sClrRTS
  257. Purpose: Clr the RTS output
  258. Call: sClrRTS(ChP)
  259. CHANPTR_T ChP; Ptr to channel structure
  260. Return: void
  261. ---------------------------------------------------------------------*/
  262. #define sClrRTS(CHP) \
  263. { \
  264. (CHP)->TxControl[3] &= ~SET_RTS; \
  265. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->TxControl[0]); \
  266. }
  267. /*-------------------------------------------------------------------
  268. Function: sClrTxXOFF
  269. Purpose: Clear any existing transmit software flow control off condition
  270. Call: sClrTxXOFF(ChP)
  271. CHANPTR_T ChP; Ptr to channel structure
  272. Return: void
  273. ---------------------------------------------------------------------*/
  274. #define sClrTxXOFF(CHP) \
  275. { \
  276. sOutB((PUCHAR)(CHP)->Cmd,(unsigned char)(TXOVERIDE | (CHP)->ChanNum)); \
  277. sOutB((PUCHAR)(CHP)->Cmd,(unsigned char)(CHP)->ChanNum); \
  278. }
  279. /*-------------------------------------------------------------------
  280. Function: sPCIControllerEOI
  281. Purpose: Strobe the PCI End Of Interrupt bit.
  282. Call: sPCIControllerEOI(CtlP)
  283. CONTROLLER_T *CtlP; Ptr to controller structure
  284. Return: void
  285. ---------------------------------------------------------------------*/
  286. //#define sPCIControllerEOI(CTLP) sOutB(((BIOA_T)(CTLP)->AiopIO[0]+_PCI_INT_FUNC),(unsigned char)(PCI_STROBE));
  287. #define sPCIControllerEOI(CTLP) sOutW((CTLP)->PCI1IO, \
  288. (USHORT)((CTLP)->PCI1 | PCI_STROBE))
  289. /*-------------------------------------------------------------------
  290. Function: sControllerEOI
  291. Purpose: Strobe the MUDBAC's End Of Interrupt bit.
  292. Call: sControllerEOI(CtlP)
  293. CONTROLLER_T *CtlP; Ptr to controller structure
  294. Return: void
  295. ---------------------------------------------------------------------*/
  296. #define sControllerEOI(CTLP) sOutB((PUCHAR)(CTLP)->MReg2IO,(unsigned char)((CTLP)->MReg2 | INT_STROB))
  297. /*-------------------------------------------------------------------
  298. Function: sDisAiop
  299. Purpose: Disable I/O access to an AIOP
  300. Call: sDisAiop(CltP)
  301. CONTROLLER_T *CtlP; Ptr to controller structure
  302. int AiopNum; Number of AIOP on controller
  303. Return: void
  304. ---------------------------------------------------------------------*/
  305. #define sDisAiop(CTLP,AIOPNUM) \
  306. { \
  307. (CTLP)->MReg3 &= (~(1 << (AIOPNUM))); \
  308. sOutB((CTLP)->MReg3IO,(CTLP)->MReg3); \
  309. }
  310. /*-------------------------------------------------------------------
  311. Function: sDisCTSFlowCtl
  312. Purpose: Disable output flow control using CTS
  313. Call: sDisCTSFlowCtl(ChP)
  314. CHANPTR_T ChP; Ptr to channel structure
  315. Return: void
  316. ---------------------------------------------------------------------*/
  317. #define sDisCTSFlowCtl(CHP) \
  318. { \
  319. (CHP)->TxControl[2] &= ~CTSFC_EN; \
  320. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->TxControl[0]); \
  321. }
  322. /*-------------------------------------------------------------------
  323. Function: sDisGlobalInt
  324. Purpose: Disable global interrupts for a controller
  325. Call: sDisGlobalInt(CtlP)
  326. CONTROLLER_T *CtlP; Ptr to controller structure
  327. Return: void
  328. ---------------------------------------------------------------------*/
  329. #define sDisGlobalInt(CTLP) \
  330. { \
  331. (CTLP)->MReg2 &= ~INTR_EN; \
  332. sOutB((CTLP)->MReg2IO,(CTLP)->MReg2); \
  333. }
  334. /*-------------------------------------------------------------------
  335. Function: sDisIXANY
  336. Purpose: Disable IXANY Software Flow Control
  337. Call: sDisIXANY(ChP)
  338. CHANPTR_T ChP; Ptr to channel structure
  339. Return: void
  340. ---------------------------------------------------------------------*/
  341. #define sDisIXANY(CHP) \
  342. { \
  343. (CHP)->MCode[IXANY_DATA] = IXANY_DIS; \
  344. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->MCode[IXANY_OUT]); \
  345. }
  346. /*-------------------------------------------------------------------
  347. Function: sDisLocalLoopback
  348. Purpose: Disable local loopback of transmit to receive
  349. Call: sDisLocalLoopback(ChP)
  350. CHANPTR_T ChP; Ptr to channel structure
  351. Return: void
  352. ---------------------------------------------------------------------*/
  353. #define sDisLocalLoopback(CHP) \
  354. { \
  355. (CHP)->TxControl[3] &= ~LOCALLOOP; \
  356. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->TxControl[0]); \
  357. }
  358. /*-------------------------------------------------------------------
  359. Function: DisParity
  360. Purpose: Disable parity
  361. Call: sDisParity(ChP)
  362. CHANPTR_T ChP; Ptr to channel structure
  363. Return: void
  364. Comments: Function sSetParity() can be used in place of functions sEnParity(),
  365. sDisParity(), sSetOddParity(), and sSetEvenParity().
  366. ---------------------------------------------------------------------*/
  367. #define sDisParity(CHP) \
  368. { \
  369. (CHP)->TxControl[2] &= ~PARITY_EN; \
  370. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->TxControl[0]); \
  371. }
  372. /*-------------------------------------------------------------------
  373. Function: sDisRTSFlowCtl
  374. Purpose: Disable input flow control using RTS
  375. Call: sDisRTSFlowCtl(ChP)
  376. CHANPTR_T ChP; Ptr to channel structure
  377. Return: void
  378. ---------------------------------------------------------------------*/
  379. #define sDisRTSFlowCtl(CHP) \
  380. { \
  381. (CHP)->RxControl[2] &= ~RTSFC_EN; \
  382. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->RxControl[0]); \
  383. }
  384. /*-------------------------------------------------------------------
  385. Function: sDisRTSToggle
  386. Purpose: Disable RTS toggle
  387. Call: sDisRTSToggle(ChP)
  388. CHANPTR_T ChP; Ptr to channel structure
  389. Return: void
  390. ---------------------------------------------------------------------*/
  391. #define sDisRTSToggle(CHP) \
  392. { \
  393. (CHP)->TxControl[2] &= ~RTSTOG_EN; \
  394. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->TxControl[0]); \
  395. }
  396. /*-------------------------------------------------------------------
  397. Function: sDisRxCompare1
  398. Purpose: Disable Rx compare byte 1
  399. Call: sDisRxCompare1(ChP)
  400. CHANPTR_T ChP; Ptr to channel structure
  401. Return: void
  402. Comments: This function is used to disable Rx replace 1, Rx ignore 1,
  403. and Rx compare and interrupt 1.
  404. ---------------------------------------------------------------------*/
  405. #define sDisRxCompare1(CHP) \
  406. { \
  407. (CHP)->MCode[RXCMP1_DATA] = RXCMP1_DIS; \
  408. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->MCode[RXCMP1_OUT]); \
  409. (CHP)->MCode[IGREP1_DATA] = IG_REP1_DIS; \
  410. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->MCode[IGREP1_OUT]); \
  411. (CHP)->MCode[INTCMP1_DATA] = INTCMP1_DIS; \
  412. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->MCode[INTCMP1_OUT]); \
  413. }
  414. /*-------------------------------------------------------------------
  415. Function: sDisRxCompare0
  416. Purpose: Disable Rx compare byte 0
  417. Call: sDisRxCompare0(ChP)
  418. CHANPTR_T ChP; Ptr to channel structure
  419. Return: void
  420. Comments: This function is used to disable Rx ignore 0,
  421. ---------------------------------------------------------------------*/
  422. #define sDisRxCompare0(CHP) \
  423. { \
  424. (CHP)->MCode[IGNORE0_DATA] = IGNORE0_DIS; \
  425. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->MCode[IGNORE0_OUT]); \
  426. }
  427. /*-------------------------------------------------------------------
  428. Function: sDisRxCompare2
  429. Purpose: Disable Rx compare byte 2
  430. Call: sDisRxCompare2(ChP)
  431. CHANPTR_T ChP; Ptr to channel structure
  432. Return: void
  433. Comments: This function is used to disable Rx replace 2, Rx ignore 2,
  434. and Rx compare and interrupt 2.
  435. ---------------------------------------------------------------------*/
  436. #define sDisRxCompare2(CHP) \
  437. { \
  438. (CHP)->MCode[RXCMP2_DATA] = RXCMP2_DIS; \
  439. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->MCode[RXCMP2_OUT]); \
  440. (CHP)->MCode[IGREP2_DATA] = IG_REP2_DIS; \
  441. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->MCode[IGREP2_OUT]); \
  442. (CHP)->MCode[INTCMP2_DATA] = INTCMP2_DIS; \
  443. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->MCode[INTCMP2_OUT]); \
  444. }
  445. /*-------------------------------------------------------------------
  446. Function: sDisRxFIFO
  447. Purpose: Disable Rx FIFO
  448. Call: sDisRxFIFO(ChP)
  449. CHANPTR_T ChP; Ptr to channel structure
  450. Return: void
  451. ---------------------------------------------------------------------*/
  452. #define sDisRxFIFO(CHP) \
  453. { \
  454. (CHP)->MCode[RXFIFO_DATA] = RXFIFO_DIS; \
  455. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->MCode[RXFIFO_OUT]); \
  456. }
  457. /*-------------------------------------------------------------------
  458. Function: sDisRxStatusMode
  459. Purpose: Disable the Rx status mode
  460. Call: sDisRxStatusMode(ChP)
  461. CHANPTR_T ChP; Ptr to channel structure
  462. Return: void
  463. Comments: This takes the channel out of the receive status mode. All
  464. subsequent reads of receive data using sReadRxWord() will return
  465. two data bytes.
  466. ---------------------------------------------------------------------*/
  467. #define sDisRxStatusMode(CHP) sOutW((CHP)->ChanStat,0)
  468. /*-------------------------------------------------------------------
  469. Function: sDisTransmit
  470. Purpose: Disable transmit
  471. Call: sDisTransmit(ChP)
  472. CHANPTR_T ChP; Ptr to channel structure
  473. Return: void
  474. This disables movement of Tx data from the Tx FIFO into the 1 byte
  475. Tx buffer. Therefore there could be up to a 2 byte latency
  476. between the time sDisTransmit() is called and the transmit buffer
  477. and transmit shift register going completely empty.
  478. ---------------------------------------------------------------------*/
  479. #define sDisTransmit(CHP) \
  480. { \
  481. (CHP)->TxControl[3] &= ~TX_ENABLE; \
  482. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->TxControl[0]); \
  483. }
  484. /*-------------------------------------------------------------------
  485. Function: sDisTxCompare1
  486. Purpose: Disable Tx compare byte 1
  487. Call: sDisTxCompare1(ChP)
  488. CHANPTR_T ChP; Ptr to channel structure
  489. Return: void
  490. Comments: This function is used to disable Tx replace 1 with 1, Tx replace
  491. 1 with 2, and Tx ignore 1.
  492. ---------------------------------------------------------------------*/
  493. #define sDisTxCompare1(CHP) \
  494. { \
  495. (CHP)->TxEnables[2] &= ~COMP1_EN; \
  496. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->TxEnables[0]); \
  497. }
  498. /*-------------------------------------------------------------------
  499. Function: sDisTxCompare2
  500. Purpose: Disable Tx compare byte 2
  501. Call: sDisTxCompare2(ChP)
  502. CHANPTR_T ChP; Ptr to channel structure
  503. Return: void
  504. Comments: This function is used to disable Tx replace 2 with 1 and Tx ignore 2.
  505. ---------------------------------------------------------------------*/
  506. #define sDisTxCompare2(CHP) \
  507. { \
  508. (CHP)->TxEnables[2] &= ~COMP2_EN; \
  509. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->TxEnables[0]); \
  510. }
  511. /*-------------------------------------------------------------------
  512. Function: sDisTxSoftFlowCtl
  513. Purpose: Disable Tx Software Flow Control
  514. Call: sDisTxSoftFlowCtl(ChP)
  515. CHANPTR_T ChP; Ptr to channel structure
  516. Return: void
  517. ---------------------------------------------------------------------*/
  518. #define sDisTxSoftFlowCtl(CHP) \
  519. { \
  520. (CHP)->MCode[TXSWFC_DATA] = TXSWFC_DIS; \
  521. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->MCode[TXSWFC_OUT]); \
  522. }
  523. /*-------------------------------------------------------------------
  524. Function: sEnAiop
  525. Purpose: Enable I/O access to an AIOP
  526. Call: sEnAiop(CltP)
  527. CONTROLLER_T *CtlP; Ptr to controller structure
  528. int AiopNum; Number of AIOP on controller
  529. Return: void
  530. ---------------------------------------------------------------------*/
  531. #define sEnAiop(CTLP,AIOPNUM) \
  532. { \
  533. (CTLP)->MReg3 |= (1 << (AIOPNUM)); \
  534. sOutB((CTLP)->MReg3IO,(CTLP)->MReg3); \
  535. }
  536. /*-------------------------------------------------------------------
  537. Function: sEnCTSFlowCtl
  538. Purpose: Enable output flow control using CTS
  539. Call: sEnCTSFlowCtl(ChP)
  540. CHANPTR_T ChP; Ptr to channel structure
  541. Return: void
  542. ---------------------------------------------------------------------*/
  543. #define sEnCTSFlowCtl(CHP) \
  544. { \
  545. (CHP)->TxControl[2] |= CTSFC_EN; \
  546. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->TxControl[0]); \
  547. }
  548. /*-------------------------------------------------------------------
  549. sIsCTSFlowCtlEnabled(CHP) -
  550. |---------------------------------------------------------------------*/
  551. #define sIsCTSFlowCtlEnabled(CHP) \
  552. { ((CHP)->TxControl[2] & CTSFC_EN) }
  553. /*-------------------------------------------------------------------
  554. Function: sDisGlobalIntPCI
  555. Purpose: Disable global interrupts for a controller
  556. Call: sDisGlobalIntPCI(CtlP)
  557. CONTROLLER_T *CtlP; Ptr to controller structure
  558. Return: void
  559. ---------------------------------------------------------------------*/
  560. #define sDisGlobalIntPCI(CTLP) \
  561. { \
  562. (CTLP)->PCI1 &= ~INTR_EN_PCI; \
  563. sOutW((WIOA_T)CtlP->PCI1IO,(USHORT)CtlP->PCI1); \
  564. }
  565. /*-------------------------------------------------------------------
  566. Function: sEnGlobalIntPCI
  567. Purpose: Enable global interrupts for a controller
  568. Call: sEnGlobalInt(CtlP)
  569. CONTROLLER_T *CtlP; Ptr to controller structure
  570. Return: void
  571. ---------------------------------------------------------------------*/
  572. #define sEnGlobalIntPCI(CTLP) \
  573. { \
  574. (CTLP)->PCI1 |= INTR_EN_PCI; \
  575. sOutW(CtlP->PCI1IO,(USHORT)CtlP->PCI1); \
  576. }
  577. /*-------------------------------------------------------------------
  578. Function: sEnGlobalInt
  579. Purpose: Enable global interrupts for a controller
  580. Call: sEnGlobalInt(CtlP)
  581. CONTROLLER_T *CtlP; Ptr to controller structure
  582. Return: void
  583. ---------------------------------------------------------------------*/
  584. #define sEnGlobalInt(CTLP) \
  585. { \
  586. (CTLP)->MReg2 |= INTR_EN; \
  587. sOutB((CTLP)->MReg2IO,(CTLP)->MReg2); \
  588. }
  589. /*-------------------------------------------------------------------
  590. Function: sEnIXANY
  591. Purpose: Enable IXANY Software Flow Control
  592. Call: sEnIXANY(ChP)
  593. CHANPTR_T ChP; Ptr to channel structure
  594. Return: void
  595. ---------------------------------------------------------------------*/
  596. #define sEnIXANY(CHP) \
  597. { \
  598. (CHP)->MCode[IXANY_DATA] = IXANY_EN; \
  599. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->MCode[IXANY_OUT]); \
  600. }
  601. /*-------------------------------------------------------------------
  602. Function: sEnLocalLoopback
  603. Purpose: Enable local loopback of transmit to receive
  604. Call: sEnLocalLoopback(ChP)
  605. CHANPTR_T ChP; Ptr to channel structure
  606. Return: void
  607. ---------------------------------------------------------------------*/
  608. #define sEnLocalLoopback(CHP) \
  609. { \
  610. (CHP)->TxControl[3] |= LOCALLOOP; \
  611. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->TxControl[0]); \
  612. }
  613. /*-------------------------------------------------------------------
  614. Function: EnParity
  615. Purpose: Enable parity
  616. Call: sEnParity(ChP)
  617. CHANPTR_T ChP; Ptr to channel structure
  618. Return: void
  619. Comments: Function sSetParity() can be used in place of functions sEnParity(),
  620. sDisParity(), sSetOddParity(), and sSetEvenParity().
  621. Warnings: Before enabling parity odd or even parity should be chosen using
  622. functions sSetOddParity() or sSetEvenParity().
  623. ---------------------------------------------------------------------*/
  624. #define sEnParity(CHP) \
  625. { \
  626. (CHP)->TxControl[2] |= PARITY_EN; \
  627. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->TxControl[0]); \
  628. }
  629. /*-------------------------------------------------------------------
  630. Function: sEnRTSFlowCtl
  631. Purpose: Enable input flow control using RTS
  632. Call: sEnRTSFlowCtl(ChP)
  633. CHANPTR_T ChP; Ptr to channel structure
  634. Return: void
  635. Warnings: RTS toggle and the RTS output will be both be cleared by this
  636. function. The original state of RTS toggle and RTS output will
  637. not be preserved after a subsequent call to sDisRTSFlowCtl().
  638. ---------------------------------------------------------------------*/
  639. #define sEnRTSFlowCtl(CHP) \
  640. { \
  641. (CHP)->TxControl[2] &= ~RTSTOG_EN; \
  642. (CHP)->TxControl[3] &= ~SET_RTS; \
  643. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->TxControl[0]); \
  644. (CHP)->RxControl[2] |= RTSFC_EN; \
  645. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->RxControl[0]); \
  646. }
  647. /*-------------------------------------------------------------------
  648. sIsRTSFlowCtlEnabled
  649. ---------------------------------------------------------------------*/
  650. #define sIsRTSFlowCtlEnabled(CHP) \
  651. { ((CHP)->TxControl[2] & RTSTOG_EN) }
  652. /*-------------------------------------------------------------------
  653. Function: sEnRTSToggle
  654. Purpose: Enable RTS toggle
  655. Call: sEnRTSToggle(ChP)
  656. CHANPTR_T ChP; Ptr to channel structure
  657. Return: void
  658. Comments: This function will disable RTS flow control and clear the RTS
  659. line to allow operation of RTS toggle.
  660. ---------------------------------------------------------------------*/
  661. #define sEnRTSToggle(CHP) \
  662. { \
  663. (CHP)->RxControl[2] &= ~RTSFC_EN; \
  664. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->RxControl[0]); \
  665. (CHP)->TxControl[2] |= RTSTOG_EN; \
  666. (CHP)->TxControl[3] &= ~SET_RTS; \
  667. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->TxControl[0]); \
  668. }
  669. /*-------------------------------------------------------------------
  670. Function: sEnRxFIFO
  671. Purpose: Enable Rx FIFO
  672. Call: sEnRxFIFO(ChP)
  673. CHANPTR_T ChP; Ptr to channel structure
  674. Return: void
  675. ---------------------------------------------------------------------*/
  676. #define sEnRxFIFO(CHP) \
  677. { \
  678. (CHP)->MCode[RXFIFO_DATA] = RXFIFO_EN; \
  679. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->MCode[RXFIFO_OUT]); \
  680. }
  681. /*-------------------------------------------------------------------
  682. Function: sEnRxIgnore0
  683. Purpose: Enable compare of Rx data with compare byte #1 and ignore (discard)
  684. that byte if a match is found.
  685. Call: sEnRxIgnore0(ChP,CmpByte)
  686. CHANPTR_T ChP; Ptr to channel structure
  687. unsigned char CmpByte; Byte to compare Rx data byte with
  688. Return: void
  689. Comments: This function enables comparison of the receive data byte
  690. with CmpByte. The comparison is done after the receive data
  691. byte has been masked (see sSetRxMask()). If a match is found the
  692. receive data byte is ignored (discarded).
  693. Rx ignore 0 can be disabled with sDisRxCompare0().
  694. ---------------------------------------------------------------------*/
  695. #define sEnRxIgnore0(CHP,CMPBYTE) \
  696. { \
  697. (CHP)->MCode[RXCMPVAL0_DATA] = (CMPBYTE); \
  698. (CHP)->MCode[IGNORE0_DATA] = IGNORE0_EN; \
  699. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->MCode[IGNORE0_OUT]); \
  700. }
  701. /*-------------------------------------------------------------------
  702. Function: sEnRxIgnore1
  703. Purpose: Enable compare of Rx data with compare byte #1 and ignore (discard)
  704. that byte if a match is found.
  705. Call: sEnRxIgnore1(ChP,CmpByte)
  706. CHANPTR_T ChP; Ptr to channel structure
  707. unsigned char CmpByte; Byte to compare Rx data byte with
  708. Return: void
  709. Comments: This function enables comparison of the receive data byte
  710. with CmpByte. The comparison is done after the receive data
  711. byte has been masked (see sSetRxMask()). If a match is found the
  712. receive data byte is ignored (discarded).
  713. Rx ignore 1 can be disabled with sDisRxCompare1().
  714. ---------------------------------------------------------------------*/
  715. #define sEnRxIgnore1(CHP,CMPBYTE) \
  716. { \
  717. (CHP)->MCode[RXCMPVAL1_DATA] = (CMPBYTE); \
  718. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->MCode[RXCMPVAL1_OUT]); \
  719. (CHP)->MCode[RXCMP1_DATA] = RXCMP1_EN; \
  720. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->MCode[RXCMP1_OUT]); \
  721. (CHP)->MCode[INTCMP1_DATA] = INTCMP1_DIS; \
  722. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->MCode[INTCMP1_OUT]); \
  723. (CHP)->MCode[IGREP1_DATA] = IGNORE1_EN; \
  724. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->MCode[IGREP1_OUT]); \
  725. }
  726. /*-------------------------------------------------------------------
  727. Function: sEnRxIgnore2
  728. Purpose: Enable compare of Rx data with compare byte #2 and ignore (discard)
  729. that byte if a match is found.
  730. Call: sEnRxIgnore2(ChP,CmpByte)
  731. CHANPTR_T ChP; Ptr to channel structure
  732. unsigned char CmpByte; Byte to compare Rx data byte with
  733. Return: void
  734. Comments: This function enables comparison of the receive data byte
  735. with CmpByte. The comparison is done after the receive data
  736. byte has been masked (see sSetRxMask()). If a match is found the
  737. receive data byte is ignored (discarded).
  738. Rx ignore 2 can be disabled with sDisRxCompare2().
  739. ---------------------------------------------------------------------*/
  740. #define sEnRxIgnore2(CHP,CMPBYTE) \
  741. { \
  742. (CHP)->MCode[RXCMPVAL2_DATA] = (CMPBYTE); \
  743. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->MCode[RXCMPVAL2_OUT]); \
  744. (CHP)->MCode[RXCMP2_DATA] = RXCMP2_EN; \
  745. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->MCode[RXCMP2_OUT]); \
  746. (CHP)->MCode[INTCMP2_DATA] = INTCMP2_DIS; \
  747. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->MCode[INTCMP2_OUT]); \
  748. (CHP)->MCode[IGREP2_DATA] = IGNORE2_EN; \
  749. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->MCode[IGREP2_OUT]); \
  750. }
  751. /*-------------------------------------------------------------------
  752. Function: sEnRxIntCompare1
  753. Purpose: Enable compare of Rx data with compare byte #1 and interrupt
  754. if a match is found.
  755. Call: sEnRxIntCompare1(ChP,CmpByte)
  756. CHANPTR_T ChP; Ptr to channel structure
  757. unsigned char CmpByte; Byte to compare Rx data byte with
  758. Return: void
  759. Comments: This function enables comparison of the receive data byte
  760. with CmpByte. The comparison is done after the receive data
  761. byte has been masked (see sSetRxMask()). If a match is found an
  762. interrupt is generated after adding the data byte to the receive
  763. FIFO.
  764. Rx compare interrupt 1 can be disabled with sDisRxCompare1().
  765. Warnings: Before an interrupt will be generated SRC interrupts must be
  766. enabled (see sEnInterrupts()).
  767. ---------------------------------------------------------------------*/
  768. #define sEnRxIntCompare1(CHP,CMPBYTE) \
  769. { \
  770. (CHP)->MCode[RXCMPVAL1_DATA] = (CMPBYTE); \
  771. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->MCode[RXCMPVAL1_OUT]); \
  772. (CHP)->MCode[RXCMP1_DATA] = RXCMP1_EN; \
  773. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->MCode[RXCMP1_OUT]); \
  774. (CHP)->MCode[IGREP1_DATA] = IG_REP1_DIS; \
  775. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->MCode[IGREP1_OUT]); \
  776. (CHP)->MCode[INTCMP1_DATA] = INTCMP1_EN; \
  777. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->MCode[INTCMP1_OUT]); \
  778. }
  779. /*-------------------------------------------------------------------
  780. Function: sEnRxIntCompare2
  781. Purpose: Enable compare of Rx data with compare byte #2 and interrupt
  782. if a match is found.
  783. Call: sEnRxIntCompare2(ChP,CmpByte)
  784. CHANPTR_T ChP; Ptr to channel structure
  785. unsigned char CmpByte; Byte to compare Rx data byte with
  786. Return: void
  787. Comments: This function enables comparison of the receive data byte
  788. with CmpByte. The comparison is done after the receive data
  789. byte has been masked (see sSetRxMask()). If a match is found an
  790. interrupt is generated after adding the data byte to the receive
  791. FIFO.
  792. Rx compare interrupt 2 can be disabled with sDisRxCompare2().
  793. Warnings: Before an interrupt will be generated SRC interrupts must be
  794. enabled (see sEnInterrupts()).
  795. ---------------------------------------------------------------------*/
  796. #define sEnRxIntCompare2(CHP,CMPBYTE) \
  797. { \
  798. (CHP)->MCode[RXCMPVAL2_DATA] = (CMPBYTE); \
  799. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->MCode[RXCMPVAL2_OUT]); \
  800. (CHP)->MCode[RXCMP2_DATA] = RXCMP2_EN; \
  801. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->MCode[RXCMP2_OUT]); \
  802. (CHP)->MCode[IGREP2_DATA] = IG_REP2_DIS; \
  803. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->MCode[IGREP2_OUT]); \
  804. (CHP)->MCode[INTCMP2_DATA] = INTCMP2_EN; \
  805. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->MCode[INTCMP2_OUT]); \
  806. }
  807. /*-------------------------------------------------------------------
  808. Function: sEnRxProcessor
  809. Purpose: Enable the receive processor
  810. Call: sEnRxProcessor(ChP)
  811. CHANPTR_T ChP; Ptr to channel structure
  812. Return: void
  813. Comments: This function is used to start the receive processor. When
  814. the channel is in the reset state the receive processor is not
  815. running. This is done to prevent the receive processor from
  816. executing invalid microcode instructions prior to the
  817. downloading of the microcode.
  818. Warnings: This function must be called after valid microcode has been
  819. downloaded to the AIOP, and it must not be called before the
  820. microcode has been downloaded.
  821. ---------------------------------------------------------------------*/
  822. #define sEnRxProcessor(CHP) \
  823. { \
  824. (CHP)->RxControl[2] |= RXPROC_EN; \
  825. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->RxControl[0]); \
  826. }
  827. /*-------------------------------------------------------------------
  828. Function: sEnRxReplace1
  829. Purpose: Enable compare of Rx data with compare byte #1 and replacement
  830. with a single byte if a match is found.
  831. Call: sEnRxReplace1(ChP,CmpByte,ReplByte)
  832. CHANPTR_T ChP; Ptr to channel structure
  833. unsigned char CmpByte; Byte to compare Rx data byte with
  834. unsigned char ReplByte; Byte to replace Rx data byte with if
  835. a match is found on the compare.
  836. Return: void
  837. Comments: This function enables comparison of the receive data byte
  838. with CmpByte. The comparison is done after the receive data
  839. byte has been masked (see sSetRxMask()). If a match is found
  840. the receive data byte is replaced by ReplByte.
  841. Rx replace 1 can be disabled with sDisRxCompare1().
  842. ---------------------------------------------------------------------*/
  843. #define sEnRxReplace1(CHP,CMPBYTE,REPLBYTE) \
  844. { \
  845. (CHP)->MCode[RXCMPVAL1_DATA] = (CMPBYTE); \
  846. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->MCode[RXCMPVAL1_OUT]); \
  847. (CHP)->MCode[RXREPL1_DATA] = (REPLBYTE); \
  848. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->MCode[RXREPL1_OUT]); \
  849. (CHP)->MCode[RXCMP1_DATA] = RXCMP1_EN; \
  850. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->MCode[RXCMP1_OUT]); \
  851. (CHP)->MCode[INTCMP1_DATA] = INTCMP1_DIS; \
  852. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->MCode[INTCMP1_OUT]); \
  853. (CHP)->MCode[IGREP1_DATA] = REPLACE1_EN; \
  854. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->MCode[IGREP1_OUT]); \
  855. }
  856. /*-------------------------------------------------------------------
  857. Function: sEnRxReplace2
  858. Purpose: Enable compare of Rx data with compare byte #2 and replacement
  859. with a single byte if a match is found.
  860. Call: sEnRxReplace2(ChP,CmpByte,ReplByte)
  861. CHANPTR_T ChP; Ptr to channel structure
  862. unsigned char CmpByte; Byte to compare Rx data byte with
  863. unsigned char ReplByte; Byte to replace Rx data byte with if
  864. a match is found on the compare.
  865. Return: void
  866. Comments: This function enables comparison of the receive data byte
  867. with CmpByte. The comparison is done after the receive data
  868. byte has been masked (see sSetRxMask()). If a match is found
  869. the receive data byte is replaced by ReplByte.
  870. Rx replace 2 can be disabled with sDisRxCompare2().
  871. ---------------------------------------------------------------------*/
  872. #define sEnRxReplace2(CHP,CMPBYTE,REPLBYTE) \
  873. { \
  874. (CHP)->MCode[RXCMPVAL2_DATA] = (CMPBYTE); \
  875. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->MCode[RXCMPVAL2_OUT]); \
  876. (CHP)->MCode[RXREPL2_DATA] = (REPLBYTE); \
  877. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->MCode[RXREPL2_OUT]); \
  878. (CHP)->MCode[RXCMP2_DATA] = RXCMP2_EN; \
  879. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->MCode[RXCMP2_OUT]); \
  880. (CHP)->MCode[INTCMP2_DATA] = INTCMP2_DIS; \
  881. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->MCode[INTCMP2_OUT]); \
  882. (CHP)->MCode[IGREP2_DATA] = REPLACE2_EN; \
  883. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->MCode[IGREP2_OUT]); \
  884. }
  885. /*-------------------------------------------------------------------
  886. Function: sEnRxStatusMode
  887. Purpose: Enable the Rx status mode
  888. Call: sEnRxStatusMode(ChP)
  889. CHANPTR_T ChP; Ptr to channel structure
  890. Return: void
  891. Comments: This places the channel in the receive status mode. All subsequent
  892. reads of receive data using sReadRxWord() will return a data byte
  893. in the low word and a status byte in the high word.
  894. ---------------------------------------------------------------------*/
  895. #define sEnRxStatusMode(CHP) sOutW((CHP)->ChanStat,STATMODE)
  896. /*-------------------------------------------------------------------
  897. Function: sEnTransmit
  898. Purpose: Enable transmit
  899. Call: sEnTransmit(ChP)
  900. CHANPTR_T ChP; Ptr to channel structure
  901. Return: void
  902. ---------------------------------------------------------------------*/
  903. #define sEnTransmit(CHP) \
  904. { \
  905. (CHP)->TxControl[3] |= TX_ENABLE; \
  906. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->TxControl[0]); \
  907. }
  908. /*-------------------------------------------------------------------
  909. Function: sEnTxIgnore1
  910. Purpose: Enable compare of Tx data with compare byte #1 and ignore (do not
  911. transmit) that byte if a match is found.
  912. Call: sEnTxIgnore1(ChP,CmpByte)
  913. CHANPTR_T ChP; Ptr to channel structure
  914. unsigned char CmpByte; Byte to compare Tx data byte with
  915. Return: void
  916. Comments: This function enables comparison of the transmit data byte
  917. with CmpByte. If a match is found the transmit data byte
  918. is ignored, that is, it is not transmitted.
  919. Tx ignore 1 can be disabled with sDisTxCompare1().
  920. ---------------------------------------------------------------------*/
  921. #define sEnTxIgnore1(CHP,CMPBYTE) \
  922. { \
  923. (CHP)->TxCompare[2] = (CMPBYTE); \
  924. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->TxCompare[0]); \
  925. (CHP)->TxEnables[2] &= ~REP1W2_EN; \
  926. (CHP)->TxEnables[2] |= (COMP1_EN | IGN1_EN); \
  927. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->TxEnables[0]); \
  928. }
  929. /*-------------------------------------------------------------------
  930. Function: sEnTxIgnore2
  931. Purpose: Enable compare of Tx data with compare byte #2 and ignore (do not
  932. transmit) that byte if a match is found.
  933. Call: sEnTxIgnore2(ChP,CmpByte)
  934. CHANPTR_T ChP; Ptr to channel structure
  935. unsigned char CmpByte; Byte to compare Tx data byte with
  936. Return: void
  937. Comments: This function enables comparison of the transmit data byte
  938. with CmpByte. If a match is found the transmit data byte
  939. is ignored, that is, it is not transmitted.
  940. Tx ignore 2 can be disabled with sDisTxCompare2().
  941. ---------------------------------------------------------------------*/
  942. #define sEnTxIgnore2(CHP,CMPBYTE) \
  943. { \
  944. (CHP)->TxCompare[3] = (CMPBYTE); \
  945. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->TxCompare[0]); \
  946. (CHP)->TxEnables[2] |= (COMP2_EN | IGN2_EN); \
  947. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->TxEnables[0]); \
  948. }
  949. /*-------------------------------------------------------------------
  950. Function: sEnTxReplace1With1
  951. Purpose: Enable compare of Tx data with compare byte #1 and replacement
  952. with a single byte if a match is found.
  953. Call: sEnTxReplace1With1(ChP,CmpByte,ReplByte)
  954. CHANPTR_T ChP; Ptr to channel structure
  955. unsigned char CmpByte; Byte to compare Tx data byte with
  956. unsigned char ReplByte; Byte to replace Tx data byte with if
  957. a match is found on the compare.
  958. Return: void
  959. Comments: This function enables comparison of the transmit data byte
  960. with CmpByte. If a match is found the transmit data byte
  961. is replaced by ReplByte.
  962. Tx replace 1 with 1 can be disabled with sDisTxCompare1().
  963. ---------------------------------------------------------------------*/
  964. #define sEnTxReplace1With1(CHP,CMPBYTE,REPLBYTE) \
  965. { \
  966. (CHP)->TxCompare[2] = (CMPBYTE); \
  967. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->TxCompare[0]); \
  968. (CHP)->TxReplace1[2] = (REPLBYTE); \
  969. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->TxReplace1[0]); \
  970. (CHP)->TxEnables[2] &= ~(REP1W2_EN | IGN1_EN); \
  971. (CHP)->TxEnables[2] |= COMP1_EN; \
  972. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->TxEnables[0]); \
  973. }
  974. /*-------------------------------------------------------------------
  975. Function: sEnTxReplace1With2
  976. Purpose: Enable compare of Tx data with compare byte #1 and replacement
  977. with two bytes if a match is found.
  978. Call: sEnTxReplace1With2(ChP,CmpByte,ReplByte1,ReplByte2)
  979. CHANPTR_T ChP; Ptr to channel structure
  980. unsigned char CmpByte; Byte to compare Tx data byte with
  981. unsigned char ReplByte1; First byte to replace Tx data byte with if
  982. a match is found on the compare.
  983. unsigned char ReplByte2; Second byte to replace Tx data byte with
  984. if a match is found on the compare.
  985. Return: void
  986. Comments: This function enables comparison of the transmit data byte
  987. with CmpByte. If a match is found the transmit data byte
  988. is replaced by bytes ReplByte1 and ReplByte2. ReplByte1 will
  989. be transmitted first, ReplByte2 second.
  990. Tx replace 1 with 2 can be disabled with sDisTxCompare1().
  991. ---------------------------------------------------------------------*/
  992. #define sEnTxReplace1With2(CHP,CMPBYTE,REPLBYTE1,REPLBYTE2) \
  993. { \
  994. (CHP)->TxCompare[2] = (CMPBYTE); \
  995. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->TxCompare[0]); \
  996. (CHP)->TxReplace1[2] = (REPLBYTE1); \
  997. (CHP)->TxReplace1[3] = (REPLBYTE2); \
  998. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->TxReplace1[0]); \
  999. (CHP)->TxEnables[2] &= ~IGN1_EN; \
  1000. (CHP)->TxEnables[2] |= (COMP1_EN | REP1W2_EN); \
  1001. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->TxEnables[0]); \
  1002. }
  1003. /*-------------------------------------------------------------------
  1004. Function: sEnTxReplace2With1
  1005. Purpose: Enable compare of Tx data with compare byte #2 and replacement
  1006. with a single byte if a match is found.
  1007. Call: sEnTxReplace2With1(ChP,CmpByte,ReplByte)
  1008. CHANPTR_T ChP; Ptr to channel structure
  1009. unsigned char CmpByte; Byte to compare Tx data byte with
  1010. unsigned char ReplByte; Byte to replace Tx data byte with if
  1011. a match is found on the compare.
  1012. Return: void
  1013. Comments: This function enables comparison of the transmit data byte
  1014. with CmpByte. If a match is found the transmit data byte
  1015. is replaced by ReplByte.
  1016. Tx replace 2 with 1 can be disabled with sDisTxCompare2().
  1017. ---------------------------------------------------------------------*/
  1018. #define sEnTxReplace2With1(CHP,CMPBYTE,REPLBYTE) \
  1019. { \
  1020. (CHP)->TxCompare[3] = (CMPBYTE); \
  1021. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->TxCompare[0]); \
  1022. (CHP)->TxReplace2[2] = (REPLBYTE); \
  1023. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->TxReplace2[0]); \
  1024. (CHP)->TxEnables[2] &= ~IGN2_EN; \
  1025. (CHP)->TxEnables[2] |= COMP2_EN; \
  1026. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->TxEnables[0]); \
  1027. }
  1028. /*-------------------------------------------------------------------
  1029. Function: sEnTxSoftFlowCtl
  1030. Purpose: Enable Tx Software Flow Control
  1031. Call: sEnTxSoftFlowCtl(ChP)
  1032. CHANPTR_T ChP; Ptr to channel structure
  1033. Return: void
  1034. ---------------------------------------------------------------------*/
  1035. #define sEnTxSoftFlowCtl(CHP) \
  1036. { \
  1037. (CHP)->MCode[TXSWFC_DATA] = TXSWFC_EN; \
  1038. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->MCode[TXSWFC_OUT]); \
  1039. }
  1040. /*-------------------------------------------------------------------
  1041. sIsTxSoftFlowCtlEnabled -
  1042. ---------------------------------------------------------------------*/
  1043. #define sIsTxSoftFlowCtlEnabled(CHP) \
  1044. ((CHP)->MCode[TXSWFC_DATA] == TXSWFC_EN)
  1045. /*-------------------------------------------------------------------
  1046. Function: sGetAiopID
  1047. Purpose: Get the AIOP ID
  1048. Call: sGetAiopID(CtlP,AiopNum)
  1049. CONTROLLER_T *CtlP; Ptr to controller structure
  1050. int AiopNum;
  1051. Return: int: The AIOP ID if the AIOP exists, AIOPID_NULL if the
  1052. AIOP does not exist.
  1053. Comments: The AIOP ID uniquely identifies the type of AIOP.
  1054. ---------------------------------------------------------------------*/
  1055. #define sGetAiopID(CTLP,AIOPNUM) (CTLP)->AiopID[AIOPNUM]
  1056. /*-------------------------------------------------------------------
  1057. Function: sGetAiopIntStatus
  1058. Purpose: Get the AIOP interrupt status
  1059. Call: sGetAiopIntStatus(CtlP,AiopNum)
  1060. CONTROLLER_T *CtlP; Ptr to controller structure
  1061. int AiopNum; AIOP number
  1062. Return: unsigned char: The AIOP interrupt status. Bits 0 through 7
  1063. represent channels 0 through 7 respectively. If a
  1064. bit is set that channel is interrupting.
  1065. ---------------------------------------------------------------------*/
  1066. #define sGetAiopIntStatus(CTLP,AIOPNUM) sInB((CTLP)->AiopIntChanIO[AIOPNUM])
  1067. /*-------------------------------------------------------------------
  1068. Function: sGetAiopNumChan
  1069. Purpose: Get the number of channels supported by an AIOP
  1070. Call: sGetAiopNumChan(CtlP,AiopNum)
  1071. CONTROLLER_T *CtlP; Ptr to controller structure
  1072. int AiopNum; AIOP number
  1073. Return: int: The number of channels supported by the AIOP
  1074. ---------------------------------------------------------------------*/
  1075. #define sGetAiopNumChan(CTLP,AIOPNUM) (CTLP)->AiopNumChan[AIOPNUM]
  1076. /*-------------------------------------------------------------------
  1077. Function: sGetChanIntID
  1078. Purpose: Get a channel's interrupt identification byte
  1079. Call: sGetChanIntID(ChP)
  1080. CHANPTR_T ChP; Ptr to channel structure
  1081. Return: unsigned char: The channel interrupt ID. Can be any
  1082. combination of the following flags:
  1083. RXF_TRIG: Rx FIFO trigger level interrupt
  1084. TXFIFO_MT: Tx FIFO empty interrupt
  1085. SRC_INT: Special receive condition interrupt
  1086. DELTA_CD: CD change interrupt
  1087. DELTA_CTS: CTS change interrupt
  1088. DELTA_DSR: DSR change interrupt
  1089. ---------------------------------------------------------------------*/
  1090. #define sGetChanIntID(CHP) (sInB((CHP)->IntID) & (RXF_TRIG | TXFIFO_MT | SRC_INT | DELTA_CD | DELTA_CTS | DELTA_DSR))
  1091. /*-------------------------------------------------------------------
  1092. Function: sGetChanNum
  1093. Purpose: Get the number of a channel within an AIOP
  1094. Call: sGetChanNum(ChP)
  1095. CHANPTR_T ChP; Ptr to channel structure
  1096. Return: int: Channel number within AIOP, or NULLCHAN if channel does
  1097. not exist.
  1098. ---------------------------------------------------------------------*/
  1099. #define sGetChanNum(CHP) (CHP)->ChanNum
  1100. /*-------------------------------------------------------------------
  1101. Function: sGetChanStatus
  1102. Purpose: Get the channel status
  1103. Call: sGetChanStatus(ChP)
  1104. CHANPTR_T ChP; Ptr to channel structure
  1105. Return: unsigned int: The channel status. Can be any combination of
  1106. the following flags:
  1107. LOW BYTE FLAGS
  1108. CTS_ACT: CTS input asserted
  1109. DSR_ACT: DSR input asserted
  1110. CD_ACT: CD input asserted
  1111. TXFIFOMT: Tx FIFO is empty
  1112. TXSHRMT: Tx shift register is empty
  1113. RDA: Rx data available
  1114. HIGH BYTE FLAGS
  1115. STATMODE: status mode enable bit
  1116. RXFOVERFL: receive FIFO overflow
  1117. RX2MATCH: receive compare byte 2 match
  1118. RX1MATCH: receive compare byte 1 match
  1119. RXBREAK: received BREAK
  1120. RXFRAME: received framing error
  1121. RXPARITY: received parity error
  1122. Warnings: This function will clear the high byte flags in the Channel
  1123. Status Register.
  1124. ---------------------------------------------------------------------*/
  1125. #define sGetChanStatus(CHP) sInW((CHP)->ChanStat)
  1126. /*-------------------------------------------------------------------
  1127. Function: sGetChanStatusLo
  1128. Purpose: Get the low byte only of the channel status
  1129. Call: sGetChanStatusLo(ChP)
  1130. CHANPTR_T ChP; Ptr to channel structure
  1131. Return: unsigned char: The channel status low byte. Can be any combination
  1132. of the following flags:
  1133. CTS_ACT: CTS input asserted
  1134. DSR_ACT: DSR input asserted
  1135. CD_ACT: CD input asserted
  1136. TXFIFOMT: Tx FIFO is empty
  1137. TXSHRMT: Tx shift register is empty
  1138. RDA: Rx data available
  1139. ---------------------------------------------------------------------*/
  1140. #define sGetChanStatusLo(CHP) sInB((BIOA_T)(CHP)->ChanStat)
  1141. /*-------------------------------------------------------------------
  1142. Function: sGetControllerID
  1143. Purpose: Get the controller ID
  1144. Call: sGetControllerID(CtlP)
  1145. CONTROLLER_T *CtlP; Ptr to controller structure
  1146. Return: int: The controller ID if the controller exists, CTLID_NULL if
  1147. the controller does not exist.
  1148. Comments: The controller ID uniquely identifies the type of controller.
  1149. ---------------------------------------------------------------------*/
  1150. #define sGetControllerID(CTLP) (CTLP)->CtlID
  1151. /*-------------------------------------------------------------------
  1152. Function: sPCIGetControllerIntStatus
  1153. Purpose: Get the controller interrupt status
  1154. Call: sPCIGetControllerIntStatus(CtlP)
  1155. CONTROLLER_T *CtlP; Ptr to controller structure
  1156. Return: unsigned char: The controller interrupt status in the lower 4
  1157. bits and bit 4. Bits 0 through 3 represent AIOP's 0
  1158. through 3 respectively. Bit 4 is set if the int
  1159. was generated from periodic. If a bit is set that
  1160. AIOP is interrupting.
  1161. ---------------------------------------------------------------------*/
  1162. #define sPCIGetControllerIntStatus(CTLP) \
  1163. ((sInW((CTLP)->PCI1IO) >> 8) & 0x1f)
  1164. /*-------------------------------------------------------------------
  1165. Function: sGetControllerIntStatus
  1166. Purpose: Get the controller interrupt status
  1167. Call: sGetControllerIntStatus(CtlP)
  1168. CONTROLLER_T *CtlP; Ptr to controller structure
  1169. Return: unsigned char: The controller interrupt status in the lower 4
  1170. bits. Bits 0 through 3 represent AIOP's 0
  1171. through 3 respectively. If a bit is set that
  1172. AIOP is interrupting. Bits 4 through 7 will
  1173. always be cleared.
  1174. ---------------------------------------------------------------------*/
  1175. #define sGetControllerIntStatus(CTLP) (sInB((CTLP)->MReg1IO) & 0x0f)
  1176. /*-------------------------------------------------------------------
  1177. Function: sGetControllerNumAiop
  1178. Purpose: Get the number of AIOPs on a controller
  1179. Call: sGetControllerNumAiop(CtlP)
  1180. CONTROLLER_T *CtlP; Ptr to controller structure
  1181. Return: int: The number of AIOPs on the controller.
  1182. ---------------------------------------------------------------------*/
  1183. //#define sGetControllerNumAiop(CTLP) (CTLP)->NumAiop
  1184. /*-------------------------------------------------------------------
  1185. Function: sGetDevMap
  1186. Purpose: Get an entry in the device map.
  1187. Call: sGetDevMap(Ctl,Aiop,Chan)
  1188. int Ctl; Controller number
  1189. int Aiop; Aiop number within a controller
  1190. int Chan; Channel number within an Aiop
  1191. Return: int: The device number that Ctl, Aiop, and Chan map to, or NULLDEV
  1192. if the device does not exist.
  1193. Comments: The device map is used to convert controller number, AIOP number,
  1194. and channel number into a device number.
  1195. ---------------------------------------------------------------------*/
  1196. #define sGetDevMap(CTL,AIOP,CHAN) sDevMapTbl[CTL][AIOP][CHAN]
  1197. /*-------------------------------------------------------------------
  1198. Function: sGetModemStatus
  1199. Purpose: Get the modem status
  1200. Call: sGetModemStatus(ChP)
  1201. CHANPTR_T ChP; Ptr to channel structure
  1202. Return: unsigned char: Modem status using flags CD_ACT, DSR_ACT, and
  1203. CTS_ACT.
  1204. ---------------------------------------------------------------------*/
  1205. #define sGetModemStatus(CHP) (unsigned char)(sInB((BIOA_T)(CHP)->ChanStat) & (CD_ACT | DSR_ACT | CTS_ACT))
  1206. /*-------------------------------------------------------------------
  1207. Function: sGetRPlusModemRI
  1208. Purpose: Get the modem status(DSR on upper unused ports have RI signal)
  1209. CHANPTR_T ChP; Ptr to channel structure
  1210. Return: unsigned char: Modem status using flags DSR_ACT signifying
  1211. RI signal.
  1212. ---------------------------------------------------------------------*/
  1213. #define sGetRPlusModemRI(CHP) (unsigned char)(sInB((BIOA_T)(CHP)->ChanStat+8) & (DSR_ACT))
  1214. /*-------------------------------------------------------------------
  1215. Function: sGetNextInBitMap
  1216. Purpose: Get the next number needing service from a bit map.
  1217. Call: sGetNextInBitMap(BitMap)
  1218. unsigned char BitMap; The bit map. Each bit set identifies an
  1219. entity that needs service.
  1220. Return: int: The next number needing service, or -1 if nothing needs
  1221. service. If the bit map represents AIOPs or channels,
  1222. NULLAIOP or NULLCHAN respectively are the return values if
  1223. nothing needs service.
  1224. Comments: Immediately after calling sGetNextInBitMap(), sClrNextInBitMap()
  1225. must be called to clear the bit of the number just returned.
  1226. ---------------------------------------------------------------------*/
  1227. //#define sGetNextInBitMap(BITMAP) sBitMapToLowTbl[BITMAP]
  1228. /*-------------------------------------------------------------------
  1229. Function: sGetRxCnt
  1230. Purpose: Get the number of data bytes in the Rx FIFO
  1231. Call: sGetRxCnt(ChP)
  1232. CHANPTR_T ChP; Ptr to channel structure
  1233. Return: int: The number of data bytes in the Rx FIFO.
  1234. Comments: Byte read of count register is required to obtain Rx count.
  1235. ---------------------------------------------------------------------*/
  1236. #define sGetRxCnt(CHP) sInW((CHP)->TxRxCount)
  1237. /*-------------------------------------------------------------------
  1238. Function: sGetRxStatus
  1239. Purpose: Get a channel's receive status
  1240. Call: sGetRxStatus(ChP)
  1241. CHANPTR_T ChP; Ptr to channel structure
  1242. Return: unsigned char: Receive status: 0 if no data is available, or the
  1243. RDA (Receive Data Available) flag if data is
  1244. available.
  1245. ---------------------------------------------------------------------*/
  1246. #define sGetRxStatus(CHP) (sInB((BIOA_T)(CHP)->ChanStat) & RDA)
  1247. /*-------------------------------------------------------------------
  1248. Function: sGetTxCnt
  1249. Purpose: Get the number of data bytes in the Tx FIFO
  1250. Call: sGetTxCnt(ChP)
  1251. CHANPTR_T ChP; Ptr to channel structure
  1252. Return: unsigned char: The number of data bytes in the Tx FIFO.
  1253. Comments: Byte read of count register is required to obtain Tx count.
  1254. ---------------------------------------------------------------------*/
  1255. #define sGetTxCnt(CHP) sInB((BIOA_T)(CHP)->TxRxCount)
  1256. /*-------------------------------------------------------------------
  1257. Function: sGetTxRxDataIO
  1258. Purpose: Get the I/O address of a channel's TxRx Data register
  1259. Call: sGetTxRxDataIO(ChP)
  1260. CHANPTR_T ChP; Ptr to channel structure
  1261. Return: WIOA_T: I/O address of a channel's TxRx Data register
  1262. ---------------------------------------------------------------------*/
  1263. #define sGetTxRxDataIO(CHP) (CHP)->TxRxData
  1264. /*-------------------------------------------------------------------
  1265. Function: sGetTxSize
  1266. Purpose: Get the maximum number of bytes allowed in a channel's Tx FIFO.
  1267. Call: sGetTxSize(ChP)
  1268. CHANPTR_T ChP; Ptr to channel structure
  1269. Return: int: The maximum number of bytes allowed in the Tx FIFO.
  1270. ---------------------------------------------------------------------*/
  1271. #define sGetTxSize(CHP) (CHP)->TxSize
  1272. /*-------------------------------------------------------------------
  1273. Function: sGetTxStatus
  1274. Purpose: Get a channels transmit status
  1275. Call: sGetTxStatus(ChP)
  1276. CHANPTR_T ChP; Ptr to channel structure
  1277. Return: unsigned char: Transmit status, can be 0 or any combination of the
  1278. following flags:
  1279. TXFIFOMT: Tx FIFO is empty
  1280. TXSHRMT: Tx shift register is empty
  1281. Comments: If the transmitter is completely drained the return value will
  1282. be (TXFIFOMT | TXSHRMT).
  1283. ---------------------------------------------------------------------*/
  1284. #define sGetTxStatus(CHP) (unsigned char)(sInB((BIOA_T)(CHP)->ChanStat) & (TXFIFOMT | TXSHRMT))
  1285. /*-------------------------------------------------------------------
  1286. Function: sInB
  1287. Purpose: Read a byte from I/O space
  1288. Call: sInB(io)
  1289. BIOA_T io; I/O address to read from
  1290. Return: unsigned char
  1291. ---------------------------------------------------------------------*/
  1292. #define sInB(IO) READ_PORT_UCHAR(IO)
  1293. /*-------------------------------------------------------------------
  1294. Function: sInStrW
  1295. Purpose: Read a string of words from I/O space
  1296. Call: sInStrW(io,Buffer,Count)
  1297. WIOA_T io: The I/O address to read from
  1298. unsigned int *Buffer; Ptr to buffer for data read
  1299. int Count; Number of words to read
  1300. Return: void
  1301. Warnings: Buffer must be large enough to hold Count words.
  1302. Watch out for macro side effects, the caller's Buffer and Count
  1303. may be modified, depending how the macro is coded.
  1304. ---------------------------------------------------------------------*/
  1305. #define sInStrW(IO,BUFFER,COUNT) READ_PORT_BUFFER_USHORT(IO,BUFFER,COUNT)
  1306. /*-------------------------------------------------------------------
  1307. Function: sInW
  1308. Purpose: Read a word from I/O space
  1309. Call: sInW(io)
  1310. WIOA_T io; I/O address to read from
  1311. Return: unsigned int
  1312. ---------------------------------------------------------------------*/
  1313. #define sInW(IO) READ_PORT_USHORT(IO)
  1314. /*-------------------------------------------------------------------
  1315. Function: sOutB
  1316. Purpose: Write a byte to I/O space
  1317. Call: sOutB(io,Value)
  1318. unsigned int io; I/O address to write to
  1319. unsigned char Value; Value to write
  1320. Return: void
  1321. ---------------------------------------------------------------------*/
  1322. #define sOutB(IO,VAL) WRITE_PORT_UCHAR(IO,VAL)
  1323. /*-------------------------------------------------------------------
  1324. Function: sOutDW
  1325. Purpose: Write a double word to I/O space
  1326. Call: sOutDW(io,Value)
  1327. unsigned int io; I/O address to write to
  1328. unsigned long Value; Value to write
  1329. Return: void
  1330. ---------------------------------------------------------------------*/
  1331. #define sOutDW(IO,VAL) WRITE_PORT_ULONG(IO,VAL)
  1332. /*-------------------------------------------------------------------
  1333. Function: sOutStrW
  1334. Purpose: Write a string of words to I/O space
  1335. Call: sOutStrW(io,Buffer,Count)
  1336. WIOA_T io: The I/O address to write to
  1337. unsigned int far *Buffer; Ptr to buffer containing write data
  1338. int Count; Number of words to write
  1339. Return: void
  1340. Warnings: Watch out for macro side effects, the caller's Buffer and Count
  1341. may be modified, depending how the macro is coded.
  1342. ---------------------------------------------------------------------*/
  1343. #define sOutStrW(IO,BUFFER,COUNT) WRITE_PORT_BUFFER_USHORT(IO,BUFFER,COUNT)
  1344. /*-------------------------------------------------------------------
  1345. Function: sOutW
  1346. Purpose: Write a word to I/O space
  1347. Call: sOutW(io,Value)
  1348. WIOA_T io; I/O address to write to
  1349. unsigned int Value; Value to write
  1350. Return: void
  1351. ---------------------------------------------------------------------*/
  1352. #define sOutW(IO,VAL) WRITE_PORT_USHORT(IO,VAL)
  1353. /*-------------------------------------------------------------------
  1354. Function: sReadRxByte
  1355. Purpose: Read a receive data byte from a channel.
  1356. Call: sReadRxByte(io)
  1357. BIOA_T io; Channel receive register I/O address. This can
  1358. be obtained with sGetTxRxDataIO().
  1359. Return: unsigned char: The receive data byte
  1360. ---------------------------------------------------------------------*/
  1361. #define sReadRxByte(IO) sInB(IO)
  1362. /*-------------------------------------------------------------------
  1363. Function: sReadRxWord
  1364. Purpose: Read two receive data bytes from a channel with a single word read
  1365. is not in Rx Status Mode. Read a data byte and a status byte if
  1366. in Rx Status Mode.
  1367. Call: sReadRxWord(io)
  1368. WIOA_T io; Channel receive register I/O address. This can
  1369. be obtained with sGetTxRxDataIO().
  1370. Return: unsigned int: The two receive data bytes if not in Rx Status Mode.
  1371. In this case the first data byte read is placed in the low byte,
  1372. the second data byte read in the high byte.
  1373. A data byte and a status byte if in Rx Status Mode. In this case
  1374. the data is placed in the low byte and the status in the high
  1375. byte. The status can be any of the following flags:
  1376. STMBREAK: Break
  1377. STMFRAME: Framing error
  1378. STMRCVROVR: Receiver over run error
  1379. STMPARITY: Parity error
  1380. The flag STMERROR is defined as (STMBREAK | STMFRAME | STMPARITY)
  1381. ---------------------------------------------------------------------*/
  1382. #define sReadRxWord(IO) sInW(IO)
  1383. /*-------------------------------------------------------------------
  1384. Function: sResetAiop
  1385. Purpose: Reset the AIOP
  1386. Call: sResetAiop(ChP)
  1387. CHANPTR_T ChP; Ptr to channel structure
  1388. Return: void
  1389. ---------------------------------------------------------------------*/
  1390. #define sResetAiop(CHP) \
  1391. { \
  1392. sOutB((CHP)->Cmd,RESET_ALL); \
  1393. sOutB((CHP)->Cmd,0x0); \
  1394. }
  1395. /*-------------------------------------------------------------------
  1396. Function: sResetUART
  1397. Purpose: Reset the channel's UART
  1398. Call: sResetUART(ChP)
  1399. CHANPTR_T ChP; Ptr to channel structure
  1400. Return: void
  1401. Comments: The two sInB() instructions provide a delay >= 400nS.
  1402. ---------------------------------------------------------------------*/
  1403. #define sResetUART(CHP) \
  1404. { \
  1405. sOutB((CHP)->Cmd,(UCHAR)(RESETUART | (CHP)->ChanNum)); \
  1406. sOutB((CHP)->Cmd,(unsigned char)(CHP)->ChanNum); \
  1407. sInB((CHP)->IntChan); \
  1408. sInB((CHP)->IntChan); \
  1409. }
  1410. /*-------------------------------------------------------------------
  1411. Function: sSendBreak
  1412. Purpose: Send a transmit BREAK signal
  1413. Call: sSendBreak(ChP)
  1414. CHANPTR_T ChP; Ptr to channel structure
  1415. Return: void
  1416. ---------------------------------------------------------------------*/
  1417. #define sSendBreak(CHP) \
  1418. { \
  1419. (CHP)->TxControl[3] |= SETBREAK; \
  1420. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->TxControl[0]); \
  1421. }
  1422. /*-------------------------------------------------------------------
  1423. Function: sSetBSChar
  1424. Purpose: Set the BS (backspace) character
  1425. Call: sSetBSChar(ChP,Ch)
  1426. CHANPTR_T ChP; Ptr to channel structure
  1427. unsigned char Ch; The value to set the backspace character to
  1428. Return: void
  1429. ---------------------------------------------------------------------*/
  1430. #define sSetBSChar(CHP,CH) \
  1431. { \
  1432. (CHP)->BS1_DATA = (CH); \
  1433. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->BS1_OUT); \
  1434. (CHP)->BS2_DATA = (CH); \
  1435. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->BS2_OUT); \
  1436. }
  1437. /*-------------------------------------------------------------------
  1438. Function: sSetData7
  1439. Purpose: Set data bits to 7
  1440. Call: sSetData7(ChP)
  1441. CHANPTR_T ChP; Ptr to channel structure
  1442. Return: void
  1443. ---------------------------------------------------------------------*/
  1444. #define sSetData7(CHP) \
  1445. { \
  1446. (CHP)->TxControl[2] &= ~DATA8BIT; \
  1447. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->TxControl[0]); \
  1448. }
  1449. /*-------------------------------------------------------------------
  1450. Function: sSetData8
  1451. Purpose: Set data bits to 8
  1452. Call: sSetData8(ChP)
  1453. CHANPTR_T ChP; Ptr to channel structure
  1454. Return: void
  1455. ---------------------------------------------------------------------*/
  1456. #define sSetData8(CHP) \
  1457. { \
  1458. (CHP)->TxControl[2] |= DATA8BIT; \
  1459. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->TxControl[0]); \
  1460. }
  1461. /*-------------------------------------------------------------------
  1462. Function: sSetDevMap
  1463. Purpose: Set an entry in the device map.
  1464. Call: sSetDevMap(Ctl,Aiop,Chan,Dev)
  1465. int Ctl; Controller number
  1466. int Aiop; Aiop number within a controller
  1467. int Chan; Channel number within an Aiop
  1468. int Dev; The device number that Ctl, Aiop, and Chan map to.
  1469. Return: void
  1470. Comments: The device map is used to convert controller number, AIOP number,
  1471. and channel number into a device number. Function sSetDevMap()
  1472. is used to initialize entries within the device map when the
  1473. mapping is first established.
  1474. ---------------------------------------------------------------------*/
  1475. #define sSetDevMap(CTL,AIOP,CHAN,DEV) sDevMapTbl[CTL][AIOP][CHAN] = (DEV)
  1476. /*-------------------------------------------------------------------
  1477. Function: sSetDTR
  1478. Purpose: Set the DTR output
  1479. Call: sSetDTR(ChP)
  1480. CHANPTR_T ChP; Ptr to channel structure
  1481. Return: void
  1482. ---------------------------------------------------------------------*/
  1483. #define sSetDTR(CHP) \
  1484. { \
  1485. (CHP)->TxControl[3] |= SET_DTR; \
  1486. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->TxControl[0]); \
  1487. }
  1488. /*-------------------------------------------------------------------
  1489. Function: sSetEOFChar
  1490. Purpose: Set the EOF (end of file) character
  1491. Call: sSetBSChar(ChP,Ch)
  1492. CHANPTR_T ChP; Ptr to channel structure
  1493. unsigned char Ch; The value to set the EOF character to
  1494. Return: void
  1495. ---------------------------------------------------------------------*/
  1496. #define sSetEOFChar(CHP,CH) \
  1497. { \
  1498. (CHP)->MCode[EOF_DATA] = (CH); \
  1499. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->MCode[EOF_OUT]); \
  1500. }
  1501. /*-------------------------------------------------------------------
  1502. Function: sSetEraseChar
  1503. Purpose: Set Erase character
  1504. Call: sSetEraseChar(ChP,Ch)
  1505. CHANPTR_T ChP; Ptr to channel structure
  1506. unsigned char Ch; The value to set the erase character to
  1507. Return: void
  1508. ---------------------------------------------------------------------*/
  1509. #define sSetEraseChar(CHP,CH) \
  1510. { \
  1511. (CHP)->MCode[ERASE_DATA] = (CH); \
  1512. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->MCode[ERASE_OUT]); \
  1513. }
  1514. /*-------------------------------------------------------------------
  1515. Function: sSetESCChar
  1516. Purpose: Set the ESC (escape) character
  1517. Call: sSetESCChar(ChP,Ch)
  1518. CHANPTR_T ChP; Ptr to channel structure
  1519. unsigned char Ch; The value to set the ESC character to
  1520. Return: void
  1521. ---------------------------------------------------------------------*/
  1522. #define sSetESCChar(CHP,CH) \
  1523. { \
  1524. (CHP)->MCode[ESC_DATA] = (CH); \
  1525. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->MCode[ESC_OUT]); \
  1526. }
  1527. /*-------------------------------------------------------------------
  1528. Function: sSetEvenParity
  1529. Purpose: Set even parity
  1530. Call: sSetEvenParity(ChP)
  1531. CHANPTR_T ChP; Ptr to channel structure
  1532. Return: void
  1533. Comments: Function sSetParity() can be used in place of functions sEnParity(),
  1534. sDisParity(), sSetOddParity(), and sSetEvenParity().
  1535. Warnings: This function has no effect unless parity is enabled with function
  1536. sEnParity().
  1537. ---------------------------------------------------------------------*/
  1538. #define sSetEvenParity(CHP) \
  1539. { \
  1540. (CHP)->TxControl[2] |= EVEN_PAR; \
  1541. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->TxControl[0]); \
  1542. }
  1543. /*-------------------------------------------------------------------
  1544. Function: sSetErrorIgn
  1545. Purpose: Set Error processing to ignore errored characters
  1546. Call: sSetErrorIgn(ChP)
  1547. CHANPTR_T ChP; Ptr to channel structure
  1548. Return: void
  1549. ---------------------------------------------------------------------*/
  1550. #define sSetErrorIgn(CHP) \
  1551. { \
  1552. (CHP)->MCode[ERROR_DATA] = (IGNORE_ER); \
  1553. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->MCode[ERROR_OUT]); \
  1554. }
  1555. /*-------------------------------------------------------------------
  1556. Function: sSetErrorNorm
  1557. Purpose: Set Error processing to treat errored character as normal
  1558. ` characters, no error processing is done.
  1559. Call: sSetErrorNorm(ChP)
  1560. CHANPTR_T ChP; Ptr to channel structure
  1561. Return: void
  1562. ---------------------------------------------------------------------*/
  1563. #define sSetErrorNorm(CHP) \
  1564. { \
  1565. (CHP)->MCode[ERROR_DATA] = (NORMAL_ER); \
  1566. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->MCode[ERROR_OUT]); \
  1567. }
  1568. /*-------------------------------------------------------------------
  1569. Function: sSetErrorRepl
  1570. Purpose: Set Error processing to replace errored characters with NULL
  1571. Call: sSetErrorRepl(ChP)
  1572. CHANPTR_T ChP; Ptr to channel structure
  1573. Return: void
  1574. ---------------------------------------------------------------------*/
  1575. #define sSetErrorRepl(CHP) \
  1576. { \
  1577. (CHP)->MCode[ERROR_DATA] = (REPLACE_ER); \
  1578. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->MCode[ERROR_OUT]); \
  1579. }
  1580. /*-------------------------------------------------------------------
  1581. Function: sSetKILLChar
  1582. Purpose: Set the KILL character
  1583. Call: sSetKILLChar(ChP,Ch)
  1584. CHANPTR_T ChP; Ptr to channel structure
  1585. unsigned char Ch; The value to set the KILL character to
  1586. Return: void
  1587. ---------------------------------------------------------------------*/
  1588. #define sSetKILLChar(CHP,CH) \
  1589. { \
  1590. (CHP)->MCode[KILL1_DATA] = (CH); \
  1591. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->MCode[KILL1_OUT]); \
  1592. (CHP)->MCode[KILL2_DATA] = (CH); \
  1593. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->MCode[KILL2_OUT]); \
  1594. }
  1595. /*-------------------------------------------------------------------
  1596. Function: sSetNLChar
  1597. Purpose: Set the NL (new line) character
  1598. Call: sSetNLChar(ChP,Ch)
  1599. CHANPTR_T ChP; Ptr to channel structure
  1600. unsigned char Ch; The value to set the NL character to
  1601. Return: void
  1602. ---------------------------------------------------------------------*/
  1603. #define sSetNLChar(CHP,CH) \
  1604. { \
  1605. (CHP)->MCode[NEWLINE1_DATA] = (CH); \
  1606. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->MCode[NEWLINE1_OUT]); \
  1607. (CHP)->MCode[NEWLINE2_DATA] = (CH); \
  1608. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->MCode[NEWLINE2_OUT]); \
  1609. }
  1610. /*-------------------------------------------------------------------
  1611. Function: sSetOddParity
  1612. Purpose: Set odd parity
  1613. Call: sSetOddParity(ChP)
  1614. CHANPTR_T ChP; Ptr to channel structure
  1615. Return: void
  1616. Comments: Function sSetParity() can be used in place of functions sEnParity(),
  1617. sDisParity(), sSetOddParity(), and sSetEvenParity().
  1618. Warnings: This function has no effect unless parity is enabled with function
  1619. sEnParity().
  1620. ---------------------------------------------------------------------*/
  1621. #define sSetOddParity(CHP) \
  1622. { \
  1623. (CHP)->TxControl[2] &= ~EVEN_PAR; \
  1624. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->TxControl[0]); \
  1625. }
  1626. /*-------------------------------------------------------------------
  1627. Function: sSetRTS
  1628. Purpose: Set the RTS output
  1629. Call: sSetRTS(ChP)
  1630. CHANPTR_T ChP; Ptr to channel structure
  1631. Return: void
  1632. ---------------------------------------------------------------------*/
  1633. #define sSetRTS(CHP) \
  1634. { \
  1635. (CHP)->TxControl[3] |= SET_RTS; \
  1636. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->TxControl[0]); \
  1637. }
  1638. /*-------------------------------------------------------------------
  1639. Function: sSetRxCmpVal0
  1640. Purpose: Set Rx Compare Value 0 to a new value without changing the state
  1641. of the enable or disable instructions.
  1642. Call: sSetRxCmpVal0(ChP,CmpByte)
  1643. CHANPTR_T ChP; Ptr to channel structure
  1644. unsigned char CmpByte; Byte to compare Rx data byte with
  1645. Return: void
  1646. Comments: This function only sets the value of CmpByte. It can be used to
  1647. dynamically set the compare byte while the compare is active.
  1648. It does not enable the compare or ignore functions.
  1649. ---------------------------------------------------------------------*/
  1650. #define sSetRxCmpVal0(CHP,CMPBYTE) \
  1651. { \
  1652. (CHP)->MCode[RXCMPVAL0_DATA] = (CMPBYTE); \
  1653. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->MCode[IGNORE0_OUT]); \
  1654. }
  1655. /*-------------------------------------------------------------------
  1656. Function: sSetRxCmpVal1
  1657. Purpose: Set Rx Compare Value 1 to a new value without changing the state
  1658. of the enable or disable instructions.
  1659. Call: sSetRxCmpVal1(ChP,CmpByte)
  1660. CHANPTR_T ChP; Ptr to channel structure
  1661. unsigned char CmpByte; Byte to compare Rx data byte with
  1662. Return: void
  1663. Comments: This function only sets the value of CmpByte. It can be used to
  1664. dynamically set the compare byte while the compare is active.
  1665. It does not enable the compare or ignore functions.
  1666. ---------------------------------------------------------------------*/
  1667. #define sSetRxCmpVal1(CHP,CMPBYTE) \
  1668. { \
  1669. (CHP)->MCode[RXCMPVAL1_DATA] = (CMPBYTE); \
  1670. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->MCode[RXCMPVAL1_OUT]); \
  1671. }
  1672. /*-------------------------------------------------------------------
  1673. Function: sSetRxCmpVal2
  1674. Purpose: Set Rx Compare Value 2 to a new value without changing the state
  1675. of the enable or disable instructions.
  1676. Call: sSetRxCmpVal2(ChP,CmpByte)
  1677. CHANPTR_T ChP; Ptr to channel structure
  1678. unsigned char CmpByte; Byte to compare Rx data byte with
  1679. Return: void
  1680. Comments: This function only sets the value of CmpByte. It can be used to
  1681. dynamically set the compare byte while the compare is active.
  1682. It does not enable the compare or ignore functions.
  1683. ---------------------------------------------------------------------*/
  1684. #define sSetRxCmpVal2(CHP,CMPBYTE) \
  1685. { \
  1686. (CHP)->MCode[RXCMPVAL2_DATA] = (CMPBYTE); \
  1687. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->MCode[RXCMPVAL2_OUT]); \
  1688. }
  1689. /*-------------------------------------------------------------------
  1690. Function: sSetRxMask
  1691. Purpose: Set the Rx mask value
  1692. Call: sSetRxMask(ChP,Ch)
  1693. CHANPTR_T ChP; Ptr to channel structure
  1694. unsigned char Ch; The value to set the Rx mask to
  1695. Return: void
  1696. ---------------------------------------------------------------------*/
  1697. #define sSetRxMask(CHP,CH) \
  1698. { \
  1699. (CHP)->MCode[RXMASK_DATA] = (CH); \
  1700. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->MCode[RXMASK_OUT]); \
  1701. }
  1702. /*-------------------------------------------------------------------
  1703. Function: sSetRxTrigger
  1704. Purpose: Set the Rx FIFO trigger level
  1705. Call: sSetRxProcessor(ChP,Level)
  1706. CHANPTR_T ChP; Ptr to channel structure
  1707. unsigned char Level; Number of characters in Rx FIFO at which the
  1708. interrupt will be generated. Can be any of the following flags:
  1709. TRIG_NO: no trigger
  1710. TRIG_1: 1 character in FIFO
  1711. TRIG_1_2: FIFO 1/2 full
  1712. TRIG_7_8: FIFO 7/8 full
  1713. Return: void
  1714. Comments: An interrupt will be generated when the trigger level is reached
  1715. only if function sEnInterrupt() has been called with flag
  1716. RXINT_EN set. The RXF_TRIG flag in the Interrupt Idenfification
  1717. register will be set whenever the trigger level is reached
  1718. regardless of the setting of RXINT_EN.
  1719. ---------------------------------------------------------------------*/
  1720. #define sSetRxTrigger(CHP,LEVEL) \
  1721. { \
  1722. (CHP)->RxControl[2] &= ~TRIG_MASK; \
  1723. (CHP)->RxControl[2] |= LEVEL; \
  1724. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->RxControl[0]); \
  1725. }
  1726. /*-------------------------------------------------------------------
  1727. Function: sSetTxSize
  1728. Purpose: Set the maximum number of bytes allowed in a channel's Tx FIFO.
  1729. Call: sSetTxSize(ChP,TxSize)
  1730. CHANPTR_T ChP; Ptr to channel structure
  1731. int TxSize; Maximum number of bytes allowed in Tx FIFO.
  1732. Return: void
  1733. ---------------------------------------------------------------------*/
  1734. #define sSetTxSize(CHP,TXSIZE) (CHP)->TxSize = (TXSIZE)
  1735. /*-------------------------------------------------------------------
  1736. Function: sSetSPChar
  1737. Purpose: Set the SP (space) character
  1738. Call: sSetSPChar(ChP,Ch)
  1739. CHANPTR_T ChP; Ptr to channel structure
  1740. unsigned char Ch; The value to set the SP character to
  1741. Return: void
  1742. ---------------------------------------------------------------------*/
  1743. #define sSetSPChar(CHP,CH) \
  1744. { \
  1745. (CHP)->MCode[SPACE_DATA] = (CH); \
  1746. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->MCode[SPACE_OUT]); \
  1747. }
  1748. /*-------------------------------------------------------------------
  1749. Function: sSetStop1
  1750. Purpose: Set stop bits to 1
  1751. Call: sSetStop1(ChP)
  1752. CHANPTR_T ChP; Ptr to channel structure
  1753. Return: void
  1754. ---------------------------------------------------------------------*/
  1755. #define sSetStop1(CHP) \
  1756. { \
  1757. (CHP)->TxControl[2] &= ~STOP2; \
  1758. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->TxControl[0]); \
  1759. }
  1760. /*-------------------------------------------------------------------
  1761. Function: sSetStop2
  1762. Purpose: Set stop bits to 2
  1763. Call: sSetStop2(ChP)
  1764. CHANPTR_T ChP; Ptr to channel structure
  1765. Return: void
  1766. ---------------------------------------------------------------------*/
  1767. #define sSetStop2(CHP) \
  1768. { \
  1769. (CHP)->TxControl[2] |= STOP2; \
  1770. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->TxControl[0]); \
  1771. }
  1772. /*-------------------------------------------------------------------
  1773. Function: sSetTxXOFFChar
  1774. Purpose: Set the Tx XOFF flow control character
  1775. Call: sSetTxXOFFChar(ChP,Ch)
  1776. CHANPTR_T ChP; Ptr to channel structure
  1777. unsigned char Ch; The value to set the Tx XOFF character to
  1778. Return: void
  1779. ---------------------------------------------------------------------*/
  1780. #define sSetTxXOFFChar(CHP,CH) \
  1781. { \
  1782. (CHP)->MCode[TXXOFFVAL_DATA] = (CH); \
  1783. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->MCode[TXXOFFVAL_OUT]); \
  1784. }
  1785. /*-------------------------------------------------------------------
  1786. Function: sSetTxXONChar
  1787. Purpose: Set the Tx XON flow control character
  1788. Call: sSetTxXONChar(ChP,Ch)
  1789. CHANPTR_T ChP; Ptr to channel structure
  1790. unsigned char Ch; The value to set the Tx XON character to
  1791. Return: void
  1792. ---------------------------------------------------------------------*/
  1793. #define sSetTxXONChar(CHP,CH) \
  1794. { \
  1795. (CHP)->MCode[TXXONVAL_DATA] = (CH); \
  1796. sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->MCode[TXXONVAL_OUT]); \
  1797. }
  1798. /*-------------------------------------------------------------------
  1799. Function: sStartRxProcessor
  1800. Purpose: Start a channel's receive processor
  1801. Call: sStartRxProcessor(ChP)
  1802. CHANPTR_T ChP; Ptr to channel structure
  1803. Return: void
  1804. Comments: This function is used to start a Rx processor after it was
  1805. stopped with sStopRxProcessor() or sStopSWInFlowCtl(). It
  1806. will restart both the Rx processor and software input flow control.
  1807. ---------------------------------------------------------------------*/
  1808. #define sStartRxProcessor(CHP) sOutDW((CHP)->IndexAddr,*(ULONGPTR_T)&(CHP)->MCode[0])
  1809. /*-------------------------------------------------------------------
  1810. Function: sWriteTxByte
  1811. Purpose: Write a transmit data byte to a channel.
  1812. BIOA_T io: Channel transmit register I/O address. This can
  1813. be obtained with sGetTxRxDataIO().
  1814. unsigned char Data; The transmit data byte.
  1815. Return: void
  1816. Warnings: This function writes the data byte without checking to see if
  1817. sMaxTxSize is exceeded in the Tx FIFO.
  1818. ---------------------------------------------------------------------*/
  1819. #define sWriteTxByte(IO,DATA) sOutB(IO,DATA)
  1820. /*-------------------------------------------------------------------
  1821. Function: sWriteTxWord
  1822. Purpose: Write two transmit data bytes to a channel with a single word write
  1823. Call: sWriteTxWord(io,Data)
  1824. WIOA_T io: Channel transmit register I/O address. This can
  1825. be obtained with sGetTxRxDataIO().
  1826. unsigned int Data; The two transmit data bytes. The low byte
  1827. will be transmitted first, then the high byte.
  1828. Return: void
  1829. ---------------------------------------------------------------------*/
  1830. #define sWriteTxWord(IO,DATA) sOutW(IO,DATA)
  1831. //----- global vars
  1832. extern unsigned char MasterMCode1[];
  1833. extern unsigned char MCode1Reg[];
  1834. extern CONTROLLER_T sController[];
  1835. extern unsigned char sIRQMap[16];