Hi,
      Here is a work in progress patch set for getting android to run
on the gumstix overo TI OMAP3503 processor, using the gumstix Palo43
expansion board.

Elvis Dowson


project bionic/
diff --git a/libc/private/bionic_tls.h b/libc/private/bionic_tls.h
index da34344..ba86d2a 100644
--- a/libc/private/bionic_tls.h
+++ b/libc/private/bionic_tls.h
@@ -81,7 +81,8 @@ extern int __set_tls(void *ptr);

 /* get the TLS */
 #ifdef __arm__
-#  define __get_tls() ( *((volatile void **) 0xffff0ff0) )
+typedef void* (__get_tls_t)(void);
+static const __get_tls_t* __get_tls = (const __get_tls_t *)
0xffff0fe0;
 #else
 extern void*  __get_tls( void );
 #endif

project external/qemu/
diff --git a/Makefile.android b/Makefile.android
index 4c697fb..98d2084 100644
--- a/Makefile.android
+++ b/Makefile.android
@@ -18,7 +18,7 @@ MY_CFLAGS := $(CONFIG_INCLUDES) -O2 -g \

 # this is needed to build the emulator on 64-bit Linux systems
 ifeq ($(HOST_OS)-$(HOST_ARCH),linux-x86)
-  MY_CFLAGS += -Wa,--32
+  MY_CFLAGS += -Wa,--32 -D_GNU_SOURCE
 endif

 ifeq ($(HOST_OS),freebsd)

project frameworks/base/
diff --git a/include/ui/EGLDisplaySurface.h b/include/ui/
EGLDisplaySurface.h
index a8b5853..002a940 100644
--- a/include/ui/EGLDisplaySurface.h
+++ b/include/ui/EGLDisplaySurface.h
@@ -25,7 +25,8 @@
 #include <ui/EGLNativeSurface.h>

 #include <pixelflinger/pixelflinger.h>
-#include <linux/fb.h>
+#include <linux-omap3/fb.h>
+#include <linux-omap3/omapfb.h>

 #include <EGL/egl.h>

diff --git a/libs/surfaceflinger/DisplayHardware/DisplayHardware.cpp b/
libs/surfaceflinger/DisplayHardware/DisplayHardware.cpp
index f14d7e9..85d81b6 100644
--- a/libs/surfaceflinger/DisplayHardware/DisplayHardware.cpp
+++ b/libs/surfaceflinger/DisplayHardware/DisplayHardware.cpp
@@ -138,7 +138,7 @@ void DisplayHardware::init(uint32_t dpy)
     const char* const egl_extensions = eglQueryString(
             display, EGL_EXTENSIONS);

-    LOGI("EGL informations:");
+    LOGI("OpenGL ES information:");
     LOGI("# of configs : %d", numConfigs);
     LOGI("vendor    : %s", eglQueryString(display, EGL_VENDOR));
     LOGI("version   : %s", eglQueryString(display, EGL_VERSION));
@@ -163,7 +163,7 @@ void DisplayHardware::init(uint32_t dpy)
     mDisplaySurface = new EGLDisplaySurface();

     surface = eglCreateWindowSurface(display, config,
mDisplaySurface.get(), NULL);
-    //checkEGLErrors("eglCreateDisplaySurfaceANDROID");
+    checkEGLErrors("eglCreateDisplaySurfaceANDROID");

     if (eglQuerySurface(display, surface, EGL_SWAP_BEHAVIOR, &dummy)
== EGL_TRUE) {
         if (dummy == EGL_BUFFER_PRESERVED) {
@@ -201,7 +201,7 @@ void DisplayHardware::init(uint32_t dpy)
      */

     context = eglCreateContext(display, config, NULL, NULL);
-    //checkEGLErrors("eglCreateContext");
+    checkEGLErrors("eglCreateContext");

     eglQuerySurface(display, surface, EGL_WIDTH, &mWidth);
     eglQuerySurface(display, surface, EGL_HEIGHT, &mHeight);
diff --git a/libs/ui/EGLDisplaySurface.cpp b/libs/ui/
EGLDisplaySurface.cpp
index d06c98b..ec406c6 100644
--- a/libs/ui/EGLDisplaySurface.cpp
+++ b/libs/ui/EGLDisplaySurface.cpp
@@ -175,8 +175,14 @@ uint32_t EGLDisplaySurface::swapBuffers()
     mIndex = 1 - mIndex;
     mInfo.activate = FB_ACTIVATE_VBL;
     mInfo.yoffset = mIndex ? mInfo.yres : 0;
-    if (ioctl(egl_native_window_t::fd, FBIOPUT_VSCREENINFO, &mInfo)
== -1) {
-        LOGE("FBIOPUT_VSCREENINFO failed");
+    if (ioctl(egl_native_window_t::fd, FBIOPAN_DISPLAY, &mInfo) ==
-1) {
+        LOGE("FBIOPAN_DISPLAY failed");
+        return 0;
+    }
+
+    // Wait for vertical blanking interval, to reduce tearing and
flicker artifacts.
+    if (ioctl(egl_native_window_t::fd, OMAPFB_WAITFORVSYNC, &mInfo)
== -1) {
+       LOGE("OMAPFB_WAITFORVSYNC failed");
         return 0;
     }

@@ -395,10 +401,10 @@ status_t EGLDisplaySurface::mapFrameBuffer()
     info.activate = FB_ACTIVATE_NOW;

     uint32_t flags = PAGE_FLIP;
-    if (ioctl(fd, FBIOPUT_VSCREENINFO, &info) == -1) {
+    if (ioctl(fd, FBIOPAN_DISPLAY, &info) == -1) {
         info.yres_virtual = info.yres;
         flags &= ~PAGE_FLIP;
-        LOGW("FBIOPUT_VSCREENINFO failed, page flipping not
supported");
+        LOGW("FBIOPAN_DISPLAY failed, page flipping not supported");
     }

     if (info.yres_virtual < info.yres * 2) {
diff --git a/libs/ui/EventHub.cpp b/libs/ui/EventHub.cpp
index 7c2fc8e..bedc2d2 100644
--- a/libs/ui/EventHub.cpp
+++ b/libs/ui/EventHub.cpp
@@ -517,7 +517,7 @@ int EventHub::open_device(const char *deviceName)
     mFDs = new_mFDs;
     mDevices = new_devices;

-#if 0
+#if 1
     LOGI("add device %d: %s\n", mFDCount, deviceName);
     LOGI("  bus:      %04x\n"
          "  vendor    %04x\n"
diff --git a/opengl/libs/Android.mk b/opengl/libs/Android.mk
index 2ecc776..20444e6 100644
--- a/opengl/libs/Android.mk
+++ b/opengl/libs/Android.mk
@@ -34,7 +34,7 @@ include $(BUILD_SHARED_LIBRARY)
 include $(CLEAR_VARS)

 LOCAL_SRC_FILES:=      \
-       GLES_CM/gl.cpp.arm              \
+       GLES_CM/gl.cpp          \
        GLES_CM/gl_logger.cpp   \
 #

diff --git a/opengl/libs/GLES_CM/gl.cpp b/opengl/libs/GLES_CM/gl.cpp
index 865cf44..35478f0 100644
--- a/opengl/libs/GLES_CM/gl.cpp
+++ b/opengl/libs/GLES_CM/gl.cpp
@@ -68,7 +68,7 @@ void glVertexPointerBounds(GLint size, GLenum type,
 #undef CALL_GL_API
 #undef CALL_GL_API_RETURN

-#if USE_FAST_TLS_KEY
+/* #if USE_FAST_TLS_KEY

     #define API_ENTRY(_api) __attribute__((naked)) _api

@@ -90,7 +90,7 @@ void glVertexPointerBounds(GLint size, GLenum type,
         CALL_GL_API(_api, __VA_ARGS__) \
         return 0; // placate gcc's warnings. never reached.

-#else
+#else */

     #define API_ENTRY(_api) _api

@@ -104,7 +104,7 @@ void glVertexPointerBounds(GLint size, GLenum
type,
         GL_LOGGER_IMPL( log_##_api
(__VA_ARGS__); )                      \
         return _c->_api(__VA_ARGS__)

-#endif
+//#endif

 extern "C" {
 #include "gl_api.in"
diff --git a/services/java/com/android/server/InputDevice.java b/
services/java/com/android/server/InputDevice.java
index 7b8a2a4..d9304c1 100644
--- a/services/java/com/android/server/InputDevice.java
+++ b/services/java/com/android/server/InputDevice.java
@@ -21,10 +21,15 @@ import android.view.Display;
 import android.view.MotionEvent;
 import android.view.Surface;
 import android.view.WindowManagerPolicy;
+import java.io.FileInputStream;
+import java.util.StringTokenizer;

 public class InputDevice {
     /** Amount that trackball needs to move in order to generate a
key event. */
     static final int TRACKBALL_MOVEMENT_THRESHOLD = 6;
+
+    /** Touchscreen calibration file. */
+    static final String CALIBRATION_FILE = "/etc/pointercal";

     final int id;
     final int classes;
@@ -33,6 +38,7 @@ public class InputDevice {
     final AbsoluteInfo absY;
     final AbsoluteInfo absPressure;
     final AbsoluteInfo absSize;
+    final TransformInfo tInfo;

     long mDownTime = 0;
     int mMetaKeysState = 0;
@@ -86,12 +92,24 @@ public class InputDevice {
                     h = tmp;
                 }
                 if (device.absX != null) {
-                    scaledX = ((scaledX-device.absX.minValue)
-                                / device.absX.range) * w;
+                   if (device.tInfo != null)
+                       scaledX = (device.tInfo.x1 * x +
+                                          device.tInfo.y1 * y +
+                                   device.tInfo.z1)
+                                  / device.tInfo.s;
+                   else
+                       scaledX = ((scaledX-device.absX.minValue)
+                                    / device.absX.range) * w;
                 }
                 if (device.absY != null) {
-                    scaledY = ((scaledY-device.absY.minValue)
-                                / device.absY.range) * h;
+                   if (device.tInfo != null)
+                       scaledY = (device.tInfo.x2 * x +
+                                          device.tInfo.y2 * y +
+                                   device.tInfo.z2)
+                                  / device.tInfo.s;
+                   else
+                       scaledY = ((scaledY-device.absY.minValue)
+                                    / device.absY.range) * h;
                 }
                 if (device.absPressure != null) {
                     scaledPressure =
@@ -199,6 +217,16 @@ public class InputDevice {
         int fuzz;
     };

+    static class TransformInfo {
+        float x1;
+        float y1;
+        float z1;
+        float x2;
+        float y2;
+       float z2;
+       float s;
+    };
+
     InputDevice(int _id, int _classes, String _name,
             AbsoluteInfo _absX, AbsoluteInfo _absY,
             AbsoluteInfo _absPressure, AbsoluteInfo _absSize) {
@@ -209,5 +237,38 @@ public class InputDevice {
         absY = _absY;
         absPressure = _absPressure;
         absSize = _absSize;
+       TransformInfo t = null;
+
+       try {
+               FileInputStream is = new FileInputStream(CALIBRATION_FILE);
+               byte[] mBuffer = new byte[64];
+               int len = is.read(mBuffer);
+               is.close();
+
+               if (len > 0) {
+                   int i;
+                   for (i = 0 ; i < len ; i++) {
+                       if (mBuffer[i] == '\n' || mBuffer[i] == 0) {
+                               break;
+                       }
+                   }
+                   len = i;
+               }
+
+               StringTokenizer st = new StringTokenizer( new String(mBuffer, 
0, 0,
len) );
+
+               t       = new TransformInfo ();
+               t.x1    = Integer.parseInt( st.nextToken() );
+               t.y1    = Integer.parseInt( st.nextToken() );
+               t.z1    = Integer.parseInt( st.nextToken() );
+               t.x2    = Integer.parseInt( st.nextToken() );
+               t.y2    = Integer.parseInt( st.nextToken() );
+               t.z2    = Integer.parseInt( st.nextToken() );
+               t.s     = Integer.parseInt( st.nextToken() );
+       } catch (java.io.FileNotFoundException e) {
+       } catch (java.io.IOException e) {
+       }
+       tInfo = t;
+
     }
 };
diff --git a/services/jni/com_android_server_BatteryService.cpp b/
services/jni/com_android_server_BatteryService.cpp
index 6636a97..748f514 100644
--- a/services/jni/com_android_server_BatteryService.cpp
+++ b/services/jni/com_android_server_BatteryService.cpp
@@ -150,12 +150,12 @@ static void setBooleanField(JNIEnv* env, jobject
obj, const char* path, jfieldID
     const int SIZE = 16;
     char buf[SIZE];

-    jboolean value = false;
-    if (readFromFile(path, buf, SIZE) > 0) {
+    jboolean value = true;
+/*    if (readFromFile(path, buf, SIZE) > 0) {
         if (buf[0] == '1') {
             value = true;
         }
-    }
+    } */
     env->SetBooleanField(obj, fieldID, value);
 }

@@ -164,10 +164,10 @@ static void setIntField(JNIEnv* env, jobject
obj, const char* path, jfieldID fie
     const int SIZE = 128;
     char buf[SIZE];

-    jint value = 0;
-    if (readFromFile(path, buf, SIZE) > 0) {
+    jint value = 100;
+/*    if (readFromFile(path, buf, SIZE) > 0) {
         value = atoi(buf);
-    }
+    } */
     env->SetIntField(obj, fieldID, value);
 }

@@ -181,17 +181,21 @@ static void android_server_BatteryService_update
(JNIEnv* env, jobject obj)
     setIntField(env, obj, BATTERY_VOLTAGE_PATH,
gFieldIds.mBatteryVoltage);
     setIntField(env, obj, BATTERY_TEMPERATURE_PATH,
gFieldIds.mBatteryTemperature);

+    env->SetIntField(obj, gFieldIds.mBatteryStatus,
gConstants.statusFull);
+    env->SetIntField(obj, gFieldIds.mBatteryHealth,
gConstants.healthGood);
+    env->SetObjectField(obj, gFieldIds.mBatteryTechnology, env-
>NewStringUTF("1"));
+
     const int SIZE = 128;
     char buf[SIZE];

-    if (readFromFile(BATTERY_STATUS_PATH, buf, SIZE) > 0)
+/*    if (readFromFile(BATTERY_STATUS_PATH, buf, SIZE) > 0)
         env->SetIntField(obj, gFieldIds.mBatteryStatus,
getBatteryStatus(buf));

     if (readFromFile(BATTERY_HEALTH_PATH, buf, SIZE) > 0)
         env->SetIntField(obj, gFieldIds.mBatteryHealth,
getBatteryHealth(buf));

     if (readFromFile(BATTERY_TECHNOLOGY_PATH, buf, SIZE) > 0)
-        env->SetObjectField(obj, gFieldIds.mBatteryTechnology, env-
>NewStringUTF(buf));
+        env->SetObjectField(obj, gFieldIds.mBatteryTechnology, env-
>NewStringUTF(buf));  */
 }

 static JNINativeMethod sMethods[] = {

--~--~---------~--~----~------------~-------~--~----~
unsubscribe: android-porting+unsubscr...@googlegroups.com
website: http://groups.google.com/group/android-porting
-~----------~----~----~----~------~----~------~--~---

Reply via email to