diff options
author | Greg Still <stillgs@us.ibm.com> | 2015-07-20 07:27:48 -0500 |
---|---|---|
committer | Amit J. Tendolkar <amit.tendolkar@in.ibm.com> | 2015-08-19 11:07:29 -0500 |
commit | f3c18a2e5d3af5d66100b502091f636d219c3655 (patch) | |
tree | a5467166a2032e474059d1b3fcb4658d6c29f131 /tools | |
parent | 316f046100d70f6d8f0e1eda0174f49a797c1264 (diff) | |
download | talos-sbe-f3c18a2e5d3af5d66100b502091f636d219c3655.tar.gz talos-sbe-f3c18a2e5d3af5d66100b502091f636d219c3655.zip |
Honor PPE partial good attributes to intialize targets
- Addressed internal Gerrit comments
- Addressed compilation issues with real procedures
- Fix image tool "clean" function (updated) (deals with missing tools/image/bin)
- make "clean" fixup
- Get vector of attribute values properly into the image
- Fix FAPI_ATTR_* signature from target pointer to target reference
- ATTR_CHIP_UNIT_POS support for non-core/cache chiplets
- Require FAPI_ATTR_GET/SET invocation to be in the form of fapi2::ATTR_....
- Fix tools bin directory creation issue
- Address plat_PervPGTargets error case
- Add FAPI_EXEC_HW support to deal with recently merged functions
- Update libcommonerrors.mk to deal with recently merged compilation issue
Change-Id: I31485ff05731e7fbaa0453d8ed9985b9ca56b8b3
Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/19342
Tested-by: Jenkins Server
Reviewed-by: Gregory S. Still <stillgs@us.ibm.com>
Reviewed-by: Sachin Gupta <sgupta2m@in.ibm.com>
Reviewed-by: Amit J. Tendolkar <amit.tendolkar@in.ibm.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/image/Makefile | 45 | ||||
-rw-r--r-- | tools/image/bin/.empty | 0 | ||||
-rw-r--r-- | tools/image/sbe_default_tool.c | 65 | ||||
-rw-r--r-- | tools/image/sbe_xip_tool.c | 34 | ||||
-rwxr-xr-x | tools/scripts/ppeCreateAttrGetSetMacros.pl | 12 | ||||
-rw-r--r-- | tools/scripts/src/fapi2PlatAttributeService.H | 575 |
6 files changed, 473 insertions, 258 deletions
diff --git a/tools/image/Makefile b/tools/image/Makefile index 0afc09ee..a7da7ae9 100644 --- a/tools/image/Makefile +++ b/tools/image/Makefile @@ -20,36 +20,6 @@ $(warning CTEPATH not defined; defaulting to awd) CTEPATH = /afs/awd/projects/cte endif - -# Are we setup for eCMD, if so let's get our eCMD Release from there -ifneq ($(strip $(ECMD_RELEASE)),) - ECMD_RELEASE := $(shell ecmdVersion full) - # Make sure we got a valid version back - ifeq ($(findstring ver,$(ECMD_RELEASE)),) - ECMD_RELEASE := rel - endif -else - # If not setup for eCMD, default to rel - ECMD_RELEASE := rel -endif - - -# Ok, now set our eCMD Path, if not set already -ifeq ($(strip $(ECMD_PATH)),) - ECMD_PATH := ${CTEPATH}/tools/ecmd/${ECMD_RELEASE}/ -endif - -ifeq ($(strip $(ECMD_PLUGIN)),cro) -# Cronus plugin specific setup - CRONUS_PATH := $(shell echo ${ECMD_EXE} | sed -n 's|\([a-zA-Z0-9]*\)\(_*\)\([a-zA-Z0-9]*\)_x86\.exe|prcd_d|p') - ifeq ($(strip $(CRONUS_PATH)),) - $(error "Error determining CRONUS_PATH from env!") - endif -endif - -# We need common up-to-date headers for FAPI - currently using these. -FAPI = $(ECMD_PATH)ext/fapi - # Locations of required headers. INCLUDES += -I. -I../../ -I../../utils INCLUDES += -I ../../sbe/image/ @@ -63,10 +33,6 @@ INCLUDES += -I ../../pk/trace/ INCLUDES += -I ../../tools/ppetracepp/ INCLUDES += -I ../../importtemp/fapi2/include/ -INCLUDES += -I$(CRONUS_PATH) -INCLUDES += -I$(ECMD_PATH)/capi -INCLUDES += -I$(FAPI)/capi - # Under Linux the scheme is to use a common compiler to create procedures. # However, the common compiler can be VERY slow, so if the system compiler is # also 4.1.2 we're using that one instead. Also, the Linux FAPI libraries we @@ -101,8 +67,11 @@ UTILITIES-DEPENDENCIES = $(patsubst %.o,%.d,$(UTILITIES-OBJECTS)) UTILITIES-EXECUTABLES = $(patsubst %,bin/%,$(UTILITIES)) -.PHONY : utilities -utilities: $(UTILITIES-EXECUTABLES) +.PHONY : utilities buildBinDir +utilities: buildBinDir $(UTILITIES-EXECUTABLES) + +buildBinDir: + mkdir -p bin bin/%.o: %.c $(CXX) -std=c++11 $(INCLUDES) $(CXXFLAGS) -DDEBUG_SBE_XIP_IMAGE=1 -DFAPI2_NO_FFDC -c -o $@ $< @@ -119,6 +88,6 @@ bin/sbe_default_tool: bin/sbe_xip_image.o bin/sbe_default_tool.o ln -sf bin/sbe_default_tool sbe_default_tool clean: - rm sbe_xip_tool sbe_default_tool + rm -f sbe_xip_tool sbe_default_tool rm -rf bin - mkdir -p bin
\ No newline at end of file + mkdir -p bin diff --git a/tools/image/bin/.empty b/tools/image/bin/.empty deleted file mode 100644 index e69de29b..00000000 --- a/tools/image/bin/.empty +++ /dev/null diff --git a/tools/image/sbe_default_tool.c b/tools/image/sbe_default_tool.c index 2b1679ef..817eee09 100644 --- a/tools/image/sbe_default_tool.c +++ b/tools/image/sbe_default_tool.c @@ -18,6 +18,7 @@ #define __PPE__ #include "fapi2.H" #include "proc_sbe_fixed.H" +#include "sbe_xip_image.h" const char* g_usage = "Usage: sbe_default_tool <image> <attribute> <value> <target type> <index>\n" @@ -46,31 +47,35 @@ void assertTarget(const char* str, unsigned int index) if(strcmp(str, "TARGET_TYPE_PROC_CHIP") == 0) { if (index > 0) { - fprintf(stderr, "sbe_default_tool: index is larger than 0\n"); + fprintf(stderr, "sbe_default_tool: index (%d) is larger than 0\n", index); exit(1); } return; } else if(strcmp(str, "TARGET_TYPE_EX") == 0) { - if (index >= EX_TARGET_COUNT) { - fprintf(stderr, "sbe_default_tool: index is larger than EX_TARGET_COUNT\n"); + if (index > EX_TARGET_COUNT) { + fprintf(stderr, "sbe_default_tool: index (%d) is larger than EX_TARGET_COUNT (%d)\n", + index, EX_TARGET_COUNT); exit(1); } return; } else if(strcmp(str, "TARGET_TYPE_EQ") == 0) { - if (index >= EQ_TARGET_COUNT) { - fprintf(stderr, "sbe_default_tool: index is larger than EQ_TARGET_COUNT\n"); + if (index > EQ_TARGET_COUNT) { + fprintf(stderr, "sbe_default_tool: index (%d) is larger than EQ_TARGET_COUNT (%d)\n", + index, EQ_TARGET_COUNT); exit(1); } return; } else if(strcmp(str, "TARGET_TYPE_CORE") == 0) { - if (index >= CORE_TARGET_COUNT) { - fprintf(stderr, "sbe_default_tool: index is larger than EQ_TARGET_COUNT\n"); + if (index > CORE_TARGET_COUNT) { + fprintf(stderr, "sbe_default_tool: index (%d) is larger than CORE_TARGET_COUNT (%d)\n", + index, CORE_TARGET_COUNT); exit(1); } return; } else if(strcmp(str, "TARGET_TYPE_PERV") == 0) { - if (index >= PERV_TARGET_COUNT) { - fprintf(stderr, "sbe_default_tool: index is larger than PERV_TARGET_COUNT\n"); + if (index > PERV_TARGET_COUNT) { + fprintf(stderr, "sbe_default_tool: index (%d) is larger than PERV_TARGET_COUNT (%d)\n", + index, PERV_TARGET_COUNT); exit(1); } return; @@ -100,45 +105,44 @@ void setAttribute(void* image, const char* attribute, unsigned int index, uint64 // debug purpose //printf("offset in string section: 0x%x \n", be32toh(item.iv_toc->iv_id)); - //printf("address: 0x%x \n", item.iv_address); + //printf("address: 0x%x index: %2d 0x%x\n", item.iv_address, index, index); sbe_xip_image2host(image, item.iv_address, &thePointer); // debug purpose - //printf("pointer1: 0x%x \n", thePointer); - //printf("val: 0x%llx \n", val); + //printf("pointer1: 0x%x val: 0x%llx \n", thePointer, val); if(item.iv_toc->iv_type == SBE_XIP_UINT8) { - *((uint8_t*)thePointer + index) = (uint8_t)val; + *((uint8_t*)thePointer + (index * sizeof(uint8_t))) = (uint8_t)val; } else if(item.iv_toc->iv_type == SBE_XIP_INT8) { - *((int8_t*)thePointer + index) = (int8_t)val; + *((int8_t*)thePointer + (index * sizeof(int8_t))) = (int8_t)val; } else if(item.iv_toc->iv_type == SBE_XIP_UINT16) { - *((uint16_t*)thePointer + index) = (uint16_t)val; + *((uint16_t*)thePointer + (index * sizeof(uint16_t))) = xipRevLe16((uint16_t)val); } else if(item.iv_toc->iv_type == SBE_XIP_INT16) { - *((int16_t*)thePointer + index) = (int16_t)val; + *((int16_t*)thePointer + (index * sizeof(int16_t))) = xipRevLe16((int16_t)val); } else if(item.iv_toc->iv_type == SBE_XIP_UINT32) { - *((uint32_t*)thePointer + index) = (uint32_t)val; + *((uint32_t*)thePointer + (index * sizeof(uint32_t))) = xipRevLe32((uint32_t)val); } else if(item.iv_toc->iv_type == SBE_XIP_INT32) { - *((int32_t*)thePointer + index) = (int32_t)val; + *((int32_t*)thePointer + (index * sizeof(int32_t))) = xipRevLe32((int32_t)val); } else if(item.iv_toc->iv_type == SBE_XIP_UINT64) { - *((uint64_t*)thePointer + index) = (uint64_t)val; + *((uint64_t*)thePointer + (index * sizeof(uint64_t))) = xipRevLe64((uint64_t)val); } else if(item.iv_toc->iv_type == SBE_XIP_INT64) { - *((int64_t*)thePointer + index) = (int64_t)val; + *((int64_t*)thePointer + (index * sizeof(int64_t))) = xipRevLe64((int64_t)val); } else { fprintf(stderr, "sbe_default_tool: type not available"); @@ -152,7 +156,8 @@ void setAttribute(void* image, const char* attribute, unsigned int index, uint64 SBE_XIP_TYPE_STRINGS(type_name); // debug purpose - //printf("pointer2: 0x%x \n", thePointer); + //printf("pointer2: 0x%x \n", thePointer + index); + //printf("elements: %d \n", item.iv_elements); //printf("section id: %s \n", section_name[item.iv_toc->iv_section]); //printf("location in section: 0x%x \n", be32toh(item.iv_toc->iv_data)); //printf("type name: %s \n", type_name[item.iv_toc->iv_type]); @@ -180,38 +185,38 @@ uint64_t getAttribute(void* image, const char* attribute, unsigned int index) { if(item.iv_toc->iv_type == SBE_XIP_UINT8) { - val = *((uint8_t*)thePointer + index); + val = *((uint8_t*)thePointer + (index * sizeof(uint8_t))); } else if(item.iv_toc->iv_type == SBE_XIP_INT8) { - val = *((int8_t*)thePointer + index); + val = *((int8_t*)thePointer + (index * sizeof(int8_t))); val &= 0xFF; } else if(item.iv_toc->iv_type == SBE_XIP_UINT16) { - val = *((uint16_t*)thePointer + index); + val = xipRevLe16(*((uint16_t*)thePointer + (index * sizeof(uint16_t)))); } else if(item.iv_toc->iv_type == SBE_XIP_INT16) { - val = *((int16_t*)thePointer + index); + val = xipRevLe16(*((int16_t*)thePointer + (index * sizeof(int16_t)))); val &= 0xFFFF; } else if(item.iv_toc->iv_type == SBE_XIP_UINT32) { - val = *((uint32_t*)thePointer + index); + val = xipRevLe32(*((uint32_t*)thePointer + (index * sizeof(uint32_t)))); } else if(item.iv_toc->iv_type == SBE_XIP_INT32) { - val = *((int32_t*)thePointer + index); + val = xipRevLe32(*((int32_t*)thePointer + (index * sizeof(int32_t)))); val &= 0xFFFFFFFF; } else if(item.iv_toc->iv_type == SBE_XIP_UINT64) { - val = *((uint64_t*)thePointer + index); + val = xipRevLe64(*((uint64_t*)thePointer + (index * sizeof(uint64_t)))); } else if(item.iv_toc->iv_type == SBE_XIP_INT64) { - val = *((int64_t*)thePointer + index); + val = xipRevLe64(*((int64_t*)thePointer + (index * sizeof(int64_t)))); } else { fprintf(stderr, "sbe_default_tool: type not available"); @@ -269,7 +274,7 @@ int main(int argc, const char** argv) if((check & val) != check) { - fprintf(stderr, "sbe_default_tool: set and get values not equal"); + fprintf(stderr, "sbe_default_tool: set and get values not equal -> "); fprintf(stderr, "%lx != %lx\n", check, val); exit(1); diff --git a/tools/image/sbe_xip_tool.c b/tools/image/sbe_xip_tool.c index 75448a25..8f6318db 100644 --- a/tools/image/sbe_xip_tool.c +++ b/tools/image/sbe_xip_tool.c @@ -324,40 +324,40 @@ tocListing(void* io_image, if (rc) break; printf("0x%02x", (uint8_t)data); break; - case SBE_XIP_INT8: + case SBE_XIP_UINT16: rc = sbe_xip_get_scalar(io_image, i_item->iv_id, &data); if (rc) break; - printf("%d", (int8_t)data); + printf("0x%04x", (uint16_t)data); break; - case SBE_XIP_UINT16: + case SBE_XIP_UINT32: rc = sbe_xip_get_scalar(io_image, i_item->iv_id, &data); if (rc) break; - printf("0x%08x", (uint16_t)data); + printf("0x%08x", (uint32_t)data); break; - case SBE_XIP_INT16: + case SBE_XIP_UINT64: rc = sbe_xip_get_scalar(io_image, i_item->iv_id, &data); if (rc) break; - printf("%d", (int16_t)data); + printf("0x%016llx", data); break; - case SBE_XIP_UINT32: + case SBE_XIP_INT8: rc = sbe_xip_get_scalar(io_image, i_item->iv_id, &data); if (rc) break; - printf("0x%08x", (uint32_t)data); + printf("0x%02x", (uint8_t)data); break; - case SBE_XIP_INT32: + case SBE_XIP_INT16: rc = sbe_xip_get_scalar(io_image, i_item->iv_id, &data); if (rc) break; - printf("%d", (int32_t)data); + printf("0x%04x", (uint16_t)data); break; - case SBE_XIP_UINT64: + case SBE_XIP_INT32: rc = sbe_xip_get_scalar(io_image, i_item->iv_id, &data); if (rc) break; - printf("0x%016llx", data); + printf("0x%08x", (uint32_t)data); break; case SBE_XIP_INT64: rc = sbe_xip_get_scalar(io_image, i_item->iv_id, &data); if (rc) break; - printf("%d", (int64_t)data); + printf("0x%016llx", data); break; case SBE_XIP_STRING: rc = sbe_xip_get_string(io_image, i_item->iv_id, &s); @@ -781,14 +781,6 @@ get(void* i_image, const int i_argc, const char** i_argv, int i_getv) } printf("%s\n", s); break; - case SBE_XIP_INT8: - case SBE_XIP_INT16: - case SBE_XIP_INT32: - case SBE_XIP_INT64: - fprintf(stderr, "%s%d : Bug, int types not implemented %d\n", - __FILE__, __LINE__, item.iv_type); - exit(1); - break; default: fprintf(stderr, "%s%d : Bug, unexpected type %d\n", __FILE__, __LINE__, item.iv_type); diff --git a/tools/scripts/ppeCreateAttrGetSetMacros.pl b/tools/scripts/ppeCreateAttrGetSetMacros.pl index 74eeb03e..78e8552f 100755 --- a/tools/scripts/ppeCreateAttrGetSetMacros.pl +++ b/tools/scripts/ppeCreateAttrGetSetMacros.pl @@ -215,12 +215,16 @@ for my $attribute (sort keys %{$enums{AttributeId}}) { } else { if ($type =~ m/uint8_t/) { $macroPostfix = "_UINT8_" . $dimension . "D_ARRAY"; + } elsif ($type =~ m/uint16_t/) { + $macroPostfix = "_UINT16_" . $dimension . "D_ARRAY"; } elsif ($type =~ m/uint32_t/) { $macroPostfix = "_UINT32_" . $dimension . "D_ARRAY"; } elsif ($type =~ m/uint64_t/) { $macroPostfix = "_UINT64_" . $dimension . "D_ARRAY"; } elsif ($type =~ m/int8_t/) { $macroPostfix = "_INT8_" . $dimension . "D_ARRAY"; + } elsif ($type =~ m/int16_t/) { + $macroPostfix = "_INT16_" . $dimension . "D_ARRAY"; } elsif ($type =~ m/int32_t/) { $macroPostfix = "_INT32_" . $dimension . "D_ARRAY"; } elsif ($type =~ m/int64_t/) { @@ -257,7 +261,7 @@ for my $attribute (sort keys %{$enums{AttributeId}}) { if(defined $targetMacro) { - my $targetFunction = "template<> void __get<fapi2::$targetMacro, fapi2attr::$macroTarget, $type, fapi2::${attribute}> ( const fapi2::Target<fapi2::$targetMacro>* i_ptarget, fapi2attr::$macroTarget* object, const fapi2::AttributeId attrid, $type *value )"; + my $targetFunction = "template<> void __get<fapi2::$targetMacro, fapi2attr::$macroTarget, $type, fapi2::${attribute}> ( const fapi2::Target<fapi2::$targetMacro>& i_ptarget, fapi2attr::$macroTarget* object, const fapi2::AttributeId attrid, $type *value )"; push(@newTargetDefines, $targetFunction . ";"); my $targetImplementation = ""; @@ -267,7 +271,7 @@ for my $attribute (sort keys %{$enums{AttributeId}}) { } else { - $targetImplementation .= "\n" . $targetFunction . "\n{\n uint32_t index = (i_ptarget)->getTargetNumber();\n *value = object->fapi2attr::${macroTarget}::${attribute}[index];\n}\n"; + $targetImplementation .= "\n" . $targetFunction . "\n{\n uint32_t index = i_ptarget.getTargetNumber();\n *value = object->fapi2attr::${macroTarget}::${attribute}[index];\n}\n"; } push(@newTargetImplementations, $targetImplementation); @@ -280,7 +284,7 @@ for my $attribute (sort keys %{$enums{AttributeId}}) { if(defined $targetMacro) { - my $targetFunction = "template<> void __set<fapi2::$targetMacro, fapi2attr::$macroTarget, $type, fapi2::${attribute}> ( const fapi2::Target<fapi2::$targetMacro>* i_ptarget, fapi2attr::$macroTarget* object, const fapi2::AttributeId attrid, $type* value )"; + my $targetFunction = "template<> void __set<fapi2::$targetMacro, fapi2attr::$macroTarget, $type, fapi2::${attribute}> ( const fapi2::Target<fapi2::$targetMacro>& i_ptarget, fapi2attr::$macroTarget* object, const fapi2::AttributeId attrid, $type* value )"; push(@newTargetDefines, $targetFunction . ";"); my $targetImplementation = ""; @@ -289,7 +293,7 @@ for my $attribute (sort keys %{$enums{AttributeId}}) { $targetImplementation = "\n" . $targetFunction . "\n{\n object->fapi2attr::${macroTarget}::${attribute} = *value;\n}\n"; } else { - $targetImplementation = "\n" . $targetFunction . "\n{\n uint32_t index = (i_ptarget)->getTargetNumber();\n object->fapi2attr::${macroTarget}::${attribute}[index] = *value;\n}\n"; + $targetImplementation = "\n" . $targetFunction . "\n{\n uint32_t index = i_ptarget.getTargetNumber();\n object->fapi2attr::${macroTarget}::${attribute}[index] = *value;\n}\n"; } push(@newTargetImplementations, $targetImplementation); diff --git a/tools/scripts/src/fapi2PlatAttributeService.H b/tools/scripts/src/fapi2PlatAttributeService.H index 3a3a7769..5010b2ea 100644 --- a/tools/scripts/src/fapi2PlatAttributeService.H +++ b/tools/scripts/src/fapi2PlatAttributeService.H @@ -18,14 +18,10 @@ #include "plat_target_parms.H" #define PLAT_GET_CHIP_EC_FEATURE_OVERRIDE(ID, PTARGET, VAL) \ - fapi2::_getEcFeatureOverride<fapi2::ID##_Type>(fapi2::ID, PTARGET, VAL) + _getEcFeatureOverride<ID##_Type>(ID, PTARGET, VAL) /* INSERT NEW ATTRIBUTES HERE */ -#define ATTR_TARGET_SCOMABLE_GETMACRO PLAT_ATTR_GET_GLOBAL_INT -#define ATTR_TARGET_SCOMABLE_SETMACRO PLAT_ATTR_SET_GLOBAL_INT - - /******************************************************************************/ /* * Global macros * */ @@ -35,101 +31,101 @@ /* global get uint8_t 1D array macro */ #define PLAT_ATTR_GET_UINT8_1D_ARRAY(ID, PTARGET, VAL) \ - fapi2::_getAttributeArrayShort<fapi2::ID##_Type, static_cast<TargetType>(fapi2::ID##_TargetTypes), fapi2::ID> \ - (fapi2::ID, PTARGET, VAL) + _getAttributeArrayShort<ID##_Type, static_cast<fapi2::TargetType>(ID##_TargetTypes), ID> \ + (ID, PTARGET, VAL) /* global set uint8_t 1D array macro */ #define PLAT_ATTR_SET_UINT8_1D_ARRAY(ID, PTARGET, VAL) \ - fapi2::_setAttributeArrayShort<fapi2::ID##_Type, static_cast<TargetType>(fapi2::ID##_TargetTypes), fapi2::ID> \ - (fapi2::ID, PTARGET, VAL) + _setAttributeArrayShort<ID##_Type, static_cast<fapi2::TargetType>(ID##_TargetTypes), ID> \ + (ID, PTARGET, VAL) /* global get uint8_t 2D array macro */ #define PLAT_ATTR_GET_UINT8_2D_ARRAY(ID, PTARGET, VAL) \ - fapi2::_getAttributeArrayShort(fapi2::ID, PTARGET, VAL[0]) + _getAttributeArrayShort(ID, PTARGET, VAL[0]) /* global set uint8_t 2D array macro */ #define PLAT_ATTR_SET_UINT8_2D_ARRAY(ID, PTARGET, VAL) \ - fapi2::_setAttributeArrayShort(fapi2::ID, PTARGET, VAL[0]) + _setAttributeArrayShort(ID, PTARGET, VAL[0]) /* global get uint8_t 3D array macro */ #define PLAT_ATTR_GET_UINT8_3D_ARRAY(ID, PTARGET, VAL) \ - fapi2::_getAttributeArrayShort(fapi2::ID, PTARGET, VAL[0][0]) + _getAttributeArrayShort(ID, PTARGET, VAL[0][0]) /* global set uint8_t 3D array macro */ #define PLAT_ATTR_SET_UINT8_3D_ARRAY(ID, PTARGET, VAL) \ - fapi2::_setAttributeArrayShort(fapi2::ID, PTARGET, VAL[0][0]) + _setAttributeArrayShort(ID, PTARGET, VAL[0][0]) /* global get uint8_t 4D array macro */ #define PLAT_ATTR_GET_UINT8_4D_ARRAY(ID, PTARGET, VAL) \ - fapi2::_getAttributeArrayShort(fapi2::ID, PTARGET, VAL[0][0][0]) + _getAttributeArrayShort(ID, PTARGET, VAL[0][0][0]) /* global set uint8_t 4D array macro */ #define PLAT_ATTR_SET_UINT8_4D_ARRAY(ID, PTARGET, VAL) \ - fapi2::_setAttributeArrayShort(fapi2::ID, PTARGET, VAL[0][0][0]) + _setAttributeArrayShort(ID, PTARGET, VAL[0][0][0]) /* global get uint32_t 1D array macro */ #define PLAT_ATTR_GET_UINT32_1D_ARRAY(ID, PTARGET, VAL) \ - fapi2::_getAttributeArrayWord(fapi2::ID, PTARGET, VAL) + _getAttributeArrayWord(ID, PTARGET, VAL) /* global set uint32_t 1D array macro */ #define PLAT_ATTR_SET_UINT32_1D_ARRAY(ID, PTARGET, VAL) \ - fapi2::_setAttributeArrayWord(fapi2::ID, PTARGET, VAL) + _setAttributeArrayWord(ID, PTARGET, VAL) /* global get uint32_t 2D array macro */ #define PLAT_ATTR_GET_UINT32_2D_ARRAY(ID, PTARGET, VAL) \ - fapi2::_getAttributeArrayWord(fapi2::ID, PTARGET, VAL[0]) + _getAttributeArrayWord(ID, PTARGET, VAL[0]) /* global set uint32_t 2D array macro */ #define PLAT_ATTR_SET_UINT32_2D_ARRAY(ID, PTARGET, VAL) \ - fapi2::_setAttributeArrayWord(fapi2::ID, PTARGET, VAL[0]) + _setAttributeArrayWord(ID, PTARGET, VAL[0]) /* global get uint32_t 3D array macro */ #define PLAT_ATTR_GET_UINT32_3D_ARRAY(ID, PTARGET, VAL) \ - fapi2::_getAttributeArrayWord(fapi2::ID, PTARGET, VAL[0][0]) + _getAttributeArrayWord(ID, PTARGET, VAL[0][0]) /* global set uint32_t 3D array macro */ #define PLAT_ATTR_SET_UINT32_3D_ARRAY(ID, PTARGET, VAL) \ - fapi2::_setAttributeArrayWord(fapi2::ID, PTARGET, VAL[0][0]) + _setAttributeArrayWord(ID, PTARGET, VAL[0][0]) /* global get uint32_t 4D array macro */ #define PLAT_ATTR_GET_UINT32_4D_ARRAY(ID, PTARGET, VAL) \ - fapi2::_getAttributeArrayWord(fapi2::ID, PTARGET, VAL[0][0][0]) + _getAttributeArrayWord(ID, PTARGET, VAL[0][0][0]) /* global set uint32_t 4D array macro */ #define PLAT_ATTR_SET_UINT32_4D_ARRAY(ID, PTARGET, VAL) \ - fapi2::_setAttributeArrayWord(fapi2::ID, PTARGET, VAL[0][0][0]) + _setAttributeArrayWord(ID, PTARGET, VAL[0][0][0]) /* global get uint64_t 1D array macro */ #define PLAT_ATTR_GET_UINT64_1D_ARRAY(ID, PTARGET, VAL) \ - fapi2::_getAttributeArrayDoubleWord(fapi2::ID, PTARGET, VAL) + _getAttributeArrayDoubleWord(ID, PTARGET, VAL) /* global set uint64_t 1D array macro */ #define PLAT_ATTR_SET_UINT64_1D_ARRAY(ID, PTARGET, VAL) \ - fapi2::_setAttributeArrayDoubleWord(fapi2::ID, PTARGET, VAL) + _setAttributeArrayDoubleWord(ID, PTARGET, VAL) /* global get uint64_t 2D array macro */ #define PLAT_ATTR_GET_UINT64_2D_ARRAY(ID, PTARGET, VAL) \ - fapi2::_getAttributeArrayDoubleWord(fapi2::ID, PTARGET, VAL[0]) + _getAttributeArrayDoubleWord(ID, PTARGET, VAL[0]) /* global set uint64_t 2D array macro */ #define PLAT_ATTR_SET_UINT64_2D_ARRAY(ID, PTARGET, VAL) \ - fapi2::_setAttributeArrayDoubleWord(fapi2::ID, PTARGET, VAL[0]) + _setAttributeArrayDoubleWord(ID, PTARGET, VAL[0]) /* global get uint64_t 3D array macro */ #define PLAT_ATTR_GET_UINT64_3D_ARRAY(ID, PTARGET, VAL) \ - fapi2::_getAttributeArrayDoubleWord(fapi2::ID, PTARGET, VAL[0][0]) + _getAttributeArrayDoubleWord(ID, PTARGET, VAL[0][0]) /* global set uint64_t 3D array macro */ #define PLAT_ATTR_SET_UINT64_3D_ARRAY(ID, PTARGET, VAL) \ - fapi2::_setAttributeArrayDoubleWord(fapi2::ID, PTARGET, VAL[0][0]) + _setAttributeArrayDoubleWord(ID, PTARGET, VAL[0][0]) /* global get uint64_t 4D array macro */ #define PLAT_ATTR_GET_UINT64_4D_ARRAY(ID, PTARGET, VAL) \ - fapi2::_getAttributeArrayDoubleWord(fapi2::ID, PTARGET, VAL[0][0][0]) + _getAttributeArrayDoubleWord(ID, PTARGET, VAL[0][0][0]) /* global set uint64_t 4D array macro */ #define PLAT_ATTR_SET_UINT64_4D_ARRAY(ID, PTARGET, VAL) \ - fapi2::_setAttributeArrayDoubleWord(fapi2::ID, PTARGET, VAL[0][0][0]) + _setAttributeArrayDoubleWord(ID, PTARGET, VAL[0][0][0]) -/* global get int macro (uint8_t, 32 and 64) */ +/* global get int macro (uint8_t, 16, 32 and 64) */ #define PLAT_ATTR_GET_GLOBAL_INT(ID, PTARGET, VAL) \ - fapi2::_get<fapi2::ID##_Type, static_cast<TargetType>(fapi2::ID##_TargetTypes), fapi2::ID> \ - (fapi2::ID, PTARGET, VAL) + _get<ID##_Type, static_cast<fapi2::TargetType>(ID##_TargetTypes), ID> \ + (ID, PTARGET, VAL) -/* global set int macro (uint8_t, 32 and 64) */ +/* global set int macro (uint8_t, 16, 32 and 64) */ #define PLAT_ATTR_SET_GLOBAL_INT(ID, PTARGET, VAL) \ - fapi2::_set<fapi2::ID##_Type, static_cast<TargetType>(fapi2::ID##_TargetTypes), fapi2::ID> \ - (fapi2::ID, PTARGET, VAL) + _set<ID##_Type, static_cast<fapi2:TargetType>(ID##_TargetTypes), ID> \ + (ID, PTARGET, VAL) //here @@ -139,48 +135,48 @@ /******************************************************************************/ /* global get override uint8_t 1D array macro */ #define PLAT_ATTR_GET_OVERRIDE_UINT8_1D_ARRAY(ID, PTARGET, VAL) \ - fapi2::_getAttributeOverrideArrayShort(fapi2::ID, PTARGET, VAL) + _getAttributeOverrideArrayShort(ID, PTARGET, VAL) /* global get override uint8_t 2D array macro */ #define PLAT_ATTR_GET_OVERRIDE_UINT8_2D_ARRAY(ID, PTARGET, VAL) \ - fapi2::_getAttributeOverrideArrayShort(fapi2::ID, PTARGET, VAL[0]) + _getAttributeOverrideArrayShort(ID, PTARGET, VAL[0]) /* global get override uint8_t 3D array macro */ #define PLAT_ATTR_GET_OVERRIDE_UINT8_3D_ARRAY(ID, PTARGET, VAL) \ - fapi2::_getAttributeOverrideArrayShort(fapi2::ID, PTARGET, VAL[0][0]) + _getAttributeOverrideArrayShort(ID, PTARGET, VAL[0][0]) /* global get override uint8_t 4D array macro */ #define PLAT_ATTR_GET_OVERRIDE_UINT8_4D_ARRAY(ID, PTARGET, VAL) \ - fapi2::_getAttributeOverrideArrayShort(fapi2::ID, PTARGET, VAL[0][0][0]) + _getAttributeOverrideArrayShort(ID, PTARGET, VAL[0][0][0]) /* global get override uint32_t 1D array macro */ #define PLAT_ATTR_GET_OVERRIDE_UINT32_1D_ARRAY(ID, PTARGET, VAL) \ - fapi2::_getAttributeOverrideArrayWord(fapi2::ID, PTARGET, VAL) + _getAttributeOverrideArrayWord(ID, PTARGET, VAL) /* global get override uint32_t 2D array macro */ #define PLAT_ATTR_GET_OVERRIDE_UINT32_2D_ARRAY(ID, PTARGET, VAL) \ - fapi2::_getAttributeOverrideArrayWord(fapi2::ID, PTARGET, VAL[0]) + _getAttributeOverrideArrayWord(ID, PTARGET, VAL[0]) /* global get override uint32_t 3D array macro */ #define PLAT_ATTR_GET_OVERRIDE_UINT32_3D_ARRAY(ID, PTARGET, VAL) \ - fapi2::_getAttributeOverrideArrayWord(fapi2::ID, PTARGET, VAL[0][0]) + _getAttributeOverrideArrayWord(ID, PTARGET, VAL[0][0]) /* global get override uint32_t 4D array macro */ #define PLAT_ATTR_GET_OVERRIDE_UINT32_4D_ARRAY(ID, PTARGET, VAL) \ - fapi2::_getAttributeOverrideArrayWord(fapi2::ID, PTARGET, VAL[0][0][0]) + _getAttributeOverrideArrayWord(ID, PTARGET, VAL[0][0][0]) /* global get override uint64_t 1D array macro */ #define PLAT_ATTR_GET_OVERRIDE_UINT64_1D_ARRAY(ID, PTARGET, VAL) \ - fapi2::_getAttributeOverrideArrayDoubleWord(fapi2::ID, PTARGET, VAL) + _getAttributeOverrideArrayDoubleWord(ID, PTARGET, VAL) /* global get override uint64_t 2D array macro */ #define PLAT_ATTR_GET_OVERRIDE_UINT64_2D_ARRAY(ID, PTARGET, VAL) \ - fapi2::_getAttributeOverrideArrayDoubleWord(fapi2::ID, PTARGET, VAL[0]) + _getAttributeOverrideArrayDoubleWord(ID, PTARGET, VAL[0]) /* global get override uint64_t 3D array macro */ #define PLAT_ATTR_GET_OVERRIDE_UINT64_3D_ARRAY(ID, PTARGET, VAL) \ - fapi2::_getAttributeOverrideArrayDoubleWord(fapi2::ID, PTARGET, VAL[0][0]) + _getAttributeOverrideArrayDoubleWord(ID, PTARGET, VAL[0][0]) /* global get override uint64_t 4D array macro */ #define PLAT_ATTR_GET_OVERRIDE_UINT64_4D_ARRAY(ID, PTARGET, VAL) \ - fapi2::_getAttributeOverrideArrayDoubleWord(fapi2::ID, PTARGET, VAL[0][0][0]) + _getAttributeOverrideArrayDoubleWord(ID, PTARGET, VAL[0][0][0]) /* global get override int macro (uint8_t, 32 and 64) */ #define PLAT_ATTR_GET_OVERRIDE_GLOBAL_INT(ID, PTARGET, VAL) \ - fapi2::_getOverride<fapi2::ID##_Type>(fapi2::ID, PTARGET, VAL) + _getOverride<ID##_Type>(ID, PTARGET, VAL) /******************************************************************************/ // Get string @@ -188,11 +184,17 @@ extern "C" { - extern fapi2attr::ProcChipAttributes_t* G_proc_chip_attributes asm("G_proc_chip_attributes") __attribute__ ((section (".fixed"))); - extern fapi2attr::PervAttributes_t* G_perv_attributes asm("G_perv_attributes") __attribute__ ((section (".fixed"))); - extern fapi2attr::CoreAttributes_t* G_core_attributes asm("G_core_attributes") __attribute__ ((section (".fixed"))); - extern fapi2attr::EQAttributes_t* G_eq_attributes asm("G_eq_attributes") __attribute__ ((section (".fixed"))); - extern fapi2attr::EXAttributes_t* G_ex_attributes asm("G_ex_attributes") __attribute__ ((section (".fixed"))); + extern fapi2attr::ProcChipAttributes_t G_proc_chip_attributes asm("G_proc_chip_attributes") __attribute__ ((section (".fixed"))); + extern fapi2attr::PervAttributes_t G_perv_attributes asm("G_perv_attributes") __attribute__ ((section (".fixed"))); + extern fapi2attr::CoreAttributes_t G_core_attributes asm("G_core_attributes") __attribute__ ((section (".fixed"))); + extern fapi2attr::EQAttributes_t G_eq_attributes asm("G_eq_attributes") __attribute__ ((section (".fixed"))); + extern fapi2attr::EXAttributes_t G_ex_attributes asm("G_ex_attributes") __attribute__ ((section (".fixed"))); + + extern fapi2attr::ProcChipAttributes_t* G_proc_chip_attributes_ptr ; + extern fapi2attr::PervAttributes_t* G_perv_attributes_ptr; + extern fapi2attr::CoreAttributes_t* G_core_attributes_ptr; + extern fapi2attr::EQAttributes_t* G_eq_attributes_ptr; + extern fapi2attr::EXAttributes_t* G_ex_attributes_ptr; } @@ -202,11 +204,11 @@ namespace fapi2 // Parameters are done as pointers (vs references) to allow the attribute // storage to be relocated -template<fapi2::TargetType K, typename TAttrStruct, typename TValue, fapi2::AttributeId AId> -void __set( const fapi2::Target<K>* i_ptarget, TAttrStruct* object, const fapi2::AttributeId attrid, TValue* value ); +template<TargetType K, typename TAttrStruct, typename TValue, AttributeId AId> +void __set( const Target<K>& i_ptarget, TAttrStruct* object, const AttributeId attrid, TValue* value ); -template<fapi2::TargetType K, typename TAttrStruct, typename TValue, fapi2::AttributeId AId> -void __get( const fapi2::Target<K>* i_ptarget, TAttrStruct* object, const fapi2::AttributeId attrid, TValue* value ); +template<TargetType K, typename TAttrStruct, typename TValue, AttributeId AId> +void __get( const Target<K>& i_ptarget, TAttrStruct* object, const AttributeId attrid, TValue* value ); /* INSERT NEW GETTER AND SETTER FUNCTIONS HERE */ @@ -218,7 +220,7 @@ void __get( const fapi2::Target<K>* i_ptarget, TAttrStruct* object, const fapi2: //****************************************************************************** template<typename T, TargetType K, AttributeId A> ReturnCode _get(const AttributeId i_Id, - const Target<K> * const i_pTarget, + const Target<K> & i_pTarget, T& o_value) { return FAPI2_RC_SUCCESS; @@ -228,35 +230,73 @@ ReturnCode _get(const AttributeId i_Id, // Get uint8_t //****************************************************************************** template<typename T, TargetType K, AttributeId A> -ReturnCode _get(const fapi2::AttributeId i_id, - const Target<K> * const i_pTarget, +ReturnCode _get(const AttributeId i_id, + const Target<K> & i_pTarget, uint8_t& o_value) { static_assert(std::is_same<T, uint8_t>::value, "Attribute type mismatch"); if(K & TARGET_TYPE_PROC_CHIP) { - __get<K, fapi2attr::ProcChipAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes, i_id, &o_value ); + __get<K, fapi2attr::ProcChipAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes_ptr, i_id, &o_value ); } if(K & TARGET_TYPE_PERV) { - __get<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes, i_id, &o_value ); + __get<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes_ptr, i_id, &o_value ); } if(K & TARGET_TYPE_CORE) { - __get<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes, i_id, &o_value ); + __get<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes_ptr, i_id, &o_value ); } if(K & TARGET_TYPE_EQ) { - __get<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes, i_id, &o_value ); + __get<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes_ptr, i_id, &o_value ); } if(K & TARGET_TYPE_EX) { - __get<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes, i_id, &o_value ); + __get<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes_ptr, i_id, &o_value ); + } + + return FAPI2_RC_SUCCESS; +} + +//****************************************************************************** +// Get uint16_t +//****************************************************************************** +template<typename T, TargetType K, AttributeId A> +ReturnCode _get(const AttributeId i_id, + const Target<K> & i_pTarget, + uint16_t& o_value) +{ + static_assert(std::is_same<T, uint16_t>::value, "Attribute type mismatch"); + + if(K & TARGET_TYPE_PROC_CHIP) + { + __get<K, fapi2attr::ProcChipAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes_ptr, i_id, &o_value ); + } + + if(K & TARGET_TYPE_PERV) + { + __get<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes_ptr, i_id, &o_value ); + } + + if(K & TARGET_TYPE_CORE) + { + __get<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes_ptr, i_id, &o_value ); + } + + if(K & TARGET_TYPE_EQ) + { + __get<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes_ptr, i_id, &o_value ); + } + + if(K & TARGET_TYPE_EX) + { + __get<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes_ptr, i_id, &o_value ); } return FAPI2_RC_SUCCESS; @@ -268,34 +308,34 @@ ReturnCode _get(const fapi2::AttributeId i_id, //****************************************************************************** template<typename T, TargetType K, AttributeId A> ReturnCode _get(const AttributeId i_id, - const Target<K> * const i_pTarget, + const Target<K> & i_pTarget, uint32_t& o_value) { static_assert(std::is_same<T, uint32_t>::value, "Attribute type mismatch"); if(K & TARGET_TYPE_PROC_CHIP) { - __get<K, fapi2attr::ProcChipAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes, i_id, &o_value ); + __get<K, fapi2attr::ProcChipAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes_ptr, i_id, &o_value ); } if(K & TARGET_TYPE_PERV) { - __get<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes, i_id, &o_value ); + __get<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes_ptr, i_id, &o_value ); } if(K & TARGET_TYPE_CORE) { - __get<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes, i_id, &o_value ); + __get<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes_ptr, i_id, &o_value ); } if(K & TARGET_TYPE_EQ) { - __get<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes, i_id, &o_value ); + __get<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes_ptr, i_id, &o_value ); } if(K & TARGET_TYPE_EX) { - __get<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes, i_id, &o_value ); + __get<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes_ptr, i_id, &o_value ); } return FAPI2_RC_SUCCESS; @@ -307,7 +347,7 @@ ReturnCode _get(const AttributeId i_id, //****************************************************************************** template<typename T, TargetType K, AttributeId A> ReturnCode _get(const AttributeId i_id, - const Target<K> * const i_pTarget, + const Target<K> & i_pTarget, uint64_t& o_value) { static_assert(std::is_same<T, uint64_t>::value, "Attribute type mismatch"); @@ -315,27 +355,27 @@ ReturnCode _get(const AttributeId i_id, if(K & TARGET_TYPE_PROC_CHIP) { - __get<K, fapi2attr::ProcChipAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes, i_id, &o_value ); + __get<K, fapi2attr::ProcChipAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes_ptr, i_id, &o_value ); } if(K & TARGET_TYPE_PERV) { - __get<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes, i_id, &o_value ); + __get<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes_ptr, i_id, &o_value ); } if(K & TARGET_TYPE_CORE) { - __get<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes, i_id, &o_value ); + __get<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes_ptr, i_id, &o_value ); } if(K & TARGET_TYPE_EQ) { - __get<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes, i_id, &o_value ); + __get<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes_ptr, i_id, &o_value ); } if(K & TARGET_TYPE_EX) { - __get<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes, i_id, &o_value ); + __get<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes_ptr, i_id, &o_value ); } return FAPI2_RC_SUCCESS; @@ -347,7 +387,7 @@ ReturnCode _get(const AttributeId i_id, //****************************************************************************** template<typename T, TargetType K, AttributeId A> ReturnCode _getOverride(const AttributeId i_id, - const Target<K> * const i_pTarget, + const Target<K> & i_pTarget, uint8_t& o_value) { static_assert(std::is_same<T, uint8_t>::value, "Attribute type mismatch"); @@ -357,11 +397,25 @@ ReturnCode _getOverride(const AttributeId i_id, //****************************************************************************** +// Get Override uint16_t +//****************************************************************************** +template<typename T, TargetType K, AttributeId A> +ReturnCode _getOverride(const AttributeId i_id, + const Target<K> & i_pTarget, + uint16_t& o_value) +{ + static_assert(std::is_same<T, uint16_t>::value, "Attribute type mismatch"); + + return FAPI2_RC_SUCCESS; +} + + +//****************************************************************************** // Get Override uint32_t //****************************************************************************** template<typename T, TargetType K, AttributeId A> ReturnCode _getOverride(const AttributeId i_id, - const Target<K> * const i_pTarget, + const Target<K> & i_pTarget, uint32_t& o_value) { static_assert(std::is_same<T, uint32_t>::value, "Attribute type mismatch"); @@ -375,7 +429,7 @@ ReturnCode _getOverride(const AttributeId i_id, //****************************************************************************** template<typename T, TargetType K, AttributeId A> ReturnCode _getOverride(const AttributeId i_id, - const Target<K> * const i_pTarget, + const Target<K> & i_pTarget, uint64_t& o_value) { static_assert(std::is_same<T, uint64_t>::value, "Attribute type mismatch"); @@ -389,7 +443,7 @@ ReturnCode _getOverride(const AttributeId i_id, //****************************************************************************** template<typename T, TargetType K, AttributeId A> ReturnCode _getEcFeatureOverride(const AttributeId i_id, - const Target<K> * const i_pTarget, + const Target<K> & i_pTarget, uint8_t& o_value) { static_assert(std::is_same<T, uint8_t>::value, "Attribute type mismatch"); @@ -408,7 +462,7 @@ ReturnCode _getEcFeatureOverride(const AttributeId i_id, //****************************************************************************** template<typename T, TargetType K, AttributeId A> ReturnCode _getAttributeArrayShort(const AttributeId i_id, - const Target<K> * const i_pTarget, + const Target<K> & i_pTarget, uint8_t * o_pValues) { // fapi2::Attributeta o_data; @@ -435,43 +489,65 @@ ReturnCode _getAttributeArrayShort(const AttributeId i_id, //****************************************************************************** template<typename T, TargetType K, AttributeId A> ReturnCode _setAttributeArrayShort(const AttributeId i_id, - const Target<K> * const i_pTarget, + const Target<K> & i_pTarget, uint8_t * i_pValues) { if(K & TARGET_TYPE_PROC_CHIP) { - __set<K, fapi2attr::CoreAttributes_t, T, A>( *i_pTarget, G_proc_chip_attributes, *i_pValues ); + __set<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes_ptr, *i_pValues ); } if(K & TARGET_TYPE_PERV) { - __set<K, fapi2attr::PervAttributes_t, T, A>( *i_pTarget, G_perv_attributes, i_pValues ); + __set<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes_ptr, i_pValues ); } if(K & TARGET_TYPE_CORE) { - __set<K, fapi2attr::CoreAttributes_t, T, A>( *i_pTarget, G_core_attributes, *i_pValues ); + __set<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes_ptr, *i_pValues ); } if(K & TARGET_TYPE_EQ) { - __set<K, fapi2attr::EQAttributes_t, T, A>( *i_pTarget, G_eq_attributes, *i_pValues ); + __set<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes_ptr, *i_pValues ); } if(K & TARGET_TYPE_EX) { - __set<K, fapi2attr::EXAttributes_t, T, A>( *i_pTarget, G_ex_attributes, *i_pValues ); + __set<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes_ptr, *i_pValues ); } return FAPI2_RC_SUCCESS; } //****************************************************************************** +// Get uint16_t array +//****************************************************************************** +template<typename T, TargetType K, AttributeId A> +ReturnCode _getAttributeArrayWord(const AttributeId i_id, + const Target<K> & i_pTarget, + uint16_t * o_pValues) +{ + return FAPI2_RC_SUCCESS; +} + +//****************************************************************************** +// Set uint16_t array +//****************************************************************************** +template<typename T, TargetType K, AttributeId A> +ReturnCode _setAttributeArrayWord(const AttributeId i_id, + const Target<K> & i_pTarget, + uint16_t * i_pValues) +{ + return FAPI2_RC_SUCCESS; +} + +//****************************************************************************** // Get uint32_t array //****************************************************************************** template<typename T, TargetType K, AttributeId A> ReturnCode _getAttributeArrayWord(const AttributeId i_id, - const Target<K> * const i_pTarget, + const Target<K> & i_pTarget, uint32_t * o_pValues) { return FAPI2_RC_SUCCESS; @@ -482,18 +558,19 @@ ReturnCode _getAttributeArrayWord(const AttributeId i_id, //****************************************************************************** template<typename T, TargetType K, AttributeId A> ReturnCode _setAttributeArrayWord(const AttributeId i_id, - const Target<K> * const i_pTarget, + const Target<K> & i_pTarget, uint32_t * i_pValues) { return FAPI2_RC_SUCCESS; } + //****************************************************************************** // Get uint64_t array //****************************************************************************** template<typename T, TargetType K, AttributeId A> ReturnCode _getAttributeArrayDoubleWord(const AttributeId i_id, - const Target<K> * const i_pTarget, + const Target<K> & i_pTarget, uint64_t * o_pValues) { return FAPI2_RC_SUCCESS; @@ -504,7 +581,7 @@ ReturnCode _getAttributeArrayDoubleWord(const AttributeId i_id, //****************************************************************************** template<typename T, TargetType K, AttributeId A> ReturnCode _setAttributeArrayDoubleWord(const AttributeId i_id, - const Target<K> * const i_pTarget, + const Target<K> & i_pTarget, uint64_t * i_pValues) { return FAPI2_RC_SUCCESS; @@ -515,18 +592,29 @@ ReturnCode _setAttributeArrayDoubleWord(const AttributeId i_id, //****************************************************************************** template<typename T, TargetType K, AttributeId A> ReturnCode _getAttributeOverrideArrayShort(const AttributeId i_id, - const Target<K> * const i_pTarget, + const Target<K> & i_pTarget, uint8_t * o_pValues) { return FAPI2_RC_SUCCESS; } //****************************************************************************** +// Get Override uint16_t array +//****************************************************************************** +template<typename T, TargetType K, AttributeId A> +ReturnCode _getAttributeOverrideArrayWord(const AttributeId i_id, + const Target<K> & i_pTarget, + uint16_t * o_pValues) +{ + return FAPI2_RC_SUCCESS; +} + +//****************************************************************************** // Get Override uint32_t array //****************************************************************************** template<typename T, TargetType K, AttributeId A> ReturnCode _getAttributeOverrideArrayWord(const AttributeId i_id, - const Target<K> * const i_pTarget, + const Target<K> & i_pTarget, uint32_t * o_pValues) { return FAPI2_RC_SUCCESS; @@ -537,7 +625,7 @@ ReturnCode _getAttributeOverrideArrayWord(const AttributeId i_id, //****************************************************************************** template<typename T, TargetType K, AttributeId A> ReturnCode _getAttributeOverrideArrayDoubleWord(const AttributeId i_id, - const Target<K> * const i_pTarget, + const Target<K> & i_pTarget, uint64_t * o_pValues) { return FAPI2_RC_SUCCESS; @@ -549,7 +637,7 @@ ReturnCode _getAttributeOverrideArrayDoubleWord(const AttributeId i_id, //****************************************************************************** template<typename T, TargetType K, AttributeId A> ReturnCode _set(const AttributeId i_Id, - const Target<K> * const i_pTarget, + const Target<K> & i_pTarget, T& i_value) { return FAPI2_RC_SUCCESS; @@ -562,34 +650,34 @@ ReturnCode _set(const AttributeId i_Id, //****************************************************************************** template<typename T, TargetType K, typename A> ReturnCode _set(const AttributeId i_Id, - const Target<K> * const i_pTarget, + const Target<K> & i_pTarget, uint8_t& i_value) { static_assert(std::is_same<T, uint8_t>::value, "Attribute type mismatch"); // May need to remove if(K & TARGET_TYPE_PROC_CHIP) { - __set<K, fapi2attr::CoreAttributes_t, T, A>( *i_pTarget, G_proc_chip_attributes, i_value ); + __set<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes_ptr, i_value ); } if(K & TARGET_TYPE_PERV) { - __set<K, fapi2attr::PervAttributes_t, T, A>( *i_pTarget, G_perv_attributes, i_value ); + __set<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes_ptr, i_value ); } if(K & TARGET_TYPE_CORE) { - __set<K, fapi2attr::CoreAttributes_t, T, A>( *i_pTarget, G_core_attributes, i_value ); + __set<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes_ptr, i_value ); } if(K & TARGET_TYPE_EQ) { - __set<K, fapi2attr::EQAttributes_t, T, A>( *i_pTarget, G_eq_attributes, i_value ); + __set<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes_ptr, i_value ); } if(K & TARGET_TYPE_EX) { - __set<K, fapi2attr::EXAttributes_t, T, A>( *i_pTarget, G_ex_attributes, i_value ); + __set<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes_ptr, i_value ); } return FAPI2_RC_SUCCESS; @@ -597,38 +685,76 @@ ReturnCode _set(const AttributeId i_Id, //****************************************************************************** +// Set uint16_t +//****************************************************************************** +template<typename T, TargetType K, typename A> +ReturnCode _set( + const Target<K> & i_pTarget, + uint16_t& i_value) +{ + static_assert(std::is_same<T, uint16_t>::value, "Attribute type mismatch"); // May need to remove + + if(K & TARGET_TYPE_PROC_CHIP) + { + __set<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes_ptr, i_value ); + } + + if(K & TARGET_TYPE_PERV) + { + __set<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes_ptr, i_value ); + } + + if(K & TARGET_TYPE_CORE) + { + __set<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes_ptr, i_value ); + } + + if(K & TARGET_TYPE_EQ) + { + __set<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes_ptr, i_value ); + } + + if(K & TARGET_TYPE_EX) + { + __set<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes_ptr, i_value ); + } + + return FAPI2_RC_SUCCESS; +} + +//****************************************************************************** // Set uint32_t //****************************************************************************** template<typename T, TargetType K, typename A> ReturnCode _set( - const Target<K> * const i_pTarget, + const Target<K> & i_pTarget, uint32_t& i_value) { static_assert(std::is_same<T, uint32_t>::value, "Attribute type mismatch"); // May need to remove if(K & TARGET_TYPE_PROC_CHIP) { - __set<K, fapi2attr::CoreAttributes_t, T, A>( *i_pTarget, G_proc_chip_attributes, i_value ); + __set<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes_ptr, i_value ); } if(K & TARGET_TYPE_PERV) { - __set<K, fapi2attr::PervAttributes_t, T, A>( *i_pTarget, G_perv_attributes, i_value ); + __set<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes_ptr, i_value ); } if(K & TARGET_TYPE_CORE) { - __set<K, fapi2attr::CoreAttributes_t, T, A>( *i_pTarget, G_core_attributes, i_value ); + __set<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes_ptr, i_value ); } if(K & TARGET_TYPE_EQ) { - __set<K, fapi2attr::EQAttributes_t, T, A>( *i_pTarget, G_eq_attributes, i_value ); + __set<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes_ptr, i_value ); } if(K & TARGET_TYPE_EX) { - __set<K, fapi2attr::EXAttributes_t, T, A>( *i_pTarget, G_ex_attributes, i_value ); + __set<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes_ptr, i_value ); } return FAPI2_RC_SUCCESS; @@ -641,34 +767,35 @@ ReturnCode _set( template<typename T, TargetType K, AttributeId A> ReturnCode _set(const AttributeId i_Id, - const Target<K> * const i_pTarget, + const Target<K> & i_pTarget, const uint64_t & i_value) { static_assert(std::is_same<T, uint64_t>::value, "Attribute type mismatch"); // May need to remove if(K & TARGET_TYPE_PROC_CHIP) { - __set<K, fapi2attr::CoreAttributes_t, T, A>( *i_pTarget, G_proc_chip_attributes, i_value ); + __set<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes_ptr, i_value ); } if(K & TARGET_TYPE_PERV) { - __set<K, fapi2attr::PervAttributes_t, T, A>( *i_pTarget, G_perv_attributes, i_value ); + + __set<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes_ptr, i_value ); } if(K & TARGET_TYPE_CORE) { - __set<K, fapi2attr::CoreAttributes_t, T, A>( *i_pTarget, G_core_attributes, i_value ); + __set<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes_ptr, i_value ); } if(K & TARGET_TYPE_EQ) { - __set<K, fapi2attr::EQAttributes_t, T, A>( *i_pTarget, G_eq_attributes, i_value ); + __set<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes_ptr, i_value ); } if(K & TARGET_TYPE_EX) { - __set<K, fapi2attr::EXAttributes_t, T, A>( *i_pTarget, G_ex_attributes, i_value ); + __set<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes_ptr, i_value ); } return FAPI2_RC_SUCCESS; @@ -680,34 +807,72 @@ ReturnCode _set(const AttributeId i_Id, //****************************************************************************** template<typename T, TargetType K, AttributeId A> ReturnCode _get(const AttributeId i_id, - const Target<K> * const i_pTarget, + const Target<K> & i_pTarget, int8_t& o_value) { static_assert(std::is_same<T, int8_t>::value, "Attribute type mismatch"); if(K & TARGET_TYPE_PROC_CHIP) { - __get<K, fapi2attr::ProcChipAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes, i_id, &o_value ); + __get<K, fapi2attr::ProcChipAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes_ptr, i_id, &o_value ); } if(K & TARGET_TYPE_PERV) { - __get<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes, i_id, &o_value ); + __get<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes_ptr, i_id, &o_value ); } if(K & TARGET_TYPE_CORE) { - __get<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes, i_id, &o_value ); + __get<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes_ptr, i_id, &o_value ); } if(K & TARGET_TYPE_EQ) { - __get<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes, i_id, &o_value ); + __get<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes_ptr, i_id, &o_value ); } if(K & TARGET_TYPE_EX) { - __get<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes, i_id, &o_value ); + __get<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes_ptr, i_id, &o_value ); + } + + return FAPI2_RC_SUCCESS; +} + +//****************************************************************************** +// Get int16_t +//****************************************************************************** +template<typename T, TargetType K, AttributeId A> +ReturnCode _get(const AttributeId i_id, + const Target<K> & i_pTarget, + int16_t& o_value) +{ + static_assert(std::is_same<T, int16_t>::value, "Attribute type mismatch"); + + if(K & TARGET_TYPE_PROC_CHIP) + { + __get<K, fapi2attr::ProcChipAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes_ptr, i_id, &o_value ); + } + + if(K & TARGET_TYPE_PERV) + { + __get<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes_ptr, i_id, &o_value ); + } + + if(K & TARGET_TYPE_CORE) + { + __get<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes_ptr, i_id, &o_value ); + } + + if(K & TARGET_TYPE_EQ) + { + __get<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes_ptr, i_id, &o_value ); + } + + if(K & TARGET_TYPE_EX) + { + __get<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes_ptr, i_id, &o_value ); } return FAPI2_RC_SUCCESS; @@ -719,34 +884,34 @@ ReturnCode _get(const AttributeId i_id, //****************************************************************************** template<typename T, TargetType K, AttributeId A> ReturnCode _get(const AttributeId i_id, - const Target<K> * const i_pTarget, + const Target<K> & i_pTarget, int32_t& o_value) { static_assert(std::is_same<T, int32_t>::value, "Attribute type mismatch"); if(K & TARGET_TYPE_PROC_CHIP) { - __get<K, fapi2attr::ProcChipAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes, i_id, &o_value ); + __get<K, fapi2attr::ProcChipAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes_ptr, i_id, &o_value ); } if(K & TARGET_TYPE_PERV) { - __get<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes, i_id, &o_value ); + __get<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes_ptr, i_id, &o_value ); } if(K & TARGET_TYPE_CORE) { - __get<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes, i_id, &o_value ); + __get<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes_ptr, i_id, &o_value ); } if(K & TARGET_TYPE_EQ) { - __get<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes, i_id, &o_value ); + __get<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes_ptr, i_id, &o_value ); } if(K & TARGET_TYPE_EX) { - __get<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes, i_id, &o_value ); + __get<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes_ptr, i_id, &o_value ); } return FAPI2_RC_SUCCESS; @@ -758,34 +923,34 @@ ReturnCode _get(const AttributeId i_id, //****************************************************************************** template<typename T, TargetType K, AttributeId A> ReturnCode _get(const AttributeId i_id, - const Target<K> * const i_pTarget, + const Target<K> & i_pTarget, int64_t& o_value) { static_assert(std::is_same<T, int64_t>::value, "Attribute type mismatch"); if(K & TARGET_TYPE_PROC_CHIP) { - __get<K, fapi2attr::ProcChipAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes, i_id, &o_value ); + __get<K, fapi2attr::ProcChipAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes_ptr, i_id, &o_value ); } if(K & TARGET_TYPE_PERV) { - __get<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes, i_id, &o_value ); + __get<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes_ptr, i_id, &o_value ); } if(K & TARGET_TYPE_CORE) { - __get<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes, i_id, &o_value ); + __get<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes_ptr, i_id, &o_value ); } if(K & TARGET_TYPE_EQ) { - __get<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes, i_id, &o_value ); + __get<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes_ptr, i_id, &o_value ); } if(K & TARGET_TYPE_EX) { - __get<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes, i_id, &o_value ); + __get<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes_ptr, i_id, &o_value ); } return FAPI2_RC_SUCCESS; @@ -797,7 +962,7 @@ ReturnCode _get(const AttributeId i_id, //****************************************************************************** template<typename T, TargetType K, AttributeId A> ReturnCode _getOverride(const AttributeId i_id, - const Target<K> * const i_pTarget, + const Target<K> & i_pTarget, int8_t& o_value) { static_assert(std::is_same<T, int8_t>::value, "Attribute type mismatch"); @@ -805,13 +970,25 @@ ReturnCode _getOverride(const AttributeId i_id, return FAPI2_RC_SUCCESS; } +//****************************************************************************** +// Get Override int16_t +//****************************************************************************** +template<typename T, TargetType K, AttributeId A> +ReturnCode _getOverride(const AttributeId i_id, + const Target<K> & i_pTarget, + int16_t& o_value) +{ + static_assert(std::is_same<T, int16_t>::value, "Attribute type mismatch"); + + return FAPI2_RC_SUCCESS; +} //****************************************************************************** // Get Override int32_t //****************************************************************************** template<typename T, TargetType K, AttributeId A> ReturnCode _getOverride(const AttributeId i_id, - const Target<K> * const i_pTarget, + const Target<K> & i_pTarget, int32_t& o_value) { static_assert(std::is_same<T, int32_t>::value, "Attribute type mismatch"); @@ -819,13 +996,12 @@ ReturnCode _getOverride(const AttributeId i_id, return FAPI2_RC_SUCCESS; } - //****************************************************************************** // Get Override int64_t //****************************************************************************** template<typename T, TargetType K, AttributeId A> ReturnCode _getOverride(const AttributeId i_id, - const Target<K> * const i_pTarget, + const Target<K> & i_pTarget, int64_t& o_value) { static_assert(std::is_same<T, int64_t>::value, "Attribute type mismatch"); @@ -839,7 +1015,7 @@ ReturnCode _getOverride(const AttributeId i_id, //****************************************************************************** template<TargetType K> ReturnCode _getAttributeArraySignedShort(const AttributeId i_id, - const Target<K> * const i_pTarget, + const Target<K> & i_pTarget, int8_t * o_pValues) { return FAPI2_RC_SUCCESS; @@ -851,19 +1027,41 @@ ReturnCode _getAttributeArraySignedShort(const AttributeId i_id, //****************************************************************************** template<TargetType K> ReturnCode _setAttributeArraySignedShort(const AttributeId i_id, - const Target<K> * const i_pTarget, + const Target<K> & i_pTarget, int8_t * i_pValues) { return FAPI2_RC_SUCCESS; } +//****************************************************************************** +// Get int16_t array +//****************************************************************************** +template<TargetType K> +ReturnCode _getAttributeArraySignedWord(const AttributeId i_id, + const Target<K> & i_pTarget, + int16_t * o_pValues) +{ + return FAPI2_RC_SUCCESS; +} + + +//****************************************************************************** +// Set int16_t array +//****************************************************************************** +template<TargetType K> +ReturnCode _setAttributeArraySignedWord(const AttributeId i_id, + const Target<K> & i_pTarget, + int16_t * i_pValues) +{ + return FAPI2_RC_SUCCESS; +} //****************************************************************************** // Get int32_t array //****************************************************************************** template<TargetType K> ReturnCode _getAttributeArraySignedWord(const AttributeId i_id, - const Target<K> * const i_pTarget, + const Target<K> & i_pTarget, int32_t * o_pValues) { return FAPI2_RC_SUCCESS; @@ -875,7 +1073,7 @@ ReturnCode _getAttributeArraySignedWord(const AttributeId i_id, //****************************************************************************** template<TargetType K> ReturnCode _setAttributeArraySignedWord(const AttributeId i_id, - const Target<K> * const i_pTarget, + const Target<K> & i_pTarget, int32_t * i_pValues) { return FAPI2_RC_SUCCESS; @@ -887,7 +1085,7 @@ ReturnCode _setAttributeArraySignedWord(const AttributeId i_id, //****************************************************************************** template<TargetType K> ReturnCode _getAttributeArraySignedDoubleWord(const AttributeId i_id, - const Target<K> * const i_pTarget, + const Target<K> & i_pTarget, int64_t * o_pValues) { return FAPI2_RC_SUCCESS; @@ -898,7 +1096,7 @@ ReturnCode _getAttributeArraySignedDoubleWord(const AttributeId i_id, //****************************************************************************** template<TargetType K> ReturnCode _setAttributeArraySignedDoubleWord(const AttributeId i_id, - const Target<K> * const i_pTarget, + const Target<K> & i_pTarget, int64_t * i_pValues) { return FAPI2_RC_SUCCESS; @@ -909,19 +1107,29 @@ ReturnCode _setAttributeArraySignedDoubleWord(const AttributeId i_id, //****************************************************************************** template<TargetType K> ReturnCode _getAttributeOverrideArraySignedShort(const AttributeId i_id, - const Target<K> * const i_pTarget, + const Target<K> & i_pTarget, int8_t * o_pValues) { return FAPI2_RC_SUCCESS; } +//****************************************************************************** +// Get Override int16_t array +//****************************************************************************** +template<TargetType K> +ReturnCode _getAttributeOverrideArraySignedWord(const AttributeId i_id, + const Target<K> & i_pTarget, + int16_t * o_pValues) +{ + return FAPI2_RC_SUCCESS; +} //****************************************************************************** // Get Override int32_t array //****************************************************************************** template<TargetType K> ReturnCode _getAttributeOverrideArraySignedWord(const AttributeId i_id, - const Target<K> * const i_pTarget, + const Target<K> & i_pTarget, int32_t * o_pValues) { return FAPI2_RC_SUCCESS; @@ -933,7 +1141,7 @@ ReturnCode _getAttributeOverrideArraySignedWord(const AttributeId i_id, //****************************************************************************** template<TargetType K> ReturnCode _getAttributeOverrideArraySignedDoubleWord(const AttributeId i_id, - const Target<K> * const i_pTarget, + const Target<K> & i_pTarget, int64_t * o_pValues) { return FAPI2_RC_SUCCESS; @@ -945,73 +1153,110 @@ ReturnCode _getAttributeOverrideArraySignedDoubleWord(const AttributeId i_id, //****************************************************************************** template<typename T, TargetType K, AttributeId A> ReturnCode _set(const AttributeId i_id, - const Target<K> * const i_pTarget, + const Target<K> & i_pTarget, int8_t& i_value) { static_assert(std::is_same<T, int8_t>::value, "Attribute type mismatch"); // May need to remove if(K & TARGET_TYPE_PROC_CHIP) { - __set<K, fapi2attr::CoreAttributes_t, T, A>( *i_pTarget, G_proc_chip_attributes, i_value ); + __set<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes_ptr, i_value ); } if(K & TARGET_TYPE_PERV) { - __set<K, fapi2attr::PervAttributes_t, T, A>( *i_pTarget, G_perv_attributes, i_value ); + __set<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes_ptr, i_value ); } if(K & TARGET_TYPE_CORE) { - __set<K, fapi2attr::CoreAttributes_t, T, A>( *i_pTarget, G_core_attributes, i_value ); + __set<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes_ptr, i_value ); } if(K & TARGET_TYPE_EQ) { - __set<K, fapi2attr::EQAttributes_t, T, A>( *i_pTarget, G_eq_attributes, i_value ); + __set<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes_ptr, i_value ); } if(K & TARGET_TYPE_EX) { - __set<K, fapi2attr::EXAttributes_t, T, A>( *i_pTarget, G_ex_attributes, i_value ); + __set<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes_ptr, i_value ); } return FAPI2_RC_SUCCESS; } +//****************************************************************************** +// Set int16_t +//****************************************************************************** +template<typename T, TargetType K, AttributeId A> +ReturnCode _set(const AttributeId i_id, + const Target<K> & i_pTarget, + int16_t& i_value) +{ + static_assert(std::is_same<T, int16_t>::value, "Attribute type mismatch"); // May need to remove + + if(K & TARGET_TYPE_PROC_CHIP) + { + __set<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes_ptr, i_value ); + } + + if(K & TARGET_TYPE_PERV) + { + __set<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes_ptr, i_value ); + } + + if(K & TARGET_TYPE_CORE) + { + __set<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes_ptr, i_value ); + } + + if(K & TARGET_TYPE_EQ) + { + __set<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes_ptr, i_value ); + } + + if(K & TARGET_TYPE_EX) + { + __set<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes_ptr, i_value ); + } + + return FAPI2_RC_SUCCESS; +} //****************************************************************************** // Set int32_t //****************************************************************************** template<typename T, TargetType K, AttributeId A> ReturnCode _set(const AttributeId i_id, - const Target<K> * const i_pTarget, + const Target<K> & i_pTarget, int32_t& i_value) { static_assert(std::is_same<T, int32_t>::value, "Attribute type mismatch"); // May need to remove if(K & TARGET_TYPE_PROC_CHIP) { - __set<K, fapi2attr::CoreAttributes_t, T, A>( *i_pTarget, G_proc_chip_attributes, i_value ); + __set<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes_ptr, i_value ); } if(K & TARGET_TYPE_PERV) { - __set<K, fapi2attr::PervAttributes_t, T, A>( *i_pTarget, G_perv_attributes, i_value ); + __set<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes_ptr, i_value ); } if(K & TARGET_TYPE_CORE) { - __set<K, fapi2attr::CoreAttributes_t, T, A>( *i_pTarget, G_core_attributes, i_value ); + __set<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes_ptr, i_value ); } if(K & TARGET_TYPE_EQ) { - __set<K, fapi2attr::EQAttributes_t, T, A>( *i_pTarget, G_eq_attributes, i_value ); + __set<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes_ptr, i_value ); } if(K & TARGET_TYPE_EX) { - __set<K, fapi2attr::EXAttributes_t, T, A>( *i_pTarget, G_ex_attributes, i_value ); + __set<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes_ptr, i_value ); } return FAPI2_RC_SUCCESS; @@ -1023,34 +1268,34 @@ ReturnCode _set(const AttributeId i_id, //****************************************************************************** template<typename T, TargetType K, AttributeId A> ReturnCode _set(const AttributeId i_id, - const Target<K> * const i_pTarget, + const Target<K> & i_pTarget, const int64_t & i_value) { static_assert(std::is_same<T, int64_t>::value, "Attribute type mismatch"); // May need to remove if(K & TARGET_TYPE_PROC_CHIP) { - __set<K, fapi2attr::CoreAttributes_t, T, A>( *i_pTarget, G_proc_chip_attributes, i_value ); + __set<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_proc_chip_attributes_ptr, i_value ); } if(K & TARGET_TYPE_PERV) { - __set<K, fapi2attr::PervAttributes_t, T, A>( *i_pTarget, G_perv_attributes, i_value ); + __set<K, fapi2attr::PervAttributes_t, T, A>( i_pTarget, G_perv_attributes_ptr, i_value ); } if(K & TARGET_TYPE_CORE) { - __set<K, fapi2attr::CoreAttributes_t, T, A>( *i_pTarget, G_core_attributes, i_value ); + __set<K, fapi2attr::CoreAttributes_t, T, A>( i_pTarget, G_core_attributes_ptr, i_value ); } if(K & TARGET_TYPE_EQ) { - __set<K, fapi2attr::EQAttributes_t, T, A>( *i_pTarget, G_eq_attributes, i_value ); + __set<K, fapi2attr::EQAttributes_t, T, A>( i_pTarget, G_eq_attributes_ptr, i_value ); } if(K & TARGET_TYPE_EX) { - __set<K, fapi2attr::EXAttributes_t, T, A>( *i_pTarget, G_ex_attributes, i_value ); + __set<K, fapi2attr::EXAttributes_t, T, A>( i_pTarget, G_ex_attributes_ptr, i_value ); } return FAPI2_RC_SUCCESS; |