home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / vol_300 / 330_02 / sio.h < prev    next >
C/C++ Source or Header  |  1990-10-12  |  5KB  |  116 lines

  1. /*
  2.    --- Version 2.0 90-10-12 10:34 ---
  3.  
  4.    SIO.H - CTask - Serial I/O interface routine definitions.
  5.  
  6.    Public Domain Software written by
  7.       Thomas Wagner
  8.       Ferrari electronic Gmbh
  9.       Beusselstrasse 27
  10.       D-1000 Berlin 21
  11.       Germany
  12. */
  13.  
  14. #define XON       0x11
  15. #define XOFF      0x13
  16.  
  17. /* Parity values for "v24_change_parity" */
  18.  
  19. #define PAR_NONE  0x00
  20. #define PAR_EVEN  0x18
  21. #define PAR_ODD   0x08
  22. #define PAR_MARK  0x28
  23. #define PAR_SPACE 0x38
  24.  
  25. /* Modem control bits for "v24_watch_modem" */
  26.  
  27. #define CTS       0x10
  28. #define DSR       0x20
  29. #define RI        0x40
  30. #define CD        0x80
  31.  
  32. /* Values for "v24_protocol" */
  33.  
  34. #define XONXOFF   0x01
  35. #define RTSCTS    0x02
  36.  
  37. /* Internal structures */
  38.  
  39. typedef struct s_port_data far *portptr;
  40. typedef struct s_sio_datarec far *sioptr;
  41.  
  42. typedef struct s_port_data {
  43.                            portptr     next;    /* Next defined port */
  44.                            int         pnum;    /* Internal Port ID */
  45.                            sioptr      sio;     /* SIO control block */
  46.                            int         base;    /* Port base */
  47.                            byte        irq;     /* IRQ level */
  48.                            byte        vector;  /* Interrupt vector number */
  49.                            } port_data;
  50.  
  51.  
  52. typedef struct s_sio_datarec {
  53.                sioptr   next;          /* Next link for shared IRQs */
  54.                intprocptr savvect;     /* Interrupt vector save location */
  55.                portptr  port;          /* Port descriptor pointer */
  56.                int      port_base;     /* Port base I/O address */
  57.                int      r_xoff;        /* Receive disable (XOFF sent) */
  58.                int      t_xoff;        /* Transmit disable (XOFF received) */
  59.                word     xoff_threshold; /* Pipe free threshold for XOFF */
  60.                word     xon_threshold; /* Pipe free threshold for XON */
  61.                byte     clcontrol;     /* Current line control reg */
  62.                byte     cmodcontrol;   /* Current modem control reg */
  63.                byte     irqbit;        /* IRQ-Bit for this port */
  64.                byte     civect;        /* Interrupt Vector for this port */
  65.                byte     modstat;       /* Current modem status */
  66.                byte     wait_xmit;     /* Transmit delayed */
  67.                byte     xmit_pending;  /* Transmit in progress */
  68.                byte     rtsoff;        /* RTS turned off by protocol */
  69.                byte     overrun;       /* Pipe full on receive */
  70.                byte     modem_flags;   /* Transmit enable modem flags */
  71.                byte     flags;         /* Protocol flags */
  72.  
  73.                byte     save_lcon;     /* Previous line control value */
  74.                byte     save_mcon;     /* Previous modem control value */
  75.                byte     save_inten;    /* Previous interrupt control value */
  76.                byte     save_irq;      /* Previous interrupt bit value */
  77.                byte     save_bd1;      /* Previous baud rate lower byte */
  78.                byte     save_bd2;      /* Previous baud rate upper byte */
  79.  
  80.                wpipe    rcv_pipe;      /* Received characters */
  81.                pipe     xmit_pipe;     /* Transmit pipe */
  82.  
  83.                } sio_datarec;
  84.  
  85.  
  86. /* function prototypes */
  87.  
  88. extern int Globalfunc v24_define_port (int base, byte irq, byte vector);
  89.  
  90. extern sioptr Globalfunc v24_install (int port, int init,
  91.                                       farptr rcvbuf, word rcvsize, 
  92.                                       farptr xmitbuf, word xmitsize);
  93. extern void Globalfunc v24_remove (sioptr sio, int restore);
  94. extern void Taskfunc v24_remove_all (void);
  95.  
  96. extern void Globalfunc v24_change_rts (sioptr sio, int on);
  97. extern void Globalfunc v24_change_dtr (sioptr sio, int on);
  98. extern void Globalfunc v24_change_baud (sioptr sio, long rate);
  99. extern void Globalfunc v24_change_parity (sioptr sio, int par);
  100. extern void Globalfunc v24_change_wordlength (sioptr sio, int len);
  101. extern void Globalfunc v24_change_stopbits (sioptr sio, int n);
  102. extern void Globalfunc v24_watch_modem (sioptr sio, byte flags);
  103. extern void Globalfunc v24_protocol (sioptr sio, int prot, 
  104.                                      word offthresh, word onthresh);
  105.  
  106. extern int Globalfunc v24_send (sioptr sio, byte ch, dword timeout);
  107. extern int Globalfunc v24_receive (sioptr sio, dword timeout);
  108. extern int Globalfunc v24_overrun (sioptr sio);
  109. extern int Globalfunc v24_check (sioptr sio);
  110. extern int Globalfunc v24_modem_status (sioptr sio);
  111. extern int Globalfunc v24_complete (sioptr sio);
  112. extern int Globalfunc v24_wait_complete (sioptr sio, dword timeout);
  113. extern void Globalfunc v24_flush_receive (sioptr sio);
  114. extern void Globalfunc v24_flush_transmit (sioptr sio);
  115.  
  116.