This class indicate an usage instance for a PCD token. This instance maybe a module\r
or platform setting. When a module produce or cosume a PCD token, then this module\r
is an usage instance for this PCD token.\r
- \r
+\r
Copyright (c) 2006, Intel Corporation\r
All rights reserved. This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
http://opensource.org/licenses/bsd-license.php\r
- \r
+\r
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
\r
-**/ \r
+**/\r
package org.tianocore.pcd.entity;\r
\r
-\r
-import java.util.UUID;\r
-\r
-import org.tianocore.ModuleTypeDef;\r
import org.tianocore.pcd.entity.CommonDefinition;\r
import org.tianocore.pcd.entity.UsageIdentification;\r
-import org.tianocore.pcd.exception.EntityException;\r
\r
/**\r
This class indicate an usage instance for a PCD token. This instance maybe a module\r
\r
///\r
/// ModuleIdentification for Usage Instance\r
- /// \r
+ ///\r
public UsageIdentification usageId;\r
\r
///\r
/// Arch also is a key for a UsageInstance\r
- /// \r
+ ///\r
public String arch;\r
\r
///\r
- /// The PCD type defined for module \r
- /// \r
+ /// The PCD type defined for module\r
+ ///\r
public Token.PCD_TYPE modulePcdType;\r
\r
///\r
- /// The value of the PCD in this usage instance. \r
- /// \r
+ /// The value of the PCD in this usage instance.\r
+ ///\r
public String datum;\r
\r
///\r
/// The maxDatumSize could be different for same PCD in different module\r
/// But this case is allow for FeatureFlag, FixedAtBuild, PatchableInModule\r
/// type.\r
- /// \r
+ ///\r
public int maxDatumSize;\r
\r
///\r
\r
///\r
/// Auotgen string for C code file.\r
- /// \r
+ ///\r
public String cAutogenStr;\r
\r
/**\r
Constructure function for UsageInstance\r
- \r
+\r
@param parentToken The token instance for this usgaInstance\r
@param id The identification for usage instance\r
@param modulePcdType The PCD type for this usage instance\r
\r
/**\r
Get the primary key for usage instance array for every token.\r
- \r
+\r
@param usageId The identification of UsageInstance\r
- \r
+\r
@retval String The primary key for this usage instance\r
**/\r
public static String getPrimaryKey(UsageIdentification usageId) {\r
\r
/**\r
Get primary key string for this usage instance\r
- \r
+\r
@return String primary key string\r
**/\r
public String getPrimaryKey() {\r
\r
/**\r
Judget whether current module is PEI driver\r
- \r
+\r
@return boolean whether current module is PEI driver\r
**/\r
public boolean isPeiPhaseComponent() {\r
\r
/**\r
Judge whether current module is DXE driver.\r
- \r
+\r
@return boolean whether current module is DXE driver\r
**/\r
public boolean isDxePhaseComponent() {\r
\r
/**\r
Generate autogen string for header file and C code file.\r
- \r
+\r
@param isBuildUsedLibrary whether the autogen is for library.\r
**/\r
public void generateAutoGen(boolean isBuildUsedLibrary) {\r
if (this.modulePcdType == Token.PCD_TYPE.DYNAMIC_EX) {\r
//\r
// For DYNAMIC_EX type PCD, use original token number in SPD or FPD to generate autogen\r
- // \r
+ //\r
tokenNumberString = Long.toString(parentToken.dynamicExTokenNumber, 16);\r
} else {\r
//\r
// For Others type PCD, use autogenerated token number to generate autogen\r
- // \r
+ //\r
tokenNumberString = Long.toString(parentToken.tokenNumber, 16);\r
}\r
\r
\r
//\r
// Judge the value of this PCD is byte array type\r
- // \r
+ //\r
if (!isBuildUsedLibrary && !parentToken.isDynamicPCD) {\r
if (datum.trim().charAt(0) == '{') {\r
isByteArray = true;\r
\r
//\r
// "ULL" should be added to value's tail for UINT64 value\r
- // \r
+ //\r
if (parentToken.datumType == Token.DATUM_TYPE.UINT64) {\r
printDatum = this.datum + "ULL";\r
} else {\r
\r
switch (modulePcdType) {\r
case FEATURE_FLAG:\r
- hAutogenStr += String.format("extern const BOOLEAN _gPcd_FixedAtBuild_%s;\r\n", \r
+ hAutogenStr += String.format("extern const BOOLEAN _gPcd_FixedAtBuild_%s;\r\n",\r
parentToken.cName);\r
hAutogenStr += String.format("#define _PCD_GET_MODE_%s_%s _gPcd_FixedAtBuild_%s\r\n",\r
- parentToken.GetAutogenDefinedatumTypeString(parentToken.datumType),\r
+ Token.GetAutogenDefinedatumTypeString(parentToken.datumType),\r
parentToken.cName,\r
parentToken.cName);\r
hAutogenStr += String.format("//#define _PCD_SET_MODE_%s_%s ASSERT(FALSE) If is not allowed to set value for a FEATURE_FLAG PCD\r\n",\r
- parentToken.GetAutogenDefinedatumTypeString(parentToken.datumType),\r
+ Token.GetAutogenDefinedatumTypeString(parentToken.datumType),\r
parentToken.cName);\r
\r
if (!isBuildUsedLibrary) {\r
- hAutogenStr += String.format("#define _PCD_VALUE_%s %s\r\n", \r
- parentToken.cName, \r
+ hAutogenStr += String.format("#define _PCD_VALUE_%s %s\r\n",\r
+ parentToken.cName,\r
printDatum);\r
cAutogenStr += String.format("GLOBAL_REMOVE_IF_UNREFERENCED const BOOLEAN _gPcd_FixedAtBuild_%s = _PCD_VALUE_%s;\r\n",\r
parentToken.cName,\r
if (isByteArray) {\r
hAutogenStr += String.format("extern const UINT8 _gPcd_FixedAtBuild_%s[];\r\n",\r
parentToken.cName);\r
- hAutogenStr += String.format("#define _PCD_GET_MODE_%s_%s (VOID*)_gPcd_FixedAtBuild_%s\r\n", \r
+ hAutogenStr += String.format("#define _PCD_GET_MODE_%s_%s (VOID*)_gPcd_FixedAtBuild_%s\r\n",\r
Token.GetAutogenDefinedatumTypeString(parentToken.datumType),\r
parentToken.cName,\r
parentToken.cName);\r
hAutogenStr += String.format("extern const %s _gPcd_FixedAtBuild_%s;\r\n",\r
Token.getAutogendatumTypeString(parentToken.datumType),\r
parentToken.cName);\r
- hAutogenStr += String.format("#define _PCD_GET_MODE_%s_%s _gPcd_FixedAtBuild_%s\r\n", \r
+ hAutogenStr += String.format("#define _PCD_GET_MODE_%s_%s _gPcd_FixedAtBuild_%s\r\n",\r
Token.GetAutogenDefinedatumTypeString(parentToken.datumType),\r
parentToken.cName,\r
parentToken.cName);\r
}\r
\r
hAutogenStr += String.format("//#define _PCD_SET_MODE_%s_%s ASSERT(FALSE) // It is not allowed to set value for a FIXED_AT_BUILD PCD\r\n",\r
- parentToken.GetAutogenDefinedatumTypeString(parentToken.datumType),\r
+ Token.GetAutogenDefinedatumTypeString(parentToken.datumType),\r
parentToken.cName);\r
if (!isBuildUsedLibrary) {\r
if (parentToken.datumType == Token.DATUM_TYPE.POINTER) {\r
if (isByteArray) {\r
- hAutogenStr += String.format("#define _PCD_VALUE_%s (VOID*)_gPcd_FixedAtBuild_%s\r\n", \r
- parentToken.cName, \r
+ hAutogenStr += String.format("#define _PCD_VALUE_%s (VOID*)_gPcd_FixedAtBuild_%s\r\n",\r
+ parentToken.cName,\r
parentToken.cName);\r
cAutogenStr += String.format("GLOBAL_REMOVE_IF_UNREFERENCED const UINT8 _gPcd_FixedAtBuild_%s[] = %s;\r\n",\r
parentToken.cName,\r
printDatum);\r
} else {\r
- hAutogenStr += String.format("#define _PCD_VALUE_%s %s\r\n", \r
- parentToken.cName, \r
+ hAutogenStr += String.format("#define _PCD_VALUE_%s %s\r\n",\r
+ parentToken.cName,\r
printDatum);\r
cAutogenStr += String.format("GLOBAL_REMOVE_IF_UNREFERENCED const %s _gPcd_FixedAtBuild_%s = _PCD_VALUE_%s;\r\n",\r
Token.getAutogendatumTypeString(parentToken.datumType),\r
parentToken.cName);\r
}\r
} else {\r
- hAutogenStr += String.format("#define _PCD_VALUE_%s %s\r\n", \r
- parentToken.cName, \r
+ hAutogenStr += String.format("#define _PCD_VALUE_%s %s\r\n",\r
+ parentToken.cName,\r
printDatum);\r
cAutogenStr += String.format("GLOBAL_REMOVE_IF_UNREFERENCED const %s _gPcd_FixedAtBuild_%s = _PCD_VALUE_%s;\r\n",\r
Token.getAutogendatumTypeString(parentToken.datumType),\r
hAutogenStr += String.format("#define _PCD_GET_MODE_%s_%s (VOID*)_gPcd_BinaryPatch_%s\r\n",\r
Token.GetAutogenDefinedatumTypeString(parentToken.datumType),\r
parentToken.cName,\r
- parentToken.cName); \r
+ parentToken.cName);\r
} else {\r
hAutogenStr += String.format("extern %s _gPcd_BinaryPatch_%s;\r\n",\r
Token.getAutogendatumTypeString(parentToken.datumType),\r
hAutogenStr += String.format("#define _PCD_GET_MODE_%s_%s _gPcd_BinaryPatch_%s\r\n",\r
Token.GetAutogenDefinedatumTypeString(parentToken.datumType),\r
parentToken.cName,\r
- parentToken.cName); \r
+ parentToken.cName);\r
}\r
\r
//\r
// Generate _PCD_SET_MODE_xx macro for using set BinaryPatch value via PcdSet macro\r
- // \r
+ //\r
if (parentToken.datumType == Token.DATUM_TYPE.POINTER) {\r
hAutogenStr += String.format("#define _PCD_SET_MODE_%s_%s(SizeOfBuffer, Buffer) CopyMem (_gPcd_BinaryPatch_%s, (Buffer), (SizeOfBuffer))\r\n",\r
Token.GetAutogenDefinedatumTypeString(parentToken.datumType),\r
parentToken.cName,\r
parentToken.cName);\r
}\r
- \r
+\r
if (!isBuildUsedLibrary) {\r
- hAutogenStr += String.format("#define _PCD_VALUE_%s %s\r\n", \r
- parentToken.cName, \r
+ hAutogenStr += String.format("#define _PCD_VALUE_%s %s\r\n",\r
+ parentToken.cName,\r
printDatum);\r
if (isByteArray) {\r
cAutogenStr += String.format("GLOBAL_REMOVE_IF_UNREFERENCED UINT8 _gPcd_BinaryPatch_%s[] = _PCD_VALUE_%s;\r\n",\r
\r
/**\r
Get the autogen string for header file.\r
- \r
+\r
@return The string of header file.\r
**/\r
public String getHAutogenStr() {\r
\r
/**\r
Get the autogen string for C code file.\r
- \r
+\r
@return The string of C Code file.\r
**/\r
public String getCAutogenStr() {\r