Example #1
0
void
generic_i2c_test_read_write_gpio(void)
{
  unsigned short d;
  unsigned short e;
  unsigned short f;

  printk("Looping on gpio alternately turning on LED1,TP24 and LED2,TP25 \n");
  printk("Pressing either push button will generate an output\n");

  generic_i2c_init_gpio();
  do {
    d= GENERIC_I2C_JUMP_LED1 | GENERIC_I2C_TP28 | GENERIC_I2C_INIT_INPUT;
    generic_i2c_write_gpio(d);
    generic_i2c_read_gpio (&e);
    f = d^e;
    if ( f & (GENERIC_I2C_INIT_OUT_HIGH|GENERIC_I2C_INIT_OUT_LOW ))
      printk("err: wrote: %04x  expected: %04x  dif: %04x \n", d, e, f);

    generic_i2c_val_bit_desc (f, e, gpio_desc); 
    udelay(100000);

    d= GENERIC_I2C_JUMP_LED2 | GENERIC_I2C_TP27;
    generic_i2c_write_gpio(d);
    generic_i2c_read_gpio (&e);
    f = d^e;
    if (f)
      printk("err: wrote: %04x  expected: %04  chg: %04x \n", d, e, f);

    generic_i2c_val_bit_desc (f, e, gpio_desc); 
    udelay(200000);

  } while generic_check_interruption();
}
Example #2
0
int
generic_spi_init(int cs)
{
    /* For now just initialize the i2c, this will be different for bdi/ecos/linux */

    return generic_i2c_init_gpio();
}