Implement new version of DNE1_TBPowerResourceController::DoRegisterStaticResources, to fix Bug 3803
authorCheng-Shiun Tsai <cheng-shiun.tsai@accenture.com>
Fri, 08 Oct 2010 14:36:55 +0100
changeset 4 5937e08d5244
parent 3 b41049883d87
child 5 bf4661c6bc44
Implement new version of DNE1_TBPowerResourceController::DoRegisterStaticResources, to fix Bug 3803
navienginebsp/ne1_tb/inc/resmanpsl.h
navienginebsp/ne1_tb/specific/resmanpsl.cpp
--- a/navienginebsp/ne1_tb/inc/resmanpsl.h	Fri Oct 01 12:45:26 2010 +0100
+++ b/navienginebsp/ne1_tb/inc/resmanpsl.h	Fri Oct 08 14:36:55 2010 +0100
@@ -81,7 +81,11 @@
 public:
 	DNE1_TBPowerResourceController();
 	TInt DoInitController(); 
-	TInt DoRegisterStaticResources(DStaticPowerResource**& aStaticResourceArray, TUint16& aStaticResourceCount);
+
+	//C TSAI: from SF4 PDK 1022, this virtual function prototype has changed, and need to re-write this function 
+	//to match the new function prototype
+	//TInt DoRegisterStaticResources(DStaticPowerResource**& aStaticResourceArray, TUint16& aStaticResourceCount);
+	TInt DoRegisterStaticResources(RPointerArray<DStaticPowerResource>& aStaticResourceArray);
 	};
 
 
--- a/navienginebsp/ne1_tb/specific/resmanpsl.cpp	Fri Oct 01 12:45:26 2010 +0100
+++ b/navienginebsp/ne1_tb/specific/resmanpsl.cpp	Fri Oct 08 14:36:55 2010 +0100
@@ -17,7 +17,6 @@
 */
 
 
-
 #include "resmanpsl.h"
 
 static DNE1_TBPowerResourceController TheController;
@@ -66,6 +65,65 @@
     It creates an array to hold the static resource and also creates the resources and updates 
 	in the array. 
 	*/
+//C TSAI: this is to fit new virtual function prototype which uses RPointerArray
+TInt DNE1_TBPowerResourceController::DoRegisterStaticResources(RPointerArray<DStaticPowerResource>& aStaticResourceArray)
+	{
+	__KTRACE_OPT(KRESMANAGER, Kern::Printf("DNE1_TBPowerResourceController::DoRegisterStaticResources [SF4 new virtual function prototype]"));
+
+/** Macro definition to register resource */
+#define REGISTER_RESOURCE_RPOINTERARRAY(resource, resourceArray)						\
+	{																					\
+	pR = new resource();																\
+	if(!pR)																				\
+		{																				\
+		TUint resourceCount = (TUint) resourceArray.Count();							\
+		for(TUint count = 0; count < resourceCount; count++)							\
+			{																			\
+			delete resourceArray[count];												\
+			}																			\
+		resourceArray.Reset();															\
+		return KErrNoMemory;															\
+		}																				\
+	resourceArray.Append(pR);												\
+	}
+
+	DStaticPowerResource* pR = NULL;
+
+	//Note: RPointerArray itself only deal with pointers and doesn't delete objects when Close() or Reset()
+
+	/** Create I2S0 MCLK resource and add to the static resource array */
+	REGISTER_RESOURCE_RPOINTERARRAY(DNE1_TBI2S0MclkResource, aStaticResourceArray);
+	/** Create I2S1 MCLK resource and add to the static resource array */
+	REGISTER_RESOURCE_RPOINTERARRAY(DNE1_TBI2S1MclkResource, aStaticResourceArray);
+	/** Create I2S2 MCLK resource and add to the static resource array */
+	REGISTER_RESOURCE_RPOINTERARRAY(DNE1_TBI2S2MclkResource, aStaticResourceArray);
+	/** Create I2S3 MCLK resource and add to the static resource array */
+	REGISTER_RESOURCE_RPOINTERARRAY(DNE1_TBI2S3MclkResource, aStaticResourceArray);
+	/** Create I2S0 SCLK resource and add to the static resource array */
+	REGISTER_RESOURCE_RPOINTERARRAY(DNE1_TBI2S0SclkResource, aStaticResourceArray);
+	/** Create I2S1 SCLK resource and add to the static resource array */
+	REGISTER_RESOURCE_RPOINTERARRAY(DNE1_TBI2S1SclkResource, aStaticResourceArray);
+	/** Create I2S2 SCLK resource and add to the static resource array */
+	REGISTER_RESOURCE_RPOINTERARRAY(DNE1_TBI2S2SclkResource, aStaticResourceArray);
+	/** Create I2S3 SCLK resource and add to the static resource array */
+	REGISTER_RESOURCE_RPOINTERARRAY(DNE1_TBI2S3SclkResource, aStaticResourceArray);
+	/** Create CSI0 clock resource and add to the static resource array */
+	REGISTER_RESOURCE_RPOINTERARRAY(DNE1_TBCSI0ClockResource, aStaticResourceArray);
+	/** Create CSI1 clock resource and add to the static resource array */
+	REGISTER_RESOURCE_RPOINTERARRAY(DNE1_TBCSI1ClockResource, aStaticResourceArray);
+	/** Create Display DCLK resource and add to the static resource array */
+	REGISTER_RESOURCE_RPOINTERARRAY(DNE1_TBDisplayDclkResource, aStaticResourceArray);
+	/** Create LCD resource and add to the static resource array */
+	REGISTER_RESOURCE_RPOINTERARRAY(DNE1_TBLcdResource, aStaticResourceArray);
+	/** Create Board Power resource and add to the static resource array */
+	REGISTER_RESOURCE_RPOINTERARRAY(DNE1_TBBoardPowerResource, aStaticResourceArray);
+	/** Create PCI clock mask enable resource and add to the static resource array */
+	REGISTER_RESOURCE_RPOINTERARRAY(DNE1_TBPCIClockResource, aStaticResourceArray);
+
+	return KErrNone;
+	}
+
+#if 0	//C TSAI: This is older function implementation (older virtual function prototype)
 TInt DNE1_TBPowerResourceController::DoRegisterStaticResources(DStaticPowerResource**& aStaticResourceArray, 
 																                 TUint16& aStaticResourceCount)
 	{
@@ -122,4 +180,6 @@
 	return KErrNone;
 	}
 
+#endif
 
+