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_hwResId * hwResId;
|
||||
fm_vrmI2C * vrmI2c;
|
||||
uint voltageCalc;
|
||||
fm_byte data[4];
|
||||
fm_uint channel;
|
||||
fm_uint regVidSet;
|
||||
|
@ -5690,30 +5691,26 @@ fm_status fmPlatformLibSetVrmVoltage(fm_int sw,
|
|||
else if (hwResId->vrm.model && (hwResId->vrm.model == VRM_IR))
|
||||
{
|
||||
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;
|
||||
printf("vrm channel %d data 0x%x\n", channel, voltageCalc);
|
||||
fflush(stdout);
|
||||
|
||||
if(channel == 0){
|
||||
if(status == 0){
|
||||
data[0] = 0x26;
|
||||
} else if (channel == 1){
|
||||
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);
|
||||
if(status == FM_OK){
|
||||
i2c->writeReadFunc(i2c->handle, vrmI2c->addr, data, 0, 1);
|
||||
break;
|
||||
}
|
||||
|
||||
fmDelay(0, 1);
|
||||
}
|
||||
if(status != FM_OK){
|
||||
i2c->writeReadFunc(i2c->handle, vrmI2c->addr, data, 0, 1);
|
||||
FM_LOG_ABORT_ON_ERR(FM_LOG_CAT_PLATFORM, status);
|
||||
fmDelayBy(1, 0);
|
||||
}
|
||||
i2c->writeReadFunc(i2c->handle, vrmI2c->addr, data, 0, 1);
|
||||
FM_LOG_ABORT_ON_ERR(FM_LOG_CAT_PLATFORM, status);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue