home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / vol_100 / 183_01 / comsup.h < prev    next >
Text File  |  1984-06-22  |  2KB  |  60 lines

  1. /* commsupp.h     - commsupp declares and defines */
  2.  
  3. /*
  4.   init_com   - initialize comm port, interrupts, baud, data, parity, stop, buf
  5.   uninit_com - disable interrupts, flushes buffer
  6.   send_brk   - send break signal
  7.   set_xoff   - enable XON, XOFF protocol
  8.   recd_xoff  - return true if XOFF received, reset recd_xoff flag
  9.   sent_xoff  - return true if XOFF sent, reset sent_xoff flag
  10.   inp_cnt    - returns the number of unread bytes in receive buffer
  11.   inp_char   - return one byte from buffer
  12.   inp_strn   - transfer n bytes from buffer to string
  13.   outp_char  - send one byte
  14.   outp_strn  - send n bytes of a string, up to end of string
  15.   com_stat   - return line status (high byte) and modem status (low byte)
  16.   on_com     - specify a routine to execute when a byte is received
  17. */
  18.  
  19. /* declare entry points to commsupp routines */
  20.  
  21. int  init_com();   /* init_com(port,baud,parity,data,stop,buff_len); */
  22. int  uninit_com(); /* uninit_com(port,lv_open);  */
  23. int  send_brk();   /* send_brk(port);         */
  24. int  set_xoff();   /* set_xoff(port,xoff_state); */
  25. int  recd_xoff();  /* recd_xoff(port);         */
  26. int  sent_xoff();  /* sent_xoff(port);         */
  27. int  inp_cnt();    /* inp_cnt(port);         */
  28. int  inp_char();   /* inp_char(port);         */
  29. int  inp_strn();   /* inp_strn(port,&str,cnt);     */
  30. int  outp_char();  /* outp_char(port,c);     */
  31. int  outp_strn();  /* outp_strn(port,&str,cnt);  */
  32. int  com_stat();   /* com_stat(port);         */
  33. int  on_com();       /* on_com(port,routine);     */
  34.  
  35. /* define for values returned by routines */
  36. #define ERROR      -1
  37. #define TRUE      1
  38. #define FALSE      0
  39.  
  40. /* defines for parity (init_com) */
  41. #define PARITY_NONE  0
  42. #define PARITY_ODD   1
  43. #define PARITY_EVEN  2
  44. #define PARITY_MARK  3
  45. #define PARITY_SPACE 4
  46.  
  47. /* defines for comm errors - mask using com_stat value */
  48. #define OVER_RUN    0x0200
  49. #define PARITY_ERR  0x0400
  50. #define FRAME_ERR   0x0800
  51. #define BREAK_IND   0x1000
  52.  
  53. /* defines for modem conditions - mask using com_stat value */
  54. #define CLEAR_SEND  0x0010
  55. #define DATASET_RDY 0x0020
  56. #define RING_IND    0x0040
  57. #define CARRIER     0x0080
  58.  
  59. /* end of commsupp.h */
  60.