TEndpointBuffer Class Reference

class TEndpointBuffer

This class forms part of the Buffer Interface Layer (BIL), which forms the user side component of the USB Shared Chunk Client. Objects of this type represent the shared chunk buffer, for a given endpoint. The method RDevUsbcScClient::OpenEndpoint() should be used to initialise objects of this type.

Constructor & Destructor Documentation

TEndpointBuffer()

IMPORT_C TEndpointBuffer ( )

Member Functions Documentation

Close()

IMPORT_C TInt Close ( )

This method closes the endpoint, after it was opened with RDevUsbcScClient::OpenEndpoint (...). No method of this object can be used after this call, until RDevUsbcScClient::OpenEndpoint (...) is called on it again.

Closes the endpoint buffer

Construct(RDevUsbcScClient *, TUint8 *, const TUsbcScHdrEndpointRecord *, TInt, SUsbcScBufferHeader *)

void Construct ( RDevUsbcScClient * aClient,
TUint8 * aBaseAddr,
const TUsbcScHdrEndpointRecord * aEpType,
TInt aEndpointNumber,
SUsbcScBufferHeader * aEndpointHdr = NULL
) [private]

Parameters

RDevUsbcScClient * aClient
TUint8 * aBaseAddr
const TUsbcScHdrEndpointRecord * aEpType
TInt aEndpointNumber
SUsbcScBufferHeader * aEndpointHdr = NULL

Dump()

IMPORT_C void Dump ( )

Expire()

IMPORT_C TInt Expire ( )

Used in conjunction with TakeBuffer method. This will make the 'oldest' block of data previously read out using the TakeBuffer method, but not already expired, to be released back to the system. This block can then be overwritten with new data, when it becomes available.

Expire(TAny *)

IMPORT_C TInt Expire ( TAny * aAddress )

Used in conjunction with TakeBuffer method. This function allows blocks to be expired in a different order from which the user read the data out of the buffer. Note that the system will only reuse blocks up to the point of the oldest non-expired block read. This means that the user must ensure to expire all blocks in a timely manner to prevent the system from running out of usable memory.

Parameters

TAny * aAddress aAddress is the start address of the block of data previously read by the user which can be overwritten.

GetBuffer(TAny *&, TUint &, TBool &, TRequestStatus &, TUint)

IMPORT_C TInt GetBuffer ( TAny *& aBuffer,
TUint & aSize,
TBool & aZLP,
TRequestStatus & aStatus,
TUint aLength = 0
)

Read the next block of data from the Shared chunk buffer. This method should be used if the user wishes to process one block of data at a time. This method also expires the previously read block, meaning that the memory used by the block of data may be re-used by the system, overwriting it with new data.

Parameters

TAny *& aBuffer aBuffer will point to data location in shared chunk
TUint & aSize aSize will hold the number of valid bytes that can be read
TBool & aZLP aZLP will indicate whether its a short packet or not
TRequestStatus & aStatus In case of no data available to be read, aStatus will be passed on to LDD, and user side should wait for asynchronous call ReadDataNotify to return
TUint aLength = 0 Not used at the moment

GetBuffer(TUint &, TUint &, TBool &, TRequestStatus &, TUint)

TInt GetBuffer ( TUint & aOffset,
TUint & aSize,
TBool & aZLP,
TRequestStatus & aStatus,
TUint aLength = 0
) [inline]

Read the next block of data from the Shared chunk buffer. This method should be used if the user wishes to process one block of data at a time. This method also expires the previously read block, meaning that the memory used by the block of data may be re-used by the system, overwriting it with new data.

Parameters

TUint & aOffset aOffset will point to data offset in shared chunk
TUint & aSize aSize will hold the number of valid bytes that can be read
TBool & aZLP aZLP will indicate whether its a short packet or not
TRequestStatus & aStatus In case of no data available to be read, aStatus will be passed on to LDD, and user side should wait for asynchronous call ReadDataNotify to return
TUint aLength = 0 Not used at the moment

GetEndpointNumber()

TInt GetEndpointNumber ( ) [inline]

Used to retrieve the endpoint number for which this object was open on.

GetInBufferRange(TAny *&, TUint &)

IMPORT_C TInt GetInBufferRange ( TAny *& aStart,
TUint & aSize
)

For IN endpoints, this method retrieves the geometry for the buffer, for which the caller should stay within, when using the WriteBuffer method.

Parameters

TAny *& aStart A pointer, which is set to point to the start of the buffer.
TUint & aSize An TUint for which the size (in bytes) of buffer, is written into.

GetInBufferRange(TUint &, TUint &)

IMPORT_C TInt GetInBufferRange ( TUint & aStart,
TUint & aSize
)

For IN endpoints, this method retrieves the geometry for the buffer, for which the caller should stay within, when using the WriteBuffer method.

Parameters

TUint & aStart A TUint for which the buffer's start offset from the start of the chunk, in written into.
TUint & aSize An TUint for which the size (in bytes) of buffer, is written into.

TakeBuffer(TAny *&, TUint &, TBool &, TRequestStatus &, TUint)

IMPORT_C TInt TakeBuffer ( TAny *& aBuffer,
TUint & aSize,
TBool & aZLP,
TRequestStatus & aStatus,
TUint aLength = 0
)

Read the next block of data from the Shared chunk buffer. This method should be used if the user wishes to process more than one block of data simultaneously. The user must call one of the Expire() methods to free the memory used by the block of data, and make it available for new data.

Parameters

TAny *& aBuffer aBuffer will point to data location in shared chunk
TUint & aSize aSize will hold the number of valid bytes that can be read
TBool & aZLP aZLP will indicate whether its a short packet or not
TRequestStatus & aStatus In case of no data available to be read, aStatus will be passed on to LDD, and user side should wait for asynchronous call ReadDataNotify to return
TUint aLength = 0 Not used at the moment

WriteBuffer(TAny *, TUint, TBool, TRequestStatus &)

IMPORT_C TInt WriteBuffer ( TAny * aBuffer,
TUint aSize,
TBool aZLP,
TRequestStatus & aStatus
)

Initiates write operation.

Parameters

TAny * aBuffer aBuffer will point to data in shared chunk to be written out. aBuffer should be aligned
TUint aSize aSize will hold the number of valid bytes to be written out
TBool aZLP aZLP will indicate whether a ZLP should be transmitted after writing the data out
TRequestStatus & aStatus This is an asynchronous function and user side should wait on status to know the end of write operation

WriteBuffer(TUint, TUint, TBool, TRequestStatus &)

IMPORT_C TInt WriteBuffer ( TUint aOffset,
TUint aSize,
TBool aZLP,
TRequestStatus & aStatus
)

Initiates write operation.

Parameters

TUint aOffset aOffset will point to offset of data in shared chunk to be written out.
TUint aSize aSize will hold the number of valid bytes to be written out
TBool aZLP aZLP will indicate whether a ZLP should be transmitted after writing the data out
TRequestStatus & aStatus This is an asynchronous function and user side should wait on status to know the end of write operation

Member Enumerations Documentation

Enum TDir

Enumerators

EValid = KErrNone
ENotValid = KErrNotSupported
EEOF = KErrEof

Member Data Documentation

const TInt KStateChange

const TInt KStateChange [static]

This return value used by GetBuffer indicates that the item pointed to by aBuffer/aOffset represents a state change, instead of endpoint data.

TUint iBaseAddr

TUint iBaseAddr [private]

Parent RDevUsbcScClient object

TInt iBufferNum

TInt iBufferNum [private]

associated endpoint number

TUint8 * iBufferStartAddr

TUint8 * iBufferStartAddr [private]

Pointer to the buffer Header for OUT/BI endpoints

RDevUsbcScClient * iClient

RDevUsbcScClient * iClient [private]

buffer number within shared chunk

SUsbcScBufferHeader * iEndpointHdr

SUsbcScBufferHeader * iEndpointHdr [private]

The address of the beginning of the Ldd's chunk

TInt iEndpointNumber

TInt iEndpointNumber [private]

describes state of endpoint, KErrNone if OUT endpoint and ready to use, KErrNotSupportd if not an OUT endpoint, KErrEoF on alternate setting change

TDir iInState

TDir iInState [private]

TDir iOutState

TDir iOutState [private]

describes state of endpoint, KErrNone if IN endpoint and ready to use, KErrNotSupportd if not an IN endpoint, KErrEof on alternate setting change

TUint iSize

TUint iSize [private]

IN/BI endpoint buffer start address within shared chunk