summaryrefslogtreecommitdiff
path: root/src/sp12.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/sp12.c')
-rw-r--r--src/sp12.c204
1 files changed, 97 insertions, 107 deletions
diff --git a/src/sp12.c b/src/sp12.c
index 0f219ab..7c59a0d 100644
--- a/src/sp12.c
+++ b/src/sp12.c
@@ -34,25 +34,25 @@
#include <time.h>
#include "sp12.h"
-#define VERSION "2.1.1"
+#define VERSION "2.1.2"
const char USAGE[] = {
" SP12/32 version %s: A serial programmer for Atmel AVR uCs.\n"
" Copyright (C) 1997-2008 Ken Huntington, Kevin Towers,\n"
" Artur Pundsack, Pitronics.\n"
- "SYNOPSIS\n"
+ "SYNOPSIS\n"
" sp12 {-options} [filename or address(:data)] {-options} [filename...\n"
"OPTIONS\n"
" i[nnn] - init E - chip erase\n"
- " e - eprom area B - blank check\n"
+ " e - eprom area B - blank check\n"
" p - program area C - calculate checksum\n"
" w - write to L[n...n] - lock fuses\n"
" r - read from F[n...n] - fuses\n"
- " a - address(:data) next H[n...n] - high fuses\n"
+ " a - address(:data) next H[n...n] - high fuses\n"
" f - filename next X[n...n] - extended fuses\n"
- " I - create Intel Hex file c[nn] - calibration byte(s)\n"
- " h - hex dump with ascii M<n.n> - match Sck to uC clock\n"
+ " I - create Intel Hex file c[nn] - calibration byte(s)\n"
+ " h - hex dump with ascii M<n.n> - match Sck to uC clock\n"
" o0, o1 - optimization P<nnn> - parallel port control\n"
" s - show supported uCs t - timing check\n"
"EXAMPLES\n"
@@ -105,22 +105,24 @@ static unsigned int *flashBuf; /* flash buffer */
static unsigned int *eepromBuf; /* eeprom buffer */
static clock_t sp12Start, sp12End;
static double sp12Elapsed;
-
+
void exitSp12(int exitState) {
-
+
char binary[9] = "76543210"; /* Stores conversion num to binary */
-
+
portControl(DEFAULT_EXIT_STATE, 1);
num2bin((unsigned char) DEFAULT_EXIT_STATE, binary);
- printf("Writing %#04x (%d, B%s) ",
+ printf("Writing %#04x (%d, B%s) ",
DEFAULT_EXIT_STATE, DEFAULT_EXIT_STATE, binary);
printf("to the parallel port data bits.\n");
sp12End = clock();
sp12Elapsed = ((double) (sp12End - sp12Start)) / CLOCKS_PER_SEC;
printf("Sp12 was active for %#3.2f seconds.\n", sp12Elapsed);
- free(flashBuf);
- free(eepromBuf);
+ if (flashBuf)
+ free(flashBuf);
+ if (eepromBuf)
+ free(eepromBuf);
exit(exitState);
}
@@ -129,7 +131,7 @@ void exitSp12(int exitState) {
/* A or U was used, and say something about it. */
void reportLEFHXcFlag(void) {
-
+
if (lockFlag) {
printf("You have selected option -L to read or write lock fuses,\n");
printf("which has had no effect. Use this option only in combination\n ");
@@ -173,7 +175,7 @@ void reportLEFHXcFlag(void) {
/* and say something about it. */
void reportBflag(void) {
-
+
if (blankChkFlag) {
printf("You have selected option -B for blank check, which has had \n");
printf("no effect. Options -w, -p and -f together cause an automatic\n");
@@ -190,7 +192,7 @@ void reportBflag(void) {
int blank_check(void) {
int signal = 0;
-
+
printf("Performing blank check...\n");
signal = blankCheck(device.flashLimit, device.eepromLimit);
if (signal == 0)
@@ -215,7 +217,7 @@ void processCommand(void) {
int idx = 0;
/*
- * If it hasn't been done yet, then set the device parameters
+ * If it hasn't been done yet, then set the device parameters
* according to device code and option -i[NN]
*/
if (!device.initPerformed) {
@@ -241,10 +243,10 @@ void processCommand(void) {
/*
* It doesn't look like a 1200. If a uC is connected,
* the SPI shiftregister is not in synch. We'll now fail
- * if it is an out of synch 1200, but other uCs do
- * echo 0x53 on the third byte of PROGRAM_ENABLE.
+ * if it is an out of synch 1200, but other uCs do
+ * echo 0x53 on the third byte of PROGRAM_ENABLE.
* So we'll try synch pulses for a while.
- */
+ */
enableSPI(0);
deviceCode = setDevicePars(initFlag, identifier);
if (deviceCode == 1) {
@@ -261,14 +263,14 @@ void processCommand(void) {
printf(" device, which may be locked mode 3. \n");
printf(" Access to a supported, mode 3 locked \n");
printf(" device can be regained, but only by \n");
- printf(" erasing it first.\n");
+ printf(" erasing it first.\n");
printf(" Check SP12.doc for details.\n\n");
}
}
if (initFlag == 0) {
- printf("The device code bytes 0,1,2: %#x, %#x, %#x were read\n",
+ printf("The device code bytes 0,1,2: %#x, %#x, %#x were read\n",
device.sigByte_0, device.sigByte_1, device.sigByte_2);
- printf("from parallel port %#x and indicate the following:\n",
+ printf("from parallel port %#x and indicate the following:\n",
portAddress);
printf("You have connected an %s\n", device.name);
printf("The device was made by %s\n\n", device.madeBy);
@@ -278,7 +280,7 @@ void processCommand(void) {
exitSp12(1);
}
if (initFlag != 0 && device.flashLimit != 0) {
- printf("Device code check OVERRULED! Assuming an %s\n\n",
+ printf("Device code check OVERRULED! Assuming an %s\n\n",
device.name);
}
/*
@@ -342,7 +344,7 @@ void processCommand(void) {
prevClkSpeed = clkSpeed;
}
clkSpeed = 0;
- /*
+ /*
* if r --> p || e || F || L
* rp --> rpf --> read program area; write to file
* rpa --> read program address to stdout
@@ -381,7 +383,7 @@ void processCommand(void) {
if (addressAvailable) {
addressAvailable = 0;
flashData = readCodeWord(flashAddress);
- printf("The word %#06x was read from program address %#08x\n",
+ printf("The word %#06x was read from program address %#08x\n",
flashData, flashAddress);
} else {
printf("Reading program area.\n");
@@ -389,7 +391,7 @@ void processCommand(void) {
if (pathAvailable) {
pathAvailable = 0;
printf("Writing program area content to %s\n", flashPath);
- if (fileFlashBuf(flashBuf, device.flashLimit,
+ if (fileFlashBuf(flashBuf, device.flashLimit,
flashPath, IntelFlag, hexAsciiFlag) != 0) {
printf("%s %s\n", FILE_WRITE_ERROR, flashPath);
exitSp12(2);
@@ -409,7 +411,7 @@ void processCommand(void) {
if (checksumFlag) {
checksumFlag = 0;
readFlashArea(flashBuf, device.flashLimit);
- printf("Checksum program area: %04x\n",
+ printf("Checksum program area: %04x\n",
checksum(flashBuf, device.flashLimit));
}
}
@@ -428,7 +430,7 @@ void processCommand(void) {
if (pathAvailable) {
pathAvailable = 0;
printf("Writing eeprom area content to %s\n", eepromPath);
- if (fileEepromBuf(eepromBuf, device.eepromLimit,
+ if (fileEepromBuf(eepromBuf, device.eepromLimit,
eepromPath, IntelFlag, hexAsciiFlag) != 0) {
printf("%s %s\n", FILE_WRITE_ERROR, eepromPath);
exitSp12(2);
@@ -443,8 +445,8 @@ void processCommand(void) {
printf("Address: Data in hex, dec, oct, bin\n");
for (address = 0; address < device.eepromLimit; address++) {
num2bin((unsigned char) eepromBuf[address], binary);
- printf( " %#04lx: %#04x %3d %#4o %s\n",
- address, eepromBuf[address], eepromBuf[address],
+ printf( " %#04lx: %#04x %3d %#4o %s\n",
+ address, eepromBuf[address], eepromBuf[address],
eepromBuf[address], binary);
}
}
@@ -453,7 +455,7 @@ void processCommand(void) {
if (checksumFlag) {
checksumFlag = 0;
readEepromArea(eepromBuf, device.eepromLimit);
- printf("Checksum eeprom area: %04x\n",
+ printf("Checksum eeprom area: %04x\n",
checksum(eepromBuf, device.eepromLimit));
}
}
@@ -461,10 +463,10 @@ void processCommand(void) {
fusesFlag = 0;
rFlag = readFuses(READ_FUSES, fusesBits, R_FUSESLSB, R_FUSESLEN);
if (rFlag == 9) {
- fprintf(stderr, "For the %s: Read_fuses not defined in _sp12dev.\n",
+ fprintf(stderr, "For the %s: Read_fuses not defined in _sp12dev.\n",
device.name);
} else {
- printf("%s are the fuse bits read from an %s\n",
+ printf("%s are the fuse bits read from an %s\n",
fusesBits, device.name);
printf("%s\n", FUSES_MESSAGE);
}
@@ -473,10 +475,10 @@ void processCommand(void) {
highFFlag = 0;
rFlag = readFuses(READ_HIGH_FUSES, fusesBits, RH_FUSESLSB, RH_FUSESLEN);
if (rFlag == 9) {
- fprintf(stderr, "For the %s: Read_high_fuses not defined in _sp12dev.\n",
+ fprintf(stderr, "For the %s: Read_high_fuses not defined in _sp12dev.\n",
device.name);
} else {
- printf("%s are the high fuse bits read from an %s\n",
+ printf("%s are the high fuse bits read from an %s\n",
fusesBits, device.name);
printf("%s\n", H_FUSES_MESSAGE);
}
@@ -485,10 +487,10 @@ void processCommand(void) {
extdFFlag = 0;
rFlag = readFuses(READ_EXTD_FUSES, fusesBits, RX_FUSESLSB, RX_FUSESLEN);
if (rFlag == 9) {
- fprintf(stderr, "For the %s: Read_extd_fuses not defined in _sp12dev.\n",
+ fprintf(stderr, "For the %s: Read_extd_fuses not defined in _sp12dev.\n",
device.name);
} else {
- printf("%s are the extended fuse bits read from an %s\n",
+ printf("%s are the extended fuse bits read from an %s\n",
fusesBits, device.name);
printf("%s\n", X_FUSES_MESSAGE);
}
@@ -497,7 +499,7 @@ void processCommand(void) {
lockFlag = 0;
rFlag = readFuses(READ_LOCK, lockBits, R_LOCKLSB, R_LOCKLEN);
if (rFlag == 9) {
- fprintf(stderr, "For the %s: Read_locks not defined in _sp12dev.\n",
+ fprintf(stderr, "For the %s: Read_locks not defined in _sp12dev.\n",
device.name);
} else {
printf("%s are the lock bits read from an %s\n", lockBits, device.name);
@@ -509,10 +511,10 @@ void processCommand(void) {
command = READ_CALIBRATION | (calibAddress << 8);
rFlag = readFuses(command, calibByte, CALIBLSB, CALIBLEN);
if (rFlag == 9) {
- fprintf(stderr, "For the %s: Read_calibration not defined in _sp12dev.\n",
+ fprintf(stderr, "For the %s: Read_calibration not defined in _sp12dev.\n",
device.name);
} else {
- printf("0x%02lx is the calibration byte read from address 0x%02lx\n",
+ printf("0x%02lx is the calibration byte read from address 0x%02lx\n",
strtol(calibByte, NULL, 2), calibAddress);
printf("%s\n", CALIB_MESSAGE);
}
@@ -520,20 +522,20 @@ void processCommand(void) {
reportLEFHXcFlag();
reportBflag();
- }
+ }
/*
* If w --> p || e
* wp --> f || a
- * wpf --> chip erase;
- * write file to program area
- * wpa --> NO chip erase (warning);
+ * wpf --> chip erase;
+ * write file to program area
+ * wpa --> NO chip erase (warning);
* write address:data
* we --> f || a
* wef --> write file to eeprom area
* wpa --> write address:data
* wF --> write the fuse bits, if possible
* wL --> write the lock bits, if possible
- * check for C; complete write before reading p || e
+ * check for C; complete write before reading p || e
* back into array to compute the checksum
* check for E, R, S but just report them
*/
@@ -557,19 +559,19 @@ void processCommand(void) {
printf(" Chip erase is not automatic; unless you \n");
printf(" used a separate -E command, it may not be \n");
printf(" possible to correctly write new data.\n");
- printf("Writing %#06x into address %#08x in program area.\n",
+ printf("Writing %#06x into address %#08x in program area.\n",
flashData, flashAddress);
error = writeFlashVerified(flashAddress, flashData, optimizeFlag);
if (logWrites(commandStr, flashAddress, flashData, flashPath,
flashBuf, overlayFlag, &error) != 0)
printf("%s %s\n", FILE_WRITE_ERROR, "sp12log.txt");
if (error) {
- printf("Readback ERROR at program address %#06x\n",
+ printf("Readback ERROR at program address %#06x\n",
flashAddress);
exitSp12(3);
}
-
- } else if (pathAvailable) { /* Write file to flash ////////////*/
+
+ } else if (pathAvailable) { /* Write file to flash ////////////*/
pathAvailable = 0;
if (!overlayFlag) {
printf("Performing chip erase...\n");
@@ -582,13 +584,13 @@ void processCommand(void) {
}
/* Read the HEX file */
printf("Writing content of %s into program area.\n", flashPath);
- error = readFlashFile(flashPath, flashBuf, device.flashLimit);
+ error = readFlashFile(flashPath, flashBuf, device.flashLimit);
if (error) {
printf("%s %s\n", flashPath, FILE_ERROR);
exitSp12(2);
}
/* Now copy file to flash */
- error = writeFlashArea(flashBuf, device.flashLimit, optimizeFlag);
+ error = writeFlashArea(flashBuf, device.flashLimit, optimizeFlag);
if (logWrites(commandStr, flashAddress, flashData, flashPath,
flashBuf, overlayFlag, &error) != 0)
printf("%s %s\n", FILE_WRITE_ERROR, "sp12log.txt");
@@ -600,13 +602,13 @@ void processCommand(void) {
} else {
printf("%s written and verified.\n", flashPath);
printf("write retries: %d\n", writeRetries);
- }
+ }
} /* Up to here the file to flash functions///////////////////*/
if (checksumFlag) {
checksumFlag = 0;
readFlashArea(flashBuf, device.flashLimit);
- printf("Checksum program area: %04x\n",
+ printf("Checksum program area: %04x\n",
checksum(flashBuf, device.flashLimit));
}
}
@@ -614,14 +616,14 @@ void processCommand(void) {
eepromFlag = 0;
if (addressAvailable) {
addressAvailable = 0;
- printf("Writing %#x into address %#x in eeprom area.\n",
+ printf("Writing %#x into address %#x in eeprom area.\n",
eepromData, eepromAddress);
error=writeEepromVerified(eepromAddress, eepromData, optimizeFlag);
if (logWrites(commandStr, eepromAddress, eepromData, eepromPath,
eepromBuf, overlayFlag, &error) != 0)
printf("%s %s\n", FILE_WRITE_ERROR, "sp12log.txt");
if (error) {
- printf("Readback ERROR at eeprom address %#04x\n",
+ printf("Readback ERROR at eeprom address %#04x\n",
eepromAddress);
exitSp12(3);
}
@@ -633,7 +635,7 @@ void processCommand(void) {
printf("%s %s\n", eepromPath, FILE_ERROR);
exitSp12(2);
}
- error = writeEepromArea(eepromBuf, device.eepromLimit,
+ error = writeEepromArea(eepromBuf, device.eepromLimit,
optimizeFlag, overlayFlag);
if (logWrites(commandStr, eepromAddress, eepromData, eepromPath,
eepromBuf, overlayFlag, &error) != 0)
@@ -644,14 +646,14 @@ void processCommand(void) {
} else {
printf("%s written and verified.\n", eepromPath);
printf("write retries: %d, byteWrite: %ld percent of default\n",
- writeRetries,
+ writeRetries,
(timeConst.byteWrite * 100) / timeConst.byteWriteDefault);
- }
+ }
}
if (checksumFlag) {
checksumFlag = 0;
readEepromArea(eepromBuf, device.eepromLimit);
- printf("Checksum eeprom area: %04x\n",
+ printf("Checksum eeprom area: %04x\n",
checksum(eepromBuf, device.eepromLimit));
}
reportBflag();
@@ -662,13 +664,14 @@ void processCommand(void) {
rFlag = writeFuses(WRITE_LOCK_HM, WRITE_LOCK_LM, lockBits, \
W_LOCKLSB, W_LOCKLEN);
if (rFlag == 9) {
- fprintf(stderr, "For the %s: Write_lock not defined in _sp12dev.\n", device.name);
+ fprintf(stderr, "For the %s: Write_lock not defined in _sp12dev.\n",
+ device.name);
} else if (rFlag == 2) {
- fprintf(stderr, "For the %s: Wrong number of lock bits, expect %d.\n", device.name, W_LOCKLEN);
+ fprintf(stderr, "For the %s: Wrong number of lock bits.\n", device.name);
} else {
for (idx = 0; idx < R_LOCKLEN - W_LOCKLEN; idx++)
printf(" ");
- printf("%s are the lock bits written into an %s\n%s\n",
+ printf("%s are the lock bits written into an %s\n%s\n",
lockBits, device.name, LOCK_MESSAGE);
}
}
@@ -677,13 +680,14 @@ void processCommand(void) {
rFlag = writeFuses(WRITE_FUSES_HM, WRITE_FUSES_LM, fusesBits, \
W_FUSESLSB, W_FUSESLEN);
if (rFlag == 9) {
- fprintf(stderr, "For the %s: Write_fuses not defined in _sp12dev.\n", device.name);
+ fprintf(stderr, "For the %s: Write_fuses not defined in _sp12dev.\n",
+ device.name);
} else if (rFlag == 2) {
- fprintf(stderr, "For the %s; Wrong number of fuse bits, expect %d.\n", device.name, W_FUSESLEN);
+ fprintf(stderr, "For the %s; Wrong number of fuse bits.\n", device.name);
} else {
for (idx = 0; idx < (R_FUSESLEN - W_FUSESLEN) - W_FUSESLSB; idx++)
printf(" ");
- printf("%s are the fuse bits written into an %s\n%s\n",
+ printf("%s are the fuse bits written into an %s\n%s\n",
fusesBits, device.name, FUSES_MESSAGE);
}
}
@@ -692,13 +696,15 @@ void processCommand(void) {
rFlag = writeFuses(WRITE_HIGH_FUSES_HM, WRITE_HIGH_FUSES_LM, fusesBits, \
WH_FUSESLSB, WH_FUSESLEN);
if (rFlag == 9) {
- fprintf(stderr, "For the %s: Write_high_fuses not defined in _sp12dev.\n", device.name);
+ fprintf(stderr, "For the %s: Write_high_fuses not defined in _sp12dev.\n",
+ device.name);
} else if (rFlag == 2) {
- fprintf(stderr, "For the %s; Wrong number of high fuse bits, expect %d.\n", device.name, WH_FUSESLEN);
+ fprintf(stderr, "For the %s; Wrong number of high fuse bits.\n",
+ device.name);
} else {
for (idx = 0; idx < (RH_FUSESLEN - WH_FUSESLEN) - WH_FUSESLSB; idx++)
printf(" ");
- printf("%s are the high fuse bits written into an %s\n%s\n",
+ printf("%s are the high fuse bits written into an %s\n%s\n",
fusesBits, device.name, H_FUSES_MESSAGE);
}
}
@@ -707,13 +713,15 @@ void processCommand(void) {
rFlag = writeFuses(WRITE_EXTD_FUSES_HM, WRITE_EXTD_FUSES_LM, fusesBits, \
WX_FUSESLSB, WX_FUSESLEN);
if (rFlag == 9) {
- fprintf(stderr, "For the %s: Write_extd_fuses not defined in _sp12dev.\n", device.name);
+ fprintf(stderr, "For the %s: Write_extd_fuses not defined in _sp12dev.\n",
+ device.name);
} else if (rFlag == 2) {
- fprintf(stderr, "For the %s; Wrong number of extended fuse bits, expect %d.\n", device.name, WX_FUSESLEN);
+ fprintf(stderr, "For the %s; Wrong number of high fuse bits.\n",
+ device.name);
} else {
for (idx = 0; idx < (RX_FUSESLEN - WX_FUSESLEN) - WX_FUSESLSB; idx++)
printf(" ");
- printf("%s are the extended fuse bits written into an %s\n%s\n",
+ printf("%s are the extended fuse bits written into an %s\n%s\n",
fusesBits, device.name, X_FUSES_MESSAGE);
}
}
@@ -722,11 +730,11 @@ void processCommand(void) {
}
/*
* if C --> (p || e) || ((p || e) && f)
- * Cp(f) --> read program area (file) into
- * device.flashLimit word array;
+ * Cp(f) --> read program area (file) into
+ * device.flashLimit word array;
* calculate checksum for array
- * Ce(f) --> read eeprom area (file) into
- * device.eepromLimit byte array;
+ * Ce(f) --> read eeprom area (file) into
+ * device.eepromLimit byte array;
* calculate checksum for array
* check for L, E, B, F, R, S but just report them
*/
@@ -736,17 +744,17 @@ void processCommand(void) {
eepromFlag = 0;
if (pathAvailable) {
pathAvailable = 0;
- if (readEepromFile(checksumPath, eepromBuf,
+ if (readEepromFile(checksumPath, eepromBuf,
device.eepromLimit) != 0) {
printf("%s %s\n", checksumPath, FILE_ERROR);
exitSp12(2);
} else {
- printf("Checksum eeprom file %s: %04x\n",
+ printf("Checksum eeprom file %s: %04x\n",
checksumPath, checksum(eepromBuf, device.eepromLimit));
}
} else {
readEepromArea(eepromBuf, device.eepromLimit);
- printf("Checksum eeprom area: %04x\n",
+ printf("Checksum eeprom area: %04x\n",
checksum(eepromBuf, device.eepromLimit));
}
} else if (flashFlag) {
@@ -757,12 +765,12 @@ void processCommand(void) {
printf("%s %s\n", checksumPath, FILE_ERROR);
exitSp12(2);
} else {
- printf("Checksum program file %s: %04x\n",
+ printf("Checksum program file %s: %04x\n",
checksumPath, checksum(flashBuf, device.flashLimit));
}
} else {
readFlashArea(flashBuf, device.flashLimit);
- printf("Checksum program area: %04x\n",
+ printf("Checksum program area: %04x\n",
checksum(flashBuf, device.flashLimit));
}
} else {
@@ -801,9 +809,6 @@ int main(int argc, char *argv[])
char *dataPtr; /* for separating address:data */
int exitFlag = 0;
char binary[9] = "76543210"; /* Stores conversion num to binary */
-#if defined(__OpenBSD__)
- u_long iomap[32];
-#endif
device.initPerformed = 0;
flashPath[0] = '\0';
@@ -822,23 +827,8 @@ int main(int argc, char *argv[])
if (ioperm(0x378,3,1)) {perror("ioperm error at 0x378");exit(1);}
if (ioperm(0x3BC,3,1)) {perror("ioperm error at 0x3BC");exit(1);}
#elif defined(__OpenBSD__)
-#define enable(a, i) do { \
- ((a)[((i) + 0) >> 5] &= ~(1 << (((i) + 0) & 0x1F))); \
- ((a)[((i) + 1) >> 5] &= ~(1 << (((i) + 1) & 0x1F))); \
- ((a)[((i) + 2) >> 5] &= ~(1 << (((i) + 2) & 0x1F))); \
-} while (0)
-
- if (i386_get_ioperm(iomap) != 0) {
- perror("i386_get_ioperm error");
- exit(1);
- }
-
- enable(iomap, 0x278);
- enable(iomap, 0x378);
- enable(iomap, 0x3BC);
-
- if (i386_set_ioperm(iomap) != 0) {
- perror("i386_set_ioperm error");
+ if (amd64_iopl(1) == -1) {
+ perror("amd64_iopl error");
exit(1);
}
#endif
@@ -862,7 +852,7 @@ int main(int argc, char *argv[])
printf("SP12 version %s performing init...\n", VERSION);
initSp12(argv[0]);
}
- /*
+ /*
* allocate our memory buffers
*/
flashBuf = malloc(FLASHBUF_UPPERLIMIT * sizeof (unsigned int));
@@ -970,7 +960,7 @@ int main(int argc, char *argv[])
exitFlag = 0;
portControl(portFlag, exitFlag);
num2bin((unsigned char) portFlag, binary);
- printf("Writing %#04x (%d, B%s) ",
+ printf("Writing %#04x (%d, B%s) ",
portFlag, portFlag, binary);
printf("to the parallel port data bits.\n");
if ((idx + 1) < argc)
@@ -1119,18 +1109,18 @@ int main(int argc, char *argv[])
}
/*
* Exiting with the byte `portFlag' on the parallel port data bits.
- * When the -Tnn option is not (also) used as the final option on
+ * When the -Tnn option is not (also) used as the final option on
* the command line, this defaults to 0x00.
*/
if (SCK == S_SCK && testFlag) {
switch(testFlag) {
- case 1:
+ case 1:
portFlag = RESET;
break;
- case 2:
+ case 2:
portFlag = RESET | PORTPOWER;
break;
- default:
+ default:
break;
}
} else if (testFlag) {
@@ -1139,7 +1129,7 @@ int main(int argc, char *argv[])
if (!portFlag) {
portFlag = DEFAULT_EXIT_STATE;
num2bin((unsigned char) portFlag, binary);
- printf("Writing %#04x (%d, B%s) ",
+ printf("Writing %#04x (%d, B%s) ",
portFlag, portFlag, binary);
printf("to the parallel port data bits.\n");
}