Issue #13 - fix HWverify CLI parsing and update documentation.

This commit is contained in:
Tom Nisbet 2020-08-24 14:35:26 -04:00
parent a45f6b4ce0
commit f17bc110aa
2 changed files with 69 additions and 60 deletions

View File

@ -80,29 +80,38 @@ byte hexDigit(char c)
/************************************************************ /************************************************************
* convert a hex byte (00 - ff) to byte * Convert a hex string to a uint32_t value.
* @param c-string with the hex value of the byte * Skips leading spaces and terminates on the first non-hex
* @return byte represented by the digits * character. Leading zeroes are not required.
************************************************************/ *
byte hexByte(char * a) * No error checking is performed - if no hex is found then
{ * defaultValue is returned. Similarly, a hex string of more than
return (hexDigit(a[0]) << 4) | hexDigit(a[1]); * 8 digits will return the value of the last 8 digits.
} * @param pointer to string with the hex value of the word (modified)
/************************************************************
* convert a hex word (0000 - ffff) to unsigned int
* @param c-string with the hex value of the word
* @return unsigned int represented by the digits * @return unsigned int represented by the digits
************************************************************/ ************************************************************/
unsigned int hexWord(char * data) uint32_t getHex32(char *& pData, uint32_t defaultValue=0)
{ {
return (hexDigit(data[0]) << 12) | uint32_t u32 = 0;
(hexDigit(data[1]) << 8) |
(hexDigit(data[2]) << 4) |
(hexDigit(data[3]));
}
while (isspace(*pData))
{
++pData;
}
if (isxdigit(*pData))
{
while (isxdigit(*pData)) {
u32 = (u32 << 4) | hexDigit(*pData++);
}
}
else
{
u32 = defaultValue;
}
return u32;
}
void printByte(byte b) void printByte(byte b)
{ {
@ -153,9 +162,10 @@ void loop()
static void commandLoop() static void commandLoop()
{ {
byte b; byte b;
word w; uint32_t arg;
const uint32_t noValue = uint32_t(-1);
char line[20]; char line[20];
uint32_t numBytes; char * cursor = line + 1;
unsigned long timeStart; unsigned long timeStart;
unsigned long timeEnd; unsigned long timeEnd;
bool cmdError = false; bool cmdError = false;
@ -171,22 +181,20 @@ static void commandLoop()
switch (c) switch (c)
{ {
case 'a': case 'a':
if (hexDigit(line[1]) <= 15) if ((arg = getHex32(cursor, noValue)) != noValue)
{ {
w = hexWord(line + 1); prom.setAddress(word(arg));
prom.setAddress(w);
} }
else else
cmdError = true; cmdError = true;
break; break;
case 'd': case 'd':
if (hexDigit(line[1]) <= 15) if ((arg = getHex32(cursor, noValue)) != noValue)
{ {
prom.disableOutput(); prom.disableOutput();
prom.setDataBusMode(OUTPUT); prom.setDataBusMode(OUTPUT);
b = hexByte(line + 1); prom.writeDataBus(byte(arg));
prom.writeDataBus(b);
} }
else else
cmdError = true; cmdError = true;
@ -202,18 +210,18 @@ static void commandLoop()
else else
{ {
bool enable = line[1] == 'e'; bool enable = line[1] == 'e';
if (c == 'c') if (c == 'c') {
if (enable) prom.enableChip(); else prom.disableChip(); if (enable) prom.enableChip(); else prom.disableChip();
else if (c == 'w') } else if (c == 'w') {
if (enable) prom.enableWrite(); else prom.disableWrite(); if (enable) prom.enableWrite(); else prom.disableWrite();
else { // c == 'o' } else { // c == 'o'
if (enable) if (enable) {
{
// Don't allow the prom and the data bus to output at the same time // Don't allow the prom and the data bus to output at the same time
prom.setDataBusMode(INPUT); prom.setDataBusMode(INPUT);
prom.enableOutput(); prom.enableOutput();
} else {
prom.disableOutput();
} }
else prom.disableOutput();
} }
} }
break; break;
@ -261,4 +269,3 @@ static void commandLoop()
Serial.println(F(" U - Send Unlock sequence to disable device Software Data Protection")); Serial.println(F(" U - Send Unlock sequence to disable device Software Data Protection"));
} }
} }

View File

@ -99,25 +99,27 @@ lines from the Arduino. The result should be measured at the target PROM footpr
at the Arduino. To fully test, use a multimeter to verify that the lines that should be at the Arduino. To fully test, use a multimeter to verify that the lines that should be
active are active and that any other lines are not. active are active and that any other lines are not.
Note that the Dx and Ax commands can be a bit confusing. The command _D5_ means "set the value 05 HEX on the eight data lines". It does not specifically refer to the D<sub>5</sub> data pin on the ROM or the D5 pin on the Arduino. In the example above, 05 HEX is the same as 00000101 BINARY. This would set the ROM D<sub>0</sub> and D<sub>2</sub> pins HIGH and the other six pins would be LOW.
### Testing the data bus ### Testing the data bus
Issue a set of Data commands from the Hardware Verify sketch and measure EACH data line at Issue a set of Data commands from the Hardware Verify sketch and measure EACH data line at
the PROM footprint. **If the expected result is "D0 HIGH", verify not only that D0 reads the PROM footprint. **If the expected result is "D<sub>0</sub> HIGH", verify not only
HIGH, but that all of the other lines read LOW.** that D<sub>0</sub> reads HIGH, but that all of the other lines read LOW.**
Data test commands Data test commands
|Command|Result| |Command|Result|
|:--- |:--- | |:--- |:--- |
|D0 |All data lines LOW| |D0 |All data lines LOW|
|D1 |D0 HIGH| |D1 |D<sub>0</sub> HIGH|
|D2 |D1 HIGH| |D2 |D<sub>1</sub> HIGH|
|D4 |D2 HIGH| |D4 |D<sub>2</sub> HIGH|
|D8 |D3 HIGH| |D8 |D<sub>3</sub> HIGH|
|D10 |D4 HIGH| |D10 |D<sub>4</sub> HIGH|
|D20 |D5 HIGH| |D20 |D<sub>5</sub> HIGH|
|D40 |D6 HIGH| |D40 |D<sub>6</sub> HIGH|
|D80 |D7 HIGH| |D80 |D<sub>7</sub> HIGH|
|Dff |all data lines HIGH| |Dff |all data lines HIGH|
### Testing the address lines ### Testing the address lines
@ -128,21 +130,21 @@ other address lines as well.
|Command|Result| |Command|Result|
|:--- |:--- | |:--- |:--- |
|A0 |All address lines LOW| |A0 |All address lines LOW|
|A1 |A0 HIGH| |A1 |A<sub>0</sub> HIGH|
|A2 |A1 HIGH| |A2 |A<sub>1</sub> HIGH|
|A4 |A2 HIGH| |A4 |A<sub>2</sub> HIGH|
|A8 |A3 HIGH| |A8 |A<sub>3</sub> HIGH|
|A10 |A4 HIGH| |A10 |A<sub>4</sub> HIGH|
|A20 |A5 HIGH| |A20 |A<sub>5</sub> HIGH|
|A40 |A6 HIGH| |A40 |A<sub>6</sub> HIGH|
|A80 |A7 HIGH| |A80 |A<sub>7</sub> HIGH|
|A100 |A8 HIGH| |A100 |A<sub>8</sub> HIGH|
|A200 |A9 HIGH| |A200 |A<sub>9</sub> HIGH|
|A400 |A10 HIGH| |A400 |A<sub>10</sub> HIGH|
|A800 |A11 HIGH| |A800 |A<sub>11</sub> HIGH|
|A1000 |A12 HIGH| |A1000 |A<sub>12</sub> HIGH|
|A2000 |A13 HIGH| |A2000 |A<sub>13</sub> HIGH|
|A4000 |A14 HIGH| |A4000 |A<sub>14</sub> HIGH|
|A7fff |all address lines HIGH| |A7fff |all address lines HIGH|
### Testing the control lines ### Testing the control lines
@ -161,6 +163,6 @@ commands are complete.
|Ce | Chip Enable (CE) LOW, others HIGH| |Ce | Chip Enable (CE) LOW, others HIGH|
|Cd | CE, OE, WE all HIGH| |Cd | CE, OE, WE all HIGH|
|Oe | Output Enable (OE) LOW, others HIGH| |Oe | Output Enable (OE) LOW, others HIGH|
|Cd | CE, OE, WE all HIGH| |Od | CE, OE, WE all HIGH|
|We | Write Enable (WE) LOW, others HIGH| |We | Write Enable (WE) LOW, others HIGH|
|Wd | CE, OE, WE all HIGH| |Wd | CE, OE, WE all HIGH|