-- Copyright (c) 2024 Huawei Technologies Co., Ltd.
-- openUBMC is licensed under Mulan PSL v2.
-- You can use this software according to the terms and conditions of the Mulan PSL v2.
-- You may obtain a copy of Mulan PSL v2 at:
--         http://license.coscl.org.cn/MulanPSL2
-- THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
-- EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
-- MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
-- See the Mulan PSL v2 for more details.

-- Description: 定义模块需要的通用常量和方法
local defs = {}

defs.RET = {
    OK = 0,
    ERR = (-1),
    OTHERS_UPGRADING = 248
}

defs.CPLD_SUPPLIER_MODE = {
    SINGLE = 1,
    MULTIPLE = 2,
    MIXED = 3 -- 新产品使用，用来标识多厂商模式
}

defs.CPLD_ACTIVE_MODE = {
    NO_IMMED = 0, -- 冷升级标志，先load, 后台等待下电再refresh
    IMMED = 1, -- 热升级标志，load，立即refresh
    ONLY_ACTIVE = 2 -- 额外场景，不load, 仅refresh
}

defs.UPGRADE_CPLD_VALID_FILE_DIR = "/data/opt/bmc/up_cfg"
-- 冷热升级valid文件分开存放
defs.HOT_UPGRADE_CPLD_VALID_FILE_DIR = "/data/opt/bmc/hot_up_cfg"

defs.UPGRADE_FPGA_TMP_PATH = '/data/backup/fpga/tmp/fpga.hpm'
defs.UPGRADE_FPGA_GOLD_PATH = '/data/backup/fpga/gold/fpga.hpm'

defs.UPGRADING_FPGA = 0 -- 0: 无FPGA升级  1: 存在FPGA升级
defs.UPGRADING_CPLD = 0 -- 0: 无CPLD升级  1: 存在CPLD升级
defs.ACTIVING_CPLD = 0 -- 0: 无CPLD生效  1: 存在CPLD生效

defs.SINGEL_SYSTEM_ID = 1
defs.ALL_SYSTEM_ID = 0xff

defs.START_RYTRY_TIME = 10 -- 启动时版本获取重试时长间隔10s
defs.RYTRY_TIME = 1 -- 非启动时版本获取重试时长间隔1s

return defs