home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / listings / v_02_04 / 2n04007a < prev    next >
Text File  |  1991-02-10  |  2KB  |  43 lines

  1. /*
  2.  *  COM.H Copyright (C) 1990 by Mark R. Nelson
  3.  *
  4.  * This header file contains the structures, constants, and function
  5.  * prototypes necessary to use the RS-232 routines in COM.C
  6.  */
  7.  
  8. /*
  9.  * This structure defines an RS-232 port.
  10.  */
  11. typedef struct {
  12.     unsigned int   address;        /* Address of the 8250                */
  13.     char           buffer[256];    /* The receive buffer.                */
  14.     unsigned char  head;           /* Offset for insertion into the buff.*/
  15.     unsigned char  tail;           /* Offset for removal from the buffer.*/
  16.     unsigned char  match;          /* The status register match value    */
  17. } PORT ;
  18.  
  19. typedef struct {
  20.     unsigned int   status_address;     /* Address of the boards status reg.  */
  21.     unsigned char  irq_mask;           /* The 8259 bits to set for this port */
  22.     unsigned char  int_number;         /* The interrupt number for this port.*/
  23.     void (interrupt far *old_vector)();/* The saved old interrupt vector.    */
  24.     PORT           *ports[4];          /* Ports for this board               */
  25.     int            port_count;         /* Number of ports currently open     */
  26. } BOARD;
  27.  
  28. BOARD  *board_open( unsigned int address, unsigned char int_number );
  29. PORT   *port_open( BOARD *board, unsigned int address, unsigned char match );
  30. void    port_set(PORT *port, long speed, char parity, int data, int stopbits);
  31. void    port_close( PORT *port );
  32. void    board_close( BOARD *board );
  33. void    port_putc( PORT *port, unsigned char c);
  34. int     port_getc( PORT *port );
  35.  
  36. #ifdef M_I86
  37. #define inportb inp
  38. #define outportb outp
  39. #define getvect _dos_getvect
  40. #define setvect _dos_setvect
  41. #endif
  42.  
  43.