IBASE MRS-801-RE User Manual

Page 60

Advertising
background image

52

MRS-801-RE User Manual

"bus, cause data loss and worse!\n");

/* Don't let the user break his/her EEPROMs */

if (address >= 0x50 && address <= 0x57 && pec) {

fprintf(stderr, "STOP! EEPROMs are I2C devices, not "

"SMBus devices. Using PEC\non I2C devices may "

"result in unexpected results, such as\n"

"trashing the contents of EEPROMs. We can't "

"let you do that, sorry.\n");

return 0;

}

if (size == I2C_SMBUS_BYTE && daddress >= 0 && pec) {

fprintf(stderr, "WARNING! All I2C chips and some SMBus chips "

"will interpret a write\nbyte command with PEC as a"

"write byte data command, effectively writing a\n"

"value into a register!\n");

dont++;

}

fprintf(stderr, "I will read from device file %s, chip "

"address 0x%02x, ", filename, address);

if (daddress < 0)

fprintf(stderr, "current data\naddress");

else

fprintf(stderr, "data address\n0x%02x", daddress);

fprintf(stderr, ", using %s.\n",

size == I2C_SMBUS_BYTE ? (daddress < 0 ?

"read byte" : "write byte/read byte") :

size == I2C_SMBUS_BYTE_DATA ? "read byte data" :

"read word data");

if (pec)

fprintf(stderr, "PEC checking enabled.\n");

fprintf(stderr, "Continue? [%s] ", dont ? "y/N" : "Y/n");

fflush(stderr);

if (!user_ack(!dont)) {

fprintf(stderr, "Aborting on user request.\n");

Advertising