kernel/eka/include/drivers/usbc.h
changeset 10 36bfc973b146
parent 9 96e5fb8b040d
equal deleted inserted replaced
9:96e5fb8b040d 10:36bfc973b146
    77 public:
    77 public:
    78 	TDmaBuf();
    78 	TDmaBuf();
    79  	TDmaBuf(TUsbcEndpointInfo* aEndpointInfo, TInt aBandwidthPriority);
    79  	TDmaBuf(TUsbcEndpointInfo* aEndpointInfo, TInt aBandwidthPriority);
    80 	~TDmaBuf();
    80 	~TDmaBuf();
    81 	TInt Construct(TUsbcEndpointInfo* aEndpointInfo);
    81 	TInt Construct(TUsbcEndpointInfo* aEndpointInfo);
    82 	TUint8* SetBufferBase(TUint8* aBase);
       
    83 	TInt BufferTotalSize() const;
    82 	TInt BufferTotalSize() const;
    84 	TUint8* BufferBase() const;
    83 	TInt BufferSize() const;
       
    84 	TInt SetBufferAddr(TInt aBufInd, TUint8* aBufAddr);
       
    85 	TInt BufferNumber() const;
    85 	void SetMaxPacketSize(TInt aSize);
    86 	void SetMaxPacketSize(TInt aSize);
    86 	void Flush();
    87 	void Flush();
    87 	// Rx (OUT) variants
    88 	// Rx (OUT) variants
    88 	void RxSetActive();
    89 	void RxSetActive();
    89 	void RxSetInActive();
    90 	void RxSetInActive();
   188 	void SetMaxPacketSize(TInt aSize);
   189 	void SetMaxPacketSize(TInt aSize);
   189 	void CancelTransfer(DThread* aThread, TClientBuffer *aTcb);
   190 	void CancelTransfer(DThread* aThread, TClientBuffer *aTcb);
   190 	void AbortTransfer();
   191 	void AbortTransfer();
   191 	inline TUsbcEndpointInfo* EndpointInfo();
   192 	inline TUsbcEndpointInfo* EndpointInfo();
   192 	inline TInt RxBytesAvailable() const;
   193 	inline TInt RxBytesAvailable() const;
   193 	inline TInt BufferTotalSize() const;
   194 
   194 	inline TUint8* SetBufferBase(TUint8* aBase);
   195 	inline TInt BufferSize() const;
       
   196 	inline TInt SetBufferAddr( TInt aBufInd, TUint8* aAddr);
       
   197 	inline TInt BufferNumber() const;
       
   198 
   195 	inline void SetTransferInfo(TEndpointTransferInfo* aTransferInfo);
   199 	inline void SetTransferInfo(TEndpointTransferInfo* aTransferInfo);
   196 	inline void ResetTransferInfo();
   200 	inline void ResetTransferInfo();
   197 	inline void SetClientReadPending(TBool aVal);
   201 	inline void SetClientReadPending(TBool aVal);
   198 	inline void SetClientWritePending(TBool aVal);
   202 	inline void SetClientWritePending(TBool aVal);
   199 	inline TBool ClientWritePending();
   203 	inline TBool ClientWritePending();
   237 
   241 
   238 public:
   242 public:
   239 	TUsbcAlternateSettingList* iNext;
   243 	TUsbcAlternateSettingList* iNext;
   240 	TInt iNumberOfEndpoints;
   244 	TInt iNumberOfEndpoints;
   241 	TUint iSetting;
   245 	TUint iSetting;
       
   246 	TInt iEpNumDeOrderedByBufSize[KMaxEndpointsPerClient + 1];
   242 	TUsbcEndpoint* iEndpoint[KMaxEndpointsPerClient + 1];
   247 	TUsbcEndpoint* iEndpoint[KMaxEndpointsPerClient + 1];
   243 	};
   248 	};
   244 
   249 
   245 
   250 
   246 struct TClientAsynchNotify
   251 struct TClientAsynchNotify
   300 	TInt EpFromAlternateSetting(TUint aAlternateSetting, TInt aEndpoint);
   305 	TInt EpFromAlternateSetting(TUint aAlternateSetting, TInt aEndpoint);
   301 	TInt ProcessAlternateSetting(TUint aAlternateSetting);
   306 	TInt ProcessAlternateSetting(TUint aAlternateSetting);
   302 	TInt ProcessDeviceState(TUsbcDeviceState aDeviceState);
   307 	TInt ProcessDeviceState(TUsbcDeviceState aDeviceState);
   303 	void ResetInterface(TInt aErrorCode);
   308 	void ResetInterface(TInt aErrorCode);
   304 	void AbortInterface();
   309 	void AbortInterface();
   305 	void RebaseInterfaceMemory(TUsbcAlternateSettingList* aAlternateSettingListRec, TUint8* aBase,
   310 	// Set buffer address of the interface
   306 							   TUint aDirection);
   311 	void ReSetInterfaceMemory(TUsbcAlternateSettingList* aAlternateSettingListRec,
       
   312 	        RArray<DPlatChunkHw*> &aHwChunks );
   307 	void UpdateEndpointSizes();
   313 	void UpdateEndpointSizes();
   308 	DPlatChunkHw* SetupInterfaceMemory(TInt aBufferSize, DPlatChunkHw* aHwChunk, TUint aDirection,
   314 	// Check and alloc memory for the interface
   309 									   TUint32 aCacheAttribs);
   315 	TInt SetupInterfaceMemory(RArray<DPlatChunkHw*> &aHwChunks, 
       
   316 	        TUint32 aCacheAttribs );
   310 	void PanicClientThread(TInt aReason);
   317 	void PanicClientThread(TInt aReason);
   311 
       
   312 	TInt PinMemory(TDesC8 *aDes, TVirtualPinObject *iPinObj); //Descriptor pinning helper.
   318 	TInt PinMemory(TDesC8 *aDes, TVirtualPinObject *iPinObj); //Descriptor pinning helper.
   313 	void CompleteBufferRequest(DThread* aThread, TInt aReqNo, TInt aReason);
   319 	void CompleteBufferRequest(DThread* aThread, TInt aReqNo, TInt aReason);
   314 private:
   320 private:
   315 	DUsbClientController* iController;
   321 	DUsbClientController* iController;
   316 	DThread* iClient;
   322 	DThread* iClient;
   324 	TUsbcStatusCallback iStatusCallbackInfo;
   330 	TUsbcStatusCallback iStatusCallbackInfo;
   325 	TAny* iEndpointStatusChangePtr;
   331 	TAny* iEndpointStatusChangePtr;
   326 	TUsbcEndpointStatusCallback iEndpointStatusCallbackInfo;
   332 	TUsbcEndpointStatusCallback iEndpointStatusCallbackInfo;
   327 	TAny* iOtgFeatureChangePtr;
   333 	TAny* iOtgFeatureChangePtr;
   328 	TUsbcOtgFeatureCallback iOtgFeatureCallbackInfo;
   334 	TUsbcOtgFeatureCallback iOtgFeatureCallbackInfo;
   329 	TUint8* iBufferBaseEp0;
       
   330 	TInt iBufferSizeEp0;
       
   331 	TInt iNumberOfEndpoints;
   335 	TInt iNumberOfEndpoints;
   332 	DPlatChunkHw* iHwChunkIN;
   336     RArray<DPlatChunkHw*> iHwChunksEp0;
   333 	DPlatChunkHw* iHwChunkOUT;
   337     RArray<DPlatChunkHw*> iHwChunks;
   334 	DPlatChunkHw* iHwChunkEp0;
   338 
   335 	TUsbcDeviceState iDeviceState;
   339 	TUsbcDeviceState iDeviceState;
   336 	TUsbcDeviceState iOldDeviceState;
   340 	TUsbcDeviceState iOldDeviceState;
   337 	TBool iOwnsDeviceControl;
   341 	TBool iOwnsDeviceControl;
   338 	TUint iAlternateSetting;
   342 	TUint iAlternateSetting;
   339 	TBool iDeviceStatusNeeded;
   343 	TBool iDeviceStatusNeeded;