aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/programs/Xserver/hw/xfree86/os-support/qnx4
diff options
context:
space:
mode:
Diffstat (limited to 'nx-X11/programs/Xserver/hw/xfree86/os-support/qnx4')
-rw-r--r--nx-X11/programs/Xserver/hw/xfree86/os-support/qnx4/Imakefile37
-rw-r--r--nx-X11/programs/Xserver/hw/xfree86/os-support/qnx4/qnx_VTsw.c116
-rw-r--r--nx-X11/programs/Xserver/hw/xfree86/os-support/qnx4/qnx_init.c175
-rw-r--r--nx-X11/programs/Xserver/hw/xfree86/os-support/qnx4/qnx_io.c110
-rw-r--r--nx-X11/programs/Xserver/hw/xfree86/os-support/qnx4/qnx_kbd.c104
-rw-r--r--nx-X11/programs/Xserver/hw/xfree86/os-support/qnx4/qnx_mouse.c267
-rw-r--r--nx-X11/programs/Xserver/hw/xfree86/os-support/qnx4/qnx_select.c75
-rw-r--r--nx-X11/programs/Xserver/hw/xfree86/os-support/qnx4/qnx_utils.c30
-rw-r--r--nx-X11/programs/Xserver/hw/xfree86/os-support/qnx4/qnx_video.c183
9 files changed, 1097 insertions, 0 deletions
diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/qnx4/Imakefile b/nx-X11/programs/Xserver/hw/xfree86/os-support/qnx4/Imakefile
new file mode 100644
index 000000000..0c8e07b37
--- /dev/null
+++ b/nx-X11/programs/Xserver/hw/xfree86/os-support/qnx4/Imakefile
@@ -0,0 +1,37 @@
+XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/qnx4/Imakefile,v 1.7 2002/10/11 01:47:00 dawes Exp $
+
+#include <Server.tmpl>
+
+
+SRCS = qnx_io.c qnx_init.c qnx_utils.c ioperm_noop.c qnx_video.c \
+ qnx_VTsw.c qnx_kbd.c posix_tty.c qnx_mouse.c qnx_select.c \
+ libc_wrapper.c stdResource.c stdPci.c sigiostubs.c pm_noop.c \
+ kmod_noop.c agp_noop.c
+
+OBJS = qnx_io.o qnx_init.o qnx_utils.o ioperm_noop.o qnx_video.o \
+ qnx_VTsw.o qnx_kbd.o posix_tty.o qnx_mouse.o qnx_select.o \
+ libc_wrapper.o stdResource.o stdPci.o sigiostubs.o pm_noop.o \
+ kmod_noop.o agp_noop.o
+
+INCLUDES = -I$(XF86COMSRC) -I$(XF86OSSRC) -I. -I$(SERVERSRC)/include \
+ -I$(XINCLUDESRC)
+
+RESDEFINES = -DUSESTDRES
+
+DEFINES = $(RESDEFINES)
+
+SubdirLibraryRule($(OBJS))
+NormalLibraryObjectRule()
+
+
+LinkSourceFile(libc_wrapper.c,../shared)
+LinkSourceFile(posix_tty.c,../shared)
+LinkSourceFile(ioperm_noop.c,../shared)
+LinkSourceFile(stdResource.c,../shared)
+LinkSourceFile(stdPci.c,../shared)
+LinkSourceFile(sigiostubs.c,../shared)
+LinkSourceFile(pm_noop.c,../shared)
+LinkSourceFile(kmod_noop.c,../shared)
+LinkSourceFile(agp_noop.c,../shared)
+
+DependTarget()
diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/qnx4/qnx_VTsw.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/qnx4/qnx_VTsw.c
new file mode 100644
index 000000000..7902b5597
--- /dev/null
+++ b/nx-X11/programs/Xserver/hw/xfree86/os-support/qnx4/qnx_VTsw.c
@@ -0,0 +1,116 @@
+/*
+ * (c) Copyright 1998 by Sebastien Marineau
+ * <sebastien@qnx.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * HOLGER VEIT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of Sebastien Marineau shall not
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from Sebastien Marineau.
+ *
+ * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/qnx/qnx_VTsw.c,v 1.1.2.2 1999/07/23 13:42:32 hohndel Exp $
+ */
+
+/* This module contains the code to use _select_receive to handle
+ * messages from the Mouse and Input driver. These cannot be select'ed on.
+ */
+
+/* This module contains the functions which are used to do
+ * VT switching to a text console and back... Experimental.
+ */
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+#include "input.h"
+#include "scrnintstr.h"
+
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86_OSlib.h"
+
+#include <sys/console.h>
+
+int QNX_console_exist[10];
+Bool QNX_vtswitch_pending = FALSE;
+int QNX_con_toactivate = -1;
+extern struct _console_ctrl *QNX_con_ctrl;
+extern unsigned QNX_con_mask, QNX_con_bits;
+extern pid_t QNX_console_proxy;
+extern int QNX_our_console;
+
+/* This gets called to determine if a VT switch has been requested */
+Bool xf86VTSwitchPending()
+{
+ return(xf86Info.vtRequestsPending ? TRUE : FALSE);
+}
+
+/* This is called to do OS-specific stuff when we switch away from
+ * our console.
+ */
+Bool xf86VTSwitchAway()
+{
+ int ret;
+ unsigned event, bits;
+
+ ErrorF("Called VT switch away!\n");
+
+ /* First check wether we are trying to switch to our console... */
+ if (xf86Info.vtRequestsPending == QNX_our_console) {
+ xf86Info.vtRequestsPending = FALSE;
+ return (FALSE);
+ }
+
+ /* Reenable console switching */
+ QNX_con_bits &= ~QNX_con_mask;
+ bits = console_ctrl(QNX_con_ctrl, -1, QNX_con_bits, QNX_con_mask);
+ QNX_con_mask = 0;
+
+ /* And activate the new console. Check if it is valid first... */
+ ret = console_active(QNX_con_ctrl, xf86Info.vtRequestsPending);
+ ErrorF("xf86VTSwitchAway: Made console %d active, ret %d\n",
+ xf86Info.vtRequestsPending, ret);
+ xf86Info.vtRequestsPending = FALSE;
+
+ if (ret == -1) {
+ QNX_con_mask = CONSOLE_INVISIBLE | CONSOLE_NOSWITCH;
+ QNX_con_bits = console_ctrl (QNX_con_ctrl,
+ QNX_our_console, QNX_con_mask, QNX_con_mask);
+ return (FALSE);
+ }
+ /* Arm the console with the proxy so we know when we come back */
+ console_state(QNX_con_ctrl, QNX_our_console, 0L, _CON_EVENT_ACTIVE);
+ event = _CON_EVENT_ACTIVE;
+ console_arm (QNX_con_ctrl, QNX_our_console, QNX_console_proxy, event);
+
+ return(TRUE);
+}
+
+/* And this is called when we are switching back to the server */
+Bool xf86VTSwitchTo()
+{
+ unsigned bits, mask;
+
+ ErrorF("Called VT switch to the server!\n");
+ QNX_con_mask = CONSOLE_INVISIBLE | CONSOLE_NOSWITCH;
+ QNX_con_bits = console_ctrl (QNX_con_ctrl, QNX_our_console, QNX_con_mask, QNX_con_mask);
+ xf86Info.vtRequestsPending = FALSE;
+ return(TRUE);
+}
diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/qnx4/qnx_init.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/qnx4/qnx_init.c
new file mode 100644
index 000000000..b96cc4d30
--- /dev/null
+++ b/nx-X11/programs/Xserver/hw/xfree86/os-support/qnx4/qnx_init.c
@@ -0,0 +1,175 @@
+/*
+ * (c) Copyright 1998 by Sebastien Marineau
+ * <sebastien@qnx.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * SEBASTIEN MARINEAU BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of Sebastien Marineau shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from Sebastien Marineau.
+ *
+ * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/qnx/qnx_init.c,v 1.1.2.2 1999/07/23 13:42:33 hohndel Exp $
+ */
+
+/* This module contains the qnx-specific functions used at server init.
+ */
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <i86.h>
+#include <sys/mman.h>
+#include <sys/console.h>
+
+#include <X11/X.h>
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86_OSlib.h"
+
+struct _console_ctrl *QNX_con_ctrl = NULL;
+unsigned long QNX_con_mask = 0;
+unsigned long QNX_con_bits = 0;
+pid_t QNX_console_proxy = -1;
+int QNX_our_console = -1;
+
+void
+xf86UseMsg()
+{
+ ErrorF("No QNX-specific usage options available at this time\n");
+ return;
+}
+
+int
+xf86ProcessArgument(argc, argv, i)
+int argc;
+char **argv;
+int i;
+{
+
+ return 0;
+
+}
+
+
+void
+xf86OpenConsole()
+{
+struct _console_info info;
+unsigned event;
+int default_console = FALSE;
+char con_name[32];
+int active;
+
+ ErrorF("xf86OpenConsole\n");
+
+ if(QNX_con_ctrl == NULL) {
+ /* First open a channel to default stdout */
+ xf86Info.consoleFd = fileno(stdout);
+ if((QNX_con_ctrl = console_open (fileno(stdout), O_RDWR)) == NULL){
+ /* Hmmm. Didn't work. Try to open con1 as default */
+
+ if (( xf86Info.consoleFd = open("/dev/con1", O_RDWR)) < 0){
+ FatalError("xf86OpenConsole: could not open console driver\n");
+ return;
+ }
+ if((QNX_con_ctrl =
+ console_open (xf86Info.consoleFd, O_RDWR)) == NULL){
+ FatalError("xf86OpenConsole: could not open console\n");
+ }
+ default_console = TRUE;
+ }
+ if(QNX_con_ctrl && console_info(QNX_con_ctrl, 0, &info) == 0 ) {
+ if( info.type != _CON_TYPE_STANDARD ) {
+ FatalError("xf86OpenConsole: console is not a standard text console\n");
+ return;
+ }
+ }
+ else {
+ FatalError("xf86OpenConsole: Error querying console\n");
+ return;
+ }
+ }
+
+ /* We have a console, and it is text. Keep going */
+ /* Next, check if Photon has got the screen */
+ if(qnx_name_locate(0, "/qnx/crt", 0, NULL) != -1) {
+ FatalError("xf86OpenConsole: Photon has already grabbed the display\n");
+ return;
+ }
+ fclose (stdout);
+ /* We have two cases here: either this is the first time through,
+ * and QNX_our_console is not set yet, or we're coming here from
+ * a reset. In that case, make sure our console is now active
+ * before we go further...
+ */
+ if (QNX_our_console < 0) {
+ QNX_our_console = console_active(QNX_con_ctrl, -1);
+ }
+ else {
+ console_arm(QNX_con_ctrl, QNX_our_console, -1, _CON_EVENT_ACTIVE);
+ while ((active = console_active(QNX_con_ctrl, -1)) !=
+ QNX_our_console) {
+ sleep(2);
+ ErrorF("Waiting for our console to become active!\n");
+ }
+ }
+ QNX_con_mask = CONSOLE_INVISIBLE | CONSOLE_NOSWITCH;
+ QNX_con_bits = console_ctrl (QNX_con_ctrl, QNX_our_console,
+ QNX_con_mask, QNX_con_mask);
+ ErrorF("xf86OpenConsole: Locked console %d\n", QNX_our_console);
+
+ /* If we had the wrong console opened in the first place, reopen */
+ if(default_console) {
+ close(xf86Info.consoleFd);
+ sprintf(con_name, "/dev/con%d", QNX_our_console);
+ xf86Info.consoleFd = open(con_name, O_RDWR);
+ ErrorF("xf86OpenConsole: reopened console %d\n", QNX_our_console);
+ }
+
+ /* Next create the proxy used to notify us of console events */
+ if(QNX_console_proxy == -1){
+ if((QNX_console_proxy = qnx_proxy_attach(0, 0, 0, -1)) == -1){
+ ErrorF("xf86OpenConsole: Could not create proxy for VT switching\n");
+ }
+ }
+
+ return;
+}
+
+void
+xf86CloseConsole()
+{
+ unsigned bits;
+ int font;
+
+ ErrorF("xf86CloseConsole\n");
+ if(QNX_con_ctrl == NULL) return;
+ QNX_con_bits &= ~QNX_con_mask; /* To make sure */
+ bits = console_ctrl(QNX_con_ctrl, 0, QNX_con_bits, QNX_con_mask);
+
+ ErrorF("xf86CloseConsole: unlocked console\n");
+ /* For now, dump malloc info as well */
+#if 0
+ malloc_dump(2);
+#endif
+ return;
+}
diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/qnx4/qnx_io.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/qnx4/qnx_io.c
new file mode 100644
index 000000000..d1cf5c4bf
--- /dev/null
+++ b/nx-X11/programs/Xserver/hw/xfree86/os-support/qnx4/qnx_io.c
@@ -0,0 +1,110 @@
+/*
+ * (c) Copyright 1998 by Sebastien Marineau
+ * <sebastien@qnx.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * SEBASTIEN MARINEAU BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of Sebastien Marineau shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from Sebastien Marineau.
+ *
+ * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/qnx4/qnx_io.c,v 1.2 2002/10/11 01:40:36 dawes Exp $
+ */
+
+/* This module contains the qnx-specific functions to access the keyboard
+ * and the console.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <i86.h>
+#include <sys/mman.h>
+#include <sys/qioctl.h>
+#include <errno.h>
+
+#include <X11/X.h>
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86_OSlib.h"
+
+
+void
+xf86SoundKbdBell(loudness, pitch, duration)
+int loudness, pitch, duration;
+{
+
+/* Come back and fix! */
+ErrorF("xf86SoundKbdBell: to implement\n");
+}
+
+void
+xf86SetKbdLeds(leds)
+int leds;
+{
+unsigned long bits[2], oldbits;
+
+ bits[0] = leds;
+ bits[1] = LED_CAP | LED_NUM | LED_SCR;
+
+ if (qnx_ioctl (xf86Info.consoleFd, QCTL_DEV_CTL, &bits, 8, &oldbits, 4) == -1)
+ ErrorF("xf86SetKbdLeds: error setting kbd leds, errno %d\n", errno);
+
+}
+
+int
+xf86GetKbdLeds()
+{
+unsigned long bits[2], oldbits = 0;
+
+ bits[0] = bits[1] = 0;
+ if (qnx_ioctl(xf86Info.consoleFd, QCTL_DEV_CTL, &bits, 8, &oldbits, 4) == -1)
+ ErrorF("xf86SetKbdLeds: error getting kbd leds, errno %d\n", errno);
+
+ return(oldbits);
+}
+
+/* This is a no-op for now */
+void
+xf86SetKbdRepeat(rad)
+char rad;
+{
+ return;
+}
+
+
+/* This is a no-op for now */
+void
+xf86KbdInit()
+{
+
+ return;
+}
+
+#include "xf86OSKbd.h"
+
+Bool
+xf86OSKbdPreInit(InputInfoPtr pInfo)
+{
+ return FALSE;
+}
diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/qnx4/qnx_kbd.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/qnx4/qnx_kbd.c
new file mode 100644
index 000000000..88a7209cd
--- /dev/null
+++ b/nx-X11/programs/Xserver/hw/xfree86/os-support/qnx4/qnx_kbd.c
@@ -0,0 +1,104 @@
+/*
+ * (c) Copyright 1998 by Sebastien Marineau
+ * <sebastien@qnx.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * SEBASTIEN MARINEAU BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of Sebastien Marineau shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from Sebastien Marineau.
+ *
+ * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/qnx/qnx_kbd.c,v 1.1.2.2 1999/07/23 13:42:35 hohndel Exp $
+ */
+
+/* This module contains the qnx-specific functions to access the keyboard
+ * and the console.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <i86.h>
+#include <sys/mman.h>
+#include <sys/dev.h>
+#include <errno.h>
+
+#include <X11/X.h>
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86_OSlib.h"
+
+
+int QNX_kbd_fd = -1;
+pid_t QNX_kbd_proxy = -1;
+
+int
+xf86KbdOn()
+{
+
+ if(QNX_kbd_fd == -1)
+ QNX_kbd_fd = open("/dev/kbd", O_RDWR);
+ if(QNX_kbd_proxy == -1)
+ QNX_kbd_proxy = qnx_proxy_attach(0, 0, 0, -1);
+ if (QNX_kbd_fd == -1) {
+ FatalError("xf86KbdOn: Could not open keyboard, errno = %d\n", errno);
+ }
+ if (QNX_kbd_proxy == -1) {
+ FatalError("xf86KbdOn: Could not create kbd proxy, errno = %d\n", errno);
+ }
+ if(xf86Verbose)
+ ErrorF("xf86KbdOn: fd = %d, proxy = %d\n", QNX_kbd_fd, QNX_kbd_proxy);
+ if (dev_arm(QNX_kbd_fd, QNX_kbd_proxy, _DEV_EVENT_RXRDY) == -1)
+ FatalError("xf86KbdOn: could not arm kbd proxy, errno %d\n", errno);
+ return(-1); /* We don't want to select on kbd handle... */
+
+
+}
+
+int
+xf86KbdOff()
+{
+ int fd;
+
+ ErrorF("xf86KbdOff:\n ");
+ fd = QNX_kbd_fd;
+ close(QNX_kbd_fd);
+ QNX_kbd_fd = -1;
+ return(-1);
+}
+
+void xf86KbdEvents()
+{
+ unsigned char rBuf[64];
+ int nBytes, i;
+
+ if ((nBytes = dev_read( QNX_kbd_fd, (char *)rBuf, sizeof(rBuf),
+ 0, 0, 0, 0, NULL)) > 0) {
+ for (i = 0; i < nBytes; i++)
+ xf86PostKbdEvent(rBuf[i]);
+ /* Re-arm proxy */
+ dev_arm(QNX_kbd_fd, QNX_kbd_proxy, _DEV_EVENT_RXRDY);
+
+ }
+}
+
diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/qnx4/qnx_mouse.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/qnx4/qnx_mouse.c
new file mode 100644
index 000000000..ec45a30be
--- /dev/null
+++ b/nx-X11/programs/Xserver/hw/xfree86/os-support/qnx4/qnx_mouse.c
@@ -0,0 +1,267 @@
+/*
+ * (c) Copyright 1998 by Sebastien Marineau
+ * <sebastien@qnx.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * SEBASTIEN MARINEAU BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of Sebastien Marineau shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from Sebastien Marineau.
+ *
+ * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/qnx4/qnx_mouse.c,v 1.4 2002/01/07 20:38:29 dawes Exp $
+ */
+
+/* This module contains the qnx-specific functions to access the keyboard
+ * and the console.
+ */
+
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <i86.h>
+#include <sys/mman.h>
+#include <sys/dev.h>
+#include <sys/mouse.h>
+#include <sys/proxy.h>
+#include <errno.h>
+
+#include <X11/X.h>
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86Xinput.h"
+#include "xf86OSmouse.h"
+
+extern int miPointerGetMotionEvents(
+ DeviceIntPtr /*pPtr*/,
+ xTimecoord * /*coords*/,
+ unsigned long /*start*/,
+ unsigned long /*stop*/,
+ ScreenPtr /*pScreen*/
+);
+
+struct _mouse_ctrl *QNX_mouse = NULL;
+pid_t QNX_mouse_proxy = -1;
+Bool QNX_mouse_event = FALSE;
+
+/* the following function is converted from old void xf86OsMouseEvents() */
+static void
+OsMouseReadInput(InputInfoPtr pInfo)
+{
+ struct mouse_event events[16];
+ int i, nEvents;
+ int buttons, col, row;
+ int armed = 0;
+ MouseDevPtr pMse;
+
+ pMse = pInfo->private;
+
+ while ((nEvents = mouse_read(QNX_mouse, &events,
+ 16, QNX_mouse_proxy, &armed) ) > 0) {
+ /* ErrorF("Got mouse event, #%d!\n", nEvents);*/
+
+ for (i = 0; i < nEvents; i ++){
+ col = events[i].dx;
+ row = -events[i].dy;
+ buttons = events[i].buttons;
+ pMse->PostEvent(pInfo, buttons, col, row, 0, 0);
+ }
+ }
+ if (!armed) ErrorF("Drained mouse queue, armed = 0??\n");
+ QNX_mouse_event = FALSE;
+}
+
+/* The main mouse setup proc */
+static int
+OsMouseProc(pPointer, what)
+DeviceIntPtr pPointer;
+int what;
+{
+ int i, ret, armed;
+ int nbuttons;
+ unsigned char *map;
+ struct mouse_event mevent;
+ MouseDevPtr pMse;
+ InputInfoPtr pInfo;
+
+ pInfo = pPointer->public.devicePrivate;
+ pMse = pInfo->private;
+ pMse->device = pPointer;
+
+ switch (what) {
+ case DEVICE_INIT:
+ pPointer->public.on = FALSE;
+ if (QNX_mouse_proxy == -1) {
+ if((QNX_mouse_proxy =
+ qnx_proxy_attach(0, 0, 0, -1)) == -1){
+ FatalError("xf86MouseOn: Could not create mouse proxy; %s\n",
+ strerror(errno));
+ }
+ }
+ if (QNX_mouse == NULL) QNX_mouse =
+ mouse_open(0, NULL, xf86Info.consoleFd);
+ if (QNX_mouse == NULL) {
+ if (xf86AllowMouseOpenFail) {
+ ErrorF("Cannot open mouse (%s) - Continuing...\n",
+ strerror(errno));
+ return(-1);
+ }
+ FatalError("Cannot open mouse (%s)\n", strerror(errno));
+ }
+ /* Ok, so we have opened the channel to the mouse driver */
+ ErrorF("Opened mouse: handle %d buttons\n", QNX_mouse->handle,
+ QNX_mouse->buttons);
+ pInfo->fd = QNX_mouse->fd;
+ mouse_flush(QNX_mouse);
+ QNX_mouse_event = FALSE;
+ /* How de we determine how many buttons we have?? */
+ nbuttons = 3;
+ map = (unsigned char *) xalloc(nbuttons + 1);
+ if (map == (unsigned char *) NULL)
+ FatalError("Failed to allocate memory for mouse structures\n");
+ for(i=0;i <= nbuttons; i++)
+ map[i] = i;
+ InitPointerDeviceStruct ((DevicePtr) pPointer, map, nbuttons,
+ miPointerGetMotionEvents, pMse->Ctrl,
+ miPointerGetMotionBufferSize());
+
+ /* X valuator */
+ xf86InitValuatorAxisStruct(pPointer, 0, 0, -1, 1, 0, 1);
+ xf86InitValuatorDefaults(pPointer, 0);
+ /* Y valuator */
+ xf86InitValuatorAxisStruct(pPointer, 1, 0, -1, 1, 0, 1);
+ xf86InitValuatorDefaults(pPointer, 1);
+ xf86MotionHistoryAllocate(pInfo);
+
+ xfree(map);
+ break;
+
+ case DEVICE_ON:
+ if(QNX_mouse == NULL) return(-1);
+ pMse->lastButtons = 0;
+ pMse->lastMappedButtons = 0;
+ pMse->emulateState = 0;
+ pPointer->public.on = TRUE;
+ mouse_flush(QNX_mouse);
+ /* AddEnabledDevice(pInfo->fd); */
+ ret = mouse_read(QNX_mouse, &mevent, 0,
+ QNX_mouse_proxy, NULL);
+ ErrorF("MouseOn: armed proxy, %d, proxy pid %d\n", ret,
+ QNX_mouse_proxy);
+ if (ret < 0) {
+ FatalError("xf86MouseOn: could not arm proxy; %s\n",
+ strerror(errno));
+ }
+ break;
+
+ case DEVICE_CLOSE:
+ case DEVICE_OFF:
+ if(QNX_mouse == NULL) return(-1);
+ pPointer->public.on = FALSE;
+ if (what == DEVICE_CLOSE){
+ mouse_close (QNX_mouse);
+ QNX_mouse = NULL;
+ }
+ pPointer->public.on = FALSE;
+ break;
+ }
+ return (Success);
+}
+
+static int
+SupportedInterfaces(void)
+{
+ /* XXX Need to check this. */
+ return MSE_SERIAL | MSE_BUS | MSE_PS2 | MSE_XPS2 | MSE_MISC | MSE_AUTO;
+}
+
+static const char *internalNames[] = {
+ "OSMouse",
+ NULL
+};
+
+static const char **
+BuiltinNames(void)
+{
+ return internalNames;
+}
+
+static Bool
+CheckProtocol(const char *protocol)
+{
+ int i;
+
+ for (i = 0; internalNames[i]; i++)
+ if (xf86NameCmp(protocol, internalNames[i]) == 0)
+ return TRUE;
+ return FALSE;
+}
+
+/* XXX Is this appropriate? If not, this function should be removed. */
+static const char *
+DefaultProtocol(void)
+{
+ return "OSMouse";
+}
+
+static Bool
+OsMousePreInit(InputInfoPtr pInfo, const char *protocol, int flags)
+{
+ MouseDevPtr pMse;
+
+ /* This is called when the protocol is "OSMouse". */
+
+ pMse = pInfo->private;
+ pMse->protocol = protocol;
+ xf86Msg(X_CONFIG, "%s: Protocol: %s\n", pInfo->name, protocol);
+
+ /* Collect the options, and process the common options. */
+ xf86CollectInputOptions(pInfo, NULL, NULL);
+ xf86ProcessCommonOptions(pInfo, pInfo->options);
+
+ /* Process common mouse options (like Emulate3Buttons, etc). */
+ pMse->CommonOptions(pInfo);
+
+ /* Setup the local procs. */
+ pInfo->device_control = OsMouseProc;
+ pInfo->read_input = OsMouseReadInput;
+
+ pInfo->flags |= XI86_CONFIGURED;
+ return TRUE;
+}
+
+OSMouseInfoPtr
+xf86OSMouseInit(int flags)
+{
+ OSMouseInfoPtr p;
+
+ p = xcalloc(sizeof(OSMouseInfoRec), 1);
+ if (!p)
+ return NULL;
+ p->SupportedInterfaces = SupportedInterfaces;
+ p->BuiltinNames = BuiltinNames;
+ p->DefaultProtocol = DefaultProtocol;
+ p->CheckProtocol = CheckProtocol;
+ p->PreInit = OsMousePreInit;
+ return p;
+}
diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/qnx4/qnx_select.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/qnx4/qnx_select.c
new file mode 100644
index 000000000..82359fe40
--- /dev/null
+++ b/nx-X11/programs/Xserver/hw/xfree86/os-support/qnx4/qnx_select.c
@@ -0,0 +1,75 @@
+/*
+ * (c) Copyright 1998 by Sebastien Marineau
+ * <sebastien@qnx.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * HOLGER VEIT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of Sebastien Marineau shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from Sebastien Marineau.
+ *
+ * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/qnx/qnx_select.c,v 1.1.2.2 1999/07/23 13:42:37 hohndel Exp $
+ */
+
+/* This module contains the code to use _select_receive to handle
+ * messages from the Mouse and Input driver. These cannot be select'ed on.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#define FD_SETSIZE 256
+#include <sys/select.h>
+#include <sys/kernel.h>
+
+#include <X11/X.h>
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86_OSlib.h"
+
+extern pid_t QNX_mouse_proxy;
+extern Bool QNX_mouse_event;
+extern pid_t QNX_console_proxy;
+
+pid_t _select_receive ( pid_t proxy)
+{
+
+ pid_t pid;
+ char msg[16];
+
+ pid = Receive(0, msg, sizeof(msg));
+/* ErrorF("Received message from pid %d %d. Mouse pid %d\n", pid, proxy,
+ QNX_mouse_proxy);
+*/
+ if (pid == QNX_mouse_proxy) return (-1);
+ if (pid == QNX_console_proxy) {
+ ErrorF("VT swicth requested by proxy to select()\n");
+ xf86Info.vtRequestsPending = TRUE;
+ return(-1);
+ }
+
+ /* For now; check exact semantics */
+ return (proxy);
+}
+
+
diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/qnx4/qnx_utils.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/qnx4/qnx_utils.c
new file mode 100644
index 000000000..f78c0453e
--- /dev/null
+++ b/nx-X11/programs/Xserver/hw/xfree86/os-support/qnx4/qnx_utils.c
@@ -0,0 +1,30 @@
+/* This includes various utility functions which are missing otherwise
+ * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/qnx/qnx_utils.c,v 1.1.2.2 1999/07/23 13:42:39 hohndel Exp $
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <limits.h>
+#include <string.h>
+#include <i86.h>
+#include <conio.h>
+#include <time.h>
+
+#include <X11/X.h>
+#include <xf86.h>
+
+void usleep (unsigned long interval) { delay( interval/1000 ); }
+
+/* We have our own version of GetTimeInMillis, because the normal
+ * version calls gettimeofday(), which seems to thrash ES...
+ */
+CARD32
+GetTimeInMillis()
+{
+struct timespec tp;
+
+ qnx_getclock(0, CLOCK_REALTIME, &tp);
+ return((tp.tv_sec * 1000) + (tp.tv_nsec / 1000000));
+}
diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/qnx4/qnx_video.c b/nx-X11/programs/Xserver/hw/xfree86/os-support/qnx4/qnx_video.c
new file mode 100644
index 000000000..578d33ea0
--- /dev/null
+++ b/nx-X11/programs/Xserver/hw/xfree86/os-support/qnx4/qnx_video.c
@@ -0,0 +1,183 @@
+/*
+ * (c) Copyright 1998 by Sebastien Marineau
+ * <sebastien@qnx.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * SEBASTIEN MARINEAU BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of Sebastien Marineau shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from Sebastien Marineau.
+ *
+ * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/qnx4/qnx_video.c,v 1.3tsi Exp $
+ */
+
+/* This module contains the qnx-specific functions to deal with video
+ * framebuffer access and interrupts.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <i86.h>
+#include <sys/mman.h>
+
+#include <X11/X.h>
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86_OSlib.h"
+
+
+/* These are the interrupt enabling/disabling functions. Simply call
+ * the Watcom equivalents.
+ */
+
+void xf86EnableInterrupts()
+{
+ _enable();
+}
+
+void xf86DisableInterrupts()
+{
+ xf86ErrorF("Disable interrupts: not yet...\n");
+ /* _disable(); */
+}
+
+/* These are the routines to map/unmap video memory... */
+
+Bool xf86LinearVidMem()
+{
+ /* Yes we can... */
+ xf86ErrorF("xf86LinearMem: called\n");
+ return(TRUE);
+}
+
+/* This is our shmem "Physical" handle */
+int QNX_PhMem_fd = -1;
+
+
+/* Map a chunk of physical video memory, using mmap */
+
+pointer xf86MapVidMem(ScreenNum, Flags, Base, Size)
+int ScreenNum;
+int Flags;
+unsigned long Base;
+unsigned long Size;
+{
+int fd;
+void *base;
+ xf86ErrorF("xf86MapVidMem called\n");
+ if(QNX_PhMem_fd < 0) {
+ if ((fd = shm_open("Physical", O_RDWR, 0777)) < 0) {
+ FatalError("xf86MapVidMem: Failed to open /dev/shmem\n");
+ }
+ QNX_PhMem_fd = fd;
+ }
+ base = mmap((caddr_t)0, Size,
+ (Flags & VIDMEM_READONLY) ?
+ PROT_READ : (PROT_READ | PROT_WRITE),
+ MAP_SHARED, QNX_PhMem_fd, (off_t)Base);
+ xf86ErrorF("MapVidMem: addr %08x size %08x addr %08x\n", Base,
+ Size, base);
+ if ((long)base == -1)
+ {
+ FatalError("xf86MapVidMem: Failed to mmap video memory\n");
+ }
+ return(base);
+
+}
+
+void xf86UnMapVidMem(ScreenNum, Base, Size)
+int ScreenNum;
+pointer Base;
+unsigned long Size;
+{
+
+ xf86ErrorF("xf86UnmapVidMem called\n");
+ munmap((caddr_t) Base, Size);
+
+}
+
+/* Finally, this function allows us to read the video BIOS content */
+
+int
+xf86ReadBIOS(Base, Offset, Buf, Len)
+unsigned long Base, Offset;
+unsigned char *Buf;
+int Len;
+{
+ unsigned char * VirtBase;
+
+ xf86ErrorF("xf86ReadBIOS called\n");
+ if (QNX_PhMem_fd == -1)
+ {
+ if ((QNX_PhMem_fd = shm_open("Physical", O_RDWR, 0777)) < 0)
+ {
+ FatalError("xf86ReadBIOS: cannot open Physical memory\n");
+ }
+ }
+
+ /* Use mmap to map BIOS region. Note the restrictions on
+ * mmap alignement of offset variable (which must be on a page
+ * boundary).
+ */
+ VirtBase = (unsigned char *) mmap(0, (size_t)((Offset & 0x7fff) + Len), PROT_READ,
+ MAP_SHARED, QNX_PhMem_fd,
+ (off_t) (Base + (Offset & 0xffff8000)));
+ if((long)VirtBase == -1) {
+ FatalError(
+ "xf86ReadBIOS: Could not mmap BIOS memory space, errno=%i\n",
+ errno);
+ }
+
+ /* So now we have our mapping to the BIOS region */
+ /* Do a sanity check on what we have just mapped */
+ if (((off_t)((off_t)Offset & 0x7FFF) != (off_t)0) &&
+ (VirtBase[0] != 0x55) &&
+ (VirtBase[1] != 0xaa)) {
+ xf86ErrorF(
+ "xf86ReadBIOS: BIOS sanity check failed, addr=%x\n",
+ (int)Base + Offset);
+ munmap(VirtBase, (Offset & 0x7fff) + Len);
+ return(-1);
+ }
+
+ /* Things look good: copy BIOS data */
+ memcpy(Buf, VirtBase + (Offset & 0x7fff), Len);
+ munmap(VirtBase, (Offset & 0x7fff) + Len);
+ return(Len);
+
+}
+
+void
+xf86MapReadSideEffects(int ScreenNum, int Flags, pointer Base,
+ unsigned long Size)
+{
+ return;
+}
+
+Bool
+xf86CheckMTRR(int s)
+{
+ return FALSE;
+}
+