epoc32/include/cs_port.h
branchSymbian3
changeset 4 837f303aceeb
parent 2 2fe1408b6811
equal deleted inserted replaced
3:e1b950c65cb4 4:837f303aceeb
     1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     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
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     7 //
     8 // Initial Contributors:
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
     9 // Nokia Corporation - initial contribution.
    10 //
    10 //
    11 // Contributors:
    11 // Contributors:
    12 //
    12 //
    13 // Description:
    13 // Description:
    14 //
    14 //
    15 
    15 
    16 #ifndef SYMBIAN_C32_SERCOMMS_V2
       
    17 // PLEASE NOTE: This file is part of Version 2 of C32 - that is, the multi-threaded version.
       
    18 // The single-threaded C32 version of this file is in c32\Version1\SCOMM
       
    19 // All defect fixes should be applied to both versions where appropriate.
       
    20 // PLEASE NOTE: This comment is applicable to SercommsV2 but is surrounded by an "#ifndef"
       
    21 // to enable the automatic removal of this comment once non-C32 V2 code is removed.
       
    22 #endif
       
    23 
    16 
    24 
    17 
    25 #ifndef CS_PORT_H
    18 #ifndef CS_PORT_H
    26 #define CS_PORT_H
    19 #define CS_PORT_H
    27 
    20 
   198 public:
   191 public:
   199 	//
   192 	//
   200 	// Pure virtual methods - to be implemented by the CSY
   193 	// Pure virtual methods - to be implemented by the CSY
   201 	//
   194 	//
   202 
   195 
   203 	/// Called by manager when access count is 0 - CSY port must call 'delete this'
   196 	// Called by manager when access count is 0 - CSY port must call 'delete this'
   204 	/** Specifies the protocol for port destruction. It is called by the comms server 
   197 	/** Specifies the protocol for port destruction. It is called by the comms server 
   205 	when the last client-side reference to a CPort object has been closed and 
   198 	when the last client-side reference to a CPort object has been closed and 
   206 	the CPort must be deleted. The comms server will not delete a CPort other 
   199 	the CPort must be deleted. The comms server will not delete a CPort other 
   207 	than by calling Destruct().
   200 	than by calling Destruct().
   208 	
   201 	
   209 	The implementation should perform any asynchronous shutdown operations on 
   202 	The implementation should perform any asynchronous shutdown operations on 
   210 	its own resources and, when these operations have completed, should delete 
   203 	its own resources and, when these operations have completed, should delete 
   211 	this. */
   204 	this. */
   212 	virtual void Destruct()=0;
   205 	virtual void Destruct()=0;
   213 	/// Queue a read - called by CPort when client wants to read
   206 	// Queue a read - called by CPort when client wants to read
   214 	/// Note: if the value in aLength is negative, this means
   207 	// Note: if the value in aLength is negative, this means
   215 	///       ReadOneOrMore and the CSY must invert the number
   208 	//       ReadOneOrMore and the CSY must invert the number
   216 	/** Specifies the protocol for reading from the port. It is called by the comms 
   209 	/** Specifies the protocol for reading from the port. It is called by the comms 
   217 	server in response to a RComm::Read() or RComm::ReadOneOrMore() request from 
   210 	server in response to a RComm::Read() or RComm::ReadOneOrMore() request from 
   218 	the client.
   211 	the client.
   219 	
   212 	
   220 	A negative value for aLength is used to flag that the read request was from 
   213 	A negative value for aLength is used to flag that the read request was from 
   227 	
   220 	
   228 	@param aClientBuffer Pointer into client address space to the descriptor containing 
   221 	@param aClientBuffer Pointer into client address space to the descriptor containing 
   229 	the client's buffer 
   222 	the client's buffer 
   230 	@param aLength The amount of data to be read */
   223 	@param aLength The amount of data to be read */
   231 	virtual void StartRead(const TAny* aClientBuffer, TInt aLength)=0;
   224 	virtual void StartRead(const TAny* aClientBuffer, TInt aLength)=0;
   232 	/// Cancel a pending read
   225 	// Cancel a pending read
   233 	/** Specifies the protocol for cancelling reading from the port. It is called by 
   226 	/** Specifies the protocol for cancelling reading from the port. It is called by 
   234 	the comms server in response to a RComm::ReadCancel() request from the client or
   227 	the comms server in response to a RComm::ReadCancel() request from the client or
   235 	when the iReadTimer timer expires.
   228 	when the iReadTimer timer expires.
   236 	
   229 	
   237 	The implementation should abort any processing which was taking place as a 
   230 	The implementation should abort any processing which was taking place as a 
   238 	result of the read request. Do not call ReadCompleted(). */
   231 	result of the read request. Do not call ReadCompleted(). */
   239 	virtual void ReadCancel()=0;
   232 	virtual void ReadCancel()=0;
   240 	/// Get the size of the receive buffer from the real serial port
   233 	// Get the size of the receive buffer from the real serial port
   241 	/** Specifies a protocol for requesting the number of bytes that are currently 
   234 	/** Specifies a protocol for requesting the number of bytes that are currently 
   242 	waiting in the port's receive buffer. It is called by the comms server in 
   235 	waiting in the port's receive buffer. It is called by the comms server in 
   243 	response to a RComm::QueryReceiveBuffer() request from the client.
   236 	response to a RComm::QueryReceiveBuffer() request from the client.
   244 	
   237 	
   245 	@param aLength On return, the number of bytes currently waiting to be read 
   238 	@param aLength On return, the number of bytes currently waiting to be read 
   246 	from the receive buffer. 
   239 	from the receive buffer. 
   247 	@return A system wide error code. */
   240 	@return A system wide error code. */
   248 	virtual TInt QueryReceiveBuffer(TInt& aLength) const=0;
   241 	virtual TInt QueryReceiveBuffer(TInt& aLength) const=0;
   249 	/// reset Tx and Rx buffers
   242 	// reset Tx and Rx buffers
   250 	/** Specifies a protocol for resetting the receive and/or transmit buffers to zero 
   243 	/** Specifies a protocol for resetting the receive and/or transmit buffers to zero 
   251 	length. It is called by the comms server in response to a RComm::ResetBuffers() 
   244 	length. It is called by the comms server in response to a RComm::ResetBuffers() 
   252 	request from the client.
   245 	request from the client.
   253 	
   246 	
   254 	@param aFlags Bitmask of the following flags: KCommResetRx to reset the receive 
   247 	@param aFlags Bitmask of the following flags: KCommResetRx to reset the receive 
   255 	buffer; KCommResetTx to reset the transmit buffer */
   248 	buffer; KCommResetTx to reset the transmit buffer */
   256 	virtual void ResetBuffers(TUint aFlags)=0;
   249 	virtual void ResetBuffers(TUint aFlags)=0;
   257 	/// Queue a write - called by CPort when client wants to write
   250 	// Queue a write - called by CPort when client wants to write
   258 	/** Specifies the protocol for writing to the port. It is called by the comms server 
   251 	/** Specifies the protocol for writing to the port. It is called by the comms server 
   259 	in response to a RComm::Write() request from the client.
   252 	in response to a RComm::Write() request from the client.
   260 	
   253 	
   261 	The implementation should use IPCRead() to get the data to write from the 
   254 	The implementation should use IPCRead() to get the data to write from the 
   262 	client's buffer. When all the data has been written, the function should call 
   255 	client's buffer. When all the data has been written, the function should call 
   264 	
   257 	
   265 	@param aClientBuffer Pointer into client address space to the descriptor containing 
   258 	@param aClientBuffer Pointer into client address space to the descriptor containing 
   266 	the client's buffer 
   259 	the client's buffer 
   267 	@param aLength The amount of data to be written */
   260 	@param aLength The amount of data to be written */
   268 	virtual void StartWrite(const TAny* aClientBuffer, TInt aLength)=0;
   261 	virtual void StartWrite(const TAny* aClientBuffer, TInt aLength)=0;
   269 	/// Cancel a pending write
   262 	// Cancel a pending write
   270 	/** Specifies the protocol for cancelling writing to the port. It is called by 
   263 	/** Specifies the protocol for cancelling writing to the port. It is called by 
   271 	the comms server in response to a RComm::WriteCancel() request from the client.
   264 	the comms server in response to a RComm::WriteCancel() request from the client.
   272 	
   265 	
   273 	The implementation should abort any processing which was taking place as a 
   266 	The implementation should abort any processing which was taking place as a 
   274 	result of the write request. Do not call WriteCompleted(). */
   267 	result of the write request. Do not call WriteCompleted(). */
   275 	virtual void WriteCancel()=0;
   268 	virtual void WriteCancel()=0;
   276 	/// Queue a break
   269 	// Queue a break
   277 	/** Specifies the protocol for setting a break condition at the port. It is called 
   270 	/** Specifies the protocol for setting a break condition at the port. It is called 
   278 	by the comms server in response to a RComm::Break() request from the client.
   271 	by the comms server in response to a RComm::Break() request from the client.
   279 	
   272 	
   280 	When the break is complete, the function should call BreakCompleted(). 
   273 	When the break is complete, the function should call BreakCompleted(). 
   281 	
   274 	
   282 	@param aTime Time period to break for in microseconds */
   275 	@param aTime Time period to break for in microseconds */
   283 	virtual void Break(TInt aTime)=0;
   276 	virtual void Break(TInt aTime)=0;
   284 	/// Cancel a pending break
   277 	// Cancel a pending break
   285 	/** Specifies the protocol for cancelling a break request. It is called by the 
   278 	/** Specifies the protocol for cancelling a break request. It is called by the 
   286 	comms server in response to a RComm::BreakCancel() request from the client.
   279 	comms server in response to a RComm::BreakCancel() request from the client.
   287 	
   280 	
   288 	The implementation should abort any processing which was taking place as a 
   281 	The implementation should abort any processing which was taking place as a 
   289 	result of the break request. Do not call BreakCompleted(). */
   282 	result of the break request. Do not call BreakCompleted(). */
   290 	virtual void BreakCancel()=0;
   283 	virtual void BreakCancel()=0;
   291 	/// Pass a config request - return in descriptor
   284 	// Pass a config request - return in descriptor
   292 	/** Specifies a protocol for getting the current configuration of the serial port. 
   285 	/** Specifies a protocol for getting the current configuration of the serial port. 
   293 	It is called by the comms server in response to a RComm::GetConfig() request 
   286 	It is called by the comms server in response to a RComm::GetConfig() request 
   294 	from the client.
   287 	from the client.
   295 	
   288 	
   296 	@param aPackage A packaged TCommConfig buffer, set on return to the current 
   289 	@param aPackage A packaged TCommConfig buffer, set on return to the current 
   297 	configuration of the serial port 
   290 	configuration of the serial port 
   298 	@return A system wide error code */
   291 	@return A system wide error code */
   299 	virtual TInt GetConfig(TDes8& aPackage) const=0;
   292 	virtual TInt GetConfig(TDes8& aPackage) const=0;
   300 	/// Set config with package in the descriptor
   293 	// Set config with package in the descriptor
   301 	/** Specifies a protocol for setting the configuration of the port. It is called 
   294 	/** Specifies a protocol for setting the configuration of the port. It is called 
   302 	by the comms server in response to a RComm::SetConfig() request from the client.
   295 	by the comms server in response to a RComm::SetConfig() request from the client.
   303 	
   296 	
   304 	@param aPackage A packaged TCommConfig buffer holding the new configuration 
   297 	@param aPackage A packaged TCommConfig buffer holding the new configuration 
   305 	values 
   298 	values 
   306 	@return A system error code */
   299 	@return A system error code */
   307 	virtual TInt SetConfig(const TDesC8& aPackage)=0;
   300 	virtual TInt SetConfig(const TDesC8& aPackage)=0;
   308 	/// Set the port to use partial reads/writes
   301 	// Set the port to use partial reads/writes
   309 	/** Specifies a protocol for setting the buffer mode. It is called by the comms 
   302 	/** Specifies a protocol for setting the buffer mode. It is called by the comms 
   310 	server in response to a RComm::SetMode() request from the client.
   303 	server in response to a RComm::SetMode() request from the client.
   311 	
   304 	
   312 	@param aPackage A TCommServerConfig package buffer holding the mode settings 
   305 	@param aPackage A TCommServerConfig package buffer holding the mode settings 
   313 	@return A system-wide error code */
   306 	@return A system-wide error code */
   314 	virtual TInt SetServerConfig(const TDesC8& aPackage)=0;
   307 	virtual TInt SetServerConfig(const TDesC8& aPackage)=0;
   315 	/// Get the server configs from the CSY
   308 	// Get the server configs from the CSY
   316 	/** Specifies a protocol for getting the buffer mode. It is called by the comms 
   309 	/** Specifies a protocol for getting the buffer mode. It is called by the comms 
   317 	server in response to a RComm::Mode() request from the client.
   310 	server in response to a RComm::Mode() request from the client.
   318 	
   311 	
   319 	@param aPackage A TCommServerConfig package buffer that, on return, holds 
   312 	@param aPackage A TCommServerConfig package buffer that, on return, holds 
   320 	the current buffer mode settings 
   313 	the current buffer mode settings 
   321 	@return A system error code */
   314 	@return A system error code */
   322 	virtual TInt GetServerConfig(TDes8& aPackage)=0;
   315 	virtual TInt GetServerConfig(TDes8& aPackage)=0;
   323 	/// Read capabilities from the driver
   316 	// Read capabilities from the driver
   324 	/** Specifies a protocol for getting the port capabilities. It is called by the 
   317 	/** Specifies a protocol for getting the port capabilities. It is called by the 
   325 	comms server in response to a RComm::Caps() request from the client.
   318 	comms server in response to a RComm::Caps() request from the client.
   326 	
   319 	
   327 	@param aPackage A TCommCaps package buffer that, on return, holds the port 
   320 	@param aPackage A TCommCaps package buffer that, on return, holds the port 
   328 	capabilities 
   321 	capabilities 
   329 	@return A system error code */
   322 	@return A system error code */
   330 	virtual TInt GetCaps(TDes8& aPackage)=0;
   323 	virtual TInt GetCaps(TDes8& aPackage)=0;
   331 	/// Get the status of the signal pins
   324 	// Get the status of the signal pins
   332 	/** Specifies a protocol for getting the status of the serial port control lines. 
   325 	/** Specifies a protocol for getting the status of the serial port control lines. 
   333 	It is called by the comms server in response to a RComm::GetSignals() request 
   326 	It is called by the comms server in response to a RComm::GetSignals() request 
   334 	from the client.
   327 	from the client.
   335 	
   328 	
   336 	@param aSignals An integer with the bits set to reflect the status of the 
   329 	@param aSignals An integer with the bits set to reflect the status of the 
   337 	handshaking lines. 
   330 	handshaking lines. 
   338 	@return A system error code */
   331 	@return A system error code */
   339 	virtual TInt GetSignals(TUint& aSignals)=0;
   332 	virtual TInt GetSignals(TUint& aSignals)=0;
   340 	/// Set selected signals to high (logical 1)
   333 	// Set selected signals to high (logical 1)
   341 	/** Specifies a protocol for setting serial port control lines. It is called by 
   334 	/** Specifies a protocol for setting serial port control lines. It is called by 
   342 	the comms server in response to a RComm::SetSignals() request from the client.
   335 	the comms server in response to a RComm::SetSignals() request from the client.
   343 	
   336 	
   344 	@param aSignals A bitmask of the handshaking lines to set 
   337 	@param aSignals A bitmask of the handshaking lines to set 
   345 	@return A system error code */
   338 	@return A system error code */
   346 	virtual TInt SetSignalsToMark(TUint aSignals)=0;
   339 	virtual TInt SetSignalsToMark(TUint aSignals)=0;
   347 	/// Set selected signals to low (logical 0)
   340 	// Set selected signals to low (logical 0)
   348 	/** Specifies a protocol for clearing serial port control lines. It is called by 
   341 	/** Specifies a protocol for clearing serial port control lines. It is called by 
   349 	the comms server in response to a RComm::SetSignals() request from the client.
   342 	the comms server in response to a RComm::SetSignals() request from the client.
   350 	
   343 	
   351 	@param aSignals A bitmask of the handshaking lines to clear 
   344 	@param aSignals A bitmask of the handshaking lines to clear 
   352 	@return A system error code */
   345 	@return A system error code */
   353 	virtual TInt SetSignalsToSpace(TUint aSignals)=0;
   346 	virtual TInt SetSignalsToSpace(TUint aSignals)=0;
   354 	/// Get size of Tx and Rx buffer
   347 	// Get size of Tx and Rx buffer
   355 	/** Specifies a protocol for requesting the size of the serial port buffers. It 
   348 	/** Specifies a protocol for requesting the size of the serial port buffers. It 
   356 	is called by the comms server in response to a RComm::ReceiveBufferLength() 
   349 	is called by the comms server in response to a RComm::ReceiveBufferLength() 
   357 	request from the client.
   350 	request from the client.
   358 	
   351 	
   359 	@param aLength The current size of the serial port buffers in bytes 
   352 	@param aLength The current size of the serial port buffers in bytes 
   360 	@return A system error code */
   353 	@return A system error code */
   361 	virtual TInt GetReceiveBufferLength(TInt& aLength) const=0;
   354 	virtual TInt GetReceiveBufferLength(TInt& aLength) const=0;
   362 	/// Set size of Tx and Rx buffer
   355 	// Set size of Tx and Rx buffer
   363 	/** Specifies a protocol for setting the size of the serial port buffers. It is 
   356 	/** Specifies a protocol for setting the size of the serial port buffers. It is 
   364 	called by the comms server in response to a RComm::SetReceiveBufferLength() 
   357 	called by the comms server in response to a RComm::SetReceiveBufferLength() 
   365 	request from the client.
   358 	request from the client.
   366 	
   359 	
   367 	@param aLength Requested size of the serial port buffers in bytes 
   360 	@param aLength Requested size of the serial port buffers in bytes 
   368 	@return A system error code */
   361 	@return A system error code */
   369 	virtual TInt SetReceiveBufferLength(TInt aLength)=0;
   362 	virtual TInt SetReceiveBufferLength(TInt aLength)=0;
   370 	virtual void FreeMemory();	// csys have their own implementation, e.g. ECUART
   363 	virtual void FreeMemory();	// csys have their own implementation, e.g. ECUART
   371 	/// Notify client when the signals change
   364 	// Notify client when the signals change
   372 	/** Specifies the protocol for setting a "signal change" notification. It is called 
   365 	/** Specifies the protocol for setting a "signal change" notification. It is called 
   373 	by the comms server in response to a RComm::NotifySignalChange() request from 
   366 	by the comms server in response to a RComm::NotifySignalChange() request from 
   374 	the client.
   367 	the client.
   375 	
   368 	
   376 	@param aSignalMask Signal mask passed by client */
   369 	@param aSignalMask Signal mask passed by client */
   377 	virtual void NotifySignalChange(TUint aSignalMask)=0;
   370 	virtual void NotifySignalChange(TUint aSignalMask)=0;
   378 	/// Cancel an outstanding signal change notification
   371 	// Cancel an outstanding signal change notification
   379 	/** Specifies the protocol for cancelling a "signal change" notification. It is called 
   372 	/** Specifies the protocol for cancelling a "signal change" notification. It is called 
   380 	by the comms server in response to a RComm::NotifySignalChangeCancel() request 
   373 	by the comms server in response to a RComm::NotifySignalChangeCancel() request 
   381 	from the client. */
   374 	from the client. */
   382 	virtual void NotifySignalChangeCancel()=0;
   375 	virtual void NotifySignalChangeCancel()=0;
   383 	/// Notify client when the configation changes
   376 	// Notify client when the configation changes
   384 	/** Specifies the protocol for setting a "configuration change" notification. It 
   377 	/** Specifies the protocol for setting a "configuration change" notification. It 
   385 	is called by the comms server in response to a RComm::NotifyConfigChange() 
   378 	is called by the comms server in response to a RComm::NotifyConfigChange() 
   386 	request from the client. */
   379 	request from the client. */
   387 	virtual void NotifyConfigChange()=0;
   380 	virtual void NotifyConfigChange()=0;
   388 	/// Cancel an outstanding config change notification
   381 	// Cancel an outstanding config change notification
   389 	/** Specifies the protocol for cancelling a "configuration change" notification. 
   382 	/** Specifies the protocol for cancelling a "configuration change" notification. 
   390 	It is called by the comms server in response to a RComm::NotifyConfigChangeCancel() 
   383 	It is called by the comms server in response to a RComm::NotifyConfigChangeCancel() 
   391 	request from the client. */
   384 	request from the client. */
   392 	virtual void NotifyConfigChangeCancel()=0;
   385 	virtual void NotifyConfigChangeCancel()=0;
   393 	/// Notify client when the flow control changes
   386 	// Notify client when the flow control changes
   394 	/** Specifies the protocol for setting a "flow control change" notification. It is 
   387 	/** Specifies the protocol for setting a "flow control change" notification. It is 
   395 	called by the comms server in response to a RComm::NotifyFlowControlChange() 
   388 	called by the comms server in response to a RComm::NotifyFlowControlChange() 
   396 	request from the client. */
   389 	request from the client. */
   397 	virtual void NotifyFlowControlChange()=0;
   390 	virtual void NotifyFlowControlChange()=0;
   398 	/// Cancel an outstanding flow control change notification
   391 	// Cancel an outstanding flow control change notification
   399 	/** Specifies the protocol for cancelling a "flow control change" notification. It 
   392 	/** Specifies the protocol for cancelling a "flow control change" notification. It 
   400 	is called by the comms server in response to a RComm::NotifyFlowControlChangeCancel() 
   393 	is called by the comms server in response to a RComm::NotifyFlowControlChangeCancel() 
   401 	request from the client. */
   394 	request from the client. */
   402 	virtual void NotifyFlowControlChangeCancel()=0;
   395 	virtual void NotifyFlowControlChangeCancel()=0;
   403 	/// Notify client when a break occurs
   396 	// Notify client when a break occurs
   404 	/** Specifies the protocol for setting a "break" notification. It is called by the 
   397 	/** Specifies the protocol for setting a "break" notification. It is called by the 
   405 	comms server in response to a RComm::NotifyBreak() request from the client. */
   398 	comms server in response to a RComm::NotifyBreak() request from the client. */
   406 	virtual void NotifyBreak()=0;
   399 	virtual void NotifyBreak()=0;
   407 	/// Cancel an outstanding break notification
   400 	// Cancel an outstanding break notification
   408 	/** Specifies the protocol for cancelling a "break" notification. It is called by 
   401 	/** Specifies the protocol for cancelling a "break" notification. It is called by 
   409 	the comms server in response to a RComm::NotifyBreakCancel() request from 
   402 	the comms server in response to a RComm::NotifyBreakCancel() request from 
   410 	the client. */
   403 	the client. */
   411 	virtual void NotifyBreakCancel()=0;
   404 	virtual void NotifyBreakCancel()=0;
   412 	/// Notify client when data is available
   405 	// Notify client when data is available
   413 	/** Specifies the protocol for setting a "data available" notification. It is called 
   406 	/** Specifies the protocol for setting a "data available" notification. It is called 
   414 	
   407 	
   415 	by the comms server in response to a RComm::NotifyDataAvailable() request 
   408 	by the comms server in response to a RComm::NotifyDataAvailable() request 
   416 	from the client. */
   409 	from the client. */
   417 	virtual void NotifyDataAvailable()=0;
   410 	virtual void NotifyDataAvailable()=0;
   418 	/// Cancel an outstanding data available notification
   411 	// Cancel an outstanding data available notification
   419 	/** Specifies the protocol for cancelling a "data available" notification. It is 
   412 	/** Specifies the protocol for cancelling a "data available" notification. It is 
   420 	called by the comms server in response to a RComm::NotifyDataAvailableCancel() 
   413 	called by the comms server in response to a RComm::NotifyDataAvailableCancel() 
   421 	request from the client. */
   414 	request from the client. */
   422 	virtual void NotifyDataAvailableCancel()=0;
   415 	virtual void NotifyDataAvailableCancel()=0;
   423 	/// Notify client when output buffer is empty
   416 	// Notify client when output buffer is empty
   424 	/** Specifies the protocol for setting a transmit buffer empty notification. It 
   417 	/** Specifies the protocol for setting a transmit buffer empty notification. It 
   425 	is called by the comms server in response to a RComm::NotifyOutputEmpty() 
   418 	is called by the comms server in response to a RComm::NotifyOutputEmpty() 
   426 	request from the client. */
   419 	request from the client. */
   427 	virtual void NotifyOutputEmpty()=0;
   420 	virtual void NotifyOutputEmpty()=0;
   428 	/// Cancel an outstanding output empty notification
   421 	// Cancel an outstanding output empty notification
   429 	/** Specifies the protocol for cancelling a transmit buffer empty notification. 
   422 	/** Specifies the protocol for cancelling a transmit buffer empty notification. 
   430 	It is called by the comms server in response to a RComm::NotifyOutputEmptyCancel() 
   423 	It is called by the comms server in response to a RComm::NotifyOutputEmptyCancel() 
   431 	request from the client. */
   424 	request from the client. */
   432 	virtual void NotifyOutputEmptyCancel()=0;
   425 	virtual void NotifyOutputEmptyCancel()=0;
   433 	/// Get the flow control status
   426 	// Get the flow control status
   434 	/** Gets flow control status. It is called by the comms server in response to a 
   427 	/** Gets flow control status. It is called by the comms server in response to a 
   435 	RComm::SetMode() request from the client.
   428 	RComm::SetMode() request from the client.
   436 	
   429 	
   437 	@param aFlowControl Flow control status to return to the client 
   430 	@param aFlowControl Flow control status to return to the client 
   438 	@return A system-wide error code */
   431 	@return A system-wide error code */
   439 	virtual TInt GetFlowControlStatus(TFlowControl& aFlowControl)=0;
   432 	virtual TInt GetFlowControlStatus(TFlowControl& aFlowControl)=0;
   440 	/// Get the role of this port unit
   433 	// Get the role of this port unit
   441 	/** Gets DCE/DTE role. It is called by the comms server in response to a RComm::GetRole() 
   434 	/** Gets DCE/DTE role. It is called by the comms server in response to a RComm::GetRole() 
   442 	request from the client.
   435 	request from the client.
   443 	
   436 	
   444 	@param aRole On return, DCE/DTE role to return to the client 
   437 	@param aRole On return, DCE/DTE role to return to the client 
   445 	@return A system-wide error code */
   438 	@return A system-wide error code */
   446 	virtual TInt GetRole(TCommRole& aRole)=0;
   439 	virtual TInt GetRole(TCommRole& aRole)=0;
   447 	/// Set the role of this port unit
   440 	// Set the role of this port unit
   448 	/** Sets DCE/DTE role. It is called by the comms server in response to a RComm::Open() 
   441 	/** Sets DCE/DTE role. It is called by the comms server in response to a RComm::Open() 
   449 	request from the client.
   442 	request from the client.
   450 	
   443 	
   451 	@param aRole DCE/DTE role 
   444 	@param aRole DCE/DTE role 
   452 	@return A system-wide error code */
   445 	@return A system-wide error code */
   458 #endif
   451 #endif
   459 private:
   452 private:
   460 	void DoOpenL(CCommSession* aSession, TInternalCommAccess aMode, TCommRole aRole,TBool aIsNew);
   453 	void DoOpenL(CCommSession* aSession, TInternalCommAccess aMode, TCommRole aRole,TBool aIsNew);
   461 	void DoPreemption();
   454 	void DoPreemption();
   462 
   455 
   463 	TDeltaTimerEntry iReadTimer;  ///< delta timer entry for read timeouts
   456 	TDeltaTimerEntry iReadTimer;  //< delta timer entry for read timeouts
   464 	TBool iReadTimerPending;      ///< true if a read timer is pending
   457 	TBool iReadTimerPending;      //< true if a read timer is pending
   465 	TDeltaTimerEntry iWriteTimer; ///< delta timer entry for write timeouts
   458 	TDeltaTimerEntry iWriteTimer; //< delta timer entry for write timeouts
   466 	TBool iWriteTimerPending;     ///< true if a write timer is pending
   459 	TBool iWriteTimerPending;     //< true if a write timer is pending
   467 	TInternalCommAccess iMode;    ///< access mode for this port
   460 	TInternalCommAccess iMode;    //< access mode for this port
   468 	CCommSession* iReadOwner;     ///< pointer to the read session
   461 	CCommSession* iReadOwner;     //< pointer to the read session
   469 	TInt iReadOwnerHandle;        ///< handle to the read session
   462 	TInt iReadOwnerHandle;        //< handle to the read session
   470 	CCommSession* iWriteOwner;    ///< pointer to the write session
   463 	CCommSession* iWriteOwner;    //< pointer to the write session
   471 	TInt iWriteOwnerHandle;       ///< handle to the write session
   464 	TInt iWriteOwnerHandle;       //< handle to the write session
   472 	// Binary compatible
   465 	// Binary compatible
   473 	// Was: CCommSession* iBreakOwner;  Replace with:
   466 	// Was: CCommSession* iBreakOwner;  Replace with:
   474 	CExtra* iExtra;               ///< pointer to the CExtra object for pre-emptable handling
   467 	CExtra* iExtra;               //< pointer to the CExtra object for pre-emptable handling
   475 #define iBreakOwner (iExtra->iBreakOwner) ///< forwards iBreakOwner to iExtra->iBreakOwner
   468 #define iBreakOwner (iExtra->iBreakOwner) //< forwards iBreakOwner to iExtra->iBreakOwner
   476 
   469 
   477 	TInt iBreakOwnerHandle;                  ///< handle to the break owner
   470 	TInt iBreakOwnerHandle;                  //< handle to the break owner
   478 	CCommSession* iSignalOwner;              ///< pointer to the signal session
   471 	CCommSession* iSignalOwner;              //< pointer to the signal session
   479 	TInt iSignalOwnerHandle;                 ///< handle to the signal session
   472 	TInt iSignalOwnerHandle;                 //< handle to the signal session
   480 	CCommSession* iFlowControlOwner;         ///< pointer to the flow control session
   473 	CCommSession* iFlowControlOwner;         //< pointer to the flow control session
   481 	TInt iFlowControlOwnerHandle;            ///< handle to the flow control session
   474 	TInt iFlowControlOwnerHandle;            //< handle to the flow control session
   482 	CCommSession* iConfigOwner;              ///< pointer to the config session
   475 	CCommSession* iConfigOwner;              //< pointer to the config session
   483 	TInt iConfigOwnerHandle;                 ///< handle to the config session
   476 	TInt iConfigOwnerHandle;                 //< handle to the config session
   484 	CCommSession* iBreakNotifyOwner;         ///< pointer to the break notify session
   477 	CCommSession* iBreakNotifyOwner;         //< pointer to the break notify session
   485 	TInt iBreakNotifyOwnerHandle;            ///< handle to the break notify session
   478 	TInt iBreakNotifyOwnerHandle;            //< handle to the break notify session
   486 	CCommSession* iNotifyDataAvailableOwner; ///< pointer to the data available session
   479 	CCommSession* iNotifyDataAvailableOwner; //< pointer to the data available session
   487 	TInt iNotifyDataAvailableOwnerHandle;    ///< handle to the data available session
   480 	TInt iNotifyDataAvailableOwnerHandle;    //< handle to the data available session
   488 	CCommSession* iNotifyOutputEmptyOwner;   ///< pointer to the output empty session
   481 	CCommSession* iNotifyOutputEmptyOwner;   //< pointer to the output empty session
   489 	TInt iNotifyOutputEmptyOwnerHandle;      ///< handle to the output empty session
   482 	TInt iNotifyOutputEmptyOwnerHandle;      //< handle to the output empty session
   490 
   483 
   491 	RMessagePtr2 iBlockedRead;                ///< pointer to the read request message
   484 	RMessagePtr2 iBlockedRead;                //< pointer to the read request message
   492 	RMessagePtr2 iBlockedWrite;               ///< pointer to the write request message
   485 	RMessagePtr2 iBlockedWrite;               //< pointer to the write request message
   493 	RMessagePtr2 iBlockedBreak;               ///< pointer to the break request message
   486 	RMessagePtr2 iBlockedBreak;               //< pointer to the break request message
   494 
   487 
   495 	/**The encapsulated message*/
   488 	/**The encapsulated message*/
   496 	RMessagePtr2 iBlockedSignalChange;			///< holds the notify signal change message
   489 	RMessagePtr2 iBlockedSignalChange;			//< holds the notify signal change message
   497 	/**Private padding to preserve BC with earlier versions*/
   490 	/**Private padding to preserve BC with earlier versions*/
   498 	TInt iBlockedSignalChangeDummyPadding[7];
   491 	TInt iBlockedSignalChangeDummyPadding[7];
   499 
   492 
   500 	/**The encapsulated message*/
   493 	/**The encapsulated message*/
   501 	RMessagePtr2 iBlockedConfigChange;			///< holds the notify config change message
   494 	RMessagePtr2 iBlockedConfigChange;			//< holds the notify config change message
   502 	/**Private padding to preserve BC with earlier versions*/
   495 	/**Private padding to preserve BC with earlier versions*/
   503 	TInt iBlockedConfigChangeDummyPadding[7];
   496 	TInt iBlockedConfigChangeDummyPadding[7];
   504 
   497 
   505 	/**The encapsulated message*/
   498 	/**The encapsulated message*/
   506 	RMessagePtr2 iBlockedFlowControlChange;		///< holds the notify flow control change message
   499 	RMessagePtr2 iBlockedFlowControlChange;		//< holds the notify flow control change message
   507 	/**Private padding to preserve BC with earlier versions*/
   500 	/**Private padding to preserve BC with earlier versions*/
   508 	TInt iBlockedFlowControlChangeDummyPadding[7];
   501 	TInt iBlockedFlowControlChangeDummyPadding[7];
   509 
   502 
   510 	RMessagePtr2 iBlockedBreakNotify;         ///< pointer to the notify break request message
   503 	RMessagePtr2 iBlockedBreakNotify;         //< pointer to the notify break request message
   511 	RMessagePtr2 iBlockedNotifyDataAvailable; ///< pointer to the notify data available request message
   504 	RMessagePtr2 iBlockedNotifyDataAvailable; //< pointer to the notify data available request message
   512 	RMessagePtr2 iBlockedNotifyOutputEmpty;   ///< pointer to the notify output empty request message
   505 	RMessagePtr2 iBlockedNotifyOutputEmpty;   //< pointer to the notify output empty request message
   513 
   506 
   514 	CPortManager* iPortManager;              ///< Not Used. Not to be exposed to deriving classes of CPort.
   507 	CPortManager* iPortManager;              //< Not Used. Not to be exposed to deriving classes of CPort.
   515 	IMPORT_C virtual void CPort_Reserved1();
   508 	IMPORT_C virtual void CPort_Reserved1();
   516 	TAny* iCPort_Reserved;                   ///< reserved pointer
   509 	TAny* iCPort_Reserved;                   //< reserved pointer
   517 	};
   510 	};
   518 
   511 
   519 
   512 
   520 //
   513 //
   521 // forward declaration
   514 // forward declaration
   553 public:
   546 public:
   554 	//
   547 	//
   555 	// pure virtuals to be implemented by the CSY
   548 	// pure virtuals to be implemented by the CSY
   556 	//
   549 	//
   557 
   550 
   558 	/// Create a new port for the supplied unit number
   551 	// Create a new port for the supplied unit number
   559 	/** Specifies the protocol for creating a new serial port for the protocol. The 
   552 	/** Specifies the protocol for creating a new serial port for the protocol. The 
   560 	comms server calls this function in response to a RComm:Open() call.
   553 	comms server calls this function in response to a RComm:Open() call.
   561 	
   554 	
   562 	Typically, the implementation would call NewL() on the protocol's CPort-based 
   555 	Typically, the implementation would call NewL() on the protocol's CPort-based 
   563 	class. Any resources required by the new port object should be done at this 
   556 	class. Any resources required by the new port object should be done at this 
   572 	that has already been created and not destroyed, NewPortL() should leave with 
   565 	that has already been created and not destroyed, NewPortL() should leave with 
   573 	KErrAlreadyExists.
   566 	KErrAlreadyExists.
   574 	
   567 	
   575 	@param aUnit The unit number to be created. */
   568 	@param aUnit The unit number to be created. */
   576 	virtual CPort* NewPortL(const TUint aUnit)=0;
   569 	virtual CPort* NewPortL(const TUint aUnit)=0;
   577 	/// Get info about this CSY, fill in the supplied structure.
   570 	// Get info about this CSY, fill in the supplied structure.
   578 	/** Specifies the protocol for getting the information about the serial protocol.
   571 	/** Specifies the protocol for getting the information about the serial protocol.
   579 	
   572 	
   580 	Implementations should fill in the TSerialInfo structure to reflect the protocol's 
   573 	Implementations should fill in the TSerialInfo structure to reflect the protocol's 
   581 	capabilities.
   574 	capabilities.
   582 	
   575 	
   589 	IMPORT_C virtual TSecurityPolicy PortPlatSecCapability(TUint aPort) const;
   582 	IMPORT_C virtual TSecurityPolicy PortPlatSecCapability(TUint aPort) const;
   590 
   583 
   591 protected:
   584 protected:
   592 	/** Module version number. The class should initialise this member with its version 
   585 	/** Module version number. The class should initialise this member with its version 
   593 	number from its constructor. */
   586 	number from its constructor. */
   594 	TVersion iVersion;                         ///< holds the version of the CSY
   587 	TVersion iVersion;                         //< holds the version of the CSY
   595 private:
   588 private:
   596 	CLibUnloader* iLibUnloader;                ///< pointer to the library unloader
   589 	CLibUnloader* iLibUnloader;                //< pointer to the library unloader
   597 	IMPORT_C virtual void CSerial_Reserved1();
   590 	IMPORT_C virtual void CSerial_Reserved1();
   598 	TAny* iCSerial_Reserved;                   ///< reserved pointer for future BC
   591 	TAny* iCSerial_Reserved;                   //< reserved pointer for future BC
   599 	};
   592 	};
   600 
   593 
   601 /** This typedef defines the form of the ordinal-1 entry point function to a serial 
   594 /** This typedef defines the form of the ordinal-1 entry point function to a serial 
   602 protocol module. The function should create and return a concrete CSerial-derived 
   595 protocol module. The function should create and return a concrete CSerial-derived 
   603 class, which will then be used by the comms server.
   596 class, which will then be used by the comms server.
   604 
   597 
   605 Each serial protocol module should only ever create a single serial protocol 
   598 Each serial protocol module should only ever create a single serial protocol 
   606 factory object. If the entry point is called twice without the first factory 
   599 factory object. If the entry point is called twice without the first factory 
   607 object being destroyed, this function should leave with KErrGeneral. */
   600 object being destroyed, this function should leave with KErrGeneral. */
   608 typedef CSerial *(*TSerialNewL)(); ///< function type of CSY module entry point
   601 typedef CSerial *(*TSerialNewL)(); //< function type of CSY module entry point
   609 
   602 
   610 #endif // CS_PORT_H
   603 #endif // CS_PORT_H