www.pudn.com > rs232 > RCOMM.H


/*============================================================================*/ 
/*   RCOMM.H  -  Serial (RS232) Communication Support. (c) RocSoft, 1997.     */ 
/*============================================================================*/ 
 
#ifndef __RCOMM__ 
#define __RCOMM__ 
 
typedef enum tagCOM_PORT 
{ 
        CP_COM1=0, 
        CP_COM2=1, 
        CP_COM3=2, 
        CP_COM4=3 
} COM_PORT; 
 
typedef enum tagCOM_DATA_BITS 
{ 
        CDB_8_BITS=0x03, 
        CDB_7_BITS=0x02 
} COM_DATA_BITS; 
 
typedef enum tagCOM_STOP_BITS 
{ 
        CSB_1_BIT=0x00, 
        CSB_2_BIT=0x04 
} COM_STOP_BITS; 
 
typedef enum tagCOM_PARITY 
{ 
        CP_NO_PARITY    =0x00, 
        CP_EVEN_PARITY  =0x18, 
        CP_ODD_PARITY   =0x08 
} COM_PARITY; 
 
typedef enum tagCOM_STATUS 
{ 
        CS_DCD          =0x8000, 
        CS_RI           =0x4000, 
        CS_DSR          =0x2000, 
        CS_CTS          =0x1000, 
        CS_DELTA_DCD    =0x0800, 
        CS_DELTA_RI     =0x0400, 
        CS_DELTA_DSR    =0x0200, 
        CS_DELTA_CTS    =0x0100, 
        CS_RESERVED     =0x0080, 
        CS_TX_EMPTY     =0x0040, 
        CS_TX_READY     =0x0020, 
        CS_BREAK        =0x0010, 
        CS_FRAME_ERROR  =0x0008, 
        CS_PARITY_ERROR =0x0004, 
        CS_OVERRUN      =0x0002, 
        CS_RX_READY     =0x0001 
} COM_STATUS; 
 
#ifdef __cplusplus 
extern "C" { 
#endif 
 
BOOL            COM_Open ( COM_PORT cpPort,unsigned long nBaud,COM_DATA_BITS cdbBits,COM_STOP_BITS csbStop,COM_PARITY cbParity,int nBuffSize ); 
BOOL            COM_Close( COM_PORT cpPort ); 
BOOL            COM_Flush( COM_PORT cpPort,BOOL bFlushInput,BOOL bFlushOutput ); 
int             COM_Write( COM_PORT cpPort,void *pBuffer,int nCount ); 
int             COM_Read ( COM_PORT cpPort,void *pBuffer,int nCount ); 
BOOL            COM_IOCtrl( COM_PORT cpPort,BOOL bAssertRTS, BOOL bAssertDTR ); 
int             COM_InQueue( COM_PORT cpPort ); 
int             COM_OutQueue( COM_PORT cpPort ); 
COM_STATUS      COM_Status( COM_PORT cpPort ); 
 
#ifdef __cplusplus 
}; 
#endif 
 
#endif 
 
/*============================================================================*/