Removed CRs. Sorry.

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8730 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold
2004-08-30 21:57:06 +00:00
parent 1886cac8e3
commit 232b476c29
13 changed files with 2126 additions and 2126 deletions
+123 -123
View File
@@ -1,123 +1,123 @@
/*****************************************************************************\ /*****************************************************************************\
* Tseng Labs ET6000, ET6100 and ET6300 graphics driver for BeOS 5. * Tseng Labs ET6000, ET6100 and ET6300 graphics driver for BeOS 5.
* Copyright (c) 2003-2004, Evgeniy Vladimirovich Bobkov. * Copyright (c) 2003-2004, Evgeniy Vladimirovich Bobkov.
\*****************************************************************************/ \*****************************************************************************/
#ifndef _DRIVERINTERFACE_H_ #ifndef _DRIVERINTERFACE_H_
#define _DRIVERINTERFACE_H_ #define _DRIVERINTERFACE_H_
#include <Accelerant.h> #include <Accelerant.h>
#include <Drivers.h> #include <Drivers.h>
#include <PCI.h> #include <PCI.h>
#include <OS.h> #include <OS.h>
#if defined(__cplusplus) #if defined(__cplusplus)
extern "C" { extern "C" {
#endif #endif
/* /*
* This is the info that needs to be shared between the kernel driver and * This is the info that needs to be shared between the kernel driver and
* the accelerant for the et6000 driver. * the accelerant for the et6000 driver.
*/ */
/*****************************************************************************/ /*****************************************************************************/
typedef struct { typedef struct {
sem_id sem; sem_id sem;
int32 ben; int32 ben;
} benaphore; } benaphore;
#define INIT_BEN(x) x.sem = create_sem(0, "ET6000 "#x" benaphore"); x.ben = 0; #define INIT_BEN(x) x.sem = create_sem(0, "ET6000 "#x" benaphore"); x.ben = 0;
#define AQUIRE_BEN(x) if((atomic_add(&(x.ben), 1)) >= 1) acquire_sem(x.sem); #define AQUIRE_BEN(x) if((atomic_add(&(x.ben), 1)) >= 1) acquire_sem(x.sem);
#define RELEASE_BEN(x) if((atomic_add(&(x.ben), -1)) > 1) release_sem(x.sem); #define RELEASE_BEN(x) if((atomic_add(&(x.ben), -1)) > 1) release_sem(x.sem);
#define DELETE_BEN(x) delete_sem(x.sem); #define DELETE_BEN(x) delete_sem(x.sem);
/*****************************************************************************/ /*****************************************************************************/
#define ET6000_PRIVATE_DATA_MAGIC 0x100CC001 #define ET6000_PRIVATE_DATA_MAGIC 0x100CC001
/*****************************************************************************/ /*****************************************************************************/
#define ET6000_HANDLER_INSTALLED 0x80000000 #define ET6000_HANDLER_INSTALLED 0x80000000
/*****************************************************************************/ /*****************************************************************************/
/* /*
* How many bytes of memory the accelerator (ACL) takes from the off-screen * How many bytes of memory the accelerator (ACL) takes from the off-screen
* part of the adapter onboard memory to perform some of its operations. * part of the adapter onboard memory to perform some of its operations.
*/ */
#define ET6000_ACL_NEEDS_MEMORY 4 #define ET6000_ACL_NEEDS_MEMORY 4
/*****************************************************************************/ /*****************************************************************************/
enum { enum {
ET6000_GET_PRIVATE_DATA = B_DEVICE_OP_CODES_END + 1, ET6000_GET_PRIVATE_DATA = B_DEVICE_OP_CODES_END + 1,
ET6000_GET_PCI, ET6000_GET_PCI,
ET6000_SET_PCI, ET6000_SET_PCI,
ET6000_DEVICE_NAME, ET6000_DEVICE_NAME,
ET6000_PROPOSE_DISPLAY_MODE, ET6000_PROPOSE_DISPLAY_MODE,
ET6000_SET_DISPLAY_MODE ET6000_SET_DISPLAY_MODE
}; };
/*****************************************************************************/ /*****************************************************************************/
typedef struct { typedef struct {
uint16 vendor_id; /* PCI vendor ID, from pci_info */ uint16 vendor_id; /* PCI vendor ID, from pci_info */
uint16 device_id; /* PCI device ID, from pci_info */ uint16 device_id; /* PCI device ID, from pci_info */
uint8 revision; /* PCI device revsion, from pci_info */ uint8 revision; /* PCI device revsion, from pci_info */
area_id memoryArea; /* Onboard memory's area_id. The addresses area_id memoryArea; /* Onboard memory's area_id. The addresses
* are shared with all teams. */ * are shared with all teams. */
void *framebuffer; /* Start of the mapped framebuffer */ void *framebuffer; /* Start of the mapped framebuffer */
void *physFramebuffer; /* Physical address of start of framebuffer */ void *physFramebuffer; /* Physical address of start of framebuffer */
void *memory; /* Start of the mapped adapter onboard memory */ void *memory; /* Start of the mapped adapter onboard memory */
void *physMemory; /* Physical address of start of onboard memory */ void *physMemory; /* Physical address of start of onboard memory */
uint32 memSize; /* Size of available onboard memory, bytes. */ uint32 memSize; /* Size of available onboard memory, bytes. */
uint16 pciConfigSpace; /* PCI header base I/O address */ uint16 pciConfigSpace; /* PCI header base I/O address */
void *mmRegs; /* memory mapped registers */ void *mmRegs; /* memory mapped registers */
void *emRegs; /* external mapped registers */ void *emRegs; /* external mapped registers */
area_id modesArea; /* Contains the list of display modes the driver supports */ area_id modesArea; /* Contains the list of display modes the driver supports */
uint32 modesNum; /* Number of display modes in the list */ uint32 modesNum; /* Number of display modes in the list */
int32 flags; int32 flags;
display_mode dm; /* current display mode configuration */ display_mode dm; /* current display mode configuration */
uint8 bytesPerPixel; /* bytes(!) per pixel at current display mode */ uint8 bytesPerPixel; /* bytes(!) per pixel at current display mode */
frame_buffer_config fbc; /* bytes_per_row and start of frame buffer */ frame_buffer_config fbc; /* bytes_per_row and start of frame buffer */
struct { struct {
uint64 count; /* last fifo slot used */ uint64 count; /* last fifo slot used */
uint64 lastIdle; /* last fifo slot we *know* the engine was idle after */ uint64 lastIdle; /* last fifo slot we *know* the engine was idle after */
benaphore lock; /* for serializing access to the acceleration engine */ benaphore lock; /* for serializing access to the acceleration engine */
} engine; } engine;
uint32 pixelClockMax16; /* The maximum speed the pixel clock should run */ uint32 pixelClockMax16; /* The maximum speed the pixel clock should run */
uint32 pixelClockMax24; /* at for a given pixel width. Usually a function */ uint32 pixelClockMax24; /* at for a given pixel width. Usually a function */
/* of memory and DAC bandwidths. */ /* of memory and DAC bandwidths. */
} ET6000SharedInfo; } ET6000SharedInfo;
/*****************************************************************************/ /*****************************************************************************/
/* Read or write a value in PCI configuration space */ /* Read or write a value in PCI configuration space */
typedef struct { typedef struct {
uint32 magic; /* magic number to make sure the caller groks us */ uint32 magic; /* magic number to make sure the caller groks us */
uint32 offset; /* Offset to read/write */ uint32 offset; /* Offset to read/write */
uint32 size; /* Number of bytes to transfer */ uint32 size; /* Number of bytes to transfer */
uint32 value; /* The value read or written */ uint32 value; /* The value read or written */
} ET6000GetSetPCI; } ET6000GetSetPCI;
/*****************************************************************************/ /*****************************************************************************/
/* Retrieve the area_id of the kernel/accelerant shared info */ /* Retrieve the area_id of the kernel/accelerant shared info */
typedef struct { typedef struct {
uint32 magic; /* magic number to make sure the caller groks us */ uint32 magic; /* magic number to make sure the caller groks us */
area_id sharedInfoArea; /* area_id containing the shared information */ area_id sharedInfoArea; /* area_id containing the shared information */
} ET6000GetPrivateData; } ET6000GetPrivateData;
/*****************************************************************************/ /*****************************************************************************/
/* /*
* Retrieve the device name. Usefull for when we have a file handle, but * Retrieve the device name. Usefull for when we have a file handle, but
* want to know the device name (like when we are cloning the accelerant). * want to know the device name (like when we are cloning the accelerant).
*/ */
typedef struct { typedef struct {
uint32 magic; /* magic number to make sure the caller groks us */ uint32 magic; /* magic number to make sure the caller groks us */
char *name; /* The name of the device, less the /dev root */ char *name; /* The name of the device, less the /dev root */
} ET6000DeviceName; } ET6000DeviceName;
/*****************************************************************************/ /*****************************************************************************/
typedef struct { typedef struct {
uint32 magic; /* magic number to make sure the caller groks us */ uint32 magic; /* magic number to make sure the caller groks us */
display_mode mode; /* Proposed mode or mode to set */ display_mode mode; /* Proposed mode or mode to set */
uint16 pciConfigSpace; /* For setting the mode */ uint16 pciConfigSpace; /* For setting the mode */
uint32 memSize; /* For proposing the mode */ uint32 memSize; /* For proposing the mode */
} ET6000DisplayMode; } ET6000DisplayMode;
/*****************************************************************************/ /*****************************************************************************/
#if defined(__cplusplus) #if defined(__cplusplus)
} }
#endif #endif
#endif /* _DRIVERINTERFACE_H_ */ #endif /* _DRIVERINTERFACE_H_ */
+256 -256
View File
@@ -1,256 +1,256 @@
/*****************************************************************************\ /*****************************************************************************\
* Tseng Labs ET6000, ET6100 and ET6300 graphics driver for BeOS 5. * Tseng Labs ET6000, ET6100 and ET6300 graphics driver for BeOS 5.
* Copyright (c) 2003-2004, Evgeniy Vladimirovich Bobkov. * Copyright (c) 2003-2004, Evgeniy Vladimirovich Bobkov.
\*****************************************************************************/ \*****************************************************************************/
#include "GlobalData.h" #include "GlobalData.h"
#include "generic.h" #include "generic.h"
/*****************************************************************************/ /*****************************************************************************/
/* /*
* Set bits in a byte pointed by addr; mask must contain 0s at the bits * Set bits in a byte pointed by addr; mask must contain 0s at the bits
* positions to be set and must contain 1s at all other bits; val must * positions to be set and must contain 1s at all other bits; val must
* contain the values of bits to be set. * contain the values of bits to be set.
*/ */
__inline void set8(volatile char *addr, char mask, char val) __inline void set8(volatile char *addr, char mask, char val)
{ {
if (mask == 0) if (mask == 0)
*addr = val; *addr = val;
else else
*addr = (*addr & mask) | (val & ~mask); *addr = (*addr & mask) | (val & ~mask);
} }
/*****************************************************************************/ /*****************************************************************************/
__inline char get8(volatile char *addr) __inline char get8(volatile char *addr)
{ {
return *addr; return *addr;
} }
/*****************************************************************************/ /*****************************************************************************/
__inline void et6000aclTerminate(void) { __inline void et6000aclTerminate(void) {
set8(mmRegs+0x31, 0xef, 0x10); /* let ACL to operate */ set8(mmRegs+0x31, 0xef, 0x10); /* let ACL to operate */
et6000aclWaitIdle(); et6000aclWaitIdle();
set8(mmRegs+0x30, 0, 0x00); set8(mmRegs+0x30, 0, 0x00);
set8(mmRegs+0x30, 0, 0x01); set8(mmRegs+0x30, 0, 0x01);
et6000aclWaitIdle(); et6000aclWaitIdle();
set8(mmRegs+0x30, 0, 0x00); set8(mmRegs+0x30, 0, 0x00);
set8(mmRegs+0x30, 0, 0x10); set8(mmRegs+0x30, 0, 0x10);
et6000aclWaitIdle(); et6000aclWaitIdle();
set8(mmRegs+0x30, 0, 0x00); set8(mmRegs+0x30, 0, 0x00);
} }
/*****************************************************************************/ /*****************************************************************************/
/* /*
* bpp must be bytes per pixel, not bits! * bpp must be bytes per pixel, not bits!
*/ */
void et6000aclInit(uint8 bpp) { void et6000aclInit(uint8 bpp) {
et6000aclTerminate(); et6000aclTerminate();
set8(mmRegs+0x31, 0xef, 0x10); /* let ACL to operate */ set8(mmRegs+0x31, 0xef, 0x10); /* let ACL to operate */
set8(mmRegs+0x32, 0x99, 0x00); /* maximize the performance */ set8(mmRegs+0x32, 0x99, 0x00); /* maximize the performance */
set8(mmRegs+0x8e, 0xcf, (bpp - 1) << 4); /* set pixel color depth */ set8(mmRegs+0x8e, 0xcf, (bpp - 1) << 4); /* set pixel color depth */
set8(mmRegs+0x91, 0x80, 0x00); /* maximize the performance */ set8(mmRegs+0x91, 0x80, 0x00); /* maximize the performance */
set8(mmRegs+0x9d, 0x00, 0x00); /* maximize the performance */ set8(mmRegs+0x9d, 0x00, 0x00); /* maximize the performance */
} }
/*****************************************************************************/ /*****************************************************************************/
/* /*
* Wait until ACL becomes idle. * Wait until ACL becomes idle.
*/ */
void et6000aclWaitIdle(void) { void et6000aclWaitIdle(void) {
while ((get8(mmRegs+0x36) & 0x02) == 0x02); while ((get8(mmRegs+0x36) & 0x02) == 0x02);
} }
/*****************************************************************************/ /*****************************************************************************/
/* /*
* Wait until ACL queue becomes not full. * Wait until ACL queue becomes not full.
*/ */
__inline void et6000aclWaitQueueNotFull(void) { __inline void et6000aclWaitQueueNotFull(void) {
while ((get8(mmRegs+0x36) & 0x01) == 0x01); while ((get8(mmRegs+0x36) & 0x01) == 0x01);
} }
/*****************************************************************************/ /*****************************************************************************/
/* /*
* Move the specified list of rectangular regions from one location in * Move the specified list of rectangular regions from one location in
* the frame buffer to another in the order they are specified in the * the frame buffer to another in the order they are specified in the
* blit_params *list. The list is uint32 count elements in length. * blit_params *list. The list is uint32 count elements in length.
*/ */
void SCREEN_TO_SCREEN_BLIT(engine_token *et, void SCREEN_TO_SCREEN_BLIT(engine_token *et,
blit_params *list, blit_params *list,
uint32 count) uint32 count)
{ {
uint16 screenWidth = si->dm.virtual_width; uint16 screenWidth = si->dm.virtual_width;
uint8 bpp = si->bytesPerPixel; uint8 bpp = si->bytesPerPixel;
uint8 bltDir; uint8 bltDir;
uint16 src_left, src_top, dest_left, dest_top, width, height; uint16 src_left, src_top, dest_left, dest_top, width, height;
uint32 srcAddr, destAddr; uint32 srcAddr, destAddr;
et6000aclWaitQueueNotFull(); et6000aclWaitQueueNotFull();
set8(mmRegs+0x92, 0x80, 0x77); /* no source wrap */ set8(mmRegs+0x92, 0x80, 0x77); /* no source wrap */
set8(mmRegs+0x9c, 0x00, 0x33); /* mask=1 always, always use FGR */ set8(mmRegs+0x9c, 0x00, 0x33); /* mask=1 always, always use FGR */
set8(mmRegs+0x9f, 0x00, 0xcc); /* FGR ROP = copy of source */ set8(mmRegs+0x9f, 0x00, 0xcc); /* FGR ROP = copy of source */
/* Set the source Y offset */ /* Set the source Y offset */
*((vuint16 *)(mmRegs+0x8a)) = screenWidth * bpp - 1; *((vuint16 *)(mmRegs+0x8a)) = screenWidth * bpp - 1;
/* Set the destination Y offset */ /* Set the destination Y offset */
*((vuint16 *)(mmRegs+0x8c)) = screenWidth * bpp - 1; *((vuint16 *)(mmRegs+0x8c)) = screenWidth * bpp - 1;
while(count--) { while(count--) {
src_left = list->src_left; src_left = list->src_left;
src_top = list->src_top; src_top = list->src_top;
dest_left = list->dest_left; dest_left = list->dest_left;
dest_top = list->dest_top; dest_top = list->dest_top;
width = list->width; width = list->width;
height = list->height; height = list->height;
et6000aclWaitQueueNotFull(); et6000aclWaitQueueNotFull();
/* Set the direction and opcode(BitBLT) register */ /* Set the direction and opcode(BitBLT) register */
bltDir = 0x00; bltDir = 0x00;
if (src_left < dest_left) bltDir |= 0x01; if (src_left < dest_left) bltDir |= 0x01;
if (src_top < dest_top) bltDir |= 0x02; if (src_top < dest_top) bltDir |= 0x02;
set8(mmRegs+0x8f, 0x3c, bltDir); set8(mmRegs+0x8f, 0x3c, bltDir);
/* Set the X count register */ /* Set the X count register */
*((vuint16 *)(mmRegs+0x98)) = (width + 1) * bpp - 1; *((vuint16 *)(mmRegs+0x98)) = (width + 1) * bpp - 1;
/* Set the Y count register */ /* Set the Y count register */
*((vuint16 *)(mmRegs+0x9a)) = height; *((vuint16 *)(mmRegs+0x9a)) = height;
switch (bltDir & 0x03) { switch (bltDir & 0x03) {
case 0x00: case 0x00:
srcAddr = (src_top * screenWidth + src_left) * bpp; srcAddr = (src_top * screenWidth + src_left) * bpp;
destAddr = (dest_top * screenWidth + dest_left) * bpp; destAddr = (dest_top * screenWidth + dest_left) * bpp;
break; break;
case 0x01: case 0x01:
srcAddr = (src_top * screenWidth + src_left + width) * bpp + bpp-1; srcAddr = (src_top * screenWidth + src_left + width) * bpp + bpp-1;
destAddr = (dest_top * screenWidth + dest_left + width) * bpp + bpp-1; destAddr = (dest_top * screenWidth + dest_left + width) * bpp + bpp-1;
break; break;
case 0x02: case 0x02:
srcAddr = ((src_top + height)*screenWidth + src_left) * bpp; srcAddr = ((src_top + height)*screenWidth + src_left) * bpp;
destAddr = ((dest_top + height)*screenWidth + dest_left) * bpp; destAddr = ((dest_top + height)*screenWidth + dest_left) * bpp;
break; break;
case 0x03: case 0x03:
srcAddr = ((src_top + height)*screenWidth + src_left + width) * bpp + bpp-1; srcAddr = ((src_top + height)*screenWidth + src_left + width) * bpp + bpp-1;
destAddr = ((dest_top + height)*screenWidth + dest_left + width) * bpp + bpp-1; destAddr = ((dest_top + height)*screenWidth + dest_left + width) * bpp + bpp-1;
break; break;
} }
/* Set the source address */ /* Set the source address */
*((vuint32 *)(mmRegs+0x84)) = srcAddr; *((vuint32 *)(mmRegs+0x84)) = srcAddr;
/* /*
* Set the destination address - * Set the destination address -
* this action starts the BitBLT operation. * this action starts the BitBLT operation.
*/ */
*((vuint32 *)(mmRegs+0xa0)) = destAddr; *((vuint32 *)(mmRegs+0xa0)) = destAddr;
list++; list++;
} }
si->engine.count++; si->engine.count++;
} }
/*****************************************************************************/ /*****************************************************************************/
/* /*
* Fill the specified list of rectangular regions with the specified color. * Fill the specified list of rectangular regions with the specified color.
* The list is uint32 count elements in length. The rectangular regions are * The list is uint32 count elements in length. The rectangular regions are
* inclusive. The uint32 color is specified in the same configuration and * inclusive. The uint32 color is specified in the same configuration and
* byte order as the current display_mode. All coordinates in the list of * byte order as the current display_mode. All coordinates in the list of
* rectangles is guaranteed to have been clipped to the virtual limits of * rectangles is guaranteed to have been clipped to the virtual limits of
* the display_mode. * the display_mode.
*/ */
void FILL_RECTANGLE(engine_token *et, void FILL_RECTANGLE(engine_token *et,
uint32 color, uint32 color,
fill_rect_params *list, fill_rect_params *list,
uint32 count) uint32 count)
{ {
uint16 screenWidth = si->dm.virtual_width; uint16 screenWidth = si->dm.virtual_width;
uint8 bpp = si->bytesPerPixel; uint8 bpp = si->bytesPerPixel;
uint16 left, top, right, bottom; uint16 left, top, right, bottom;
uint32 srcAddr; uint32 srcAddr;
uint8 i; uint8 i;
/* /*
* Normally WaitQueueNotFull should be required & enough, but in reality * Normally WaitQueueNotFull should be required & enough, but in reality
* this is somewhy sometimes not enough for pixel depth of 3 bytes. * this is somewhy sometimes not enough for pixel depth of 3 bytes.
*/ */
if (bpp == 2) if (bpp == 2)
et6000aclWaitQueueNotFull(); et6000aclWaitQueueNotFull();
else else
et6000aclWaitIdle(); et6000aclWaitIdle();
/* /*
* We'll put the color at 4 bytes just after the framebuffer. * We'll put the color at 4 bytes just after the framebuffer.
* The srcAddr must be 4 bytes aligned and is always for standard * The srcAddr must be 4 bytes aligned and is always for standard
* resolutions. * resolutions.
*/ */
srcAddr = (uint32)si->framebuffer - (uint32)si->memory + srcAddr = (uint32)si->framebuffer - (uint32)si->memory +
si->dm.virtual_width * si->dm.virtual_height * bpp; si->dm.virtual_width * si->dm.virtual_height * bpp;
switch(bpp) { switch(bpp) {
case 2: case 2:
set8(mmRegs+0x92, 0x80, 0x02); /* 4x1 source wrap */ set8(mmRegs+0x92, 0x80, 0x02); /* 4x1 source wrap */
for (i = 0; i < 2; i++) /* copy the color to source address */ for (i = 0; i < 2; i++) /* copy the color to source address */
((vuint16 *)((uint32)si->memory + srcAddr))[i] = (uint16)color; ((vuint16 *)((uint32)si->memory + srcAddr))[i] = (uint16)color;
break; break;
case 3: case 3:
set8(mmRegs+0x92, 0x80, 0x0a); /* 3x1 source wrap */ set8(mmRegs+0x92, 0x80, 0x0a); /* 3x1 source wrap */
for (i = 0; i < 3; i++) /* copy the color to source address */ for (i = 0; i < 3; i++) /* copy the color to source address */
((vuint8 *)((uint32)si->memory + srcAddr))[i] = ((uint8 *)&color)[i]; ((vuint8 *)((uint32)si->memory + srcAddr))[i] = ((uint8 *)&color)[i];
break; break;
} }
set8(mmRegs+0x9c, 0x00, 0x33); /* mask=1 always, always use FGR */ set8(mmRegs+0x9c, 0x00, 0x33); /* mask=1 always, always use FGR */
set8(mmRegs+0x9f, 0x00, 0xcc); /* FGR ROP = copy of source */ set8(mmRegs+0x9f, 0x00, 0xcc); /* FGR ROP = copy of source */
/* Set the source Y offset */ /* Set the source Y offset */
*((vuint16 *)(mmRegs+0x8a)) = screenWidth * bpp - 1; *((vuint16 *)(mmRegs+0x8a)) = screenWidth * bpp - 1;
/* Set the destination Y offset */ /* Set the destination Y offset */
*((vuint16 *)(mmRegs+0x8c)) = screenWidth * bpp - 1; *((vuint16 *)(mmRegs+0x8c)) = screenWidth * bpp - 1;
/* Set the direction and opcode(trapezoid) register (primary edge) */ /* Set the direction and opcode(trapezoid) register (primary edge) */
set8(mmRegs+0x8f, 0x18, 0x40); set8(mmRegs+0x8f, 0x18, 0x40);
/* Set the secondary edge register */ /* Set the secondary edge register */
set8(mmRegs+0x93, 0x1a, 0x00); set8(mmRegs+0x93, 0x1a, 0x00);
/* Set the primary delta minor register */ /* Set the primary delta minor register */
*((vuint16 *)(mmRegs+0xac)) = 0; *((vuint16 *)(mmRegs+0xac)) = 0;
/* Set the secondary delta minor register */ /* Set the secondary delta minor register */
*((vuint16 *)(mmRegs+0xb4)) = 0; *((vuint16 *)(mmRegs+0xb4)) = 0;
while(count--) { while(count--) {
left = list->left; left = list->left;
top = list->top; top = list->top;
right = list->right; right = list->right;
bottom = list->bottom; bottom = list->bottom;
et6000aclWaitQueueNotFull(); et6000aclWaitQueueNotFull();
/* Set the X count register */ /* Set the X count register */
*((vuint16 *)(mmRegs+0x98)) = (right-left+1)*bpp - 1; *((vuint16 *)(mmRegs+0x98)) = (right-left+1)*bpp - 1;
/* Set the Y count register */ /* Set the Y count register */
*((vuint16 *)(mmRegs+0x9a)) = bottom-top; *((vuint16 *)(mmRegs+0x9a)) = bottom-top;
/* Set the primary delta major register */ /* Set the primary delta major register */
*((vuint16 *)(mmRegs+0xae)) = bottom-top; *((vuint16 *)(mmRegs+0xae)) = bottom-top;
/* Set the secondary delta major register */ /* Set the secondary delta major register */
*((vuint16 *)(mmRegs+0xb6)) = bottom-top; *((vuint16 *)(mmRegs+0xb6)) = bottom-top;
/* Set the source address */ /* Set the source address */
*((vuint32 *)(mmRegs+0x84)) = srcAddr; *((vuint32 *)(mmRegs+0x84)) = srcAddr;
/* /*
* Set the destination address - * Set the destination address -
* this action starts the trapezoid operation. * this action starts the trapezoid operation.
*/ */
*((vuint32 *)(mmRegs+0xa0)) = (top * screenWidth + left) * bpp; *((vuint32 *)(mmRegs+0xa0)) = (top * screenWidth + left) * bpp;
list++; list++;
} }
si->engine.count++; si->engine.count++;
} }
/*****************************************************************************/ /*****************************************************************************/
+17 -17
View File
@@ -1,17 +1,17 @@
/*****************************************************************************\ /*****************************************************************************\
* Tseng Labs ET6000, ET6100 and ET6300 graphics driver for BeOS 5. * Tseng Labs ET6000, ET6100 and ET6300 graphics driver for BeOS 5.
* Copyright (c) 2003-2004, Evgeniy Vladimirovich Bobkov. * Copyright (c) 2003-2004, Evgeniy Vladimirovich Bobkov.
\*****************************************************************************/ \*****************************************************************************/
#include "GlobalData.h" #include "GlobalData.h"
/*****************************************************************************/ /*****************************************************************************/
int fd; int fd;
ET6000SharedInfo *si; ET6000SharedInfo *si;
area_id sharedInfoArea; area_id sharedInfoArea;
display_mode *et6000ModesList; display_mode *et6000ModesList;
area_id et6000ModesListArea; area_id et6000ModesListArea;
int accelerantIsClone; int accelerantIsClone;
volatile unsigned char *mmRegs; /* memory mapped registers */ volatile unsigned char *mmRegs; /* memory mapped registers */
/*****************************************************************************/ /*****************************************************************************/
+23 -23
View File
@@ -1,23 +1,23 @@
/*****************************************************************************\ /*****************************************************************************\
* Tseng Labs ET6000, ET6100 and ET6300 graphics driver for BeOS 5. * Tseng Labs ET6000, ET6100 and ET6300 graphics driver for BeOS 5.
* Copyright (c) 2003-2004, Evgeniy Vladimirovich Bobkov. * Copyright (c) 2003-2004, Evgeniy Vladimirovich Bobkov.
\*****************************************************************************/ \*****************************************************************************/
#ifndef _ET6000GLOBALDATA_H_ #ifndef _ET6000GLOBALDATA_H_
#define _ET6000GLOBALDATA_H_ #define _ET6000GLOBALDATA_H_
#include "DriverInterface.h" #include "DriverInterface.h"
/*****************************************************************************/ /*****************************************************************************/
extern int fd; extern int fd;
extern ET6000SharedInfo *si; extern ET6000SharedInfo *si;
extern area_id sharedInfoArea; extern area_id sharedInfoArea;
extern display_mode *et6000ModesList; extern display_mode *et6000ModesList;
extern area_id et6000ModesListArea; extern area_id et6000ModesListArea;
extern int accelerantIsClone; extern int accelerantIsClone;
extern volatile unsigned char *mmRegs; /* memory mapped registers */ extern volatile unsigned char *mmRegs; /* memory mapped registers */
/*****************************************************************************/ /*****************************************************************************/
#endif /* _ET6000GLOBALDATA_H_ */ #endif /* _ET6000GLOBALDATA_H_ */
+227 -227
View File
@@ -1,227 +1,227 @@
/*****************************************************************************\ /*****************************************************************************\
* Tseng Labs ET6000, ET6100 and ET6300 graphics driver for BeOS 5. * Tseng Labs ET6000, ET6100 and ET6300 graphics driver for BeOS 5.
* Copyright (c) 2003-2004, Evgeniy Vladimirovich Bobkov. * Copyright (c) 2003-2004, Evgeniy Vladimirovich Bobkov.
\*****************************************************************************/ \*****************************************************************************/
#include "GlobalData.h" #include "GlobalData.h"
#include "generic.h" #include "generic.h"
#include "string.h" #include "string.h"
#include "unistd.h" #include "unistd.h"
#include "sys/types.h" #include "sys/types.h"
#include "sys/stat.h" #include "sys/stat.h"
#include "fcntl.h" #include "fcntl.h"
#include <sys/ioctl.h> #include <sys/ioctl.h>
/*****************************************************************************/ /*****************************************************************************/
/* /*
* Initialization code shared between primary and cloned accelerants. * Initialization code shared between primary and cloned accelerants.
*/ */
static status_t initCommon(int the_fd) { static status_t initCommon(int the_fd) {
status_t result; status_t result;
ET6000GetPrivateData gpd; ET6000GetPrivateData gpd;
/* memorize the file descriptor */ /* memorize the file descriptor */
fd = the_fd; fd = the_fd;
/* set the magic number so the driver knows we're for real */ /* set the magic number so the driver knows we're for real */
gpd.magic = ET6000_PRIVATE_DATA_MAGIC; gpd.magic = ET6000_PRIVATE_DATA_MAGIC;
/* contact driver and get a pointer to the registers and shared data */ /* contact driver and get a pointer to the registers and shared data */
result = ioctl(fd, ET6000_GET_PRIVATE_DATA, &gpd, sizeof(gpd)); result = ioctl(fd, ET6000_GET_PRIVATE_DATA, &gpd, sizeof(gpd));
if (result != B_OK) goto error0; if (result != B_OK) goto error0;
/* clone the shared area for our use */ /* clone the shared area for our use */
sharedInfoArea = clone_area("ET6000 shared info", (void **)&si, sharedInfoArea = clone_area("ET6000 shared info", (void **)&si,
B_ANY_ADDRESS, B_READ_AREA | B_WRITE_AREA, gpd.sharedInfoArea); B_ANY_ADDRESS, B_READ_AREA | B_WRITE_AREA, gpd.sharedInfoArea);
if (sharedInfoArea < 0) { if (sharedInfoArea < 0) {
result = sharedInfoArea; result = sharedInfoArea;
goto error0; goto error0;
} }
mmRegs = si->mmRegs; mmRegs = si->mmRegs;
error0: error0:
return result; return result;
} }
/*****************************************************************************/ /*****************************************************************************/
/* /*
* Clean up code shared between primary and cloned accelrants. * Clean up code shared between primary and cloned accelrants.
*/ */
static void uninitCommon(void) { static void uninitCommon(void) {
/* release our copy of the shared info from the kernel driver */ /* release our copy of the shared info from the kernel driver */
delete_area(sharedInfoArea); delete_area(sharedInfoArea);
si = 0; si = 0;
} }
/*****************************************************************************/ /*****************************************************************************/
/* /*
* Initialize the accelerant. the_fd is the file handle of the device * Initialize the accelerant. the_fd is the file handle of the device
* (in /dev/graphics) that has been opened by the app_server (or some test * (in /dev/graphics) that has been opened by the app_server (or some test
* harness). We need to determine if the kernel driver and the accelerant * harness). We need to determine if the kernel driver and the accelerant
* are compatible. If they are, get the accelerant ready to handle other * are compatible. If they are, get the accelerant ready to handle other
* hook functions and report success or failure. * hook functions and report success or failure.
*/ */
status_t INIT_ACCELERANT(int the_fd) { status_t INIT_ACCELERANT(int the_fd) {
status_t result; status_t result;
/* note that we're the primary accelerant (accelerantIsClone is global) */ /* note that we're the primary accelerant (accelerantIsClone is global) */
accelerantIsClone = 0; accelerantIsClone = 0;
/* do the initialization common to both the primary and the clones */ /* do the initialization common to both the primary and the clones */
result = initCommon(the_fd); result = initCommon(the_fd);
/* bail out if the common initialization failed */ /* bail out if the common initialization failed */
if (result != B_OK) goto error0; if (result != B_OK) goto error0;
/* Call the device specific initialization code here, bail out if it failed */ /* Call the device specific initialization code here, bail out if it failed */
if (result != B_OK) goto error1; if (result != B_OK) goto error1;
/* /*
* Now is a good time to figure out what video modes the card supports. * Now is a good time to figure out what video modes the card supports.
* We'll place the list of modes in another shared area so all * We'll place the list of modes in another shared area so all
* of the copies of the driver can see them. The primary copy of the * of the copies of the driver can see them. The primary copy of the
* accelerant (ie the one initialized with this routine) will own the * accelerant (ie the one initialized with this routine) will own the
* "one true copy" of the list. Everybody else get's a read-only clone. * "one true copy" of the list. Everybody else get's a read-only clone.
*/ */
result = createModesList(); result = createModesList();
if (result != B_OK) goto error2; if (result != B_OK) goto error2;
/* /*
* We store this info in a frame_buffer_config structure to * We store this info in a frame_buffer_config structure to
* make it convienient to return to the app_server later. * make it convienient to return to the app_server later.
*/ */
si->fbc.frame_buffer = si->framebuffer; si->fbc.frame_buffer = si->framebuffer;
si->fbc.frame_buffer_dma = si->physFramebuffer; si->fbc.frame_buffer_dma = si->physFramebuffer;
/* init the shared semaphore */ /* init the shared semaphore */
INIT_BEN(si->engine.lock); INIT_BEN(si->engine.lock);
/* initialize the engine synchronization variables */ /* initialize the engine synchronization variables */
/* count of issued parameters or commands */ /* count of issued parameters or commands */
si->engine.lastIdle = si->engine.count = 0; si->engine.lastIdle = si->engine.count = 0;
/* bail out if something failed */ /* bail out if something failed */
if (result != B_OK) goto error3; if (result != B_OK) goto error3;
/* a winner! */ /* a winner! */
result = B_OK; result = B_OK;
goto error0; goto error0;
error3: error3:
/* free up the benaphore */ /* free up the benaphore */
DELETE_BEN(si->engine.lock); DELETE_BEN(si->engine.lock);
error2: error2:
/* /*
* Clean up any resources allocated in your device * Clean up any resources allocated in your device
* specific initialization code. * specific initialization code.
*/ */
error1: error1:
/* /*
* Initialization failed after initCommon() succeeded, so we need to * Initialization failed after initCommon() succeeded, so we need to
* clean up before quiting. * clean up before quiting.
*/ */
uninitCommon(); uninitCommon();
error0: error0:
return result; return result;
} }
/*****************************************************************************/ /*****************************************************************************/
/* /*
* Return the number of bytes required to hold the information required * Return the number of bytes required to hold the information required
* to clone the device. * to clone the device.
*/ */
ssize_t ACCELERANT_CLONE_INFO_SIZE(void) { ssize_t ACCELERANT_CLONE_INFO_SIZE(void) {
/* /*
* Since we're passing the name of the device as the only required * Since we're passing the name of the device as the only required
* info, return the size of the name buffer * info, return the size of the name buffer
*/ */
return B_OS_NAME_LENGTH; return B_OS_NAME_LENGTH;
} }
/*****************************************************************************/ /*****************************************************************************/
/* /*
* Return the info required to clone the device. void *data points to * Return the info required to clone the device. void *data points to
* a buffer at least ACCELERANT_CLONE_INFO_SIZE() bytes in length. * a buffer at least ACCELERANT_CLONE_INFO_SIZE() bytes in length.
*/ */
void GET_ACCELERANT_CLONE_INFO(void *data) { void GET_ACCELERANT_CLONE_INFO(void *data) {
ET6000DeviceName dn; ET6000DeviceName dn;
status_t result; status_t result;
/* call the kernel driver to get the device name */ /* call the kernel driver to get the device name */
dn.magic = ET6000_PRIVATE_DATA_MAGIC; dn.magic = ET6000_PRIVATE_DATA_MAGIC;
/* store the returned info directly into the passed buffer */ /* store the returned info directly into the passed buffer */
dn.name = (char *)data; dn.name = (char *)data;
result = ioctl(fd, ET6000_DEVICE_NAME, &dn, sizeof(dn)); result = ioctl(fd, ET6000_DEVICE_NAME, &dn, sizeof(dn));
} }
/*****************************************************************************/ /*****************************************************************************/
/* /*
* Initialize a copy of the accelerant as a clone. void *data points * Initialize a copy of the accelerant as a clone. void *data points
* to a copy of the data returned by GET_ACCELERANT_CLONE_INFO(). * to a copy of the data returned by GET_ACCELERANT_CLONE_INFO().
*/ */
status_t CLONE_ACCELERANT(void *data) { status_t CLONE_ACCELERANT(void *data) {
status_t result; status_t result;
char path[MAXPATHLEN]; char path[MAXPATHLEN];
/* the data is the device name */ /* the data is the device name */
strcpy(path, "/dev"); strcpy(path, "/dev");
strcat(path, (const char *)data); strcat(path, (const char *)data);
/* open the device, the permissions aren't important */ /* open the device, the permissions aren't important */
fd = open(path, B_READ_WRITE); fd = open(path, B_READ_WRITE);
if (fd < 0) { if (fd < 0) {
result = fd; result = fd;
goto error0; goto error0;
} }
/* note that we're a clone accelerant */ /* note that we're a clone accelerant */
accelerantIsClone = 1; accelerantIsClone = 1;
/* call the shared initialization code */ /* call the shared initialization code */
result = initCommon(fd); result = initCommon(fd);
/* bail out if the common initialization failed */ /* bail out if the common initialization failed */
if (result != B_OK) goto error1; if (result != B_OK) goto error1;
/* get shared area for display modes */ /* get shared area for display modes */
result = et6000ModesListArea = clone_area("ET6000 cloned display_modes", result = et6000ModesListArea = clone_area("ET6000 cloned display_modes",
(void **)&et6000ModesList, B_ANY_ADDRESS, B_READ_AREA, si->modesArea); (void **)&et6000ModesList, B_ANY_ADDRESS, B_READ_AREA, si->modesArea);
if (result < B_OK) goto error2; if (result < B_OK) goto error2;
/* all done */ /* all done */
result = B_OK; result = B_OK;
goto error0; goto error0;
error2: error2:
/* free up the areas we cloned */ /* free up the areas we cloned */
uninitCommon(); uninitCommon();
error1: error1:
/* close the device we opened */ /* close the device we opened */
close(fd); close(fd);
error0: error0:
return result; return result;
} }
/*****************************************************************************/ /*****************************************************************************/
void UNINIT_ACCELERANT(void) { void UNINIT_ACCELERANT(void) {
/* free our mode list area */ /* free our mode list area */
delete_area(et6000ModesListArea); delete_area(et6000ModesListArea);
et6000ModesList = 0; et6000ModesList = 0;
/* release our cloned data */ /* release our cloned data */
uninitCommon(); uninitCommon();
/* close the file handle ONLY if we're the clone */ /* close the file handle ONLY if we're the clone */
if (accelerantIsClone) close(fd); if (accelerantIsClone) close(fd);
} }
/*****************************************************************************/ /*****************************************************************************/
status_t GET_ACCELERANT_DEVICE_INFO(accelerant_device_info *adi) status_t GET_ACCELERANT_DEVICE_INFO(accelerant_device_info *adi)
{ {
adi->version = B_ACCELERANT_VERSION; adi->version = B_ACCELERANT_VERSION;
strcpy(adi->name, "Tseng Labs ET6x00"); strcpy(adi->name, "Tseng Labs ET6x00");
strcpy(adi->chipset, "Tseng Labs ET6x00"); strcpy(adi->chipset, "Tseng Labs ET6x00");
strcpy(adi->serial_no, ""); strcpy(adi->serial_no, "");
adi->memory = si->memSize; adi->memory = si->memSize;
adi->dac_speed = si->pixelClockMax16; adi->dac_speed = si->pixelClockMax16;
return B_OK; return B_OK;
} }
/*****************************************************************************/ /*****************************************************************************/
@@ -1,141 +1,141 @@
/*****************************************************************************\ /*****************************************************************************\
* Tseng Labs ET6000, ET6100 and ET6300 graphics driver for BeOS 5. * Tseng Labs ET6000, ET6100 and ET6300 graphics driver for BeOS 5.
* Copyright (c) 2003-2004, Evgeniy Vladimirovich Bobkov. * Copyright (c) 2003-2004, Evgeniy Vladimirovich Bobkov.
\*****************************************************************************/ \*****************************************************************************/
#include "GlobalData.h" #include "GlobalData.h"
#include "generic.h" #include "generic.h"
#include <string.h> #include <string.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
/*****************************************************************************/ /*****************************************************************************/
#define T_POSITIVE_SYNC (B_POSITIVE_HSYNC | B_POSITIVE_VSYNC) #define T_POSITIVE_SYNC (B_POSITIVE_HSYNC | B_POSITIVE_VSYNC)
#define MODE_FLAGS (B_SCROLL | B_8_BIT_DAC | B_PARALLEL_ACCESS) #define MODE_FLAGS (B_SCROLL | B_8_BIT_DAC | B_PARALLEL_ACCESS)
#define MODE_COUNT (sizeof (modesList) / sizeof (display_mode)) #define MODE_COUNT (sizeof (modesList) / sizeof (display_mode))
/*****************************************************************************/ /*****************************************************************************/
static const display_mode modesList[] = { static const display_mode modesList[] = {
{ { 25175, 640, 656, 752, 800, 480, 490, 492, 525, 0}, B_RGB24, 640, 480, 0, 0, MODE_FLAGS}, /* Vesa_Monitor_@60Hz_(640X480X8.Z1) */ { { 25175, 640, 656, 752, 800, 480, 490, 492, 525, 0}, B_RGB24, 640, 480, 0, 0, MODE_FLAGS}, /* Vesa_Monitor_@60Hz_(640X480X8.Z1) */
{ { 27500, 640, 672, 768, 864, 480, 488, 494, 530, 0}, B_RGB24, 640, 480, 0, 0, MODE_FLAGS}, /* 640X480X60Hz */ { { 27500, 640, 672, 768, 864, 480, 488, 494, 530, 0}, B_RGB24, 640, 480, 0, 0, MODE_FLAGS}, /* 640X480X60Hz */
{ { 30500, 640, 672, 768, 864, 480, 517, 523, 588, 0}, B_RGB24, 640, 480, 0, 0, MODE_FLAGS}, /* SVGA_640X480X60HzNI */ { { 30500, 640, 672, 768, 864, 480, 517, 523, 588, 0}, B_RGB24, 640, 480, 0, 0, MODE_FLAGS}, /* SVGA_640X480X60HzNI */
{ { 31500, 640, 664, 704, 832, 480, 489, 492, 520, 0}, B_RGB24, 640, 480, 0, 0, MODE_FLAGS}, /* Vesa_Monitor_@70-72Hz_(640X480X8.Z1) */ { { 31500, 640, 664, 704, 832, 480, 489, 492, 520, 0}, B_RGB24, 640, 480, 0, 0, MODE_FLAGS}, /* Vesa_Monitor_@70-72Hz_(640X480X8.Z1) */
{ { 31500, 640, 656, 720, 840, 480, 481, 484, 500, 0}, B_RGB24, 640, 480, 0, 0, MODE_FLAGS}, /* Vesa_Monitor_@75Hz_(640X480X8.Z1) */ { { 31500, 640, 656, 720, 840, 480, 481, 484, 500, 0}, B_RGB24, 640, 480, 0, 0, MODE_FLAGS}, /* Vesa_Monitor_@75Hz_(640X480X8.Z1) */
{ { 36000, 640, 696, 752, 832, 480, 481, 484, 509, 0}, B_RGB24, 640, 480, 0, 0, MODE_FLAGS}, /* Vesa_Monitor_@85Hz_(640X480X8.Z1) */ { { 36000, 640, 696, 752, 832, 480, 481, 484, 509, 0}, B_RGB24, 640, 480, 0, 0, MODE_FLAGS}, /* Vesa_Monitor_@85Hz_(640X480X8.Z1) */
{ { 38100, 800, 832, 960, 1088, 600, 602, 606, 620, 0}, B_RGB24, 800, 600, 0, 0, MODE_FLAGS}, /* SVGA_800X600X56HzNI */ { { 38100, 800, 832, 960, 1088, 600, 602, 606, 620, 0}, B_RGB24, 800, 600, 0, 0, MODE_FLAGS}, /* SVGA_800X600X56HzNI */
{ { 40000, 800, 840, 968, 1056, 600, 601, 605, 628, T_POSITIVE_SYNC}, B_RGB24, 800, 600, 0, 0, MODE_FLAGS}, /* Vesa_Monitor_@60Hz_(800X600X8.Z1) */ { { 40000, 800, 840, 968, 1056, 600, 601, 605, 628, T_POSITIVE_SYNC}, B_RGB24, 800, 600, 0, 0, MODE_FLAGS}, /* Vesa_Monitor_@60Hz_(800X600X8.Z1) */
{ { 49500, 800, 816, 896, 1056, 600, 601, 604, 625, T_POSITIVE_SYNC}, B_RGB24, 800, 600, 0, 0, MODE_FLAGS}, /* Vesa_Monitor_@75Hz_(800X600X8.Z1) */ { { 49500, 800, 816, 896, 1056, 600, 601, 604, 625, T_POSITIVE_SYNC}, B_RGB24, 800, 600, 0, 0, MODE_FLAGS}, /* Vesa_Monitor_@75Hz_(800X600X8.Z1) */
{ { 50000, 800, 856, 976, 1040, 600, 637, 643, 666, T_POSITIVE_SYNC}, B_RGB24, 800, 600, 0, 0, MODE_FLAGS}, /* Vesa_Monitor_@70-72Hz_(800X600X8.Z1) */ { { 50000, 800, 856, 976, 1040, 600, 637, 643, 666, T_POSITIVE_SYNC}, B_RGB24, 800, 600, 0, 0, MODE_FLAGS}, /* Vesa_Monitor_@70-72Hz_(800X600X8.Z1) */
{ { 56250, 800, 832, 896, 1048, 600, 601, 604, 631, T_POSITIVE_SYNC}, B_RGB24, 800, 600, 0, 0, MODE_FLAGS}, /* Vesa_Monitor_@85Hz_(800X600X8.Z1) */ { { 56250, 800, 832, 896, 1048, 600, 601, 604, 631, T_POSITIVE_SYNC}, B_RGB24, 800, 600, 0, 0, MODE_FLAGS}, /* Vesa_Monitor_@85Hz_(800X600X8.Z1) */
{ { 65000, 1024, 1048, 1184, 1344, 768, 771, 777, 806, 0}, B_RGB24, 1024, 768, 0, 0, MODE_FLAGS}, /* Vesa_Monitor_@60Hz_(1024X768X8.Z1) */ { { 65000, 1024, 1048, 1184, 1344, 768, 771, 777, 806, 0}, B_RGB24, 1024, 768, 0, 0, MODE_FLAGS}, /* Vesa_Monitor_@60Hz_(1024X768X8.Z1) */
{ { 75000, 1024, 1048, 1184, 1328, 768, 771, 777, 806, 0}, B_RGB24, 1024, 768, 0, 0, MODE_FLAGS}, /* Vesa_Monitor_@70-72Hz_(1024X768X8.Z1) */ { { 75000, 1024, 1048, 1184, 1328, 768, 771, 777, 806, 0}, B_RGB24, 1024, 768, 0, 0, MODE_FLAGS}, /* Vesa_Monitor_@70-72Hz_(1024X768X8.Z1) */
{ { 78750, 1024, 1040, 1136, 1312, 768, 769, 772, 800, T_POSITIVE_SYNC}, B_RGB24, 1024, 768, 0, 0, MODE_FLAGS}, /* Vesa_Monitor_@75Hz_(1024X768X8.Z1) */ { { 78750, 1024, 1040, 1136, 1312, 768, 769, 772, 800, T_POSITIVE_SYNC}, B_RGB24, 1024, 768, 0, 0, MODE_FLAGS}, /* Vesa_Monitor_@75Hz_(1024X768X8.Z1) */
{ { 94500, 1024, 1072, 1168, 1376, 768, 769, 772, 808, T_POSITIVE_SYNC}, B_RGB24, 1024, 768, 0, 0, MODE_FLAGS}, /* Vesa_Monitor_@85Hz_(1024X768X8.Z1) */ { { 94500, 1024, 1072, 1168, 1376, 768, 769, 772, 808, T_POSITIVE_SYNC}, B_RGB24, 1024, 768, 0, 0, MODE_FLAGS}, /* Vesa_Monitor_@85Hz_(1024X768X8.Z1) */
{ { 94200, 1152, 1184, 1280, 1472, 864, 865, 868, 914, T_POSITIVE_SYNC}, B_RGB24, 1152, 864, 0, 0, MODE_FLAGS}, /* Vesa_Monitor_@70Hz_(1152X864X8.Z1) */ { { 94200, 1152, 1184, 1280, 1472, 864, 865, 868, 914, T_POSITIVE_SYNC}, B_RGB24, 1152, 864, 0, 0, MODE_FLAGS}, /* Vesa_Monitor_@70Hz_(1152X864X8.Z1) */
{ { 108000, 1152, 1216, 1344, 1600, 864, 865, 868, 900, T_POSITIVE_SYNC}, B_RGB24, 1152, 864, 0, 0, MODE_FLAGS}, /* Vesa_Monitor_@75Hz_(1152X864X8.Z1) */ { { 108000, 1152, 1216, 1344, 1600, 864, 865, 868, 900, T_POSITIVE_SYNC}, B_RGB24, 1152, 864, 0, 0, MODE_FLAGS}, /* Vesa_Monitor_@75Hz_(1152X864X8.Z1) */
{ { 121500, 1152, 1216, 1344, 1568, 864, 865, 868, 911, T_POSITIVE_SYNC}, B_RGB24, 1152, 864, 0, 0, MODE_FLAGS}, /* Vesa_Monitor_@85Hz_(1152X864X8.Z1) */ { { 121500, 1152, 1216, 1344, 1568, 864, 865, 868, 911, T_POSITIVE_SYNC}, B_RGB24, 1152, 864, 0, 0, MODE_FLAGS}, /* Vesa_Monitor_@85Hz_(1152X864X8.Z1) */
{ { 108000, 1280, 1328, 1440, 1688, 1024, 1025, 1028, 1066, T_POSITIVE_SYNC}, B_RGB24, 1280, 1024, 0, 0, MODE_FLAGS}, /* Vesa_Monitor_@60Hz_(1280X1024X8.Z1) */ { { 108000, 1280, 1328, 1440, 1688, 1024, 1025, 1028, 1066, T_POSITIVE_SYNC}, B_RGB24, 1280, 1024, 0, 0, MODE_FLAGS}, /* Vesa_Monitor_@60Hz_(1280X1024X8.Z1) */
{ { 135000, 1280, 1296, 1440, 1688, 1024, 1025, 1028, 1066, T_POSITIVE_SYNC}, B_RGB24, 1280, 1024, 0, 0, MODE_FLAGS}, /* Vesa_Monitor_@75Hz_(1280X1024X8.Z1) */ { { 135000, 1280, 1296, 1440, 1688, 1024, 1025, 1028, 1066, T_POSITIVE_SYNC}, B_RGB24, 1280, 1024, 0, 0, MODE_FLAGS}, /* Vesa_Monitor_@75Hz_(1280X1024X8.Z1) */
{ { 157500, 1280, 1344, 1504, 1728, 1024, 1025, 1028, 1072, T_POSITIVE_SYNC}, B_RGB24, 1280, 1024, 0, 0, MODE_FLAGS}, /* Vesa_Monitor_@85Hz_(1280X1024X8.Z1) */ { { 157500, 1280, 1344, 1504, 1728, 1024, 1025, 1028, 1072, T_POSITIVE_SYNC}, B_RGB24, 1280, 1024, 0, 0, MODE_FLAGS}, /* Vesa_Monitor_@85Hz_(1280X1024X8.Z1) */
{ { 162000, 1600, 1664, 1856, 2160, 1200, 1201, 1204, 1250, T_POSITIVE_SYNC}, B_RGB24, 1600, 1200, 0, 0, MODE_FLAGS}, /* Vesa_Monitor_@60Hz_(1600X1200X8.Z1) */ { { 162000, 1600, 1664, 1856, 2160, 1200, 1201, 1204, 1250, T_POSITIVE_SYNC}, B_RGB24, 1600, 1200, 0, 0, MODE_FLAGS}, /* Vesa_Monitor_@60Hz_(1600X1200X8.Z1) */
{ { 175500, 1600, 1664, 1856, 2160, 1200, 1201, 1204, 1250, T_POSITIVE_SYNC}, B_RGB24, 1600, 1200, 0, 0, MODE_FLAGS}, /* Vesa_Monitor_@65Hz_(1600X1200X8.Z1) */ { { 175500, 1600, 1664, 1856, 2160, 1200, 1201, 1204, 1250, T_POSITIVE_SYNC}, B_RGB24, 1600, 1200, 0, 0, MODE_FLAGS}, /* Vesa_Monitor_@65Hz_(1600X1200X8.Z1) */
{ { 189000, 1600, 1664, 1856, 2160, 1200, 1201, 1204, 1250, T_POSITIVE_SYNC}, B_RGB24, 1600, 1200, 0, 0, MODE_FLAGS}, /* Vesa_Monitor_@70Hz_(1600X1200X8.Z1) */ { { 189000, 1600, 1664, 1856, 2160, 1200, 1201, 1204, 1250, T_POSITIVE_SYNC}, B_RGB24, 1600, 1200, 0, 0, MODE_FLAGS}, /* Vesa_Monitor_@70Hz_(1600X1200X8.Z1) */
{ { 202500, 1600, 1664, 1856, 2160, 1200, 1201, 1204, 1250, T_POSITIVE_SYNC}, B_RGB24, 1600, 1200, 0, 0, MODE_FLAGS}, /* Vesa_Monitor_@75Hz_(1600X1200X8.Z1) */ { { 202500, 1600, 1664, 1856, 2160, 1200, 1201, 1204, 1250, T_POSITIVE_SYNC}, B_RGB24, 1600, 1200, 0, 0, MODE_FLAGS}, /* Vesa_Monitor_@75Hz_(1600X1200X8.Z1) */
{ { 216000, 1600, 1664, 1856, 2160, 1200, 1201, 1204, 1250, T_POSITIVE_SYNC}, B_RGB24, 1600, 1200, 0, 0, MODE_FLAGS}, /* Vesa_Monitor_@80Hz_(1600X1200X8.Z1) */ { { 216000, 1600, 1664, 1856, 2160, 1200, 1201, 1204, 1250, T_POSITIVE_SYNC}, B_RGB24, 1600, 1200, 0, 0, MODE_FLAGS}, /* Vesa_Monitor_@80Hz_(1600X1200X8.Z1) */
{ { 229500, 1600, 1664, 1856, 2160, 1200, 1201, 1204, 1250, T_POSITIVE_SYNC}, B_RGB24, 1600, 1200, 0, 0, MODE_FLAGS} /* Vesa_Monitor_@85Hz_(1600X1200X8.Z1) */ { { 229500, 1600, 1664, 1856, 2160, 1200, 1201, 1204, 1250, T_POSITIVE_SYNC}, B_RGB24, 1600, 1200, 0, 0, MODE_FLAGS} /* Vesa_Monitor_@85Hz_(1600X1200X8.Z1) */
}; };
/*****************************************************************************/ /*****************************************************************************/
/* /*
* Validate a target display mode is both * Validate a target display mode is both
* a) a valid display mode for this device and * a) a valid display mode for this device and
* b) falls between the contraints imposed by "low" and "high" * b) falls between the contraints imposed by "low" and "high"
* *
* If the mode is not (or cannot) be made valid for this device, return B_ERROR. * If the mode is not (or cannot) be made valid for this device, return B_ERROR.
* If a valid mode can be constructed, but it does not fall within the limits, * If a valid mode can be constructed, but it does not fall within the limits,
* return B_BAD_VALUE. * return B_BAD_VALUE.
* If the mode is both valid AND falls within the limits, return B_OK. * If the mode is both valid AND falls within the limits, return B_OK.
*/ */
status_t PROPOSE_DISPLAY_MODE(display_mode *target, status_t PROPOSE_DISPLAY_MODE(display_mode *target,
const display_mode *low, const display_mode *low,
const display_mode *high) const display_mode *high)
{ {
ET6000DisplayMode mode; ET6000DisplayMode mode;
mode.magic = ET6000_PRIVATE_DATA_MAGIC; mode.magic = ET6000_PRIVATE_DATA_MAGIC;
mode.mode = *target; mode.mode = *target;
mode.memSize = si->memSize; mode.memSize = si->memSize;
return ioctl(fd, ET6000_PROPOSE_DISPLAY_MODE, &mode, sizeof(mode)); return ioctl(fd, ET6000_PROPOSE_DISPLAY_MODE, &mode, sizeof(mode));
} }
/*****************************************************************************/ /*****************************************************************************/
/* /*
* Return the number of modes this device will return from GET_MODE_LIST(). * Return the number of modes this device will return from GET_MODE_LIST().
*/ */
uint32 ACCELERANT_MODE_COUNT(void) { uint32 ACCELERANT_MODE_COUNT(void) {
/* return the number of 'built-in' display modes */ /* return the number of 'built-in' display modes */
return si->modesNum; return si->modesNum;
} }
/*****************************************************************************/ /*****************************************************************************/
/* /*
* Copy the list of guaranteed supported video modes to the location provided. * Copy the list of guaranteed supported video modes to the location provided.
*/ */
status_t GET_MODE_LIST(display_mode *dm) { status_t GET_MODE_LIST(display_mode *dm) {
/* copy them to the buffer pointed at by *dm */ /* copy them to the buffer pointed at by *dm */
memcpy(dm, et6000ModesList, si->modesNum * sizeof(display_mode)); memcpy(dm, et6000ModesList, si->modesNum * sizeof(display_mode));
return B_OK; return B_OK;
} }
/*****************************************************************************/ /*****************************************************************************/
/* /*
* Create a list of display_modes to pass back to the caller. * Create a list of display_modes to pass back to the caller.
*/ */
status_t createModesList(void) { status_t createModesList(void) {
size_t maxSize; size_t maxSize;
uint32 i, j, pixelClockRange; uint32 i, j, pixelClockRange;
const display_mode *src; const display_mode *src;
display_mode *dst, low, high; display_mode *dst, low, high;
color_space spaces[] = {B_RGB15_LITTLE, B_RGB16_LITTLE, B_RGB24_LITTLE}; color_space spaces[] = {B_RGB15_LITTLE, B_RGB16_LITTLE, B_RGB24_LITTLE};
/* figure out how big the list could be, and adjust up to nearest multiple of B_PAGE_SIZE */ /* figure out how big the list could be, and adjust up to nearest multiple of B_PAGE_SIZE */
maxSize = (((MODE_COUNT * 3) * sizeof(display_mode)) + (B_PAGE_SIZE-1)) & ~(B_PAGE_SIZE-1); maxSize = (((MODE_COUNT * 3) * sizeof(display_mode)) + (B_PAGE_SIZE-1)) & ~(B_PAGE_SIZE-1);
/* Create an area to hold the info */ /* Create an area to hold the info */
si->modesArea = et6000ModesListArea = si->modesArea = et6000ModesListArea =
create_area("ET6000 accelerant mode info", (void **)&et6000ModesList, create_area("ET6000 accelerant mode info", (void **)&et6000ModesList,
B_ANY_ADDRESS, maxSize, B_NO_LOCK, B_READ_AREA | B_WRITE_AREA); B_ANY_ADDRESS, maxSize, B_NO_LOCK, B_READ_AREA | B_WRITE_AREA);
if (et6000ModesListArea < B_OK) if (et6000ModesListArea < B_OK)
return et6000ModesListArea; return et6000ModesListArea;
/* walk through our predefined list and see which modes fit this device */ /* walk through our predefined list and see which modes fit this device */
src = modesList; src = modesList;
dst = et6000ModesList; dst = et6000ModesList;
si->modesNum = 0; si->modesNum = 0;
for (i = 0; i < MODE_COUNT; i++) { for (i = 0; i < MODE_COUNT; i++) {
/* set ranges for acceptable values */ /* set ranges for acceptable values */
low = high = *src; low = high = *src;
/* range is 6.25% of default clock: arbitrarily picked */ /* range is 6.25% of default clock: arbitrarily picked */
pixelClockRange = low.timing.pixel_clock >> 5; pixelClockRange = low.timing.pixel_clock >> 5;
low.timing.pixel_clock -= pixelClockRange; low.timing.pixel_clock -= pixelClockRange;
high.timing.pixel_clock += pixelClockRange; high.timing.pixel_clock += pixelClockRange;
/* some cards need wider virtual widths for certain modes */ /* some cards need wider virtual widths for certain modes */
high.virtual_width = 2048; high.virtual_width = 2048;
/* do it once for each depth we want to support */ /* do it once for each depth we want to support */
for (j = 0; j < (sizeof(spaces) / sizeof(color_space)); j++) { for (j = 0; j < (sizeof(spaces) / sizeof(color_space)); j++) {
/* set target values */ /* set target values */
*dst = *src; *dst = *src;
/* poke the specific space */ /* poke the specific space */
dst->space = low.space = high.space = spaces[j]; dst->space = low.space = high.space = spaces[j];
/* ask for a compatible mode */ /* ask for a compatible mode */
if (PROPOSE_DISPLAY_MODE(dst, &low, &high) != B_ERROR) { if (PROPOSE_DISPLAY_MODE(dst, &low, &high) != B_ERROR) {
/* count it, and move on to next mode */ /* count it, and move on to next mode */
dst++; dst++;
si->modesNum++; si->modesNum++;
} }
} }
/* advance to next mode */ /* advance to next mode */
src++; src++;
} }
return B_OK; return B_OK;
} }
/*****************************************************************************/ /*****************************************************************************/
@@ -1,46 +1,46 @@
/*****************************************************************************\ /*****************************************************************************\
* Tseng Labs ET6000, ET6100 and ET6300 graphics driver for BeOS 5. * Tseng Labs ET6000, ET6100 and ET6300 graphics driver for BeOS 5.
* Copyright (c) 2003-2004, Evgeniy Vladimirovich Bobkov. * Copyright (c) 2003-2004, Evgeniy Vladimirovich Bobkov.
\*****************************************************************************/ \*****************************************************************************/
#include "acl.h" #include "acl.h"
#include "bits.h" #include "bits.h"
/*****************************************************************************/ /*****************************************************************************/
__inline void et6000aclMasterInterruptEnable(void *base) { __inline void et6000aclMasterInterruptEnable(void *base) {
set8(&((volatile char *)base)[0x34], 0x7f, 0x80); set8(&((volatile char *)base)[0x34], 0x7f, 0x80);
} }
/*****************************************************************************/ /*****************************************************************************/
__inline void et6000aclMasterInterruptDisable(void *base) { __inline void et6000aclMasterInterruptDisable(void *base) {
set8(&((volatile char *)base)[0x34], 0x7f, 0x00); set8(&((volatile char *)base)[0x34], 0x7f, 0x00);
} }
/*****************************************************************************/ /*****************************************************************************/
__inline void et6000aclReadInterruptEnable(void *base) { __inline void et6000aclReadInterruptEnable(void *base) {
set8(&((volatile char *)base)[0x34], 0xfd, 0x02); set8(&((volatile char *)base)[0x34], 0xfd, 0x02);
} }
/*****************************************************************************/ /*****************************************************************************/
__inline void et6000aclReadInterruptDisable(void *base) { __inline void et6000aclReadInterruptDisable(void *base) {
set8(&((volatile char *)base)[0x34], 0xfd, 0x00); set8(&((volatile char *)base)[0x34], 0xfd, 0x00);
} }
/*****************************************************************************/ /*****************************************************************************/
__inline void et6000aclWriteInterruptEnable(void *base) { __inline void et6000aclWriteInterruptEnable(void *base) {
set8(&((volatile char *)base)[0x34], 0xfe, 0x01); set8(&((volatile char *)base)[0x34], 0xfe, 0x01);
} }
/*****************************************************************************/ /*****************************************************************************/
__inline void et6000aclWriteInterruptDisable(void *base) { __inline void et6000aclWriteInterruptDisable(void *base) {
set8(&((volatile char *)base)[0x34], 0xfe, 0x00); set8(&((volatile char *)base)[0x34], 0xfe, 0x00);
} }
/*****************************************************************************/ /*****************************************************************************/
__inline void et6000aclReadInterruptClear(void *base) { __inline void et6000aclReadInterruptClear(void *base) {
set8(&((volatile char *)base)[0x35], 0xfd, 0x02); set8(&((volatile char *)base)[0x35], 0xfd, 0x02);
} }
/*****************************************************************************/ /*****************************************************************************/
__inline void et6000aclWriteInterruptClear(void *base) { __inline void et6000aclWriteInterruptClear(void *base) {
set8(&((volatile char *)base)[0x34], 0xfe, 0x00); set8(&((volatile char *)base)[0x34], 0xfe, 0x00);
} }
/*****************************************************************************/ /*****************************************************************************/
__inline char et6000aclInterruptCause(void *base) { __inline char et6000aclInterruptCause(void *base) {
return ((volatile char *)base)[0x35] & 0x03; return ((volatile char *)base)[0x35] & 0x03;
} }
/*****************************************************************************/ /*****************************************************************************/
@@ -1,27 +1,27 @@
/*****************************************************************************\ /*****************************************************************************\
* Tseng Labs ET6000, ET6100 and ET6300 graphics driver for BeOS 5. * Tseng Labs ET6000, ET6100 and ET6300 graphics driver for BeOS 5.
* Copyright (c) 2003-2004, Evgeniy Vladimirovich Bobkov. * Copyright (c) 2003-2004, Evgeniy Vladimirovich Bobkov.
\*****************************************************************************/ \*****************************************************************************/
#ifndef _ET6000ACL_H_ #ifndef _ET6000ACL_H_
#define _ET6000ACL_H_ #define _ET6000ACL_H_
/*****************************************************************************/ /*****************************************************************************/
__inline void et6000aclMasterInterruptEnable(void *base); __inline void et6000aclMasterInterruptEnable(void *base);
__inline void et6000aclMasterInterruptDisable(void *base); __inline void et6000aclMasterInterruptDisable(void *base);
__inline void et6000aclReadInterruptEnable(void *base); __inline void et6000aclReadInterruptEnable(void *base);
__inline void et6000aclReadInterruptDisable(void *base); __inline void et6000aclReadInterruptDisable(void *base);
__inline void et6000aclWriteInterruptEnable(void *base); __inline void et6000aclWriteInterruptEnable(void *base);
__inline void et6000aclWriteInterruptDisable(void *base); __inline void et6000aclWriteInterruptDisable(void *base);
__inline void et6000aclReadInterruptClear(void *base); __inline void et6000aclReadInterruptClear(void *base);
__inline void et6000aclWriteInterruptClear(void *base); __inline void et6000aclWriteInterruptClear(void *base);
__inline char et6000aclInterruptCause(void *base); __inline char et6000aclInterruptCause(void *base);
/*****************************************************************************/ /*****************************************************************************/
#define ET6000_ACL_INT_CAUSE_NONE 0 #define ET6000_ACL_INT_CAUSE_NONE 0
#define ET6000_ACL_INT_CAUSE_READ 2 #define ET6000_ACL_INT_CAUSE_READ 2
#define ET6000_ACL_INT_CAUSE_WRITE 1 #define ET6000_ACL_INT_CAUSE_WRITE 1
#define ET6000_ACL_INT_CAUSE_BOTH 3 #define ET6000_ACL_INT_CAUSE_BOTH 3
/*****************************************************************************/ /*****************************************************************************/
#endif /* _ET6000ACL_H_ */ #endif /* _ET6000ACL_H_ */
@@ -1,86 +1,86 @@
/*****************************************************************************\ /*****************************************************************************\
* Tseng Labs ET6000, ET6100 and ET6300 graphics driver for BeOS 5. * Tseng Labs ET6000, ET6100 and ET6300 graphics driver for BeOS 5.
* Copyright (c) 2003-2004, Evgeniy Vladimirovich Bobkov. * Copyright (c) 2003-2004, Evgeniy Vladimirovich Bobkov.
\*****************************************************************************/ \*****************************************************************************/
#include "bits.h" #include "bits.h"
/*****************************************************************************/ /*****************************************************************************/
/* /*
* Set bits in a byte pointed by addr; mask must contain 0s at the bits * Set bits in a byte pointed by addr; mask must contain 0s at the bits
* positions to be set and must contain 1s at all other bits; val must * positions to be set and must contain 1s at all other bits; val must
* contain the values of bits to be set. * contain the values of bits to be set.
*/ */
__inline void set8(volatile char *addr, char mask, char val) __inline void set8(volatile char *addr, char mask, char val)
{ {
if (mask == 0) if (mask == 0)
*addr = val; *addr = val;
else else
*addr = (*addr & mask) | (val & ~mask); *addr = (*addr & mask) | (val & ~mask);
} }
/*****************************************************************************/ /*****************************************************************************/
__inline void set16(volatile short *addr, short mask, short val) __inline void set16(volatile short *addr, short mask, short val)
{ {
if (mask == 0) if (mask == 0)
*addr = val; *addr = val;
else else
*addr = (*addr & mask) | (val & ~mask); *addr = (*addr & mask) | (val & ~mask);
} }
/*****************************************************************************/ /*****************************************************************************/
__inline void set32(volatile int *addr, int mask, int val) __inline void set32(volatile int *addr, int mask, int val)
{ {
if (mask == 0) if (mask == 0)
*addr = val; *addr = val;
else else
*addr = (*addr & mask) | (val & ~mask); *addr = (*addr & mask) | (val & ~mask);
} }
/*****************************************************************************/ /*****************************************************************************/
__inline void ioSet8(short port, char mask, char val) __inline void ioSet8(short port, char mask, char val)
{ {
char current; char current;
if (mask == 0) { if (mask == 0) {
__asm__ __volatile__ ( __asm__ __volatile__ (
"movb %0, %%al\n\t" "movb %0, %%al\n\t"
"movw %1, %%dx\n\t" "movw %1, %%dx\n\t"
"outb %%al, %%dx" "outb %%al, %%dx"
: /* no output */ : /* no output */
: "r"(val), "r"(port) : "r"(val), "r"(port)
: "%eax", "%edx" : "%eax", "%edx"
); );
} }
else { else {
__asm__ __volatile__ ( __asm__ __volatile__ (
"movw %1, %%dx;" "movw %1, %%dx;"
"inb %%dx, %%al;" "inb %%dx, %%al;"
"movb %%al, %0" "movb %%al, %0"
: "=r"(current) : "=r"(current)
: "r"(port) : "r"(port)
: "%eax", "%edx" : "%eax", "%edx"
); );
current = (current & mask) | (val & ~mask); current = (current & mask) | (val & ~mask);
__asm__ __volatile__ ( __asm__ __volatile__ (
"movb %0, %%al;" "movb %0, %%al;"
"movw %1, %%dx;" "movw %1, %%dx;"
"outb %%al, %%dx" "outb %%al, %%dx"
: /* no output */ : /* no output */
: "r"(current), "r"(port) : "r"(current), "r"(port)
: "%eax", "%edx" : "%eax", "%edx"
); );
} }
} }
/*****************************************************************************/ /*****************************************************************************/
__inline char ioGet8(short port) __inline char ioGet8(short port)
{ {
char current; char current;
__asm__ __volatile__ ( __asm__ __volatile__ (
"movw %1, %%dx;" "movw %1, %%dx;"
"inb %%dx, %%al;" "inb %%dx, %%al;"
"movb %%al, %0" "movb %%al, %0"
: "=r"(current) : "=r"(current)
: "r"(port) : "r"(port)
: "%eax", "%edx" : "%eax", "%edx"
); );
return current; return current;
} }
/*****************************************************************************/ /*****************************************************************************/
@@ -1,18 +1,18 @@
/*****************************************************************************\ /*****************************************************************************\
* Tseng Labs ET6000, ET6100 and ET6300 graphics driver for BeOS 5. * Tseng Labs ET6000, ET6100 and ET6300 graphics driver for BeOS 5.
* Copyright (c) 2003-2004, Evgeniy Vladimirovich Bobkov. * Copyright (c) 2003-2004, Evgeniy Vladimirovich Bobkov.
\*****************************************************************************/ \*****************************************************************************/
#ifndef _ET6000BITS_H_ #ifndef _ET6000BITS_H_
#define _ET6000BITS_H_ #define _ET6000BITS_H_
/*****************************************************************************/ /*****************************************************************************/
__inline void set8(volatile char *addr, char mask, char val); __inline void set8(volatile char *addr, char mask, char val);
__inline void set16(volatile short *addr, short mask, short val); __inline void set16(volatile short *addr, short mask, short val);
__inline void set32(volatile int *addr, int mask, int val); __inline void set32(volatile int *addr, int mask, int val);
__inline void ioSet8(short port, char mask, char val); __inline void ioSet8(short port, char mask, char val);
__inline char ioGet8(short port); __inline char ioGet8(short port);
/*****************************************************************************/ /*****************************************************************************/
#endif /* _ET6000BITS_H_ */ #endif /* _ET6000BITS_H_ */
File diff suppressed because it is too large Load Diff
@@ -1,430 +1,430 @@
/*****************************************************************************\ /*****************************************************************************\
* Tseng Labs ET6000, ET6100 and ET6300 graphics driver for BeOS 5. * Tseng Labs ET6000, ET6100 and ET6300 graphics driver for BeOS 5.
* Copyright (c) 2003-2004, Evgeniy Vladimirovich Bobkov. * Copyright (c) 2003-2004, Evgeniy Vladimirovich Bobkov.
\*****************************************************************************/ \*****************************************************************************/
#include "setmode.h" #include "setmode.h"
/* /*
* ATTENTION: Currently we set the graphics modes by setting the registers * ATTENTION: Currently we set the graphics modes by setting the registers
* with the beforehand dumped values of the corresponding registers. So not * with the beforehand dumped values of the corresponding registers. So not
* all graphics modes ET6x00 chips are capable of are accessible. So it would * all graphics modes ET6x00 chips are capable of are accessible. So it would
* be great to implement the normal algorithm of run-time computing of the * be great to implement the normal algorithm of run-time computing of the
* values to set the register. * values to set the register.
*/ */
/*****************************************************************************/ /*****************************************************************************/
typedef struct { typedef struct {
uint32 VisScreenWidth; uint32 VisScreenWidth;
uint32 VisScreenHeight; uint32 VisScreenHeight;
uint8 BitsPerPlane; uint8 BitsPerPlane;
uint8 NumberGreenBits; uint8 NumberGreenBits;
uint16 Frequency; uint16 Frequency;
} VIDEO_MODE_INFORMATION; } VIDEO_MODE_INFORMATION;
/*****************************************************************************/ /*****************************************************************************/
/* /*
* ATTENTION: Don't forget that CRTC indexed register 0x11 * ATTENTION: Don't forget that CRTC indexed register 0x11
* bit[7] write-protects some registers. * bit[7] write-protects some registers.
*/ */
struct { struct {
uint16 width, height, bpp, refreshRate; uint16 width, height, bpp, refreshRate;
uint8 clock0M, clock0N; uint8 clock0M, clock0N;
uint8 pci42; /* contains MCLK divider (MDIV) */ uint8 pci42; /* contains MCLK divider (MDIV) */
uint8 crtc[64]; uint8 crtc[64];
} clock0MN[] = { } clock0MN[] = {
{640, 480, 24, 75, 0x28, 0x22, 0x02, {640, 480, 24, 75, 0x28, 0x22, 0x02,
{0x5f, 0x4f, 0x50, 0x82, 0x54, 0x80, 0x0b, 0x3e, {0x5f, 0x4f, 0x50, 0x82, 0x54, 0x80, 0x0b, 0x3e,
0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xea, 0x0c, 0xdf, 0xf0, 0x60, 0xe7, 0x04, 0xab, 0xea, 0x0c, 0xdf, 0xf0, 0x60, 0xe7, 0x04, 0xab,
0xff, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0xff, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
0x11, 0x11, 0x11, 0x00, 0x00, 0x00, 0x11, 0x11, 0x11, 0x11, 0x11, 0x00, 0x00, 0x00, 0x11, 0x11,
0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x00}}, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x00}},
{640, 480, 24, 72, 0x56, 0x63, 0x00, {640, 480, 24, 72, 0x56, 0x63, 0x00,
{0x63, 0x4f, 0x50, 0x86, 0x55, 0x9a, 0x06, 0x3e, {0x63, 0x4f, 0x50, 0x86, 0x55, 0x9a, 0x06, 0x3e,
0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xe8, 0x0b, 0xdf, 0xf0, 0x60, 0xe7, 0xff, 0xab, 0xe8, 0x0b, 0xdf, 0xf0, 0x60, 0xe7, 0xff, 0xab,
0xff, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0xff, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
0x11, 0x11, 0x11, 0x00, 0x00, 0x00, 0x11, 0x11, 0x11, 0x11, 0x11, 0x00, 0x00, 0x00, 0x11, 0x11,
0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x00}}, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x00}},
{640, 480, 24, 60, 0x28, 0x22, 0x02, {640, 480, 24, 60, 0x28, 0x22, 0x02,
{0x5f, 0x4f, 0x50, 0x82, 0x54, 0x80, 0x0b, 0x3e, {0x5f, 0x4f, 0x50, 0x82, 0x54, 0x80, 0x0b, 0x3e,
0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xea, 0x0c, 0xdf, 0xf0, 0x60, 0xe7, 0x04, 0xab, 0xea, 0x0c, 0xdf, 0xf0, 0x60, 0xe7, 0x04, 0xab,
0xff, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0xff, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
0x11, 0x11, 0x11, 0x00, 0x00, 0x00, 0x11, 0x11, 0x11, 0x11, 0x11, 0x00, 0x00, 0x00, 0x11, 0x11,
0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x00}}, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x00}},
{640, 480, 16, 75, 0x56, 0x43, 0x01, {640, 480, 16, 75, 0x56, 0x43, 0x01,
{0x64, 0x4f, 0x4f, 0x88, 0x54, 0x9c, 0xf2, 0x1f, {0x64, 0x4f, 0x4f, 0x88, 0x54, 0x9c, 0xf2, 0x1f,
0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xe0, 0x03, 0xdf, 0xa0, 0x60, 0xdf, 0xf3, 0xab, 0xe0, 0x03, 0xdf, 0xa0, 0x60, 0xdf, 0xf3, 0xab,
0xff, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0xff, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
0x11, 0x11, 0x11, 0x00, 0x00, 0x00, 0x11, 0x11, 0x11, 0x11, 0x11, 0x00, 0x00, 0x00, 0x11, 0x11,
0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x00}}, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x00}},
{640, 480, 16, 72, 0x56, 0x43, 0x01, {640, 480, 16, 72, 0x56, 0x43, 0x01,
{0x63, 0x4f, 0x50, 0x86, 0x55, 0x9a, 0x06, 0x3e, {0x63, 0x4f, 0x50, 0x86, 0x55, 0x9a, 0x06, 0x3e,
0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xe8, 0x0b, 0xdf, 0xa0, 0x60, 0xe7, 0xff, 0xab, 0xe8, 0x0b, 0xdf, 0xa0, 0x60, 0xe7, 0xff, 0xab,
0xff, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0xff, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
0x11, 0x11, 0x11, 0x00, 0x00, 0x00, 0x11, 0x11, 0x11, 0x11, 0x11, 0x00, 0x00, 0x00, 0x11, 0x11,
0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x00}}, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x00}},
{640, 480, 16, 60, 0x28, 0x41, 0x01, {640, 480, 16, 60, 0x28, 0x41, 0x01,
{0x5f, 0x4f, 0x50, 0x82, 0x54, 0x80, 0x0b, 0x3e, {0x5f, 0x4f, 0x50, 0x82, 0x54, 0x80, 0x0b, 0x3e,
0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xea, 0x0c, 0xdf, 0xa0, 0x60, 0xe7, 0x04, 0xab, 0xea, 0x0c, 0xdf, 0xa0, 0x60, 0xe7, 0x04, 0xab,
0xff, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0xff, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
0x11, 0x11, 0x11, 0x00, 0x00, 0x00, 0x11, 0x11, 0x11, 0x11, 0x11, 0x00, 0x00, 0x00, 0x11, 0x11,
0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x00}}, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x00}},
{800, 600, 24, 75, 0x79, 0x49, 0x00, {800, 600, 24, 75, 0x79, 0x49, 0x00,
{0x7f, 0x63, 0x63, 0x83, 0x6b, 0x1b, 0x72, 0xf0, {0x7f, 0x63, 0x63, 0x83, 0x6b, 0x1b, 0x72, 0xf0,
0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x58, 0x0c, 0x57, 0x2c, 0x60, 0x57, 0x73, 0xab, 0x58, 0x0c, 0x57, 0x2c, 0x60, 0x57, 0x73, 0xab,
0xff, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0xff, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
0x11, 0x11, 0x11, 0x00, 0x00, 0x00, 0x11, 0x11, 0x11, 0x11, 0x11, 0x00, 0x00, 0x00, 0x11, 0x11,
0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x80}}, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x80}},
{800, 600, 24, 72, 0x28, 0x41, 0x00, {800, 600, 24, 72, 0x28, 0x41, 0x00,
{0x7d, 0x63, 0x63, 0x81, 0x6d, 0x1c, 0x98, 0xf0, {0x7d, 0x63, 0x63, 0x81, 0x6d, 0x1c, 0x98, 0xf0,
0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x7c, 0x02, 0x57, 0x2c, 0x60, 0x57, 0x99, 0xab, 0x7c, 0x02, 0x57, 0x2c, 0x60, 0x57, 0x99, 0xab,
0xff, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0xff, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
0x11, 0x11, 0x11, 0x00, 0x00, 0x00, 0x11, 0x11, 0x11, 0x11, 0x11, 0x00, 0x00, 0x00, 0x11, 0x11,
0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x80}}, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x80}},
{800, 600, 24, 60, 0x79, 0x49, 0x00, {800, 600, 24, 60, 0x79, 0x49, 0x00,
{0x7f, 0x63, 0x63, 0x83, 0x6b, 0x1b, 0x72, 0xf0, {0x7f, 0x63, 0x63, 0x83, 0x6b, 0x1b, 0x72, 0xf0,
0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x58, 0x0c, 0x57, 0x2c, 0x60, 0x57, 0x73, 0xab, 0x58, 0x0c, 0x57, 0x2c, 0x60, 0x57, 0x73, 0xab,
0xff, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0xff, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
0x11, 0x11, 0x11, 0x00, 0x00, 0x00, 0x11, 0x11, 0x11, 0x11, 0x11, 0x00, 0x00, 0x00, 0x11, 0x11,
0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x80}}, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x80}},
{800, 600, 16, 75, 0x51, 0x44, 0x00, {800, 600, 16, 75, 0x51, 0x44, 0x00,
{0x7f, 0x63, 0x63, 0x83, 0x68, 0x12, 0x6f, 0xf0, {0x7f, 0x63, 0x63, 0x83, 0x68, 0x12, 0x6f, 0xf0,
0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x58, 0x0b, 0x57, 0xc8, 0x60, 0x57, 0x70, 0xab, 0x58, 0x0b, 0x57, 0xc8, 0x60, 0x57, 0x70, 0xab,
0xff, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0xff, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
0x11, 0x11, 0x11, 0x00, 0x00, 0x00, 0x11, 0x11, 0x11, 0x11, 0x11, 0x00, 0x00, 0x00, 0x11, 0x11,
0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x00}}, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x00}},
{800, 600, 16, 72, 0x28, 0x41, 0x00, {800, 600, 16, 72, 0x28, 0x41, 0x00,
{0x7d, 0x63, 0x63, 0x81, 0x6d, 0x1c, 0x98, 0xf0, {0x7d, 0x63, 0x63, 0x81, 0x6d, 0x1c, 0x98, 0xf0,
0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x7c, 0x02, 0x57, 0xc8, 0x60, 0x57, 0x99, 0xab, 0x7c, 0x02, 0x57, 0xc8, 0x60, 0x57, 0x99, 0xab,
0xff, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0xff, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
0x11, 0x11, 0x11, 0x00, 0x00, 0x00, 0x11, 0x11, 0x11, 0x11, 0x11, 0x00, 0x00, 0x00, 0x11, 0x11,
0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x00}}, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x00}},
{800, 600, 16, 60, 0x79, 0x49, 0x00, {800, 600, 16, 60, 0x79, 0x49, 0x00,
{0x7f, 0x63, 0x63, 0x83, 0x6b, 0x1b, 0x72, 0xf0, {0x7f, 0x63, 0x63, 0x83, 0x6b, 0x1b, 0x72, 0xf0,
0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x58, 0x0c, 0x57, 0xc8, 0x60, 0x57, 0x73, 0xab, 0x58, 0x0c, 0x57, 0xc8, 0x60, 0x57, 0x73, 0xab,
0xff, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0xff, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
0x11, 0x11, 0x11, 0x00, 0x00, 0x00, 0x11, 0x11, 0x11, 0x11, 0x11, 0x00, 0x00, 0x00, 0x11, 0x11,
0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x00}}, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x00}},
{1024, 768, 16, 75, 0x1f, 0x21, 0x00, {1024, 768, 16, 75, 0x1f, 0x21, 0x00,
{0x9f, 0x7f, 0x7f, 0x83, 0x84, 0x90, 0x1e, 0xf5, {0x9f, 0x7f, 0x7f, 0x83, 0x84, 0x90, 0x1e, 0xf5,
0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x83, 0xff, 0x00, 0x60, 0xff, 0x1f, 0xab, 0x00, 0x83, 0xff, 0x00, 0x60, 0xff, 0x1f, 0xab,
0xff, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0xff, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
0x11, 0x11, 0x11, 0x00, 0x00, 0x00, 0x11, 0x11, 0x11, 0x11, 0x11, 0x00, 0x00, 0x00, 0x11, 0x11,
0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x80}}, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x80}},
{1024, 768, 16, 70, 0x28, 0x22, 0x00, {1024, 768, 16, 70, 0x28, 0x22, 0x00,
{0x9f, 0x7f, 0x7f, 0x83, 0x84, 0x90, 0x1e, 0xf5, {0x9f, 0x7f, 0x7f, 0x83, 0x84, 0x90, 0x1e, 0xf5,
0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x83, 0xff, 0x00, 0x60, 0xff, 0x1f, 0xab, 0x00, 0x83, 0xff, 0x00, 0x60, 0xff, 0x1f, 0xab,
0xff, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0xff, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
0x11, 0x11, 0x11, 0x00, 0x00, 0x00, 0x11, 0x11, 0x11, 0x11, 0x11, 0x00, 0x00, 0x00, 0x11, 0x11,
0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x80}}, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x80}},
{1024, 768, 16, 60, 0x6b, 0x44, 0x00, {1024, 768, 16, 60, 0x6b, 0x44, 0x00,
{0xa1, 0x7f, 0x80, 0x84, 0x88, 0x99, 0x26, 0xfd, {0xa1, 0x7f, 0x80, 0x84, 0x88, 0x99, 0x26, 0xfd,
0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x08, 0x0a, 0xff, 0x00, 0x60, 0x04, 0x22, 0xab, 0x08, 0x0a, 0xff, 0x00, 0x60, 0x04, 0x22, 0xab,
0xff, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0xff, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
0x11, 0x11, 0x11, 0x00, 0x00, 0x00, 0x11, 0x11, 0x11, 0x11, 0x11, 0x00, 0x00, 0x00, 0x11, 0x11,
0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x80}}, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x80}},
}; };
#define CLOCK0MN (sizeof(clock0MN) / sizeof(clock0MN[0])) #define CLOCK0MN (sizeof(clock0MN) / sizeof(clock0MN[0]))
/*****************************************************************************/ /*****************************************************************************/
__inline void et6000EnableLinearMemoryMapping(uint16 pciConfigSpace) __inline void et6000EnableLinearMemoryMapping(uint16 pciConfigSpace)
{ {
/* /*
* Relocate memory via PCI Base Address 0; don't enable MMU; * Relocate memory via PCI Base Address 0; don't enable MMU;
* enable memory mapped registers; enable system linear memory mapping. * enable memory mapped registers; enable system linear memory mapping.
*/ */
ioSet8(pciConfigSpace+0x40, 0xf0, 0x0b); ioSet8(pciConfigSpace+0x40, 0xf0, 0x0b);
} }
/*****************************************************************************/ /*****************************************************************************/
static void setPCIConfigSpaceRegisters41to5E(uint16 pciConfigSpace, static void setPCIConfigSpaceRegisters41to5E(uint16 pciConfigSpace,
VIDEO_MODE_INFORMATION *mi, VIDEO_MODE_INFORMATION *mi,
uint32 m) uint32 m)
{ {
uint8 pci415e[30] = { uint8 pci415e[30] = {
0x3a, 0x00, 0x02, 0x15, 0x04, 0x40, 0x13, 0x00, 0x3a, 0x00, 0x02, 0x15, 0x04, 0x40, 0x13, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x00, 0x00}; 0x04, 0x00, 0x00, 0x00, 0x00, 0x00};
uint8 i; uint8 i;
pci415e[1] = clock0MN[m].pci42; pci415e[1] = clock0MN[m].pci42;
for (i=0x41; i<0x5f; i++) { for (i=0x41; i<0x5f; i++) {
if ((i==0x45) || ((i>0x47)&&(i<0x4e)) || if ((i==0x45) || ((i>0x47)&&(i<0x4e)) ||
(i==0x4e) || ((i>0x59)&&(i<0x5c))) (i==0x4e) || ((i>0x59)&&(i<0x5c)))
continue; /* Skip absent or read-only registers */ continue; /* Skip absent or read-only registers */
ioSet8(pciConfigSpace+i, 0x00, pci415e[i-0x41]); ioSet8(pciConfigSpace+i, 0x00, pci415e[i-0x41]);
} }
if (mi->BitsPerPlane == 16) { if (mi->BitsPerPlane == 16) {
if (mi->NumberGreenBits == 5) if (mi->NumberGreenBits == 5)
ioSet8(pciConfigSpace+0x58, 0xfd, 0x00); /* 16bpp is 5:5:5 */ ioSet8(pciConfigSpace+0x58, 0xfd, 0x00); /* 16bpp is 5:5:5 */
else else
ioSet8(pciConfigSpace+0x58, 0xfd, 0x02); /* 16bpp is 5:6:5 */ ioSet8(pciConfigSpace+0x58, 0xfd, 0x02); /* 16bpp is 5:6:5 */
} }
} }
/*****************************************************************************/ /*****************************************************************************/
static void setMiscOutputRegister(VIDEO_MODE_INFORMATION *mi) { static void setMiscOutputRegister(VIDEO_MODE_INFORMATION *mi) {
uint8 MiscOutputReg; uint8 MiscOutputReg;
if (mi->VisScreenHeight < 400) if (mi->VisScreenHeight < 400)
MiscOutputReg = 0x80; /* -vsync, +hsync */ MiscOutputReg = 0x80; /* -vsync, +hsync */
else if (mi->VisScreenHeight < 480) else if (mi->VisScreenHeight < 480)
MiscOutputReg = 0x40; /* +vsync, -hsync */ MiscOutputReg = 0x40; /* +vsync, -hsync */
else if (mi->VisScreenHeight < 768) else if (mi->VisScreenHeight < 768)
MiscOutputReg = 0xc0; /* -vsync, -hsync */ MiscOutputReg = 0xc0; /* -vsync, -hsync */
else else
MiscOutputReg = 0x00; /* +vsync, +hsync */ MiscOutputReg = 0x00; /* +vsync, +hsync */
ioSet8(0x3c2, 0x00, (ioGet8(0x3cc) & 0x3f) | MiscOutputReg); ioSet8(0x3c2, 0x00, (ioGet8(0x3cc) & 0x3f) | MiscOutputReg);
/* Enable host access to display memory, color mode */ /* Enable host access to display memory, color mode */
ioSet8(0x3c2, 0x00, (ioGet8(0x3cc) & 0xfc) | 0x03); ioSet8(0x3c2, 0x00, (ioGet8(0x3cc) & 0xfc) | 0x03);
} }
/*****************************************************************************/ /*****************************************************************************/
static void setATC(uint8 bpp) { static void setATC(uint8 bpp) {
uint8 atc[7] = {0x21, 0x00, 0x30, 0x00, 0x00}, atc16 = 0x80;/// uint8 atc[7] = {0x21, 0x00, 0x30, 0x00, 0x00}, atc16 = 0x80;///
///uint8 atc[7] = {0x01, 0x00, 0x0f, 0x00, 0x00}, atc16 = 0x80;///zzz ///uint8 atc[7] = {0x01, 0x00, 0x0f, 0x00, 0x00}, atc16 = 0x80;///zzz
uint8 i, atcIndexReg; uint8 i, atcIndexReg;
volatile uint8 f; volatile uint8 f;
f = ioGet8(0x3da); /* Set index/data flip-flop to index mode */ f = ioGet8(0x3da); /* Set index/data flip-flop to index mode */
atcIndexReg = ioGet8(0x3c0) & 0xe0; /* Save bits[7:5] */ atcIndexReg = ioGet8(0x3c0) & 0xe0; /* Save bits[7:5] */
for (i = 0x10; i < 0x15; i++) { for (i = 0x10; i < 0x15; i++) {
f = ioGet8(0x3da); /* Set index/data flip-flop to index mode */ f = ioGet8(0x3da); /* Set index/data flip-flop to index mode */
ioSet8(0x3c0, 0x00, i | atcIndexReg); ioSet8(0x3c0, 0x00, i | atcIndexReg);
ioSet8(0x3c0, 0x00, atc[i-0x10]); ioSet8(0x3c0, 0x00, atc[i-0x10]);
} }
switch (bpp) { switch (bpp) {
case 24: case 24:
atc16 |= 0x20; atc16 |= 0x20;
break; break;
case 16: case 16:
atc16 |= 0x10; atc16 |= 0x10;
break; break;
} }
f = ioGet8(0x3da); /* Set index/data flip-flop to index mode */ f = ioGet8(0x3da); /* Set index/data flip-flop to index mode */
ioSet8(0x3c0, 0x00, 0x16 | atcIndexReg); ioSet8(0x3c0, 0x00, 0x16 | atcIndexReg);
ioSet8(0x3c0, 0x00, atc16); ioSet8(0x3c0, 0x00, atc16);
} }
/*****************************************************************************/ /*****************************************************************************/
static void setTS(void) { static void setTS(void) {
uint8 ts[7] = {0x02, 0x01, 0x0f, 0x00, 0x0e, 0x00, 0x00}; uint8 ts[7] = {0x02, 0x01, 0x0f, 0x00, 0x0e, 0x00, 0x00};
uint8 i; uint8 i;
for (i = 0; i < 7; i++) { for (i = 0; i < 7; i++) {
if (i == 5) continue; /* Skip absent register */ if (i == 5) continue; /* Skip absent register */
ioSet8(0x3c4, 0xf8, i); ioSet8(0x3c4, 0xf8, i);
ioSet8(0x3c5, 0x00, ts[i]); ioSet8(0x3c5, 0x00, ts[i]);
} }
} }
/*****************************************************************************/ /*****************************************************************************/
static void setGDC(void) { static void setGDC(void) {
uint8 gdc[9] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x05, 0x0f, 0xff}; uint8 gdc[9] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x05, 0x0f, 0xff};
uint8 i; uint8 i;
for (i = 0; i < 9; i++) { for (i = 0; i < 9; i++) {
ioSet8(0x3ce, 0xf0, i); ioSet8(0x3ce, 0xf0, i);
ioSet8(0x3cf, 0x00, gdc[i]); ioSet8(0x3cf, 0x00, gdc[i]);
} }
} }
/*****************************************************************************/ /*****************************************************************************/
static void setClock0RegNum(uint8 regNum) { static void setClock0RegNum(uint8 regNum) {
/* Set bits[1:0] of the selected CLOCK0 PLL parameters register number */ /* Set bits[1:0] of the selected CLOCK0 PLL parameters register number */
ioSet8(0x3c2, 0x00, (ioGet8(0x3cc) & 0xf3) | ((regNum & 0x03) << 2)); ioSet8(0x3c2, 0x00, (ioGet8(0x3cc) & 0xf3) | ((regNum & 0x03) << 2));
/* Set bit[2] of the selected CLOCK0 PLL parameters register number */ /* Set bit[2] of the selected CLOCK0 PLL parameters register number */
ioSet8(0x3d4, 0xc0, 0x34); ioSet8(0x3d4, 0xc0, 0x34);
ioSet8(0x3d5, 0xfd, (regNum & 0x04) << 1); ioSet8(0x3d5, 0xfd, (regNum & 0x04) << 1);
} }
/*****************************************************************************/ /*****************************************************************************/
static void setPLL(uint16 pciConfigSpace, static void setPLL(uint16 pciConfigSpace,
uint32 m) /* mode index */ uint32 m) /* mode index */
{ {
uint8 regNum = 3; uint8 regNum = 3;
uint8 clock0M = 0, clock0N = 0; uint8 clock0M = 0, clock0N = 0;
clock0M = clock0MN[m].clock0M; clock0M = clock0MN[m].clock0M;
clock0N = clock0MN[m].clock0N; clock0N = clock0MN[m].clock0N;
setClock0RegNum(regNum); setClock0RegNum(regNum);
ioSet8(pciConfigSpace+0x67, 0x00, regNum); ioSet8(pciConfigSpace+0x67, 0x00, regNum);
ioSet8(pciConfigSpace+0x68, 0x00, regNum); ioSet8(pciConfigSpace+0x68, 0x00, regNum);
ioSet8(pciConfigSpace+0x69, 0x00, clock0M); ioSet8(pciConfigSpace+0x69, 0x00, clock0M);
ioSet8(pciConfigSpace+0x69, 0x00, clock0N); ioSet8(pciConfigSpace+0x69, 0x00, clock0N);
} }
/*****************************************************************************/ /*****************************************************************************/
static void setCRTC(uint32 m) /* mode index */ static void setCRTC(uint32 m) /* mode index */
{ {
uint8 i; uint8 i;
/* Unlock the write protection of several registers */ /* Unlock the write protection of several registers */
ioSet8(0x3d4, 0xc0, 0x11); ioSet8(0x3d4, 0xc0, 0x11);
ioSet8(0x3d5, 0x7f, 0x00); ioSet8(0x3d5, 0x7f, 0x00);
for (i = 0; i < 64; i++) { for (i = 0; i < 64; i++) {
if (((i > 0x18) && (i < 0x33)) || if (((i > 0x18) && (i < 0x33)) ||
((i > 0x35) && (i < 0x3f))) ((i > 0x35) && (i < 0x3f)))
continue; /* Skip absent or read-only registers */ continue; /* Skip absent or read-only registers */
ioSet8(0x3d4, 0xc0, i); ioSet8(0x3d4, 0xc0, i);
ioSet8(0x3d5, 0x00, clock0MN[m].crtc[i]); ioSet8(0x3d5, 0x00, clock0MN[m].crtc[i]);
} }
} }
/*****************************************************************************/ /*****************************************************************************/
uint32 et6000SetGraphicsMode(VIDEO_MODE_INFORMATION *mi, uint32 et6000SetGraphicsMode(VIDEO_MODE_INFORMATION *mi,
uint16 pciConfigSpace) uint16 pciConfigSpace)
{ {
uint8 m; uint8 m;
for(m = 0; m < CLOCK0MN; m++) { for(m = 0; m < CLOCK0MN; m++) {
if ((clock0MN[m].width == mi->VisScreenWidth) && if ((clock0MN[m].width == mi->VisScreenWidth) &&
(clock0MN[m].height == mi->VisScreenHeight) && (clock0MN[m].height == mi->VisScreenHeight) &&
(clock0MN[m].bpp == mi->BitsPerPlane) && (clock0MN[m].bpp == mi->BitsPerPlane) &&
((clock0MN[m].refreshRate-1 <= mi->Frequency) && ((clock0MN[m].refreshRate-1 <= mi->Frequency) &&
(clock0MN[m].refreshRate+1 >= mi->Frequency))) (clock0MN[m].refreshRate+1 >= mi->Frequency)))
{ {
break; break;
} }
} }
if (m == CLOCK0MN) if (m == CLOCK0MN)
return B_BAD_VALUE; /* Found no entry for requested mode */ return B_BAD_VALUE; /* Found no entry for requested mode */
et6000EnableLinearMemoryMapping(pciConfigSpace); et6000EnableLinearMemoryMapping(pciConfigSpace);
setMiscOutputRegister(mi); setMiscOutputRegister(mi);
ioSet8(0x3d8, 0x00, 0xa0); /* Set the KEY for color modes */ ioSet8(0x3d8, 0x00, 0xa0); /* Set the KEY for color modes */
setPCIConfigSpaceRegisters41to5E(pciConfigSpace, mi, m); setPCIConfigSpaceRegisters41to5E(pciConfigSpace, mi, m);
ioSet8(0x3c6, 0x00, 0xff); /* Set pixel mask */ ioSet8(0x3c6, 0x00, 0xff); /* Set pixel mask */
setATC(mi->BitsPerPlane); setATC(mi->BitsPerPlane);
setTS(); setTS();
setGDC(); setGDC();
setCRTC(m); setCRTC(m);
setPLL(pciConfigSpace, m); setPLL(pciConfigSpace, m);
return B_OK; return B_OK;
} }
/*****************************************************************************/ /*****************************************************************************/
status_t et6000SetMode(display_mode *mode, uint16 pciConfigSpace) { status_t et6000SetMode(display_mode *mode, uint16 pciConfigSpace) {
VIDEO_MODE_INFORMATION mi; VIDEO_MODE_INFORMATION mi;
mi.VisScreenWidth = mode->virtual_width; mi.VisScreenWidth = mode->virtual_width;
mi.VisScreenHeight = mode->virtual_height; mi.VisScreenHeight = mode->virtual_height;
switch (mode->space) { switch (mode->space) {
case B_RGB24_LITTLE: case B_RGB24_LITTLE:
case B_RGB24_BIG: case B_RGB24_BIG:
mi.BitsPerPlane = 24; mi.BitsPerPlane = 24;
mi.NumberGreenBits = 8; mi.NumberGreenBits = 8;
break; break;
case B_RGB16_LITTLE: case B_RGB16_LITTLE:
case B_RGB16_BIG: case B_RGB16_BIG:
mi.BitsPerPlane = 16; mi.BitsPerPlane = 16;
mi.NumberGreenBits = 6; mi.NumberGreenBits = 6;
break; break;
case B_RGB15_LITTLE: case B_RGB15_LITTLE:
case B_RGB15_BIG: case B_RGB15_BIG:
mi.BitsPerPlane = 16; mi.BitsPerPlane = 16;
mi.NumberGreenBits = 5; mi.NumberGreenBits = 5;
break; break;
} }
mi.Frequency = (uint16) (mode->timing.pixel_clock * 1000 mi.Frequency = (uint16) (mode->timing.pixel_clock * 1000
/ (mode->timing.h_total * mode->timing.v_total)); / (mode->timing.h_total * mode->timing.v_total));
return et6000SetGraphicsMode(&mi, pciConfigSpace); return et6000SetGraphicsMode(&mi, pciConfigSpace);
} }
/*****************************************************************************/ /*****************************************************************************/
status_t et6000ProposeMode(display_mode *mode, uint32 memSize) { status_t et6000ProposeMode(display_mode *mode, uint32 memSize) {
uint8 m, bpp; uint8 m, bpp;
uint16 refreshRate; uint16 refreshRate;
/* Framebuffer must not overlap with the memory mapped registers */ /* Framebuffer must not overlap with the memory mapped registers */
if (memSize > 0x3fe000) if (memSize > 0x3fe000)
memSize = 0x3fe000; memSize = 0x3fe000;
memSize -= ET6000_ACL_NEEDS_MEMORY; memSize -= ET6000_ACL_NEEDS_MEMORY;
switch (mode->space) { switch (mode->space) {
case B_RGB24_LITTLE: case B_RGB24_LITTLE:
case B_RGB24_BIG: case B_RGB24_BIG:
bpp = 24; bpp = 24;
break; break;
case B_RGB16_LITTLE: case B_RGB16_LITTLE:
case B_RGB16_BIG: case B_RGB16_BIG:
case B_RGB15_LITTLE: case B_RGB15_LITTLE:
case B_RGB15_BIG: case B_RGB15_BIG:
bpp = 16; bpp = 16;
break; break;
} }
refreshRate = (uint16) (mode->timing.pixel_clock * 1000 refreshRate = (uint16) (mode->timing.pixel_clock * 1000
/ (mode->timing.h_total * mode->timing.v_total)); / (mode->timing.h_total * mode->timing.v_total));
for(m = 0; m < CLOCK0MN; m++) { for(m = 0; m < CLOCK0MN; m++) {
if ((clock0MN[m].width == mode->virtual_width) && if ((clock0MN[m].width == mode->virtual_width) &&
(clock0MN[m].height == mode->virtual_height) && (clock0MN[m].height == mode->virtual_height) &&
(clock0MN[m].bpp == bpp) && (clock0MN[m].bpp == bpp) &&
((clock0MN[m].refreshRate-1 <= refreshRate) && ((clock0MN[m].refreshRate-1 <= refreshRate) &&
(clock0MN[m].refreshRate+1 >= refreshRate))) (clock0MN[m].refreshRate+1 >= refreshRate)))
{ {
break; break;
} }
} }
if (m == CLOCK0MN) if (m == CLOCK0MN)
return B_BAD_VALUE; /* Found no entry for requested mode */ return B_BAD_VALUE; /* Found no entry for requested mode */
if (mode->virtual_width * mode->virtual_height * bpp / 8 > memSize) if (mode->virtual_width * mode->virtual_height * bpp / 8 > memSize)
return B_BAD_VALUE; /* Not enough adapter onboard memory */ return B_BAD_VALUE; /* Not enough adapter onboard memory */
return B_OK; return B_OK;
} }
/*****************************************************************************/ /*****************************************************************************/
@@ -1,19 +1,19 @@
/*****************************************************************************\ /*****************************************************************************\
* Tseng Labs ET6000, ET6100 and ET6300 graphics driver for BeOS 5. * Tseng Labs ET6000, ET6100 and ET6300 graphics driver for BeOS 5.
* Copyright (c) 2003-2004, Evgeniy Vladimirovich Bobkov. * Copyright (c) 2003-2004, Evgeniy Vladimirovich Bobkov.
\*****************************************************************************/ \*****************************************************************************/
#ifndef _ET6000SETMODE_H_ #ifndef _ET6000SETMODE_H_
#define _ET6000SETMODE_H_ #define _ET6000SETMODE_H_
#include "DriverInterface.h" #include "DriverInterface.h"
#include "bits.h" #include "bits.h"
/*****************************************************************************/ /*****************************************************************************/
__inline void et6000EnableLinearMemoryMapping(uint16 pciConfigSpace); __inline void et6000EnableLinearMemoryMapping(uint16 pciConfigSpace);
status_t et6000SetMode(display_mode *mode, uint16 pciConfigSpace); status_t et6000SetMode(display_mode *mode, uint16 pciConfigSpace);
status_t et6000ProposeMode(display_mode *mode, uint32 memSize); status_t et6000ProposeMode(display_mode *mode, uint32 memSize);
/*****************************************************************************/ /*****************************************************************************/
#endif /* _ET6000SETMODE_H_ */ #endif /* _ET6000SETMODE_H_ */