1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/kernelhwsrv/kernel/eka/include/d32comm.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,941 @@
1.4 +// Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of the License "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +// e32\include\d32comm.h
1.18 +//
1.19 +//
1.20 +
1.21 +//#define _DEBUG_DEVCOMM
1.22 +
1.23 +/**
1.24 +@file
1.25 +@publishedPartner
1.26 +@released
1.27 +*/
1.28 +
1.29 +#ifndef __D32COMM_H__
1.30 +#define __D32COMM_H__
1.31 +#include <e32cmn.h>
1.32 +#include <e32ver.h>
1.33 +#include <d32public.h>
1.34 +
1.35 +/**
1.36 + Enumeration of number of data bits for serial port configuration.
1.37 + Typically, these values are used to initialize the iDataBits of
1.38 + TCommConfigV01 before calling DComm::Configure() or any other serial
1.39 + comm API to configure the serial port's databits size.
1.40 + */
1.41 +enum TDataBits {EData5,EData6,EData7,EData8};
1.42 +/**
1.43 + Enumeration of number of stop bits for serial port configuration.
1.44 + Typically, these values are used to initialize the iStopBits of
1.45 + TCommConfigV01 before calling DComm::Configure() or any other serial
1.46 + comm API to configure the serial port's stopbits.
1.47 + */
1.48 +enum TStopBits {EStop1,EStop2};
1.49 +/**
1.50 + Enumeration of types of parity for serial port configuration.
1.51 + Typically, these values are used to initialize the iParity of
1.52 + TCommConfigV01 before calling DComm::Configure() or any other serial
1.53 + comm API to configure the serial port's parity setting.
1.54 + */
1.55 +enum TParity {EParityNone,EParityEven,EParityOdd,EParityMark,EParitySpace};
1.56 +/**
1.57 + Enumeration of baud rates in bits per second for serial port configuration.
1.58 + * e.g EBps115200 is for 115200Bps data rate
1.59 + Typically, these values are used to initialize the iRate of TCommConfigV01
1.60 + before calling DComm::Configure() or any other serial comm API to configure
1.61 + the serial port's baud rate.
1.62 + */
1.63 +enum TBps
1.64 + {
1.65 + EBps50,
1.66 + EBps75,
1.67 + EBps110,
1.68 + EBps134,
1.69 + EBps150,
1.70 + EBps300,
1.71 + EBps600,
1.72 + EBps1200,
1.73 + EBps1800,
1.74 + EBps2000,
1.75 + EBps2400,
1.76 + EBps3600,
1.77 + EBps4800,
1.78 + EBps7200,
1.79 + EBps9600,
1.80 + EBps19200,
1.81 + EBps38400,
1.82 + EBps57600,
1.83 + EBps115200,
1.84 + EBps230400,
1.85 + EBps460800,
1.86 + EBps576000,
1.87 + EBps1152000,
1.88 + EBps4000000,
1.89 + EBps921600,
1.90 + EBpsAutobaud=0x40000000,
1.91 + EBpsSpecial=0x80000000,
1.92 + };
1.93 +/**
1.94 + Enumeration of Fifo status (enable and disable) for serial port configuration.
1.95 + Typically, these values are used to initialize the iFifo of TCommConfigV01
1.96 + before calling DComm::Configure() or any other serial comm API to configure
1.97 + the serial port's fifo.
1.98 + */
1.99 +enum TFifo
1.100 + {
1.101 + EFifoEnable,EFifoDisable,
1.102 + };
1.103 +/**
1.104 + Enumeration of SIR status (enable and disable) for serial comm configuration.
1.105 + Typically, these values are used to initialize the iSIREnable of TCommConfigV01
1.106 + before calling DComm::Configure() or any other serial comm API to configure
1.107 + the serial port's SIR (infrared) settings.
1.108 + */
1.109 +enum TSir
1.110 + {
1.111 + ESIREnable,ESIRDisable,
1.112 + };
1.113 +
1.114 +const TInt KConfigMaxTerminators=4;
1.115 +// DTE Constants
1.116 +const TUint KConfigObeyXoff=0x01;
1.117 +const TUint KConfigSendXoff=0x02;
1.118 +const TUint KConfigObeyCTS=0x04;
1.119 +const TUint KConfigFailCTS=0x08;
1.120 +const TUint KConfigObeyDSR=0x10;
1.121 +const TUint KConfigFailDSR=0x20;
1.122 +const TUint KConfigObeyDCD=0x40;
1.123 +const TUint KConfigFailDCD=0x80;
1.124 +const TUint KConfigFreeRTS=0x100;
1.125 +const TUint KConfigFreeDTR=0x200;
1.126 +// DCE Constants
1.127 +const TUint KConfigObeyDTR=0x400;
1.128 +const TUint KConfigFailDTR=0x800;
1.129 +const TUint KConfigObeyRTS=0x1000;
1.130 +const TUint KConfigFailRTS=0x2000;
1.131 +const TUint KConfigFreeDSR=0x4000;
1.132 +const TUint KConfigFreeCTS=0x8000;
1.133 +const TUint KConfigFreeDCD=0x10000;
1.134 +const TUint KConfigFreeRI=0x20000;
1.135 +const TUint KConfigWriteBufferedComplete=0x80000000;
1.136 +//
1.137 +const TUint KConfigParityErrorFail=0;
1.138 +const TUint KConfigParityErrorIgnore=0x01;
1.139 +const TUint KConfigParityErrorReplaceChar=0x02;
1.140 +const TUint KConfigXonXoffDebug=0x80000000;
1.141 +//
1.142 +const TUint KSignalCTS=0x01;
1.143 +const TUint KSignalDSR=0x02;
1.144 +const TUint KSignalDCD=0x04;
1.145 +const TUint KSignalRNG=0x08;
1.146 +const TUint KSignalRTS=0x10;
1.147 +const TUint KSignalDTR=0x20;
1.148 +const TUint KSignalBreak=0x40;
1.149 +
1.150 +const TUint KSignalChanged=0x1000;
1.151 +const TUint KCTSChanged=KSignalCTS*KSignalChanged;
1.152 +const TUint KDSRChanged=KSignalDSR*KSignalChanged;
1.153 +const TUint KDCDChanged=KSignalDCD*KSignalChanged;
1.154 +const TUint KRNGChanged=KSignalRNG*KSignalChanged;
1.155 +const TUint KRTSChanged=KSignalRTS*KSignalChanged;
1.156 +const TUint KDTRChanged=KSignalDTR*KSignalChanged;
1.157 +const TUint KBreakChanged=KSignalBreak*KSignalChanged;
1.158 +
1.159 +const TUint KSignalDTEOutputs=KSignalRTS|KSignalDTR;
1.160 +const TUint KSignalDTEInputs=KSignalCTS|KSignalDSR|KSignalDCD|KSignalRNG;
1.161 +const TUint KSignalDCEInputs=KSignalDTEOutputs;
1.162 +const TUint KSignalDCEOutputs=KSignalDTEInputs;
1.163 +
1.164 +const TUint KConfigSIRPulseWidthMaximum=0x01;
1.165 +const TUint KConfigSIRPulseWidthMinimum=0x02;
1.166 +
1.167 +// more SIRSettings for selecting the IR range
1.168 +const TUint KConfigSIRShutDown=0x10;
1.169 +const TUint KConfigSIRMinimumRange=0x20;
1.170 +const TUint KConfigSIRMediumRange=0x40;
1.171 +const TUint KConfigSIRMaximumRange=0x80;
1.172 +
1.173 +/**
1.174 + Comms configuration structure.
1.175 + Class to hold the configuration settings for serial comm port
1.176 +
1.177 + This class provides the serial port configuration block interface of serial comms (c32).
1.178 + A serial comm client sets up a serial port before use, by providing a configuration block.
1.179 + TCommConfigV01 is initialized with settings for serial port and used to configure the
1.180 + serial port by calling DComm::Configure(TCommConfigV01 &aConfig) or any other serial comm
1.181 + API to configure the serial port.
1.182 + */
1.183 +class TCommConfigV01
1.184 + {
1.185 +public:
1.186 + /**
1.187 + Data rate in bits per second.
1.188 + @see TBps
1.189 + */
1.190 + TBps iRate;
1.191 + /**
1.192 + Character width in bits.
1.193 + @see TDataBits
1.194 + */
1.195 + TDataBits iDataBits;
1.196 + /**
1.197 + Number of stop bits.
1.198 + @see TStopBits
1.199 + */
1.200 + TStopBits iStopBits;
1.201 + /**
1.202 + Type of parity.
1.203 + @see TParity
1.204 + */
1.205 + TParity iParity;
1.206 + /**
1.207 + Type of Handshaking control.
1.208 + Possible values can be KConfigObeyXXX or KConfigSendXXX or KConfigFailXXX or KConfigFreeXXX
1.209 + */
1.210 + TUint iHandshake;
1.211 + /**
1.212 + Type of error to generate on a parity failure.
1.213 + Possible values can be KConfigParityErrorFail or KConfigParityErrorIgnore or KConfigParityErrorReplaceChar
1.214 + */
1.215 + TUint iParityError;
1.216 + /**
1.217 + FIFO status, enabled or disabled.
1.218 + @see TFifo
1.219 + */
1.220 + TUint iFifo;
1.221 + /**
1.222 + Special data rate, not listed under TBps. Use this, when iRate is set to EBpsSpecial
1.223 + */
1.224 + TInt iSpecialRate;
1.225 + /**
1.226 + Count of number of special characters used as terminators (<=KConfigMaxTerminators)
1.227 + */
1.228 + TInt iTerminatorCount;
1.229 + /**
1.230 + Array of special characters which can be used as terminators
1.231 + */
1.232 + TText8 iTerminator[KConfigMaxTerminators];
1.233 + /**
1.234 + Character used to signal the transmitter to resume sending when using XON/XOFF handshaking
1.235 + i.e character used as XON - software flow control
1.236 + */
1.237 + TText8 iXonChar;
1.238 + /**
1.239 + Character used to signal the transmitter to suspend sending when using XON/XOFF handshaking
1.240 + i.e character used as XOFF - software flow control
1.241 + */
1.242 + TText8 iXoffChar;
1.243 + /**
1.244 + Character used to replace the characters received with a parity error.
1.245 + This is used when iParityError is set to KConfigParityErrorReplaceChar
1.246 + */
1.247 + TText8 iParityErrorChar;
1.248 + /**
1.249 + Switch the SIR encoding hardware on and off.
1.250 + @see TSir
1.251 + */
1.252 + TSir iSIREnable;
1.253 + /**
1.254 + SIR hardware control setting. Possible value can be one of KConfigSIRXXX
1.255 + */
1.256 + TUint iSIRSettings;
1.257 + };
1.258 +/**
1.259 + Package buffer for a TCommConfigV01 object.
1.260 +
1.261 + TCommConfig packages the comms configuration structure TCommConfigV01 to a buffer.
1.262 + This is used with API of serial comms like RComm::Config(TDes8 &aConfig) and
1.263 + RComm::SetConfig(TDesC8 &aConfig) where config structure is passed as buffer.
1.264 +
1.265 + @see TCommConfigV01
1.266 + */
1.267 +typedef TPckgBuf<TCommConfigV01> TCommConfig;
1.268 +
1.269 +// TCommConfigV02 is deprecated.
1.270 +//
1.271 +class TCommConfigV02: public TCommConfigV01
1.272 + {
1.273 +public:
1.274 + TInt iTxShutdownTimeout;
1.275 + };
1.276 +
1.277 +// TCommConfig2 is deprecated
1.278 +//
1.279 +typedef TPckgBuf<TCommConfigV02> TCommConfig2;
1.280 +
1.281 +//
1.282 +const TUint KCapsBps50=0x00000001;
1.283 +const TUint KCapsBps75=0x00000002;
1.284 +const TUint KCapsBps110=0x00000004;
1.285 +const TUint KCapsBps134=0x00000008;
1.286 +const TUint KCapsBps150=0x00000010;
1.287 +const TUint KCapsBps300=0x00000020;
1.288 +const TUint KCapsBps600=0x00000040;
1.289 +const TUint KCapsBps1200=0x00000080;
1.290 +const TUint KCapsBps1800=0x00000100;
1.291 +const TUint KCapsBps2000=0x00000200;
1.292 +const TUint KCapsBps2400=0x00000400;
1.293 +const TUint KCapsBps3600=0x00000800;
1.294 +const TUint KCapsBps4800=0x00001000;
1.295 +const TUint KCapsBps7200=0x00002000;
1.296 +const TUint KCapsBps9600=0x00004000;
1.297 +const TUint KCapsBps19200=0x00008000;
1.298 +const TUint KCapsBps38400=0x00010000;
1.299 +const TUint KCapsBps57600=0x00020000;
1.300 +const TUint KCapsBps115200=0x00040000;
1.301 +const TUint KCapsBps230400=0x00080000;
1.302 +const TUint KCapsBps460800=0x00100000;
1.303 +const TUint KCapsBps576000 =0x00200000;
1.304 +const TUint KCapsBps1152000=0x00400000;
1.305 +const TUint KCapsBps4000000=0x00800000;
1.306 +const TUint KCapsBps921600=0x01000000;
1.307 +const TUint KCapsBpsAutobaud=0x40000000;
1.308 +const TUint KCapsBpsSpecial=0x80000000;
1.309 +//
1.310 +const TUint KCapsData5=0x01;
1.311 +const TUint KCapsData6=0x02;
1.312 +const TUint KCapsData7=0x04;
1.313 +const TUint KCapsData8=0x08;
1.314 +//
1.315 +const TUint KCapsStop1=0x01;
1.316 +const TUint KCapsStop2=0x02;
1.317 +//
1.318 +const TUint KCapsParityNone=0x01;
1.319 +const TUint KCapsParityEven=0x02;
1.320 +const TUint KCapsParityOdd=0x04;
1.321 +const TUint KCapsParityMark=0x08;
1.322 +const TUint KCapsParitySpace=0x10;
1.323 +//
1.324 +const TUint KCapsSignalCTSSupported=0x01;
1.325 +const TUint KCapsSignalDSRSupported=0x02;
1.326 +const TUint KCapsSignalDCDSupported=0x04;
1.327 +const TUint KCapsSignalRNGSupported=0x08;
1.328 +const TUint KCapsSignalRTSSupported=0x10;
1.329 +const TUint KCapsSignalDTRSupported=0x20;
1.330 +//
1.331 +const TUint KCapsObeyXoffSupported=0x01;
1.332 +const TUint KCapsSendXoffSupported=0x02;
1.333 +const TUint KCapsObeyCTSSupported=0x04;
1.334 +const TUint KCapsFailCTSSupported=0x08;
1.335 +const TUint KCapsObeyDSRSupported=0x10;
1.336 +const TUint KCapsFailDSRSupported=0x20;
1.337 +const TUint KCapsObeyDCDSupported=0x40;
1.338 +const TUint KCapsFailDCDSupported=0x80;
1.339 +const TUint KCapsFreeRTSSupported=0x100;
1.340 +const TUint KCapsFreeDTRSupported=0x200;
1.341 +// DCE Constants
1.342 +const TUint KCapsObeyRTSSupported=0x400;
1.343 +const TUint KCapsObeyDTRSupported=0x800;
1.344 +//
1.345 +const TUint KCapsHasFifo=0x01;
1.346 +//
1.347 +const TUint KCapsSIR115kbps=0x01;
1.348 +const TUint KCapsSIR2400bpsOnly=0x02;
1.349 +const TUint KCapsSIR4Mbs=0x04;
1.350 +//
1.351 +const TUint KNotifySignalsChangeSupported=0x01;
1.352 +const TUint KNotifyRateChangeSupported=0x02;
1.353 +const TUint KNotifyDataFormatChangeSupported=0x04;
1.354 +const TUint KNotifyHandshakeChangeSupported=0x08;
1.355 +const TUint KNotifyBreakSupported=0x10;
1.356 +const TUint KNotifyFlowControlChangeSupported=0x20;
1.357 +const TUint KNotifyDataAvailableSupported=0x40;
1.358 +const TUint KNotifyOutputEmptySupported=0x80;
1.359 +//
1.360 +const TUint KCapsRoleSwitchSupported=0x01;
1.361 +//
1.362 +const TUint KCapsFlowControlStatusSupported=0x01;
1.363 +//
1.364 +const TUint KRateChanged=0x01;
1.365 +const TUint KDataFormatChanged=0x02;
1.366 +const TUint KHandshakeChanged=0x04;
1.367 +//
1.368 +
1.369 +/**
1.370 + Comms capability structure.
1.371 + Class to query the capability settings for serial comm port device.
1.372 + Members of this class are filled with the capabilities of the comm port device.
1.373 + */
1.374 +
1.375 +class TCommCapsV01
1.376 + {
1.377 +public:
1.378 + /**
1.379 + Data rates supported, in bits per second.
1.380 + The value is a bitmask made by OR-ing KCapsBpsXXX values.
1.381 + Each set bit corresponds to a supported bit rate.
1.382 + */
1.383 + TUint iRate;
1.384 + /**
1.385 + Character widths supported, in bits.
1.386 + The value is a bitmask made by OR-ing a combination of KCapsData5, KCapsData6, KCapsData7 and KCapsData8 values.
1.387 + Each set bit corresponds to a supported character width.
1.388 + */
1.389 + TUint iDataBits;
1.390 + /**
1.391 + Number of stop bits supported.
1.392 + The value is one of KCapsStop1, KCapsStop2 or KCapsStop1|KCapsStop2.
1.393 + Each set bit corresponds to a supported number of stop bit.
1.394 + */
1.395 + TUint iStopBits;
1.396 + /**
1.397 + Parity types supported.
1.398 + The value is a bitmask made by OR-ing a combination of KCapsParityNone, KCapsParityEven, KCapsParityOdd, KCapsParityMark and KCapsParitySpace values.
1.399 + Each set bit corresponds to a supported parity type.
1.400 + */
1.401 + TUint iParity;
1.402 + /**
1.403 + Type of Handshaking protocols supported by the device.
1.404 + The value is a bitmask made by OR-ing a combination of KCapsObeyXXX, KCapsSendXXX, KCapsFailXXX and KCapsFreeXXX values.
1.405 + Each set bit corresponds to a supported handshaking protocol.
1.406 + */
1.407 + TUint iHandshake;
1.408 + /**
1.409 + Type of Signals supported by the device.
1.410 + The value is a bitmask made by OR-ing a combination of KCapsSignalXXX values.
1.411 + Each set bit corresponds to a supported signal.
1.412 + */
1.413 + TUint iSignals;
1.414 + /**
1.415 + Whether Fifo is enabled or disabled.
1.416 + Value is KCapsHasFifo if enabled, 0 otherwise
1.417 + */
1.418 + TUint iFifo;
1.419 + /**
1.420 + Capabilities of the SIR encoding hardware.
1.421 + The value is a bitmask made by OR-ing a combination of KCapsSIR115kbps, KCapsSIR2400bpsOnly and KCapsSIR4Mbps values.
1.422 + Each set bit corresponds to a supported SIR capability.
1.423 + */
1.424 + TUint iSIR;
1.425 + };
1.426 +/**
1.427 + Package buffer for a TCommCapsV01 object.
1.428 +
1.429 + TCommCaps packages the comms capability structure TCommCapsV01 in a buffer.
1.430 + This is used by serial comms APIs to pass the capability structure as a buffer,
1.431 + for example in RComm::Caps(TDes8 &aCaps).
1.432 +
1.433 + @see TCommCapsV01
1.434 + */
1.435 +typedef TPckgBuf<TCommCapsV01> TCommCaps;
1.436 +
1.437 +/**
1.438 + Comms capability structure.
1.439 + Class to query the capability settings for serial comm port.
1.440 + Members of this class are filled with the capabilities of the comm port.
1.441 +
1.442 + @see TCommCapsV01
1.443 + */
1.444 +class TCommCapsV02 : public TCommCapsV01
1.445 + {
1.446 +public:
1.447 + /**
1.448 + Specifies the notifications that are supported for the serial comm port.
1.449 + The field is a bitmask made by OR-ing a combination of:
1.450 + -KNotifySignalsChangeSupported
1.451 + -KNotifyRateChangeSupported
1.452 + -KNotifyDataFormatChangeSupported
1.453 + -KNotifyHandshakeChangeSupported
1.454 + -KNotifyBreakSupported
1.455 + -KNotifyFlowControlChangeSupported
1.456 + -KNotifyDataAvailableSupported
1.457 + -KNotifyOutputEmptySupported
1.458 + Each set bit corresponds to a supported notification type.
1.459 + */
1.460 + TUint iNotificationCaps;
1.461 + /**
1.462 + Specifies whether Role Switch is supported or not.
1.463 + If supported the value is KCapsRoleSwitchSupported, otherwise Zero
1.464 + */
1.465 + TUint iRoleCaps;
1.466 + /**
1.467 + Specifies whether Flow Control Status is supported or not.
1.468 + If supported the value is KCapsFlowControlStatusSupported, otherwise Zero
1.469 + */
1.470 + TUint iFlowControlCaps;
1.471 + };
1.472 +
1.473 +/**
1.474 + Package buffer for a TCommCapsV02 object.
1.475 +
1.476 + TCommCaps2 packages the comms capability structure TCommCapsV02 in a buffer.
1.477 + This is used by serial comms to pass the capability structure as a buffer,
1.478 + for example in RComm::Caps(TDes8 &aCaps)
1.479 +
1.480 + @see TCommCapsV02
1.481 + */
1.482 +typedef TPckgBuf<TCommCapsV02> TCommCaps2;
1.483 +
1.484 +
1.485 +/**
1.486 + Comms capability structure.
1.487 + Class to hold the capability settings for serial comm port.
1.488 +
1.489 + This class is used to query the capabilities of the serial comm port.
1.490 + Members of this class are filled with the capabilities of the comm port.
1.491 +
1.492 + @see TCommCapsV02
1.493 + */
1.494 +class TCommCapsV03 : public TCommCapsV02
1.495 + {
1.496 +public:
1.497 + /**
1.498 + Specifies whether break is supported or not.
1.499 + ETrue if Supported, EFalse otherwise.
1.500 + */
1.501 + TBool iBreakSupported;
1.502 + };
1.503 +
1.504 +/**
1.505 + Package buffer for a TCommCapsV03 object.
1.506 +
1.507 + TCommCaps3 packages the comms capability structure TCommCapsV03 in a buffer.
1.508 + This is used by serial comms APIs to pass the capability structure as a buffer,
1.509 + for example in RComm::Caps(TDes8 &aCaps)
1.510 +
1.511 + @see TCommCapsV03
1.512 + */
1.513 +typedef TPckgBuf<TCommCapsV03> TCommCaps3;
1.514 +
1.515 +/**
1.516 + Structure that holds the capabilities of the Comms factory object. Only Version is supported.
1.517 + This structure is packaged within a descriptor when passed to methods such as RDevice::GetCaps()
1.518 + */
1.519 +class TCapsDevCommV01
1.520 + {
1.521 +public:
1.522 + /**
1.523 + Version of the device
1.524 + @see TVersion
1.525 + */
1.526 + TVersion version;
1.527 + };
1.528 +
1.529 +/**
1.530 + Comms Notification configuration structure
1.531 + Class to hold the notification configuration of the device.
1.532 + Notifications are only used with DCE (modem) comms ports.
1.533 + */
1.534 +class TCommNotificationV01
1.535 + {
1.536 +public:
1.537 + /**
1.538 + Specifies which of the configuration members have changed
1.539 + This value is a bitmask made by OR-ing a combination of KRateChanged,KDataFormatChanged and KHandshakeChanged values.
1.540 + Each set bit corresponds to a change in the configuration notification.
1.541 + @see TCommCapsV01
1.542 + */
1.543 + TUint iChangedMembers;
1.544 + /**
1.545 + Data rate in bits per second.
1.546 + @see TBps
1.547 + */
1.548 + TBps iRate;
1.549 + /**
1.550 + Character width in bits.
1.551 + @see TDataBits
1.552 + */
1.553 + TDataBits iDataBits;
1.554 + /**
1.555 + Number of stop bits.
1.556 + @see TStopBits
1.557 + */
1.558 + TStopBits iStopBits;
1.559 + /**
1.560 + Type of parity.
1.561 + @see TParity
1.562 + */
1.563 + TParity iParity;
1.564 + /**
1.565 + Type of Handshaking control.
1.566 + Possible values can be any combination of KConfigObeyXXX, KConfigSendXXX, KConfigFailXXX and KConfigFreeXXX.
1.567 + */
1.568 + TUint iHandshake;
1.569 + };
1.570 +/**
1.571 + Package buffer for a TCommNotificationV01 object.
1.572 + Packages TCommNotificationV01 within a buffer.
1.573 + @see TCommNotificationV01
1.574 + */
1.575 +typedef TPckgBuf<TCommNotificationV01> TCommNotificationPckg;
1.576 +//
1.577 +const TUint KDataAvailableNotifyFlag=0x80000000;
1.578 +//
1.579 +#ifdef _DEBUG_DEVCOMM
1.580 +class TCommDebugInfo
1.581 + {
1.582 +public:
1.583 + TBool iRxBusy;
1.584 + TBool iRxHeld;
1.585 + TInt iRxLength;
1.586 + TInt iRxOffset;
1.587 + TInt iRxIntCount;
1.588 + TInt iRxErrCount;
1.589 + TInt iRxBufCount;
1.590 + TBool iTxBusy;
1.591 + TBool iTxHeld;
1.592 + TInt iTxLength;
1.593 + TInt iTxOffset;
1.594 + TInt iTxIntCount;
1.595 + TInt iTxErrCount;
1.596 + TInt iTxBufCount;
1.597 + TBool iDrainingRxBuf;
1.598 + TBool iFillingTxBuf;
1.599 + TBool iRunningDfc;
1.600 + TInt iDfcCount;
1.601 + TInt iDfcReqSeq;
1.602 + TInt iDfcHandlerSeq;
1.603 + TInt iDoDrainSeq;
1.604 + TBool iTxDfcPend;
1.605 + TBool iRxDfcPend;
1.606 + TInt iTxChars, iRxChars;
1.607 + TInt iTxXon, iTxXoff, iRxXon, iRxXoff;
1.608 + };
1.609 +typedef TPckgBuf<TCommDebugInfo> TCommDebugInfoPckg;
1.610 +#endif
1.611 +//
1.612 +
1.613 +/**
1.614 + The externally visible interface through which the clients can access serial devices.
1.615 + It also represents a user side handle to the serial device driver.
1.616 + */
1.617 +class RBusDevComm : public RBusLogicalChannel
1.618 + {
1.619 +public:
1.620 + /**
1.621 + Serial device driver build version.
1.622 + */
1.623 + enum TVer
1.624 + {
1.625 + /** Major Version */
1.626 + EMajorVersionNumber=1,
1.627 + /** Minor Version */
1.628 + EMinorVersionNumber=0,
1.629 + /** Build Version */
1.630 + EBuildVersionNumber=KE32BuildVersionNumber
1.631 + };
1.632 +
1.633 + /**
1.634 + Asynchronous request types
1.635 + */
1.636 + enum TRequest
1.637 + {
1.638 + /** Read request */
1.639 + ERequestRead=0x0,
1.640 + /** Cancel read request */
1.641 + ERequestReadCancel=0x1,
1.642 + /** Write reqeust */
1.643 + ERequestWrite=0x1,
1.644 + /** Cancel write request */
1.645 + ERequestWriteCancel=0x2,
1.646 + /** Break request */
1.647 + ERequestBreak=0x2,
1.648 + /** Cancel break request */
1.649 + ERequestBreakCancel=0x4,
1.650 + /** Signal change notification request */
1.651 + ERequestNotifySignalChange=0x3,
1.652 + /** Cancel signal change notification request */
1.653 + ERequestNotifySignalChangeCancel=0x8,
1.654 + };
1.655 +
1.656 + /**
1.657 + Synchronous request types
1.658 + */
1.659 + enum TControl
1.660 + {
1.661 + /** Get the current configuration */
1.662 + EControlConfig,
1.663 + /** Set the device configuration */
1.664 + EControlSetConfig,
1.665 + /** Get the device capabilities */
1.666 + EControlCaps,
1.667 + /** Read the state of Modem control signals supported */
1.668 + EControlSignals,
1.669 + /** Set the state of output modem control signals */
1.670 + EControlSetSignals,
1.671 + /** Query the driver receive buffer for data availability */
1.672 + EControlQueryReceiveBuffer,
1.673 + /** Reset the driver buffers */
1.674 + EControlResetBuffers,
1.675 + /** Get the driver receive buffer length */
1.676 + EControlReceiveBufferLength,
1.677 + /** Set the driver receive buffer length */
1.678 + EControlSetReceiveBufferLength,
1.679 + /** Get the minimum turnaround time between a receive and subsequent transmission operation */
1.680 + EControlMinTurnaroundTime,
1.681 + /** Set the minimum turnaround time between a receive and subsequent transmission operation */
1.682 + EControlSetMinTurnaroundTime,
1.683 +#ifdef _DEBUG_DEVCOMM
1.684 + /** Get debug information from the driver */
1.685 + EControlDebugInfo
1.686 +#endif
1.687 + };
1.688 +
1.689 +public:
1.690 +#ifndef __KERNEL_MODE__
1.691 +
1.692 + /**
1.693 + This function opens a channel and creates a handle to the serial driver.
1.694 + @param aUnit The unit number of the serial device.
1.695 + @return KErrNone, if successful;
1.696 + otherwise one of the other system-wide error codes.
1.697 + KErrPermissionDenied if the port given in aName is wrong or if the request fails the CSY's own security check;
1.698 + KErrNotSupported if this port is not supported by the CSY or the hardware;
1.699 + KErrLocked if the port has already been opened;
1.700 + KErrAccessDenied if the device driver encounteres a problem opening the hardware port.
1.701 + */
1.702 + inline TInt Open(TInt aUnit);
1.703 +
1.704 + /**
1.705 + Get the version number required by the driver
1.706 + @return The version number required by the driver
1.707 + @see TVersion
1.708 + */
1.709 + inline TVersion VersionRequired() const;
1.710 +
1.711 + /**
1.712 + Read from the channel
1.713 + @param aStatus The asynchronous request status
1.714 + @param aDes Buffer to be filled in by the driver
1.715 + */
1.716 + inline void Read(TRequestStatus &aStatus,TDes8 &aDes);
1.717 +
1.718 + /**
1.719 + Read from the channel
1.720 + @param aStatus The asynchronous request status
1.721 + @param aDes Buffer to be filled in by the driver
1.722 + @param aLength The length of the data to be read
1.723 + */
1.724 + inline void Read(TRequestStatus &aStatus,TDes8 &aDes,TInt aLength);
1.725 +
1.726 + /**
1.727 + Read one or more characters from the channel.
1.728 + If there is data in the serial driver's buffer when ReadOneOrMore() is called it will
1.729 + read as much data as possible (up to the maximum length of the supplied buffer)
1.730 + and then return.
1.731 + If there is no data in the buffer the request will complete as soon as one or more bytes arrive at the serial hardware.
1.732 + @param aStatus The asynchronous request status
1.733 + @param aDes Buffer to be filled in by the driver
1.734 + */
1.735 + inline void ReadOneOrMore(TRequestStatus &aStatus,TDes8 &aDes);
1.736 +
1.737 + /**
1.738 + Cancel a pending read request
1.739 + */
1.740 + inline void ReadCancel();
1.741 +
1.742 + /**
1.743 + Write to the channel
1.744 + @param aStatus The asynchronous request status
1.745 + @param aDes Buffer containing the data to be sent
1.746 + */
1.747 + inline void Write(TRequestStatus &aStatus,const TDesC8 &aDes);
1.748 +
1.749 + /**
1.750 + Write to the channel
1.751 + @param aStatus The asynchronous request status
1.752 + @param aDes Buffer containing the data to be sent
1.753 + @param aLength The length of the data to be sent
1.754 + */
1.755 + inline void Write(TRequestStatus &aStatus,const TDesC8 &aDes,TInt aLength);
1.756 +
1.757 + /**
1.758 + Cancel a pending write request
1.759 + */
1.760 + inline void WriteCancel();
1.761 +
1.762 + /**
1.763 + Causes a break condition to be transmitted to the receiving device
1.764 + @param aStatus The asynchronous request status
1.765 + @param aTime The time interval in microseconds after which the break condition will be released
1.766 + */
1.767 + inline void Break(TRequestStatus &aStatus,TInt aTime);
1.768 +
1.769 + /**
1.770 + Cancel a pending break request
1.771 + */
1.772 + inline void BreakCancel();
1.773 +
1.774 + /**
1.775 + Get the current configuration of the serial device
1.776 + @param aConfig A packaged object to be filled with the configuration information by the driver
1.777 + @see TCommConfigV02
1.778 + */
1.779 + inline void Config(TDes8 &aConfig);
1.780 +
1.781 + /**
1.782 + Set the cofiguration of the serial device
1.783 + @param aConfig A packaged object containing the configuration information
1.784 + @see TCommConfigV02
1.785 + */
1.786 + inline TInt SetConfig(const TDesC8 &aConfig);
1.787 +
1.788 + /**
1.789 + Get the capabilities of the serial device.
1.790 + @param aCaps A packaged object to be filled with the capabilities of the device.
1.791 + @see TCommCapsV03
1.792 + */
1.793 + inline void Caps(TDes8 &aCaps);
1.794 +
1.795 + /**
1.796 + Get the status of the control lines
1.797 + @return A bitmask of KSignalCTS, KSignalDSR, KSignalDCD, KSignalRNG,
1.798 + KSignalRTS, KSignalDTR, KSignalBreak
1.799 + */
1.800 + inline TUint Signals();
1.801 +
1.802 + /**
1.803 + Set and clear the control lines
1.804 + @param aSetMask Bitmask of signals to set
1.805 + @param aClearMask Bitmask of signals to clear
1.806 + @see Signals for a list of signals
1.807 + */
1.808 + inline void SetSignals(TUint aSetMask,TUint aClearMask);
1.809 +
1.810 + /**
1.811 + Get the number of unread characters in the receive buffer of the driver
1.812 + @return The number of unread characters
1.813 + */
1.814 + inline TInt QueryReceiveBuffer();
1.815 +
1.816 + /**
1.817 + Reset the receive and transmit buffers.
1.818 + */
1.819 + inline void ResetBuffers();
1.820 +
1.821 + /**
1.822 + Get the length of the receive buffer
1.823 + @return The length of the receive buffer
1.824 + */
1.825 + inline TInt ReceiveBufferLength();
1.826 +
1.827 + /**
1.828 + Set the length of the receive buffer
1.829 + @param aLength The length of the receive buffer to be set
1.830 + */
1.831 + inline TInt SetReceiveBufferLength(TInt aLength);
1.832 +
1.833 + /**
1.834 + Request notification when one of the signals change.
1.835 + The signals that could change are KSignalCTS, KSignalDSR, KSignalDCD, KSignalRNG,
1.836 + KSignalRTS, KSignalDTR, KSignalBreak.
1.837 + @param aStatus The asynchronous request status
1.838 + @param aSignals Pointer to the bitmask containing the changed signals
1.839 + @param aSignalMask Bitmask of signals to be monitored
1.840 + */
1.841 + inline void NotifySignalChange(TRequestStatus& aStatus,TUint& aSignals,TUint aSignalMask=0x3F);
1.842 +
1.843 + /**
1.844 + Cancel a pending signal change notification request
1.845 + */
1.846 + inline void NotifySignalChangeCancel();
1.847 +
1.848 + /**
1.849 + Request notification when there is data available to be read from the driver receive buffer
1.850 + @param aStatus The asynchronous request status
1.851 + */
1.852 + inline void NotifyReceiveDataAvailable(TRequestStatus& aStatus);
1.853 +
1.854 + /**
1.855 + Cancel a pending data notification request
1.856 + */
1.857 + inline void NotifyReceiveDataAvailableCancel();
1.858 +
1.859 + /**
1.860 + Get the minimum turnaround time before a transmission can begin after a receive operation
1.861 + @return The turnaround time in microseconds
1.862 + */
1.863 + inline TUint MinTurnaroundTime();
1.864 +
1.865 + /**
1.866 + Set the minimum turnaround time between a receive and the next transmission operation
1.867 + @param aMicroSeconds The turnaround time in microseconds
1.868 + */
1.869 + inline TInt SetMinTurnaroundTime(TUint aMicroSeconds);
1.870 +
1.871 +#ifdef _DEBUG_DEVCOMM
1.872 + /**
1.873 + Get the debug information
1.874 + @param aInfo a packaged object to be filled by the driver with debug information
1.875 + @see TCommDebugInfo
1.876 + */
1.877 + inline void DebugInfo(TDes8 &aInfo);
1.878 +#endif
1.879 +#endif
1.880 + };
1.881 +
1.882 +class RBusDevCommDCE : public RBusLogicalChannel
1.883 + {
1.884 +public:
1.885 + enum TVer {EMajorVersionNumber=1,EMinorVersionNumber=0,EBuildVersionNumber=KE32BuildVersionNumber};
1.886 + enum TRequest
1.887 + {
1.888 + ERequestRead=0x0,ERequestReadCancel=0x1,
1.889 + ERequestWrite=0x1,ERequestWriteCancel=0x2,
1.890 + ERequestBreak=0x2,ERequestBreakCancel=0x4,
1.891 + ERequestNotifySignalChange=0x3,ERequestNotifySignalChangeCancel=0x8,
1.892 + ERequestNotifyFlowControlChange=0x4,ERequestNotifyFlowControlChangeCancel=0x10,
1.893 + ERequestNotifyConfigChange=0x5,ERequestNotifyConfigChangeCancel=0x20
1.894 + };
1.895 + enum TControl
1.896 + {
1.897 + EControlConfig,EControlSetConfig,EControlCaps,
1.898 + EControlSignals,EControlSetSignals,
1.899 + EControlQueryReceiveBuffer,EControlResetBuffers,
1.900 + EControlReceiveBufferLength,EControlSetReceiveBufferLength,
1.901 + EControlFlowControlStatus,
1.902 +#ifdef _DEBUG_DEVCOMM
1.903 + EControlDebugInfo
1.904 +#endif
1.905 + };
1.906 +public:
1.907 +#ifndef __KERNEL_MODE__
1.908 + inline TInt Open(TInt aUnit);
1.909 + inline TVersion VersionRequired() const;
1.910 + inline void Read(TRequestStatus &aStatus,TDes8 &aDes);
1.911 + inline void Read(TRequestStatus &aStatus,TDes8 &aDes,TInt aLength);
1.912 + inline void ReadOneOrMore(TRequestStatus &aStatus,TDes8 &aDes);
1.913 + inline void ReadCancel();
1.914 + inline void Write(TRequestStatus &aStatus,const TDesC8 &aDes);
1.915 + inline void Write(TRequestStatus &aStatus,const TDesC8 &aDes,TInt aLength);
1.916 + inline void WriteCancel();
1.917 + inline void Break(TRequestStatus &aStatus,TInt aTime);
1.918 + inline void BreakCancel();
1.919 + inline void Config(TDes8 &aConfig);
1.920 + inline TInt SetConfig(const TDesC8 &aConfig);
1.921 + inline void Caps(TDes8 &aCaps);
1.922 + inline TUint Signals();
1.923 + inline void SetSignals(TUint aSetMask,TUint aClearMask);
1.924 + inline TInt QueryReceiveBuffer();
1.925 + inline void ResetBuffers();
1.926 + inline TInt ReceiveBufferLength();
1.927 + inline TInt SetReceiveBufferLength(TInt aLength);
1.928 + inline void NotifySignalChange(TRequestStatus& aStatus,TUint& aSignals,TUint aSignalMask=0x3F);
1.929 + inline void NotifySignalChangeCancel();
1.930 + inline void NotifyReceiveDataAvailable(TRequestStatus& aStatus);
1.931 + inline void NotifyReceiveDataAvailableCancel();
1.932 + inline void NotifyFlowControlChange(TRequestStatus& aStatus);
1.933 + inline void NotifyFlowControlChangeCancel();
1.934 + inline void GetFlowControlStatus(TFlowControl& aFlowControl);
1.935 + inline void NotifyConfigChange(TRequestStatus& aStatus, TDes8& aNewConfig);
1.936 + inline void NotifyConfigChangeCancel();
1.937 +#ifdef _DEBUG_DEVCOMM
1.938 + inline void DebugInfo(TDes8 &aInfo);
1.939 +#endif
1.940 +#endif
1.941 + };
1.942 +
1.943 +#include <d32comm.inl>
1.944 +#endif