|
1 // Copyright (c) 1997-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 @internalComponent |
|
19 */ |
|
20 |
|
21 #if !defined(__IR_CONST_H__) |
|
22 #define __IR_CONST_H__ |
|
23 |
|
24 #include <es_prot.h> |
|
25 #include <d32comm.h> |
|
26 #include "es_prot_internal.h" |
|
27 |
|
28 |
|
29 // P&S key used to disable sending of discovery responses. |
|
30 const TUint KIrdaDiscoveryResponseSuppressor = 0x1028279f; |
|
31 |
|
32 // Enum used for Discovery Response Suppressor key |
|
33 enum TDiscoveryResponseSuppressorStatus |
|
34 { |
|
35 EAllowDiscoveryResponses, |
|
36 ESuppressDiscoveryResponses, |
|
37 }; |
|
38 |
|
39 //#define _MKLOG |
|
40 //#define __TRACEWIN__ // For tracewin logging window |
|
41 |
|
42 //#################### PRT CONSTANTS ########################### |
|
43 |
|
44 const TUint KIrdaMinHeapSize=0x0400; |
|
45 const TUint KIrdaMaxHeapSize=0x4000; |
|
46 const TUint KIrdaSenderPriority=ECommTransmitPriority; |
|
47 const TUint KIrdaReceiverPriority=ECommReceivePriority; |
|
48 |
|
49 const TUint32 KIrdaAddrNone=0x00000000; |
|
50 // Version numbers for IrDA |
|
51 const TUint KIrdaMajor=1; // For major ROM releases |
|
52 const TUint KIrdaMinor=0; // For minor ROM releases |
|
53 const TUint KIrdaBuild=205; // This is the overall Version number |
|
54 |
|
55 const TUint KIrdaDatagramServiceInfo= |
|
56 KSIReliable|KSIDatagram|KSIGracefulClose|KSIUrgentData|KSIBroadcast|KSIQOS|KSIConnectData; |
|
57 |
|
58 const TUint8 KDefaultDiscoverySlots=6; |
|
59 const TUint8 KDefaultTinyTPCredit=4; |
|
60 |
|
61 const TUint KIrdaDefaultSendBufSize=64; |
|
62 const TUint KIrdaDefaultRecvBufSize=64; |
|
63 /* This is the amount of heap space we alloc for irSender and irReceiver |
|
64 frames WITHOUT allowing for the extra space required for byte stuffing */ |
|
65 /********* Frame sizes - INCLUDES the size of the FCS field ********/ |
|
66 const TUint KDiscoveryCMDFrameSize=16; /* A+C+1+4+4+1+1+1+FCS */ |
|
67 const TUint KEndOfDiscoveryCMDFrameSize=19; /* A+C+1+4+4+1+1+1+3+FCS */ |
|
68 const TUint KDiscoveryRSPFrameSize=19; /* A+C+1+4+4+1+1+1+3+FCS */ |
|
69 const TUint KTESTFrameSize=36; /* A+C+4+4+24+FCS */ |
|
70 const TUint KSNRMFrameSize=34; /* A+C+4+4+1+21+FCS */ |
|
71 const TUint KFRMRFrameSize=7; /* A+C+1+1+1+FCS */ |
|
72 const TUint KDISCFrameSize=4; /* A+C+FCS */ |
|
73 const TUint KUAfromDISCFrameSize=12; /* A+C+4+4+FCS */ |
|
74 const TUint KUAfromSNRMFrameSize=33; /* A+C+4+4+21+FCS */ |
|
75 |
|
76 // |
|
77 const TUint KDMFrameSize=4; /* A+C+FCS & no info field */ |
|
78 const TUint KRRFrameSize=4; /* A+C+FCS */ |
|
79 const TUint KREJFrameSize=4; /* A+C+FCS */ |
|
80 const TUint KRDFrameSize=4; /* A+C+FCS */ |
|
81 const TUint KRNRMFrameSize=4; /* A+C+FCS */ |
|
82 const TUint KRNRFrameSize=4; /* A+C+FCS */ |
|
83 const TUint16 KInitFCS=0xffff; /* Initial FCS value for CRC */ |
|
84 const TUint16 KGoodFCS=0xf0b8; /* Good final FCS value for CRC */ |
|
85 |
|
86 /************************** Timeouts ****************************/ |
|
87 const TUint KSlotTimeout=110; /* 60ms */ |
|
88 const TUint KMediaBusyTimeout=500; /* 500ms */ |
|
89 const TUint KIrmuxTimeout=2000; /* 2 secs */ |
|
90 const TUint KIrmuxSAPTimeout=2000; /* 2 secs */ |
|
91 const TUint KIrmuxMonitorTimeout=2000; /* 2 secs */ |
|
92 const TUint KMilliSecondFactor=1000; /* ms to microsec */ |
|
93 |
|
94 /********* Frame destroy defines - immediate or delayed? ********/ |
|
95 const TUint KDataFrame=1; |
|
96 const TUint KConnectingAsPrimary=1; /* Trying to change baud up */ |
|
97 const TUint KConnectingAsSecondary=2; |
|
98 const TUint KDisconnecting=3; /* Trying to change baud down */ |
|
99 const TUint KDisconnectOnTimeout=4; /* Timed out */ |
|
100 |
|
101 /***************** IRLAP DEVICE ADDRESS CONSTANTS ****************/ |
|
102 const TUint8 KEOFMask=0xc1; /* End of frame char */ |
|
103 const TUint8 KBOFMask=0xc0; /* Start of frame char */ |
|
104 const TUint8 KAdditionalBOFMask=0xff; /* Additional BOF=0xff */ |
|
105 const TUint8 KESCMask=0x7d; /* Byte stuff char mask */ |
|
106 const TUint8 KByteStuffMask=0x20; /* Byte stuff:OR with this */ |
|
107 |
|
108 /*************** IRLAP DEVICE ADDRESS CONSTANTS ********************/ |
|
109 const TUint KBroadcastDevAddrMask=0xffffffff; |
|
110 const TUint KNullDevAddrMask=0x00000000; |
|
111 const TUint KDevAddrLength=4; |
|
112 |
|
113 /*************** IRLAP ADDRESS FIELD CONSTANTS *********************/ |
|
114 const TUint KAddressFieldOffset=0; |
|
115 const TUint8 KCRMask=0x01; /* 00000001 - mask in the C/R bit */ |
|
116 const TUint8 KConnAddrMask=0xfe; /* 11111110 - mask off C/R bit */ |
|
117 const TUint8 KBroadcastConnAddrMask=0xfe; /* 11111110 - broadcast connAddr */ |
|
118 const TUint8 KNullConnAddrMask=0x00; /* 00000000 - null connAddr */ |
|
119 const TUint8 KMaxConnAddrMask=0x7f; /* 01111111 - need to shl this by 1 */ |
|
120 |
|
121 /*************** IRLAP CONTROL FIELD CONSTANTS *********************/ |
|
122 const TUint8 KControlFieldOffset=1; /* offset into IrLap frame */ |
|
123 const TUint8 KFrameTypeMask=0x03; /* 00000011 - only the last two bits */ |
|
124 const TUint8 KInfoFrameControlMask=0x13; /* 00010011 - just last 2 bits and P/F */ |
|
125 const TUint8 KPFMask=0x10; /* 00010000 - to get just the P/F bit */ |
|
126 |
|
127 /* IrLAP UNNUMBERED Field Values */ |
|
128 const TUint8 KUnnumberedFrameTypeMask=0x03; /* 00000011 */ |
|
129 const TUint8 KUnnumberedFrameMask=0x03; /* 00000011 - U frame has 11 as last 2 bits */ |
|
130 const TUint8 KUnnumberedPFrameMask=0x13; /* 00010011 - captures P/F bit too */ |
|
131 const TUint8 KUnnumberedNotPFrameMask=0x03; /* 00000011 - captures P/F bit too */ |
|
132 const TUint8 KUnnumberedFFrameMask=0x13; /* 00010011 - captures P/F bit too */ |
|
133 const TUint8 KUnnumberedNotFFrameMask=0x03; /* 00000011 - captures P/F bit too */ |
|
134 |
|
135 /* Sent by primary as CMD frames to a secondary */ |
|
136 const TUint8 KSNRMPMask=0x93; /* 10010011 */ |
|
137 const TUint8 KSNRMNotPMask=0x83; /* 10000011 */ |
|
138 const TUint8 KDISCPMask=0x53; /* 01010011 */ |
|
139 const TUint8 KDISCNotPMask=0x43; /* 01000011 */ |
|
140 const TUint8 KUIPMask=0x13; /* 00010011 */ |
|
141 const TUint8 KUINotPMask=0x03; /* 00000011 */ |
|
142 const TUint8 KXIDPMask=0x3f; /* 00111111 */ |
|
143 const TUint8 KXIDNotPMask=0x2f; /* 00101111 */ |
|
144 const TUint8 KTESTPMask=0xf3; /* 11110011 */ |
|
145 |
|
146 /* Sent by secondary as RSP frames to a primary */ |
|
147 const TUint8 KRNRMFMask=0x93; /* 10010011 */ |
|
148 const TUint8 KRNRMNotFMask=0x83; /* 10000011 */ |
|
149 const TUint8 KUAFMask=0x73; /* 01110011 */ |
|
150 const TUint8 KUANotFMask=0x63; /* 01100011 */ |
|
151 const TUint8 KFRMRFMask=0x97; /* 10010111 */ |
|
152 const TUint8 KFRMRNotFMask=0x87; /* 10000111 */ |
|
153 const TUint8 KDMFMask=0x1f; /* 00011111 */ |
|
154 const TUint8 KDMNotFMask=0x0f; /* 00001111 */ |
|
155 const TUint8 KRDFMask=0x53; /* 01010011 */ |
|
156 const TUint8 KRD_NOTF=0x43; /* 01000011 */ |
|
157 const TUint8 KUIFMask=0x13; /* 00010011 */ |
|
158 const TUint8 KUINotFMask=0x03; /* 00000011 */ |
|
159 const TUint8 KXIDFMask=0xbf; /* 10111111 */ |
|
160 const TUint8 KXIDNotFMask=0xaf; /* 10101111 */ |
|
161 const TUint8 KTESTFMask=0xf3; /* 11110011 */ |
|
162 |
|
163 /* XID frame masks and field offsets */ |
|
164 const TUint8 KFormatFieldOffset=2; |
|
165 const TUint8 KDiscoveryFormatMask=0x01; /* 00000001 */ |
|
166 const TUint8 KNegotiationFormatMask=0x02; /* 00000010 */ |
|
167 /* For format field value 0x01 => DISCOVERY XID */ |
|
168 const TUint8 KMaxSlotsBitsMask=0x03; |
|
169 const TUint8 KAddressConflictBitMask=0x04; /* 00000100 in discovery flags byte */ |
|
170 const TUint KSourceDevAddrFieldOffset=3; |
|
171 const TUint KDestDevAddrFieldOffset=7; |
|
172 const TUint KDiscoveryFlagsFieldOffset=11; |
|
173 const TUint KSlotNumberFieldOffset=12; |
|
174 const TUint8 KIrlapVersionFieldOffset=13; |
|
175 const TUint8 KIrlapVersion=0x00; |
|
176 const TUint KDiscoveryDeviceInfoFieldOffset=14; |
|
177 const TUint KFirstServiceHintByteOffset=14; |
|
178 const TUint8 KServiceHintsExtensionMask=0x80; |
|
179 const TUint KSecondServiceHintByteOffset=15; |
|
180 const TUint KCharacterSetFieldOffset=16; |
|
181 const TUint8 KASCIIMask=0x00; /* 8086 ASCII */ |
|
182 const TUint8 KUnicodeMask=0xff; |
|
183 const TUint KNicknameFieldOffset=17; |
|
184 const TInt KDiscoveryNicknameLength=20; |
|
185 const TUint KDiscoveryDeviceInfoLength=27; |
|
186 const TUint KNDMAdditionalBOFs=10; |
|
187 const TUint KNDMMinimumTurnaroundTime=0; /* 0 ms */ |
|
188 |
|
189 /* Various negotiation constants */ |
|
190 const TUint KNegotiationLength=21; |
|
191 const TUint KMaxNumberOfNegotiables=7; |
|
192 const TUint8 KBaudRateTuple=0x01; |
|
193 const TUint8 KBaudRateLengthTuple=1; |
|
194 const TUint8 KMaxTATimeTuple=0x82; |
|
195 const TUint8 KMaxTATimeLengthTuple=1; |
|
196 const TUint8 KMaxDataSizeTuple=0x83; |
|
197 const TUint8 KMaxDataSizeLengthTuple=1; |
|
198 const TUint8 KMaxWindowSizeTuple=0x84; |
|
199 const TUint8 KMaxWindowSizeLengthTuple=1; |
|
200 const TUint8 KNumberBofsTuple=0x85; |
|
201 const TUint8 KNumberBofsLengthTuple=1; |
|
202 const TUint8 KMinTATimeTuple=0x86; |
|
203 const TUint8 KMinTATimeLengthTuple=1; |
|
204 const TUint8 KLinkDisconnTuple=0x08; |
|
205 const TUint8 KLinkDisconnLengthTuple=1; |
|
206 /* Default negotiation parameters */ |
|
207 const TBps KDefaultBaudRate=EBps9600; |
|
208 const TUint KDefaultMaxHostTATime=500; |
|
209 const TUint KDefaultMaxHostDataSize=64; |
|
210 const TUint KDefaultReceiveWindow=1; |
|
211 const TUint KDefaultAdditionalBofs=0; |
|
212 const TUint KDefaultMinTATime=10; |
|
213 const TUint KDefaultLinkDisconnTime=3; |
|
214 const TUint KDefaultSubMsTATime=1; // Submillisecond time defaults to 1ms |
|
215 const TUint KDefaultSupportedBaudRates=2; |
|
216 /* Actual host supported negotiation parameters */ |
|
217 const TBps KMaxSupportedBaudRate=EBps115200; |
|
218 const TUint16 KMaxSupportedBaudRates=0x003F; // All rates supported upto 115200bps |
|
219 const TUint KMinSupportedMaxTATime=500; |
|
220 const TUint KMaxSupportedMaxHostDataSize=2048; |
|
221 const TUint KMaxReceiveWindow=7; |
|
222 const TUint KMaxAdditionalBofs=48; |
|
223 const TUint KMinTATime=0; |
|
224 const TUint KSupportedLinkDisconnTime=40; |
|
225 |
|
226 /* SNRM frame masks and field offsets */ |
|
227 const TUint KSNRMSourceDevAddrFieldOffset=2; |
|
228 const TUint KSNRMDestDevAddrFieldOffset=6; |
|
229 const TUint KSNRMProposedConnAddrFieldOffset=10; |
|
230 const TUint KSNRMNegotiationFieldOffset=11; |
|
231 |
|
232 /* UA frame masks and field offsets */ |
|
233 const TUint KUASourceDevAddrFieldOffset=2; |
|
234 const TUint KUADestDevAddrFieldOffset=6; |
|
235 const TUint KUANegotiationFieldOffset=10; |
|
236 const TBool KfromDISC=EFalse; |
|
237 const TBool KfromSNRM=ETrue; |
|
238 const TBool KFullSNRM=ETrue; |
|
239 const TBool KResetSNRM=EFalse; |
|
240 |
|
241 /* FRMR frame masks and field offsets */ |
|
242 const TUint KFRMRFirstInfoFieldByteOffset=2; /* Rejected C Field */ |
|
243 const TUint KFRMRSecondInfoFieldByteOffset=3; /* Frame fields */ |
|
244 const TUint KFRMRThirdInfoFieldByteOffset=4; /* FRMR reason */ |
|
245 |
|
246 /* TEST frame masks and field offsets */ |
|
247 const TUint KTESTSourceDevAddrFieldOffset=2; |
|
248 const TUint KTESTDestDevAddrFieldOffset=6; |
|
249 const TUint KTESTDataFieldOffset=10; |
|
250 const TUint KTESTConnDataFieldOffset=2; |
|
251 const TUint KTESTInfoFieldLength=24; |
|
252 #define KTESTFrameBanner _S(" Protea IrDA TEST Frame ") |
|
253 |
|
254 /* IrLAP Supervisory Frame values */ |
|
255 const TUint8 KSupervisoryFrameTypeMask=0x01; /* 00000001 */ |
|
256 const TUint8 KSupervisoryFrameControlMask=0x1f; /* 00011111 */ |
|
257 const TUint8 KRRPMask=0x11; /* 00010001 */ |
|
258 const TUint8 KRRFMask=0x11; /* 00010001 */ |
|
259 const TUint8 KRNRPMask=0x15; /* 00010101 */ |
|
260 const TUint8 KRNRFMask=0x15; /* 00010101 */ |
|
261 const TUint8 KREJPMask=0x19; /* 00011001 */ |
|
262 const TUint8 KREJFMask=0x19; /* 00011001 */ |
|
263 const TUint8 KSREJPMask=0x1d; /* 00011101 */ |
|
264 const TUint8 KSREJFMask=0x1d; /* 00011101 */ |
|
265 |
|
266 /* IrLAP Information Frame values */ |
|
267 const TUint8 KInfo1FrameTypeMask=0x00; /* 00000000 */ |
|
268 const TUint8 KInfo2FrameTypeMask=0x02; /* 00000010 */ |
|
269 const TUint8 KInfoFrameMask=0x01; /* 00000001 */ |
|
270 const TUint8 KInfo1PMask=0x10; /* 00010000 */ |
|
271 const TUint8 KInfo1FMask=0x10; |
|
272 const TUint8 KInfo2PMask=0x12; /* 00010010 */ |
|
273 const TUint8 KInfo2FMask=0x12; |
|
274 const TUint8 KInfo1NotPMask=0x00; /* 00000000 */ |
|
275 const TUint8 KInfo1NotFMask=0x00; |
|
276 const TUint8 KInfo2NotPMask=0x02; /* 00000010 */ |
|
277 const TUint8 KInfo2NotFMask=0x02; |
|
278 const TUint8 KNsMask=0x0e; /* 00001110 */ |
|
279 const TUint8 KNrMask=0xe0; /* 11100000 */ |
|
280 |
|
281 const TUint KHighWaterMark=8; |
|
282 const TUint KLowWaterMark=3; |
|
283 |
|
284 /******************** IRMUX ADDRESS CONSTANTS **********************/ |
|
285 const TUint KIrmuxConnectMinFrameSize=8; /* A+C+D+S+op+rsvd+...+FCS */ |
|
286 const TUint KIASConnectFrameSize=8; /* A+C+D+S+op+rsvd+FCS */ |
|
287 const TUint KIASQueryFrameSize=66; /* A+C+D+S+..60..+FCS */ |
|
288 const TUint KIASGetValueByClassMinFrameSize=7; /* A+C+D+S+op+ret+...+FCS */ |
|
289 const TUint KIrmuxDisconnectFrameSize=8; /* A+C+D+S+op+rsvd+FCS */ |
|
290 const TUint KIrmuxAccessModeFrameSize=9; /* A+C+D+S+op+stat+mode+FCS */ |
|
291 |
|
292 const TUint8 KLSAP_SELMask=0x7f; |
|
293 const TUint KMaxLSAP = 0x6f; |
|
294 const TUint KMinLSAP = 0x01; |
|
295 const TUint8 KIrmuxControlFrameMask=0x80; |
|
296 const TUint KIrmuxDLSAP_SELFieldOffset=0; |
|
297 const TUint KIrmuxSLSAP_SELFieldOffset=1; |
|
298 const TUint KIrmuxOpcodeFieldOffset=2; |
|
299 const TUint KIrmuxParametersFieldOffset=3; |
|
300 const TUint8 KIrmuxReservedParametersMask=0x00; |
|
301 const TUint KIrmuxControlFrameDataFieldOffset=4; |
|
302 const TUint KIrmuxControlFrameDataFieldLength=60; |
|
303 |
|
304 const TUint KModeStatusFieldOffset=3; |
|
305 const TUint8 KModeStatusSuccessMask=0x00; |
|
306 const TUint8 KModeStatusFailureMask=0x01; |
|
307 const TUint8 KModeStatusUnsupportedMask=0xff; |
|
308 const TUint KModeFieldOffset=4; |
|
309 const TUint8 KMultiplexModeMask=0x00; |
|
310 const TUint8 KExclusiveModeMask=0x01; |
|
311 |
|
312 const TUint8 KIrmuxConnectRequestMask=0x01; /* 00000001 */ |
|
313 const TUint8 KIrmuxConnectConfirmMask=0x81; /* 10000001 */ |
|
314 const TUint8 KIrmuxDisconnectMask=0x02; /* 00000010 */ |
|
315 const TUint8 KIrmuxAccessModeRequestMask=0x03; /* 00000011 */ |
|
316 const TUint8 KIrmuxAccessModeConfirmMask=0x83; /* 10000011 */ |
|
317 |
|
318 const TUint KHoldoffMark=5; |
|
319 |
|
320 const TUint KIASControlFieldOffset=4; |
|
321 const TUint KIASResultsFieldOffset=5; |
|
322 const TUint8 KIASLstMask=0x80; |
|
323 const TUint8 KIASAckMask=0x40; |
|
324 const TUint8 KIASOpcodeMask=0x3f; |
|
325 |
|
326 /****************** IR TINY TP ADDRESS CONSTANTS *******************/ |
|
327 const TUint8 KTPParameterMask=0x80; /* 10000000 */ |
|
328 const TUint8 KTPDeltaCreditMask=0x7f; /* 01111111 */ |
|
329 const TUint8 KTinyTPInitialCreditPosition=0x06; //This is offset from start of TinyTP Connect Frame |
|
330 const TUint KIrdaMaxTPBufferSize=8192; //This is used to calculate the initial credit value |
|
331 const TUint8 KTPMaxSduSizePIMask=0x01; |
|
332 |
|
333 const TUint8 KIrmuxSapFrameOverhead = 0x02; |
|
334 const TUint8 KTinyTPSapFrameOverhead = 0x03; |
|
335 |
|
336 const TUint KMaxIrdaMinTABofSize = 115; |
|
337 const TUint KMaxIrdaRawFrameSize = 4154;// 0x103A |
|
338 const TUint KMaxIrdaProcessedFrameSize = 2052;// 0x0804 |
|
339 |
|
340 #endif // __IR_CONST_H__ |