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

📄 load_config_params.c

📁 hifn ipsec固件下载工具
💻 C
📖 第 1 页 / 共 2 页
字号:
      param_p->processorType = HFTC_ESC;      hardware_status.statusVersion = HFTC_HARDWARE_STATUS_VERSION_2;      status = read_status(unit, param_p, RETRANSMIT_RETRY_SECONDS,                           &hardware_status);      if (status == HFTC_STATUS_OK)      {         if (DL_DEBUG)         {            printf("ReadStatus eSC success.\n");         }      }      else      {         printf("ReadStatus eSC failed.\n");         break;      }      param_p->processorType = HFTC_DPU;      hardware_status.statusVersion = HFTC_HARDWARE_STATUS_VERSION_2;      status = read_status(unit, param_p, RETRANSMIT_RETRY_SECONDS,                           &hardware_status);      if (status == HFTC_STATUS_OK)      {         if (DL_DEBUG)         {            printf("ReadStatus DPU success.\n");         }      }      else      {         printf("ReadStatus DPU failed.\n");         break;      }      /* ------------------- Get eSC/DPU Config Data ------------------ */      /*         Read the config file.      */      status = HFTC_ReadConfigFile(param_p->configparams,                                      &escParameters_p);      if (status != HFTC_STATUS_OK)      {         printf("Problem with config file %s - status = %s (%d).\n",                param_p->configparams, HFTC_Status_t_text(status), status);         break;      }      /*         After setting up the PPCI Addresses and doing Unit Table         Registration we need to finish the configuration of the eSC.      */      /* ------------------ Setup eSC Parameters ------------------ */      for (i = 0; i < HFTC_CONFIG_PARAMETER_TABLE_SIZE; i++)      {         /*            Set the parameter if we have a value for it; otherwise,            just leave the value at its default setting.         */         if ((escParameters_p[i].state == SET) ||             (escParameters_p[i].state == UNSET_DEFAULT))         {            retries = 0;            do            {               if (escParameters_p[i].type == PORT_MTU_VALUE)               {                  status = HFTC_WritePortMTU(unit, cbp, reqid,                                             escParameters_p[i].value.number,                                             escParameters_p[i].parameter);                  RESEND_TIMEOUTS(status, retries);                  if (status != HFTC_STATUS_OK && status != HFTC_RESEND)                  {                     printf("** ERROR from HFTC_WritePortMTU: "                            " status = %s (%d).\n",                            HFTC_Status_t_text(status), status);                     /* no need to break since we'll exit loop on                        status != RESEND                      */                  }               }               else               {                  status = HFTC_SetSystemParameter(unit, cbp, reqid,                                                   escParameters_p[i].parameter,                                                   &escParameters_p[i].value);                  RESEND_TIMEOUTS(status, retries);                  if (status != HFTC_STATUS_OK && status != HFTC_RESEND)                  {                     printf("** ERROR from HFTC_SetSystemParameter: "                            " status = %s (%d).\n",                            HFTC_Status_t_text(status), status);                     /* same as above re: break */                  }               }            } while (status == HFTC_RESEND);            if (status != HFTC_STATUS_OK)            {               printf("** Set of parameter '%s' failed.\n",                      escParameters_p[i].keyword);               break;            }            else if (DL_DEBUG)            {               printf("Set of parameter %s success.\n",                      escParameters_p[i].keyword);            }         }      }   } while (HFTC_FALSE);   return(status);}   /* End load_config_params *//*----------------------------------------------------------------------------* *   wait_esc *----------------------------------------------------------------------------* * @ingroup startup * @brief Wait for eSC. * * This function is used to wait for the eSC to be ready. * * @param param_p       RO: Parameters pointer * * @par Externals: *    None. * * @return *    HFTC_STATUS_OK on sucess * * @par Errors: *    None. * * @par Assumptions: *    Unit table is set up properly. * *----------------------------------------------------------------------------*/HFTC_Status_t wait_esc(download_param_t   *param_p){   HFTC_Status_t              status            = HFTC_STATUS_OK;   HFTC_Unit_t                unit            = 0;   int                        escStatus         = -1;   int                        oldStatus         = -1;   HFTC_Boolean_t             poll              = HFTC_TRUE;   HFTC_hardware_status_t     hardware_status;   uint32_t                   readStatusSeconds;   uint32_t                   current_seconds;   uint32_t                   current_milliseconds;   uint32_t                   end_seconds = 0;   uint32_t                   end_milliseconds = 0;   /*      Try reading the hardware status.  Keep going until the eSC is      ready.   */   printf("  ESC status:\n");   /*      Get the current time.  We are only going to retry for a limited      amount of clock time, so we need to know how much time has passed.   */   status = HFTC_get_time(&current_seconds, &current_milliseconds);   if (status != HFTC_STATUS_OK)   {      printf("** Error: HFTC_get_time problem, status = %s (%d)\n",               HFTC_Status_t_text(status), status);      poll = HFTC_FALSE;   }   else   {      end_seconds = current_seconds + WAIT_ESC_SECONDS;      end_milliseconds = current_milliseconds;      poll = HFTC_TRUE;   }   while (poll == HFTC_TRUE)   {      /*         We only need to wait for the minimum of the amount of time left on         our WAIT_EST_SECONDS or RETRANSMIT_RETRY_SECONDS for the read         status response.  This is because we don't need to wait longer than         WAIT_ESC_SECONDS if the eSC is not responding at all.  However, to         keep the logic simpler here, and since the timeout is not critical,         just take the minimum of WAIT_ESC_SECONDS and         RETRANSMIT_RETRY_SECONDS.      */      readStatusSeconds = (WAIT_ESC_SECONDS < RETRANSMIT_RETRY_SECONDS)         ? WAIT_ESC_SECONDS         : RETRANSMIT_RETRY_SECONDS;      hardware_status.statusVersion = HFTC_HARDWARE_STATUS_VERSION_2;      param_p->processorType = HFTC_ESC;      status = read_status(unit, param_p, readStatusSeconds, &hardware_status);      if (status != HFTC_STATUS_OK)      {         printf("Read hardware status failed in waiting for eSC.\n");         escStatus = -1;         poll = HFTC_FALSE;         break;      }      else      {         /*            The sysClock2Status value has the boot status for production            eSC code.         */         escStatus = hardware_status.sysClock2Status;         if (DL_DEBUG)         {            printf("Read Hardware Status read 0x%08x while waiting for esc.\n",                   escStatus);         }         /*            If the status has changed, remember the old status and print            the current status.         */         if (escStatus != oldStatus)         {            printf("    %s\n", HFTC_ESCBootStatus_t_text(escStatus));            oldStatus = escStatus;         }         if (escStatus == HFTC_ESC_BOOT_STATUS_FAILED_DPU_FW)         {            status = HFTC_FAILED_DPU_FW;            poll = HFTC_FALSE;         }         if (escStatus >= HFTC_ESC_BOOT_STATUS_COMPLETE)         {            poll = HFTC_FALSE;         }         else         {            /*               If WAIT_ESC_SECONDS have passed, exit with a timeout.            */            status = HFTC_get_time(&current_seconds, &current_milliseconds);            if (status != HFTC_STATUS_OK)            {               printf("** Error: HFTC_get_time problem, status = %s (%d)\n",                     HFTC_Status_t_text(status), status);               break;            }            if (current_seconds > end_seconds ||                  (current_seconds == end_seconds &&                     current_milliseconds >= end_milliseconds))            {               printf("** Error: More than %d seconds have passed without\n"                     "          getting HFTC_ESC_BOOT_STATUS_COMPLETE.\n"                     "          Check your configuration.\n", WAIT_ESC_SECONDS);               status = HFTC_TIMEOUT;               break;            }            /* Sleep a moment to avoid pounding the system will polls. */            HFTC_sleep(1);         }      }   }   return(status);}   /* End wait_esc *//* End load_config_params.c *//*----------------------------------------------------------------------------*REV #  DATE       BY    REVISION DESCRIPTION-----  --------  -----  ------------------------------------------------------0001   07/06/05   msz   Created.0002   08/03/05   msz   Code review changes.0003   11/28/05   msz   Syncing up boot status table with firmware.0004   11/29/05   dws   Replaced the eSC_bootEnum_t with constants from                        hftc_pub_service.h.                        The status field in eSC_bootStatus_t is now a uint32_t                        instead of eSC_bootEnum_t.0005   01/09/06   akg   HFTC_UnitData_t was extended to include HFTC_UnitType_t.                        Thus, the default unit table needed to be changed.0006  06/05/06    rlh   Changed to use common base porting layer and app_utils                        lib (for reading esc & unit files).0007  08/15/06    msz   Exit with error for status of                        HFTC_ESC_BOOT_STATUS_FAILED_DPU_FW (Bug 1707)0008  08/22/06    msz   Check that the unit table matches the target being                        downloaded.  Print out warning if default unit table                        is being used.0009   08/29/06   msz   Exit with error if unit table was not found instead                        of using default values.0010   09/25/06   rlh   Changed public names to be more general & consistent                        w/ existing naming conventions (HFTC_esc_parameter* ->                        HFTC_ConfigParameter*).0011   09/28/06   dws   Added an entry for HFTC_ESC_BOOT_STATUS_LOG_SERVER_WAIT                        to escStatusTable.0012   09/25/06   rlh   Streamlined startup messages.  Added '** Error: ' to                        error messages.0013   09/29/06   dws   Modified wait_esc to use HFTC_ESCBootStatus_t_text.0014   10/09/06   rlh   * Renamed file from configure_esc.c ->                        load_config_params.c and                        configure_esc -> load_config_params                        * Added DPU port MTU params.  Since the port MTU                        values are a DPU parameter, generalized the                        config file to not just handle ESC parameters.                        * Renamed config/escconfig -> config/configparams                        and changed all related definitions to be                        consistent w/ new naming scheme:                        HFTC_ReadESCConfigFile -> HFTC_ReadConfigFile                        ESC_PARAMETER -> CONFIG_PARAMETER,                        esc_parameters -> config_params, etc.0015   12/01/06   msz   Minor fix, part of bug-2021, exit from                        load_config_params on error, rather than continuing                        in the routine.0016   12/12/06   msz   Fix in wait_esc bug 2091.  Don't let wait_esc wait                        forever for the eSC, some misconfigurations can                        cause the eSC to never send a                        HFTC_ESC_BOOT_STATUS_COMPLETE.0017   02/06/07   msz   Fix compiler warning seen in RH-9 Bug-2248.0018   03/20/07   msz   Added RESEND_TIMEOUTS so we will resend on ft-api                        (ft-min) timeouts.  This should make download over                        the MII more reliable.  (Bug 2307)0019   03/27/07   msz   Variable amount of time on read_status to allow more                        time for POST when running long-sdram-test.  (Bug-2317)*-----------------------------------------------------------------------------*/

⌨️ 快捷键说明

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