home *** CD-ROM | disk | FTP | other *** search
- /*
- #### # # # #
- # # # # # The FreeWare C library for
- # # ## ### # # # # ### RISC OS machines
- # # # # # # # # # # # ___________________________________
- # # #### ### ## # # # #
- # # # # # # # # # # Please refer to the accompanying
- #### ### #### # # ##### # ### documentation for conditions of use
- ________________________________________________________________________
-
- File: Serial.h
- Author: Copyright © 1993 Jason Howat
- Version: 1.10 (12 Dec 1993)
- Purpose: Serial-SWI interfaces.
- */
-
-
- #ifndef __dl_serial_h
- #define __dl_serial_h
-
- #ifndef __dl_core_h
- #include "Core.h"
- #endif
-
-
- /* The serial_rate enumeration defines the values to be used when
- * reading/setting baud rates with Serial_Get?xRate/Serial_Set?xRate.
- */
- typedef enum
- {
- serial_9600BAUD = 0,
- serial_75BAUD,
- serial_150BAUD,
- serial_300BAUD,
- serial_1200BAUD,
- serial_2400BAUD,
- serial_4800BAUD,
- /*serial_9600BAUD,*/
- serial_19200BAUD = 8,
- serial_50BAUD,
- serial_110BAUD,
- serial_134_5BAUD,
- serial_600BAUD,
- serial_1800BAUD,
- serial_3600BAUD,
- serial_7200BAUD
- } serial_rate;
-
-
- /* The following #defines describe the meaning of the bits in the word used
- * by Serial_GetStatust/Serial_SetStatus.
- */
- #define serial_USEXONXOFF 0x00000001
- #define serial_IGNOREDCDBIT 0x00000002
- #define serial_IGNOREDSRBIT 0x00000004
- #define serial_DTROFF 0x00000008
- #define serial_IGNORECTSBIT 0x00000010
- #define serial_DONTUSERTSFLOWCONTROL 0x00000020
- #define serial_SUPPRESSINPUT 0x00000040
- #define serial_RTSHIGH 0x00000080
- #define serial_XOFFRECEIVED 0x00010000
- #define serial_XOFFSENT 0x00020000
- #define serial_DCDHIGH 0x00040000
- #define serial_NOCARRIER 0x00040000
- #define serial_DSRHIGH 0x00080000
- #define serial_RIHIGH 0x00100000
- #define serial_CTSHIGH 0x00200000
- #define serial_XOFFSENTMANUALLY 0x00400000
- #define serial_SPACEINRECEIVEBUFFER 0x00800000
-
-
- /* The following #defines describe the meaning of the bits in the word used
- * by Serial_GetFormat/Serial_SetFormat.
- */
- #define serial_8BITWORD 0x00000000
- #define serial_7BITWORD 0x00000001
- #define serial_6BITWORD 0x00000002
- #define serial_5BITWORD 0x00000003
- #define serial_1STOPBIT 0x00000000
- #define serial_2STOPBITS 0x00000004
- #define serial_NOPARITY 0x00000000
- #define serial_PARITY 0x00000008
- #define serial_ODDPARITY 0x00000000
- #define serial_EVENPARITY 0x00000010
- #define serial_MARKPARITY 0x00000020
- #define serial_SPACEPARITY 0x00000030
-
-
- /* Serial_Activate ---------------------------------------------------------
- * This function simply does an OS_Byte 2,2 to enable the serial drivers.
- */
- extern os_error *Serial_Activate(void);
-
-
- /* Serial_Deactivate -------------------------------------------------------
- * This function simply does an OS_Byte 2,0 to disable the serial drivers.
- */
- extern os_error *Serial_Deactivate(void);
-
-
- /* Serial_GetStatus --------------------------------------------------------
- * This function returns the current status of the serial port as given by
- * OS_SerialOp 0.
- */
- extern int Serial_GetStatus(void);
-
-
- /* Serial_SetStatus --------------------------------------------------------
- * This function sets the current state of the serial port as given by
- * OS_SerialOp 0.
- */
- extern os_error *Serial_SetStatus(int eor_mask, int and_mask);
-
-
- /* Serial_GetFormat --------------------------------------------------------
- * This function returns the current format used for transmission/reception
- * of characters on the serial line.
- */
- extern int Serial_GetFormat(void);
-
-
- /* Serial_GetFormat --------------------------------------------------------
- * This function sets the format to use for transmission/reception of
- * characters on the serial line.
- */
- extern os_error *Serial_SetFormat(int format);
-
-
- /* Serial_GetTxRate/Serial_GetRxRate ---------------------------------------
- * This function returns the current speed used for transmission/reception
- * of characters on the serial line.
- */
- extern serial_rate Serial_GetTxRate(void);
- extern serial_rate Serial_GetRxRate(void);
-
-
- /* Serial_SetTxRate/Serial_SetRxRate ---------------------------------------
- * This function sets the speed to use for transmission/reception of
- * characters on the serial line.
- */
- extern os_error *Serial_SetTxRate(serial_rate rate);
- extern os_error *Serial_SetRxRate(serial_rate rate);
-
-
- /* Serial_GetByte ----------------------------------------------------------
- * Reads a byte from the serial input buffer if one is available, otherwise
- * returns -1.
- */
- extern int Serial_GetByte(void);
-
-
- /* Serial_PutByte ----------------------------------------------------------
- * Inserts a byte to be transmitted into the serial output buffer if there
- * is room. Returns TRUE if unable to send byte.
- */
- extern BOOL Serial_PutByte(int c);
-
-
- /* Serial_SendBreak --------------------------------------------------------
- * Transmits a break of the specified length.
- */
- extern os_error *Serial_SendBreak(int length);
-
-
- /* Serial_NonZeroPollWordOnReceive -----------------------------------------
- * This function installs a piece of code on the InsV vector to monitor the
- * insertion of characters into the serial input buffer. It will modify the
- * supplied pollword to the given value whenever an insertion occurs. Also,
- * an atexit function is registered to remove the vector claimant and the
- * RMA based code.
- */
- extern void Serial_NonZeroPollWordOnReceive(int pollword_value,
- void *pollword);
-
-
- #endif
-