Compare commits
2 Commits
c5e1b16cfc
...
8d2f8a06e2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8d2f8a06e2 | ||
|
|
d651c1459e |
@ -73,7 +73,7 @@ res_tmp468=""
|
|||||||
file.write(header_content)
|
file.write(header_content)
|
||||||
file.write(param_context)
|
file.write(param_context)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"写入文件时出现错误: {e}")
|
dbg_print("Error", f"写入文件时出现错误: {e}")
|
||||||
|
|
||||||
def process_hw_topo():
|
def process_hw_topo():
|
||||||
dbg_print("info", "====== Process Server Hw Topo ======")
|
dbg_print("info", "====== Process Server Hw Topo ======")
|
||||||
@ -92,9 +92,18 @@ def process_hw_topo():
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
dbg_print("Error", f"发生未知错误:{e}")
|
dbg_print("Error", f"发生未知错误:{e}")
|
||||||
|
|
||||||
|
set_configuration_content = """
|
||||||
|
set_configuration_oem(){
|
||||||
|
"""
|
||||||
|
|
||||||
maxPcieSlotNum = hw_topo_data['maxPcieSlotNum']
|
maxPcieSlotNum = hw_topo_data['maxPcieSlotNum']
|
||||||
dbg_print("info", f"maxPcieSlotNum={maxPcieSlotNum}")
|
dbg_print("info", f"maxPcieSlotNum={maxPcieSlotNum}")
|
||||||
|
|
||||||
|
if maxPcieSlotNum > 0 :
|
||||||
|
set_configuration_content += """
|
||||||
|
if [ $nic_type == "pcie" ];then
|
||||||
|
"""
|
||||||
|
|
||||||
PcieSlotProperties = hw_topo_data['PcieSlotProperties']
|
PcieSlotProperties = hw_topo_data['PcieSlotProperties']
|
||||||
# dbg_print("info", f"PcieSlotProperties={PcieSlotProperties}")
|
# dbg_print("info", f"PcieSlotProperties={PcieSlotProperties}")
|
||||||
|
|
||||||
@ -114,11 +123,14 @@ def process_hw_topo():
|
|||||||
is_have_pca9641 = i2c_cs['is_have_pca9641']
|
is_have_pca9641 = i2c_cs['is_have_pca9641']
|
||||||
|
|
||||||
if is_have_pca9641 == "enable":
|
if is_have_pca9641 == "enable":
|
||||||
|
pca9641_flag = 1
|
||||||
pca9641_slave = i2c_cs['pca9641_slave']
|
pca9641_slave = i2c_cs['pca9641_slave']
|
||||||
dbg_print("info", f">>> there has pca9641 !!!")
|
dbg_print("info", f">>> there has pca9641 !!!")
|
||||||
dbg_print("info", f">>> pca9641_slave={pca9641_slave}")
|
dbg_print("info", f">>> pca9641_slave={pca9641_slave}")
|
||||||
else:
|
else:
|
||||||
dbg_print("info", f">>> there has no pca9641 !!!")
|
dbg_print("info", f">>> there has no pca9641 !!!")
|
||||||
|
pca9641_flag = 0
|
||||||
|
pca9641_slave = "0xff"
|
||||||
|
|
||||||
pca9548num = i2c_cs['pca9548num']
|
pca9548num = i2c_cs['pca9548num']
|
||||||
dbg_print("info", f">>> pca9548num={pca9548num}")
|
dbg_print("info", f">>> pca9548num={pca9548num}")
|
||||||
@ -135,11 +147,39 @@ def process_hw_topo():
|
|||||||
for i in range(8):
|
for i in range(8):
|
||||||
channel = f"channel{i}"
|
channel = f"channel{i}"
|
||||||
pca9548_channel = pca9548_cs[channel]
|
pca9548_channel = pca9548_cs[channel]
|
||||||
|
pca9548_i2c_offset = 0x01 << i
|
||||||
|
|
||||||
if pca9548_channel != None :
|
if pca9548_channel != None :
|
||||||
dbg_print("info", f"{channel}={pca9548_channel}")
|
dbg_print("info", f"{channel}={pca9548_channel}")
|
||||||
|
set_configuration_content += f"""
|
||||||
|
if [ $slot_name == "{pca9548_channel}" ];
|
||||||
|
i2c_bus = "{i2c_bus}"
|
||||||
|
is_have_pca9641 = "{pca9641_flag}"
|
||||||
|
pca9641_slave = "{pca9641_slave}"
|
||||||
|
pca9548_slave = "{pca9548_slave}"
|
||||||
|
pca9548_channel = "0x{pca9548_i2c_offset:02x}"
|
||||||
|
fi
|
||||||
|
"""
|
||||||
else:
|
else:
|
||||||
dbg_print("info", f"{channel} is null")
|
dbg_print("info", f"{channel} is null")
|
||||||
|
|
||||||
|
# PCIe 类型添加 fi
|
||||||
|
set_configuration_content += """
|
||||||
|
fi
|
||||||
|
"""
|
||||||
|
|
||||||
|
# 添加 }
|
||||||
|
set_configuration_content += """}
|
||||||
|
"""
|
||||||
|
|
||||||
|
# 写入 script
|
||||||
|
try:
|
||||||
|
with open (output_path, 'a+', encoding='utf-8') as file:
|
||||||
|
file.write(set_configuration_content)
|
||||||
|
dbg_print("info", "Success to load hw topo!")
|
||||||
|
except Exception as e:
|
||||||
|
dbg_print("Error", f"An error ouccuer when load hw topo")
|
||||||
|
|
||||||
|
|
||||||
def load_adc128_feature(data):
|
def load_adc128_feature(data):
|
||||||
dbg_print("info", ">>> Start load adc128 feature ...")
|
dbg_print("info", ">>> Start load adc128 feature ...")
|
||||||
@ -256,9 +296,66 @@ INA3221_POWER=2
|
|||||||
|
|
||||||
def load_emc1413_feature(data):
|
def load_emc1413_feature(data):
|
||||||
dbg_print("info", ">>> Start load emc1413 feature ...")
|
dbg_print("info", ">>> Start load emc1413 feature ...")
|
||||||
|
ch0_name = data['ch0_name']
|
||||||
|
ch1_name = data['ch0_name']
|
||||||
|
ch2_name = data['ch0_name']
|
||||||
|
|
||||||
|
emc1413_channel_name_context = f"""
|
||||||
|
EMC1413_Channel0_name="{ch0_name}"
|
||||||
|
EMC1413_Channel1_name="{ch1_name}"
|
||||||
|
EMC1413_Channel2_name="{ch2_name}"
|
||||||
|
"""
|
||||||
|
|
||||||
|
emc1413_REG_info_context = """
|
||||||
|
REG_emc1413_TD1_H="0x00"
|
||||||
|
REG_emc1413_TD1_L="0x29"
|
||||||
|
REG_emc1413_TD2_H="0x01"
|
||||||
|
REG_emc1413_TD2_L="0x10"
|
||||||
|
REG_emc1413_TD3_H="0x23"
|
||||||
|
REG_emc1413_TD3_L="0x24"
|
||||||
|
"""
|
||||||
|
|
||||||
|
try:
|
||||||
|
with open (output_path, 'a+', encoding='utf-8') as file:
|
||||||
|
file.write(emc1413_channel_name_context)
|
||||||
|
file.write(emc1413_REG_info_context)
|
||||||
|
dbg_print("info", "Success to load emc1413 feature!")
|
||||||
|
except Exception as e:
|
||||||
|
dbg_print("Error", f"An error ouccuer when load emc1413 feature")
|
||||||
|
|
||||||
def load_tmp468_feature(data):
|
def load_tmp468_feature(data):
|
||||||
dbg_print("info", ">>> Start load tmp468 feature ...")
|
dbg_print("info", ">>> Start load tmp468 feature ...")
|
||||||
|
remote_name = data['remote_name']
|
||||||
|
ch0_name = data['ch0_name']
|
||||||
|
ch1_name = data['ch1_name']
|
||||||
|
ch2_name = data['ch2_name']
|
||||||
|
ch3_name = data['ch3_name']
|
||||||
|
ch4_name = data['ch4_name']
|
||||||
|
ch5_name = data['ch5_name']
|
||||||
|
ch6_name = data['ch6_name']
|
||||||
|
ch7_name = data['ch7_name']
|
||||||
|
|
||||||
|
tmp468_channel_name_context = f"""
|
||||||
|
TMP468_Channel0_name="{remote_name}"
|
||||||
|
TMP468_Channel1_name="{ch0_name}"
|
||||||
|
TMP468_Channel2_name="{ch1_name}"
|
||||||
|
TMP468_Channel3_name="{ch2_name}"
|
||||||
|
TMP468_Channel4_name="{ch3_name}"
|
||||||
|
TMP468_Channel5_name="{ch4_name}"
|
||||||
|
TMP468_Channel6_name="{ch5_name}"
|
||||||
|
TMP468_Channel7_name="{ch6_name}"
|
||||||
|
TMP468_Channel8_name="{ch7_name}"
|
||||||
|
"""
|
||||||
|
tmp468_REG_info_context = """
|
||||||
|
REG_tmp468="0x80"
|
||||||
|
"""
|
||||||
|
try:
|
||||||
|
with open (output_path, 'a+', encoding='utf-8') as file:
|
||||||
|
file.write(tmp468_channel_name_context)
|
||||||
|
file.write(tmp468_REG_info_context)
|
||||||
|
dbg_print("info", "Success to load tmp468 feature!")
|
||||||
|
except Exception as e:
|
||||||
|
dbg_print("Error", f"An error ouccuer when load tmp468 feature")
|
||||||
|
|
||||||
def load_tmp112_feature(data):
|
def load_tmp112_feature(data):
|
||||||
dbg_print("info", ">>> Start load tmp112 feature ...")
|
dbg_print("info", ">>> Start load tmp112 feature ...")
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user