Compare commits
30 Commits
nicsensor-
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
250637a96c | ||
|
|
9b5d4a77d9 | ||
|
|
023aa38673 | ||
|
|
da64a8296a | ||
|
|
455b1509e5 | ||
|
|
daa30910c5 | ||
|
|
78a17a2843 | ||
| 8ec46fc9eb | |||
|
|
75658f06e8 | ||
|
|
3ca7de0ecf | ||
|
|
6458d5daa4 | ||
|
|
ef2c4495b0 | ||
| 27a77f05bd | |||
|
|
5510b0d96e | ||
|
|
5ad98b9226 | ||
|
|
7e3a6a1c38 | ||
|
|
43c1c4b210 | ||
|
|
0c56a7d01d | ||
|
|
b4169ce1f5 | ||
|
|
fcaa50bd0b | ||
| a3b2c16198 | |||
| 9eb8564b6c | |||
| 87e0d2b00a | |||
| 89aae7feb0 | |||
|
|
c58f8fc96f | ||
|
|
fba2e6f2f5 | ||
|
|
6c98851598 | ||
|
|
0836f65cc5 | ||
|
|
1470a86c3d | ||
|
|
034c3d7164 |
@ -1,9 +1,15 @@
|
|||||||
# Script Version 1.2
|
# Script Version 1.3 20241229
|
||||||
|
Release Note
|
||||||
|
1.[新增功能]支持5280m7的OCP卡的使用
|
||||||
|
2.[新增功能]支持传感器tmp468和tmp112
|
||||||
|
|
||||||
|
# Script Version 1.2 20241102
|
||||||
Release Note:
|
Release Note:
|
||||||
1.[新增功能]支持写入板卡FRU
|
1.[新增功能]支持写入板卡FRU
|
||||||
2.[新增功能]添加适配服务器 donghu yichun
|
2.[新增功能]添加适配服务器 donghu yichun qiandaohu
|
||||||
3.[功能优化]修复一些交互类bug,增强脚本健壮性
|
3.[功能优化]修复一些交互类bug,增强脚本健壮性
|
||||||
4.[功能优化]更便捷的支持脚本传感器名称本地化
|
4.[功能优化]更便捷的支持脚本传感器名称本地化
|
||||||
|
5.[功能优化]debug模式下执行i2c detect时可自定义执行detect内容
|
||||||
|
|
||||||
# Script Version 1.1 20240912
|
# Script Version 1.1 20240912
|
||||||
Release Note:
|
Release Note:
|
||||||
|
|||||||
10
02.nicsensor/code_structure.txt
Normal file
10
02.nicsensor/code_structure.txt
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
On Version V1.2
|
||||||
|
start_get_sensor //启动读取Sensor的流程
|
||||||
|
|--->set_configuration
|
||||||
|
| |--->set_configuration_5280m7/5468m7/donghu/yichun //根据服务器类型设置具体I2C相关参数
|
||||||
|
|--->get_pca9641_controll //如果服务器上有PCA9641,选通它
|
||||||
|
|--->switch_pca9548_channel //切换9548/9546到对应的槽位上
|
||||||
|
|--->process_sensor
|
||||||
|
|--->sensor_init //传感器可能需要初始化
|
||||||
|
|--->read_sensor_value //读取传感器的数值
|
||||||
|
|--->convert_sensor_value //处理传感器的读值并做可视化处理
|
||||||
File diff suppressed because it is too large
Load Diff
4
02.nicsensor/readme.md
Normal file
4
02.nicsensor/readme.md
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
# 文件更新
|
||||||
|
|
||||||
|
当前不在继续维护
|
||||||
|
继续更新详见 [nicsensor](http://121.36.59.21:3000/Marcin/nicsensor)
|
||||||
@ -1,138 +0,0 @@
|
|||||||
### 重要说明 : 脚本仅用于M7服务器,带有i2c standard tool工具的BMC使用
|
|
||||||
### 仅限用于实验室调试使用
|
|
||||||
|
|
||||||
### 大纲
|
|
||||||
一、脚本使用方法
|
|
||||||
1.1 修改项目专属配置(必做)
|
|
||||||
1.2 增加脚本可执行权限
|
|
||||||
1.3 脚本命令格式
|
|
||||||
1.4 特殊命令
|
|
||||||
1.4.1 Detect命令
|
|
||||||
1.4.2 fru命令
|
|
||||||
1.4.3 读取芯片寄存器
|
|
||||||
1.5 debug模式
|
|
||||||
二、服务器PCIE槽位和PCA9548的channel关系
|
|
||||||
三、M7 sysadmin用户 SSH打开方法
|
|
||||||
四、常见问题
|
|
||||||
|
|
||||||
### 正文
|
|
||||||
|
|
||||||
一、脚本使用方法 Version1.2
|
|
||||||
|
|
||||||
1.1、修改项目专属配置
|
|
||||||
针对不同项目,请先修改脚本中的部分变量(ADC128电压传感器的分压系数,INA3221的分流精密电阻阻值)
|
|
||||||
针对不同服务器产品,请对应修改server_type变量, 当前支持设置的服务器型号:
|
|
||||||
5280m7
|
|
||||||
5468m7
|
|
||||||
donghu
|
|
||||||
|
|
||||||
1.2、增加脚本可执行权限
|
|
||||||
|
|
||||||
在脚本目录下执行命令: chmod +x ./nicsensor.sh
|
|
||||||
|
|
||||||
1.3、脚本命令格式
|
|
||||||
|
|
||||||
./nicsensor.sh <pcie_slot> <chip_type> <chip_slave>
|
|
||||||
|
|
||||||
参数说明:
|
|
||||||
pcie_slot : 网卡所在的PCIE槽位, 填数字0,1,2,3,4,5
|
|
||||||
chip_type : 传感器芯片的类型, emc1413,adc128,ina3221
|
|
||||||
chip_slave: 传感器芯片的I2C地址(7bit)
|
|
||||||
|
|
||||||
举例说明:读取PCIE 1 上网卡的adc128芯片, 芯片slave地址为0x1f
|
|
||||||
./nicsensor.sh 1 adc128 0x1f
|
|
||||||
|
|
||||||
1.4、特殊命令
|
|
||||||
|
|
||||||
1.4.1 Detect命令
|
|
||||||
|
|
||||||
扫描服务器的PCIE slot 0 - 5上所有的I2C设备
|
|
||||||
|
|
||||||
命令: ./nicsensor.sh detect
|
|
||||||
|
|
||||||
1.4.2 fru命令
|
|
||||||
|
|
||||||
命令: ./nicsensor.sh <pcie_slot> fru <chip_slave> read
|
|
||||||
举例说明:读取Ravel板卡的EEPROM中的FRU(0x57)
|
|
||||||
- ./nicsensor.sh 5 fru 0x57 read
|
|
||||||
|
|
||||||
1.4.3 读取芯片寄存器
|
|
||||||
|
|
||||||
命令: ./nicsensor.sh <pcie_slot> chip <chip_slave> <i2c_cmd>
|
|
||||||
举例说明: 读取cpld的寄存器 0x00 ,读2个byte
|
|
||||||
- ./nicsensor.sh 5 chip 0x10 "i2ctransfer -y 13 w1@0x10 0x00 r2"
|
|
||||||
|
|
||||||
1.5、DEBUG模式
|
|
||||||
|
|
||||||
可通过配置脚本中的 DEBUG_MODE 变量(In Srcipt Line:112)来使用debug模式,在debug模式下,不会执行选通
|
|
||||||
9641,9548的操作,仅执行读取传感器的操作,因此启用debug模式后需要手动配置的变量有:
|
|
||||||
i2c_bus
|
|
||||||
|
|
||||||
|
|
||||||
二、服务器PCIE槽位和PCA9548的channel关系
|
|
||||||
|
|
||||||
5280M7的PCIE槽位和PCA9548/9546没有确定的对应关系,取决于使用的riser卡.根据一般情况选择的Riser卡, 对应
|
|
||||||
情况如下:
|
|
||||||
|
|
||||||
PCIE 0 = i2c bus 12 , 9548channel1(0x02)
|
|
||||||
PCIE 1 = i2c bus 12 , 9548channel2(0x04)
|
|
||||||
PCIE 2 = i2c bus 12 , 9548channel3(0x08)
|
|
||||||
PCIE 3 = i2c bus 13 , 9548channel1(0x02)
|
|
||||||
PCIE 4 = i2c bus 13 , 9548channel2(0x04)
|
|
||||||
PCIE 5 = i2c bus 13 , 9548channel3(0x08)
|
|
||||||
|
|
||||||
5468M7的PCIE槽位和PCA9548/9546的对应关系:
|
|
||||||
|
|
||||||
PCIE 0 = i2c bus 13 , 9548channel0(0x01)
|
|
||||||
PCIE 1 = i2c bus 13 , 9548channel1(0x02)
|
|
||||||
PCIE 2 = i2c bus 13 , 9548channel2(0x04)
|
|
||||||
PCIE 3 = i2c bus 13 , 9548channel3(0x08)
|
|
||||||
PCIE 4 = i2c bus 13 , 9548channel4(0x10)
|
|
||||||
PCIE 5 = i2c bus 14 , 9548channel0(0x01)
|
|
||||||
PCIE 6 = i2c bus 14 , 9548channel1(0x02)
|
|
||||||
PCIE 7 = i2c bus 14 , 9548channel2(0x04)
|
|
||||||
PCIE 8 = i2c bus 14 , 9548channel3(0x08)
|
|
||||||
PCIE 9 = i2c bus 14 , 9548channel4(0x10)
|
|
||||||
PCIE 10 = i2c bus 14 , 9548channel5(0x20)
|
|
||||||
|
|
||||||
针对不同服务器产品,请对应修改server_type变量,当前支持的服务器类型:
|
|
||||||
5280m7
|
|
||||||
5468m7
|
|
||||||
|
|
||||||
三、M7 sysadmin用户 SSH打开方法
|
|
||||||
|
|
||||||
5280M7服务器默认不开启SSH, 且串口通常有较多干扰打印, 因此推荐使用SSH来执行脚本, 刷新BMC镜像后需要重新配置
|
|
||||||
|
|
||||||
1、打开M7 BMC的串口, 可通过串口线或者IPMI SOL带外登入
|
|
||||||
|
|
||||||
使用IPMI SOL的前提环境: 可与BMC网络连接, 且电脑上有ipmitool工具
|
|
||||||
SOL登陆方法:
|
|
||||||
(1) 将SOL串口源切换到BMC:
|
|
||||||
ipmitool -I lanplus -H <bmcip> -U admin -P admin raw 0x3c 0x2c 0x02 0x01
|
|
||||||
(2) 打开SOL:
|
|
||||||
ipmitool -I lanplus -H <bmcip> -U admin -P admin sol activate
|
|
||||||
备注: <bmcip> 为目标BMC的ip地址, 请自行更改为对应的ip地址
|
|
||||||
|
|
||||||
2、登录进入bmc的linux系统
|
|
||||||
|
|
||||||
bmc linux系统的默认用户名/密码 : sysadmin/superuser
|
|
||||||
|
|
||||||
3、在BMC的linux系统下执行命令
|
|
||||||
|
|
||||||
(1) cp /etc/defconfig/ssh_server_config_with_sysadmin /etc/ssh/sshd_config
|
|
||||||
|
|
||||||
(2) /etc/init.d/ssh restart
|
|
||||||
|
|
||||||
执行完毕后,就可以使用ssh登录BMC了
|
|
||||||
|
|
||||||
四、常见问题
|
|
||||||
|
|
||||||
1、脚本执行时出现大量的 Error
|
|
||||||
|
|
||||||
由于M7服务器的I2C设计有PCA9641作为I2C仲裁器, 脚本执行过程中可能会被9641强行断开I2C连接, 造成大量的
|
|
||||||
脚本Error, 这种情况在实际运行中是不可避免的, 直接重新执行脚本即可
|
|
||||||
|
|
||||||
2、不建议使用该脚本进行压力测试
|
|
||||||
|
|
||||||
由于BMC shell的版本非常原始, 没有集成高级的命令行工具, 因此处理数值时采用了复杂的脚本逻辑进行执行, 处
|
|
||||||
理效率较低。另外由于9641芯片的存在, 不能保证压力测试的正常执行。
|
|
||||||
9
05.auto_work/obsidian_pull.bat
Normal file
9
05.auto_work/obsidian_pull.bat
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
@echo off
|
||||||
|
::配置Obsidian workspace地址
|
||||||
|
set obsidian_path="D:\Files\3.SelfLerning\Marcin's_Repo"
|
||||||
|
::切换目录到 Obsidian workspace下
|
||||||
|
D:
|
||||||
|
cd %obsidian_path%
|
||||||
|
|
||||||
|
::先拉取远端更新
|
||||||
|
git pull
|
||||||
20
05.auto_work/obsidian_push.bat
Normal file
20
05.auto_work/obsidian_push.bat
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
@echo off
|
||||||
|
::配置Obsidian workspace地址
|
||||||
|
set obsidian_path="D:\Files\3.SelfLerning\Marcin's_Repo"
|
||||||
|
::切换目录到 Obsidian workspace下
|
||||||
|
D:
|
||||||
|
cd %obsidian_path%
|
||||||
|
|
||||||
|
::判断是否有更新并将更新同步到远端仓库
|
||||||
|
for /f "delims=" %%a in ('git status --porcelain') do (
|
||||||
|
set HAS_CHANGES=1
|
||||||
|
goto end_loop
|
||||||
|
)
|
||||||
|
:end_loop
|
||||||
|
if defined HAS_CHANGES (
|
||||||
|
git add -A
|
||||||
|
git commit -m "Daily Sync from workbook"
|
||||||
|
git push origin main
|
||||||
|
) else (
|
||||||
|
echo Git has no changes.
|
||||||
|
)
|
||||||
38
07.bmc_tool_script/Linux_CollectOnekeylog.sh
Normal file
38
07.bmc_tool_script/Linux_CollectOnekeylog.sh
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
BMC_IP=$1
|
||||||
|
BMC_USER=$2
|
||||||
|
BMC_PW=$3
|
||||||
|
BMC_INFO="${BMC_USER}:${BMC_PW}"
|
||||||
|
|
||||||
|
if [ $# -lt 3 ];then
|
||||||
|
echo "Script Usage:"
|
||||||
|
echo " ./Outband_Collect_OneKeyLog.sh <BMC_IP> <BMC_USERNAME> <BMC_PASSWORD>"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Get BoardSN
|
||||||
|
BoardSN=`ipmitool -H ${BMC_IP} -I lanplus -U ${BMC_USER} -P ${BMC_PW} fru print | grep "Board Serial" | awk '{print $4}'`
|
||||||
|
|
||||||
|
if [ "${BoardSN}" = "" ];then
|
||||||
|
echo "Error: Can't Get BoardSN, please check network connection or user&password !"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
time=`date "+%Y-%m-%dT%H:%M:%S"`
|
||||||
|
LOG_FILENAME="Product_${BoardSN}_${time}.tar.gz"
|
||||||
|
|
||||||
|
# Post message to BMC to collect all log
|
||||||
|
echo -e "\n Step 1. Post Collect all log to BMC"
|
||||||
|
curl -k -u $BMC_INFO -X POST -H "Content-Length: 0" https://${BMC_IP}/redfish/v1/Managers/1/LogServices/Actions/public/CollectAllLog
|
||||||
|
|
||||||
|
# Wait 60 seconds to Complete
|
||||||
|
echo -e "\n Waiting 150 seconds for collect all log ..."
|
||||||
|
sleep 150
|
||||||
|
|
||||||
|
# Download Onekeylog
|
||||||
|
echo -e "\n Step 2. Download Onekeylog"
|
||||||
|
curl -k -u $BMC_INFO -X POST -H "Content-Length: 0" https://${BMC_IP}/redfish/v1/Managers/1/LogServices/Actions/public/DownloadAllLog --output $LOG_FILENAME
|
||||||
|
|
||||||
|
# Complete
|
||||||
|
echo -e "\n Complete Download Onekeylog"
|
||||||
86
07.bmc_tool_script/Windows_CollectOnekeylog.bat
Normal file
86
07.bmc_tool_script/Windows_CollectOnekeylog.bat
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
@echo off
|
||||||
|
setlocal
|
||||||
|
|
||||||
|
:: Param Check
|
||||||
|
if "%1"=="" goto :USAGE
|
||||||
|
if "%2"=="" goto :USAGE
|
||||||
|
if "%3"=="" goto :USAGE
|
||||||
|
|
||||||
|
:: ==== Script will start here
|
||||||
|
::echo Command Infomation
|
||||||
|
::echo BMC_IP: %1
|
||||||
|
::echo USER: %2
|
||||||
|
::echo PASSWORD: %3
|
||||||
|
|
||||||
|
set "BMC_IP=%1"
|
||||||
|
set "USER=%2"
|
||||||
|
set "PASSWORD=%3"
|
||||||
|
|
||||||
|
set "BMC_INFO=%USER%:%PASSWORD%"
|
||||||
|
set "redfish_fru_result=%CD%\fru_info.json"
|
||||||
|
|
||||||
|
:: Step0. Get BMC SN
|
||||||
|
echo __________
|
||||||
|
echo Opertion 1 : Check Network Connection with BMC...
|
||||||
|
curl -k -u %BMC_INFO% -X GET "https://%BMC_IP%/redfish/v1/Systems/1/public/FRU" > %redfish_fru_result%
|
||||||
|
if %ERRORLEVEL% neq 0 (
|
||||||
|
echo Connect to BMC Failed
|
||||||
|
exit /b 1
|
||||||
|
)
|
||||||
|
|
||||||
|
for /f "delims=" %%a in ('
|
||||||
|
powershell -command "$json = Get-Content -Path '%redfish_fru_result%' -Raw | ConvertFrom-Json; $json.'board'.'Board Serial'"
|
||||||
|
') do set "value=%%a"
|
||||||
|
set "BoardSN=%value%"
|
||||||
|
|
||||||
|
:: Setp1. Get local time stamp
|
||||||
|
set "dt=%DATE% %TIME%"
|
||||||
|
for /f "tokens=2 delims==" %%a in ('wmic OS get LocalDateTime /value') do set "dt=%%a"
|
||||||
|
set "year=%dt:~0,4%"
|
||||||
|
set "month=%dt:~4,2%"
|
||||||
|
set "day=%dt:~6,2%"
|
||||||
|
set "hour=%dt:~8,2%"
|
||||||
|
set "minute=%dt:~10,2%"
|
||||||
|
set "second=%dt:~12,2%"
|
||||||
|
|
||||||
|
set "timestamp=%year%%month%%day%T%hour%%minute%%second%"
|
||||||
|
::echo TimeStamp: %timestamp%
|
||||||
|
set "LogFile=%CD%\Product_%BoardSN%_%timestamp%.tar.gz"
|
||||||
|
|
||||||
|
:: Step2. Post Collect Onekeylog Request to BMC by redfish
|
||||||
|
echo __________
|
||||||
|
echo Opertion 2 : Post Request to BMC...
|
||||||
|
curl -k -u %BMC_INFO% -X POST -H "Content-Length: 0" "https://%BMC_IP%/redfish/v1/Managers/1/LogServices/Actions/public/CollectAllLog"
|
||||||
|
|
||||||
|
if %ERRORLEVEL% neq 0 (
|
||||||
|
echo Post Request Error
|
||||||
|
exit /b 1
|
||||||
|
)
|
||||||
|
|
||||||
|
:: Step3. Wait 150s to Complete Collect
|
||||||
|
echo __________
|
||||||
|
echo Opertion 3 : Wait 150s for bmc to collect onekeylog...
|
||||||
|
timeout /t 150 /nobreak
|
||||||
|
|
||||||
|
:: Step4. Download Onekeylog
|
||||||
|
echo __________
|
||||||
|
echo Opertion 4 : Download onekeylog now ...
|
||||||
|
curl -k -u %BMC_INFO% -X POST -H "Content-Length: 0" "https://%BMC_IP%/redfish/v1/Managers/1/LogServices/Actions/public/DownloadAllLog" --output %LogFile%
|
||||||
|
|
||||||
|
if %ERRORLEVEL% neq 0 (
|
||||||
|
echo Download Onekeylog Error
|
||||||
|
exit /b 1
|
||||||
|
)
|
||||||
|
|
||||||
|
:: === Complete
|
||||||
|
echo __________
|
||||||
|
echo Opertion 5 : Success Download Onekeylog
|
||||||
|
echo Onekeylog Path: %LogFile%
|
||||||
|
goto :END
|
||||||
|
|
||||||
|
:USAGE
|
||||||
|
echo Invalid command format
|
||||||
|
echo Script Format : CollectOnekeylog.bat [bmc ip] [username] [password]
|
||||||
|
|
||||||
|
:END
|
||||||
|
endlocal
|
||||||
5
07.bmc_tool_script/manual_crashdump.sh
Normal file
5
07.bmc_tool_script/manual_crashdump.sh
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
pid=`ps aux | grep Crashdump | awk 'NR==1{print $2}'`
|
||||||
|
kill $pid
|
||||||
|
Crashdump --dump-now
|
||||||
114
07.bmc_tool_script/read_adc_reg.sh
Normal file
114
07.bmc_tool_script/read_adc_reg.sh
Normal file
@ -0,0 +1,114 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# ADC Base Address 0x1e6e 9000
|
||||||
|
# Channel0 & Channel 1 0x10
|
||||||
|
# Channel2 & Channel 3 0x14
|
||||||
|
# Channel4 & Channel 5 0x18
|
||||||
|
# Channel6 & Channel 7 0x1c
|
||||||
|
# Channel8 & Channel 9 0x20
|
||||||
|
# Channel10 & Channel 11 0x24
|
||||||
|
# Channel12 & Channel 13 0x28
|
||||||
|
# Channel14 & Channel 15 0x2c
|
||||||
|
|
||||||
|
# volt = ((data+1.0) /1024) *1.8; //ADC calculation formular
|
||||||
|
# volt *= resist; /* based on the hardware resistance added*/
|
||||||
|
|
||||||
|
|
||||||
|
Board_Desc="Common_Board"
|
||||||
|
Low_Position=0
|
||||||
|
High_Position=1
|
||||||
|
# ---------------------------------------------------------------
|
||||||
|
# Resist List
|
||||||
|
# ---------------------------------------------------------------
|
||||||
|
Channel00_resist=1
|
||||||
|
Channel01_resist=1
|
||||||
|
Channel02_resist=1
|
||||||
|
Channel03_resist=1
|
||||||
|
Channel04_resist=1
|
||||||
|
Channel05_resist=1
|
||||||
|
Channel06_resist=1
|
||||||
|
Channel07_resist=1
|
||||||
|
Channel08_resist=1
|
||||||
|
Channel09_resist=1
|
||||||
|
Channel10_resist=1
|
||||||
|
Channel11_resist=1
|
||||||
|
Channel12_resist=1
|
||||||
|
Channel13_resist=1
|
||||||
|
Channel14_resist=1
|
||||||
|
Channel15_resist=1
|
||||||
|
|
||||||
|
# ---------------------------------------------------------------
|
||||||
|
# Channel Name
|
||||||
|
# ---------------------------------------------------------------
|
||||||
|
Channel00_name="Channel00_Volt"
|
||||||
|
Channel01_name="Channel01_Volt"
|
||||||
|
Channel02_name="Channel02_Volt"
|
||||||
|
Channel03_name="Channel03_Volt"
|
||||||
|
Channel04_name="Channel04_Volt"
|
||||||
|
Channel05_name="Channel05_Volt"
|
||||||
|
Channel06_name="Channel06_Volt"
|
||||||
|
Channel07_name="Channel07_Volt"
|
||||||
|
Channel08_name="Channel08_Volt"
|
||||||
|
Channel09_name="Channel09_Volt"
|
||||||
|
Channel10_name="Channel10_Volt"
|
||||||
|
Channel11_name="Channel11_Volt"
|
||||||
|
Channel12_name="Channel12_Volt"
|
||||||
|
Channel13_name="Channel13_Volt"
|
||||||
|
Channel14_name="Channel14_Volt"
|
||||||
|
Channel15_name="Channel15_Volt"
|
||||||
|
|
||||||
|
# ---------------------------------------------------------------
|
||||||
|
# Function Define
|
||||||
|
# ---------------------------------------------------------------
|
||||||
|
# @Param1 ChannelNumber
|
||||||
|
# @Param2 ChannelRegOffset
|
||||||
|
# @Param3 Pos Flag
|
||||||
|
# @Param4 ChannelName
|
||||||
|
# @Param5 ChannelResist
|
||||||
|
read_channel_and_convert(){
|
||||||
|
RegAddr=0x1e6e90$2
|
||||||
|
# echo "RegAddr=${RegAddr}"
|
||||||
|
|
||||||
|
res=`devmem ${RegAddr} 32`
|
||||||
|
# echo $res
|
||||||
|
if [ $3 = $Low_Position ];then
|
||||||
|
ex=$(echo ${res} | cut -c 8)
|
||||||
|
h=$(echo ${res} | cut -c 9)
|
||||||
|
l=$(echo ${res} | cut -c 10)
|
||||||
|
hex_raw=${ex}${h}${l}
|
||||||
|
else
|
||||||
|
ex=$(echo ${res} | cut -c 4)
|
||||||
|
h=$(echo ${res} | cut -c 5)
|
||||||
|
l=$(echo ${res} | cut -c 6)
|
||||||
|
hex_raw=${ex}${h}${l}
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Convert hex raw data to sensor value
|
||||||
|
dec_raw=$(echo "ibase=16; ${hex_raw}" | bc)
|
||||||
|
volt=$(echo "scale=4; ((${dec_raw} + 1.0) / 1024) * 1.8 * ${5} " | bc)
|
||||||
|
format_volt=$(echo "$volt" | awk '{ if ($0 ~ /^\./) print "0" $0; else print $0 }')
|
||||||
|
|
||||||
|
# Output result
|
||||||
|
echo "Channel$1 | $4 : ${format_volt}V"
|
||||||
|
}
|
||||||
|
|
||||||
|
# ---------------------------------------------------------------
|
||||||
|
# Main
|
||||||
|
# ---------------------------------------------------------------
|
||||||
|
echo "Board Name : ${Board_Desc}"
|
||||||
|
read_channel_and_convert "00" "10" ${Low_Position} "${Channel00_name}" "${Channel00_resist}"
|
||||||
|
read_channel_and_convert "01" "10" ${High_Position} "${Channel01_name}" "${Channel01_resist}"
|
||||||
|
read_channel_and_convert "02" "14" ${Low_Position} "${Channel02_name}" "${Channel02_resist}"
|
||||||
|
read_channel_and_convert "03" "14" ${High_Position} "${Channel03_name}" "${Channel03_resist}"
|
||||||
|
read_channel_and_convert "04" "18" ${Low_Position} "${Channel04_name}" "${Channel04_resist}"
|
||||||
|
read_channel_and_convert "05" "18" ${High_Position} "${Channel05_name}" "${Channel05_resist}"
|
||||||
|
read_channel_and_convert "06" "1c" ${Low_Position} "${Channel06_name}" "${Channel06_resist}"
|
||||||
|
read_channel_and_convert "07" "1c" ${High_Position} "${Channel07_name}" "${Channel07_resist}"
|
||||||
|
read_channel_and_convert "08" "20" ${Low_Position} "${Channel08_name}" "${Channel08_resist}"
|
||||||
|
read_channel_and_convert "09" "20" ${High_Position} "${Channel09_name}" "${Channel09_resist}"
|
||||||
|
read_channel_and_convert "10" "24" ${Low_Position} "${Channel10_name}" "${Channel10_resist}"
|
||||||
|
read_channel_and_convert "11" "24" ${High_Position} "${Channel11_name}" "${Channel11_resist}"
|
||||||
|
read_channel_and_convert "12" "28" ${Low_Position} "${Channel12_name}" "${Channel12_resist}"
|
||||||
|
read_channel_and_convert "13" "28" ${High_Position} "${Channel13_name}" "${Channel13_resist}"
|
||||||
|
read_channel_and_convert "14" "2c" ${Low_Position} "${Channel14_name}" "${Channel14_resist}"
|
||||||
|
read_channel_and_convert "15" "2c" ${High_Position} "${Channel15_name}" "${Channel15_resist}"
|
||||||
@ -17,3 +17,9 @@
|
|||||||
|
|
||||||
### 脚本模板
|
### 脚本模板
|
||||||
- 简单的循环模板 :[template_loop.sh](./03.template/template_loop.sh)
|
- 简单的循环模板 :[template_loop.sh](./03.template/template_loop.sh)
|
||||||
|
|
||||||
|
### BMC工具脚本
|
||||||
|
- Linux系统下一键收集日志 :[Linux_CollectOnekeylog.sh](./07.bmc_tool_script/Linux_CollectOnekeylog.sh)
|
||||||
|
- Windows系统下一键收集日志 :[Windows_CollectOnekeylog.bat](./07.bmc_tool_script/Windows_CollectOnekeylog.bat)
|
||||||
|
- BMC下快速读取ADC寄存器的数值 :[read_adc_reg.sh](./07.bmc_tool_script/read_adc_reg.sh)
|
||||||
|
- BMC下手动触发Crashdump : [manul_crashdump.sh](./07.bmc_tool_script/manual_crashdump.sh)
|
||||||
Loading…
Reference in New Issue
Block a user