⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 download_configure.c

📁 hifn ipsec固件下载工具
💻 C
📖 第 1 页 / 共 5 页
字号:
         Normally after loading the DPU code the time of day is set.         Get the time of day, and set it.      */      status = HFTC_get_time(&timeOfDay, NULL);      if (status != HFTC_STATUS_OK)      {         printf("** ERROR: HFTC_get_time failed; status = %s (%d).\n",                HFTC_Status_t_text(status), status);         break;      }      status = HFTC_SetSystemParameter(unit, cbp, reqid,                                       HFTC_PP_TIME_OF_DAY,                                       &timeOfDay);      RESEND_TIMEOUTS(status, retries);   } while (status == HFTC_RESEND);   if (status != HFTC_STATUS_OK)   {      printf("** ERROR: HFTC_SetSystemParameter set time of day failed, "             "status = %s (%d)\n",             HFTC_Status_t_text(status), status);   }   if (DL_DEBUG)   {      printf("<--%s status = %d\n", __func__, status);   }   return status;} /* end set_tod *//*----------------------------------------------------------------------------* *   register_units *----------------------------------------------------------------------------* * @ingroup CD_API_UTIL * @brief Register passed unit table. * * @param HFTC_Buffer_t *localAddressData *                                     RO: A pointer to a structure defining *                                         the PPCI address and MAC address *                                         of the processor (host or TOE) *                                         making the call. * @param uint32_t       numberOfUnits RO: Specifies the # of entries in *                                         the unit information array pointed *                                         to by unitArray_p. * @param HFTC_Buffer_t *unitArray_p   RO: A pointer to an array of *                                         HFTC_UnitData_t entries. * * @par Externals: *    None. * * @return *    HFTC_STATUS_OK    Unit table and local address data registered. * * @par Errors: *    Errors returned from HFTC_RegisterUnits. * * @par Assumptions: *    None. * *----------------------------------------------------------------------------*/staticHFTC_Status_t register_units(HFTC_UnitData_t *localAddressData_p,                             uint32_t         numberOfUnits,                             HFTC_UnitData_t *unitArray_p){   HFTC_Status_t              status            = HFTC_STATUS_OK;   do   {      /*         Then we do registration for the DPU and eSC.      */      status = HFTC_RegisterUnits(localAddressData_p,                                  numberOfUnits,                                  unitArray_p);      if (status != HFTC_STATUS_OK)      {         printf("** ERROR: HFTC_RegisterUnits failed; status = %s (%d)\n",                 HFTC_Status_t_text(status), status);         break;      }      else if (DL_DEBUG)      {         printf("HFTC_RegisterUnits success.\n");      }   } while (HFTC_FALSE);   return status;} /* register_units *//*----------------------------------------------------------------------------* *   register_units_from_file *----------------------------------------------------------------------------* * @ingroup CD_API_UTIL * @brief Register a unit table. * * If we aren't configuring an esc, we still may need to register a unit * table to do other PPCI operations using a different PPCI address.  Given * a unit table filename, read that file and register the unit table. * * @param param_p       RO: Parameters pointer * * @par Externals: *    None. * * @return *    HFTC_STATUS_OK    Values set * * @par Errors: *    Errors returned from HFTC_ReadUnitFile and register_units. * * @par Assumptions: *    None. * *----------------------------------------------------------------------------*/staticHFTC_Status_t register_units_from_file(download_param_t   *param_p){   HFTC_Status_t              status            = HFTC_STATUS_OK;   uint32_t                   numberOfUnits     = 0;   HFTC_UnitData_t           *unitTable_p       = NULL;   HFTC_UnitData_t           *localData_p       = NULL;   do   {      /*         Read the unit table file if it exists.      */      status = HFTC_ReadUnitFile(param_p->unitTable, &numberOfUnits,                                    &unitTable_p, &localData_p);      if (status != HFTC_STATUS_OK)      {         printf("Problem reading unit file '%s';  status = %s (%d).\n",                param_p->unitTable,                HFTC_Status_t_text(status), status);         break;      }      /*         Then we do registration for the DPU and eSC.      */      status = register_units(localData_p,                              numberOfUnits,                              unitTable_p);   } while (HFTC_FALSE);   return status;} /* register_units_from_file *//*----------------------------------------------------------------------------* *   register_units_from_param *----------------------------------------------------------------------------* * @ingroup CD_API_UTIL * @brief Register a unit table based on the current DPU and eSC PPCI address. * * The download-api uses the passed command line parameters to fill in the * DPU and eSC PPCI addresses directly.  However, the ft-api portion of the * code uses unit numbers that map to PPCI addresses.  This routine builds a * unit table based on the DPU and eSC PPCI addresses and registers it with * ft-api.  Unit 0 will refer to the DPU and unit 1 to the eSC. * * @param param_p       RO: Parameters pointer * * @par Externals: *    UnitTable         File static Unit table information. *    LocalAddressData  File static local address (host) * * @return *    HFTC_STATUS_OK on success, sets the default parameter values *    as appropriate to the device type. * * @par Errors: *    Exits with a non-HFTC_STATUS_OK on problem, values from *    register_units, read_status * * @par Assumptions: *    None. * *----------------------------------------------------------------------------*/HFTC_Status_t register_units_from_param(download_param_t   *param_p){   HFTC_Status_t status;   /*      Copy parameter info into unit tables.   Unit 0 is the DPU, and unit 1      is the eSC   */   UnitTable[0].PPCIaddress = param_p->destPPCIAddrDpu;   (void) memcpy(UnitTable[0].MACaddress,                  param_p->destMACAddr,                  sizeof(param_p->destMACAddr));   UnitTable[1].PPCIaddress = param_p->destPPCIAddrEsc;   (void) memcpy(UnitTable[1].MACaddress,                  param_p->destMACAddr,                  sizeof(param_p->destMACAddr));   LocalAddressData.PPCIaddress = param_p->srcPPCIAddr;   (void) memcpy(LocalAddressData.MACaddress,                  param_p->srcMACAddr,                  sizeof(param_p->srcMACAddr));   /* Register Units - register_units will print any error message. */   status = register_units(&LocalAddressData, NUMUNITS, UnitTable);   return status;} /* End register_units_from_param *//*----------------------------------------------------------------------------* *   set_espudp_ports *----------------------------------------------------------------------------* * @ingroup CD_API_UTIL * @brief Set the ESPUDP port option * * The ESPUDP option is used for inbound packet processing.  It is a 32 bit * value.  The upper 16 bits are the source port, and the lower 16 bits are * the destination port number.  When this value is provided, the "Enable * ESPUDP" processing flag will also be set in the PP options flag word. * * @param unit          RO: Unit number of target being downloaded. * @param param_p       RO: Parameters pointer * * @par Externals: *    None. * * @return *    HFTC_STATUS_OK    Values set * * @par Errors: *    Errors returned from HFTC_SetSystemParameter, HFTC_GetSystemParameter * * @par Assumptions: *    None. * *----------------------------------------------------------------------------*/staticHFTC_Status_t set_espudp_ports(HFTC_Unit_t         unit,                               download_param_t   *param_p){   HFTC_Status_t              status       = HFTC_STATUS_OK;   uint32_t                   options;   HFTC_Reqid_t               reqid        = 0x1234; /* Arbitrary value */   HFTC_Cbp_t                 cbp          = NULL;   uint32_t                   retries      = 0;   if (DL_DEBUG)   {      printf("-->%s\n", __func__);   }   do   {      do      {         status = HFTC_SetSystemParameter(unit, cbp, reqid,                                          HFTC_PP_ESPUDP_PORTS,                                          &param_p->espudpPortValues);         RESEND_TIMEOUTS(status, retries);      } while (status == HFTC_RESEND);      if (status != HFTC_STATUS_OK)      {         printf(" HFTC_SetSystemParameter ESPUDP ports failed; "               "status = %s (%d).\n",               HFTC_Status_t_text(status), status);         break;      }      retries = 0;      do      {         status = HFTC_GetSystemParameter(unit, cbp, reqid,                                          HFTC_PP_FLAG_OPTIONS,                                          &options);         RESEND_TIMEOUTS(status, retries);      } while (status == HFTC_RESEND);      if (status != HFTC_STATUS_OK)      {         printf(" HFTC_GetSystemParameter flag options failed; "                "status = %s (%d).\n",                HFTC_Status_t_text(status), status);         break;      }      /*         Turn on the ESPUDP flag option.  (See "Flag Options Word" in UG-0039         section 8.4.1.1)      */      options |= 0x00010000;      retries = 0;      do      {         status = HFTC_SetSystemParameter(unit, cbp, reqid,                                          HFTC_PP_FLAG_OPTIONS,                                          &options);         RESEND_TIMEOUTS(status, retries);      } while (status == HFTC_RESEND);      if (status != HFTC_STATUS_OK)      {         printf(" HFTC_SetSystemParameter flag options failed; "                "status = %s (%d).\n",                HFTC_Status_t_text(status), status);         break;      }   } while (HFTC_FALSE);   if (DL_DEBUG)   {      printf("<--%s status = %d\n", __func__, status);   }   return status;} /* end set_espudp_ports *//*----------------------------------------------------------------------------* *   check_post_results *----------------------------------------------------------------------------* * @ingroup CD_API_UTIL * @brief Checks post results after downloading DPU or eSC POST * * Checks post results after a download of the DPU firmware or eSC POST * firmware.  This is done by doing a read status and looking at the * results.  The param_p->processorType is used to determine if this is DPU * or eSC POST. * * @param unit          RO: Unit, use 0 for DPU 1 for eSC * @param param_p       RO: Parameters pointer * * @par Externals: *    None. * * @return *    HFTC_STATUS_OK            Post results OK *    HFTC_HARDWARE_ERROR       Problem with POST results * * @par Errors: *    Errors from read status. * * @par Assumptions: *    None. * *----------------------------------------------------------------------------*/HFTC_Status_t check_post_results(HFTC_Unit_t         unit,                                 download_param_t   *param_p){   HFTC_Status_t              status            = HFTC_STATUS_OK;   HFTC_hardware_status_t     hardware_status;   uint32_t                   POSTTestNumber = 0;   uint32_t                   POSTSubTestNumber = 0;   uint32_t                   POSTResult = 0;   uint32_t                   timeoutSeconds = RETRANSMIT_RETRY_SECONDS;   do   {      /*         Do a read status until we get a reply.   This allows the processor         to be ready, and it also allows the sequence numbers to get synced         up when using ft-api.  When the system responds to a read status         command, the post results are available.  We give a bit more time         for checking POST results when running the long sdram test.      */      hardware_status.statusVersion = HFTC_HARDWARE_STATUS_VERSION_2;      if (param_p->longSdramTest == HFTC_TRUE)      {         timeoutSeconds = RETRANSMIT_RETRY_SECONDS_LONG_POST;      }      status = read_status(unit, param_p, timeoutSeconds, &hardware_status);      if (status != HFTC_STATUS_OK)      {         printf("** ERROR: read status after download of %s failed!  "                "status = %s (%d)\n",                 (param_p->processorType == HFTC_DPU) ? "DPU" : "eSC",                 HFTC_Status_t_text(status), status);         break;      }      /*         Figure out expected results.  If we are running POST code, the         first read status gives different results from normal code.         Normally the result should be a

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -