diff options
author | joy_chu <joy_chu@wistron.com> | 2019-07-22 18:57:17 +0800 |
---|---|---|
committer | William A Bryan <wilbryan@us.ibm.com> | 2019-07-30 13:14:38 -0500 |
commit | 1e8731f62fa73292197d85757987eebc055c5cc1 (patch) | |
tree | 0ff242dde576c996e2a3b1caa3f15118f55824b6 /src/occ_405 | |
parent | 0ac177024e4fa576d6cc2988cfc77a0b520139a6 (diff) | |
download | talos-occ-1e8731f62fa73292197d85757987eebc055c5cc1.tar.gz talos-occ-1e8731f62fa73292197d85757987eebc055c5cc1.zip |
Modify: modify amec power sensor calculation
The offset value will be added to APSS raw value when APSS raw value is not 0.
Change-Id: Iba5ecc6d979ea3cc771c6cd25f6e7bab44bb2d78
Signed-off-by: joy_chu <joy_chu@wistron.com>
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/81383
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Reviewed-by: Christopher J Cain <cjcain@us.ibm.com>
Reviewed-by: William A Bryan <wilbryan@us.ibm.com>
Diffstat (limited to 'src/occ_405')
-rwxr-xr-x | src/occ_405/amec/amec_sensors_power.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/occ_405/amec/amec_sensors_power.c b/src/occ_405/amec/amec_sensors_power.c index 6b6fe9f..c6dcf15 100755 --- a/src/occ_405/amec/amec_sensors_power.c +++ b/src/occ_405/amec/amec_sensors_power.c @@ -173,14 +173,18 @@ uint32_t amec_value_from_apss_adc(uint8_t i_chan) // Read Raw Value in mA (divide masked channel data by 2) l_raw = (G_dcom_slv_inbox_rx.adc[i_chan] & APSS_12BIT_ADC_MASK)/2; // Apply offset and gain - if (l_offset & 0x80000000) + // Add offset if Raw Value is not zero + if (l_raw != 0) { - // Negative offset - l_raw -= (~l_offset + 1); - } - else - { - l_raw += l_offset; + if (l_offset & 0x80000000) + { + // Negative offset + l_raw -= (~l_offset + 1); + } + else + { + l_raw += l_offset; + } } //Check to see if l_raw is negative. If so, set raw to 0 if (l_raw & 0x8000) |