1 // |
|
2 // * Copyright 2004 Neusoft America Inc. |
|
3 // * All rights reserved. |
|
4 // * This component and the accompanying materials are made available |
|
5 // * under the terms of the Eclipse Public License v1.0 |
|
6 // * which accompanies this distribution, and is available |
|
7 // * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 // * |
|
9 // * Contributors: |
|
10 // * Keith Collins (Neusoft America Inc.) original software development and additional code and modifications. |
|
11 // * Thomas Gahagen (Neusoft America Inc.) additional code and modifications. |
|
12 // * Zhen Yuan (Neusoft America Inc.) additional code and modifications. |
|
13 // * |
|
14 // * Description: This include file contains the global definitions for the CSY. |
|
15 // |
|
16 |
|
17 // CsyGlobals.h |
|
18 |
|
19 /** @file CsyGlobals.h |
|
20 * |
|
21 */ |
|
22 |
|
23 #ifndef _CSYGLOBALS_H_ |
|
24 #define _CSYGLOBALS_H_ |
|
25 |
|
26 #include <e32std.h> |
|
27 |
|
28 |
|
29 #if defined DSAMPLE || defined P2SAMPLE || defined H2 |
|
30 #define _27010ADVANCEOPTION |
|
31 _LIT8(KATInitialised,"AT-Command Interpreter ready"); |
|
32 _LIT8(KATCmdSetup,"ATE0Q0V1%CPRI=0\r"); // echo off, quiet off, verbose on |
|
33 #else |
|
34 _LIT8(KATInitialised,"OK"); |
|
35 _LIT8(KATCmdSetup,"ATE0Q0V1\r"); // echo off, quiet off, verbose on |
|
36 #endif |
|
37 |
|
38 |
|
39 // CSY name |
|
40 _LIT(KCSY_Gsm0710ServerName, "CSY27010"); |
|
41 _LIT(KCSY_Description, "Csy27010::CSY"); |
|
42 |
|
43 // Version information. |
|
44 const TUint KCSY_Gsm0710MajorVersionNumber = 1; |
|
45 const TUint KCSY_Gsm0710MinorVersionNumber = 0; |
|
46 const TUint KCSY_Gsm0710BuildVersionNumber = 0; // MAF put mainline num here on release |
|
47 |
|
48 // Serial Info |
|
49 const TUint KCSY_Gsm0710LowUnit = 1; |
|
50 const TUint KCSY_Gsm0710HighUnit = 100; |
|
51 |
|
52 const TInt KCsyDefaultMaxDLCChannels = 10; |
|
53 |
|
54 // Buffer size for LDD |
|
55 const TUint KDefaultTxRxBufSize = 512; |
|
56 |
|
57 |
|
58 // LDD/PDD configuration |
|
59 #if !defined P2SAMPLE |
|
60 _LIT8(KCsyDefaultPDDNameComm1, "EUART1"); |
|
61 _LIT8(KCsyDefaultPDDNameComm2, "EUART2"); |
|
62 #else |
|
63 _LIT8(KCsyDefaultPDDNameComm1, "EUARTCSMI"); |
|
64 _LIT8(KCsyDefaultPDDNameComm2, "EUART1"); |
|
65 #endif |
|
66 |
|
67 // AT Command need to put the baseband into Mux mode |
|
68 #ifdef _27010ADVANCEOPTION |
|
69 _LIT8(KCsyDefaultATEnterMuxModeCmd, "AT+CMUX=1,0,5\r"); |
|
70 #else |
|
71 _LIT8(KCsyDefaultATEnterMuxModeCmd, "AT+CMUX=0,0,5\r"); |
|
72 #endif |
|
73 |
|
74 // C32 Port number offsets |
|
75 const TInt KCOMMP_CSD_PPP_NUMBER = 6; // 6 - reserved for CSD PPP |
|
76 const TInt KCOMMP_IP_NIF_OFFSET = 16; // 16 and above - Raw IP |
|
77 |
|
78 // Factor by which to increase the size of the receive buffer in the LDD. |
|
79 const TInt KCSY_ReceiveBufferSizeIncreaseFactor = 10; |
|
80 |
|
81 // Basic sizes |
|
82 const TUint KMaxFrameSize = 127; |
|
83 const TUint KMaxIpPacketSize = 1502; |
|
84 |
|
85 const TUint KMaxAdvFrameSize = KMaxFrameSize + 8; |
|
86 |
|
87 // -------------------------------------------------------- |
|
88 |
|
89 // Constants for enforcing when the modem is allowed to send to the CSY |
|
90 |
|
91 // FC enforced when we are starting to run out of frames to put data in |
|
92 // or when a particular client is slow at reading |
|
93 |
|
94 // Maximum frames and flow control thresholds |
|
95 const TUint KMaxFreeFrames = 75; // <- should be enough for 3 contexts at max throughput each way |
|
96 const TUint KStopDataDlcsThreshold = 10; |
|
97 const TUint KStartDataDlcsThreshold = 40; |
|
98 |
|
99 // Slow read by client |
|
100 const TUint KMaxPacketsOutstandingForC32Client = 5; |
|
101 |
|
102 // At Response timeout |
|
103 const TInt KAtResponseTimeoutLimit = 5; |
|
104 |
|
105 // -------------------------------------------------------- |
|
106 |
|
107 // active object priorities |
|
108 const TInt KFrameReaderAoPriority = 100; |
|
109 const TInt KFrameWriterAoPriority = KFrameReaderAoPriority; |
|
110 |
|
111 // Magic numbers |
|
112 const TUint8 KSingleFrame = 0x03; // Only Frame of Message |
|
113 const TUint8 KStartMultiFrame = 0x01; // Start MultiFrame |
|
114 const TUint8 KMiddleMultiFrame = 0x00; // Middle MultiFrame |
|
115 const TUint8 KEndMultiFrame = 0x02; // Ending MultiFrame |
|
116 |
|
117 const TInt KAdvOptionNumOfNonDataOctets = 4; |
|
118 const TInt KAdvOptionType4StartOfMessageData = 3; |
|
119 const TInt KAdvOptionType4FrameControl = 2; |
|
120 |
|
121 // Ignoring start/end flags .. |
|
122 // Advanced format: address | control | data | checksum |
|
123 const TInt KAdvOptionHeaderSize = 2; |
|
124 const TInt KAdvOptionControl = 1; |
|
125 const TInt KAdvOptionAddress = 0; |
|
126 |
|
127 const TInt KChecksumSize = 1; |
|
128 |
|
129 const TInt KBasicOptionHeaderSize = 3; |
|
130 const TInt KBasicOptionLength = 2; |
|
131 const TInt KBasicOptionControl = 1; |
|
132 const TInt KBasicOptionAddress = 0; |
|
133 |
|
134 // Ctrl(dlc 0) commands |
|
135 // adv option: address | control | CtrlType | LengthData | Value(s) |
|
136 // basic option: address | control | length | CtrlType | LengthData | Value(s) |
|
137 const TInt KBasicOptionCtrlStart = KBasicOptionHeaderSize; |
|
138 const TInt KAdvOptionCtrlStart = KAdvOptionHeaderSize; |
|
139 |
|
140 // CtrlType | LengthData | Value(s) |
|
141 const TInt KPositionOfValueFieldInCtrlData = 2; |
|
142 const TInt KPositionOfLengthFieldInCtrlData = 1; |
|
143 |
|
144 const TUint8 KCtrlChannelDlcNum = 0; |
|
145 |
|
146 // Timeouts |
|
147 const TInt KOneSecond = 1000000; |
|
148 const TInt KTwoSeconds = 2000000; |
|
149 |
|
150 |
|
151 // Frame Start/Stop Flag |
|
152 |
|
153 |
|
154 const TUint8 KCsy0710StartEndFlag = 0x7E; |
|
155 const TUint8 KCsy0710EscapeByte = 0x7D; |
|
156 |
|
157 const TUint8 KPNFrameType = 0x00; |
|
158 const TUint8 KPNClBits = 0x03; |
|
159 const TUint8 KPNDlcPriority = 0x07; |
|
160 const TUint8 KPNAckTimer = 0x0A; // 10ms resolution |
|
161 const TUint8 KPNMaxFrameSize = 0x00ff & KMaxFrameSize; |
|
162 const TUint8 KPNMaxRetransmissions = 0x03; |
|
163 const TUint8 KPNWindowSize = 0x00; |
|
164 |
|
165 |
|
166 // Control Field Constants |
|
167 const TUint8 KCsy0710CTLSABM = 0x2F; |
|
168 const TUint8 KCsy0710CTLUA = 0x63; |
|
169 const TUint8 KCsy0710CTLDM = 0x0F; |
|
170 const TUint8 KCsy0710CTLDISC = 0x43; |
|
171 const TUint8 KCsy0710CTLUIH = 0xEF; |
|
172 const TUint8 KCsy0710CTLUI = 0x03; |
|
173 |
|
174 const TUint KCsy0710EA = 0x01; |
|
175 const TUint KCsy0710CRBit = 0x02; |
|
176 const TUint KCsy0710PollFinal = 0x10; |
|
177 |
|
178 // Message Types for UIH frames received by the CSY on DLC 0 (control channel) |
|
179 // The EA (bit 0) and C/R (bit 1) bits are both assumed to be set |
|
180 const TUint8 KCsy0710CTLUIH_DlcParamNegotiate = 0x83; |
|
181 const TUint8 KCsy0710CTLUIH_DlcParamNegotiateRsp = 0x81; |
|
182 const TUint8 KCsy0710CTLUIH_PowerSaveCtl = 0x43; |
|
183 const TUint8 KCsy0710CTLUIH_MultCloseDown = 0xC3; |
|
184 const TUint8 KCsy0710CTLUIH_TestCmd = 0x23; |
|
185 const TUint8 KCsy0710CTLUIH_FlowControlOn = 0xA3; |
|
186 const TUint8 KCsy0710CTLUIH_FlowControlOff = 0x63; |
|
187 const TUint8 KCsy0710CTLUIH_ModemStatusCmd = 0xE3; |
|
188 const TUint8 KCsy0710CTLUIH_ModemStatusRsp = 0xE1; |
|
189 const TUint8 KCsy0710CTLUIH_NonSupportedCmdResp = 0x13; |
|
190 const TUint8 KCsy0710CTLUIH_RemotePortNegotiate = 0x93; |
|
191 const TUint8 KCsy0710CTLUIH_RemoteLineStatus = 0x53; |
|
192 const TUint8 KCsy0710CTLUIH_ServiceNegotiate = 0xD3; |
|
193 |
|
194 |
|
195 // The CRC Table as defined in 27.010 |
|
196 const TUint8 crctable[256] = |
|
197 { //reversed, 8-bit, poly=0x07 |
|
198 0x00, 0x91, 0xE3, 0x72, 0x07, 0x96, 0xE4, 0x75, 0x0E, 0x9F, 0xED, 0x7C, 0x09, 0x98,0xEA, 0x7B, |
|
199 0x1C, 0x8D, 0xFF, 0x6E, 0x1B, 0x8A, 0xF8, 0x69, 0x12, 0x83, 0xF1, 0x60, 0x15, 0x84,0xF6, 0x67, |
|
200 0x38, 0xA9, 0xDB, 0x4A, 0x3F, 0xAE, 0xDC, 0x4D, 0x36, 0xA7, 0xD5, 0x44, 0x31, 0xA0,0xD2, 0x43, |
|
201 0x24, 0xB5, 0xC7, 0x56, 0x23, 0xB2, 0xC0, 0x51, 0x2A, 0xBB, 0xC9, 0x58, 0x2D, 0xBC,0xCE, 0x5F, |
|
202 0x70, 0xE1, 0x93, 0x02, 0x77, 0xE6, 0x94, 0x05, 0x7E, 0xEF, 0x9D, 0x0C, 0x79, 0xE8,0x9A, 0x0B, |
|
203 0x6C, 0xFD, 0x8F, 0x1E, 0x6B, 0xFA, 0x88, 0x19, 0x62, 0xF3, 0x81, 0x10, 0x65, 0xF4,0x86, 0x17, |
|
204 0x48, 0xD9, 0xAB, 0x3A, 0x4F, 0xDE, 0xAC, 0x3D, 0x46, 0xD7, 0xA5, 0x34, 0x41, 0xD0,0xA2, 0x33, |
|
205 0x54, 0xC5, 0xB7, 0x26, 0x53, 0xC2, 0xB0, 0x21, 0x5A, 0xCB, 0xB9, 0x28, 0x5D, 0xCC,0xBE, 0x2F, |
|
206 0xE0, 0x71, 0x03, 0x92, 0xE7, 0x76, 0x04, 0x95, 0xEE, 0x7F, 0x0D, 0x9C, 0xE9, 0x78,0x0A, 0x9B, |
|
207 0xFC, 0x6D, 0x1F, 0x8E, 0xFB, 0x6A, 0x18, 0x89, 0xF2, 0x63, 0x11, 0x80, 0xF5, 0x64,0x16, 0x87, |
|
208 0xD8, 0x49, 0x3B, 0xAA, 0xDF, 0x4E, 0x3C, 0xAD, 0xD6, 0x47, 0x35, 0xA4, 0xD1, 0x40,0x32, 0xA3, |
|
209 0xC4, 0x55, 0x27, 0xB6, 0xC3, 0x52, 0x20, 0xB1, 0xCA, 0x5B, 0x29, 0xB8, 0xCD, 0x5C,0x2E, 0xBF, |
|
210 0x90, 0x01, 0x73, 0xE2, 0x97, 0x06, 0x74, 0xE5, 0x9E, 0x0F, 0x7D, 0xEC, 0x99, 0x08,0x7A, 0xEB, |
|
211 0x8C, 0x1D, 0x6F, 0xFE, 0x8B, 0x1A, 0x68, 0xF9, 0x82, 0x13, 0x61, 0xF0, 0x85, 0x14,0x66, 0xF7, |
|
212 0xA8, 0x39, 0x4B, 0xDA, 0xAF, 0x3E, 0x4C, 0xDD, 0xA6, 0x37, 0x45, 0xD4, 0xA1, 0x30,0x42, 0xD3, |
|
213 0xB4, 0x25, 0x57, 0xC6, 0xB3, 0x22, 0x50, 0xC1, 0xBA, 0x2B, 0x59, 0xC8, 0xBD, 0x2C,0x5E, 0xCF |
|
214 }; |
|
215 |
|
216 //v24 signals |
|
217 const TUint KV24SignalRTC = 0x04; |
|
218 const TUint KV24SignalRTR = 0x08; |
|
219 const TUint KV24SignalIC = 0x40; |
|
220 const TUint KV24SignalDV = 0x80; |
|
221 |
|
222 // Logging |
|
223 |
|
224 _LIT(KCsyLogDir, "TRP\\CSY" ); |
|
225 _LIT(KCsyLogFile, "csy27010.txt"); |
|
226 _LIT(KCsyLogLine, "---------- CSY 3GPP 27.010 Log ----------"); |
|
227 |
|
228 |
|
229 #endif // _CSYGLOBALS_H_ |
|