Wolfgang Denk | ba94a1b | 2006-05-30 15:56:48 +0200 | [diff] [blame] | 1 | /** |
| 2 | * @file IxNpeDl.c |
| 3 | * |
| 4 | * @author Intel Corporation |
| 5 | * @date 08 January 2002 |
| 6 | * |
| 7 | * @brief This file contains the implementation of the public API for the |
| 8 | * IXP425 NPE Downloader component |
| 9 | * |
| 10 | * |
| 11 | * @par |
| 12 | * IXP400 SW Release version 2.0 |
| 13 | * |
| 14 | * -- Copyright Notice -- |
| 15 | * |
| 16 | * @par |
| 17 | * Copyright 2001-2005, Intel Corporation. |
| 18 | * All rights reserved. |
| 19 | * |
| 20 | * @par |
Wolfgang Denk | cb3761e | 2013-07-28 22:12:47 +0200 | [diff] [blame] | 21 | * SPDX-License-Identifier: BSD-3-Clause |
Wolfgang Denk | ba94a1b | 2006-05-30 15:56:48 +0200 | [diff] [blame] | 22 | * @par |
| 23 | * -- End of Copyright Notice -- |
| 24 | */ |
| 25 | |
| 26 | /* |
| 27 | * Put the system defined include files required |
| 28 | */ |
| 29 | |
| 30 | /* |
| 31 | * Put the user defined include files required |
| 32 | */ |
| 33 | #include "IxNpeDl.h" |
| 34 | #include "IxNpeDlImageMgr_p.h" |
| 35 | #include "IxNpeDlNpeMgr_p.h" |
| 36 | #include "IxNpeDlMacros_p.h" |
| 37 | #include "IxFeatureCtrl.h" |
| 38 | #include "IxOsal.h" |
| 39 | /* |
| 40 | * #defines used in this file |
| 41 | */ |
| 42 | #define IMAGEID_MAJOR_NUMBER_DEFAULT 0 |
| 43 | #define IMAGEID_MINOR_NUMBER_DEFAULT 0 |
| 44 | |
| 45 | /* |
| 46 | * Typedefs whose scope is limited to this file. |
| 47 | */ |
| 48 | typedef struct |
| 49 | { |
| 50 | BOOL validImage; |
| 51 | IxNpeDlImageId imageId; |
| 52 | } IxNpeDlNpeState; |
| 53 | |
| 54 | /* module statistics counters */ |
| 55 | typedef struct |
| 56 | { |
| 57 | UINT32 attemptedDownloads; |
| 58 | UINT32 successfulDownloads; |
| 59 | UINT32 criticalFailDownloads; |
| 60 | } IxNpeDlStats; |
| 61 | |
| 62 | /* |
| 63 | * Variable declarations global to this file only. Externs are followed |
| 64 | * by static variables. |
| 65 | */ |
| 66 | static IxNpeDlNpeState ixNpeDlNpeState[IX_NPEDL_NPEID_MAX] = |
| 67 | { |
York Sun | 472d546 | 2013-04-01 11:29:11 -0700 | [diff] [blame] | 68 | {false, {IX_NPEDL_NPEID_MAX, 0, 0, 0}}, |
| 69 | {false, {IX_NPEDL_NPEID_MAX, 0, 0, 0}}, |
| 70 | {false, {IX_NPEDL_NPEID_MAX, 0, 0, 0}} |
Wolfgang Denk | ba94a1b | 2006-05-30 15:56:48 +0200 | [diff] [blame] | 71 | }; |
| 72 | |
| 73 | static IxNpeDlStats ixNpeDlStats; |
| 74 | |
| 75 | /* |
| 76 | * Software guard to prevent NPE from being started multiple times. |
| 77 | */ |
York Sun | 472d546 | 2013-04-01 11:29:11 -0700 | [diff] [blame] | 78 | static BOOL ixNpeDlNpeStarted[IX_NPEDL_NPEID_MAX] ={false, false, false} ; |
Wolfgang Denk | ba94a1b | 2006-05-30 15:56:48 +0200 | [diff] [blame] | 79 | |
| 80 | |
| 81 | /* |
| 82 | * static function prototypes. |
| 83 | */ |
| 84 | PRIVATE IX_STATUS |
| 85 | ixNpeDlNpeInitAndStartInternal (UINT32 *imageLibrary, UINT32 imageId); |
| 86 | |
| 87 | /* |
Wolfgang Denk | ba94a1b | 2006-05-30 15:56:48 +0200 | [diff] [blame] | 88 | * Function definition: ixNpeDlImageDownload |
| 89 | */ |
| 90 | PUBLIC IX_STATUS |
| 91 | ixNpeDlImageDownload (IxNpeDlImageId *imageIdPtr, |
| 92 | BOOL verify) |
| 93 | { |
| 94 | UINT32 imageSize; |
| 95 | UINT32 *imageCodePtr = NULL; |
| 96 | IX_STATUS status; |
| 97 | IxNpeDlNpeId npeId = imageIdPtr->npeId; |
| 98 | |
| 99 | IX_NPEDL_TRACE0 (IX_NPEDL_FN_ENTRY_EXIT, |
| 100 | "Entering ixNpeDlImageDownload\n"); |
| 101 | |
| 102 | ixNpeDlStats.attemptedDownloads++; |
| 103 | |
| 104 | /* Check input parameters */ |
| 105 | if ((npeId >= IX_NPEDL_NPEID_MAX) || (npeId < 0)) |
| 106 | { |
| 107 | status = IX_NPEDL_PARAM_ERR; |
| 108 | IX_NPEDL_ERROR_REPORT ("ixNpeDlImageDownload - invalid parameter\n"); |
| 109 | } |
| 110 | else |
| 111 | { |
| 112 | /* Ensure initialisation has been completed */ |
| 113 | ixNpeDlNpeMgrInit(); |
| 114 | |
| 115 | /* If not IXP42X A0 stepping, proceed to check for existence of npe's */ |
| 116 | if ((IX_FEATURE_CTRL_SILICON_TYPE_A0 != |
| 117 | (ixFeatureCtrlProductIdRead() & IX_FEATURE_CTRL_SILICON_STEPPING_MASK)) |
| 118 | || (IX_FEATURE_CTRL_DEVICE_TYPE_IXP42X != ixFeatureCtrlDeviceRead ())) |
| 119 | { |
| 120 | if (npeId == IX_NPEDL_NPEID_NPEA) |
| 121 | { |
| 122 | if (ixFeatureCtrlComponentCheck(IX_FEATURECTRL_NPEA) == |
| 123 | IX_FEATURE_CTRL_COMPONENT_DISABLED) |
| 124 | { |
| 125 | IX_NPEDL_WARNING_REPORT("Warning: the NPE A component you specified does" |
| 126 | " not exist\n"); |
| 127 | return IX_SUCCESS; |
| 128 | } |
| 129 | } /* end of if(npeId) */ |
| 130 | else if (npeId == IX_NPEDL_NPEID_NPEB) |
| 131 | { |
| 132 | if (ixFeatureCtrlComponentCheck(IX_FEATURECTRL_NPEB)== |
| 133 | IX_FEATURE_CTRL_COMPONENT_DISABLED) |
| 134 | { |
| 135 | IX_NPEDL_WARNING_REPORT("Warning: the NPE B component you specified" |
| 136 | " does not exist\n"); |
| 137 | return IX_SUCCESS; |
| 138 | } |
| 139 | } /* end of elseif(npeId) */ |
| 140 | else if (npeId == IX_NPEDL_NPEID_NPEC) |
| 141 | { |
| 142 | if (ixFeatureCtrlComponentCheck(IX_FEATURECTRL_NPEC)== |
| 143 | IX_FEATURE_CTRL_COMPONENT_DISABLED) |
| 144 | { |
| 145 | IX_NPEDL_WARNING_REPORT("Warning: the NPE C component you specified" |
| 146 | " does not exist\n"); |
| 147 | return IX_SUCCESS; |
| 148 | } |
| 149 | } /* end of elseif(npeId) */ |
| 150 | } /* end of if(IX_FEATURE_CTRL_SILICON_TYPE_B0) */ /*End of Silicon Type Check*/ |
| 151 | |
| 152 | /* stop and reset the NPE */ |
| 153 | if (IX_SUCCESS != ixNpeDlNpeStopAndReset (npeId)) |
| 154 | { |
| 155 | IX_NPEDL_ERROR_REPORT ("Failed to stop and reset NPE\n"); |
| 156 | return IX_FAIL; |
| 157 | } |
| 158 | |
| 159 | /* Locate image */ |
| 160 | status = ixNpeDlImageMgrImageLocate (imageIdPtr, &imageCodePtr, |
| 161 | &imageSize); |
| 162 | if (IX_SUCCESS == status) |
| 163 | { |
| 164 | /* |
| 165 | * If download was successful, store image Id in list of |
| 166 | * currently loaded images. If a critical error occured |
| 167 | * during download, record that the NPE has an invalid image |
| 168 | */ |
| 169 | status = ixNpeDlNpeMgrImageLoad (npeId, imageCodePtr, |
| 170 | verify); |
| 171 | if (IX_SUCCESS == status) |
| 172 | { |
| 173 | ixNpeDlNpeState[npeId].imageId = *imageIdPtr; |
York Sun | 472d546 | 2013-04-01 11:29:11 -0700 | [diff] [blame] | 174 | ixNpeDlNpeState[npeId].validImage = true; |
Wolfgang Denk | ba94a1b | 2006-05-30 15:56:48 +0200 | [diff] [blame] | 175 | ixNpeDlStats.successfulDownloads++; |
| 176 | |
| 177 | status = ixNpeDlNpeExecutionStart (npeId); |
| 178 | } |
| 179 | else if ((status == IX_NPEDL_CRITICAL_NPE_ERR) || |
| 180 | (status == IX_NPEDL_CRITICAL_MICROCODE_ERR)) |
| 181 | { |
| 182 | ixNpeDlNpeState[npeId].imageId = *imageIdPtr; |
York Sun | 472d546 | 2013-04-01 11:29:11 -0700 | [diff] [blame] | 183 | ixNpeDlNpeState[npeId].validImage = false; |
Wolfgang Denk | ba94a1b | 2006-05-30 15:56:48 +0200 | [diff] [blame] | 184 | ixNpeDlStats.criticalFailDownloads++; |
| 185 | } |
| 186 | } /* end of if(IX_SUCCESS) */ /* condition: image located successfully in microcode image */ |
| 187 | } /* end of if-else(npeId) */ /* condition: parameter checks ok */ |
| 188 | |
| 189 | IX_NPEDL_TRACE1 (IX_NPEDL_FN_ENTRY_EXIT, |
| 190 | "Exiting ixNpeDlImageDownload : status = %d\n", status); |
| 191 | return status; |
| 192 | } |
| 193 | |
| 194 | /* |
| 195 | * Function definition: ixNpeDlAvailableImagesCountGet |
| 196 | */ |
| 197 | PUBLIC IX_STATUS |
| 198 | ixNpeDlAvailableImagesCountGet (UINT32 *numImagesPtr) |
| 199 | { |
| 200 | IX_STATUS status; |
| 201 | |
| 202 | IX_NPEDL_TRACE0 (IX_NPEDL_FN_ENTRY_EXIT, |
| 203 | "Entering ixNpeDlAvailableImagesCountGet\n"); |
| 204 | |
| 205 | /* Check input parameters */ |
| 206 | if (numImagesPtr == NULL) |
| 207 | { |
| 208 | status = IX_NPEDL_PARAM_ERR; |
| 209 | IX_NPEDL_ERROR_REPORT ("ixNpeDlAvailableImagesCountGet - " |
| 210 | "invalid parameter\n"); |
| 211 | } |
| 212 | else |
| 213 | { |
| 214 | /* |
| 215 | * Use ImageMgr module to get no. of images listed in Image Library Header. |
| 216 | * If NULL is passed as imageListPtr parameter to following function, |
| 217 | * it will only fill number of images into numImagesPtr |
| 218 | */ |
| 219 | status = ixNpeDlImageMgrImageListExtract (NULL, numImagesPtr); |
| 220 | } /* end of if-else(numImagesPtr) */ |
| 221 | |
| 222 | IX_NPEDL_TRACE1 (IX_NPEDL_FN_ENTRY_EXIT, |
| 223 | "Exiting ixNpeDlAvailableImagesCountGet : " |
| 224 | "status = %d\n", status); |
| 225 | return status; |
| 226 | } |
| 227 | |
| 228 | /* |
| 229 | * Function definition: ixNpeDlAvailableImagesListGet |
| 230 | */ |
| 231 | PUBLIC IX_STATUS |
| 232 | ixNpeDlAvailableImagesListGet (IxNpeDlImageId *imageIdListPtr, |
| 233 | UINT32 *listSizePtr) |
| 234 | { |
| 235 | IX_STATUS status; |
| 236 | |
| 237 | IX_NPEDL_TRACE0 (IX_NPEDL_FN_ENTRY_EXIT, |
| 238 | "Entering ixNpeDlAvailableImagesListGet\n"); |
| 239 | |
| 240 | /* Check input parameters */ |
| 241 | if ((imageIdListPtr == NULL) || (listSizePtr == NULL)) |
| 242 | { |
| 243 | status = IX_NPEDL_PARAM_ERR; |
| 244 | IX_NPEDL_ERROR_REPORT ("ixNpeDlAvailableImagesListGet - " |
| 245 | "invalid parameter\n"); |
| 246 | } |
| 247 | else |
| 248 | { |
| 249 | /* Call ImageMgr to get list of images listed in Image Library Header */ |
| 250 | status = ixNpeDlImageMgrImageListExtract (imageIdListPtr, |
| 251 | listSizePtr); |
| 252 | } /* end of if-else(imageIdListPtr) */ |
| 253 | |
| 254 | IX_NPEDL_TRACE1 (IX_NPEDL_FN_ENTRY_EXIT, |
| 255 | "Exiting ixNpeDlAvailableImagesListGet : status = %d\n", |
| 256 | status); |
| 257 | return status; |
| 258 | } |
| 259 | |
| 260 | /* |
| 261 | * Function definition: ixNpeDlLoadedImageGet |
| 262 | */ |
| 263 | PUBLIC IX_STATUS |
| 264 | ixNpeDlLoadedImageGet (IxNpeDlNpeId npeId, |
| 265 | IxNpeDlImageId *imageIdPtr) |
| 266 | { |
| 267 | IX_STATUS status = IX_SUCCESS; |
| 268 | |
| 269 | IX_NPEDL_TRACE0 (IX_NPEDL_FN_ENTRY_EXIT, |
| 270 | "Entering ixNpeDlLoadedImageGet\n"); |
| 271 | |
| 272 | /* Check input parameters */ |
| 273 | if ((npeId >= IX_NPEDL_NPEID_MAX) || (npeId < 0) || (imageIdPtr == NULL)) |
| 274 | { |
| 275 | status = IX_NPEDL_PARAM_ERR; |
| 276 | IX_NPEDL_ERROR_REPORT ("ixNpeDlLoadedImageGet - invalid parameter\n"); |
| 277 | } |
| 278 | else |
| 279 | { |
| 280 | |
| 281 | /* If not IXP42X A0 stepping, proceed to check for existence of npe's */ |
| 282 | if ((IX_FEATURE_CTRL_SILICON_TYPE_A0 != |
| 283 | (ixFeatureCtrlProductIdRead() & IX_FEATURE_CTRL_SILICON_STEPPING_MASK)) |
| 284 | || (IX_FEATURE_CTRL_DEVICE_TYPE_IXP42X != ixFeatureCtrlDeviceRead ())) |
| 285 | { |
| 286 | if (npeId == IX_NPEDL_NPEID_NPEA && |
| 287 | (ixFeatureCtrlComponentCheck(IX_FEATURECTRL_NPEA) == |
| 288 | IX_FEATURE_CTRL_COMPONENT_DISABLED)) |
| 289 | { |
| 290 | IX_NPEDL_WARNING_REPORT("Warning: the NPE A component you specified does" |
| 291 | " not exist\n"); |
| 292 | return IX_SUCCESS; |
| 293 | } /* end of if(npeId) */ |
| 294 | |
| 295 | if (npeId == IX_NPEDL_NPEID_NPEB && |
| 296 | (ixFeatureCtrlComponentCheck(IX_FEATURECTRL_NPEB) == |
| 297 | IX_FEATURE_CTRL_COMPONENT_DISABLED)) |
| 298 | { |
| 299 | IX_NPEDL_WARNING_REPORT("Warning: the NPE B component you specified does" |
| 300 | " not exist\n"); |
| 301 | return IX_SUCCESS; |
| 302 | } /* end of if(npeId) */ |
| 303 | |
| 304 | if (npeId == IX_NPEDL_NPEID_NPEC && |
| 305 | (ixFeatureCtrlComponentCheck(IX_FEATURECTRL_NPEC) == |
| 306 | IX_FEATURE_CTRL_COMPONENT_DISABLED)) |
| 307 | { |
| 308 | IX_NPEDL_WARNING_REPORT("Warning: the NPE C component you specified does" |
| 309 | " not exist\n"); |
| 310 | return IX_SUCCESS; |
| 311 | } /* end of if(npeId) */ |
| 312 | } /* end of if not IXP42x-A0 silicon */ |
| 313 | |
| 314 | if (ixNpeDlNpeState[npeId].validImage) |
| 315 | { |
| 316 | /* use npeId to get imageId from list of currently loaded |
| 317 | images */ |
| 318 | *imageIdPtr = ixNpeDlNpeState[npeId].imageId; |
| 319 | } |
| 320 | else |
| 321 | { |
| 322 | status = IX_FAIL; |
| 323 | } /* end of if-else(ixNpeDlNpeState) */ |
| 324 | } /* end of if-else(npeId) */ |
| 325 | |
| 326 | IX_NPEDL_TRACE1 (IX_NPEDL_FN_ENTRY_EXIT, |
| 327 | "Exiting ixNpeDlLoadedImageGet : status = %d\n", |
| 328 | status); |
| 329 | return status; |
| 330 | } |
| 331 | |
| 332 | /* |
| 333 | * Function definition: ixNpeDlLatestImageGet |
| 334 | */ |
| 335 | PUBLIC IX_STATUS |
| 336 | ixNpeDlLatestImageGet ( |
| 337 | IxNpeDlNpeId npeId, |
| 338 | IxNpeDlFunctionalityId functionalityId, |
| 339 | IxNpeDlImageId *imageIdPtr) |
| 340 | { |
| 341 | IX_STATUS status; |
| 342 | |
| 343 | IX_NPEDL_TRACE0 (IX_NPEDL_FN_ENTRY_EXIT, |
| 344 | "Entering ixNpeDlLatestImageGet\n"); |
| 345 | |
| 346 | /* Check input parameters */ |
| 347 | if ((npeId >= IX_NPEDL_NPEID_MAX) || |
| 348 | (npeId < 0) || |
| 349 | (imageIdPtr == NULL)) |
| 350 | { |
| 351 | status = IX_NPEDL_PARAM_ERR; |
| 352 | IX_NPEDL_ERROR_REPORT ("ixNpeDlLatestImageGet - " |
| 353 | "invalid parameter\n"); |
| 354 | } /* end of if(npeId) */ |
| 355 | else |
| 356 | { |
| 357 | |
| 358 | /* If not IXP42X A0 stepping, proceed to check for existence of npe's */ |
| 359 | if ((IX_FEATURE_CTRL_SILICON_TYPE_A0 != |
| 360 | (ixFeatureCtrlProductIdRead() & IX_FEATURE_CTRL_SILICON_STEPPING_MASK)) |
| 361 | || (IX_FEATURE_CTRL_DEVICE_TYPE_IXP42X != ixFeatureCtrlDeviceRead ())) |
| 362 | { |
| 363 | if (npeId == IX_NPEDL_NPEID_NPEA && |
| 364 | (ixFeatureCtrlComponentCheck(IX_FEATURECTRL_NPEA) == |
| 365 | IX_FEATURE_CTRL_COMPONENT_DISABLED)) |
| 366 | { |
| 367 | IX_NPEDL_WARNING_REPORT("Warning: the NPE A component you specified does" |
| 368 | " not exist\n"); |
| 369 | return IX_SUCCESS; |
| 370 | } /* end of if(npeId) */ |
| 371 | |
| 372 | if (npeId == IX_NPEDL_NPEID_NPEB && |
| 373 | (ixFeatureCtrlComponentCheck(IX_FEATURECTRL_NPEB) == |
| 374 | IX_FEATURE_CTRL_COMPONENT_DISABLED)) |
| 375 | { |
| 376 | IX_NPEDL_WARNING_REPORT("Warning: the NPE B component you specified does" |
| 377 | " not exist\n"); |
| 378 | return IX_SUCCESS; |
| 379 | } /* end of if(npeId) */ |
| 380 | |
| 381 | if (npeId == IX_NPEDL_NPEID_NPEC && |
| 382 | (ixFeatureCtrlComponentCheck(IX_FEATURECTRL_NPEC) == |
| 383 | IX_FEATURE_CTRL_COMPONENT_DISABLED)) |
| 384 | { |
| 385 | IX_NPEDL_WARNING_REPORT("Warning: the NPE C component you specified does" |
| 386 | " not exist\n"); |
| 387 | return IX_SUCCESS; |
| 388 | } /* end of if(npeId) */ |
| 389 | } /* end of if not IXP42x-A0 silicon */ |
| 390 | |
| 391 | imageIdPtr->npeId = npeId; |
| 392 | imageIdPtr->functionalityId = functionalityId; |
| 393 | imageIdPtr->major = IMAGEID_MAJOR_NUMBER_DEFAULT; |
| 394 | imageIdPtr->minor = IMAGEID_MINOR_NUMBER_DEFAULT; |
| 395 | /* Call ImageMgr to get list of images listed in Image Library Header */ |
| 396 | status = ixNpeDlImageMgrLatestImageExtract(imageIdPtr); |
| 397 | } /* end of if-else(npeId) */ |
| 398 | |
| 399 | IX_NPEDL_TRACE1 (IX_NPEDL_FN_ENTRY_EXIT, |
| 400 | "Exiting ixNpeDlLatestImageGet : status = %d\n", |
| 401 | status); |
| 402 | |
| 403 | return status; |
| 404 | } |
| 405 | |
| 406 | /* |
| 407 | * Function definition: ixNpeDlNpeStopAndReset |
| 408 | */ |
| 409 | PUBLIC IX_STATUS |
| 410 | ixNpeDlNpeStopAndReset (IxNpeDlNpeId npeId) |
| 411 | { |
| 412 | IX_STATUS status = IX_SUCCESS; |
| 413 | |
| 414 | IX_NPEDL_TRACE0 (IX_NPEDL_FN_ENTRY_EXIT, |
| 415 | "Entering ixNpeDlNpeStopAndReset\n"); |
| 416 | |
| 417 | /* Ensure initialisation has been completed */ |
| 418 | ixNpeDlNpeMgrInit(); |
| 419 | |
| 420 | /* If not IXP42X A0 stepping, proceed to check for existence of npe's */ |
| 421 | if ((IX_FEATURE_CTRL_SILICON_TYPE_A0 != |
| 422 | (ixFeatureCtrlProductIdRead() & IX_FEATURE_CTRL_SILICON_STEPPING_MASK)) |
| 423 | || (IX_FEATURE_CTRL_DEVICE_TYPE_IXP42X != ixFeatureCtrlDeviceRead ())) |
| 424 | { |
| 425 | /* |
| 426 | * Check whether NPE is present |
| 427 | */ |
| 428 | if (IX_NPEDL_NPEID_NPEA == npeId) |
| 429 | { |
| 430 | /* Check whether NPE A is present */ |
| 431 | if (ixFeatureCtrlComponentCheck(IX_FEATURECTRL_NPEA)== |
| 432 | IX_FEATURE_CTRL_COMPONENT_DISABLED) |
| 433 | { |
| 434 | /* NPE A does not present */ |
| 435 | IX_NPEDL_WARNING_REPORT ("ixNpeDlNpeStopAndReset - Warning:NPEA does not present.\n"); |
| 436 | return IX_SUCCESS; |
| 437 | } |
| 438 | } /* end of if(IX_NPEDL_NPEID_NPEA) */ |
| 439 | else if (IX_NPEDL_NPEID_NPEB == npeId) |
| 440 | { |
| 441 | /* Check whether NPE B is present */ |
| 442 | if (ixFeatureCtrlComponentCheck(IX_FEATURECTRL_NPEB)== |
| 443 | IX_FEATURE_CTRL_COMPONENT_DISABLED) |
| 444 | { |
| 445 | /* NPE B does not present */ |
| 446 | IX_NPEDL_WARNING_REPORT ("ixNpeDlNpeStopAndReset - Warning:NPEB does not present.\n"); |
| 447 | return IX_SUCCESS; |
| 448 | } |
| 449 | } /* end of elseif(IX_NPEDL_NPEID_NPEB) */ |
| 450 | else if (IX_NPEDL_NPEID_NPEC == npeId) |
| 451 | { |
| 452 | /* Check whether NPE C is present */ |
| 453 | if (ixFeatureCtrlComponentCheck(IX_FEATURECTRL_NPEC)== |
| 454 | IX_FEATURE_CTRL_COMPONENT_DISABLED) |
| 455 | { |
| 456 | /* NPE C does not present */ |
| 457 | IX_NPEDL_WARNING_REPORT ("ixNpeDlNpeStopAndReset - Warning:NPEC does not present.\n"); |
| 458 | return IX_SUCCESS; |
| 459 | } |
| 460 | } /* end of elseif(IX_NPEDL_NPEID_NPEC) */ |
| 461 | else |
| 462 | { |
| 463 | /* Invalid NPE ID */ |
| 464 | IX_NPEDL_ERROR_REPORT ("ixNpeDlNpeStopAndReset - invalid Npe ID\n"); |
| 465 | status = IX_NPEDL_PARAM_ERR; |
| 466 | } /* end of if-else(IX_NPEDL_NPEID_NPEC) */ |
| 467 | } /* end of if not IXP42x-A0 Silicon */ |
| 468 | |
| 469 | if (status == IX_SUCCESS) |
| 470 | { |
| 471 | /* call NpeMgr function to stop the NPE */ |
| 472 | status = ixNpeDlNpeMgrNpeStop (npeId); |
| 473 | if (status == IX_SUCCESS) |
| 474 | { |
| 475 | /* call NpeMgr function to reset the NPE */ |
| 476 | status = ixNpeDlNpeMgrNpeReset (npeId); |
| 477 | } |
| 478 | } /* end of if(status) */ |
| 479 | |
| 480 | IX_NPEDL_TRACE1 (IX_NPEDL_FN_ENTRY_EXIT, |
| 481 | "Exiting ixNpeDlNpeStopAndReset : status = %d\n", status); |
| 482 | |
| 483 | if (IX_SUCCESS == status) |
| 484 | { |
| 485 | /* Indicate NPE has been stopped */ |
York Sun | 472d546 | 2013-04-01 11:29:11 -0700 | [diff] [blame] | 486 | ixNpeDlNpeStarted[npeId] = false ; |
Wolfgang Denk | ba94a1b | 2006-05-30 15:56:48 +0200 | [diff] [blame] | 487 | } |
| 488 | |
| 489 | return status; |
| 490 | } |
| 491 | |
| 492 | /* |
| 493 | * Function definition: ixNpeDlNpeExecutionStart |
| 494 | */ |
| 495 | PUBLIC IX_STATUS |
| 496 | ixNpeDlNpeExecutionStart (IxNpeDlNpeId npeId) |
| 497 | { |
| 498 | IX_STATUS status = IX_SUCCESS; |
| 499 | |
| 500 | IX_NPEDL_TRACE0 (IX_NPEDL_FN_ENTRY_EXIT, |
| 501 | "Entering ixNpeDlNpeExecutionStart\n"); |
| 502 | |
| 503 | /* If not IXP42X A0 stepping, proceed to check for existence of npe's */ |
| 504 | if ((IX_FEATURE_CTRL_SILICON_TYPE_A0 != |
| 505 | (ixFeatureCtrlProductIdRead() & IX_FEATURE_CTRL_SILICON_STEPPING_MASK)) |
| 506 | || (IX_FEATURE_CTRL_DEVICE_TYPE_IXP42X != ixFeatureCtrlDeviceRead ())) |
| 507 | { |
| 508 | /* |
| 509 | * Check whether NPE is present |
| 510 | */ |
| 511 | if (IX_NPEDL_NPEID_NPEA == npeId) |
| 512 | { |
| 513 | /* Check whether NPE A is present */ |
| 514 | if (ixFeatureCtrlComponentCheck(IX_FEATURECTRL_NPEA)== |
| 515 | IX_FEATURE_CTRL_COMPONENT_DISABLED) |
| 516 | { |
| 517 | /* NPE A does not present */ |
| 518 | IX_NPEDL_WARNING_REPORT ("ixNpeDlNpeExecutionStart - Warning:NPEA does not present.\n"); |
| 519 | return IX_SUCCESS; |
| 520 | } |
| 521 | } /* end of if(IX_NPEDL_NPEID_NPEA) */ |
| 522 | else if (IX_NPEDL_NPEID_NPEB == npeId) |
| 523 | { |
| 524 | /* Check whether NPE B is present */ |
| 525 | if (ixFeatureCtrlComponentCheck(IX_FEATURECTRL_NPEB)== |
| 526 | IX_FEATURE_CTRL_COMPONENT_DISABLED) |
| 527 | { |
| 528 | /* NPE B does not present */ |
| 529 | IX_NPEDL_WARNING_REPORT ("ixNpeDlNpeExecutionStart - Warning:NPEB does not present.\n"); |
| 530 | return IX_SUCCESS; |
| 531 | } |
| 532 | } /* end of elseif(IX_NPEDL_NPEID_NPEB) */ |
| 533 | else if (IX_NPEDL_NPEID_NPEC == npeId) |
| 534 | { |
| 535 | /* Check whether NPE C is present */ |
| 536 | if (ixFeatureCtrlComponentCheck(IX_FEATURECTRL_NPEC)== |
| 537 | IX_FEATURE_CTRL_COMPONENT_DISABLED) |
| 538 | { |
| 539 | /* NPE C does not present */ |
| 540 | IX_NPEDL_WARNING_REPORT ("ixNpeDlNpeExecutionStart - Warning:NPEC does not present.\n"); |
| 541 | return IX_SUCCESS; |
| 542 | } |
| 543 | } /* end of elseif(IX_NPEDL_NPEID_NPEC) */ |
| 544 | else |
| 545 | { |
| 546 | /* Invalid NPE ID */ |
| 547 | IX_NPEDL_ERROR_REPORT ("ixNpeDlNpeExecutionStart - invalid Npe ID\n"); |
| 548 | return IX_NPEDL_PARAM_ERR; |
| 549 | } /* end of if-else(IX_NPEDL_NPEID_NPEC) */ |
| 550 | } /* end of if not IXP42x-A0 Silicon */ |
| 551 | |
York Sun | 472d546 | 2013-04-01 11:29:11 -0700 | [diff] [blame] | 552 | if (true == ixNpeDlNpeStarted[npeId]) |
Wolfgang Denk | ba94a1b | 2006-05-30 15:56:48 +0200 | [diff] [blame] | 553 | { |
| 554 | /* NPE has been started. */ |
| 555 | return IX_SUCCESS ; |
| 556 | } |
| 557 | |
| 558 | /* Ensure initialisation has been completed */ |
| 559 | ixNpeDlNpeMgrInit(); |
| 560 | |
| 561 | /* call NpeMgr function to start the NPE */ |
| 562 | status = ixNpeDlNpeMgrNpeStart (npeId); |
| 563 | |
| 564 | if (IX_SUCCESS == status) |
| 565 | { |
| 566 | /* Indicate NPE has started */ |
York Sun | 472d546 | 2013-04-01 11:29:11 -0700 | [diff] [blame] | 567 | ixNpeDlNpeStarted[npeId] = true ; |
Wolfgang Denk | ba94a1b | 2006-05-30 15:56:48 +0200 | [diff] [blame] | 568 | } |
| 569 | |
| 570 | IX_NPEDL_TRACE1 (IX_NPEDL_FN_ENTRY_EXIT, |
| 571 | "Exiting ixNpeDlNpeExecutionStart : status = %d\n", |
| 572 | status); |
| 573 | |
| 574 | return status; |
| 575 | } |
| 576 | |
| 577 | /* |
| 578 | * Function definition: ixNpeDlNpeExecutionStop |
| 579 | */ |
| 580 | PUBLIC IX_STATUS |
| 581 | ixNpeDlNpeExecutionStop (IxNpeDlNpeId npeId) |
| 582 | { |
| 583 | IX_STATUS status = IX_SUCCESS; |
| 584 | |
| 585 | IX_NPEDL_TRACE0 (IX_NPEDL_FN_ENTRY_EXIT, |
| 586 | "Entering ixNpeDlNpeExecutionStop\n"); |
| 587 | |
| 588 | /* Ensure initialisation has been completed */ |
| 589 | ixNpeDlNpeMgrInit(); |
| 590 | |
| 591 | /* If not IXP42X A0 stepping, proceed to check for existence of npe's */ |
| 592 | if ((IX_FEATURE_CTRL_SILICON_TYPE_A0 != |
| 593 | (ixFeatureCtrlProductIdRead() & IX_FEATURE_CTRL_SILICON_STEPPING_MASK)) |
| 594 | || (IX_FEATURE_CTRL_DEVICE_TYPE_IXP42X != ixFeatureCtrlDeviceRead ())) |
| 595 | { |
| 596 | /* |
| 597 | * Check whether NPE is present |
| 598 | */ |
| 599 | if (IX_NPEDL_NPEID_NPEA == npeId) |
| 600 | { |
| 601 | /* Check whether NPE A is present */ |
| 602 | if (ixFeatureCtrlComponentCheck(IX_FEATURECTRL_NPEA)== |
| 603 | IX_FEATURE_CTRL_COMPONENT_DISABLED) |
| 604 | { |
| 605 | /* NPE A does not present */ |
| 606 | IX_NPEDL_WARNING_REPORT ("ixNpeDlNpeExecutionStop - Warning:NPEA does not present.\n"); |
| 607 | return IX_SUCCESS; |
| 608 | } |
| 609 | } /* end of if(IX_NPEDL_NPEID_NPEA) */ |
| 610 | else if (IX_NPEDL_NPEID_NPEB == npeId) |
| 611 | { |
| 612 | /* Check whether NPE B is present */ |
| 613 | if (ixFeatureCtrlComponentCheck(IX_FEATURECTRL_NPEB)== |
| 614 | IX_FEATURE_CTRL_COMPONENT_DISABLED) |
| 615 | { |
| 616 | /* NPE B does not present */ |
| 617 | IX_NPEDL_WARNING_REPORT ("ixNpeDlNpeExecutionStop - Warning:NPEB does not present.\n"); |
| 618 | return IX_SUCCESS; |
| 619 | } |
| 620 | } /* end of elseif(IX_NPEDL_NPEID_NPEB) */ |
| 621 | else if (IX_NPEDL_NPEID_NPEC == npeId) |
| 622 | { |
| 623 | /* Check whether NPE C is present */ |
| 624 | if (ixFeatureCtrlComponentCheck(IX_FEATURECTRL_NPEC)== |
| 625 | IX_FEATURE_CTRL_COMPONENT_DISABLED) |
| 626 | { |
| 627 | /* NPE C does not present */ |
| 628 | IX_NPEDL_WARNING_REPORT ("ixNpeDlNpeExecutionStop - Warning:NPEC does not present.\n"); |
| 629 | return IX_SUCCESS; |
| 630 | } |
| 631 | } /* end of elseif(IX_NPEDL_NPEID_NPEC) */ |
| 632 | else |
| 633 | { |
| 634 | /* Invalid NPE ID */ |
| 635 | IX_NPEDL_ERROR_REPORT ("ixNpeDlNpeExecutionStop - invalid Npe ID\n"); |
| 636 | status = IX_NPEDL_PARAM_ERR; |
| 637 | } /* end of if-else(IX_NPEDL_NPEID_NPEC) */ |
| 638 | } /* end of if not IXP42X-AO Silicon */ |
| 639 | |
| 640 | if (status == IX_SUCCESS) |
| 641 | { |
| 642 | /* call NpeMgr function to stop the NPE */ |
| 643 | status = ixNpeDlNpeMgrNpeStop (npeId); |
| 644 | } |
| 645 | |
| 646 | IX_NPEDL_TRACE1 (IX_NPEDL_FN_ENTRY_EXIT, |
| 647 | "Exiting ixNpeDlNpeExecutionStop : status = %d\n", |
| 648 | status); |
| 649 | |
| 650 | if (IX_SUCCESS == status) |
| 651 | { |
| 652 | /* Indicate NPE has been stopped */ |
York Sun | 472d546 | 2013-04-01 11:29:11 -0700 | [diff] [blame] | 653 | ixNpeDlNpeStarted[npeId] = false ; |
Wolfgang Denk | ba94a1b | 2006-05-30 15:56:48 +0200 | [diff] [blame] | 654 | } |
| 655 | |
| 656 | return status; |
| 657 | } |
| 658 | |
| 659 | /* |
| 660 | * Function definition: ixNpeDlUnload |
| 661 | */ |
| 662 | PUBLIC IX_STATUS |
| 663 | ixNpeDlUnload (void) |
| 664 | { |
| 665 | IX_STATUS status; |
| 666 | |
| 667 | IX_NPEDL_TRACE0 (IX_NPEDL_FN_ENTRY_EXIT, |
| 668 | "Entering ixNpeDlUnload\n"); |
| 669 | |
| 670 | status = ixNpeDlNpeMgrUninit(); |
| 671 | |
| 672 | IX_NPEDL_TRACE1 (IX_NPEDL_FN_ENTRY_EXIT, |
| 673 | "Exiting ixNpeDlUnload : status = %d\n", |
| 674 | status); |
| 675 | return status; |
| 676 | } |
| 677 | |
| 678 | /* |
| 679 | * Function definition: ixNpeDlStatsShow |
| 680 | */ |
| 681 | PUBLIC void |
| 682 | ixNpeDlStatsShow (void) |
| 683 | { |
| 684 | ixOsalLog (IX_OSAL_LOG_LVL_USER, |
| 685 | IX_OSAL_LOG_DEV_STDOUT, |
| 686 | "\nixNpeDlStatsShow:\n" |
| 687 | "\tDownloads Attempted by user: %u\n" |
| 688 | "\tSuccessful Downloads: %u\n" |
| 689 | "\tFailed Downloads (due to Critical Error): %u\n\n", |
| 690 | ixNpeDlStats.attemptedDownloads, |
| 691 | ixNpeDlStats.successfulDownloads, |
| 692 | ixNpeDlStats.criticalFailDownloads, |
| 693 | 0,0,0); |
| 694 | |
| 695 | ixNpeDlImageMgrStatsShow (); |
| 696 | ixNpeDlNpeMgrStatsShow (); |
| 697 | } |
| 698 | |
| 699 | /* |
| 700 | * Function definition: ixNpeDlStatsReset |
| 701 | */ |
| 702 | PUBLIC void |
| 703 | ixNpeDlStatsReset (void) |
| 704 | { |
| 705 | ixNpeDlStats.attemptedDownloads = 0; |
| 706 | ixNpeDlStats.successfulDownloads = 0; |
| 707 | ixNpeDlStats.criticalFailDownloads = 0; |
| 708 | |
| 709 | ixNpeDlImageMgrStatsReset (); |
| 710 | ixNpeDlNpeMgrStatsReset (); |
| 711 | } |
| 712 | |
| 713 | /* |
| 714 | * Function definition: ixNpeDlNpeInitAndStartInternal |
| 715 | */ |
| 716 | PRIVATE IX_STATUS |
| 717 | ixNpeDlNpeInitAndStartInternal (UINT32 *imageLibrary, |
| 718 | UINT32 imageId) |
| 719 | { |
| 720 | UINT32 imageSize; |
| 721 | UINT32 *imageCodePtr = NULL; |
| 722 | IX_STATUS status; |
| 723 | IxNpeDlNpeId npeId = IX_NPEDL_NPEID_FROM_IMAGEID_GET(imageId); |
| 724 | IxFeatureCtrlDeviceId deviceId = IX_NPEDL_DEVICEID_FROM_IMAGEID_GET(imageId); |
| 725 | |
| 726 | IX_NPEDL_TRACE0 (IX_NPEDL_FN_ENTRY_EXIT, |
| 727 | "Entering ixNpeDlNpeInitAndStartInternal\n"); |
| 728 | |
| 729 | ixNpeDlStats.attemptedDownloads++; |
| 730 | |
| 731 | /* Check input parameter device correctness */ |
| 732 | if ((deviceId >= IX_FEATURE_CTRL_DEVICE_TYPE_MAX) || |
| 733 | (deviceId < IX_FEATURE_CTRL_DEVICE_TYPE_IXP42X)) |
| 734 | { |
| 735 | status = IX_NPEDL_PARAM_ERR; |
| 736 | IX_NPEDL_ERROR_REPORT ("ixNpeDlNpeInitAndStartInternal - " |
| 737 | "invalid parameter\n"); |
| 738 | } /* End valid device id checking */ |
| 739 | |
| 740 | /* Check input parameters */ |
| 741 | else if ((npeId >= IX_NPEDL_NPEID_MAX) || (npeId < 0)) |
| 742 | { |
| 743 | status = IX_NPEDL_PARAM_ERR; |
| 744 | IX_NPEDL_ERROR_REPORT ("ixNpeDlNpeInitAndStartInternal - " |
| 745 | "invalid parameter\n"); |
| 746 | } |
| 747 | |
| 748 | else |
| 749 | { |
| 750 | /* Ensure initialisation has been completed */ |
| 751 | ixNpeDlNpeMgrInit(); |
| 752 | |
| 753 | /* Checking if image being loaded is meant for device that is running. |
| 754 | * Image is forward compatible. i.e Image built for IXP42X should run |
| 755 | * on IXP46X but not vice versa.*/ |
| 756 | if (deviceId > (ixFeatureCtrlDeviceRead() & IX_FEATURE_CTRL_DEVICE_TYPE_MASK)) |
| 757 | { |
| 758 | IX_NPEDL_ERROR_REPORT ("ixNpeDlNpeInitAndStartInternal - " |
| 759 | "Device type mismatch. NPE Image not " |
| 760 | "meant for device in use \n"); |
| 761 | return IX_NPEDL_DEVICE_ERR; |
| 762 | }/* if statement - matching image device and current device */ |
| 763 | |
| 764 | /* If not IXP42X A0 stepping, proceed to check for existence of npe's */ |
| 765 | if ((IX_FEATURE_CTRL_SILICON_TYPE_A0 != |
| 766 | (ixFeatureCtrlProductIdRead() & IX_FEATURE_CTRL_SILICON_STEPPING_MASK)) |
| 767 | || (IX_FEATURE_CTRL_DEVICE_TYPE_IXP42X != ixFeatureCtrlDeviceRead ())) |
| 768 | { |
| 769 | if (npeId == IX_NPEDL_NPEID_NPEA) |
| 770 | { |
| 771 | if (ixFeatureCtrlComponentCheck(IX_FEATURECTRL_NPEA) == |
| 772 | IX_FEATURE_CTRL_COMPONENT_DISABLED) |
| 773 | { |
| 774 | IX_NPEDL_WARNING_REPORT("Warning: the NPE A component you specified does" |
| 775 | " not exist\n"); |
| 776 | return IX_SUCCESS; |
| 777 | } |
| 778 | } /* end of if(npeId) */ |
| 779 | else if (npeId == IX_NPEDL_NPEID_NPEB) |
| 780 | { |
| 781 | if (ixFeatureCtrlComponentCheck(IX_FEATURECTRL_NPEB)== |
| 782 | IX_FEATURE_CTRL_COMPONENT_DISABLED) |
| 783 | { |
| 784 | IX_NPEDL_WARNING_REPORT("Warning: the NPE B component you specified" |
| 785 | " does not exist\n"); |
| 786 | return IX_SUCCESS; |
| 787 | } |
| 788 | } /* end of elseif(npeId) */ |
| 789 | else if (npeId == IX_NPEDL_NPEID_NPEC) |
| 790 | { |
| 791 | if (ixFeatureCtrlComponentCheck(IX_FEATURECTRL_NPEC)== |
| 792 | IX_FEATURE_CTRL_COMPONENT_DISABLED) |
| 793 | { |
| 794 | IX_NPEDL_WARNING_REPORT("Warning: the NPE C component you specified" |
| 795 | " does not exist\n"); |
| 796 | return IX_SUCCESS; |
| 797 | } |
| 798 | } /* end of elseif(npeId) */ |
| 799 | } /* end of if not IXP42X-A0 Silicon */ |
| 800 | |
| 801 | /* stop and reset the NPE */ |
| 802 | status = ixNpeDlNpeStopAndReset (npeId); |
| 803 | if (IX_SUCCESS != status) |
| 804 | { |
| 805 | IX_NPEDL_ERROR_REPORT ("Failed to stop and reset NPE\n"); |
| 806 | return status; |
| 807 | } |
| 808 | |
| 809 | /* Locate image */ |
| 810 | status = ixNpeDlImageMgrImageFind (imageLibrary, imageId, |
| 811 | &imageCodePtr, &imageSize); |
| 812 | if (IX_SUCCESS == status) |
| 813 | { |
| 814 | /* |
| 815 | * If download was successful, store image Id in list of |
| 816 | * currently loaded images. If a critical error occured |
| 817 | * during download, record that the NPE has an invalid image |
| 818 | */ |
York Sun | 472d546 | 2013-04-01 11:29:11 -0700 | [diff] [blame] | 819 | status = ixNpeDlNpeMgrImageLoad (npeId, imageCodePtr, true); |
Wolfgang Denk | ba94a1b | 2006-05-30 15:56:48 +0200 | [diff] [blame] | 820 | if (IX_SUCCESS == status) |
| 821 | { |
York Sun | 472d546 | 2013-04-01 11:29:11 -0700 | [diff] [blame] | 822 | ixNpeDlNpeState[npeId].validImage = true; |
Wolfgang Denk | ba94a1b | 2006-05-30 15:56:48 +0200 | [diff] [blame] | 823 | ixNpeDlStats.successfulDownloads++; |
| 824 | |
| 825 | status = ixNpeDlNpeExecutionStart (npeId); |
| 826 | } |
| 827 | else if ((status == IX_NPEDL_CRITICAL_NPE_ERR) || |
| 828 | (status == IX_NPEDL_CRITICAL_MICROCODE_ERR)) |
| 829 | { |
York Sun | 472d546 | 2013-04-01 11:29:11 -0700 | [diff] [blame] | 830 | ixNpeDlNpeState[npeId].validImage = false; |
Wolfgang Denk | ba94a1b | 2006-05-30 15:56:48 +0200 | [diff] [blame] | 831 | ixNpeDlStats.criticalFailDownloads++; |
| 832 | } |
| 833 | |
| 834 | /* NOTE - The following section of code is here to support |
| 835 | * a deprecated function ixNpeDlLoadedImageGet(). When that |
| 836 | * function is removed from the API, this code should be revised. |
| 837 | */ |
| 838 | ixNpeDlNpeState[npeId].imageId.npeId = npeId; |
| 839 | ixNpeDlNpeState[npeId].imageId.functionalityId = |
| 840 | IX_NPEDL_FUNCTIONID_FROM_IMAGEID_GET(imageId); |
| 841 | ixNpeDlNpeState[npeId].imageId.major = |
| 842 | IX_NPEDL_MAJOR_FROM_IMAGEID_GET(imageId); |
| 843 | ixNpeDlNpeState[npeId].imageId.minor = |
| 844 | IX_NPEDL_MINOR_FROM_IMAGEID_GET(imageId); |
| 845 | } /* end of if(IX_SUCCESS) */ /* condition: image located successfully in microcode image */ |
| 846 | } /* end of if-else(npeId-deviceId) */ /* condition: parameter checks ok */ |
| 847 | |
| 848 | IX_NPEDL_TRACE1 (IX_NPEDL_FN_ENTRY_EXIT, |
| 849 | "Exiting ixNpeDlNpeInitAndStartInternal : " |
| 850 | "status = %d\n", status); |
| 851 | return status; |
| 852 | } |
| 853 | |
| 854 | /* |
| 855 | * Function definition: ixNpeDlCustomImageNpeInitAndStart |
| 856 | */ |
| 857 | PUBLIC IX_STATUS |
| 858 | ixNpeDlCustomImageNpeInitAndStart (UINT32 *imageLibrary, |
| 859 | UINT32 imageId) |
| 860 | { |
| 861 | IX_STATUS status; |
| 862 | |
| 863 | if (imageLibrary == NULL) |
| 864 | { |
| 865 | status = IX_NPEDL_PARAM_ERR; |
| 866 | IX_NPEDL_ERROR_REPORT ("ixNpeDlCustomImageNpeInitAndStart " |
| 867 | "- invalid parameter\n"); |
| 868 | } |
| 869 | else |
| 870 | { |
| 871 | status = ixNpeDlNpeInitAndStartInternal (imageLibrary, imageId); |
| 872 | } /* end of if-else(imageLibrary) */ |
| 873 | |
| 874 | return status; |
| 875 | } |
| 876 | |
| 877 | /* |
| 878 | * Function definition: ixNpeDlNpeInitAndStart |
| 879 | */ |
| 880 | PUBLIC IX_STATUS |
| 881 | ixNpeDlNpeInitAndStart (UINT32 imageId) |
| 882 | { |
| 883 | return ixNpeDlNpeInitAndStartInternal (NULL, imageId); |
| 884 | } |
| 885 | |
| 886 | /* |
| 887 | * Function definition: ixNpeDlLoadedImageFunctionalityGet |
| 888 | */ |
| 889 | PUBLIC IX_STATUS |
| 890 | ixNpeDlLoadedImageFunctionalityGet (IxNpeDlNpeId npeId, |
| 891 | UINT8 *functionalityId) |
| 892 | { |
| 893 | /* Check input parameters */ |
| 894 | if ((npeId >= IX_NPEDL_NPEID_MAX) || (npeId < 0)) |
| 895 | { |
| 896 | IX_NPEDL_ERROR_REPORT ("ixNpeDlLoadedImageFunctionalityGet " |
| 897 | "- invalid parameter\n"); |
| 898 | return IX_NPEDL_PARAM_ERR; |
| 899 | } |
| 900 | if (functionalityId == NULL) |
| 901 | { |
| 902 | IX_NPEDL_ERROR_REPORT ("ixNpeDlLoadedImageFunctionalityGet " |
| 903 | "- invalid parameter\n"); |
| 904 | return IX_NPEDL_PARAM_ERR; |
| 905 | } |
| 906 | |
| 907 | if (ixNpeDlNpeState[npeId].validImage) |
| 908 | { |
| 909 | *functionalityId = ixNpeDlNpeState[npeId].imageId.functionalityId; |
| 910 | return IX_SUCCESS; |
| 911 | } |
| 912 | else |
| 913 | { |
| 914 | return IX_FAIL; |
| 915 | } |
| 916 | } |