r1647 - in trunk/src/host/qemu-neo1973: . hw openmoko

andrew at sita.openmoko.org andrew at sita.openmoko.org
Tue Apr 3 16:17:56 CEST 2007


Author: andrew
Date: 2007-04-03 16:17:53 +0200 (Tue, 03 Apr 2007)
New Revision: 1647

Modified:
   trunk/src/host/qemu-neo1973/hw/neo1973.c
   trunk/src/host/qemu-neo1973/hw/s3c.h
   trunk/src/host/qemu-neo1973/hw/s3c2410.c
   trunk/src/host/qemu-neo1973/openmoko/download.sh
   trunk/src/host/qemu-neo1973/openmoko/env
   trunk/src/host/qemu-neo1973/openmoko/flash.sh
   trunk/src/host/qemu-neo1973/vl.h
Log:
Allow multiple devices on each UART, add modem ioctls.
Invert GSM power-on signal.
Explicitely use bash and GNU make in scripts. (GNU echo is still needed so we're not 100% BSD-friendly yet)


Modified: trunk/src/host/qemu-neo1973/hw/neo1973.c
===================================================================
--- trunk/src/host/qemu-neo1973/hw/neo1973.c	2007-04-03 13:36:14 UTC (rev 1646)
+++ trunk/src/host/qemu-neo1973/hw/neo1973.c	2007-04-03 14:17:53 UTC (rev 1647)
@@ -100,7 +100,7 @@
 
 static void neo_gsm_switch(int line, int level, void *opaque)
 {
-    neo_printf("GSM %sabled.\n", level ? "en" : "dis");
+    neo_printf("GSM %sabled.\n", level ? "dis" : "en");
 }
 
 static void neo_bt_switch(int line, int level, void *opaque)

Modified: trunk/src/host/qemu-neo1973/hw/s3c.h
===================================================================
--- trunk/src/host/qemu-neo1973/hw/s3c.h	2007-04-03 13:36:14 UTC (rev 1646)
+++ trunk/src/host/qemu-neo1973/hw/s3c.h	2007-04-03 14:17:53 UTC (rev 1647)
@@ -109,8 +109,8 @@
 
 struct s3c_uart_state_s;
 struct s3c_uart_state_s *s3c_uart_init(target_phys_addr_t base,
-                void *pic, void *dma, int irq[], int drq[],
-                CharDriverState *chr);
+                void *pic, void *dma, int irq[], int drq[]);
+void s3c_uart_attach(struct s3c_uart_state_s *s, CharDriverState *chr);
 
 struct s3c_adc_state_s;
 struct s3c_adc_state_s *s3c_adc_init(target_phys_addr_t base, void *pic);

Modified: trunk/src/host/qemu-neo1973/hw/s3c2410.c
===================================================================
--- trunk/src/host/qemu-neo1973/hw/s3c2410.c	2007-04-03 13:36:14 UTC (rev 1646)
+++ trunk/src/host/qemu-neo1973/hw/s3c2410.c	2007-04-03 14:17:53 UTC (rev 1647)
@@ -1049,7 +1049,9 @@
     uint8_t rxfifo[16];
     int rxstart;
     int rxlen;
-    CharDriverState *chr;
+#define UART_MAX_CHR	4
+    int chr_num;
+    CharDriverState *chr[UART_MAX_CHR];
 
     uint8_t lcontrol;
     uint8_t fcontrol;
@@ -1074,6 +1076,7 @@
 static void s3c_uart_params_update(struct s3c_uart_state_s *s)
 {
     QEMUSerialSetParams ssp;
+    int i;
     if (!s->chr)
         return;
 
@@ -1097,7 +1100,8 @@
 
     ssp.stop_bits = (s->lcontrol & (1 << 2)) ? 2 : 1;
 
-    qemu_chr_ioctl(s->chr, CHR_IOCTL_SERIAL_SET_PARAMS, &ssp);
+    for (i = 0; i < s->chr_num; i ++)
+        qemu_chr_ioctl(s->chr[i], CHR_IOCTL_SERIAL_SET_PARAMS, &ssp);
 }
 
 static void s3c_uart_err(struct s3c_uart_state_s *s, int err)
@@ -1234,6 +1238,7 @@
 {
     struct s3c_uart_state_s *s = (struct s3c_uart_state_s *) opaque;
     uint8_t ch;
+    int i, afc;
     addr -= s->base;
 
     switch (addr) {
@@ -1256,12 +1261,17 @@
         s->fcontrol = value & 0xf1;
         break;
     case S3C_UMCON:
-        s->mcontrol = value & 0xe1;
+        if ((s->mcontrol ^ value) & (1 << 4)) {
+            afc = (value >> 4) & 1;
+            for (i = 0; i < s->chr_num; i ++)
+                qemu_chr_ioctl(s->chr[i], CHR_IOCTL_MODEM_SET_AFC, &afc);
+        }
+        s->mcontrol = value & 0x11;
         break;
     case S3C_UTXH:
         ch = value & 0xff;
-        if (s->chr)
-            qemu_chr_write(s->chr, &ch, 1);
+        for (i = 0; i < s->chr_num; i ++)
+            qemu_chr_write(s->chr[i], &ch, 1);
         s3c_uart_empty(s);
         break;
     case S3C_UBRDIV:
@@ -1286,8 +1296,7 @@
 };
 
 struct s3c_uart_state_s *s3c_uart_init(target_phys_addr_t base,
-                void *pic, void *dma, int irq[], int drq[],
-                CharDriverState *chr)
+                void *pic, void *dma, int irq[], int drq[])
 {
     int iomemtype;
     struct s3c_uart_state_s *s = (struct s3c_uart_state_s *)
@@ -1298,7 +1307,6 @@
     s->dma = dma;
     s->irq = irq;
     s->drq = drq;
-    s->chr = chr;
 
     s3c_uart_reset(s);
 
@@ -1306,13 +1314,19 @@
                     s3c_uart_writefn, s);
     cpu_register_physical_memory(s->base, 0xfff, iomemtype);
 
-    if (chr)
-        qemu_chr_add_read_handler(chr, s3c_uart_is_empty, s3c_uart_rx, s);
-    /* S3C2410 UART doesn't seem to understand break conditions.  */
-
     return s;
 }
 
+void s3c_uart_attach(struct s3c_uart_state_s *s, CharDriverState *chr)
+{
+    if (s->chr_num >= UART_MAX_CHR)
+        cpu_abort(cpu_single_env, "%s: Too many devices\n", __FUNCTION__);
+    s->chr[s->chr_num ++] = chr;
+
+    qemu_chr_add_read_handler(chr, s3c_uart_is_empty, s3c_uart_rx, s);
+    /* S3C2410 UART doesn't seem to understand break conditions.  */
+}
+
 /* ADC & Touchscreen interface */
 struct s3c_adc_state_s {
     target_phys_addr_t base;
@@ -2189,10 +2203,12 @@
                     s3c_nand_writefn, s);
     cpu_register_physical_memory(s->nand_base, 0xffffff, iomemtype);
 
-    for (i = 0; s3c2410_uart[i].base; i ++)
+    for (i = 0; s3c2410_uart[i].base; i ++) {
         s->uart[i] = s3c_uart_init(s3c2410_uart[i].base, s->pic, s->dma,
-                        s3c2410_uart[i].irq, s3c2410_uart[i].dma,
-                        serial_hds[i]);
+                        s3c2410_uart[i].irq, s3c2410_uart[i].dma);
+        if (serial_hds[i])
+            s3c_uart_attach(s->uart[i], serial_hds[i]);
+    }
 
     s->timers = s3c_timers_init(0x51000000, s->pic, s->dma);
 

Modified: trunk/src/host/qemu-neo1973/openmoko/download.sh
===================================================================
--- trunk/src/host/qemu-neo1973/openmoko/download.sh	2007-04-03 13:36:14 UTC (rev 1646)
+++ trunk/src/host/qemu-neo1973/openmoko/download.sh	2007-04-03 14:17:53 UTC (rev 1647)
@@ -1,4 +1,4 @@
-#! /bin/sh
+#! /bin/bash
 # Chooses and downloads some OpenMoko image snapshots for flash.sh to use.
 #
 # Copyright (C) 2007 OpenMoko, Inc.

Modified: trunk/src/host/qemu-neo1973/openmoko/env
===================================================================
--- trunk/src/host/qemu-neo1973/openmoko/env	2007-04-03 13:36:14 UTC (rev 1646)
+++ trunk/src/host/qemu-neo1973/openmoko/env	2007-04-03 14:17:53 UTC (rev 1647)
@@ -7,6 +7,7 @@
 qemu_relative="arm-softmmu/qemu-system-arm -M neo -m 130"
 qemu="$src_dir/$qemu_relative"
 flash_image=openmoko-flash.image
+make=gmake
 
 kernel_addr=0x32000000
 splash_addr=0x36000000

Modified: trunk/src/host/qemu-neo1973/openmoko/flash.sh
===================================================================
--- trunk/src/host/qemu-neo1973/openmoko/flash.sh	2007-04-03 13:36:14 UTC (rev 1646)
+++ trunk/src/host/qemu-neo1973/openmoko/flash.sh	2007-04-03 14:17:53 UTC (rev 1647)
@@ -1,4 +1,4 @@
-#! /bin/sh
+#! /bin/bash
 # Generates a ready to use OpenMoko NAND flash image.  Vaguely based
 # on devirginator and http://wiki.openmoko.org/wiki/NAND_bad_blocks.
 #
@@ -31,7 +31,7 @@
 	exit -1
 fi
 
-make splash.gz || exit -1
+${make} splash.gz || exit -1
 
 # Find the most recent OpenMoko images in the current directory.
 # We assume they have numeric date or some build number in their names.
@@ -56,7 +56,7 @@
 ln -s $script_dir_relative/$uboot_image $uboot_symlink
 
 rm -rf $flash_image
-make $flash_image || exit -1
+${make} $flash_image || exit -1
 
 # Launch the emulator assuming that u-boot is now functional enough
 # for us to be able to issue u-boot commands.

Modified: trunk/src/host/qemu-neo1973/vl.h
===================================================================
--- trunk/src/host/qemu-neo1973/vl.h	2007-04-03 13:36:14 UTC (rev 1646)
+++ trunk/src/host/qemu-neo1973/vl.h	2007-04-03 14:17:53 UTC (rev 1647)
@@ -292,6 +292,8 @@
 #define CHR_IOCTL_PP_WRITE_CONTROL    6
 #define CHR_IOCTL_PP_READ_STATUS      7
 
+#define CHR_IOCTL_MODEM_SET_AFC       8
+
 typedef void IOEventHandler(void *opaque, int event);
 
 typedef struct CharDriverState {





More information about the commitlog mailing list