Debian Codegraph @

Samples/4_CUDA_Libraries/cudaNvSciNvMedia/nvmedia_utils/config_parser.cpp

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