r2242 - in trunk/src/host/qemu-neo1973: . hw

andrew at sita.openmoko.org andrew at sita.openmoko.org
Wed Jun 13 19:12:09 CEST 2007


Author: andrew
Date: 2007-06-13 19:12:06 +0200 (Wed, 13 Jun 2007)
New Revision: 2242

Modified:
   trunk/src/host/qemu-neo1973/Makefile.target
   trunk/src/host/qemu-neo1973/hw/modem.c
   trunk/src/host/qemu-neo1973/hw/nand.c
   trunk/src/host/qemu-neo1973/hw/neo1973.c
   trunk/src/host/qemu-neo1973/hw/usb.h
   trunk/src/host/qemu-neo1973/vl.c
   trunk/src/host/qemu-neo1973/vl.h
Log:
Add a primitive bluetooth subsystem (there are no bluetooth slaves yet, only an HCI).


Modified: trunk/src/host/qemu-neo1973/Makefile.target
===================================================================
--- trunk/src/host/qemu-neo1973/Makefile.target	2007-06-13 17:10:30 UTC (rev 2241)
+++ trunk/src/host/qemu-neo1973/Makefile.target	2007-06-13 17:12:06 UTC (rev 2242)
@@ -409,11 +409,14 @@
 
 # USB layer
 VL_OBJS+= usb.o usb-hub.o usb-linux.o usb-hid.o usb-ohci.o usb-msd.o usb-net.o
-VL_OBJS+= usb-linux-gadget.o
+VL_OBJS+= usb-linux-gadget.o usb-bt.o
 
 # EEPROM emulation
 VL_OBJS += eeprom93xx.o
 
+# Bluetooth subsystem
+VL_OBJS += bt-hci.o
+
 # PCI network cards
 VL_OBJS += eepro100.o
 VL_OBJS += ne2000.o

Modified: trunk/src/host/qemu-neo1973/hw/modem.c
===================================================================
--- trunk/src/host/qemu-neo1973/hw/modem.c	2007-06-13 17:10:30 UTC (rev 2241)
+++ trunk/src/host/qemu-neo1973/hw/modem.c	2007-06-13 17:12:06 UTC (rev 2242)
@@ -28,11 +28,16 @@
     struct gsmmodem_info_s info;
 };
 
-#define TICALYPSO_MANF	"<manufacturer>"
-#define TICALYPSO_MODEL	"<model>"
-#define TICALYPSO_REV	"<revision>"
-#define TICALYPSO_IMEI	"<serial number>"
+#define TICALYPSOv3_MANF	"<manufacturer>"
+#define TICALYPSOv3_MODEL	"<model>"
+#define TICALYPSOv3_REV		"<revision>"
+#define TICALYPSOv3_IMEI	"<serial number>"
 
+#define TICALYPSOv4_MANF	"FIC"
+#define TICALYPSOv4_MODEL	"GTA01 Embedded GSM Modem"
+#define TICALYPSOv4_REV		"GTA01Bv4"
+#define TICALYPSOv4_IMEI	"354651010000000"
+
 static gn_error modem_ops(gn_operation op, gn_data *data,
                 struct gn_statemachine *sm)
 {
@@ -66,22 +71,22 @@
         break;
 
     case GN_OP_GetImei:
-        strcpy(data->imei, TICALYPSO_IMEI);
+        strcpy(data->imei, TICALYPSOv4_IMEI);
         break;
 
     case GN_OP_GetRevision:
-        strcpy(data->revision, TICALYPSO_REV);
+        strcpy(data->revision, TICALYPSOv4_REV);
         break;
 
     case GN_OP_GetModel:
-        strcpy(data->revision, TICALYPSO_MODEL);
+        strcpy(data->revision, TICALYPSOv4_MODEL);
         break;
 
     case GN_OP_Identify:
-        strcpy(data->model, TICALYPSO_MODEL);
-        strcpy(data->revision, TICALYPSO_REV);
-        strcpy(data->imei, TICALYPSO_IMEI);
-        strcpy(data->manufacturer, TICALYPSO_MANF);
+        strcpy(data->model, TICALYPSOv4_MODEL);
+        strcpy(data->revision, TICALYPSOv4_REV);
+        strcpy(data->imei, TICALYPSOv4_IMEI);
+        strcpy(data->manufacturer, TICALYPSOv4_MANF);
         break;
 
     default:

Modified: trunk/src/host/qemu-neo1973/hw/nand.c
===================================================================
--- trunk/src/host/qemu-neo1973/hw/nand.c	2007-06-13 17:10:30 UTC (rev 2241)
+++ trunk/src/host/qemu-neo1973/hw/nand.c	2007-06-13 17:12:06 UTC (rev 2242)
@@ -356,11 +356,10 @@
         }
         if (value == NAND_CMD_READ0)
             s->offset = 0;
-	else if (value == NAND_CMD_READ1) {
+        else if (value == NAND_CMD_READ1) {
             s->offset = 0x100;
             value = NAND_CMD_READ0;
-        }
-	else if (value == NAND_CMD_READ2) {
+        } else if (value == NAND_CMD_READ2) {
             s->offset = 1 << s->page_shift;
             value = NAND_CMD_READ0;
         }

Modified: trunk/src/host/qemu-neo1973/hw/neo1973.c
===================================================================
--- trunk/src/host/qemu-neo1973/hw/neo1973.c	2007-06-13 17:10:30 UTC (rev 2241)
+++ trunk/src/host/qemu-neo1973/hw/neo1973.c	2007-06-13 17:12:06 UTC (rev 2242)
@@ -419,6 +419,8 @@
 
     neo_gsm_setup(s);
 
+    usb_device_attach(usb_bt_init(local_piconet));
+
     /* Setup initial (reset) machine state */
     qemu_register_reset(neo_reset, s);
 #if 0

Modified: trunk/src/host/qemu-neo1973/hw/usb.h
===================================================================
--- trunk/src/host/qemu-neo1973/hw/usb.h	2007-06-13 17:10:30 UTC (rev 2241)
+++ trunk/src/host/qemu-neo1973/hw/usb.h	2007-06-13 17:12:06 UTC (rev 2242)
@@ -228,3 +228,6 @@
 
 /* usb-net.c */
 USBDevice *usb_net_init(NICInfo *nd);
+
+/* usb-bt.c */
+USBDevice *usb_bt_init(struct bt_piconet_s *net);

Modified: trunk/src/host/qemu-neo1973/vl.c
===================================================================
--- trunk/src/host/qemu-neo1973/vl.c	2007-06-13 17:10:30 UTC (rev 2241)
+++ trunk/src/host/qemu-neo1973/vl.c	2007-06-13 17:12:06 UTC (rev 2242)
@@ -201,6 +201,7 @@
 unsigned int nb_prom_envs = 0;
 const char *prom_envs[MAX_PROM_ENVS];
 #endif
+struct bt_piconet_s *local_piconet;
 
 /***********************************************************/
 /* x86 ISA bus support */
@@ -4312,6 +4313,32 @@
     usb_gadget = device;
 }
 
+int usb_device_attach(USBDevice *dev)
+{
+    USBPort *port;
+
+    /* Find a USB port to add the device to.  */
+    port = free_usb_ports;
+    if (!port->next) {
+        USBDevice *hub;
+
+        /* Create a new hub and chain it on.  */
+        free_usb_ports = NULL;
+        port->next = used_usb_ports;
+        used_usb_ports = port;
+
+        hub = usb_hub_init(VM_USB_HUB_SIZE);
+        usb_attach(port, hub);
+        port = free_usb_ports;
+    }
+
+    free_usb_ports = port->next;
+    port->next = used_usb_ports;
+    used_usb_ports = port;
+    usb_attach(port, dev);
+    return 0;
+}
+
 static int usb_device_add(const char *devname)
 {
     const char *p;
@@ -4327,7 +4354,8 @@
             usb_gadget_config_set(port, strtoul(&p[1], NULL, 0));
         else if (p[0] != 0)
             return -1;
-        goto attach;
+        usb_attach(port, dev);
+        return 0;
     }
 
     if (!free_usb_ports)
@@ -4352,27 +4380,7 @@
     if (!dev)
         return -1;
 
-    /* Find a USB port to add the device to.  */
-    port = free_usb_ports;
-    if (!port->next) {
-        USBDevice *hub;
-
-        /* Create a new hub and chain it on.  */
-        free_usb_ports = NULL;
-        port->next = used_usb_ports;
-        used_usb_ports = port;
-
-        hub = usb_hub_init(VM_USB_HUB_SIZE);
-        usb_attach(port, hub);
-        port = free_usb_ports;
-    }
-
-    free_usb_ports = port->next;
-    port->next = used_usb_ports;
-    used_usb_ports = port;
-attach:
-    usb_attach(port, dev);
-    return 0;
+    return usb_device_attach(dev);
 }
 
 static int usb_device_del(const char *devname)
@@ -8157,6 +8165,8 @@
         }
     }
 
+    local_piconet = qemu_mallocz(sizeof(struct bt_piconet_s));
+
     machine->init(ram_size, vga_ram_size, boot_device,
                   ds, fd_filename, snapshot,
                   kernel_filename, kernel_cmdline, initrd_filename, cpu_model);

Modified: trunk/src/host/qemu-neo1973/vl.h
===================================================================
--- trunk/src/host/qemu-neo1973/vl.h	2007-06-13 17:10:30 UTC (rev 2241)
+++ trunk/src/host/qemu-neo1973/vl.h	2007-06-13 17:12:06 UTC (rev 2242)
@@ -1135,6 +1135,10 @@
 
 #include "hw/smbus.h"
 
+/* Bluetooth */
+#include "hw/bt.h"
+extern struct bt_piconet_s *local_piconet;
+
 /* acpi.c */
 extern int acpi_enabled;
 i2c_bus *piix4_pm_init(PCIBus *bus, int devfn);
@@ -1375,6 +1379,7 @@
 void do_usb_del(const char *devname);
 void usb_info(void);
 void usb_slave_info(void);
+int usb_device_attach(USBDevice *dev);
 
 /* scsi-disk.c */
 enum scsi_reason {





More information about the commitlog mailing list