📄 download_configure.c
字号:
} helpPrinted = HFTC_TRUE; status = HFTC_NOT_INITIALIZED; break; case 'r': /* For --root we set up our default values. See help routine to see what these are (or look at code below.) The --root value is prepended to the default string. */ if (strlen(optarg) >= (MAXOPTLEN - MAXDEF)) { printf("** ERROR: root directory name (%s) too long.\n", optarg); printf(" Max value is %d chars; arg length is %d chars.\n", MAXOPTLEN - MAXDEF, strlen(optarg)); status = HFTC_INVALID_OPERATION; } else { param_p->rootSpecified = HFTC_TRUE; strcpy(param_p->root, optarg); } break; case 'f': if (strlen(optarg) >= MAXOPTLEN) { printf("** ERROR: dpu file name too long: %s\n", optarg); status = HFTC_INVALID_OPERATION; } else { strncpy(param_p->dfile, optarg, MAXOPTLEN); } break; case 'w': if (strlen(optarg) >= MAXOPTLEN) { printf("** ERROR: eSC sdram workaround file name too long: %s\n", optarg); status = HFTC_INVALID_OPERATION; } else { strncpy(param_p->wfile, optarg, MAXOPTLEN); } break; case 'p': if (strlen(optarg) >= MAXOPTLEN) { printf("** ERROR: eSC post file name too long: %s\n", optarg); status = HFTC_INVALID_OPERATION; } else { strncpy(param_p->pfile, optarg, MAXOPTLEN); } break; case 'e': if (strlen(optarg) >= MAXOPTLEN) { printf("** ERROR: eSC file name too long: %s\n", optarg); status = HFTC_INVALID_OPERATION; } else { strncpy(param_p->efile, optarg, MAXOPTLEN); } break; case 'i': if (strlen(optarg) >= MAXOPTLEN) { printf("** ERROR: interface name too long: %s\n", optarg); status = HFTC_INVALID_OPERATION; } else { strncpy(param_p->interface, optarg, MAXOPTLEN); } break; case 'u': if (strlen(optarg) >= MAXOPTLEN) { printf("** ERROR: unit table file name too long: %s\n", optarg); status = HFTC_INVALID_OPERATION; } else { strncpy(param_p->unitTable, optarg, MAXOPTLEN); } break; case 'c': if (strlen(optarg) >= MAXOPTLEN) { printf("** ERROR: config file name too long: %s\n", optarg); status = HFTC_INVALID_OPERATION; } else { strncpy(param_p->configparams, optarg, MAXOPTLEN); } break; case 'd': ppciAddr = strtoul(optarg, &end_p, 0); if (end_p == optarg) { printf("** ERROR: Invalid DPU PPCI addresses: %s\n", optarg); status = HFTC_INVALID_OPERATION; } else if (ppciAddr > 0x0000FFFF) { printf("** ERROR: PPCI addresses are only 16 bits long: %s\n", optarg); status = HFTC_INVALID_OPERATION; } else { param_p->destPPCIAddrDpu = (HFTC_PPCIAddress_t) ppciAddr; } break; case DEST_PPCI_ESC: ppciAddr = strtoul(optarg, &end_p, 0); if (end_p == optarg) { printf("** ERROR: Invalid eSC PPCI addresses: %s\n", optarg); status = HFTC_INVALID_OPERATION; } else if (ppciAddr > 0x0000FFFF) { printf("** ERROR: PPCI addresses are only 16 bits long: %s\n", optarg); status = HFTC_INVALID_OPERATION; } else { param_p->destPPCIAddrEsc = (HFTC_PPCIAddress_t) ppciAddr; } break; case 's': ppciAddr = strtoul(optarg, &end_p, 0); if (end_p == optarg) { printf("** ERROR: Invalid PPCI addresses: %s\n", optarg); status = HFTC_INVALID_OPERATION; } else if (ppciAddr > 0x0000FFFF) { printf("** ERROR: PPCI addresses are only 16 bits long: %s\n", optarg); status = HFTC_INVALID_OPERATION; } else { param_p->srcPPCIAddr = (HFTC_PPCIAddress_t) ppciAddr; } break; case 'm': status = scanMacAddr(optarg, param_p->destMACAddr); if (status != HFTC_STATUS_OK) { printf("** ERROR: Problem parsing destination mac address: %s\n", optarg); } break; case SOURCE_MAC: status = scanMacAddr(optarg, param_p->srcMACAddr); if (status != HFTC_STATUS_OK) { printf("** ERROR: Problem parsing source mac address: %s\n", optarg); } break; case BUFFER_SIZE: param_p->codeBufferLen = (uint32_t) strtoul(optarg, &end_p, 0); if (end_p == optarg) { printf("** ERROR: Invalid buffer size: %s\n", optarg); status = HFTC_INVALID_OPERATION; } break; case FORCE_RESET: param_p->forceSoftBootReset = HFTC_TRUE; break; case NO_RESET: param_p->noSoftBootReset = HFTC_TRUE; break; case FORCE_DOWNLOAD: param_p->forceDownload = HFTC_TRUE; break; case NO_VERIFY: param_p->noVerify = HFTC_TRUE; break; case NO_SETTOD: param_p->noSetTod = HFTC_TRUE; break; case NO_RUN: param_p->noRun = HFTC_TRUE; break; case NO_CONFIG_PARAMS: param_p->noConfigParams = HFTC_TRUE; break; case NO_GMAC_ENABLE: param_p->noGmacEnable = HFTC_TRUE; break; case MII133: param_p->codeBufferLen = 128; /* Set 128 byte buffer length */ param_p->mii133MHzDownload = HFTC_TRUE; /* fall through -- set mii download as well */ case MII_DOWNLOAD: param_p->miiDownload = HFTC_TRUE; break; case BYPASS_POLICY: param_p->bypassPolicy = HFTC_TRUE; break; case PROMISCUOUS: param_p->promiscuous = HFTC_TRUE; break; case LONG_SDRAM_TEST: param_p->longSdramTest = HFTC_TRUE; break; case POST_MONITOR_MODE: param_p->postMonitorMode = HFTC_TRUE; param_p->noSetTod = HFTC_TRUE; break; case DPU_DDL: if (param_p->numDdlFiles == NUM_DDLS) { printf("** ERROR: No more than %d DDL files may be downloaded.\n", NUM_DDLS); status = HFTC_INVALID_OPERATION; } else if (strlen(optarg) >= MAXOPTLEN) { printf("** ERROR: DPU DDL file name too long: %s\n", optarg); status = HFTC_INVALID_OPERATION; } else { strncpy(param_p->ddlFile[param_p->numDdlFiles], optarg, MAXOPTLEN); param_p->ddlDestination[param_p->numDdlFiles] = HFTC_DPU; ++param_p->numDdlFiles; } break; case ESC_DDL: if (param_p->numDdlFiles == NUM_DDLS) { printf("** ERROR: No more than %d DDL files may be downloaded.\n", NUM_DDLS); status = HFTC_INVALID_OPERATION; } else if (strlen(optarg) >= MAXOPTLEN) { printf("** ERROR: eSC DDL file name too long: %s\n", optarg); status = HFTC_INVALID_OPERATION; } else { strncpy(param_p->ddlFile[param_p->numDdlFiles], optarg, MAXOPTLEN); param_p->ddlDestination[param_p->numDdlFiles] = HFTC_ESC; ++param_p->numDdlFiles; } break; case ESPUDP_PORTS: param_p->espudpPortValues = strtoul(optarg, &end_p, 0); if (end_p == optarg) { printf("** ERROR: Invalid ESPUDP port values: %s\n", optarg); status = HFTC_INVALID_OPERATION; break; } param_p->espudpPortsSet = HFTC_TRUE; break; case '?': default: if (helpPrinted == HFTC_FALSE) { /* printf("** ERROR: Unknown option. Try --help for usage.\n"); */ } status = HFTC_INVALID_OPERATION; break; } /* END switch (c) */ if (status != HFTC_STATUS_OK) { break; } } /* END while (HFTC_TRUE) */ /* At least one option must be present. Argc is 1 if no options are present. Act as if it were a --help. */ if (argc == 1) { printf("** ERROR: No options present. Try --help for usage.\n"); status = HFTC_INVALID_OPERATION; } if (optind < argc) { printf("** ERROR: Unrecognized option argument: '%s'.\n", argv[optind]); printf("Try --help for usage.\n"); status = HFTC_INVALID_OPERATION; } /* Return status */ return status;} /* End parseCommandLineOptions *//*----------------------------------------------------------------------------* * Read Status *----------------------------------------------------------------------------* * @ingroup CD_API_UTIL * @brief Read Status from a processor. * * This uses the Utility API to read the status of a processor. * * @param unit RO: Unit number of target being queried. * @param param_p RO: Parameters pointer * @param timeoutSeconds RO: Seconds to retry before timing out * @param hardware_status WO: returned status from read status. * * @par Externals: * None. * * @return * HFTC_STATUS_OK Status Read * * @par Errors: * None. * * @par Assumptions: * This call assumes the driver (in our case the PPCI Driver) has been * properly initialized. * *----------------------------------------------------------------------------*/HFTC_Status_t read_status(HFTC_Unit_t unit, download_param_t *param_p, uint32_t timeoutSeconds, HFTC_hardware_status_t *hardware_status_p ){ HFTC_Status_t status = HFTC_STATUS_OK; HFTC_Status_t tstatus = HFTC_STATUS_OK; uint32_t numRetransmits = 0; HFTC_Parameter_t parameter; HFTC_Reqid_t reqid = 0x1234; /* Arbitrary value */ HFTC_Cbp_t cbp = NULL; uint32_t current_seconds; uint32_t current_milliseconds; uint32_t end_seconds; uint32_t end_milliseconds; if (DL_DEBUG) { printf("-->%s unit=%d, processor=%d\n", __func__, unit, param_p->processorType); } do { /* Find out if this is going to the PP or AP. We have used the processorType here to make that determination. Set the unit value as appropriate, unit 0 refers to the DPU, unit 1 to the eSC. */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -