kerneltest/e32test/iic/t_iic.h
branchRCL_3
changeset 257 3e88ff8f41d5
parent 256 c1f20ce4abcf
equal deleted inserted replaced
256:c1f20ce4abcf 257:3e88ff8f41d5
   215 // 31:29 - HS Master address (I2C only)
   215 // 31:29 - HS Master address (I2C only)
   216 // 28    - HS address valid bit
   216 // 28    - HS address valid bit
   217 // 27:23 - Reserved
   217 // 27:23 - Reserved
   218 // 22:20 - Bus type
   218 // 22:20 - Bus type
   219 // 19:15 - Channel number
   219 // 19:15 - Channel number
   220 // 14:10 - Transaction speed	// deprecated
   220 // 14:10 - Transaction speed
   221 //  9:0  - Slave address
   221 //  9:0  - Slave address
   222 #define HS_MASTER_ADDR_SHIFT 29
   222 #define HS_MASTER_ADDR_SHIFT 29
   223 #define HS_MASTER_ADDR_MASK 0x7
   223 #define HS_MASTER_ADDR_MASK 0x7
   224 #define HS_ADDR_VALID_SHIFT 28
   224 #define HS_ADDR_VALID_SHIFT 28
   225 #define HS_ADDR_VALID_MASK 0x1
   225 #define HS_ADDR_VALID_MASK 0x1
   226 #define BUS_TYPE_SHIFT 20
   226 #define BUS_TYPE_SHIFT 20
   227 #define BUS_TYPE_MASK 0x7
   227 #define BUS_TYPE_MASK 0x7
   228 #define CHANNEL_NO_SHIFT 15
   228 #define CHANNEL_NO_SHIFT 15
   229 #define CHANNEL_NO_MASK 0x1F
   229 #define CHANNEL_NO_MASK 0x1F
   230 //#define TRANS_SPEED_SHIFT 10
   230 #define TRANS_SPEED_SHIFT 10
   231 //#define TRANS_SPEED_MASK 0x1F
   231 #define TRANS_SPEED_MASK 0x1F
   232 #define SLAVE_ADDR_SHIFT 0
   232 #define SLAVE_ADDR_SHIFT 0
   233 #define SLAVE_ADDR_MASK 0x3FF
   233 #define SLAVE_ADDR_MASK 0x3FF
   234 //
   234 //
   235 // Macros to access fields within Bus Realisation Configuration data, used on a per-transaction basis with IIC
   235 // Macros to access fields within Bus Realisation Configuration data, used on a per-transaction basis with IIC
   236 #define SET_CONFIG_FIELD(aBusId,aField,aMask,aShift) aBusId=(aBusId&~(aMask<<aShift))|((aField&aMask)<<aShift);
   236 #define SET_CONFIG_FIELD(aBusId,aField,aMask,aShift) aBusId=(aBusId&~(aMask<<aShift))|((aField&aMask)<<aShift);
   242 #define SET_HS_VALID(aBusId,aHsValid) SET_CONFIG_FIELD(aBusId,aHsValid,HS_ADDR_VALID_MASK,HS_ADDR_VALID_SHIFT)
   242 #define SET_HS_VALID(aBusId,aHsValid) SET_CONFIG_FIELD(aBusId,aHsValid,HS_ADDR_VALID_MASK,HS_ADDR_VALID_SHIFT)
   243 #define GET_BUS_TYPE(aBusId) GET_CONFIG_FIELD(aBusId,BUS_TYPE_MASK,BUS_TYPE_SHIFT)
   243 #define GET_BUS_TYPE(aBusId) GET_CONFIG_FIELD(aBusId,BUS_TYPE_MASK,BUS_TYPE_SHIFT)
   244 #define SET_BUS_TYPE(aBusId,aBusType) SET_CONFIG_FIELD(aBusId,aBusType,BUS_TYPE_MASK,BUS_TYPE_SHIFT)
   244 #define SET_BUS_TYPE(aBusId,aBusType) SET_CONFIG_FIELD(aBusId,aBusType,BUS_TYPE_MASK,BUS_TYPE_SHIFT)
   245 #define GET_CHAN_NUM(aBusId) GET_CONFIG_FIELD(aBusId,CHANNEL_NO_MASK,CHANNEL_NO_SHIFT)
   245 #define GET_CHAN_NUM(aBusId) GET_CONFIG_FIELD(aBusId,CHANNEL_NO_MASK,CHANNEL_NO_SHIFT)
   246 #define SET_CHAN_NUM(aBusId,aChanNum) SET_CONFIG_FIELD(aBusId,aChanNum,CHANNEL_NO_MASK,CHANNEL_NO_SHIFT)
   246 #define SET_CHAN_NUM(aBusId,aChanNum) SET_CONFIG_FIELD(aBusId,aChanNum,CHANNEL_NO_MASK,CHANNEL_NO_SHIFT)
   247 //#define SET_TRANS_SPEED(aBusId,aTransSpeed) SET_CONFIG_FIELD(aBusId,aTransSpeed,TRANS_SPEED_MASK,TRANS_SPEED_SHIFT)
   247 #define SET_TRANS_SPEED(aBusId,aTransSpeed) SET_CONFIG_FIELD(aBusId,aTransSpeed,TRANS_SPEED_MASK,TRANS_SPEED_SHIFT)
   248 //#define GET_TRANS_SPEED(aBusId) GET_CONFIG_FIELD(aBusId,TRANS_SPEED_MASK,TRANS_SPEED_SHIFT)
   248 #define GET_TRANS_SPEED(aBusId) GET_CONFIG_FIELD(aBusId,TRANS_SPEED_MASK,TRANS_SPEED_SHIFT)
   249 #define SET_SLAVE_ADDR(aBusId,aSlaveAddr) SET_CONFIG_FIELD(aBusId,aSlaveAddr,SLAVE_ADDR_MASK,SLAVE_ADDR_SHIFT)
   249 #define SET_SLAVE_ADDR(aBusId,aSlaveAddr) SET_CONFIG_FIELD(aBusId,aSlaveAddr,SLAVE_ADDR_MASK,SLAVE_ADDR_SHIFT)
   250 #define GET_SLAVE_ADDR(aBusId) GET_CONFIG_FIELD(aBusId,SLAVE_ADDR_MASK,SLAVE_ADDR_SHIFT)
   250 #define GET_SLAVE_ADDR(aBusId) GET_CONFIG_FIELD(aBusId,SLAVE_ADDR_MASK,SLAVE_ADDR_SHIFT)
   251 
   251 
   252 static const TUint8 KTransactionWithPreamble = 0x80;
   252 static const TUint8 KTransactionWithPreamble = 0x80;
   253 static const TUint8 KTransactionWithMultiTransc = 0x40;
   253 static const TUint8 KTransactionWithMultiTransc = 0x40;
   299 		EInitSlaveClient,					/**< Instigate Slave initialisation required to support testing	*/
   299 		EInitSlaveClient,					/**< Instigate Slave initialisation required to support testing	*/
   300 		ECaptureChanSync,					/**< Capture Channel (Synchronous version)						*/
   300 		ECaptureChanSync,					/**< Capture Channel (Synchronous version)						*/
   301 		EReleaseChan,						/**< ReleaseChannel												*/
   301 		EReleaseChan,						/**< ReleaseChannel												*/
   302 		ERegisterRxBuffer,					/**< Register a buffer for receiving data						*/
   302 		ERegisterRxBuffer,					/**< Register a buffer for receiving data						*/
   303 		ERegisterTxBuffer,					/**< Register a buffer for transmitting data					*/
   303 		ERegisterTxBuffer,					/**< Register a buffer for transmitting data					*/
   304 		ESetNotifTrigger,					/**< Set the notification triggers                               */
   304 		ESetNotifTrigger					/**< Set the notification triggers                               */									
   305 		ETestSpare1,
       
   306 		ETestStaticEx
       
   307 		};
   305 		};
   308 
   306 
   309 	enum TStaticExt
   307 	enum TStaticExt
   310 		{
   308 		{
   311 		ECtlIoNone = 0,
   309 		ECtlIoNone = 0,
   375 	inline TInt CaptureChannel(TInt aBusId, TDes8* aConfigHdr, TInt& aChannelId, TRequestStatus& aStatus) {TInt* parms[2]; parms[0]=(TInt*)aBusId; parms[1]=&aChannelId;DoRequest(ECaptureChanAsync,aStatus,(TAny*)aConfigHdr,(TAny*)(&parms[0]));return KErrNone;}
   373 	inline TInt CaptureChannel(TInt aBusId, TDes8* aConfigHdr, TInt& aChannelId, TRequestStatus& aStatus) {TInt* parms[2]; parms[0]=(TInt*)aBusId; parms[1]=&aChannelId;DoRequest(ECaptureChanAsync,aStatus,(TAny*)aConfigHdr,(TAny*)(&parms[0]));return KErrNone;}
   376 
   374 
   377 	inline TInt ReleaseChannel(TInt aChannelId){return(DoControl(EReleaseChan,(TAny*)aChannelId,NULL));};
   375 	inline TInt ReleaseChannel(TInt aChannelId){return(DoControl(EReleaseChan,(TAny*)aChannelId,NULL));};
   378 	inline TInt RegisterRxBuffer(TInt aChannelId, TInt8 aBufGranularity, TInt8 aNumWords, TInt8 aOffset){TInt8 parms[3]; parms[0]=aBufGranularity; parms[1]=aNumWords; parms[2]=aOffset;return(DoControl(ERegisterRxBuffer,(TAny*)aChannelId,(TAny*)(&parms[0])));};
   376 	inline TInt RegisterRxBuffer(TInt aChannelId, TInt8 aBufGranularity, TInt8 aNumWords, TInt8 aOffset){TInt8 parms[3]; parms[0]=aBufGranularity; parms[1]=aNumWords; parms[2]=aOffset;return(DoControl(ERegisterRxBuffer,(TAny*)aChannelId,(TAny*)(&parms[0])));};
   379 	inline TInt RegisterTxBuffer(TInt aChannelId, TInt8 aBufGranularity, TInt8 aNumWords, TInt8 aOffset){TInt8 parms[3]; parms[0]=aBufGranularity; parms[1]=aNumWords; parms[2]=aOffset;return(DoControl(ERegisterTxBuffer,(TAny*)aChannelId,(TAny*)(&parms[0])));};
   377 	inline TInt RegisterTxBuffer(TInt aChannelId, TInt8 aBufGranularity, TInt8 aNumWords, TInt8 aOffset){TInt8 parms[3]; parms[0]=aBufGranularity; parms[1]=aNumWords; parms[2]=aOffset;return(DoControl(ERegisterTxBuffer,(TAny*)aChannelId,(TAny*)(&parms[0])));};
   380 	inline TInt SetNotificationTrigger(TInt aChannelId, TInt aTrigger, TRequestStatus* aStatus){TInt parms[2]; parms[0]=aChannelId; parms[1]=aTrigger; *aStatus=KRequestPending; return(DoControl(ESetNotifTrigger,(TAny*)aStatus,(TAny*)(&parms[0])));};
   378 	inline TInt SetNotificationTrigger(TInt aChannelId, TInt aTrigger, TRequestStatus* aStatus){TInt parms[2]; parms[0]=aChannelId; parms[1]=aTrigger;return(DoControl(ESetNotifTrigger,(TAny*)aStatus,(TAny*)(&parms[0])));};
   381 
   379 
   382 	// ControlIO functions follow
   380 	// ControlIO functions follow
   383 	inline TInt BlockReqCompletion(TInt aBusId) {return(DoControl(ECtlIoBlockReqCompletion,(TAny*)aBusId));}
   381 	inline TInt BlockReqCompletion(TInt aBusId) {return(DoControl(ECtlIoBlockReqCompletion,(TAny*)aBusId));}
   384 	inline TInt UnblockReqCompletion(TInt aBusId) {return(DoControl(ECtlIoUnblockReqCompletion,(TAny*)aBusId));}
   382 	inline TInt UnblockReqCompletion(TInt aBusId) {return(DoControl(ECtlIoUnblockReqCompletion,(TAny*)aBusId));}
   385 	inline TInt DeRegisterChan(TInt aBusId) {return(DoControl(ECtlIoDeRegChan,(TAny*)aBusId));}
   383 	inline TInt DeRegisterChan(TInt aBusId) {return(DoControl(ECtlIoDeRegChan,(TAny*)aBusId));}
   405 	inline TInt UnblockNotification(TInt aBusId, TInt aChannelId) {return(DoControl(ECtrlIoUnblockNotification,(TAny*)aBusId,(TAny*)aChannelId));}
   403 	inline TInt UnblockNotification(TInt aBusId, TInt aChannelId) {return(DoControl(ECtrlIoUnblockNotification,(TAny*)aBusId,(TAny*)aChannelId));}
   406 	inline TInt UpdateTimeoutValues(TInt aBusId, TInt aChannelId) {return(DoControl(ECtrlIoUpdTimeout,(TAny*)aBusId,(TAny*)aChannelId));}
   404 	inline TInt UpdateTimeoutValues(TInt aBusId, TInt aChannelId) {return(DoControl(ECtrlIoUpdTimeout,(TAny*)aBusId,(TAny*)aChannelId));}
   407 	inline TInt SetNotifNoTrigger(TInt aChannelId, TInt aTrigger){return(DoControl(ECtrlIoNotifNoTrigger,(TAny*)aChannelId,(TAny*)aTrigger));};
   405 	inline TInt SetNotifNoTrigger(TInt aChannelId, TInt aTrigger){return(DoControl(ECtrlIoNotifNoTrigger,(TAny*)aChannelId,(TAny*)aTrigger));};
   408 
   406 
   409 	inline void TestOverrunUnderrun(TInt aBusId, TInt aChannelId, TRequestStatus& aStatus) {DoRequest(ECtrlIoOvUndRunRxTx,aStatus,(TAny*)aBusId,(TAny*)aChannelId);}
   407 	inline void TestOverrunUnderrun(TInt aBusId, TInt aChannelId, TRequestStatus& aStatus) {DoRequest(ECtrlIoOvUndRunRxTx,aStatus,(TAny*)aBusId,(TAny*)aChannelId);}
   410 	
   408 
   411 	inline TInt TestSpare1(TInt aBusId) {return (DoControl(ETestSpare1, (TAny*)aBusId));}
       
   412 	inline TInt TestStaticExtension(TInt aBusId) {return (DoControl(ETestStaticEx, (TAny*)aBusId));}
       
   413 #endif
   409 #endif
   414 	};
   410 	};
   415 
   411 
   416 
   412 
   417 #ifdef __KERNEL_MODE__
   413 #ifdef __KERNEL_MODE__