mirror of
https://github.com/dougg3/mac-rom-simm-programmer.git
synced 2024-06-13 02:29:32 +00:00
The same short is never repeated twice with the same 2 pins now. However -- if there's a short between 1, 2, and 3 -- it will still show a short between 1 and 2, 1 and 3, and 2 and 3, even though that info is somewhat redundant. But the host software can iron all that out.
This commit is contained in:
parent
9333b65cde
commit
a1ca591d60
|
@ -135,6 +135,11 @@ int SIMMElectricalTest_Run(void (*errorHandler)(uint8_t, uint8_t))
|
||||||
// Now, check each individual line vs. all other lines on the SIMM for any shorts between them
|
// Now, check each individual line vs. all other lines on the SIMM for any shorts between them
|
||||||
ElectricalTestStage curStage = TestingAddressLines;
|
ElectricalTestStage curStage = TestingAddressLines;
|
||||||
int x = 0;
|
int x = 0;
|
||||||
|
// This is a counter we do once per pin. I use it to do a "triangle" algorithm so that I don't check
|
||||||
|
// every possible pair of pins twice. If I did, I would get two notifications for each short.
|
||||||
|
uint8_t pinsAlreadyChecked = 0;
|
||||||
|
uint8_t thisPin = 0;
|
||||||
|
uint8_t i;
|
||||||
while (curStage != DoneTesting)
|
while (curStage != DoneTesting)
|
||||||
{
|
{
|
||||||
// Set one pin to output a 0.
|
// Set one pin to output a 0.
|
||||||
|
@ -219,6 +224,11 @@ int SIMMElectricalTest_Run(void (*errorHandler)(uint8_t, uint8_t))
|
||||||
|
|
||||||
DelayMS(DELAY_SETTLE_TIME_MS);
|
DelayMS(DELAY_SETTLE_TIME_MS);
|
||||||
|
|
||||||
|
// Now keep a count of how many pins we have actually checked.
|
||||||
|
// We will skip the first "pinsAlreadyChecked" pins each time so we don't get duplicates.
|
||||||
|
thisPin = 0;
|
||||||
|
|
||||||
|
// Read back the address data to see if any shorts were found
|
||||||
readback = Ports_ReadAddress();
|
readback = Ports_ReadAddress();
|
||||||
if (curStage == TestingAddressLines)
|
if (curStage == TestingAddressLines)
|
||||||
{
|
{
|
||||||
|
@ -226,17 +236,15 @@ int SIMMElectricalTest_Run(void (*errorHandler)(uint8_t, uint8_t))
|
||||||
readback |= (1UL << x);
|
readback |= (1UL << x);
|
||||||
}
|
}
|
||||||
|
|
||||||
// At this point, any errors will manifest as 0 bits. It's easier to test for errors by turning them
|
|
||||||
// into 1 bits, so invert the readback so shorted pins are 1s and non-shorted pins are 0s
|
|
||||||
readback = ~readback & SIMM_ADDRESS_PINS_MASK;
|
|
||||||
|
|
||||||
failIndex = FIRST_ADDRESS_LINE_FAIL_INDEX;
|
failIndex = FIRST_ADDRESS_LINE_FAIL_INDEX;
|
||||||
|
|
||||||
// Count any shorted pins
|
// Count any shorted pins
|
||||||
while (readback)
|
for (i = 0; i <= SIMM_HIGHEST_ADDRESS_LINE; i++)
|
||||||
{
|
{
|
||||||
// failure here?
|
// failure here?
|
||||||
if ((readback & 1) && !SIMMElectricalTest_IsGroundShort(failIndex))
|
if ((thisPin >= pinsAlreadyChecked) && // We haven't already checked this combination of pins...
|
||||||
|
!(readback & 1) && // It's showing as a short...
|
||||||
|
!SIMMElectricalTest_IsGroundShort(failIndex)) // And it's not a short to ground
|
||||||
{
|
{
|
||||||
errorHandler(testPinFailIndex, failIndex);
|
errorHandler(testPinFailIndex, failIndex);
|
||||||
numErrors++;
|
numErrors++;
|
||||||
|
@ -244,6 +252,7 @@ int SIMMElectricalTest_Run(void (*errorHandler)(uint8_t, uint8_t))
|
||||||
|
|
||||||
readback >>= 1;
|
readback >>= 1;
|
||||||
failIndex++;
|
failIndex++;
|
||||||
|
thisPin++;
|
||||||
}
|
}
|
||||||
|
|
||||||
readback = Ports_ReadData();
|
readback = Ports_ReadData();
|
||||||
|
@ -253,16 +262,15 @@ int SIMMElectricalTest_Run(void (*errorHandler)(uint8_t, uint8_t))
|
||||||
readback |= (1UL << x);
|
readback |= (1UL << x);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Again, invert readback so shorted pins are 1s and non-shorted pins are 0s
|
|
||||||
readback = ~readback;
|
|
||||||
|
|
||||||
failIndex = FIRST_DATA_LINE_FAIL_INDEX;
|
failIndex = FIRST_DATA_LINE_FAIL_INDEX;
|
||||||
|
|
||||||
// Count any shorted pins
|
// Count any shorted pins
|
||||||
while (readback)
|
while (readback)
|
||||||
{
|
{
|
||||||
// failure here?
|
// failure here?
|
||||||
if ((readback & 1) && !SIMMElectricalTest_IsGroundShort(failIndex))
|
if ((thisPin >= pinsAlreadyChecked) && // We haven't already checked this combination of pins...
|
||||||
|
!(readback & 1) && // It's showing as a short...
|
||||||
|
!SIMMElectricalTest_IsGroundShort(failIndex)) // And it's not a short to ground
|
||||||
{
|
{
|
||||||
errorHandler(testPinFailIndex, failIndex);
|
errorHandler(testPinFailIndex, failIndex);
|
||||||
numErrors++;
|
numErrors++;
|
||||||
|
@ -270,34 +278,44 @@ int SIMMElectricalTest_Run(void (*errorHandler)(uint8_t, uint8_t))
|
||||||
|
|
||||||
readback >>= 1;
|
readback >>= 1;
|
||||||
failIndex++;
|
failIndex++;
|
||||||
|
thisPin++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (curStage != TestingCS)
|
if (curStage != TestingCS)
|
||||||
{
|
{
|
||||||
if (!Ports_ReadCS() && !SIMMElectricalTest_IsGroundShort(CS_FAIL_INDEX))
|
if ((thisPin >= pinsAlreadyChecked) &&
|
||||||
|
!Ports_ReadCS() &&
|
||||||
|
!SIMMElectricalTest_IsGroundShort(CS_FAIL_INDEX))
|
||||||
{
|
{
|
||||||
errorHandler(testPinFailIndex, CS_FAIL_INDEX);
|
errorHandler(testPinFailIndex, CS_FAIL_INDEX);
|
||||||
numErrors++;
|
numErrors++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
thisPin++;
|
||||||
|
|
||||||
if (curStage != TestingOE)
|
if (curStage != TestingOE)
|
||||||
{
|
{
|
||||||
if (!Ports_ReadOE() && !SIMMElectricalTest_IsGroundShort(OE_FAIL_INDEX))
|
if ((thisPin >= pinsAlreadyChecked) &&
|
||||||
|
!Ports_ReadOE() &&
|
||||||
|
!SIMMElectricalTest_IsGroundShort(OE_FAIL_INDEX))
|
||||||
{
|
{
|
||||||
errorHandler(testPinFailIndex, OE_FAIL_INDEX);
|
errorHandler(testPinFailIndex, OE_FAIL_INDEX);
|
||||||
numErrors++;
|
numErrors++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
thisPin++;
|
||||||
|
|
||||||
if (curStage != TestingWE)
|
if (curStage != TestingWE)
|
||||||
{
|
{
|
||||||
if (!Ports_ReadWE() && !SIMMElectricalTest_IsGroundShort(WE_FAIL_INDEX))
|
if ((thisPin >= pinsAlreadyChecked) &&
|
||||||
|
!Ports_ReadWE() &&
|
||||||
|
!SIMMElectricalTest_IsGroundShort(WE_FAIL_INDEX))
|
||||||
{
|
{
|
||||||
errorHandler(testPinFailIndex, WE_FAIL_INDEX);
|
errorHandler(testPinFailIndex, WE_FAIL_INDEX);
|
||||||
numErrors++;
|
numErrors++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
thisPin++;
|
||||||
|
|
||||||
// Finally, move on to the next stage if needed.
|
// Finally, move on to the next stage if needed.
|
||||||
if (curStage == TestingAddressLines)
|
if (curStage == TestingAddressLines)
|
||||||
|
@ -323,6 +341,9 @@ int SIMMElectricalTest_Run(void (*errorHandler)(uint8_t, uint8_t))
|
||||||
{
|
{
|
||||||
curStage++;
|
curStage++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Increase the number of pins we have actually checked...
|
||||||
|
pinsAlreadyChecked++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return numErrors;
|
return numErrors;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user