Implement Silicom card features #1
2 changed files with 8 additions and 11 deletions
|
@ -5441,6 +5441,7 @@ fm_status fmPlatformLibSetVrmVoltage(fm_int sw,
|
||||||
fm_i2cCfg * i2c;
|
fm_i2cCfg * i2c;
|
||||||
fm_hwResId * hwResId;
|
fm_hwResId * hwResId;
|
||||||
fm_vrmI2C * vrmI2c;
|
fm_vrmI2C * vrmI2c;
|
||||||
|
uint voltageCalc;
|
||||||
fm_byte data[4];
|
fm_byte data[4];
|
||||||
fm_uint channel;
|
fm_uint channel;
|
||||||
fm_uint regVidSet;
|
fm_uint regVidSet;
|
||||||
|
@ -5690,31 +5691,27 @@ fm_status fmPlatformLibSetVrmVoltage(fm_int sw,
|
||||||
else if (hwResId->vrm.model && (hwResId->vrm.model == VRM_IR))
|
else if (hwResId->vrm.model && (hwResId->vrm.model == VRM_IR))
|
||||||
{
|
{
|
||||||
printf("vrm mVolt %d delta %d\n", mVolt, hwResId->vrm.delta);
|
printf("vrm mVolt %d delta %d\n", mVolt, hwResId->vrm.delta);
|
||||||
uint voltageCalc = (mVolt + hwResId->vrm.delta) / 5 - 49;
|
voltageCalc = (mVolt + hwResId->vrm.delta) / 5 - 49;
|
||||||
data[1] = voltageCalc;
|
data[1] = voltageCalc;
|
||||||
printf("vrm channel %d data 0x%x\n", channel, voltageCalc);
|
printf("vrm channel %d data 0x%x\n", channel, voltageCalc);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
|
|
||||||
if(channel == 0){
|
if(status == 0){
|
||||||
data[0] = 0x26;
|
data[0] = 0x26;
|
||||||
} else if (channel == 1){
|
} else if (channel == 1){
|
||||||
data[0] = 0x27;
|
data[0] = 0x27;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(uint i = 0; i < 0x32; ++i){
|
for(uint i = 0; i < 50; ++i){
|
||||||
status = i2c->writeReadFunc(i2c->handle, vrmI2c->addr, data, 2, 0);
|
status = i2c->writeReadFunc(i2c->handle, vrmI2c->addr, data, 2, 0);
|
||||||
if(status == FM_OK){
|
if(status == FM_OK){
|
||||||
i2c->writeReadFunc(i2c->handle, vrmI2c->addr, data, 0, 1);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
fmDelayBy(1, 0);
|
||||||
fmDelay(0, 1);
|
|
||||||
}
|
}
|
||||||
if(status != FM_OK){
|
|
||||||
i2c->writeReadFunc(i2c->handle, vrmI2c->addr, data, 0, 1);
|
i2c->writeReadFunc(i2c->handle, vrmI2c->addr, data, 0, 1);
|
||||||
FM_LOG_ABORT_ON_ERR(FM_LOG_CAT_PLATFORM, status);
|
FM_LOG_ABORT_ON_ERR(FM_LOG_CAT_PLATFORM, status);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
status = FM_ERR_INVALID_ARGUMENT;
|
status = FM_ERR_INVALID_ARGUMENT;
|
||||||
|
|
Loading…
Reference in a new issue