|
|
|
|
File: [XFree86 CVS] / xc / programs / Xserver / hw / xfree86 / os-support / qnx4 / qnx_video.c
(download)
Revision: 1.2, Fri Jan 21 02:30:06 2000 UTC (13 years, 4 months ago) by dawes Branch: MAIN CVS Tags: xf-4_1_99_4, xf-4_1_99_3, xf-4_1_99_2, xf-4_1_99_1, xf-4_1_0_2, xf-4_1_0_1, xf-4_1_0-bindist, xf-4_1_0, xf-4_1-branch, xf-4_0g, xf-4_0f, xf-4_0e, xf-4_0d, xf-4_0c, xf-4_0b, xf-4_0a, xf-4_0_99_902, xf-4_0_99_901, xf-4_0_99_900, xf-4_0_99_3, xf-4_0_99_2, xf-4_0_99_1, xf-4_0_3b, xf-4_0_3a, xf-4_0_3, xf-4_0_2c, xf-4_0_2b, xf-4_0_2a, xf-4_0_2-branch, xf-4_0_2-bindist, xf-4_0_2, xf-4_0_1h, xf-4_0_1g, xf-4_0_1f, xf-4_0_1e, xf-4_0_1d, xf-4_0_1c, xf-4_0_1b, xf-4_0_1a, xf-4_0_1Zc, xf-4_0_1Zb, xf-4_0_1Za, xf-4_0_1Z, xf-4_0_1-bindist, xf-4_0_1, xf-4_0Z, xf-4_0-bindist, xf-4_0, xf-3_9_18b, xf-3_9_18a, xf-3_9_18Za, xf-3_9_18Z, xf-3_9_18, xf-3_9_17f, xf-3_9_17e, xf-3_9_17d, xf-3_9_17c, xf-3_9_17b, xf-3_9_17a, xf-3_9_17Z, pre-R651-import Branch point for: Domain-branch Changes since 1.1: +8 -8 lines 3565. Update linux.cf to use the kernel header files on Debian rather than
those packaged with the libc headers (#3544, Simon Richter).
3564. Add an item to the default twm menu to open an xterm window (#3584,
David Brownlee).
3563. Update Spanish locales in xc/nls (#3583, Fernando Herrera).
3562. Fix I2C/DDC for S3 ViRGE (#3582, Harald Koenig).
3561. Update the fbdevhw module for some new cards (#3579, Kostas Gewrgiou).
3560. Fix interpret_vdif.c for big endian machines (#3578, Kostas Gewrgiou).
3559. Minor fix to DDC to find monitor descriptions in EDID v1.1 (#3576,
Egbert Eich).
3558. Allow silken mouse to work when building on Linux without DRI (#3574,
Keith Packard).
3557. Only do the kbdrate I/O on architectures that support it (#3573, 3581,
Kostas Gewrgiou, Branden Robinson).
3556. Fix XAA colour expansion for big-endian architectures (#3572,
Kostas Gewrgiou).
3555. Update QNX support (#3570, Frank Guangxin Liu).
|
/*
* (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.1 1999/12/27 00:45:48 robin Exp $
*/
/* This module contains the qnx-specific functions to deal with video
* framebuffer access and interrupts.
*/
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <i86.h>
#include <sys/mman.h>
#include <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;
unsigned char *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 = (unsigned char *) mmap((caddr_t)0, Size, 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)
{
}
|
Powered by ViewCVS 0.9.2 |