#include #include #include #include #include /* defines u_int32_t and friends */ #include #include int main(int argc, char **argv) { u_int8_t w; if (glue_default_init() || glue_enable_lb()) { fprintf(stderr, "Failed to initialise glue-card\n"); exit(1); } glue_enable_i2c(0); /* open channel 0 on the I2C controller */ /* scan for a device at address 0x50 on bus 0 */ if (i2c_scan(I2C_ADDR(0, 0x50), I2C_SCAN_WRITE) == I2C_OK) { printf("Found device at address 0x50\n"); } /* now let's read a word from the local bus (this is the glue-card enable register) */ lb_read_byte(0x10, &w); printf("I read %x at local bus address 0x10\n", w); exit(0); }