summaryrefslogtreecommitdiffstats
path: root/src/usr/hwpf
diff options
context:
space:
mode:
authorMike Jones <mjjones@us.ibm.com>2011-09-07 10:20:10 -0500
committerMIKE J. JONES <mjjones@us.ibm.com>2011-09-08 15:02:32 -0500
commitd2f4ff53fa03875d7d5df7e42df71d6294622762 (patch)
tree9ad24ed7e59afe3098dea19890d71abddd523d5d /src/usr/hwpf
parent1a9fe61084b58fe8e56e92c5983704751b3bf536 (diff)
downloadtalos-hostboot-d2f4ff53fa03875d7d5df7e42df71d6294622762.tar.gz
talos-hostboot-d2f4ff53fa03875d7d5df7e42df71d6294622762.zip
HWPF: Attribute Simplification
Change-Id: I84553317e8b21c3f538c787e43c4482f3e1944f0 Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/327 Tested-by: Jenkins Server Reviewed-by: Andrew J. Geissler <andrewg@us.ibm.com> Reviewed-by: Nicholas E. Bofferding <bofferdn@us.ibm.com>
Diffstat (limited to 'src/usr/hwpf')
-rwxr-xr-xsrc/usr/hwpf/fapi/fapiParseAttributeInfo.pl97
-rw-r--r--src/usr/hwpf/hwp/fapiHwpAttributeInfo.xml91
-rwxr-xr-xsrc/usr/hwpf/hwp/fapiTestHwpAttr.C793
3 files changed, 716 insertions, 265 deletions
diff --git a/src/usr/hwpf/fapi/fapiParseAttributeInfo.pl b/src/usr/hwpf/fapi/fapiParseAttributeInfo.pl
index ec853bcba..1f8ae4430 100755
--- a/src/usr/hwpf/fapi/fapiParseAttributeInfo.pl
+++ b/src/usr/hwpf/fapi/fapiParseAttributeInfo.pl
@@ -21,7 +21,6 @@
# Origin: 30
#
# IBM_PROLOG_END
-
#
# Purpose: This perl script will parse HWP Attribute XML files
# and add attribute information to a file called fapiAttributeIds.H
@@ -40,6 +39,7 @@
# mjjones 06/10/11 Added "use strict;"
# mjjones 06/23/11 Parse more info
# mjjones 07/05/11 Take output dir as parameter
+# mjjones 09/06/11 Remove string/defaultVal support
#
# End Change Log ******************************************************
@@ -117,7 +117,7 @@ foreach my $argnum (1 .. $#ARGV)
#----------------------------------------------------------------------
# Print the AttributeId
#----------------------------------------------------------------------
- if (!$attr->{id})
+ if (! exists $attr->{id})
{
print ("fapiParseAttributeInfo.pl ERROR. Att 'id' missing\n");
exit(1);
@@ -159,7 +159,7 @@ foreach my $argnum (1 .. $#ARGV)
#----------------------------------------------------------------------
if ($attr->{description})
{
- print OUTFILE "// ", $attr->{id}, ": ", $attr->{description}, "\n";
+ print OUTFILE "// $attr->{id}: $attr->{description}\n";
}
#----------------------------------------------------------------------
@@ -173,43 +173,30 @@ foreach my $argnum (1 .. $#ARGV)
foreach my $val (@vals)
{
- $arrayDimensions .= "[";
- $arrayDimensions .= ${val};
- $arrayDimensions .= "]";
+ $arrayDimensions .= "[${val}]";
}
}
#----------------------------------------------------------------------
# Print the typedef for each attribute's value type
#----------------------------------------------------------------------
- if (!$attr->{valueType})
+ if (! exists $attr->{valueType})
{
print ("fapiParseAttributeInfo.pl ERROR. Att 'valueType' missing\n");
exit(1);
}
- print OUTFILE "typedef ";
- my $attrDefaultValType;
-
if ($attr->{valueType} eq 'uint8')
{
- $attrDefaultValType = "uint8_t";
- print OUTFILE "uint8_t ", $attr->{id}, "_Type", $arrayDimensions, ";\n";
+ print OUTFILE "typedef uint8_t $attr->{id}_Type$arrayDimensions;\n";
}
elsif ($attr->{valueType} eq 'uint32')
{
- $attrDefaultValType = "uint32_t";
- print OUTFILE "uint32_t ", $attr->{id}, "_Type", $arrayDimensions, ";\n";
+ print OUTFILE "typedef uint32_t $attr->{id}_Type$arrayDimensions;\n";
}
elsif ($attr->{valueType} eq 'uint64')
{
- $attrDefaultValType = "uint64_t";
- print OUTFILE "uint64_t ", $attr->{id}, "_Type", $arrayDimensions, ";\n";
- }
- elsif ($attr->{valueType} eq 'string')
- {
- $attrDefaultValType = "char *";
- print OUTFILE "char * ", $attr->{id}, "_Type;\n";
+ print OUTFILE "typedef uint64_t $attr->{id}_Type$arrayDimensions;\n";
}
else
{
@@ -219,74 +206,42 @@ foreach my $argnum (1 .. $#ARGV)
}
#----------------------------------------------------------------------
+ # Print if the platform initializes the value
+ #----------------------------------------------------------------------
+ if (exists $attr->{platInit})
+ {
+ print OUTFILE "#define $attr->{id}_PLATINIT true\n"
+ }
+ else
+ {
+ print OUTFILE "#define $attr->{id}_PLATINIT false\n"
+ }
+
+ #----------------------------------------------------------------------
# Print the value enumeration (if it is specified)
#----------------------------------------------------------------------
- if ($attr->{enum})
+ if (exists $attr->{enum})
{
- print OUTFILE "enum ", $attr->{id}, "_Enum\n{\n";
+ print OUTFILE "enum $attr->{id}_Enum\n{\n";
# Values must be separated by white space
my @vals = split(' ', $attr->{enum});
foreach my $val (@vals)
{
- print OUTFILE " ", $attr->{id}, "_", ${val}, ",\n";
+ print OUTFILE " $attr->{id}_${val},\n";
}
print OUTFILE "};\n";
}
#----------------------------------------------------------------------
- # Print the default value information
- #----------------------------------------------------------------------
- print OUTFILE "const bool ", $attr->{id}, "_HASDEFAULTVAL = ";
-
- if ($attr->{defaultValue})
- {
- print OUTFILE "true;\n";
-
- if ($attr->{valueType} eq 'string')
- {
- print OUTFILE "const char * const ", $attr->{id};
- print OUTFILE "_DEFAULTVAL = \"", $attr->{defaultValue};
- print OUTFILE "\";\n";
- }
- elsif ($attr->{enum})
- {
- print OUTFILE "const ", $attrDefaultValType, " ", $attr->{id};
- print OUTFILE "_DEFAULTVAL = ", $attr->{id}, "_";
- print OUTFILE $attr->{defaultValue}, ";\n";
- }
- else
- {
- print OUTFILE "const ", $attrDefaultValType, " ", $attr->{id};
- print OUTFILE "_DEFAULTVAL = ", $attr->{defaultValue}, ";\n";
- }
- }
- else
- {
- print OUTFILE "false;\n";
-
- if ($attr->{valueType} eq 'string')
- {
- print OUTFILE "const char * const ", $attr->{id};
- print OUTFILE "_DEFAULTVAL = \"\";\n";
- }
- else
- {
- print OUTFILE "const ", $attrDefaultValType, " ", $attr->{id};
- print OUTFILE "_DEFAULTVAL = 0;\n";
- }
- }
-
- #----------------------------------------------------------------------
# If the attribute is read-only then define the _SETMACRO to something
- # that will cause a compile failure
+ # that will cause a compile failure if a set is attempted
#----------------------------------------------------------------------
- if (!$attr->{writeable})
+ if (! exists $attr->{writeable})
{
- print OUTFILE "#define ", $attr->{id};
- print OUTFILE "_SETMACRO ATTRIBUTE_NOT_WRITABLE\n";
+ print OUTFILE "#define $attr->{id}_SETMACRO ATTRIBUTE_NOT_WRITABLE\n";
}
#----------------------------------------------------------------------
diff --git a/src/usr/hwpf/hwp/fapiHwpAttributeInfo.xml b/src/usr/hwpf/hwp/fapiHwpAttributeInfo.xml
index 259dd080e..16b98f1ed 100644
--- a/src/usr/hwpf/hwp/fapiHwpAttributeInfo.xml
+++ b/src/usr/hwpf/hwp/fapiHwpAttributeInfo.xml
@@ -21,80 +21,109 @@
IBM_PROLOG_END -->
<!-- XML file specifying HW Procedure requested attributes. -->
-<!-- This is just the initial test version. HWPs will replace with an official version. -->
+<!-- These are the scratch attributes that every platform must support for HWP development -->
<attributes>
<!-- ********************************************************************* -->
<attribute>
- <id>ATTR_TEST_UINT8</id>
+ <id>ATTR_SCRATCH_UINT8_1</id>
<targetType>TARGET_TYPE_SYSTEM</targetType>
- <description>Test Attr UINT8. DefaultVal 6</description>
+ <description>Scratch uint8_t attribute 1</description>
<valueType>uint8</valueType>
- <defaultValue>6</defaultValue>
<writeable/>
</attribute>
<!-- ********************************************************************* -->
<attribute>
- <id>ATTR_TEST_UINT32</id>
+ <id>ATTR_SCRATCH_UINT8_2</id>
<targetType>TARGET_TYPE_SYSTEM</targetType>
- <description>Test Attr UINT32. PLAT (sets val to 3). RO</description>
+ <description>Scratch uint8_t attribute 2</description>
+ <valueType>uint8</valueType>
+ <writeable/>
+ </attribute>
+ <!-- ********************************************************************* -->
+ <attribute>
+ <id>ATTR_SCRATCH_UINT32_1</id>
+ <targetType>TARGET_TYPE_SYSTEM</targetType>
+ <description>Scratch uint32_t attribute 1</description>
+ <valueType>uint32</valueType>
+ <writeable/>
+ </attribute>
+ <!-- ********************************************************************* -->
+ <attribute>
+ <id>ATTR_SCRATCH_UINT32_2</id>
+ <targetType>TARGET_TYPE_SYSTEM</targetType>
+ <description>Scratch uint32_t attribute 2</description>
<valueType>uint32</valueType>
- <platInit/>
+ <writeable/>
+ </attribute>
+ <!-- ********************************************************************* -->
+ <attribute>
+ <id>ATTR_SCRATCH_UINT64_1</id>
+ <targetType>TARGET_TYPE_SYSTEM</targetType>
+ <description>Scratch uint64_t attribute 1</description>
+ <valueType>uint64</valueType>
+ <writeable/>
</attribute>
<!-- ********************************************************************* -->
<attribute>
- <id>ATTR_TEST_UINT64</id>
+ <id>ATTR_SCRATCH_UINT64_2</id>
<targetType>TARGET_TYPE_SYSTEM</targetType>
- <description>Test Attr UINT64. Enum. DefaultVal VALB</description>
+ <description>Scratch uint64_t attribute 2</description>
<valueType>uint64</valueType>
- <defaultValue>VALB</defaultValue>
- <enum>VALA VALB VALC</enum>
<writeable/>
</attribute>
<!-- ********************************************************************* -->
<attribute>
- <id>ATTR_TEST_UINT8_ARRAY</id>
+ <id>ATTR_SCRATCH_UINT8_ARRAY_1</id>
<targetType>TARGET_TYPE_SYSTEM</targetType>
- <description>Test Attr UINT8 ARRAY[3]. DefaultVal 2</description>
+ <description>Scratch uint8_t array ([32]) attribute 1</description>
<valueType>uint8</valueType>
- <defaultValue>2</defaultValue>
- <array>3</array>
+ <array>32</array>
<writeable/>
</attribute>
<!-- ********************************************************************* -->
<attribute>
- <id>ATTR_TEST_UINT32_ARRAY</id>
+ <id>ATTR_SCRATCH_UINT8_ARRAY_2</id>
<targetType>TARGET_TYPE_SYSTEM</targetType>
- <description>Test Attr UINT32 ARRAY[2][3][4]. DefaultVal 8</description>
- <valueType>uint32</valueType>
- <defaultValue>8</defaultValue>
+ <description>Scratch uint8_t array ([2][3][4]) attribute 2</description>
+ <valueType>uint8</valueType>
<array>2 3 4</array>
<writeable/>
</attribute>
<!-- ********************************************************************* -->
<attribute>
- <id>ATTR_TEST_UINT64_ARRAY</id>
+ <id>ATTR_SCRATCH_UINT32_ARRAY_1</id>
<targetType>TARGET_TYPE_SYSTEM</targetType>
- <description>Test Attr UINT64 ARRAY[5]. PLAT (sets vals to 4). RO</description>
- <valueType>uint64</valueType>
- <platInit/>
- <array>5</array>
+ <description>Scratch uint32_t array ([8]) attribute 1</description>
+ <valueType>uint32</valueType>
+ <array>8</array>
+ <writeable/>
</attribute>
<!-- ********************************************************************* -->
<attribute>
- <id>ATTR_TEST_STRING1</id>
+ <id>ATTR_SCRATCH_UINT32_ARRAY_2</id>
<targetType>TARGET_TYPE_SYSTEM</targetType>
- <description>Test Attr STRING1. DefaultVal 'mike'</description>
- <valueType>string</valueType>
- <defaultValue>mike</defaultValue>
+ <description>Scratch uint32_t array ([2][3]) attribute 2</description>
+ <valueType>uint32</valueType>
+ <array>2 3</array>
+ <writeable/>
+ </attribute>
+ <!-- ********************************************************************* -->
+ <attribute>
+ <id>ATTR_SCRATCH_UINT64_ARRAY_1</id>
+ <targetType>TARGET_TYPE_SYSTEM</targetType>
+ <description>Scratch uint64_t array ([4]) attribute 1</description>
+ <valueType>uint64</valueType>
+ <array>4</array>
<writeable/>
</attribute>
<!-- ********************************************************************* -->
<attribute>
- <id>ATTR_TEST_STRING2</id>
+ <id>ATTR_SCRATCH_UINT64_ARRAY_2</id>
<targetType>TARGET_TYPE_SYSTEM</targetType>
- <description>Test Attr STRING2. PLAT (sets val to 'platString')</description>
- <valueType>string</valueType>
+ <description>Scratch uint64_t array ([2][2]) attribute 2</description>
+ <valueType>uint64</valueType>
+ <array>2 2</array>
<writeable/>
</attribute>
</attributes>
diff --git a/src/usr/hwpf/hwp/fapiTestHwpAttr.C b/src/usr/hwpf/hwp/fapiTestHwpAttr.C
index a8590efbd..6cf43ee6a 100755
--- a/src/usr/hwpf/hwp/fapiTestHwpAttr.C
+++ b/src/usr/hwpf/hwp/fapiTestHwpAttr.C
@@ -23,7 +23,7 @@
/**
* @file fapiTestHwpAttr.C
*
- * @brief Implements the test Hardware Procedure that exercises the test
+ * @brief Implements the test Hardware Procedure that exercises the scratch
* attributes
*/
@@ -32,6 +32,7 @@
* Flag Defect/Feature User Date Description
* ------ -------------- ---------- ----------- ----------------------------
* mjjones 06/30/2011 Created.
+ * mjjones 09/07/2011 Update to test scratch attrs
*
*/
@@ -45,49 +46,51 @@ extern "C"
//******************************************************************************
fapi::ReturnCode hwpTestAttributes(const fapi::Target & i_target)
{
- // Attempt to call the attribute get/set functions for the test attributes
+ FAPI_INF("Performing HWP: hwpTestAttributes");
+
+ // Attempt to call the attribute get/set macros for the scratch attributes
fapi::ReturnCode l_rc;
- // Test getting and setting the test attributes
do
{
//----------------------------------------------------------------------
- // Test ATTR_TEST_UINT8 (DefaultVal 6)
+ // Test ATTR_SCRATCH_UINT8_1
//----------------------------------------------------------------------
- uint8_t l_uint8 = 0;
+ {
+ uint8_t l_uint8 = 1;
// Test get
- l_rc = FAPI_ATTR_GET(ATTR_TEST_UINT8, NULL, l_uint8);
+ l_rc = FAPI_ATTR_GET(ATTR_SCRATCH_UINT8_1, NULL, l_uint8);
if (l_rc)
{
- FAPI_ERR("hwpTestAttributes: ATTR_TEST_UINT8. Error from GET");
+ FAPI_ERR("hwpTestAttributes: ATTR_SCRATCH_UINT8_1. Error from GET");
break;
}
// Check value
- if (l_uint8 != 6)
+ if (l_uint8 != 0)
{
l_rc = fapi::FAPI_RC_ATTR_UNIT_TEST_FAIL;
- FAPI_ERR("hwpTestAttributes: ATTR_TEST_UINT8. GET returned %d",
+ FAPI_ERR("hwpTestAttributes: ATTR_SCRATCH_UINT8_1. GET returned %d",
l_uint8);
break;
}
// Test set
l_uint8 = 7;
- l_rc = FAPI_ATTR_SET(ATTR_TEST_UINT8, NULL, l_uint8);
+ l_rc = FAPI_ATTR_SET(ATTR_SCRATCH_UINT8_1, NULL, l_uint8);
if (l_rc)
{
- FAPI_ERR("hwpTestAttributes: ATTR_TEST_UINT8. Error from SET");
+ FAPI_ERR("hwpTestAttributes: ATTR_SCRATCH_UINT8_1. Error from SET");
break;
}
// Test get
l_uint8 = 8;
- l_rc = FAPI_ATTR_GET(ATTR_TEST_UINT8, NULL, l_uint8);
+ l_rc = FAPI_ATTR_GET(ATTR_SCRATCH_UINT8_1, NULL, l_uint8);
if (l_rc)
{
- FAPI_ERR("hwpTestAttributes: ATTR_TEST_UINT8. Error from GET (2)");
+ FAPI_ERR("hwpTestAttributes: ATTR_SCRATCH_UINT8_1. Error from GET (2)");
break;
}
@@ -95,104 +98,259 @@ fapi::ReturnCode hwpTestAttributes(const fapi::Target & i_target)
if (l_uint8 != 7)
{
l_rc = fapi::FAPI_RC_ATTR_UNIT_TEST_FAIL;
- FAPI_ERR("hwpTestAttributes: ATTR_TEST_UINT8. GET returned %d (2)",
+ FAPI_ERR("hwpTestAttributes: ATTR_SCRATCH_UINT8_1. GET returned %d (2)",
l_uint8);
break;
}
+ // Set to zero
+ l_uint8 = 0;
+ l_rc = FAPI_ATTR_SET(ATTR_SCRATCH_UINT8_1, NULL, l_uint8);
+ if (l_rc)
+ {
+ FAPI_ERR("hwpTestAttributes: ATTR_SCRATCH_UINT8_1. Error from SET (2)");
+ break;
+ }
+ }
+
//----------------------------------------------------------------------
- // Test ATTR_TEST_UINT32 (PLAT (sets val to 3). RO)
+ // Test ATTR_SCRATCH_UINT8_2
//----------------------------------------------------------------------
- uint32_t l_uint32 = 0;
+ {
+ uint8_t l_uint8 = 8;
// Test get
- l_rc = FAPI_ATTR_GET(ATTR_TEST_UINT32, NULL, l_uint32);
+ l_rc = FAPI_ATTR_GET(ATTR_SCRATCH_UINT8_2, NULL, l_uint8);
if (l_rc)
{
- FAPI_ERR("hwpTestAttributes: ATTR_TEST_UINT32. Error from GET");
+ FAPI_ERR("hwpTestAttributes: ATTR_SCRATCH_UINT8_2. Error from GET");
break;
}
// Check value
- if (l_uint32 != 3)
+ if (l_uint8 != 0)
{
l_rc = fapi::FAPI_RC_ATTR_UNIT_TEST_FAIL;
- FAPI_ERR("hwpTestAttributes: ATTR_TEST_UINT32. GET returned %d",
+ FAPI_ERR("hwpTestAttributes: ATTR_SCRATCH_UINT8_2. GET returned %d",
+ l_uint8);
+ break;
+ }
+
+ // Set to zero
+ l_rc = FAPI_ATTR_SET(ATTR_SCRATCH_UINT8_2, NULL, l_uint8);
+ if (l_rc)
+ {
+ FAPI_ERR("hwpTestAttributes: ATTR_SCRATCH_UINT8_2. Error from SET");
+ break;
+ }
+ }
+
+ //----------------------------------------------------------------------
+ // Test ATTR_SCRATCH_UINT32_1
+ //----------------------------------------------------------------------
+ {
+ uint32_t l_uint32 = 1;
+
+ // Test get
+ l_rc = FAPI_ATTR_GET(ATTR_SCRATCH_UINT32_1, NULL, l_uint32);
+ if (l_rc)
+ {
+ FAPI_ERR("hwpTestAttributes: ATTR_SCRATCH_UINT32_1. Error from GET");
+ break;
+ }
+
+ // Check value
+ if (l_uint32 != 0)
+ {
+ l_rc = fapi::FAPI_RC_ATTR_UNIT_TEST_FAIL;
+ FAPI_ERR("hwpTestAttributes: ATTR_SCRATCH_UINT32_1. GET returned %d",
l_uint32);
break;
}
- // Cannot set read-only attribute
+ // Test set
+ l_uint32 = 7;
+ l_rc = FAPI_ATTR_SET(ATTR_SCRATCH_UINT32_1, NULL, l_uint32);
+ if (l_rc)
+ {
+ FAPI_ERR("hwpTestAttributes: ATTR_SCRATCH_UINT32_1. Error from SET");
+ break;
+ }
+
+ // Test get
+ l_uint32 = 8;
+ l_rc = FAPI_ATTR_GET(ATTR_SCRATCH_UINT32_1, NULL, l_uint32);
+ if (l_rc)
+ {
+ FAPI_ERR("hwpTestAttributes: ATTR_SCRATCH_UINT32_1. Error from GET (2)");
+ break;
+ }
+
+ // Check value
+ if (l_uint32 != 7)
+ {
+ l_rc = fapi::FAPI_RC_ATTR_UNIT_TEST_FAIL;
+ FAPI_ERR("hwpTestAttributes: ATTR_SCRATCH_UINT32_1. GET returned %d (2)",
+ l_uint32);
+ break;
+ }
+
+ // Set to zero
+ l_uint32 = 0;
+ l_rc = FAPI_ATTR_SET(ATTR_SCRATCH_UINT32_1, NULL, l_uint32);
+ if (l_rc)
+ {
+ FAPI_ERR("hwpTestAttributes: ATTR_SCRATCH_UINT32_1. Error from SET (2)");
+ break;
+ }
+ }
+
+ //----------------------------------------------------------------------
+ // Test ATTR_SCRATCH_UINT32_2
+ //----------------------------------------------------------------------
+ {
+ uint32_t l_uint32 = 1;
+
+ // Test get
+ l_rc = FAPI_ATTR_GET(ATTR_SCRATCH_UINT32_2, NULL, l_uint32);
+ if (l_rc)
+ {
+ FAPI_ERR("hwpTestAttributes: ATTR_SCRATCH_UINT32_2. Error from GET");
+ break;
+ }
+
+ // Check value
+ if (l_uint32 != 0)
+ {
+ l_rc = fapi::FAPI_RC_ATTR_UNIT_TEST_FAIL;
+ FAPI_ERR("hwpTestAttributes: ATTR_SCRATCH_UINT32_2. GET returned %d",
+ l_uint32);
+ break;
+ }
+
+ // Set to zero
+ l_rc = FAPI_ATTR_SET(ATTR_SCRATCH_UINT32_2, NULL, l_uint32);
+ if (l_rc)
+ {
+ FAPI_ERR("hwpTestAttributes: ATTR_SCRATCH_UINT32_2. Error from SET");
+ break;
+ }
+ }
//----------------------------------------------------------------------
- // Test ATTR_TEST_UINT64 (Enum. DefaultVal VALB)
+ // Test ATTR_SCRATCH_UINT64_1
//----------------------------------------------------------------------
- uint64_t l_uint64 = 0;
+ {
+ uint64_t l_uint64 = 1;
// Test get
- l_rc = FAPI_ATTR_GET(ATTR_TEST_UINT64, NULL, l_uint64);
+ l_rc = FAPI_ATTR_GET(ATTR_SCRATCH_UINT64_1, NULL, l_uint64);
if (l_rc)
{
- FAPI_ERR("hwpTestAttributes: ATTR_TEST_UINT64. Error from GET");
+ FAPI_ERR("hwpTestAttributes: ATTR_SCRATCH_UINT64_1. Error from GET");
break;
}
// Check value
- if (l_uint64 != fapi::ATTR_TEST_UINT64_VALB)
+ if (l_uint64 != 0)
{
l_rc = fapi::FAPI_RC_ATTR_UNIT_TEST_FAIL;
- FAPI_ERR("hwpTestAttributes: ATTR_TEST_UINT64. GET returned %d",
+ FAPI_ERR("hwpTestAttributes: ATTR_SCRATCH_UINT64_1. GET returned %d",
static_cast<uint32_t>(l_uint64));
break;
}
// Test set
- l_uint64 = fapi::ATTR_TEST_UINT64_VALA;
- l_rc = FAPI_ATTR_SET(ATTR_TEST_UINT64, NULL, l_uint64);
+ l_uint64 = 7;
+ l_rc = FAPI_ATTR_SET(ATTR_SCRATCH_UINT64_1, NULL, l_uint64);
+ if (l_rc)
+ {
+ FAPI_ERR("hwpTestAttributes: ATTR_SCRATCH_UINT64_1. Error from SET");
+ break;
+ }
+
+ // Test get
+ l_uint64 = 8;
+ l_rc = FAPI_ATTR_GET(ATTR_SCRATCH_UINT64_1, NULL, l_uint64);
+ if (l_rc)
+ {
+ FAPI_ERR("hwpTestAttributes: ATTR_SCRATCH_UINT64_1. Error from GET (2)");
+ break;
+ }
+
+ // Check value
+ if (l_uint64 != 7)
+ {
+ l_rc = fapi::FAPI_RC_ATTR_UNIT_TEST_FAIL;
+ FAPI_ERR("hwpTestAttributes: ATTR_SCRATCH_UINT64_1. GET returned %d (2)",
+ static_cast<uint32_t>(l_uint64));
+ break;
+ }
+
+ // Set to zero
+ l_uint64 = 0;
+ l_rc = FAPI_ATTR_SET(ATTR_SCRATCH_UINT64_1, NULL, l_uint64);
if (l_rc)
{
- FAPI_ERR("hwpTestAttributes: ATTR_TEST_UINT64. Error from SET");
+ FAPI_ERR("hwpTestAttributes: ATTR_SCRATCH_UINT64_1. Error from SET (2)");
break;
}
+ }
+
+ //----------------------------------------------------------------------
+ // Test ATTR_SCRATCH_UINT64_2
+ //----------------------------------------------------------------------
+ {
+ uint64_t l_uint64 = 1;
// Test get
- l_uint64 = fapi::ATTR_TEST_UINT64_VALC;
- l_rc = FAPI_ATTR_GET(ATTR_TEST_UINT64, NULL, l_uint64);
+ l_rc = FAPI_ATTR_GET(ATTR_SCRATCH_UINT64_2, NULL, l_uint64);
if (l_rc)
{
- FAPI_ERR("hwpTestAttributes: ATTR_TEST_UINT64. Error from GET (2)");
+ FAPI_ERR("hwpTestAttributes: ATTR_SCRATCH_UINT64_2. Error from GET");
break;
}
- if (l_uint64 != fapi::ATTR_TEST_UINT64_VALA)
+ // Check value
+ if (l_uint64 != 0)
{
l_rc = fapi::FAPI_RC_ATTR_UNIT_TEST_FAIL;
- FAPI_ERR("hwpTestAttributes: ATTR_TEST_UINT64. GET returned %d (2)",
+ FAPI_ERR("hwpTestAttributes: ATTR_SCRATCH_UINT64_2. GET returned %d",
static_cast<uint32_t>(l_uint64));
break;
}
+ // Set to zero
+ l_rc = FAPI_ATTR_SET(ATTR_SCRATCH_UINT64_2, NULL, l_uint64);
+ if (l_rc)
+ {
+ FAPI_ERR("hwpTestAttributes: ATTR_SCRATCH_UINT64_2. Error from SET");
+ break;
+ }
+ }
+
//----------------------------------------------------------------------
- // Test ATTR_TEST_UINT8_ARRAY ([3], DefaultVal 2)
+ // Test ATTR_SCRATCH_UINT8_ARRAY_1
//----------------------------------------------------------------------
- uint8_t l_uint8Array[3];
+ {
+ uint8_t l_uint8array1[32];
// Test get
- l_rc = FAPI_ATTR_GET(ATTR_TEST_UINT8_ARRAY, NULL, l_uint8Array);
+ l_rc = FAPI_ATTR_GET(ATTR_SCRATCH_UINT8_ARRAY_1, NULL, l_uint8array1);
if (l_rc)
{
- FAPI_ERR("hwpTestAttributes: ATTR_TEST_UINT8_ARRAY. Error from GET");
+ FAPI_ERR("hwpTestAttributes: ATTR_SCRATCH_UINT8_ARRAY_1. Error from GET");
break;
}
- // Check values
- for (uint32_t i = 0; i < 3; i++)
+ // Check value
+ for (uint32_t i = 0; i < 32; i++)
{
- if (l_uint8Array[i] != 2)
+ if (l_uint8array1[i] != 0)
{
l_rc = fapi::FAPI_RC_ATTR_UNIT_TEST_FAIL;
- FAPI_ERR("hwpTestAttributes: ATTR_TEST_UINT8_ARRAY GET "
- "returned %d in index %d", l_uint8Array[i], i);
+ FAPI_ERR("hwpTestAttributes: ATTR_SCRATCH_UINT8_ARRAY1. GET [%d] returned %d",
+ i, l_uint8array1[i]);
break;
}
}
@@ -203,36 +361,39 @@ fapi::ReturnCode hwpTestAttributes(const fapi::Target & i_target)
}
// Test set
- l_uint8Array[0] = 0;
- l_uint8Array[1] = 1;
- l_uint8Array[2] = 2;
+ for (uint32_t i = 0; i < 32; i++)
+ {
+ l_uint8array1[i] = i + 1;
+ }
- l_rc = FAPI_ATTR_SET(ATTR_TEST_UINT8_ARRAY, NULL, l_uint8Array);
+ l_rc = FAPI_ATTR_SET(ATTR_SCRATCH_UINT8_ARRAY_1, NULL, l_uint8array1);
if (l_rc)
{
- FAPI_ERR("hwpTestAttributes: ATTR_TEST_UINT8_ARRAY. Error from SET");
+ FAPI_ERR("hwpTestAttributes: ATTR_SCRATCH_UINT8_ARRAY_1. Error from SET");
break;
}
// Test get
- l_uint8Array[0] = 6;
- l_uint8Array[1] = 7;
- l_uint8Array[2] = 8;
- l_rc = FAPI_ATTR_GET(ATTR_TEST_UINT8_ARRAY, NULL, l_uint8Array);
+ for (uint32_t i = 0; i < 32; i++)
+ {
+ l_uint8array1[i] = 0;
+ }
+
+ l_rc = FAPI_ATTR_GET(ATTR_SCRATCH_UINT8_ARRAY_1, NULL, l_uint8array1);
if (l_rc)
{
- FAPI_ERR("hwpTestAttributes: ATTR_TEST_UINT8_ARRAY. Error from GET (2)");
+ FAPI_ERR("hwpTestAttributes: ATTR_SCRATCH_UINT8_ARRAY_1. Error from GET (2)");
break;
}
- // Check values
- for (uint32_t i = 0; i < 3; i++)
+ // Check value
+ for (uint32_t i = 0; i < 32; i++)
{
- if (l_uint8Array[i] != i)
+ if (l_uint8array1[i] != (i + 1))
{
l_rc = fapi::FAPI_RC_ATTR_UNIT_TEST_FAIL;
- FAPI_ERR("hwpTestAttributes: ATTR_TEST_UINT8_ARRAY. GET "
- "returned %d in index %d", l_uint8Array[i], i);
+ FAPI_ERR("hwpTestAttributes: ATTR_SCRATCH_UINT8_ARRAY1. GET [%d] returned %d (2)",
+ i, l_uint8array1[i]);
break;
}
}
@@ -242,42 +403,55 @@ fapi::ReturnCode hwpTestAttributes(const fapi::Target & i_target)
break;
}
+ // Set to zero
+ for (uint32_t i = 0; i < 32; i++)
+ {
+ l_uint8array1[i] = 0;
+ }
+
+ l_rc = FAPI_ATTR_SET(ATTR_SCRATCH_UINT8_ARRAY_1, NULL, l_uint8array1);
+ if (l_rc)
+ {
+ FAPI_ERR("hwpTestAttributes: ATTR_SCRATCH_UINT8_ARRAY_1. Error from SET (2)");
+ break;
+ }
+ }
+
//----------------------------------------------------------------------
- // Test ATTR_TEST_UINT32_ARRAY ([2][3][4], DefaultVal 8)
+ // Test ATTR_SCRATCH_UINT8_ARRAY_2
//----------------------------------------------------------------------
- uint32_t l_uint32Array[2][3][4];
+ {
+ uint8_t l_uint8 = 1;
+ uint8_t l_uint8array2[2][3][4];
// Test get
- l_rc = FAPI_ATTR_GET(ATTR_TEST_UINT32_ARRAY, NULL, l_uint32Array);
+ l_rc = FAPI_ATTR_GET(ATTR_SCRATCH_UINT8_ARRAY_2, NULL, l_uint8array2);
if (l_rc)
{
- FAPI_ERR("hwpTestAttributes: ATTR_TEST_UINT32_ARRAY. Error from GET");
+ FAPI_ERR("hwpTestAttributes: ATTR_SCRATCH_UINT8_ARRAY_2. Error from GET");
break;
}
- // Check values
+ // Check value
for (uint32_t i = 0; i < 2; i++)
{
for (uint32_t j = 0; j < 3; j++)
{
for (uint32_t k = 0; k < 4; k++)
{
- if (l_uint32Array[i][j][k] != 8)
+ if (l_uint8array2[i][j][k] != 0)
{
l_rc = fapi::FAPI_RC_ATTR_UNIT_TEST_FAIL;
- FAPI_ERR("hwpTestAttributes: ATTR_TEST_UINT32_ARRAY. "
- "GET returned %d in index %d:%d:%d",
- l_uint32Array[i][j][j], i, j, k);
+ FAPI_ERR("hwpTestAttributes: ATTR_SCRATCH_UINT8_ARRAY2. GET [%d:%d:%d] returned %d",
+ i, j, k, l_uint8array2[i][j][k]);
break;
}
}
-
if (l_rc)
{
break;
}
}
-
if (l_rc)
{
break;
@@ -290,22 +464,22 @@ fapi::ReturnCode hwpTestAttributes(const fapi::Target & i_target)
}
// Test set
- uint32_t l_val = 0;
+ l_uint8 = 1;
for (uint32_t i = 0; i < 2; i++)
{
for (uint32_t j = 0; j < 3; j++)
{
for (uint32_t k = 0; k < 4; k++)
{
- l_uint32Array[i][j][k] = l_val++;
+ l_uint8array2[i][j][k] = l_uint8++;
}
}
}
- l_rc = FAPI_ATTR_SET(ATTR_TEST_UINT32_ARRAY, NULL, l_uint32Array);
+ l_rc = FAPI_ATTR_SET(ATTR_SCRATCH_UINT8_ARRAY_2, NULL, l_uint8array2);
if (l_rc)
{
- FAPI_ERR("hwpTestAttributes: ATTR_TEST_UINT32_ARRAY. Error from SET");
+ FAPI_ERR("hwpTestAttributes: ATTR_SCRATCH_UINT8_ARRAY_2. Error from SET");
break;
}
@@ -316,43 +490,39 @@ fapi::ReturnCode hwpTestAttributes(const fapi::Target & i_target)
{
for (uint32_t k = 0; k < 4; k++)
{
- l_uint32Array[i][j][k] = 32;
+ l_uint8array2[i][j][k] = 0;
}
}
}
- l_rc = FAPI_ATTR_GET(ATTR_TEST_UINT32_ARRAY, NULL, l_uint32Array);
+ l_rc = FAPI_ATTR_GET(ATTR_SCRATCH_UINT8_ARRAY_2, NULL, l_uint8array2);
if (l_rc)
{
- FAPI_ERR("hwpTestAttributes: Error from GET uint32 array (2)");
+ FAPI_ERR("hwpTestAttributes: ATTR_SCRATCH_UINT8_ARRAY_2. Error from GET (2)");
break;
}
- // Check values
- l_val = 0;
+ // Check value
+ l_uint8 = 1;
for (uint32_t i = 0; i < 2; i++)
{
for (uint32_t j = 0; j < 3; j++)
{
for (uint32_t k = 0; k < 4; k++)
{
- if (l_uint32Array[i][j][k] != l_val)
+ if (l_uint8array2[i][j][k] != l_uint8++)
{
l_rc = fapi::FAPI_RC_ATTR_UNIT_TEST_FAIL;
- FAPI_ERR("hwpTestAttributes: ATTR_TEST_UINT32_ARRAY. "
- "GET returned %d in index %d:%d:%d (2)",
- l_uint32Array[i][j][j], i, j, k);
+ FAPI_ERR("hwpTestAttributes: ATTR_SCRATCH_UINT8_ARRAY2. GET [%d:%d:%d] returned %d",
+ i, j, k, l_uint8array2[i][j][k]);
break;
}
- l_val++;
}
-
if (l_rc)
{
break;
}
}
-
if (l_rc)
{
break;
@@ -364,28 +534,91 @@ fapi::ReturnCode hwpTestAttributes(const fapi::Target & i_target)
break;
}
+ // Set to zero
+ for (uint32_t i = 0; i < 2; i++)
+ {
+ for (uint32_t j = 0; j < 3; j++)
+ {
+ for (uint32_t k = 0; k < 4; k++)
+ {
+ l_uint8array2[i][j][k] = 0;
+ }
+ }
+ }
+
+ l_rc = FAPI_ATTR_SET(ATTR_SCRATCH_UINT8_ARRAY_2, NULL, l_uint8array2);
+ if (l_rc)
+ {
+ FAPI_ERR("hwpTestAttributes: ATTR_SCRATCH_UINT8_ARRAY_2. Error from SET (2)");
+ break;
+ }
+ }
+
//----------------------------------------------------------------------
- // Test ATTR_TEST_UINT64_ARRAY ([5]. PLAT (sets vals to 4). RO)
+ // Test ATTR_SCRATCH_UINT32_ARRAY_1
//----------------------------------------------------------------------
- uint64_t l_uint64Array[5];
+ {
+ uint32_t l_uint32array1[8];
+
+ // Test get
+ l_rc = FAPI_ATTR_GET(ATTR_SCRATCH_UINT32_ARRAY_1, NULL, l_uint32array1);
+ if (l_rc)
+ {
+ FAPI_ERR("hwpTestAttributes: ATTR_SCRATCH_UINT32_ARRAY_1. Error from GET");
+ break;
+ }
+
+ // Check value
+ for (uint32_t i = 0; i < 8; i++)
+ {
+ if (l_uint32array1[i] != 0)
+ {
+ l_rc = fapi::FAPI_RC_ATTR_UNIT_TEST_FAIL;
+ FAPI_ERR("hwpTestAttributes: ATTR_SCRATCH_UINT32_ARRAY1. GET [%d] returned %d",
+ i, l_uint32array1[i]);
+ break;
+ }
+ }
+
+ if (l_rc)
+ {
+ break;
+ }
+
+ // Test set
+ for (uint32_t i = 0; i < 8; i++)
+ {
+ l_uint32array1[i] = i + 1;
+ }
+
+ l_rc = FAPI_ATTR_SET(ATTR_SCRATCH_UINT32_ARRAY_1, NULL, l_uint32array1);
+ if (l_rc)
+ {
+ FAPI_ERR("hwpTestAttributes: ATTR_SCRATCH_UINT32_ARRAY_1. Error from SET");
+ break;
+ }
// Test get
- l_rc = FAPI_ATTR_GET(ATTR_TEST_UINT64_ARRAY, NULL, l_uint64Array);
+ for (uint32_t i = 0; i < 8; i++)
+ {
+ l_uint32array1[i] = 0;
+ }
+
+ l_rc = FAPI_ATTR_GET(ATTR_SCRATCH_UINT32_ARRAY_1, NULL, l_uint32array1);
if (l_rc)
{
- FAPI_ERR("hwpTestAttributes: ATTR_TEST_UINT64_ARRAY. Error from GET");
+ FAPI_ERR("hwpTestAttributes: ATTR_SCRATCH_UINT32_ARRAY_1. Error from GET (2)");
break;
}
- // Check values
- for (uint32_t i = 0; i < 5; i++)
+ // Check value
+ for (uint32_t i = 0; i < 8; i++)
{
- if (l_uint64Array[i] != 4)
+ if (l_uint32array1[i] != (i + 1))
{
l_rc = fapi::FAPI_RC_ATTR_UNIT_TEST_FAIL;
- FAPI_ERR("hwpTestAttributes: ATTR_TEST_UINT64_ARRAY. GET "
- "returned %d in index %d",
- static_cast<uint32_t>(l_uint64Array[i]), i);
+ FAPI_ERR("hwpTestAttributes: ATTR_SCRATCH_UINT32_ARRAY1. GET [%d] returned %d (2)",
+ i, l_uint32array1[i]);
break;
}
}
@@ -395,137 +628,371 @@ fapi::ReturnCode hwpTestAttributes(const fapi::Target & i_target)
break;
}
- // Cannot set read-only attribute
+ // Set to zero
+ for (uint32_t i = 0; i < 8; i++)
+ {
+ l_uint32array1[i] = 0;
+ }
+
+ l_rc = FAPI_ATTR_SET(ATTR_SCRATCH_UINT32_ARRAY_1, NULL, l_uint32array1);
+ if (l_rc)
+ {
+ FAPI_ERR("hwpTestAttributes: ATTR_SCRATCH_UINT32_ARRAY_1. Error from SET (2)");
+ break;
+ }
+ }
//----------------------------------------------------------------------
- // Test ATTR_TEST_STRING1 (DefaultVal 'mike')
+ // Test ATTR_SCRATCH_UINT32_ARRAY_2
//----------------------------------------------------------------------
- char * l_pString1 = NULL;
+ {
+ uint32_t l_uint32 = 1;
+ uint32_t l_uint32array2[2][3];
// Test get
- l_rc = FAPI_ATTR_GET(ATTR_TEST_STRING1, NULL, l_pString1);
+ l_rc = FAPI_ATTR_GET(ATTR_SCRATCH_UINT32_ARRAY_2, NULL, l_uint32array2);
if (l_rc)
{
- FAPI_ERR("hwpTestAttributes: ATTR_TEST_STRING1. Error from GET");
+ FAPI_ERR("hwpTestAttributes: ATTR_SCRATCH_UINT8_ARRAY_2. Error from GET");
break;
}
// Check value
- if (l_pString1 == NULL)
+ for (uint32_t i = 0; i < 2; i++)
+ {
+ for (uint32_t j = 0; j < 3; j++)
+ {
+ if (l_uint32array2[i][j] != 0)
+ {
+ l_rc = fapi::FAPI_RC_ATTR_UNIT_TEST_FAIL;
+ FAPI_ERR("hwpTestAttributes: ATTR_SCRATCH_UINT32_ARRAY2. GET [%d:%d] returned %d",
+ i, j, l_uint32array2[i][j]);
+ break;
+ }
+ }
+ if (l_rc)
+ {
+ break;
+ }
+ }
+
+ if (l_rc)
{
- l_rc = fapi::FAPI_RC_ATTR_UNIT_TEST_FAIL;
- FAPI_ERR("hwpTestAttributes: ATTR_TEST_STRING1. GET returned NULL");
break;
}
- if (strcmp(l_pString1, "mike") != 0)
+ // Test set
+ l_uint32 = 1;
+ for (uint32_t i = 0; i < 2; i++)
{
- l_rc = fapi::FAPI_RC_ATTR_UNIT_TEST_FAIL;
- FAPI_ERR("hwpTestAttributes: ATTR_TEST_STRING1. GET returned %s",
- l_pString1);
+ for (uint32_t j = 0; j < 3; j++)
+ {
+ l_uint32array2[i][j] = l_uint32++;
+ }
+ }
+
+ l_rc = FAPI_ATTR_SET(ATTR_SCRATCH_UINT32_ARRAY_2, NULL, l_uint32array2);
+ if (l_rc)
+ {
+ FAPI_ERR("hwpTestAttributes: ATTR_SCRATCH_UINT32_ARRAY_2. Error from SET");
break;
}
- delete [] l_pString1;
+ // Test get
+ for (uint32_t i = 0; i < 2; i++)
+ {
+ for (uint32_t j = 0; j < 3; j++)
+ {
+ l_uint32array2[i][j] = 0;
+ }
+ }
- // Test set
- l_pString1 = "test1";
+ l_rc = FAPI_ATTR_GET(ATTR_SCRATCH_UINT32_ARRAY_2, NULL, l_uint32array2);
+ if (l_rc)
+ {
+ FAPI_ERR("hwpTestAttributes: ATTR_SCRATCH_UINT32_ARRAY_2. Error from GET (2)");
+ break;
+ }
- l_rc = FAPI_ATTR_SET(ATTR_TEST_STRING1, NULL, l_pString1);
+ // Check value
+ l_uint32 = 1;
+ for (uint32_t i = 0; i < 2; i++)
+ {
+ for (uint32_t j = 0; j < 3; j++)
+ {
+ if (l_uint32array2[i][j] != l_uint32++)
+ {
+ l_rc = fapi::FAPI_RC_ATTR_UNIT_TEST_FAIL;
+ FAPI_ERR("hwpTestAttributes: ATTR_SCRATCH_UINT32_ARRAY2. GET [%d:%d] returned %d",
+ i, j, l_uint32array2[i][j]);
+ break;
+ }
+ }
+ if (l_rc)
+ {
+ break;
+ }
+ }
+
+ if (l_rc)
+ {
+ break;
+ }
+
+ // Set to zero
+ for (uint32_t i = 0; i < 2; i++)
+ {
+ for (uint32_t j = 0; j < 3; j++)
+ {
+ l_uint32array2[i][j]= 0;
+ }
+ }
+
+ l_rc = FAPI_ATTR_SET(ATTR_SCRATCH_UINT32_ARRAY_2, NULL, l_uint32array2);
if (l_rc)
{
- FAPI_ERR("hwpTestAttributes: ATTR_TEST_STRING1. Error from SET");
+ FAPI_ERR("hwpTestAttributes: ATTR_SCRATCH_UINT32_ARRAY_2. Error from SET (2)");
break;
}
+ }
- l_pString1 = NULL;
+ //----------------------------------------------------------------------
+ // Test ATTR_SCRATCH_UINT64_ARRAY_1
+ //----------------------------------------------------------------------
+ {
+ uint64_t l_uint64array1[4];
// Test get
- l_rc = FAPI_ATTR_GET(ATTR_TEST_STRING1, NULL, l_pString1);
+ l_rc = FAPI_ATTR_GET(ATTR_SCRATCH_UINT64_ARRAY_1, NULL, l_uint64array1);
if (l_rc)
{
- FAPI_ERR("hwpTestAttributes: ATTR_TEST_STRING1. Error from GET (2)");
+ FAPI_ERR("hwpTestAttributes: ATTR_SCRATCH_UINT64_ARRAY_1. Error from GET");
break;
}
// Check value
- if (l_pString1 == NULL)
+ for (uint32_t i = 0; i < 4; i++)
+ {
+ if (l_uint64array1[i] != 0)
+ {
+ l_rc = fapi::FAPI_RC_ATTR_UNIT_TEST_FAIL;
+ FAPI_ERR("hwpTestAttributes: ATTR_SCRATCH_UINT64_ARRAY1. GET [%d] returned %d",
+ i, static_cast<uint32_t>(l_uint64array1[i]));
+ break;
+ }
+ }
+
+ if (l_rc)
{
- l_rc = fapi::FAPI_RC_ATTR_UNIT_TEST_FAIL;
- FAPI_ERR("hwpTestAttributes: ATTR_TEST_STRING1. GET returned NULL (2)");
break;
}
- if (strcmp(l_pString1, "test1") != 0)
+ // Test set
+ for (uint32_t i = 0; i < 4; i++)
{
- l_rc = fapi::FAPI_RC_ATTR_UNIT_TEST_FAIL;
- FAPI_ERR("hwpTestAttributes: ATTR_TEST_STRING1. GET returned %s (2)",
- l_pString1);
+ l_uint64array1[i] = i + 1;
+ }
+
+ l_rc = FAPI_ATTR_SET(ATTR_SCRATCH_UINT64_ARRAY_1, NULL, l_uint64array1);
+ if (l_rc)
+ {
+ FAPI_ERR("hwpTestAttributes: ATTR_SCRATCH_UINT64_ARRAY_1. Error from SET");
break;
}
- delete [] l_pString1;
+ // Test get
+ for (uint32_t i = 0; i < 4; i++)
+ {
+ l_uint64array1[i] = 0;
+ }
+
+ l_rc = FAPI_ATTR_GET(ATTR_SCRATCH_UINT64_ARRAY_1, NULL, l_uint64array1);
+ if (l_rc)
+ {
+ FAPI_ERR("hwpTestAttributes: ATTR_SCRATCH_UINT64_ARRAY_1. Error from GET (2)");
+ break;
+ }
+
+ // Check value
+ for (uint32_t i = 0; i < 4; i++)
+ {
+ if (l_uint64array1[i] != (i + 1))
+ {
+ l_rc = fapi::FAPI_RC_ATTR_UNIT_TEST_FAIL;
+ FAPI_ERR("hwpTestAttributes: ATTR_SCRATCH_UINT64_ARRAY1. GET [%d] returned %d (2)",
+ i, static_cast<uint32_t>(l_uint64array1[i]));
+ break;
+ }
+ }
+
+ if (l_rc)
+ {
+ break;
+ }
+
+ // Set to zero
+ for (uint32_t i = 0; i < 4; i++)
+ {
+ l_uint64array1[i] = 0;
+ }
+
+ l_rc = FAPI_ATTR_SET(ATTR_SCRATCH_UINT64_ARRAY_1, NULL, l_uint64array1);
+ if (l_rc)
+ {
+ FAPI_ERR("hwpTestAttributes: ATTR_SCRATCH_UINT64_ARRAY_1. Error from SET (2)");
+ break;
+ }
+ }
//----------------------------------------------------------------------
- // Test ATTR_TEST_STRING2 (PLAT (sets val to 'platString'))
+ // Test ATTR_SCRATCH_UINT64_ARRAY_2
//----------------------------------------------------------------------
- char * l_pString2 = NULL;
+ {
+ uint64_t l_uint64 = 1;
+ uint64_t l_uint64array2[2][2];
// Test get
- l_rc = FAPI_ATTR_GET(ATTR_TEST_STRING2, NULL, l_pString2);
+ l_rc = FAPI_ATTR_GET(ATTR_SCRATCH_UINT64_ARRAY_2, NULL, l_uint64array2);
if (l_rc)
{
- FAPI_ERR("hwpTestAttributes: ATTR_TEST_STRING2. Error from GET");
+ FAPI_ERR("hwpTestAttributes: ATTR_SCRATCH_UINT8_ARRAY_2. Error from GET");
break;
}
// Check value
- if (l_pString2 == NULL)
+ for (uint32_t i = 0; i < 2; i++)
+ {
+ for (uint32_t j = 0; j < 2; j++)
+ {
+ if (l_uint64array2[i][j] != 0)
+ {
+ l_rc = fapi::FAPI_RC_ATTR_UNIT_TEST_FAIL;
+ FAPI_ERR("hwpTestAttributes: ATTR_SCRATCH_UINT64_ARRAY2. GET [%d:%d] returned %d",
+ i, j, static_cast<uint32_t>(l_uint64array2[i][j]));
+ break;
+ }
+ }
+ if (l_rc)
+ {
+ break;
+ }
+ }
+
+ if (l_rc)
{
- l_rc = fapi::FAPI_RC_ATTR_UNIT_TEST_FAIL;
- FAPI_ERR("hwpTestAttributes: ATTR_TEST_STRING2. GET returned NULL");
break;
}
- if (strcmp(l_pString2, "platString") != 0)
+ // Test set
+ l_uint64 = 1;
+ for (uint32_t i = 0; i < 2; i++)
+ {
+ for (uint32_t j = 0; j < 2; j++)
+ {
+ l_uint64array2[i][j] = l_uint64++;
+ }
+ }
+
+ l_rc = FAPI_ATTR_SET(ATTR_SCRATCH_UINT64_ARRAY_2, NULL, l_uint64array2);
+ if (l_rc)
+ {
+ FAPI_ERR("hwpTestAttributes: ATTR_SCRATCH_UINT64_ARRAY_2. Error from SET");
+ break;
+ }
+
+ // Test get
+ for (uint32_t i = 0; i < 2; i++)
+ {
+ for (uint32_t j = 0; j < 2; j++)
+ {
+ l_uint64array2[i][j] = 0;
+ }
+ }
+
+ l_rc = FAPI_ATTR_GET(ATTR_SCRATCH_UINT64_ARRAY_2, NULL, l_uint64array2);
+ if (l_rc)
+ {
+ FAPI_ERR("hwpTestAttributes: ATTR_SCRATCH_UINT64_ARRAY_2. Error from GET (2)");
+ break;
+ }
+
+ // Check value
+ l_uint64 = 1;
+ for (uint32_t i = 0; i < 2; i++)
+ {
+ for (uint32_t j = 0; j < 2; j++)
+ {
+ if (l_uint64array2[i][j] != l_uint64++)
+ {
+ l_rc = fapi::FAPI_RC_ATTR_UNIT_TEST_FAIL;
+ FAPI_ERR("hwpTestAttributes: ATTR_SCRATCH_UINT64_ARRAY2. GET [%d:%d] returned %d",
+ i, j, static_cast<uint32_t>(l_uint64array2[i][j]));
+ break;
+ }
+ }
+ if (l_rc)
+ {
+ break;
+ }
+ }
+
+ if (l_rc)
{
- l_rc = fapi::FAPI_RC_ATTR_UNIT_TEST_FAIL;
- FAPI_ERR("hwpTestAttributes: ATTR_TEST_STRING2. GET returned %s",
- l_pString2);
break;
}
+ // Set to zero
+ for (uint32_t i = 0; i < 2; i++)
+ {
+ for (uint32_t j = 0; j < 2; j++)
+ {
+ l_uint64array2[i][j]= 0;
+ }
+ }
+
+ l_rc = FAPI_ATTR_SET(ATTR_SCRATCH_UINT64_ARRAY_2, NULL, l_uint64array2);
+ if (l_rc)
+ {
+ FAPI_ERR("hwpTestAttributes: ATTR_SCRATCH_UINT64_ARRAY_2. Error from SET (2)");
+ break;
+ }
+ }
- // All of the following should not compile due to setting read-only
- // attributes
- //l_rc = FAPI_ATTR_SET(ATTR_TEST_UINT32, NULL, l_uint32);
- //l_rc = FAPI_ATTR_SET(ATTR_TEST_UINT64_ARRAY, NULL, l_uint64Array);
+ //----------------------------------------------------------------------
+ // Test invalid accesses
+ //----------------------------------------------------------------------
// All of the following should not compile due to wrong types used
- //l_rc = FAPI_ATTR_GET(ATTR_TEST_STRING1, NULL, l_uint8);
- //l_rc = FAPI_ATTR_GET(ATTR_TEST_STRING2, NULL, l_uint32);
- //l_rc = FAPI_ATTR_GET(ATTR_TEST_STRING1, NULL, l_uint64);
- //l_rc = FAPI_ATTR_GET(ATTR_TEST_STRING2, NULL, l_uint8Array);
- //l_rc = FAPI_ATTR_GET(ATTR_TEST_UINT8, NULL, l_pString1);
- //l_rc = FAPI_ATTR_GET(ATTR_TEST_UINT32, NULL, l_uint8);
- //l_rc = FAPI_ATTR_GET(ATTR_TEST_UINT64, NULL, l_uint8Array);
- //l_rc = FAPI_ATTR_GET(ATTR_TEST_UINT64, NULL, l_uint64Array);
- //l_rc = FAPI_ATTR_GET(ATTR_TEST_UINT8_ARRAY, NULL, l_pString1);
- //l_rc = FAPI_ATTR_GET(ATTR_TEST_UINT32_ARRAY, NULL, l_uint8);
- //l_rc = FAPI_ATTR_GET(ATTR_TEST_UINT64_ARRAY, NULL, l_uint64);
- //l_rc = FAPI_ATTR_GET(ATTR_TEST_UINT64_ARRAY, NULL, &l_uint32Array[0][0][0]);
-
- //l_rc = FAPI_ATTR_SET(ATTR_TEST_STRING1, NULL, l_uint8);
- //l_rc = FAPI_ATTR_SET(ATTR_TEST_STRING2, NULL, l_uint32);
- //l_rc = FAPI_ATTR_SET(ATTR_TEST_STRING1, NULL, l_uint64);
- //l_rc = FAPI_ATTR_SET(ATTR_TEST_STRING2, NULL, l_uint64Array);
- //l_rc = FAPI_ATTR_SET(ATTR_TEST_UINT8, NULL, l_pString1);
- //l_rc = FAPI_ATTR_SET(ATTR_TEST_UINT32, NULL, l_uint64);
- //l_rc = FAPI_ATTR_SET(ATTR_TEST_UINT64, NULL, &l_uint32Array[0][0][0]);
- //l_rc = FAPI_ATTR_SET(ATTR_TEST_UINT64, NULL, l_uint64Array);
- //l_rc = FAPI_ATTR_SET(ATTR_TEST_UINT8_ARRAY, NULL, l_pString2);
- //l_rc = FAPI_ATTR_SET(ATTR_TEST_UINT32_ARRAY, NULL, l_uint8);
- //l_rc = FAPI_ATTR_SET(ATTR_TEST_UINT64_ARRAY, NULL, l_uint64);
+ {
+ //uint32_t l_val;
+ //l_rc = FAPI_ATTR_GET(ATTR_SCRATCH_UINT8_1, NULL, l_val);
+ //l_rc = FAPI_ATTR_SET(ATTR_SCRATCH_UINT8_1, NULL, l_val);
+ }
+ {
+ //uint64_t l_val;
+ //l_rc = FAPI_ATTR_GET(ATTR_SCRATCH_UINT32_1, NULL, l_val);
+ //l_rc = FAPI_ATTR_SET(ATTR_SCRATCH_UINT32_1, NULL, l_val);
+ }
+ {
+ //uint8_t l_val;
+ //l_rc = FAPI_ATTR_GET(ATTR_SCRATCH_UINT64_1, NULL, l_val);
+ //l_rc = FAPI_ATTR_SET(ATTR_SCRATCH_UINT64_1, NULL, l_val);
+ }
+ {
+ //uint8_t l_array[33]; // size should be 32
+ //l_rc = FAPI_ATTR_GET(ATTR_SCRATCH_UINT8_ARRAY_1, NULL, l_array);
+ //l_rc = FAPI_ATTR_SET(ATTR_SCRATCH_UINT8_ARRAY_1, NULL, l_array);
+ }
+ {
+ //uint8_t l_array[2][3]; // type should be uint32_t
+ //l_rc = FAPI_ATTR_GET(ATTR_SCRATCH_UINT32_ARRAY_2, NULL, l_array);
+ //l_rc = FAPI_ATTR_SET(ATTR_SCRATCH_UINT32_ARRAY_2, NULL, l_array);
+ }
+ {
+ //uint64_t l_array[2][1]; // second dimension should be 2
+ //l_rc = FAPI_ATTR_GET(ATTR_SCRATCH_UINT64_ARRAY_2, NULL, l_array);
+ //l_rc = FAPI_ATTR_SET(ATTR_SCRATCH_UINT64_ARRAY_2, NULL, l_array);
+ }
} while (0);
OpenPOWER on IntegriCloud