epoc32/include/libc/sys/serial.h
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
child 4 837f303aceeb
equal deleted inserted replaced
1:666f914201fb 2:2fe1408b6811
     1 serial.h
     1 // Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 
       
    17 
       
    18 /**
       
    19  @file
       
    20  @publishedAll
       
    21  @released
       
    22 */
       
    23 
       
    24 #ifndef _SYS_SERIAL_H_
       
    25 #define _SYS_SERIAL_H_
       
    26 
       
    27 #ifdef __cplusplus
       
    28 extern "C" {
       
    29 #endif
       
    30 /**
       
    31 notifications
       
    32 */
       
    33 #define	KNotifyBreakInt				0x01
       
    34 #define	KNotifyCD					0x02
       
    35 #define	KNotifyCTS					0x04
       
    36 #define	KNotifyDataAvailable		0x08
       
    37 #define	KNotifyDSR					0x10
       
    38 #define	KNotifyFramingError			0x20
       
    39 #define	KNotifyOutputEmpty			0x40
       
    40 #define	KNotifyOverrunError			0x80
       
    41 #define	KNotifyParityError			0x100
       
    42 #define	KNotifyRI					0x200
       
    43 
       
    44 /**
       
    45 enums, #defines and struct for serial port settings
       
    46 */
       
    47 enum DataBits {DBits5,DBits6,DBits7,DBits8};
       
    48 
       
    49 enum StopBits {Stop1,Stop2};
       
    50 
       
    51 enum Parity {ParityNone,ParityEven,ParityOdd,ParityMark,ParitySpace};
       
    52 
       
    53 enum Bps
       
    54 	{
       
    55 	Bps50,Bps75,Bps110,Bps134,Bps150,Bps300,Bps600,Bps1200,
       
    56 	Bps1800,Bps2000,Bps2400,Bps3600,Bps4800,Bps7200,Bps9600,
       
    57 	Bps19200,Bps38400,Bps57600,Bps115200,Bps230400,Bps460800,
       
    58 	Bps576000,Bps1152000,Bps4000000,
       
    59 	BpsSpecial=0x80000000
       
    60 	};
       
    61 
       
    62 enum Fifo {FifoEnable,FifoDisable};
       
    63 
       
    64 enum Sir {SIREnable,SIRDisable};
       
    65 //
       
    66 #define ConfigMaxTerminators 4
       
    67 //
       
    68 #define ConfigObeyXoff 0x01
       
    69 #define ConfigSendXoff 0x02
       
    70 #define ConfigObeyCTS 0x04
       
    71 #define ConfigFailCTS 0x08
       
    72 #define ConfigObeyDSR 0x10
       
    73 #define ConfigFailDSR 0x20
       
    74 #define ConfigObeyDCD 0x40
       
    75 #define ConfigFailDCD 0x80
       
    76 #define ConfigFreeRTS 0x100
       
    77 #define ConfigFreeDTR 0x200
       
    78 #define ConfigWriteBufferedComplete 0x80000000
       
    79 //
       
    80 #define ConfigParityErrorFail 0
       
    81 #define ConfigParityErrorIgnore 0x01
       
    82 #define ConfigParityErrorReplaceChar 0x02
       
    83 #define ConfigXonXoffDebug 0x80000000
       
    84 //
       
    85 #define SignalCTS 0x01
       
    86 #define SignalDSR 0x02
       
    87 #define SignalDCD 0x04
       
    88 #define SignalRNG 0x08
       
    89 #define SignalRTS 0x10
       
    90 #define SignalDTR 0x20
       
    91 
       
    92 #define ConfigSIRPulseWidthMaximum 0x01
       
    93 #define ConfigSIRPulseWidthMinimum 0x02
       
    94 //
       
    95 
       
    96 typedef struct
       
    97 	{
       
    98 	enum Bps iRate;
       
    99 	enum DataBits iDataBits;
       
   100 	enum StopBits iStopBits;
       
   101 	enum Parity iParity;
       
   102 	unsigned int iHandshake;
       
   103 	unsigned int iParityError;
       
   104 	unsigned int iFifo;
       
   105 	int iSpecialRate;
       
   106 	int iTerminatorCount;
       
   107 	char iTerminator[ConfigMaxTerminators];
       
   108 	char iXonChar;
       
   109 	char iXoffChar;
       
   110 	char iParityErrorChar;
       
   111 	enum Sir iSIREnable;
       
   112 	unsigned int iSIRSettings;
       
   113 	} SerialConfig;
       
   114 
       
   115 #ifdef __cplusplus
       
   116 }
       
   117 #endif
       
   118 
       
   119 #endif