mirror of
https://github.com/preble/libpinproc
synced 2026-02-24 18:25:23 +01:00
Double flush read buffer on startup.
This commit is contained in:
@@ -303,7 +303,6 @@ PRResult PRDevice::DriverLoadMachineTypeDefaults(PRMachineType machineType, uint
|
|||||||
int rowEnableSelect;
|
int rowEnableSelect;
|
||||||
int lastCoilDriverGroup;
|
int lastCoilDriverGroup;
|
||||||
|
|
||||||
DEBUG(PRLog(kPRLogError, "In Defaults:, machineType = %x.\n", machineType));
|
|
||||||
switch (machineType)
|
switch (machineType)
|
||||||
{
|
{
|
||||||
case kPRMachineWPC:
|
case kPRMachineWPC:
|
||||||
@@ -350,7 +349,6 @@ PRResult PRDevice::DriverLoadMachineTypeDefaults(PRMachineType machineType, uint
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DEBUG(PRLog(kPRLogError, "Defaults:, setup done.\n", machineType));
|
|
||||||
|
|
||||||
memset(&driverGlobalConfig, 0x00, sizeof(PRDriverGlobalConfig));
|
memset(&driverGlobalConfig, 0x00, sizeof(PRDriverGlobalConfig));
|
||||||
for (i = 0; i < kPRDriverCount; i++)
|
for (i = 0; i < kPRDriverCount; i++)
|
||||||
@@ -362,7 +360,6 @@ PRResult PRDevice::DriverLoadMachineTypeDefaults(PRMachineType machineType, uint
|
|||||||
if (resetFlags & kPRResetFlagUpdateDevice)
|
if (resetFlags & kPRResetFlagUpdateDevice)
|
||||||
res = DriverUpdateState(driver);
|
res = DriverUpdateState(driver);
|
||||||
}
|
}
|
||||||
DEBUG(PRLog(kPRLogError, "Defaults:, Drivers done.\n", machineType));
|
|
||||||
for (i = 0; i < kPRDriverGroupsMax; i++)
|
for (i = 0; i < kPRDriverGroupsMax; i++)
|
||||||
{
|
{
|
||||||
PRDriverGroupConfig *group = &driverGroups[i];
|
PRDriverGroupConfig *group = &driverGroups[i];
|
||||||
@@ -370,7 +367,6 @@ PRResult PRDevice::DriverLoadMachineTypeDefaults(PRMachineType machineType, uint
|
|||||||
group->groupNum = i;
|
group->groupNum = i;
|
||||||
group->polarity = globalPolarity;
|
group->polarity = globalPolarity;
|
||||||
}
|
}
|
||||||
DEBUG(PRLog(kPRLogError, "Defaults:, Drivers groups set up.\n", machineType));
|
|
||||||
|
|
||||||
PRDriverGlobalConfig globals;
|
PRDriverGlobalConfig globals;
|
||||||
globals.enableOutputs = false;
|
globals.enableOutputs = false;
|
||||||
@@ -386,7 +382,6 @@ PRResult PRDevice::DriverLoadMachineTypeDefaults(PRMachineType machineType, uint
|
|||||||
globals.watchdogExpired = false;
|
globals.watchdogExpired = false;
|
||||||
globals.watchdogEnable = true;
|
globals.watchdogEnable = true;
|
||||||
globals.watchdogResetTime = watchdogResetTime;
|
globals.watchdogResetTime = watchdogResetTime;
|
||||||
DEBUG(PRLog(kPRLogError, "Defaults:, Drivers globals set up.\n", machineType));
|
|
||||||
|
|
||||||
// We want to start up safely, so we'll update the global driver config twice.
|
// We want to start up safely, so we'll update the global driver config twice.
|
||||||
// When we toggle enableOutputs like this P-ROC will reset the polarity:
|
// When we toggle enableOutputs like this P-ROC will reset the polarity:
|
||||||
@@ -404,7 +399,6 @@ PRResult PRDevice::DriverLoadMachineTypeDefaults(PRMachineType machineType, uint
|
|||||||
else
|
else
|
||||||
driverGlobalConfig = globals;
|
driverGlobalConfig = globals;
|
||||||
|
|
||||||
DEBUG(PRLog(kPRLogError, "Defaults:, Drivers globals programmed.\n", machineType));
|
|
||||||
|
|
||||||
// Configure the groups. Each group corresponds to 8 consecutive drivers, starting
|
// Configure the groups. Each group corresponds to 8 consecutive drivers, starting
|
||||||
// with driver #32. The following 6 groups are configured for coils/flashlamps.
|
// with driver #32. The following 6 groups are configured for coils/flashlamps.
|
||||||
@@ -426,10 +420,8 @@ PRResult PRDevice::DriverLoadMachineTypeDefaults(PRMachineType machineType, uint
|
|||||||
res = DriverUpdateGroupConfig(&group);
|
res = DriverUpdateGroupConfig(&group);
|
||||||
else
|
else
|
||||||
driverGroups[i] = group;
|
driverGroups[i] = group;
|
||||||
DEBUG(PRLog(kPRLogError, "Defaults: group %x programmed.\n", i));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUG(PRLog(kPRLogError, "Defaults: First groups programmed.\n", machineType));
|
|
||||||
|
|
||||||
// The following 8 groups are configured for the feature lamp matrix.
|
// The following 8 groups are configured for the feature lamp matrix.
|
||||||
for (i = 10; i < 10 + numMatrixGroups; i++) {
|
for (i = 10; i < 10 + numMatrixGroups; i++) {
|
||||||
@@ -447,9 +439,7 @@ PRResult PRDevice::DriverLoadMachineTypeDefaults(PRMachineType machineType, uint
|
|||||||
res = DriverUpdateGroupConfig(&group);
|
res = DriverUpdateGroupConfig(&group);
|
||||||
else
|
else
|
||||||
driverGroups[i] = group;
|
driverGroups[i] = group;
|
||||||
DEBUG(PRLog(kPRLogError, "Defaults: group %x programmed.\n", i));
|
|
||||||
}
|
}
|
||||||
DEBUG(PRLog(kPRLogError, "Defaults: last groups programmed.\n", machineType));
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -821,6 +811,10 @@ PRResult PRDevice::Open()
|
|||||||
SwitchUpdateConfig(&switchConfig);
|
SwitchUpdateConfig(&switchConfig);
|
||||||
|
|
||||||
// Flush read data to ensure VerifyChipID starts with clean buffer.
|
// Flush read data to ensure VerifyChipID starts with clean buffer.
|
||||||
|
// Do it twice with a delay in between to ensure that any data in the P-ROC
|
||||||
|
// while the buffer is being flushed the first time is flushed the second time.
|
||||||
|
res = FlushReadBuffer();
|
||||||
|
PRSleep(100);
|
||||||
res = FlushReadBuffer();
|
res = FlushReadBuffer();
|
||||||
if (VerifyChipID() == kPRFailure) {
|
if (VerifyChipID() == kPRFailure) {
|
||||||
// Since the FPGA didn't appear to be responding properly, send the FPGA's FTDI
|
// Since the FPGA didn't appear to be responding properly, send the FPGA's FTDI
|
||||||
|
|||||||
Reference in New Issue
Block a user