home *** CD-ROM | disk | FTP | other *** search
/ Piper's Pit BBS/FTP: ibm 0020 - 0029 / ibm0020-0029 / ibm0028.tar / ibm0028 / GRLF-C-1.ZIP / ASIPORTS.H next >
Encoding:
C/C++ Source or Header  |  1990-08-14  |  28.9 KB  |  876 lines

  1. /*
  2.  * asiports.h
  3.  * contains: User include file for Greenleaf CommLib
  4.  *
  5.  * The Greenleaf Comm Library
  6.  *
  7.  * Copyright (C) 1985-1990 Greenleaf Software Inc.  All    Rights Reserved.
  8.  *
  9.  */
  10. #ifndef    GFDOTH
  11. #include "gf.h"
  12. #endif
  13. /*
  14.  *
  15.  * MODIFICATIONS
  16.  *  David Nienhiser   03-FEB-1987  11:18:34.27
  17.  *    Added definition for extern int    _asoprt.
  18.  *  David Nienhiser   03-FEB-1987  14:34:48.81
  19.  *    txwalert && xoffsent bits in AS_STBITS structure were reversed.
  20.  *    Added constants    for COMLIBVERSION && COMLIBREVISION.
  21.  *  David Nienhiser   20-FEB-1987  09:08:15.37
  22.  *    Added structure    bits & variables for support of    RTS control
  23.  *
  24.  *  David Nienhiser   11-MAY-1988  15:35:02.32     Version 2.20
  25.  *
  26.  *    Added new structure member called txiflag, this    bit will take
  27.  *    the place of the old Transmit interrupt    enable bit internal
  28.  *    to the 8250/16450.  At initialization time the transmit    interrupt
  29.  *    enable bit will    be enabled (if transmit    interrupts are enabled).
  30.  *    From this point    forward    the txiflag bit    in the structure will
  31.  *    be what    is actually toggled off    and on instead of the interrupt
  32.  *    enable bit internal to the 8250/16450.    This was done because
  33.  *    not all    serial devices generate    an interrupt when the interrupt
  34.  *    enable flag inside the 8250/16450 is asserted.
  35.  *
  36.  *    Added a    new function to    select an alternate set    of interrupt
  37.  *    scan and lock code.  These new interrupt routine headers are
  38.  *    specifically for multiple port COMM boards that    represent channels
  39.  *    needing    service    by setting bits    in the interrupt latch such as the
  40.  *    Digiboard for the PS/2 and Quadport AT.     The name of the new function
  41.  *    is asihsel() (handler select) and is in    the file _asifirs.asm.
  42.  *    It must    be called with a parameter of 1.
  43.  *
  44.  *    Added a    new function submodel(), this function returns the
  45.  *    machine    submodel byte which is documented on page 2-95 and 4-18
  46.  *    of the IBM BIOS    interface technical reference.    This was necessary
  47.  *    to differentiate between PS/2 model 50 & 60 and    IBM-AT systems,
  48.  *    the value returned by machine()    is the same for    both.  submodel()
  49.  *    can be found in    machine.asm.
  50.  *
  51.  *    Defined    the constant COM17 for the 16 channel digiboard.
  52.  *
  53.  *    Added a    new member to the PORTINFO structure, the as_xorv.
  54.  *    This member is xor'ed with the value read from the board's
  55.  *    interrupt identification port.    By default it is 0, if the
  56.  *    board's    interrupt identification register identifies channels
  57.  *    that need service with 0's instead of 1's this value should
  58.  *    be set to 0xffff.  An example of where this is needed is with
  59.  *    the Arnet Multiport.
  60.  *
  61.  *    Added new function asinvert() to accomplish this.  asinvert()
  62.  *    is in a    NEW module, asinvert.c
  63.  *
  64.  *    Changed    MAX_PORT to 17,    for PS/2 & Digiboard 16    channel    + COM1
  65.  *
  66.  *    Added POS.... macro's and constants to ease accessing POS registers
  67.  *    on PS/2    w/Micro-Channel.
  68.  *
  69.  *    Version    2.20 of    the Greenleaf Comm library has now been    tested with
  70.  *    the following:
  71.  *
  72.  *    Digiboard  8 port for IBM PC and AT
  73.  *    Digiboard  4 port for PS/2 Micro Channel
  74.  *    Digiboard 16 port for PS/2 Micro Channel
  75.  *
  76.  *    Quadram    Quadport-AT  5 channel
  77.  *
  78.  *    Arnet Multiport    8 port for IBM PC and AT
  79.  *
  80.  *    Star Gate Technologies PLUS 8 and PLUS 8 MC
  81.  *
  82.  *    Consult    the program MULTLOOP.C for information on how to setup
  83.  *    the Comm library for each of these.
  84.  *
  85.  *    Added new file GLCRC.ASM, which    contains function glcrc().  This
  86.  *    function calculates the    crc of a variable length buffer.
  87.  *
  88.  *    Modified the XMBUF structure in    xmodem.h.
  89.  *    Added member to    XMBUF structure    named xfermode,    this will be set
  90.  *    to CRCMODE if XMODEM-CRC is being used,    it will    be set to
  91.  *    CHECKSUMMODE if    XMODEM-Checksum    is being used.    CRCMODE    and
  92.  *    CHECKSUMMODE are two new constants added to xmodem.h also.
  93.  *
  94.  *    Added another parameter    to asigetd(), controls whether
  95.  *    character is actually removed from buffer.
  96.  *
  97.  *  Kamy Rahimi        03-6-1988
  98.  *    Changed    static int _asidown to int _asidown() to match asiquit.c
  99.  *    source.
  100.  **
  101.  *
  102.  *  David Nienhiser Mon    05-Jun-1989 13:39:39
  103.  **
  104.  *    Changed    MAX_PORT constant to 35    (from 17)
  105.  *
  106.  *    Added constants    for BAUD38K, BAUD56K and BAUD115K
  107.  *
  108.  */
  109.  
  110. #define    COMLIBVERSION    3        /* Comm    library    Version    */
  111. #define    COMLIBREVISION    0        /* Comm    library    Revision */
  112.  
  113.  
  114. #define    MAX_PORT    35
  115. #define    MAX_BUF_SIZE    65535U
  116. #define    MIN_BUF_SIZE    2
  117.  
  118. #define    COM1        0
  119. #define    COM2        1
  120. #define    COM3        2
  121. #define    COM4        3
  122. #define    COM5        4
  123. #define    COM6        5
  124. #define    COM7        6
  125. #define    COM8        7
  126. #define    COM9        8
  127. #define    COM10        9
  128. #define    COM11        10
  129. #define    COM12        11
  130. #define    COM13        12
  131. #define    COM14        13
  132. #define    COM15        14
  133. #define    COM16        15
  134. #define    COM17        16
  135. #define    COM18        17
  136. #define    COM19        18
  137. #define    COM20        19
  138. #define    COM21        20
  139. #define    COM22        21
  140. #define    COM23        22
  141. #define    COM24        23
  142. #define    COM25        24
  143. #define    COM26        25
  144. #define    COM27        26
  145. #define    COM28        27
  146. #define    COM29        28
  147. #define    COM30        29
  148. #define    COM31        30
  149. #define    COM32        31
  150. #define    COM33        32
  151. #define    COM34        33
  152. #define    COM35        34
  153.  
  154. /* Macro's and constants to ease the reading of    Micro Channel POS
  155.  * registers.
  156.  */
  157. #define    POSCHNLSELECT    0x96        /* POS Channel Select */
  158. #define    POSLOWIDPORT    0x100        /* POS I.D. Low    byte */
  159. #define    POSHIGHIDPORT    0x101        /* POS I.D. High byte */
  160. #define    POS2PORT    0x102        /* POS Adapter info ports 2-5*/
  161. #define    POS3PORT    0x103
  162. #define    POS4PORT    0x104
  163. #define    POS5PORT    0x105
  164. #define    POSCHMIN    0x08        /* Minimum channel */
  165. #define    POSCHMAX    0x0f        /* Maximum channel */
  166. #define    POSCHNLDISABLE    0x00        /* Disable channel access */
  167. #define    POSSELECTCHANNEL(p)    _asoutb(POSCHNLSELECT,p)
  168. #define    POSDESELECTCHANNEL(p)    _asoutb(POSCHNLSELECT,POSCHNLDISABLE)
  169. #define    POSID()            ((_asinb(POSHIGHIDPORT)<<8)+_asinb(POSLOWIDPORT))
  170. #define    POS2INFO()        _asinb(POS2PORT)
  171. #define    POS3INFO()        _asinb(POS3PORT)
  172. #define    POS4INFO()        _asinb(POS4PORT)
  173. #define    POS5INFO()        _asinb(POS5PORT)
  174.  
  175. #define    TICKS_PER_SECOND          18 /* Timer ticks    per second         */
  176.  
  177. #define    TRUE        1
  178. #define    FALSE        0
  179.  
  180. /************************************************************************
  181. *                                    *
  182. *  USER    SHOULD NOT WRITE TO OR ACCESS DIRECTLY ANYTHING    PAST THIS POINT    *
  183. *                                    *
  184. ************************************************************************/
  185.  
  186. /* IRQ's 1..8 */
  187. #define    IRQ1 1
  188. #define    IRQ2 2
  189. #define    IRQ3 3
  190. #define    IRQ4 4
  191. #define    IRQ5 5
  192. #define    IRQ6 6
  193. #define    IRQ7 7
  194. #define    IRQ8 8
  195.  
  196. /*  port operating modes
  197. */
  198. #define    ASIN        1
  199. #define    ASOUT        2
  200. #define    ASINOUT        3
  201. #define    BINARY        0
  202. #define    ASCII        4
  203. #define    NORMALRX    0
  204. #define    WIDETRACKRX    128
  205.  
  206. /* Error masks for widetrack rx    buffer
  207. */
  208. #define    OVERRUN_ERR      2
  209. #define    PARITY_ERR      4
  210. #define    FRAMING_ERR      8
  211. #define    CTS_STATE     16
  212. #define    DSR_STATE     32
  213. #define    RI_STATE     64
  214. #define    CD_STATE    128
  215.  
  216. /*
  217.  * Argument values for asicheck()
  218. */
  219. #define    ALERT_FLAG_STOPS_RX_AND_TX     1
  220. #define    CTS_LOW_STOPS_TX_INTERRUPTS     2
  221. #define    DSR_LOW_DISCARDS_RX_DATA     4
  222. #define    CD_LOW_DISCARDS_RX_DATA         8
  223. #define    MODEM_STATUS_CHANGES_SET_ALERT     16
  224. #define    LINE_STATUS_ERRORS_SET_ALERT     32
  225.  
  226. /*
  227.  * For asirchk()
  228.  */
  229. #define    CHKDISABLE 0
  230. #define    CHKDISCARD 1
  231. #define    CHKFLAGDISCARD 2
  232. #define    CHKFLAG    3
  233. #define    CHKRESET 4
  234.  
  235. /*
  236.  *Define status    modes for all those is...() functions
  237.  */
  238. #define    IMMEDIATE    0
  239. #define    CUMULATIVE    1
  240.  
  241. /*
  242.  * Define dialing methods for HMSetDialingMethod()
  243.  */
  244. #define    TOUCH_TONE    0
  245. #define    PULSE        1
  246.  
  247. /*
  248.  * Define hookswitch states for    HMSetHookSwitch()
  249.  */
  250. #define    ONHOOK         0
  251. #define    OFFHOOK         1
  252. #define    SPECIAL_OFFHOOK     2
  253. /*
  254.  * Define special speaker state    for HMSetSpeaker()
  255.  */
  256. #define    ON_ALWAYS     2
  257.  
  258.  
  259. /*  Buffer Flags (Masks)
  260. */
  261. #define    ALERT    1
  262. #define    RXEMPTY    2
  263. #define    RXFULL    4
  264. #define    RXOVFLOW 8
  265. #define    TXEMPTY    16
  266. #define    TXFULL    32
  267. #define    LINERR    64
  268. #define    MODCHG    128
  269.  
  270. /*  Line Status
  271. */
  272. #define    OVERRUN    2
  273. #define    PARERR    4
  274. #define    FRAMERR    8
  275. #define    BREAKDET 16
  276. #define    THRE 32
  277. #define    TEMT 64
  278.  
  279. /*  Modem Status
  280. */
  281. #define    CTSCHG    1
  282. #define    DSRCHG    2
  283. #define    RITRAIL    4
  284. #define    CDCHG    8
  285. #define    CTS    16
  286. #define    DSR    32
  287. #define    RI    64
  288. #define    CD    128
  289.  
  290. /*  ASCII Protocol Characters
  291. */
  292. #ifndef    NUL
  293. #define    NUL 0
  294. #endif
  295. #define    SOH 1
  296. #define    STX 2
  297. #define    ETX 3
  298. #define    EOT 4
  299. #define    ACK 6
  300. #define    DLE 0x10
  301. #define    DC1 0x11
  302. #define    DC2 0x12
  303. #define    DC3 0x13
  304. #define    DC4 0x14
  305. #define    NAK 0x15
  306. #define    ETB 0x17
  307. #define    XON 0x11
  308. #define    XOFF 0x13
  309. #define    CAN 0x18
  310. #define    NEWLINE    '\n'
  311.  
  312. /* Error codes returned    by all functions OR in _aserror.
  313. */
  314. #define    ASSUCCESS         0
  315. #define    ASGENERALERROR        -1
  316. #define    ASINVPORT        -2
  317. #define    ASINUSE            -3
  318. #define    ASINVBUFSIZE        -4
  319. #define    ASNOMEMORY        -5
  320. #define    ASNOTSETUP        -6
  321. #define    ASINVPAR        -7
  322. #define    ASBUFREMPTY        -8
  323. #define    ASBUFRFULL        -9
  324. #define    ASTIMEOUT        -10
  325. #define    ASNOCTS            -11
  326. #define    ASNOCD            -12
  327. #define    ASNODSR            -13
  328. #define    ASNO8250        -14
  329. #define    ASXMSTATUS        -15
  330. #define    ASUSERABORT        -16
  331. #define    ASFILERR        -17
  332. #define    ASXMERROR        -18
  333. #define    ASNOWIDERX        -19
  334. #define    ASCONFLICT        -20
  335. #define    ASCRCMODE        -21
  336. #define    ASNOHAYESOK        -22
  337. #define    ASNOHAYESRESPONSE    -23
  338.  
  339. /* Parity types
  340. */
  341. #define    P_NONE        0
  342. #define    P_ODD        1
  343. #define    P_EVEN        2
  344. #define    P_S_STICK    3
  345. #define    P_M_STICK    4
  346.  
  347. /************************************************************************
  348. *  SUPPORT POLICY RE ALL STRUCTURES FROM HERE ON:            *
  349. *                                    *
  350. *  These structures are    used internally    by the Comm functions and the    *
  351. *  interrupts.    Any endeavor to    modify them, write to them, or inspect    *
  352. *  values from an applications or other    user program will not be    *
  353. *  supported.  We have left the    comments in this file intentionally to    *
  354. *  provide some    insight    into what is going on;    we decline to answer    *
  355. *  any questions on these structures beyond this point.            *
  356. ************************************************************************/
  357. /*  Port Status    Bits (from interrupt process)
  358. */
  359. struct AS_STBITS {
  360.     unsigned alert :  1;
  361.     unsigned rxempty: 1;
  362.     unsigned rxfull:  1;
  363.     unsigned rxovflow: 1;
  364.     unsigned txempty: 1;
  365.     unsigned txfull:  1;
  366.     unsigned linerr:  1;
  367.     unsigned modchg:  1;
  368.     unsigned xchrun:  1;
  369.     unsigned rchrun:  1;
  370.     unsigned txwxon:  1;
  371.     unsigned txwcts:  1;
  372.     unsigned txwalert: 1;
  373.     unsigned xoffsent: 1;
  374.     unsigned rtsactive:1;
  375.     unsigned txiflag:1;
  376.     };
  377.  
  378. /*  Interrupt Options (written from application    side, read by interrupts)
  379. */
  380. struct AS_MODEBITS {
  381.     unsigned is_txint:   1;
  382.     unsigned is_rxint:   1;
  383.     unsigned is_ascii:   1;
  384.     unsigned is_rxerror: 1;
  385.     unsigned is_xoffmode: 1;
  386.     unsigned cts_low_holds_tx_interrupts: 1;
  387.     unsigned alert_flag_stops_rx_and_tx: 1;
  388.     unsigned dsr_low_discards_rx_data : 1;
  389.     unsigned cd_low_discards_rx_data : 1;
  390.     unsigned modem_status_changes_set_alert    : 1;
  391.     unsigned line_errors_set_alert : 1;
  392.     unsigned is_xmodemmode:    1;
  393.     unsigned is_polledhdw:    1;
  394.     unsigned is_rchking: 1;
  395.     unsigned is_rtscontrol:1;
  396.     };
  397.  
  398. /* Port    Information Table
  399. */
  400. struct PORT_TABLE {
  401.     /* 8250    Information
  402.     */
  403.     int    intrpt_num;    /* 8250    interrupt no. 0C...  */
  404.     unsigned base_8250;    /* base    i/o address of 8250  */
  405.     int p_8250[5];        /* previous values for 8250 registers:
  406.                 [0] = line control register,
  407.                 [1] = modem control register,
  408.                 [2] = interrupt    enable register,
  409.                 [3] = divisor latch least significant byte,
  410.                 [4] = divisor latch most significant byte,
  411.                 */
  412.     long p_vector;        /* previous value for interrupt    vector */
  413.     unsigned line_stat,    /* line    status */
  414.     modem_stat,        /* modem status    */
  415.     wide_stat;        /* wide-track status */
  416.  
  417.     /* 8259    Information
  418.     */
  419.     int irq_8259,        /* Interrupt # in 8259 (com0 = 4) */
  420.     p_8259;            /* Previous value of irq_8259 bit */
  421.     unsigned port_8259;    /* I/O Address of 8259 */
  422.  
  423.     /* buffer information
  424.     */
  425.     unsigned
  426.         rx_cell,    /* size    of transmit cell (for wide-track)*/
  427.     rx_size,    /* size    of receive buffer */
  428.     rx_count,    /* number of characters    in receive buffer */
  429.     rx_head,    /* offset of receive buffer head */
  430.     rx_tail;    /* offset of receive buffer tail */
  431.     char *rx_buffer; /* always points to base of receive buffer */
  432.  
  433.     unsigned
  434.         tx_cell,    /* size    of transmit cell (to be    like rx-buffer)    */
  435.     tx_size,    /* size    of transmit buffer */
  436.     tx_count,    /* number of characters    in transmit buffer */
  437.     tx_head,    /* offset of transmit buffer head */
  438.     tx_tail;    /* offset of transmit buffer tail */
  439.     char *tx_buffer; /* always points to base of transmit buffer */
  440.  
  441.     /* port    information
  442.     */
  443.     struct AS_STBITS chst_bits;    /* port    status bits */
  444.     struct AS_MODEBITS chmode_bits;    /* port    mode bits IN,OUT,XON,etc */
  445.     unsigned rts_lowater,        /* when    to assert RTS */
  446.     rts_hiwater;            /* when    to de-assert RTS */
  447.  
  448.     unsigned rx_accum, /* counter for received characters */
  449.     rx_lowater,      /* low water mark, point at which xon    get's sent */
  450.     rx_hiwater;      /* high water    mark, point at which xoff gets sent */
  451.     int stop_xmt,      /* if    xon/xoff enabled character that    stops xmit */
  452.     start_xmt,      /* character that starts xmit    */
  453.     stop_rem_xmt,      /* character sent when rx buffer almost full */
  454.     start_rem_xmt;      /* character sent when rx buffer almost empty    */
  455.  
  456.     int break_delay;  /* amount of delay for break signal */
  457.  
  458.     /* time-out values for polled mode
  459.     */
  460.     int aswmodem,
  461.     aswtime,
  462.     asrtime;
  463.  
  464.     /* Shared Interrupt Hardware: Status port and bitmask */
  465.     unsigned shioad,
  466.     shbmask;
  467.     unsigned chkchr[3];    /* Each    character occupies the low order
  468.                    8 bits, the high order bit (bit 15)
  469.                    is set to 1 if rx-interrupts    are to
  470.                    look    at this    character, bit 14 is set
  471.                    by interrupt    routines and is    to be
  472.                    checked by asirchk().  Bit 8    & 9 determine
  473.                    the mode or option of what to do */
  474. };
  475.  
  476.  
  477. /************************************************************************
  478. *  ARRAYS OF FUNDAMENTAL THINGS    THAT MUST BE KNOWN AT INTERRUPT    TIME.    *
  479. *                                    *
  480. *  1.  Pointer to main parameter structure for the port.        *
  481. *  2.  I/O Address of status reg if shared-int hardware, zero if not.    *
  482. *  3.  If shared hardware, this    is bitmask to compare for the port.    *
  483. *      Note:  when the int. reads the status port it searches for a    *
  484. *      match against an    entry in this column in    the array.        *
  485. *  4.  Value to    be XOR'ed with value read from shared port, this will    *
  486. *      cover the case where bits in the    board's    interrupt I.D. register    *
  487. *      are active when 0 instead of active when    1.            *
  488. ************************************************************************/
  489.  
  490. struct PORTINFO    {
  491.     struct PORT_TABLE *ptb;
  492.     unsigned as_shport;
  493.     unsigned as_shbits;
  494.     unsigned as_mask;
  495.     unsigned as_xorv;
  496. };
  497. struct TABLEPORT {
  498.     struct PORTINFO    tblport[MAX_PORT];
  499. };
  500.  
  501. #ifndef    MOD_ASIFIRST
  502. extern struct TABLEPORT    *as_chnl;
  503. extern unsigned    as_8250port[],as_8259ports[];
  504. extern int as_intnums[],as_8259irq[],as_brkdly[],as_wmodem[],
  505.     as_wtime[],as_rtime[],_aserror,_asoprt,_asmask,_asxorv,
  506.     _comvers,_comrev;
  507. extern unsigned    as_shioad[],as_shbmask[];
  508. #endif
  509.  
  510.  
  511. #define    isalert(p)              _iswhat((p),1)
  512. #define    isrxempty(p)              _iswhat((p),2)
  513. #define    isrxfull(p)              _iswhat((p),3)
  514. #define    isrxovflow(p)              _iswhat((p),4)
  515. #define    istxempty(p)              _iswhat((p),5)
  516. #define    istxfull(p)              _iswhat((p),6)
  517. #define    islinerr(p)              _iswhat((p),7)
  518. #define    ismodemerr(p)              _iswhat((p),8)
  519. #define    istxintrunning(p)          _iswhat((p),9)
  520. #define    isrxintrunning(p)          _iswhat((p),10)
  521. #define    AlertFlagStopsRXAndTX(p)      _iswhat((p),11)
  522. #define    CTSLowHoldsTXInterrupts(p)      _iswhat((p),12)
  523. #define    DSRLowDiscardsRXData(p)          _iswhat((p),13)
  524. #define    CDLowDiscardsRXData(p)          _iswhat((p),14)
  525. #define    ModemStatusChangesSetAlert(p)      _iswhat((p),15)
  526. #define    LineStatusErrorsSetAlert(p)      _iswhat((p),16)
  527.  
  528. #define    isoverrun(p,o)        _isstat((p),o,1)
  529. #define    isparityerr(p,o)    _isstat((p),o,2)
  530. #define    isframerr(p,o)        _isstat((p),o,3)
  531. #define    isbreak(p,o)        _isstat((p),o,4)
  532. #define    iscts(p,o)        _isstat((p),o,5)
  533. #define    isdsr(p,o)        _isstat((p),o,6)
  534. #define    iscd(p,o)        _isstat((p),o,7)
  535. #define    isri(p,o)        _isstat((p),o,8)
  536. #define    ischgcts(p,o)        _isstat((p),o,9)
  537. #define    ischgdsr(p,o)        _isstat((p),o,10)
  538. #define    ischgcd(p,o)        _isstat((p),o,11)
  539. #define    ischgri(p,o)        _isstat((p),o,12)
  540.  
  541. #define    isncts(p)        _iswhat((p),17)
  542. #define    isndsr(p)        _iswhat((p),18)
  543. #define    isncd(p)        _iswhat((p),19)
  544. #define    isring(p)        _iswhat((p),20)
  545. #define    isxmrxing(p)        _iswhat((p),21)
  546. #define    isxoffblocked(p)    _iswhat((p),22)
  547. #define    isctsblocked(p)        _iswhat((p),23)
  548.  
  549. /*#ifdef __cplusplus
  550. extern "C" {
  551. #endif
  552. */
  553. int          GF_CDECL glcrc( unsigned int count,
  554.                   unsigned int startvalue,
  555.                   char *buffer );
  556. void          GF_CDECL _assti( void    );
  557. void          GF_CDECL _ascli( void    );
  558. int          GF_CDECL _asgetc( unsigned base_8250_address );
  559. int          GF_CDECL _asputc( unsigned base_8250_address,    int character );
  560. int          GF_CDECL _asinb( unsigned io_address );
  561. int          GF_CDECL _asoutb( unsigned io_address, int value );
  562. int          GF_CDECL _asigetc( struct PORT_TABLE *port_structure );
  563. int          GF_CDECL _asiputc( struct PORT_TABLE *port_structure,    int character );
  564. int          GF_CDECL _asipekc( struct PORT_TABLE *port_structure );
  565. void          GF_CDECL _asregister(    struct TABLEPORT *port_structure );
  566. int          GF_CDECL _asifirst( int port_number,
  567.                       int latch,
  568.                       struct PORT_TABLE    *port_structure    );
  569. void          GF_CDECL _asiprime( struct PORT_TABLE    *port_structure    );
  570. int          GF_CDECL interror( void );
  571. int          GF_CDECL asitime( void );
  572. int          GF_CDECL _asrts( unsigned io_address,
  573.                    int on_off,
  574.                    struct PORT_TABLE *port_structure );
  575. int          GF_CDECL _asdtr( unsigned io_address,    int on_off );
  576. void          GF_CDECL _asireset( unsigned io_address,
  577.                       int line_control,
  578.                       int divisor_lsb,
  579.                       int divisor_msb,
  580.                       int modem_control    );
  581. void          GF_CDECL _asiresume( unsigned    port,
  582.                        int interrupt_register,
  583.                        struct PORT_TABLE *port_structure );
  584. void          GF_CDECL _asihold( unsigned base_8250_address,
  585.                      int interrupt_register,
  586.                      struct PORT_TABLE *port_structure );
  587. int          GF_CDECL _asiinit( unsigned io_address,
  588.                      int divisor,
  589.                      unsigned parity_stop_bits_word_length );
  590. void          GF_CDECL _asibreak( unsigned io_address,int on_off );
  591. int          GF_CDECL _asistart( struct PORT_TABLE    *port_structure    );
  592. void          GF_CDECL _asiquit( int latch,    struct PORT_TABLE *port_structure);
  593. void          GF_CDECL _asidiag( unsigned io_address, int on_off );
  594. int          GF_CDECL _asgetdivisor( unsigned io_address );
  595. unsigned      GF_CDECL machine( void );
  596. void          GF_CDECL timer( unsigned ticks );
  597. void          GF_CDECL asihsel( int    ps_2_or_pc );
  598. int          GF_CDECL submodel( void );
  599. int          GF_CONV asiflow( int port_number,
  600.                int low_water,
  601.                int hi_water,
  602.                int rts_on_off,
  603.                int cts_on_off );
  604. struct PORT_TABLE * GF_CONV _aschkcnl( int port_number);
  605. int          GF_CONV asdtr( int port_number, int on_off );
  606. int          GF_CONV asgetc( int port_number );
  607. int          GF_CONV asibreak( int    port_number, int length_in_ticks);
  608. unsigned int GF_CONV  asibstat( int    port_number );
  609. int          GF_CONV asiclear( int    port_number, int option    );
  610. int          GF_CONV asidiag( int port_number, int    on_off );
  611. unsigned int      GF_CONV asierst( int port_number );
  612. int          GF_CONV asifirst( int    port_number,
  613.                 unsigned int operating_mode,
  614.                 unsigned int rx_buffer_length,
  615.                 unsigned int tx_buffer_length );
  616. unsigned      int GF_CONV asigetb( int port_number,
  617.                    char *buffer,
  618.                    unsigned    int length );
  619. unsigned      int GF_CONV asigetb_timed( int port_number,
  620.                      char *buffer,
  621.                      unsigned int length,
  622.                      int ticks );
  623. int          GF_CONV asigetc( int port_number );
  624. int          GF_CONV asigetc_timed( int port_number, int ticks );
  625. int          GF_CONV asigetparms( int port_number,
  626.                    long *baud_rate,
  627.                    int *word_length,
  628.                    int *parity,
  629.                    int *stop_bits,
  630.                    int *dtr,
  631.                    int *rts    );
  632. unsigned int      GF_CONV asigets( int port_number,
  633.                char    *buffer,
  634.                unsigned int    maximum_length,
  635.                int terminating_character );
  636. unsigned int     GF_CONV asigets_timed( int port_number,
  637.                  char *buffer,
  638.                  unsigned int maximum_length,
  639.                  int terminating_character,
  640.                  int ticks );
  641. int          GF_CONV asihold( int port_number, unsigned int mode );
  642. int          GF_CONV asicheck( int    port_number, int condition, int    on_off );
  643. int          GF_CONV asiignore( int port_number, int condition, int on_off    );
  644. int          GF_CONV asiinit( int port_number,
  645.                long    baud_rate,
  646.                int parity,
  647.                int stop_bits,
  648.                int word_length );
  649. unsigned int      GF_CONV asilrst( int port_number );
  650. unsigned int      GF_CONV asilstat( int    port_number, 
  651.                                 int immediate_or_cumulative);
  652. int          GF_CONV HMReset( int port_number);
  653. int          GF_CONV HMGetRegister( int port_number, int modem_register);
  654. int          GF_CONV HMSetRegister( int port_number,
  655.                  int modem_register,
  656.                  int value );
  657. int          GF_CONV HMSetAutoAnswerRingCount( int    port_number, int count);
  658. int          GF_CONV HMGetIncomingRingCount( int port_number );
  659. int          GF_CONV HMSetEscapeCode( int port_number, char escape_character );
  660. int          GF_CONV HMSetEndOfLineCharacter( int port_number,
  661.                        char    end_of_line_character );
  662. int          GF_CONV HMSetLineFeedCharacter( int port_number,
  663.                       char line_feed_character );
  664. int          GF_CONV HMSetBackspaceCharacter( int port_number,
  665.                        char    backspace_character );
  666. int          GF_CONV HMSetWaitForDialToneTime( int    port_number,
  667.                         int    wait_for_dial_tone_time);
  668. int          GF_CONV HMSetWaitTimeForCarrier( int port_number,
  669.                        int wait_for_carrier_time );
  670. int          GF_CONV HMSetPauseTimeForComma( int port_number,
  671.                       int pause_time_for_comma );
  672. int          GF_CONV HMSetCDResponseTime( int port_number,
  673.                        int carrier_detect_response );
  674. int          GF_CONV HMSetCarrierDisconnectTime( int port_number,
  675.                           int carrier_disconnect_timer );
  676. int          GF_CONV HMSetTouchToneDuration( int port_number, int dial_speed );
  677. int          GF_CONV HMSetEscapeCodeGuardTime( int    port_number,
  678.                         int    escape_guard_time );
  679. int          GF_CONV HMGetUARTStatus( int port_number );
  680. int          GF_CONV HMGetOptionRegister( int port_number );
  681. int          GF_CONV HMGetFlagRegister( int port_number );
  682. int          GF_CONV HMGoOnline( int port_number );
  683. int          GF_CONV HMSetDialingMethod( int port_number, int tone_or_pulse );
  684. int          GF_CONV HMDial( int port_number, char    *digit_string );
  685. int          GF_CONV HMRepeatLastCommand( int port_number );
  686. int          GF_CONV HMDialInAnswerMode( int port_number, char *digit_string );
  687. int          GF_CONV HMDialAndReturnToCommandMode(    int port_number,
  688.                         char *digit_string );
  689. int          GF_CONV HMAnswer( int    port_number );
  690. int          GF_CONV HMSetCarrier(    int port_number, int on_off );
  691. int          GF_CONV HMSetEchoMode( int port_number, int on_off );
  692. int          GF_CONV HMSetFullDuplexMode( int port_number,    int full_or_half );
  693. int          GF_CONV HMSetHookSwitch( int port_number, int    on_or_off_hook );
  694. int          GF_CONV HMSetSpeaker(    int port_number, int speaker_control );
  695. int          GF_CONV HMReturnNoResultCodes( int port_number, int on_or_off    );
  696. int          GF_CONV HMSelectExtendedResultCodes( int port_number,
  697.                            int extended_result_codes );
  698. int          GF_CONV HMSetVerboseMode( int    port_number ,int on_of_off );
  699. void          GF_CONV HMWaitForOK( int ticks,
  700.                    char *match_string );
  701. void          GF_CONV HMSetUpEchoRoutine( void ( GF_CDECL *character_printer    )( char    c ) );
  702. void          GF_CONV HMSetUpAbortKey( unsigned int    key );
  703. void          GF_CONV HMFixedDelay(    int ticks );
  704. int          GF_CONV HMSendString(    int port_number, char *    string );
  705. int          GF_CONV HMSendStringNoWait( int port_number,
  706.                       char *string,
  707.                       int termination_sequence );
  708. void          GF_CONV icat(    char *string, int value);
  709. int          GF_CONV _hm3(    int port_number, char *output_string, int digit    );
  710. int          GF_CONV HMInputLine( int port, int ticks, char *buffer, 
  711.                         int length );
  712.  
  713.  
  714. unsigned int      GF_CONV asimrst( int port_number );
  715. unsigned int      GF_CONV asimstat( int    port_number, 
  716.                             int immediate_or_cumulative );
  717. int          GF_CONV asiopen( int port_number,
  718.                unsigned int    mode,
  719.                unsigned int    rx_buffer_length,
  720.                unsigned int    tx_buffer_length,
  721.                long    baud_rate,
  722.                int parity,
  723.                int stop_bits,
  724.                int word_length,
  725.                int dtr,
  726.                int rts );
  727. int          GF_CONV asipeek( int port_number );
  728. unsigned int      GF_CONV asiputb( int port_number, char * buffer, 
  729.                                 unsigned int    length );
  730. int          GF_CONV asiputc( int port_number, int    character );
  731. unsigned int    GF_CONV  asiputs( int port_number,
  732.                char    *output_string,
  733.                int termination_sequence );
  734. int          GF_CONV asiquit( int port_number );
  735. int          GF_CONV _asidown( int    port_number );
  736. void          GF_CDECL _asiexit_routine( void );
  737. int          GF_CONV asirchk( int port_number,
  738.                int code_number,
  739.                unsigned int    code_to_check,
  740.                int operation );
  741. int          GF_CONV asireset( int    port_number );
  742. int          GF_CONV asiresume( int port_number, unsigned int mode    );
  743. int          GF_CONV asisetv( int port_number,
  744.                unsigned int    address_of_8250,
  745.                int interrupt_vector_number,
  746.                unsigned int    address_of_8259,
  747.                int irq_number,
  748.                int break_delay,
  749.                int wait_for_signals_in_polled_mode,
  750.                int polled_mode_write_timeout,
  751.                int polled_mode_read_timeout,
  752.                unsigned int    shared_status_port_address,
  753.                unsigned int    shared_status_port_bit_mask );
  754. int          GF_CONV asishare( unsigned mask );
  755. int          GF_CONV asistart( int    port_number, unsigned int option );
  756. unsigned int      GF_CONV asiwgetb( int    port_number,
  757.                 char *character_buffer,
  758.                 unsigned int maximum_length,
  759.                 char *status_buffer    );
  760. unsigned int      GF_CONV asiwgetb_timed( int port_number,
  761.                   char *character_buffer,
  762.                   unsigned int maximum_length,
  763.                   char *status_buffer,
  764.                   int ticks );
  765. int          GF_CONV asiwgetc( int    port_number, char *wide_track_buffer );
  766. int          GF_CONV asiwgetc_timed( int port_number,
  767.                   char *wide_track_buffer,
  768.                   int ticks );
  769. unsigned int      GF_CONV asiwgets( int    port_number,
  770.                 char *destination_string,
  771.                 unsigned int maximum_length,
  772.                 int    terminating_character,
  773.                 char *status_buffer    );
  774. unsigned int      GF_CONV asiwgets_timed( int port_number,
  775.                   char *destination_string,
  776.                   unsigned int maximum_length,
  777.                   int terminating_character,
  778.                   char *status_buffer,
  779.                   int ticks );
  780. int          GF_CONV asiwpeek( int    port_number, char *status_buffer );
  781. int          GF_CONV asixoff( int port_number );
  782. int          GF_CONV asixon( int port_number,
  783.               int low_water_mark,
  784.               int high_water_mark,
  785.               int xon_character,
  786.               int xoff_character );
  787. unsigned int      GF_CONV asixrst( int port_number );
  788. int          GF_CONV asputc( int port_number, int character );
  789. unsigned int      GF_CONV asputs(  int port_number,
  790.                char    *output_string,
  791.                int termination_sequence );
  792. int          GF_CONV asrts( int port_number, int on_or_off    );
  793. unsigned int      GF_CONV getrxcnt( int    port_number );
  794. unsigned int      GF_CONV gettxfree( int port_number );
  795. int          GF_CONV isrchk( int port_number, int code_number );
  796. int          GF_CONV _isstat( int port_number,
  797.                int what_to_check,
  798.                int what_to_do );
  799. int          GF_CONV isxmrxcnt( int port_number, unsigned int count );
  800. int          GF_CONV _iswhat( int port_number, int    what_to_check );
  801. int          GF_CONV asinvert( unsigned mask );
  802.  
  803. /*#ifdef __cplusplus
  804. }
  805. #endif
  806. */
  807. /*
  808.  * Things after    this point are all in place in order to    have compatibility
  809.  * with    earlier    versions of the    CommLib.  Feel free to delete everything
  810.  * from    here down if you are not using any of the old function names.
  811.  */
  812.  
  813. /*
  814.  * Names used as parameters passed to asicheck()
  815.  */
  816.  
  817. #define    IGALERT        1
  818. #define    IGCTS        2
  819. #define    IGDSR        4
  820. #define    IGCD        8
  821. #define    IGMSTAT        16
  822. #define    IGLSTAT        32
  823. /*
  824.  * Old argument    values for the is...() functions
  825.  */
  826. #define    DIRECT        0
  827. #define    STATIC        1
  828.  
  829. /*
  830.  * Old function    definitions
  831.  */
  832. #define    isigalert(p)        _iswhat((p),11)
  833. #define    isigcts(p)        _iswhat((p),12)
  834. #define    isigdsr(p)        _iswhat((p),13)
  835. #define    isigcd(p)        _iswhat((p),14)
  836. #define    isigmstat(p)        _iswhat((p),15)
  837. #define    isiglstat(p)        _iswhat((p),16)
  838.  
  839. /*
  840.  * The old Hayes Modem function    names
  841.  */
  842. #define    hmreset        HMReset
  843. #define    hmregset    HMSetRegister
  844. #define    hmringnum   HMSetAutoAnswerRingCount
  845. #define    hmringcnt   HMGetIncomingRingCount
  846. #define    hmescset    HMSetEscapeCode
  847. #define    hms3set        HMSetEndOfLineCharacter
  848. #define    hms4set        HMSetLineFeedCharacter
  849. #define    hms5set        HMSetBackspaceCharacter
  850. #define    hmdialset   HMSetWaitForDialToneTime
  851. #define    hmcarrset   HMSetWaitTimeForCarrier
  852. #define    hmcomaset   HMSetPauseTimeForComma
  853. #define    hmcarrec    HMSetCDResponseTime
  854. #define    hmcarrdisc  HMSetCarrierDisconnectTime
  855. #define    hmdialrate  HMSetTouchToneDuration
  856. #define    hmescguard  HMSetEscapeCodeGuardTime
  857. #define    hmuart        HMGetUARTStatus
  858. #define    hmoption    HMGetOptionRegister
  859. #define    hmflags        HMGetFlagRegister
  860. #define    hmonline    HMGoOnline
  861. #define    hmdialmode  HMSetDialingMethod
  862. #define    hmdial        HMDial
  863. #define    hmrepeat    HMRepeatLastCommand
  864. #define    hmreverse   HMDialInAnswerMode
  865. #define    hmanswer    HMAnswer
  866. #define    hmcarron    HMSetCarrier
  867. #define    hmecho        HMSetEchoMode
  868. #define    hmduplex    HMSetFullDuplexMode
  869. #define    hmhook        HMSetHookSwitch
  870. #define    hmspeak        HMSetSpeaker
  871. #define    hmquiet        HMReturnNoResultCodes
  872. #define    hmextend    HMSelectExtendedResultCodes
  873. #define    hmverbose   HMSetVerboseMode
  874. #define    hmstr        HMSendString
  875. #define    hmregread   HMGetRegister
  876.