kernel/eka/drivers/iic/iic.cpp
changeset 247 d8d70de2bd36
parent 0 a41df078684a
child 257 3e88ff8f41d5
equal deleted inserted replaced
201:43365a9b78a3 247:d8d70de2bd36
    23 #include <drivers/iic_trace.h>
    23 #include <drivers/iic_trace.h>
    24 #endif
    24 #endif
    25 
    25 
    26 // Global Controller pointer
    26 // Global Controller pointer
    27 static DIicBusController* TheController = NULL;
    27 static DIicBusController* TheController = NULL;
       
    28 
       
    29 #ifdef IIC_SIMULATED_PSL
       
    30 DIicBusController*& gTheController = TheController;
       
    31 #endif
    28 
    32 
    29 //
    33 //
    30 //		Implementation of generic IicBus API for client interface
    34 //		Implementation of generic IicBus API for client interface
    31 //
    35 //
    32 EXPORT_C TInt IicBus::QueueTransaction(TInt aBusId, TIicBusTransaction* aTransaction)
    36 EXPORT_C TInt IicBus::QueueTransaction(TInt aBusId, TIicBusTransaction* aTransaction)
  1012 		};
  1016 		};
  1013 	}
  1017 	}
  1014 
  1018 
  1015 #endif
  1019 #endif
  1016 
  1020 
  1017 #ifdef IIC_SIMULATED_PSL
       
  1018 TVersion DIicPdd::VersionRequired()
       
  1019 	{
       
  1020 	const TInt KIicMajorVersionNumber=1;
       
  1021 	const TInt KIicMinorVersionNumber=0;
       
  1022 	const TInt KIicBuildVersionNumber=KE32BuildVersionNumber;
       
  1023 	return TVersion(KIicMajorVersionNumber,KIicMinorVersionNumber,KIicBuildVersionNumber);
       
  1024 	}
       
  1025 
       
  1026 /** Factory class constructor */
       
  1027 DIicPdd::DIicPdd()
       
  1028 	{
       
  1029     iVersion = DIicPdd::VersionRequired();
       
  1030 	}
       
  1031 
       
  1032 DIicPdd::~DIicPdd()
       
  1033 	{
       
  1034 	delete TheController;
       
  1035 	}
       
  1036 
       
  1037 TInt DIicPdd::Install()
       
  1038     {
       
  1039     return(SetName(&KPddName));
       
  1040     }
       
  1041 
       
  1042 /**  Called by the kernel's device driver framework to create a Physical Channel. */
       
  1043 TInt DIicPdd::Create(DBase*& /*aChannel*/, TInt /*aUint*/, const TDesC8* /*anInfo*/, const TVersion& /*aVer*/)
       
  1044     {
       
  1045     return KErrNone;
       
  1046     }
       
  1047 
       
  1048 /**  Called by the kernel's device driver framework to check if this PDD is suitable for use with a Logical Channel.*/
       
  1049 TInt DIicPdd::Validate(TInt /*aUnit*/, const TDesC8* /*anInfo*/, const TVersion& aVer)
       
  1050     {
       
  1051    	if (!Kern::QueryVersionSupported(DIicPdd::VersionRequired(),aVer))
       
  1052 		return(KErrNotSupported);
       
  1053     return KErrNone;
       
  1054     }
       
  1055 
       
  1056 /** Return the driver capabilities */
       
  1057 void DIicPdd::GetCaps(TDes8& aDes) const
       
  1058     {
       
  1059 	// Create a capabilities object
       
  1060 	TCaps caps;
       
  1061 	caps.iVersion = iVersion;
       
  1062 	// Zero the buffer
       
  1063 	TInt maxLen = aDes.MaxLength();
       
  1064 	aDes.FillZ(maxLen);
       
  1065 	// Copy cpabilities
       
  1066 	TInt size=sizeof(caps);
       
  1067 	if(size>maxLen)
       
  1068 	   size=maxLen;
       
  1069 	aDes.Copy((TUint8*)&caps,size);
       
  1070     }
       
  1071 #endif
       
  1072 
       
  1073 #ifndef IIC_SIMULATED_PSL
  1021 #ifndef IIC_SIMULATED_PSL
       
  1022 
  1074 // Client interface entry point
  1023 // Client interface entry point
  1075 DECLARE_EXTENSION_WITH_PRIORITY(KExtensionMaximumPriority-1)	// highest priority after Resource Manager
  1024 DECLARE_EXTENSION_WITH_PRIORITY(KExtensionMaximumPriority-1)	// highest priority after Resource Manager
  1076 	{
  1025 	{
  1077 	TheController = new DIicBusController;
  1026 	TheController = new DIicBusController;
  1078 	if(!TheController)
  1027 	if(!TheController)
  1079 		return KErrNoMemory;
  1028 		return KErrNoMemory;
  1080 	TInt r=TheController->Create();
  1029 	TInt r=TheController->Create();
  1081 	return r;
  1030 	return r;
  1082 	}
  1031 	}
  1083 #else
  1032 #endif
  1084 static DIicPdd* TheIicPdd;
  1033 
  1085 
  1034 
  1086 DECLARE_STANDARD_PDD()
       
  1087 	{
       
  1088 	TheController = new DIicBusController;
       
  1089 	if(!TheController)
       
  1090 		return NULL;
       
  1091 	TInt r = TheController->Create();
       
  1092 	if(r == KErrNone)
       
  1093 		{
       
  1094 		TheIicPdd = new DIicPdd;
       
  1095 		if(TheIicPdd)
       
  1096 			return TheIicPdd;
       
  1097 		}
       
  1098 	
       
  1099 	delete TheController; 
       
  1100 	return NULL;
       
  1101 	}
       
  1102 #endif
       
  1103 
       
  1104 
       
  1105