Scale TSC2102 touchscreen pressure value more realistically (still could be better).
authorbalrog <balrog@c046a42c-6fe2-441c-8c8c-71466251a162>
Sun, 25 Nov 2007 18:46:17 +0000 (18:46 +0000)
committerbalrog <balrog@c046a42c-6fe2-441c-8c8c-71466251a162>
Sun, 25 Nov 2007 18:46:17 +0000 (18:46 +0000)
PalmOS 5.2.1 now fully boots.

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3741 c046a42c-6fe2-441c-8c8c-71466251a162

hw/mainstone.c
hw/omap.c
hw/sd.c
hw/tsc210x.c

index 274cbffb5a1e0bada2e5bb0f74011994c78fe94a..d6ce4ffe0b3072ae3c8a126cc29091fad6d31bcb 100644 (file)
@@ -11,7 +11,6 @@
 #include "hw.h"
 #include "pxa.h"
 #include "arm-misc.h"
-#include "sysemu.h"
 #include "net.h"
 #include "devices.h"
 #include "boards.h"
index a873b5fe54ecc5df364a57d58aa2e323b007cebe..c8d5064f634aef7d15b14ffc3d12625eee253ca5 100644 (file)
--- a/hw/omap.c
+++ b/hw/omap.c
@@ -4809,7 +4809,6 @@ static void omap_mpu_reset(void *opaque)
 {
     struct omap_mpu_state_s *mpu = (struct omap_mpu_state_s *) opaque;
 
-    omap_clkm_reset(mpu);
     omap_inth_reset(mpu->ih[0]);
     omap_inth_reset(mpu->ih[1]);
     omap_dma_reset(mpu->dma);
@@ -4843,6 +4842,7 @@ static void omap_mpu_reset(void *opaque)
     omap_mcbsp_reset(mpu->mcbsp3);
     omap_lpg_reset(mpu->led[0]);
     omap_lpg_reset(mpu->led[1]);
+    omap_clkm_reset(mpu);
     cpu_reset(mpu->env);
 }
 
diff --git a/hw/sd.c b/hw/sd.c
index fc3c45a83ccde391726b9a9f4edfee211b8b1993..93ad3dab81a4d8990db898ec23db3ac502ea7d4c 100644 (file)
--- a/hw/sd.c
+++ b/hw/sd.c
@@ -397,7 +397,7 @@ static void sd_cardchange(void *opaque)
 }
 
 /* We do not model the chip select pin, so allow the board to select
-   whether card should be in SSI ot MMC/SD mode.  It is also up to the
+   whether card should be in SSI or MMC/SD mode.  It is also up to the
    board to ensure that ssi transfers only occur when the chip select
    is asserted.  */
 SDState *sd_init(BlockDriverState *bs, int is_spi)
index 6082aa0b9a8df1449d320de6855b6ce3652f619c..96956a47de894aef784bfab2167449260d234402 100644 (file)
@@ -130,9 +130,10 @@ static const uint16_t mode_regs[16] = {
 #define Y_TRANSFORM(value)             \
     ((150 + ((int) (value) * (3037 - 150) / 32768)) << 4)
 #define Z1_TRANSFORM(s)                        \
-    ((400 - (s)->x + ((s)->pressure << 9)) << 4)
+    ((400 - ((s)->x >> 7) + ((s)->pressure << 10)) << 4)
 #define Z2_TRANSFORM(s)                        \
-    ((4000 + (s)->y - ((s)->pressure << 10)) << 4)
+    ((4000 + ((s)->y >> 7) - ((s)->pressure << 10)) << 4)
+
 #define BAT1_VAL                       0x8660
 #define BAT2_VAL                       0x0000
 #define AUX1_VAL                       0x35c0
@@ -367,7 +368,8 @@ static uint16_t tsc2102_data_register_read(struct tsc210x_state_s *s, int reg)
 
     case 0x05: /* BAT1 */
         s->dav &= 0xffbf;
-        return TSC_CUT_RESOLUTION(BAT1_VAL, s->precision);
+        return TSC_CUT_RESOLUTION(BAT1_VAL, s->precision) +
+                (s->noise & 6);
 
     case 0x06: /* BAT2 */
         s->dav &= 0xffdf;
@@ -383,11 +385,13 @@ static uint16_t tsc2102_data_register_read(struct tsc210x_state_s *s, int reg)
 
     case 0x09: /* TEMP1 */
         s->dav &= 0xfffb;
-        return TSC_CUT_RESOLUTION(TEMP1_VAL, s->precision);
+        return TSC_CUT_RESOLUTION(TEMP1_VAL, s->precision) -
+                (s->noise & 5);
 
     case 0x0a: /* TEMP2 */
         s->dav &= 0xfffd;
-        return TSC_CUT_RESOLUTION(TEMP2_VAL, s->precision);
+        return TSC_CUT_RESOLUTION(TEMP2_VAL, s->precision) ^
+                (s->noise & 3);
 
     case 0x0b: /* DAC */
         s->dav &= 0xfffe;