| 1 | /*************************************************************************** |
|---|
| 2 | * Copyright (c) 2003-2008, Broadcom Corporation |
|---|
| 3 | * All Rights Reserved |
|---|
| 4 | * Confidential Property of Broadcom Corporation |
|---|
| 5 | * |
|---|
| 6 | * THIS SOFTWARE MAY ONLY BE USED SUBJECT TO AN EXECUTED SOFTWARE LICENSE |
|---|
| 7 | * AGREEMENT BETWEEN THE USER AND BROADCOM. YOU HAVE NO RIGHT TO USE OR |
|---|
| 8 | * EXPLOIT THIS MATERIAL EXCEPT SUBJECT TO THE TERMS OF SUCH AN AGREEMENT. |
|---|
| 9 | * |
|---|
| 10 | * $brcm_Workfile: bvdb.c $ |
|---|
| 11 | * $brcm_Revision: Hydra_Software_Devel/5 $ |
|---|
| 12 | * $brcm_Date: 7/14/08 3:21p $ |
|---|
| 13 | * |
|---|
| 14 | * Module Description: |
|---|
| 15 | * |
|---|
| 16 | * Revision History: |
|---|
| 17 | * |
|---|
| 18 | * $brcm_Log: /magnum/commonutils/vdb/3548/A0/bvdb.c $ |
|---|
| 19 | * |
|---|
| 20 | * Hydra_Software_Devel/5 7/14/08 3:21p jessem |
|---|
| 21 | * PR 43759: Updated API and implementation |
|---|
| 22 | * |
|---|
| 23 | * Hydra_Software_Devel/4 7/11/08 4:49p jessem |
|---|
| 24 | * PR 39237: Corrected check for BVDB_VideoDisplayMode in |
|---|
| 25 | * BVDB_GetVdbEntry. |
|---|
| 26 | * |
|---|
| 27 | * Hydra_Software_Devel/3 7/11/08 10:59a jessem |
|---|
| 28 | * PR 39237: Changed check for BVDB_VideoDisplayMode in BVDB_GetVdbEntry. |
|---|
| 29 | * |
|---|
| 30 | * Hydra_Software_Devel/2 7/10/08 12:01p jessem |
|---|
| 31 | * PR 44689: Removed include "bavc.h". |
|---|
| 32 | * |
|---|
| 33 | * Hydra_Software_Devel/2 6/18/08 3:43p jessem |
|---|
| 34 | * PR 39237: Added check for config ID in BVDB_GetVdbEntry. |
|---|
| 35 | * |
|---|
| 36 | * Hydra_Software_Devel/1 6/18/08 12:35p jessem |
|---|
| 37 | * PR 43759: Initial version. |
|---|
| 38 | * |
|---|
| 39 | ***************************************************************************/ |
|---|
| 40 | #include <stdio.h> |
|---|
| 41 | #include <stdlib.h> |
|---|
| 42 | #include <string.h> |
|---|
| 43 | |
|---|
| 44 | #include "bstd.h" |
|---|
| 45 | #include "berr.h" |
|---|
| 46 | #include "bkni.h" |
|---|
| 47 | #include "bfmt.h" |
|---|
| 48 | #include "blst_circleq.h" |
|---|
| 49 | #include "bdbg.h" |
|---|
| 50 | |
|---|
| 51 | #include "bvdb.h" |
|---|
| 52 | #include "bvdb_priv.h" |
|---|
| 53 | #include "bvdb_viddispmode_priv.h" |
|---|
| 54 | |
|---|
| 55 | BDBG_MODULE(BVDB); |
|---|
| 56 | |
|---|
| 57 | extern const BVDB_UsageMode aVdbEntries[]; |
|---|
| 58 | extern uint32_t ulVdbTableSize; |
|---|
| 59 | |
|---|
| 60 | /* Public Functions */ |
|---|
| 61 | BERR_Code BVDB_CreateVdb |
|---|
| 62 | ( BVDB_Handle *phVdb, |
|---|
| 63 | uint32_t *pulEntries) |
|---|
| 64 | { |
|---|
| 65 | BERR_Code err = BERR_SUCCESS; |
|---|
| 66 | BVDB_P_Context *pVdb; |
|---|
| 67 | uint32_t i; |
|---|
| 68 | |
|---|
| 69 | /* create head */ |
|---|
| 70 | pVdb = (BVDB_Handle)BKNI_Malloc(sizeof(BVDB_Handle)); |
|---|
| 71 | if (pVdb == NULL) |
|---|
| 72 | { |
|---|
| 73 | BDBG_ERR(("Out of memory")); |
|---|
| 74 | return BERR_OUT_OF_SYSTEM_MEMORY; |
|---|
| 75 | } |
|---|
| 76 | |
|---|
| 77 | BLST_CQ_INIT(pVdb); |
|---|
| 78 | |
|---|
| 79 | for (i=0; i<ulVdbTableSize; i++) |
|---|
| 80 | { |
|---|
| 81 | BVDB_UsageMode *pUsageMode; |
|---|
| 82 | |
|---|
| 83 | pUsageMode = (BVDB_UsageMode *)BKNI_Malloc(sizeof(BVDB_UsageMode)); |
|---|
| 84 | if (pUsageMode == NULL) |
|---|
| 85 | { |
|---|
| 86 | do |
|---|
| 87 | { |
|---|
| 88 | pUsageMode = BLST_CQ_FIRST(pVdb); |
|---|
| 89 | BLST_CQ_REMOVE_HEAD(pVdb, link); |
|---|
| 90 | BKNI_Free(pUsageMode); |
|---|
| 91 | } while (!BLST_CQ_EMPTY(pVdb)); |
|---|
| 92 | |
|---|
| 93 | BKNI_Free(pVdb); |
|---|
| 94 | BDBG_ERR(("Out of memory")); |
|---|
| 95 | return BERR_OUT_OF_SYSTEM_MEMORY; |
|---|
| 96 | } |
|---|
| 97 | |
|---|
| 98 | /* copy from array to doubly-linked list */ |
|---|
| 99 | BKNI_Memcpy((void *)pUsageMode, (void *)&aVdbEntries[i], sizeof(BVDB_UsageMode)); |
|---|
| 100 | |
|---|
| 101 | BLST_CQ_INSERT_TAIL(pVdb, pUsageMode, link); |
|---|
| 102 | } |
|---|
| 103 | |
|---|
| 104 | /* Validate entries */ |
|---|
| 105 | err = BVDB_P_ValidateVdb(pVdb); |
|---|
| 106 | if (err != BERR_SUCCESS) |
|---|
| 107 | { |
|---|
| 108 | BDBG_ERR(("Errors in VDB.")); |
|---|
| 109 | } |
|---|
| 110 | |
|---|
| 111 | /* All done. now return the new fresh context to user. */ |
|---|
| 112 | *phVdb = (BVDB_Handle)pVdb; |
|---|
| 113 | *pulEntries = ulVdbTableSize; |
|---|
| 114 | |
|---|
| 115 | return err; |
|---|
| 116 | } |
|---|
| 117 | |
|---|
| 118 | BERR_Code BVDB_DestroyVdb |
|---|
| 119 | ( BVDB_Handle hVdb ) |
|---|
| 120 | { |
|---|
| 121 | BVDB_UsageMode *pMode; |
|---|
| 122 | BVDB_P_Context *pVdb; |
|---|
| 123 | |
|---|
| 124 | BVDB_P_GET_CONTEXT(hVdb, pVdb); |
|---|
| 125 | |
|---|
| 126 | while (!BLST_CQ_EMPTY(pVdb)) |
|---|
| 127 | { |
|---|
| 128 | pMode = BLST_CQ_FIRST(pVdb); |
|---|
| 129 | BLST_CQ_REMOVE_HEAD(pVdb, link); |
|---|
| 130 | BKNI_Free(pMode); |
|---|
| 131 | } |
|---|
| 132 | |
|---|
| 133 | BKNI_Free((void*)pVdb); |
|---|
| 134 | pVdb = NULL; |
|---|
| 135 | |
|---|
| 136 | return BERR_SUCCESS; |
|---|
| 137 | } |
|---|
| 138 | |
|---|
| 139 | |
|---|
| 140 | BERR_Code BVDB_PrintUsageMode |
|---|
| 141 | ( const BVDB_UsageMode *pstUsageMode ) |
|---|
| 142 | { |
|---|
| 143 | char acStr[20]; |
|---|
| 144 | BVDB_VideoDisplayMode stDispMode = pstUsageMode->stDisplayMode; |
|---|
| 145 | |
|---|
| 146 | BDBG_ASSERT(pstUsageMode); |
|---|
| 147 | |
|---|
| 148 | /* ID */ |
|---|
| 149 | BDBG_P_PrintString("ID: %s\n", pstUsageMode->acId); |
|---|
| 150 | |
|---|
| 151 | /* Input format */ |
|---|
| 152 | BVDB_P_GetSourceFormatSetStr(pstUsageMode->eSrcFmtSet, acStr); |
|---|
| 153 | BDBG_P_PrintString("\tInput format: %s\n", acStr); |
|---|
| 154 | |
|---|
| 155 | /* Display */ |
|---|
| 156 | BVDB_P_GetDisplayStr(pstUsageMode->eDisplay, acStr); |
|---|
| 157 | BDBG_P_PrintString("\tDisplay: %s\n", acStr); |
|---|
| 158 | |
|---|
| 159 | /* Window */ |
|---|
| 160 | BVDB_P_GetWindowStr(pstUsageMode->eWindow, acStr); |
|---|
| 161 | BDBG_P_PrintString("\tWindow: %s\n", acStr); |
|---|
| 162 | |
|---|
| 163 | /* Input */ |
|---|
| 164 | BVDB_P_GetInputStr(pstUsageMode->eInput, acStr); |
|---|
| 165 | BDBG_P_PrintString("\tInput: %s\n", acStr); |
|---|
| 166 | |
|---|
| 167 | /* display usage mode */ |
|---|
| 168 | BVDB_P_GetVideoDisplayModeStr(&stDispMode, acStr); |
|---|
| 169 | BDBG_P_PrintString("\tVideo Display Usage Mode: %s\n", acStr); |
|---|
| 170 | |
|---|
| 171 | /* OSD size */ |
|---|
| 172 | BVDB_P_GetOsdStr(pstUsageMode->eOsd, acStr); |
|---|
| 173 | BDBG_P_PrintString("\tOSD: %s\n", acStr); |
|---|
| 174 | |
|---|
| 175 | /* 3D comb */ |
|---|
| 176 | BVDB_P_GetStateStr(pstUsageMode->e3dComb, acStr); |
|---|
| 177 | BDBG_P_PrintString("\t3D Comb: %s\n", acStr); |
|---|
| 178 | |
|---|
| 179 | /* oversample */ |
|---|
| 180 | BVDB_P_GetStateStr(pstUsageMode->eOversample, acStr); |
|---|
| 181 | BDBG_P_PrintString("\tOversample: %s\n", acStr); |
|---|
| 182 | |
|---|
| 183 | /* MNR/BNR */ |
|---|
| 184 | BVDB_P_GetStateStr(pstUsageMode->eMnrBnr, acStr); |
|---|
| 185 | BDBG_P_PrintString("\tMNR/BNR: %s\n", acStr); |
|---|
| 186 | |
|---|
| 187 | /* DCR */ |
|---|
| 188 | BVDB_P_GetStateStr(pstUsageMode->eDcr, acStr); |
|---|
| 189 | BDBG_P_PrintString("\tDCR: %s\n", acStr); |
|---|
| 190 | |
|---|
| 191 | /* ANR format */ |
|---|
| 192 | BVDB_P_GetPixelFormatStr(pstUsageMode->stAnr.ePixelFormat, pstUsageMode->stAnr.eState, acStr); |
|---|
| 193 | BDBG_P_PrintString("\tANR: %s\n", acStr); |
|---|
| 194 | |
|---|
| 195 | /* CAP/VFD */ |
|---|
| 196 | BVDB_P_GetPixelFormatStr(pstUsageMode->stCapVfd.ePixelFormat, pstUsageMode->stCapVfd.eState, acStr); |
|---|
| 197 | BDBG_P_PrintString("\tCAP/VFD: %s\n", acStr); |
|---|
| 198 | |
|---|
| 199 | /* MAD */ |
|---|
| 200 | BVDB_P_GetPixelFormatStr(pstUsageMode->stMad.ePixelFormat, pstUsageMode->stMad.eState, acStr); |
|---|
| 201 | if (pstUsageMode->stMad.eState == BVDB_State_eYes) |
|---|
| 202 | { |
|---|
| 203 | char acTemp[20]; |
|---|
| 204 | |
|---|
| 205 | BVDB_P_GetFieldStoreCntStr(pstUsageMode->stMad.eFieldStore, acTemp); |
|---|
| 206 | strcat(acTemp, "\t"); |
|---|
| 207 | strcat(acTemp, acStr); |
|---|
| 208 | strcpy(acStr, acTemp); |
|---|
| 209 | } |
|---|
| 210 | else |
|---|
| 211 | { |
|---|
| 212 | if (pstUsageMode->stMad.ePixelFormat == BVDB_PixelFmt_eInvalid) |
|---|
| 213 | strcat(acStr, "\tn/a"); |
|---|
| 214 | else |
|---|
| 215 | strcpy(acStr, "\tno"); |
|---|
| 216 | } |
|---|
| 217 | BDBG_P_PrintString("\tMAD: %s\n", acStr); |
|---|
| 218 | |
|---|
| 219 | /* RTS */ |
|---|
| 220 | BVDB_P_GetRtsSetStr(pstUsageMode->eRtsSet, acStr); |
|---|
| 221 | BDBG_P_PrintString("\tRTS: %s\n", acStr); |
|---|
| 222 | |
|---|
| 223 | /* SCL-CAP tolerance and bias */ |
|---|
| 224 | BDBG_P_PrintString("\tSCL-CAP tolerance: %d\n", pstUsageMode->ulSclCapTolerance); |
|---|
| 225 | |
|---|
| 226 | BVDB_P_GetSclCapBiasStr(pstUsageMode->eSclCapBias, acStr); |
|---|
| 227 | BDBG_P_PrintString("\tSCL-CAP bias: %s\n", acStr); |
|---|
| 228 | |
|---|
| 229 | return BERR_SUCCESS; |
|---|
| 230 | } |
|---|
| 231 | |
|---|
| 232 | BERR_Code BVDB_PrintVdb |
|---|
| 233 | ( BVDB_Handle hVdb ) |
|---|
| 234 | { |
|---|
| 235 | BVDB_UsageMode *pstTemp; |
|---|
| 236 | BVDB_P_Context *pVdb; |
|---|
| 237 | |
|---|
| 238 | BVDB_P_GET_CONTEXT(hVdb, pVdb); |
|---|
| 239 | |
|---|
| 240 | pstTemp = BLST_CQ_FIRST(pVdb); |
|---|
| 241 | |
|---|
| 242 | do |
|---|
| 243 | { |
|---|
| 244 | BVDB_PrintUsageMode(pstTemp); |
|---|
| 245 | pstTemp = BVDB_P_UsageMode_GetNextNode(pstTemp); |
|---|
| 246 | } while(pstTemp != BLST_CQ_FIRST(pVdb)); |
|---|
| 247 | |
|---|
| 248 | return BERR_SUCCESS; |
|---|
| 249 | } |
|---|
| 250 | |
|---|
| 251 | BERR_Code BVDB_AddVdbEntry |
|---|
| 252 | ( BVDB_Handle hVdb, |
|---|
| 253 | const BVDB_UsageMode *pstUsageMode ) |
|---|
| 254 | { |
|---|
| 255 | BERR_Code err = BERR_SUCCESS; |
|---|
| 256 | BVDB_P_Context *pVdb; |
|---|
| 257 | BVDB_VideoDisplayMode stDispMode = pstUsageMode->stDisplayMode; |
|---|
| 258 | BVDB_UsageMode stUsageMode; |
|---|
| 259 | |
|---|
| 260 | BVDB_P_GET_CONTEXT(hVdb, pVdb); |
|---|
| 261 | |
|---|
| 262 | BKNI_Memcpy((void*)&stUsageMode, (void *)pstUsageMode, sizeof(BVDB_UsageMode)); |
|---|
| 263 | |
|---|
| 264 | /* Create ID based on given parameters */ |
|---|
| 265 | if (BVDB_P_CreateId(pVdb, &stUsageMode) == BERR_SUCCESS) |
|---|
| 266 | { |
|---|
| 267 | BVDB_UsageMode *pCurr, *pNext, *pPrev = NULL, *pInsert = NULL; |
|---|
| 268 | bool bInsertPointBefore = false, bInsertPointAfter = false; |
|---|
| 269 | BVDB_DispModeType eDispMode, eInsertDispMode; |
|---|
| 270 | |
|---|
| 271 | /* Validate Entry */ |
|---|
| 272 | err = BVDB_P_ValidateVdbEntry(NULL, &stUsageMode); |
|---|
| 273 | |
|---|
| 274 | if (err == BERR_SUCCESS) |
|---|
| 275 | { |
|---|
| 276 | pCurr = BLST_CQ_FIRST(pVdb); |
|---|
| 277 | do |
|---|
| 278 | { |
|---|
| 279 | /* search for similar source format, display and window */ |
|---|
| 280 | if ((pCurr->eSrcFmtSet == stUsageMode.eSrcFmtSet) && |
|---|
| 281 | (pCurr->eDisplay == stUsageMode.eDisplay) && |
|---|
| 282 | (pCurr->eWindow == stUsageMode.eWindow)) |
|---|
| 283 | { |
|---|
| 284 | eDispMode = BVDB_P_GetVideoDisplayModeType(&pCurr->stDisplayMode); |
|---|
| 285 | eInsertDispMode = BVDB_P_GetVideoDisplayModeType(&stDispMode); |
|---|
| 286 | pNext = BVDB_P_UsageMode_GetNextNode(pCurr); |
|---|
| 287 | pPrev = BVDB_P_UsageMode_GetPrevNode(pCurr); |
|---|
| 288 | |
|---|
| 289 | if (((pCurr->eInput == stUsageMode.eInput) && (eDispMode < eInsertDispMode)) || /* compare inputs and display mode */ |
|---|
| 290 | ((pCurr->eInput < stUsageMode.eInput) && (stUsageMode.eInput < pNext->eInput))) /* compare inputs */ |
|---|
| 291 | { |
|---|
| 292 | bInsertPointAfter = true; |
|---|
| 293 | break; |
|---|
| 294 | } |
|---|
| 295 | else if (((pCurr->eInput == stUsageMode.eInput) && (eDispMode > eInsertDispMode)) || /* compare inputs and display mode */ |
|---|
| 296 | ((pCurr->eInput > stUsageMode.eInput) && (stUsageMode.eInput > pPrev->eInput))) /* compare inputs */ |
|---|
| 297 | { |
|---|
| 298 | bInsertPointBefore = true; |
|---|
| 299 | break; |
|---|
| 300 | } |
|---|
| 301 | } |
|---|
| 302 | pCurr = BVDB_P_UsageMode_GetNextNode(pCurr); |
|---|
| 303 | } while (pCurr != BLST_CQ_FIRST(pVdb)); |
|---|
| 304 | |
|---|
| 305 | pInsert = (BVDB_UsageMode *)BKNI_Malloc(sizeof(BVDB_UsageMode)); |
|---|
| 306 | if (pInsert == NULL) |
|---|
| 307 | { |
|---|
| 308 | BDBG_ERR(("Out of memory")); |
|---|
| 309 | return BERR_OUT_OF_SYSTEM_MEMORY; |
|---|
| 310 | } |
|---|
| 311 | |
|---|
| 312 | BKNI_Memcpy((void *)pInsert, (void *)&stUsageMode, sizeof(BVDB_UsageMode)); |
|---|
| 313 | |
|---|
| 314 | /* compare input of above usage mode with to be inserted usage mode. */ |
|---|
| 315 | if (bInsertPointAfter) |
|---|
| 316 | { |
|---|
| 317 | BLST_CQ_INSERT_AFTER(pVdb, pCurr, pInsert, link); |
|---|
| 318 | } |
|---|
| 319 | else if (bInsertPointBefore) |
|---|
| 320 | { |
|---|
| 321 | BLST_CQ_INSERT_BEFORE(pVdb, pCurr, pInsert, link); |
|---|
| 322 | } |
|---|
| 323 | else /* add at tail */ |
|---|
| 324 | { |
|---|
| 325 | BLST_CQ_INSERT_TAIL(pVdb, pInsert, link); |
|---|
| 326 | } |
|---|
| 327 | BDBG_MSG(("Added usage mode %s", stUsageMode.acId)); |
|---|
| 328 | } |
|---|
| 329 | } |
|---|
| 330 | else |
|---|
| 331 | { |
|---|
| 332 | BDBG_ERR(("Failed to add usage mode due to bad parameters entered")); |
|---|
| 333 | err = BERR_INVALID_PARAMETER; |
|---|
| 334 | } |
|---|
| 335 | return err; |
|---|
| 336 | } |
|---|
| 337 | |
|---|
| 338 | BERR_Code BVDB_RemoveVdbEntry |
|---|
| 339 | ( BVDB_Handle hVdb, |
|---|
| 340 | const BVDB_UsageMode *pstUsageMode ) |
|---|
| 341 | { |
|---|
| 342 | BERR_Code err = BERR_SUCCESS; |
|---|
| 343 | BVDB_P_Context *pVdb; |
|---|
| 344 | BVDB_UsageMode *pCurr; |
|---|
| 345 | bool bFound = false; |
|---|
| 346 | |
|---|
| 347 | BVDB_P_GET_CONTEXT(hVdb, pVdb); |
|---|
| 348 | |
|---|
| 349 | pCurr = BLST_CQ_FIRST(pVdb); |
|---|
| 350 | do |
|---|
| 351 | { |
|---|
| 352 | if (strcmp(pCurr->acId, pstUsageMode->acId) == 0) |
|---|
| 353 | { |
|---|
| 354 | bFound = true; |
|---|
| 355 | break; |
|---|
| 356 | } |
|---|
| 357 | pCurr = BVDB_P_UsageMode_GetNextNode(pCurr); |
|---|
| 358 | } while (pCurr != BLST_CQ_FIRST(pVdb)); |
|---|
| 359 | |
|---|
| 360 | if (bFound) |
|---|
| 361 | { |
|---|
| 362 | /* remove entry */ |
|---|
| 363 | BLST_CQ_REMOVE(pVdb, pCurr, link); |
|---|
| 364 | BKNI_Free(pCurr); |
|---|
| 365 | } |
|---|
| 366 | else |
|---|
| 367 | { |
|---|
| 368 | BDBG_ERR(("ID not found")); |
|---|
| 369 | err = BERR_INVALID_PARAMETER; |
|---|
| 370 | } |
|---|
| 371 | |
|---|
| 372 | return err; |
|---|
| 373 | } |
|---|
| 374 | |
|---|
| 375 | BERR_Code BVDB_GetVdbEntry |
|---|
| 376 | ( BVDB_Handle hVdb, |
|---|
| 377 | BVDB_UsageMode *pstUsageMode ) |
|---|
| 378 | { |
|---|
| 379 | BERR_Code err = BERR_SUCCESS; |
|---|
| 380 | BVDB_P_Context *pVdb; |
|---|
| 381 | BVDB_UsageMode *pstTemp; |
|---|
| 382 | bool bFound = false; |
|---|
| 383 | BVDB_VideoDisplayMode *pMode, *pSearchMode; |
|---|
| 384 | uint32_t ulUsrId, ulTempId; |
|---|
| 385 | |
|---|
| 386 | BVDB_P_GET_CONTEXT(hVdb, pVdb); |
|---|
| 387 | |
|---|
| 388 | ulUsrId = BVDB_P_GetConfigId(pstUsageMode->acId); |
|---|
| 389 | |
|---|
| 390 | pstTemp = BLST_CQ_FIRST(pVdb); |
|---|
| 391 | do |
|---|
| 392 | { |
|---|
| 393 | pMode = &pstTemp->stDisplayMode; |
|---|
| 394 | pSearchMode = &(pstUsageMode->stDisplayMode); |
|---|
| 395 | ulTempId = BVDB_P_GetConfigId(pstTemp->acId); |
|---|
| 396 | |
|---|
| 397 | if ((ulUsrId == ulTempId) && |
|---|
| 398 | (pstUsageMode->eSrcFmtSet == pstTemp->eSrcFmtSet) && |
|---|
| 399 | (pstUsageMode->eDisplay == pstTemp->eDisplay) && |
|---|
| 400 | (pstUsageMode->eWindow == pstTemp->eWindow) && |
|---|
| 401 | (pstUsageMode->eInput == pstTemp->eInput) && |
|---|
| 402 | ((*(uint32_t*)pMode) & (*(uint32_t *)pSearchMode))) |
|---|
| 403 | { |
|---|
| 404 | bFound = true; |
|---|
| 405 | break; |
|---|
| 406 | } |
|---|
| 407 | pstTemp = BVDB_P_UsageMode_GetNextNode(pstTemp); |
|---|
| 408 | } while (pstTemp != BLST_CQ_FIRST(pVdb)); |
|---|
| 409 | |
|---|
| 410 | if (bFound == false) |
|---|
| 411 | err = BERR_INVALID_PARAMETER; |
|---|
| 412 | else |
|---|
| 413 | { |
|---|
| 414 | BKNI_Memcpy((void *)pstUsageMode, (void *)pstTemp, sizeof(BVDB_UsageMode)); |
|---|
| 415 | } |
|---|
| 416 | |
|---|
| 417 | return err; |
|---|
| 418 | } |
|---|
| 419 | |
|---|
| 420 | BERR_Code BVDB_GetVdbEntryById |
|---|
| 421 | ( BVDB_Handle hVdb, |
|---|
| 422 | BVDB_UsageMode *pstUsageMode ) |
|---|
| 423 | { |
|---|
| 424 | BERR_Code err = BERR_SUCCESS; |
|---|
| 425 | BVDB_P_Context *pVdb; |
|---|
| 426 | BVDB_UsageMode *pstTemp; |
|---|
| 427 | bool bFound = false; |
|---|
| 428 | |
|---|
| 429 | BVDB_P_GET_CONTEXT(hVdb, pVdb); |
|---|
| 430 | |
|---|
| 431 | pstTemp = BLST_CQ_FIRST(pVdb); |
|---|
| 432 | do |
|---|
| 433 | { |
|---|
| 434 | if (strcmp(pstUsageMode->acId, pstTemp->acId) == 0) |
|---|
| 435 | { |
|---|
| 436 | BKNI_Memcpy((void *)pstUsageMode, (void *)pstTemp, sizeof(BVDB_UsageMode)); |
|---|
| 437 | bFound = true; |
|---|
| 438 | break; |
|---|
| 439 | } |
|---|
| 440 | pstTemp = BVDB_P_UsageMode_GetNextNode(pstTemp); |
|---|
| 441 | } while (pstTemp != BLST_CQ_FIRST(pVdb)); |
|---|
| 442 | |
|---|
| 443 | if (bFound == false) |
|---|
| 444 | err = BERR_INVALID_PARAMETER; |
|---|
| 445 | |
|---|
| 446 | return err; |
|---|
| 447 | } |
|---|
| 448 | |
|---|
| 449 | |
|---|