home *** CD-ROM | disk | FTP | other *** search
/ RISC DISC 1 / RISC_DISC_1.iso / pd_share / code / gcc / !GCC / patches / DeskLib / h / Serial < prev    next >
Encoding:
Text File  |  1994-10-03  |  5.8 KB  |  184 lines

  1. /*
  2.     ####             #    #     # #
  3.     #   #            #    #       #          The FreeWare C library for
  4.     #   #  ##   ###  #  # #     # ###             RISC OS machines
  5.     #   # #  # #     # #  #     # #  #   ___________________________________
  6.     #   # ####  ###  ##   #     # #  #
  7.     #   # #        # # #  #     # #  #    Please refer to the accompanying
  8.     ####   ### ####  #  # ##### # ###    documentation for conditions of use
  9.     ________________________________________________________________________
  10.  
  11.     File:    Serial.h
  12.     Author:  Copyright © 1993 Jason Howat
  13.     Version: 1.10 (12 Dec 1993)
  14.     Purpose: Serial-SWI interfaces.
  15. */
  16.  
  17.  
  18. #ifndef __dl_serial_h
  19. #define __dl_serial_h
  20.  
  21. #ifndef __dl_core_h
  22. #include "Core.h"
  23. #endif
  24.  
  25. #ifdef __cplusplus
  26. extern "C" {
  27. #endif
  28.  
  29. /* The serial_rate enumeration defines the values to be used when
  30.  * reading/setting baud rates with Serial_Get?xRate/Serial_Set?xRate.
  31.  */
  32. typedef enum
  33. {
  34.   serial_9600BAUD = 0,
  35.   serial_75BAUD,
  36.   serial_150BAUD,
  37.   serial_300BAUD,
  38.   serial_1200BAUD,
  39.   serial_2400BAUD,
  40.   serial_4800BAUD,
  41. /*serial_9600BAUD,*/
  42.   serial_19200BAUD = 8,
  43.   serial_50BAUD,
  44.   serial_110BAUD,
  45.   serial_134_5BAUD,
  46.   serial_600BAUD,
  47.   serial_1800BAUD,
  48.   serial_3600BAUD,
  49.   serial_7200BAUD
  50. } serial_rate;
  51.  
  52.  
  53. /* The following #defines describe the meaning of the bits in the word used
  54.  * by Serial_GetStatust/Serial_SetStatus.
  55.  */
  56. #define serial_USEXONXOFF               0x00000001
  57. #define serial_IGNOREDCDBIT             0x00000002
  58. #define serial_IGNOREDSRBIT             0x00000004
  59. #define serial_DTROFF                   0x00000008
  60. #define serial_IGNORECTSBIT             0x00000010
  61. #define serial_DONTUSERTSFLOWCONTROL    0x00000020
  62. #define serial_SUPPRESSINPUT            0x00000040
  63. #define serial_RTSHIGH                  0x00000080
  64. #define serial_XOFFRECEIVED             0x00010000
  65. #define serial_XOFFSENT                 0x00020000
  66. #define serial_DCDHIGH                  0x00040000
  67. #define serial_NOCARRIER                0x00040000
  68. #define serial_DSRHIGH                  0x00080000
  69. #define serial_RIHIGH                   0x00100000
  70. #define serial_CTSHIGH                  0x00200000
  71. #define serial_XOFFSENTMANUALLY         0x00400000
  72. #define serial_SPACEINRECEIVEBUFFER     0x00800000
  73.  
  74.  
  75. /* The following #defines describe the meaning of the bits in the word used
  76.  * by Serial_GetFormat/Serial_SetFormat.
  77.  */
  78. #define serial_8BITWORD         0x00000000
  79. #define serial_7BITWORD         0x00000001
  80. #define serial_6BITWORD         0x00000002
  81. #define serial_5BITWORD         0x00000003
  82. #define serial_1STOPBIT         0x00000000
  83. #define serial_2STOPBITS        0x00000004
  84. #define serial_NOPARITY         0x00000000
  85. #define serial_PARITY           0x00000008
  86. #define serial_ODDPARITY        0x00000000
  87. #define serial_EVENPARITY       0x00000010
  88. #define serial_MARKPARITY       0x00000020
  89. #define serial_SPACEPARITY      0x00000030
  90.  
  91.  
  92. /* Serial_Activate ---------------------------------------------------------
  93.  * This function simply does an OS_Byte 2,2 to enable the serial drivers.
  94.  */
  95. extern os_error *Serial_Activate(void);
  96.  
  97.  
  98. /* Serial_Deactivate -------------------------------------------------------
  99.  * This function simply does an OS_Byte 2,0 to disable the serial drivers.
  100.  */
  101. extern os_error *Serial_Deactivate(void);
  102.  
  103.  
  104. /* Serial_GetStatus --------------------------------------------------------
  105.  * This function returns the current status of the serial port as given by
  106.  * OS_SerialOp 0.
  107.  */
  108. extern int Serial_GetStatus(void);
  109.  
  110.  
  111. /* Serial_SetStatus --------------------------------------------------------
  112.  * This function sets the current state of the serial port as given by
  113.  * OS_SerialOp 0.
  114.  */
  115. extern os_error *Serial_SetStatus(int eor_mask, int and_mask);
  116.  
  117.  
  118. /* Serial_GetFormat --------------------------------------------------------
  119.  * This function returns the current format used for transmission/reception
  120.  * of characters on the serial line.
  121.  */
  122. extern int Serial_GetFormat(void);
  123.  
  124.  
  125. /* Serial_GetFormat --------------------------------------------------------
  126.  * This function sets the format to use for transmission/reception of
  127.  * characters on the serial line.
  128.  */
  129. extern os_error *Serial_SetFormat(int format);
  130.  
  131.  
  132. /* Serial_GetTxRate/Serial_GetRxRate ---------------------------------------
  133.  * This function returns the current speed used for transmission/reception
  134.  * of characters on the serial line.
  135.  */
  136. extern serial_rate Serial_GetTxRate(void);
  137. extern serial_rate Serial_GetRxRate(void);
  138.  
  139.  
  140. /* Serial_SetTxRate/Serial_SetRxRate ---------------------------------------
  141.  * This function sets the speed to use for transmission/reception of
  142.  * characters on the serial line.
  143.  */
  144. extern os_error *Serial_SetTxRate(serial_rate rate);
  145. extern os_error *Serial_SetRxRate(serial_rate rate);
  146.  
  147.  
  148. /* Serial_GetByte ----------------------------------------------------------
  149.  * Reads a byte from the serial input buffer if one is available, otherwise
  150.  * returns -1.
  151.  */
  152. extern int Serial_GetByte(void);
  153.  
  154.  
  155. /* Serial_PutByte ----------------------------------------------------------
  156.  * Inserts a byte to be transmitted into the serial output buffer if there
  157.  * is room.  Returns TRUE if unable to send byte.
  158.  */
  159. extern BOOL Serial_PutByte(int c);
  160.  
  161.  
  162. /* Serial_SendBreak --------------------------------------------------------
  163.  * Transmits a break of the specified length.
  164.  */
  165. extern os_error *Serial_SendBreak(int length);
  166.  
  167.  
  168. /* Serial_NonZeroPollWordOnReceive -----------------------------------------
  169.  * This function installs a piece of code on the InsV vector to monitor the
  170.  * insertion of characters into the serial input buffer.  It will modify the
  171.  * supplied pollword to the given value whenever an insertion occurs.  Also,
  172.  * an atexit function is registered to remove the vector claimant and the
  173.  * RMA based code.
  174.  */
  175. extern void Serial_NonZeroPollWordOnReceive(int pollword_value,
  176.                                             void *pollword);
  177.  
  178.  
  179. #ifdef __cplusplus
  180.            }
  181. #endif
  182.  
  183. #endif
  184.