1 /*
   2  * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 #ifndef PLATFORM_INTERNAL_H
  27 #define PLATFORM_INTERNAL_H
  28 
  29 #ifndef FB_DEVICE
  30 #define FB_DEVICE "/dev/fb0"
  31 #endif
  32 
  33 #ifndef FB_CURSOR_DEVICE
  34 #define FB_CURSOR_DEVICE "/dev/fb1"
  35 #endif
  36 
  37 #define LENSFB_32_CURSOR_COLOR_KEY 0xABABABAB
  38 #define LENSFB_16_CURSOR_COLOR_KEY 0xABAB
  39 
  40 #define RGB565TOCOLORKEY(rgb)                              \
  41       ( ((rgb & 0xf800)<<8)  |  ((rgb & 0xe000)<<3)  |     \
  42         ((rgb & 0x07e0)<<5)  |  ((rgb & 0x0600)>>1)  |     \
  43         ((rgb & 0x001f)<<3)  |  ((rgb & 0x001c)>>2)  )
  44 
  45 /**
  46  * The bellow macros will convert pointers to long
  47  * representation, which is how java is keeping native pointers,
  48  * and vice versa.
  49  * This code will work in both 32 and 64 bit systems
  50  */
  51 #if defined (_LP64) || defined(_WIN64)
  52 #define jlong_to_ptr(a) ((void*)(a))
  53 #define ptr_to_jlong(a) ((jlong)(a))
  54 #else
  55 #define jlong_to_ptr(a) ((void*)(int)(a))
  56 #define ptr_to_jlong(a) ((jlong)(int)(a))
  57 #endif
  58 
  59 #endif // PLATFORM_INTERNAL_H