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