IBASE MRS-801-RE User Manual

Page 75

Advertising
background image

Copyright © 2013 IBASE Technology Inc. All Rights Reserved.

67

IBASE Technology Inc.

printf("Warning - readback failed\n");

} else

if (res != value) {

printf("Warning - data mismatch - wrote "

"0x%0*x, read back 0x%0*x\n",

size == I2C_SMBUS_WORD_DATA ? 4 : 2, value,

size == I2C_SMBUS_WORD_DATA ? 4 : 2, res);

} else {

printf("Value 0x%0*x written, readback matched\n",

size == I2C_SMBUS_WORD_DATA ? 4 : 2, value);

}

exit(0);

}

Utils/headers

/*

i2cbusses: Print the installed i2c busses for both 2.4 and 2.6 kernels.

Part of user-space programs to access for I2C

devices.

*/

/* For strdup and snprintf */

#define _BSD_SOURCE 1

#include <sys/types.h>

#include <sys/stat.h>

#include <sys/param.h> /* for NAME_MAX */

#include <sys/ioctl.h>

#include <string.h>

#include <strings.h> /* for strcasecmp() */

#include <stdio.h>

#include <stdlib.h>

#include <unistd.h>

#include <limits.h>

#include <dirent.h>

#include <fcntl.h>

#include <errno.h>

Advertising