Diff for /qemu/hw/tosa.c between versions 1.1.1.7 and 1.1.1.8

version 1.1.1.7, 2018/04/24 19:28:24 version 1.1.1.8, 2018/04/24 19:48:09
Line 6 Line 6
  *   *
  * Code based on spitz platform by Andrzej Zaborowski <balrog@zabor.org>   * Code based on spitz platform by Andrzej Zaborowski <balrog@zabor.org>
  * This code is licensed under the GNU GPL v2.   * This code is licensed under the GNU GPL v2.
    *
    * Contributions after 2012-01-13 are licensed under the terms of the
    * GNU GPL, version 2 or (at your option) any later version.
  */   */
   
 #include "hw.h"  #include "hw.h"
Line 130  static int tosa_ssp_init(SSISlave *dev) Line 133  static int tosa_ssp_init(SSISlave *dev)
 }  }
   
 typedef struct {  typedef struct {
     i2c_slave i2c;      I2CSlave i2c;
     int len;      int len;
     char buf[3];      char buf[3];
 } TosaDACState;  } TosaDACState;
   
 static int tosa_dac_send(i2c_slave *i2c, uint8_t data)  static int tosa_dac_send(I2CSlave *i2c, uint8_t data)
 {  {
     TosaDACState *s = FROM_I2C_SLAVE(TosaDACState, i2c);      TosaDACState *s = FROM_I2C_SLAVE(TosaDACState, i2c);
     s->buf[s->len] = data;      s->buf[s->len] = data;
Line 154  static int tosa_dac_send(i2c_slave *i2c, Line 157  static int tosa_dac_send(i2c_slave *i2c,
     return 0;      return 0;
 }  }
   
 static void tosa_dac_event(i2c_slave *i2c, enum i2c_event event)  static void tosa_dac_event(I2CSlave *i2c, enum i2c_event event)
 {  {
     TosaDACState *s = FROM_I2C_SLAVE(TosaDACState, i2c);      TosaDACState *s = FROM_I2C_SLAVE(TosaDACState, i2c);
     s->len = 0;      s->len = 0;
Line 177  static void tosa_dac_event(i2c_slave *i2 Line 180  static void tosa_dac_event(i2c_slave *i2
     }      }
 }  }
   
 static int tosa_dac_recv(i2c_slave *s)  static int tosa_dac_recv(I2CSlave *s)
 {  {
     printf("%s: recv not supported!!!\n", __FUNCTION__);      printf("%s: recv not supported!!!\n", __FUNCTION__);
     return -1;      return -1;
 }  }
   
 static int tosa_dac_init(i2c_slave *i2c)  static int tosa_dac_init(I2CSlave *i2c)
 {  {
     /* Nothing to do.  */      /* Nothing to do.  */
     return 0;      return 0;
Line 208  static void tosa_init(ram_addr_t ram_siz Line 211  static void tosa_init(ram_addr_t ram_siz
                 const char *initrd_filename, const char *cpu_model)                  const char *initrd_filename, const char *cpu_model)
 {  {
     MemoryRegion *address_space_mem = get_system_memory();      MemoryRegion *address_space_mem = get_system_memory();
       MemoryRegion *rom = g_new(MemoryRegion, 1);
     PXA2xxState *cpu;      PXA2xxState *cpu;
     TC6393xbState *tmio;      TC6393xbState *tmio;
     DeviceState *scp0, *scp1;      DeviceState *scp0, *scp1;
Line 217  static void tosa_init(ram_addr_t ram_siz Line 221  static void tosa_init(ram_addr_t ram_siz
   
     cpu = pxa255_init(address_space_mem, tosa_binfo.ram_size);      cpu = pxa255_init(address_space_mem, tosa_binfo.ram_size);
   
     cpu_register_physical_memory(0, TOSA_ROM,      memory_region_init_ram(rom, "tosa.rom", TOSA_ROM);
                     qemu_ram_alloc(NULL, "tosa.rom", TOSA_ROM) | IO_MEM_ROM);      vmstate_register_ram_global(rom);
       memory_region_set_readonly(rom, true);
       memory_region_add_subregion(address_space_mem, 0, rom);
   
     tmio = tc6393xb_init(address_space_mem, 0x10000000,      tmio = tc6393xb_init(address_space_mem, 0x10000000,
             qdev_get_gpio_in(cpu->gpio, TOSA_GPIO_TC6393XB_INT));              qdev_get_gpio_in(cpu->gpio, TOSA_GPIO_TC6393XB_INT));
Line 253  static void tosapda_machine_init(void) Line 259  static void tosapda_machine_init(void)
   
 machine_init(tosapda_machine_init);  machine_init(tosapda_machine_init);
   
 static I2CSlaveInfo tosa_dac_info = {  static void tosa_dac_class_init(ObjectClass *klass, void *data)
     .qdev.name = "tosa_dac",  {
     .qdev.size = sizeof(TosaDACState),      I2CSlaveClass *k = I2C_SLAVE_CLASS(klass);
     .init = tosa_dac_init,  
     .event = tosa_dac_event,      k->init = tosa_dac_init;
     .recv = tosa_dac_recv,      k->event = tosa_dac_event;
     .send = tosa_dac_send      k->recv = tosa_dac_recv;
       k->send = tosa_dac_send;
   }
   
   static TypeInfo tosa_dac_info = {
       .name          = "tosa_dac",
       .parent        = TYPE_I2C_SLAVE,
       .instance_size = sizeof(TosaDACState),
       .class_init    = tosa_dac_class_init,
 };  };
   
 static SSISlaveInfo tosa_ssp_info = {  static void tosa_ssp_class_init(ObjectClass *klass, void *data)
     .qdev.name = "tosa-ssp",  {
     .qdev.size = sizeof(SSISlave),      SSISlaveClass *k = SSI_SLAVE_CLASS(klass);
     .init = tosa_ssp_init,  
     .transfer = tosa_ssp_tansfer      k->init = tosa_ssp_init;
       k->transfer = tosa_ssp_tansfer;
   }
   
   static TypeInfo tosa_ssp_info = {
       .name          = "tosa-ssp",
       .parent        = TYPE_SSI_SLAVE,
       .instance_size = sizeof(SSISlave),
       .class_init    = tosa_ssp_class_init,
 };  };
   
 static void tosa_register_devices(void)  static void tosa_register_types(void)
 {  {
     i2c_register_slave(&tosa_dac_info);      type_register_static(&tosa_dac_info);
     ssi_register_slave(&tosa_ssp_info);      type_register_static(&tosa_ssp_info);
 }  }
   
 device_init(tosa_register_devices)  type_init(tosa_register_types)

Removed from v.1.1.1.7  
changed lines
  Added in v.1.1.1.8


unix.superglobalmegacorp.com