mirror of
https://github.com/dougg3/mac-rom-simm-programmer.git
synced 2024-11-25 10:30:49 +00:00
- Fixed stupid bug of -1 instead of +1 in external_mem.c.
- Began writing an electrical test so I remember WTF I'm doing later
This commit is contained in:
parent
1595c69890
commit
0a52df645a
@ -9,7 +9,7 @@
|
||||
#include "ports.h"
|
||||
#include <avr/io.h>
|
||||
|
||||
#define NUM_ADDRESS_LINES 20
|
||||
#define HIGHEST_ADDRESS_LINE 20
|
||||
|
||||
// Allow this to be initialized more than once.
|
||||
// In case we mess with the port settings,
|
||||
@ -22,11 +22,11 @@ void ExternalMem_Init(void)
|
||||
|
||||
// Disable all pull-ups, on both the address and data lines. They aren't needed
|
||||
// for normal operation.
|
||||
Ports_AddressPullups_RMW(0, (1UL << (NUM_ADDRESS_LINES - 1)) - 1);
|
||||
Ports_AddressPullups_RMW(0, (1UL << (HIGHEST_ADDRESS_LINE + 1)) - 1);
|
||||
Ports_DataPullups_RMW(0, 0xFFFFFFFFUL);
|
||||
|
||||
// Configure all address lines as outputs
|
||||
Ports_SetAddressDDR((1UL << (NUM_ADDRESS_LINES - 1)) - 1);
|
||||
Ports_SetAddressDDR((1UL << (HIGHEST_ADDRESS_LINE - 1)) - 1);
|
||||
|
||||
// Sensible defaults for address and data lines:
|
||||
// Write out address zero
|
||||
|
@ -6,11 +6,37 @@
|
||||
*/
|
||||
|
||||
#include "simm_electrical_test.h"
|
||||
#include "../ports.h"
|
||||
|
||||
#define SIMM_HIGHEST_ADDRESS_LINE 18
|
||||
|
||||
int SIMMElectricalTest_Run(void)
|
||||
{
|
||||
// Returns number of errors found
|
||||
int numErrors = 0;
|
||||
|
||||
Ports_Init();
|
||||
|
||||
// First check for anything shorted to ground. Set all lines as inputs with a weak pull-up resistor.
|
||||
// Then read the values back and check for any zeros. This would indicate a short to ground.
|
||||
Ports_SetAddressDDR(0);
|
||||
Ports_SetDataDDR(0);
|
||||
Ports_AddressPullups_RMW((1UL << (SIMM_HIGHEST_ADDRESS_LINE + 1)) - 1, (1UL << (SIMM_HIGHEST_ADDRESS_LINE + 1)) - 1);
|
||||
Ports_DataPullups_RMW(0xFFFFFFFFUL, 0xFFFFFFFFUL);
|
||||
|
||||
// TODO: Wait a sec?
|
||||
|
||||
if (Ports_ReadAddress() != (1UL << (SIMM_HIGHEST_ADDRESS_LINE + 1)) - 1)
|
||||
{
|
||||
// TODO: Log all these errors somewhere?
|
||||
numErrors++;
|
||||
}
|
||||
|
||||
if (Ports_ReadData() != 0xFFFFFFFFUL)
|
||||
{
|
||||
// TODO: Log all these errors somewhere?
|
||||
numErrors++;
|
||||
}
|
||||
|
||||
return numErrors;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user