1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558
|
/* Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of NVIDIA CORPORATION nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <stdlib.h>
#include "config_parser.h"
#include "log_utils.h"
#if defined(__QNX__)
#include <strings.h>
#endif
static NvMediaStatus GetParamIndex(ConfigParamsMap *paramsMap, char *paramName, unsigned int *index)
{
int i = 0;
while(paramsMap[i].paramName != NULL) {
if (strcasecmp(paramsMap[i].paramName, paramName) == 0) {
*index = i;
return NVMEDIA_STATUS_OK;
} else {
i++;
}
}
return NVMEDIA_STATUS_BAD_PARAMETER;
}
NvMediaStatus ConfigParser_GetSectionIndexByName(SectionMap *sectionsMap, char *sectionName, unsigned int *index)
{
unsigned int i = 0;
while(sectionsMap[i].secType != SECTION_NONE) {
if(strcmp(sectionsMap[i].name, sectionName) == 0) {
*index = i;
return NVMEDIA_STATUS_OK;
} else {
i++;
}
}
return NVMEDIA_STATUS_BAD_PARAMETER;
}
NvMediaStatus ConfigParser_GetSectionIndexByType(SectionMap *sectionsMap, SectionType sectionType, unsigned int *index)
{
unsigned int i = 0;
while(sectionsMap[i].secType != SECTION_NONE) {
if(sectionsMap[i].secType == sectionType) {
*index = i;
return NVMEDIA_STATUS_OK;
} else {
i++;
}
}
*index = i;
return NVMEDIA_STATUS_OK;
}
static NvMediaStatus GetFileContent(char *filename, char **fileContentOut)
{
FILE *file;
char *fileCotent;
long fileSize;
file = fopen(filename, "r");
if(file == NULL) {
printf("Parser_GetFileContent: Cannot open configuration file %s\n", filename);
return NVMEDIA_STATUS_BAD_PARAMETER;
}
if (fseek(file, 0, SEEK_END) != 0) {
printf("Parser_GetFileContent: Cannot fseek in configuration file %s\n", filename);
return NVMEDIA_STATUS_ERROR;
}
fileSize = ftell(file);
if(fileSize < 0 || fileSize > 150000) {
printf("Parser_GetFileContent: Unreasonable Filesize %ld encountered for file %s\n", fileSize, filename);
return NVMEDIA_STATUS_ERROR;
}
if(fseek (file, 0, SEEK_SET) != 0) {
printf("Parser_GetFileContent: Cannot fseek in configuration file %s\n", filename);
return NVMEDIA_STATUS_ERROR;
}
fileCotent = (char*)malloc(fileSize + 1);
if(fileCotent == NULL) {
printf("Parser_GetFileContent: Failed allocating buffer for file Content\n");
return NVMEDIA_STATUS_OUT_OF_MEMORY;
}
fileSize = (long)fread(fileCotent, 1, fileSize, file);
fileCotent[fileSize] = '\0';
*fileContentOut = fileCotent;
fclose(file);
return NVMEDIA_STATUS_OK;
}
NvMediaStatus ConfigParser_ParseFile(ConfigParamsMap *paramsMap, unsigned int numParams, SectionMap *sectionsMap, char *fileName)
{
char *items[MAX_ITEMS_TO_PARSE] = {NULL};
int intValue, itemsCount = 0, i = 0, sectionIndex = 0;
double doubleValue;
float floatValue;
unsigned int currItemIndex, uintValue, sectionId = 0, currSectionId = 0, charValue, paramDefaultLength;
unsigned short ushortValue;
short shortValue;
unsigned long long ullValue;
NvMediaBool isInString = NVMEDIA_FALSE, isInItem = NVMEDIA_FALSE;
char *buffer, *bufferEnd, *param, *pParamLength;
char sectionName[100];
char currDigit;
char *configContentBuf = NULL;
unsigned int numSetsInSection = 0;
if(GetFileContent(fileName, &configContentBuf) != NVMEDIA_STATUS_OK) {
printf("ConfigParser_ParseFile: Failed reading file %s", fileName);
return NVMEDIA_STATUS_ERROR;
}
buffer = configContentBuf;
bufferEnd = &configContentBuf[strlen(configContentBuf)];
// Stage one: Create items mapping in the content using "items" pointers array. For each parameter we have 3 items: param name, '=' char and the param value.
while(buffer < bufferEnd) {
if(itemsCount >= MAX_ITEMS_TO_PARSE) {
LOG_WARN("ConfigParser_ParseFile: Number of items in configuration file exceeded the maximum allowed (%d). Only %d items will be parsed.\n",
MAX_ITEMS_TO_PARSE, MAX_ITEMS_TO_PARSE);
itemsCount = MAX_ITEMS_TO_PARSE;
break;
}
switch(*buffer) {
// Carriage return
case 13:
++buffer;
break;
case '#':
*buffer = '\0'; // Replace '#' with '\0' in case of comment immediately following integer or string
while(*buffer != '\n' && buffer < bufferEnd) { // Skip till EOL or EOF
++buffer;
}
isInString = NVMEDIA_FALSE;
isInItem = NVMEDIA_FALSE;
break;
case '\n':
isInItem = NVMEDIA_FALSE;
isInString = NVMEDIA_FALSE;
*buffer++='\0';
break;
case ' ':
case '\t': // Skip whitespace, leave state unchanged
if(isInString)
buffer++;
else { // Terminate non-strings once whitespace is found
*buffer++ = '\0';
isInItem = NVMEDIA_FALSE;
}
break;
case '"': // Begin/End of String
*buffer++ = '\0';
if(!isInString) {
items[itemsCount++] = buffer;
isInItem = ~isInItem;
} else {
isInItem = NVMEDIA_FALSE;
}
isInString = ~isInString; // Toggle
break;
case '[':
*(buffer++) = '\0';
items[itemsCount++] = buffer;
while(*buffer != ' ' && *buffer != '\n' && buffer < bufferEnd) { // Skip till whitespace (after which is located the parsed section number) or EOL or EOF
sectionName[i++] = *(buffer++);
}
sectionName[i] = '\0';
i = 0;
while(*buffer == ' ') {
*(buffer++) = '\0';
}
items[itemsCount++] = buffer;
while(*buffer != ']' && *buffer != '\n' && buffer < bufferEnd) { // Read the section number
currDigit = *buffer;
sectionIndex = sectionIndex * 10 + (currDigit - '0');
buffer++;
}
*(buffer++) = '\0';
sectionIndex--;
if(ConfigParser_GetSectionIndexByName(sectionsMap, sectionName, §ionId) != NVMEDIA_STATUS_OK) {
printf("ConfigParser_ParseFile: SectionName couldn't be found in section map: '%s'.\n", sectionName);
}
numSetsInSection++;
sectionsMap[sectionId].lastSectionIndex = sectionIndex;
sectionIndex = 0;
isInString = NVMEDIA_FALSE;
isInItem = NVMEDIA_FALSE;
break;
default:
if(!isInItem) {
items[itemsCount++] = buffer;
isInItem = ~isInItem;
}
buffer++;
}
}
itemsCount--;
if(numSetsInSection > numParams) {
printf("%s: Not enough buffers allocated for parsing. Number of sets allocated: %d. Number of sets in config file: %d \n",
__func__, numParams, numSetsInSection);
if(configContentBuf) {
free(configContentBuf);
}
return NVMEDIA_STATUS_ERROR;
}
// Stage 2: Go through the list of items and save their values in parameters map
for(i = 0; i < itemsCount; i += 3) {
if(ConfigParser_GetSectionIndexByName(sectionsMap, items[i], &currItemIndex) == NVMEDIA_STATUS_OK) {
currSectionId = atoi(items[i + 1]);
currSectionId--;
LOG_DBG("ConfigParser_ParseFile: Parsing section %s index %d\n", items[i], currSectionId);
i -= 1;
continue;
}
if(GetParamIndex(paramsMap, items[i], &currItemIndex) != NVMEDIA_STATUS_OK) {
LOG_WARN("ConfigParser_ParseFile: Parameter Name '%s' is not recognized. Dismissing this parameter.\n", items[i]);
continue;
}
if(strcmp("=", items[i + 1])) {
printf("ConfigParser_ParseFile: '=' expected as the second token in each line. Error caught while parsing parameter '%s'.\n", items[i]);
i -= 2;
continue;
}
if(ConfigParser_GetSectionIndexByType(sectionsMap, paramsMap[currItemIndex].sectionType, §ionId) != NVMEDIA_STATUS_OK) {
printf("ConfigParser_ParseFile: Section index couldn't be found in section map by type. Param Name: '%s'.\n", paramsMap[currItemIndex].paramName);
}
if(sectionsMap[sectionId].lastSectionIndex == 0) {
// Param is not part of a collection or collection includes only one item
currSectionId = 0;
}
param = (char *)paramsMap[currItemIndex].mappedLocation + currSectionId * sectionsMap[sectionId].sizeOfStruct;
pParamLength = (char *)paramsMap[currItemIndex].stringLengthAddr + currSectionId * sectionsMap[sectionId].sizeOfStruct;
paramDefaultLength = paramsMap[currItemIndex].stringLength;
// Interpret the Value
LOG_DBG("ConfigParser_ParseFile: Interpreting parameter %s\n", items[i]);
switch(paramsMap[currItemIndex].type) {
case TYPE_INT:
if(sscanf(items[i + 2], "%d", &intValue) != 1) {
printf("ConfigParser_ParseFile: Expected numerical value for Parameter %s, found value '%s'\n", items[i], items[i + 2]);
}
*(int *)(void *)param = intValue;
break;
case TYPE_UINT:
if(sscanf(items[i + 2], "%u", &uintValue) != 1) {
printf("ConfigParser_ParseFile: Expected numerical value for Parameter %s, found value '%s'\n", items[i], items[i + 2]);
}
*(unsigned int *)(void *)param = uintValue;
break;
case TYPE_UINT_HEX:
if(sscanf(items[i + 2], "%x", &uintValue) != 1) {
printf("ConfigParser_ParseFile: Expected unsigned char value for Parameter %s, found value '%s'\n", items[i], items[i + 2]);
}
*(unsigned int *)(void *)param = uintValue;
break;
case TYPE_CHAR_ARR:
if(items[i + 2] == NULL)
memset(param, 0, (pParamLength != NULL && *pParamLength != 0) ? *pParamLength : paramDefaultLength);
else {
strncpy(param, items[i + 2], paramsMap[currItemIndex].stringLength);
param[strlen(items[i + 2])] = '\0';
}
break;
case TYPE_DOUBLE:
if(sscanf(items[i + 2], "%lf", &doubleValue) != 1) {
printf("ConfigParser_ParseFile: Expected double value for Parameter %s, found value '%s'\n", items[i], items[i + 2]);
}
*(double *)(void *)param = doubleValue;
break;
case TYPE_FLOAT:
if(sscanf(items[i + 2], "%f", &floatValue) != 1) {
printf("ConfigParser_ParseFile: Expected double value for Parameter %s, found value '%s'\n", items[i], items[i + 2]);
}
*(float *)(void *)param = floatValue;
break;
case TYPE_UCHAR:
if(sscanf(items[i + 2], "%u", &charValue) != 1) {
printf("ConfigParser_ParseFile: Expected unsigned char value for Parameter %s, found value '%s'\n", items[i], items[i + 2]);
}
*(unsigned char *)(void *)param = charValue;
break;
case TYPE_USHORT:
if(sscanf(items[i + 2], "%hu", &ushortValue) != 1) {
printf("ConfigParser_ParseFile: Expected unsigned short value for Parameter %s, found value '%s'\n", items[i], items[i + 2]);
}
*(unsigned short *)(void *)param = ushortValue;
break;
case TYPE_SHORT:
if(sscanf(items[i + 2], "%hd", &shortValue) != 1) {
printf("ConfigParser_ParseFile: Expected short value for Parameter %s, found value '%s'\n", items[i], items[i + 2]);
}
*(short *)(void *)param = shortValue;
break;
case TYPE_UCHAR_ARR:
if(items[i + 2] == NULL)
memset(param, 0, (pParamLength != NULL && *pParamLength != 0) ? *pParamLength : paramDefaultLength);
else {
strncpy(param, items[i + 2], paramsMap[currItemIndex].stringLength);
param[strlen(items[i + 2])] = '\0';
}
break;
case TYPE_ULLONG:
if(sscanf(items[i + 2], "%llu", &ullValue) != 1) {
printf("ConfigParser_ParseFile: Expected numerical value for Parameter %s, found value '%s'\n", items[i], items[i + 2]);
}
*(unsigned long long *)(void *)param = ullValue;
break;
default:
printf("ConfigParser_ParseFile: Encountered unknown value type in the map\n");
}
}
if (configContentBuf)
free(configContentBuf);
return NVMEDIA_STATUS_OK;
}
NvMediaStatus ConfigParser_InitParamsMap(ConfigParamsMap *paramsMap)
{
int i = 0;
while(paramsMap[i].paramName != NULL) {
if (paramsMap[i].mappedLocation == NULL) {
i++;
continue;
}
switch(paramsMap[i].type) {
case TYPE_UINT:
case TYPE_UINT_HEX:
*(unsigned int *)(paramsMap[i].mappedLocation) = (unsigned int)paramsMap[i].defaultValue;
break;
case TYPE_INT:
*(int *)(paramsMap[i].mappedLocation) = (int)paramsMap[i].defaultValue;
break;
case TYPE_DOUBLE:
*(double *)(paramsMap[i].mappedLocation) = (double)paramsMap[i].defaultValue;
break;
case TYPE_FLOAT:
*(float *)(paramsMap[i].mappedLocation) = (float)paramsMap[i].defaultValue;
break;
case TYPE_UCHAR:
*(unsigned char *)(paramsMap[i].mappedLocation) = (NvMediaBool)paramsMap[i].defaultValue;
break;
case TYPE_USHORT:
*(unsigned short *)(paramsMap[i].mappedLocation) = (unsigned short)paramsMap[i].defaultValue;
break;
case TYPE_SHORT:
*(short *)(paramsMap[i].mappedLocation) = (short)paramsMap[i].defaultValue;
break;
case TYPE_ULLONG:
*(unsigned long long *)(paramsMap[i].mappedLocation) = (unsigned long long)paramsMap[i].defaultValue;
break;
case TYPE_CHAR_ARR:
case TYPE_UCHAR_ARR:
default:
break;
}
i++;
}
return NVMEDIA_STATUS_OK;
}
NvMediaStatus ConfigParser_ValidateParams(ConfigParamsMap *paramsMap, SectionMap *sectionsMap)
{
NvMediaStatus status = NVMEDIA_STATUS_OK;
unsigned int sectionId = 0, i = 0, j;
char *param;
while(paramsMap[i].paramName != NULL) {
if(ConfigParser_GetSectionIndexByType(sectionsMap, paramsMap[i].sectionType, §ionId) != NVMEDIA_STATUS_OK) {
printf("ConfigParser_ValidateParams: Section index couldn't be found in section map. Param Name: '%s'.\n", paramsMap[i].paramName);
}
for(j = 0; j <= sectionsMap[sectionId].lastSectionIndex; j++) {
if(paramsMap[i].paramLimits == 1 || paramsMap[i].paramLimits == 2) {
param = (char *)paramsMap[i].mappedLocation + j * sectionsMap[sectionId].sizeOfStruct;
if (param == NULL) {
i++;
continue;
}
switch (paramsMap[i].type) {
case TYPE_UINT:
case TYPE_UINT_HEX:
if(*(unsigned int *)(void *)param < (unsigned int)paramsMap[i].minLimit ||
(paramsMap[i].paramLimits == 2 && *(unsigned int *)(void *)param > (unsigned int)paramsMap[i].maxLimit )) {
printf("ConfigParser_ValidateParams: Error in input parameter %s\n", paramsMap[i].paramName);
printf("Check configuration file for parameter limits\n");
status = NVMEDIA_STATUS_BAD_PARAMETER;
}
break;
case TYPE_DOUBLE:
if(*(double *)(void *)param < (double)paramsMap[i].minLimit ||
(paramsMap[i].paramLimits == 2 && *(double *)(void *)param > (double)paramsMap[i].maxLimit )) {
printf("ConfigParser_ValidateParams: Error in input parameter %s\n", paramsMap[i].paramName);
printf("Check configuration file for parameter limits\n");
status = NVMEDIA_STATUS_BAD_PARAMETER;
}
break;
case TYPE_FLOAT:
if(*(float *)(void *)param < (float)paramsMap[i].minLimit ||
(paramsMap[i].paramLimits == 2 && *(float *)(void *)param > (float)paramsMap[i].maxLimit )) {
printf("ConfigParser_ValidateParams: Error in input parameter %s\n", paramsMap[i].paramName);
printf("Check configuration file for parameter limits\n");
status = NVMEDIA_STATUS_BAD_PARAMETER;
}
break;
case TYPE_INT:
if(*(int *)(void *)param < (int)paramsMap[i].minLimit ||
(paramsMap[i].paramLimits == 2 && *(int *)(void *)param > (int)paramsMap[i].maxLimit )) {
printf("ConfigParser_ValidateParams: Error in input parameter %s\n", paramsMap[i].paramName);
printf("Check configuration file for parameter limits\n");
status = NVMEDIA_STATUS_BAD_PARAMETER;
}
break;
case TYPE_USHORT:
if(*(unsigned short *)(void *)param < (unsigned short)paramsMap[i].minLimit ||
(paramsMap[i].paramLimits == 2 && *(unsigned short *)(void *)param > (unsigned short)paramsMap[i].maxLimit )) {
printf("ConfigParser_ValidateParams: Error in input parameter %s\n", paramsMap[i].paramName);
printf("Check configuration file for parameter limits\n");
status = NVMEDIA_STATUS_BAD_PARAMETER;
}
break;
case TYPE_SHORT:
if(*(short *)(void *)param < (short)paramsMap[i].minLimit ||
(paramsMap[i].paramLimits == 2 && *(short *)(void *)param > (short)paramsMap[i].maxLimit )) {
printf("ConfigParser_ValidateParams: Error in input parameter %s\n", paramsMap[i].paramName);
printf("Check configuration file for parameter limits\n");
status = NVMEDIA_STATUS_BAD_PARAMETER;
}
break;
case TYPE_ULLONG:
if(*(unsigned long long *)(void *)param < (unsigned long long)paramsMap[i].minLimit ||
(paramsMap[i].paramLimits == 2 && *(unsigned long long *)(void *)param > (unsigned long long)paramsMap[i].maxLimit )) {
printf("ConfigParser_ValidateParams: Error in input parameter %s\n", paramsMap[i].paramName);
printf("Check configuration file for parameter limits\n");
status = NVMEDIA_STATUS_BAD_PARAMETER;
}
break;
default:
break;
}
}
}
i++;
}
return status;
}
NvMediaStatus ConfigParser_DisplayParams(ConfigParamsMap *pParamsMap, SectionMap *pSectionsMap)
{
unsigned int i = 0, j, sectionId = 0;
char *param;
while(pParamsMap[i].paramName != NULL) {
if(ConfigParser_GetSectionIndexByType(pSectionsMap, pParamsMap[i].sectionType, §ionId) != NVMEDIA_STATUS_OK) {
printf("ConfigParser_DisplayParams: Section index couldn't be found in section map by type. Param Name: '%s'.\n", pParamsMap[i].paramName);
}
for(j = 0; j <= pSectionsMap[sectionId].lastSectionIndex; j++) {
param = (char *)pParamsMap[i].mappedLocation + j * pSectionsMap[sectionId].sizeOfStruct;
if (param == NULL) {
i++;
continue;
}
switch(pParamsMap[i].type) {
case TYPE_UINT:
printf("(%d) %s = %u\n", j, pParamsMap[i].paramName, *(unsigned int *)(void *)param);
break;
case TYPE_DOUBLE:
printf("(%d) %s = %.2lf\n", j, pParamsMap[i].paramName, *(double *)(void *)param);
break;
case TYPE_FLOAT:
printf("(%d) %s = %.2f\n", j, pParamsMap[i].paramName, *(float *)(void *)param);
break;
case TYPE_UCHAR:
printf("(%d) %s = %d\n", j, pParamsMap[i].paramName, *(unsigned char *)(void *)param);
break;
case TYPE_USHORT:
printf("(%d) %s = %hu\n", j, pParamsMap[i].paramName, *(unsigned short *)(void *)param);
break;
case TYPE_SHORT:
printf("(%d) %s = %hd\n", j, pParamsMap[i].paramName, *(short *)(void *)param);
break;
case TYPE_ULLONG:
printf("(%d) %s = %llu\n", j, pParamsMap[i].paramName, *(unsigned long long *)(void *)param);
break;
case TYPE_CHAR_ARR:
printf("(%d) %s = ""%s""\n", j, pParamsMap[i].paramName, param);
break;
case TYPE_UCHAR_ARR:
printf("(%d) %s = ""%s""\n", j, pParamsMap[i].paramName, (unsigned char *)(void *)param);
break;
case TYPE_INT:
printf("(%d) %s = %d\n", j, pParamsMap[i].paramName, *(int *)(void *)param);
break;
case TYPE_UINT_HEX:
printf("(%d) %s = %x\n", j, pParamsMap[i].paramName, *(unsigned int *)(void *)param);
break;
default:
// Do nothing
break;
}
}
i++;
}
return NVMEDIA_STATUS_OK;
}
|