forked from Apple-2-HW/TommyPROM
Add lock command for 28C devices
This commit is contained in:
parent
b93ee42d0c
commit
ed539fe310
@ -47,6 +47,13 @@ The READ and WRITE command both use XMODEM CRC to complete the file transfers.
|
||||
|
||||
The files used for READ and WRITE are simple binary images. This can be created directly by [asm85](http://github.com/TomNisbet/asm85) or can be converted from S-record or Intel HEX using an external utility.
|
||||
|
||||
## Troubleshooting
|
||||
* If the code doesn't appear to be working, concentrate on the read operations first to verify that the data and address paths are good.
|
||||
* Re-check all hardware connections and verify the the control pins are going to the Arduino pins that match the definitions in the code.
|
||||
* Verify that the ARDUINO_IS_xxx line in Configure.h matches the Arduino type you are using. Many Arduino boards other than those listed in
|
||||
the file may work as well by commenting out all of the ARDUINO_IS_xxx lines. This will use the slower bit-at-a-time code for that data bus instead of the board-specific code.
|
||||
* 28C series EEPROMS, like the 28C256, sometimes ship from the factory with Data Protection enabled. Use the UNLOCK command to disable this.
|
||||
|
||||
## Further Work
|
||||
* Add a new PromDevice class for 27 series EPROMS.
|
||||
* Additional error checking in the CmdLine code.
|
||||
|
@ -1,13 +1,16 @@
|
||||
// Uncomment only one of these to use the fast I/O code for the data bus, or
|
||||
// comment them all out to use the slower bit-at-a-time code.
|
||||
// Uncomment only one of the ARDUINO_IS_ lines to use the fast I/O code for
|
||||
// the data bus, or comment them all out to use the slower bit-at-a-time code.
|
||||
|
||||
//#define ARDUINO_IS_MICRO
|
||||
//#define ARDUINO_IS_UNO
|
||||
#define ARDUINO_IS_NANO
|
||||
#define ARDUINO_IS_UNO
|
||||
//#define ARDUINO_IS_NANO
|
||||
|
||||
|
||||
// Comment this out to remove extra debugging commands and code
|
||||
|
||||
#define ENABLE_DEBUG_COMMANDS
|
||||
|
||||
|
||||
// Uncomment only one of these to choose the PROM device code that will be
|
||||
// compiled in.
|
||||
|
||||
@ -15,6 +18,7 @@
|
||||
//#define PROM_IS_8755A
|
||||
|
||||
|
||||
// Don't change anything below this comment unless you are adding support for a new device type.
|
||||
#if defined(PROM_IS_28C)
|
||||
#include "PromDevice28C.h"
|
||||
#elif defined(PROM_IS_8755A)
|
||||
|
@ -22,7 +22,9 @@ class PromDevice
|
||||
byte readData(word address) { return readByte(address); }
|
||||
|
||||
virtual void begin() = 0;
|
||||
virtual const char * getName() = 0;
|
||||
virtual void disableSoftwareWriteProtect() {}
|
||||
virtual void enableSoftwareWriteProtect() {}
|
||||
|
||||
protected:
|
||||
unsigned int mSize; // Size of the device, in bytes
|
||||
|
@ -64,6 +64,23 @@ void PromDevice28C::disableSoftwareWriteProtect()
|
||||
}
|
||||
|
||||
|
||||
// Write the special three-byte code to turn on Software Data Protection.
|
||||
void PromDevice28C::enableSoftwareWriteProtect()
|
||||
{
|
||||
disableOutput();
|
||||
disableWrite();
|
||||
enableChip();
|
||||
setDataBusMode(OUTPUT);
|
||||
|
||||
setByte(0xaa, 0x5555);
|
||||
setByte(0x55, 0x2aaa);
|
||||
setByte(0xa0, 0x5555);
|
||||
|
||||
setDataBusMode(INPUT);
|
||||
disableChip();
|
||||
}
|
||||
|
||||
|
||||
// BEGIN PRIVATE METHODS
|
||||
//
|
||||
|
||||
|
@ -20,7 +20,9 @@ class PromDevice28C : public PromDevice
|
||||
public:
|
||||
PromDevice28C(unsigned long size, word blockSize, unsigned maxWriteTime, bool polling);
|
||||
void begin();
|
||||
const char * getName() { return "28C series EEPROM"; }
|
||||
void disableSoftwareWriteProtect();
|
||||
void enableSoftwareWriteProtect();
|
||||
|
||||
protected:
|
||||
void setAddress(word address);
|
||||
|
@ -20,6 +20,7 @@ class PromDevice8755A : public PromDevice
|
||||
public:
|
||||
PromDevice8755A(unsigned long size);
|
||||
void begin();
|
||||
const char * getName() { return "Intel 8755A EPROM"; }
|
||||
|
||||
protected:
|
||||
void setAddress(word address);
|
||||
|
@ -71,6 +71,7 @@ enum {
|
||||
CMD_DUMP,
|
||||
CMD_ERASED,
|
||||
CMD_FILL,
|
||||
CMD_LOCK,
|
||||
CMD_READ,
|
||||
CMD_UNLOCK,
|
||||
CMD_WRITE,
|
||||
@ -127,6 +128,7 @@ byte parseCommand(char c)
|
||||
case 'd': cmd = CMD_DUMP; break;
|
||||
case 'e': cmd = CMD_ERASED; break;
|
||||
case 'f': cmd = CMD_FILL; break;
|
||||
case 'l': cmd = CMD_LOCK; break;
|
||||
case 'r': cmd = CMD_READ; break;
|
||||
case 'u': cmd = CMD_UNLOCK; break;
|
||||
case 'w': cmd = CMD_WRITE; break;
|
||||
@ -610,6 +612,11 @@ void loop()
|
||||
fillBlock(start, end, val);
|
||||
break;
|
||||
|
||||
case CMD_LOCK:
|
||||
Serial.println(F("Writing the lock code to enable Software Write Protect mode."));
|
||||
prom.enableSoftwareWriteProtect();
|
||||
break;
|
||||
|
||||
case CMD_READ:
|
||||
Serial.println(F("Set the terminal to receive XMODEM CRC"));
|
||||
if (xmodem.SendFile(start, uint32_t(end) - start + 1))
|
||||
@ -657,14 +664,17 @@ void loop()
|
||||
break;
|
||||
|
||||
default:
|
||||
Serial.println(F("TommyPROM 1.6\n"));
|
||||
Serial.print(F("TommyPROM 1.7 - "));
|
||||
Serial.println(prom.getName());
|
||||
Serial.println();
|
||||
Serial.println(F("Valid commands are:"));
|
||||
Serial.println(F(" Cssss eeee - Compute checksum from device"));
|
||||
Serial.println(F(" Dssss eeee - Dump bytes from device to terminal"));
|
||||
Serial.println(F(" Essss eeee - Check to see if device range is Erased (all FF)"));
|
||||
Serial.println(F(" Fssss eeee dd - Fill block on device with fixed value"));
|
||||
Serial.println(F(" L - Lock (enable) device Software Data Protection"));
|
||||
Serial.println(F(" Rssss eeee - Read from device and save to XMODEM CRC file"));
|
||||
Serial.println(F(" U - Unlock device Software Data Protection"));
|
||||
Serial.println(F(" U - Unlock (disable) device Software Data Protection"));
|
||||
Serial.println(F(" Wssss - Write to device from XMODEM CRC file"));
|
||||
#ifdef ENABLE_DEBUG_COMMANDS
|
||||
Serial.println();
|
||||
|
Loading…
x
Reference in New Issue
Block a user