OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [mw/] [src/] [drivers/] [vgaplan4.i] - Rev 1765

Compare with Previous | Blame | View Log

# 1 "vgaplan4.c"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "vgaplan4.c"
# 21 "vgaplan4.c"
# 1 "/projects/or32-uclinux/include/assert.h" 1
# 25 "/projects/or32-uclinux/include/assert.h"
# 1 "/projects/or32-uclinux/include/features.h" 1
# 292 "/projects/or32-uclinux/include/features.h"
# 1 "/projects/or32-uclinux/include/sys/cdefs.h" 1
# 293 "/projects/or32-uclinux/include/features.h" 2
# 327 "/projects/or32-uclinux/include/features.h"
# 1 "/projects/or32-uclinux/include/bits/uClibc_config.h" 1
# 328 "/projects/or32-uclinux/include/features.h" 2
# 26 "/projects/or32-uclinux/include/assert.h" 2
# 36 "/projects/or32-uclinux/include/assert.h"
extern void __assert (const char *, const char *, int, const char *) ;
# 22 "vgaplan4.c" 2
# 1 "../include/device.h" 1
# 10 "../include/device.h"
# 1 "../include/mwtypes.h" 1
# 160 "../include/mwtypes.h"
    typedef unsigned char MWPIXELVAL;
# 176 "../include/mwtypes.h"
typedef int MWCOORD;
typedef int MWBOOL;
typedef unsigned char MWUCHAR;
typedef unsigned long MWCOLORVAL;
typedef unsigned short MWIMAGEBITS;
typedef unsigned long MWTIMEOUT;


typedef struct _mwlist {
        struct _mwlist *next;
        struct _mwlist *prev;
} MWLIST, *PMWLIST;


typedef struct _mwlisthead {
        struct _mwlist *head;
        struct _mwlist *tail;
} MWLISTHEAD, *PMWLISTHEAD;


typedef unsigned int MWKEYMOD;


typedef struct {
        MWCOORD rows;
        MWCOORD cols;
        int xdpcm;
        int ydpcm;
        int planes;
        int bpp;
        long ncolors;
        int fonts;
        int buttons;
        MWKEYMOD modifiers;
        int pixtype;
        int portrait;
        MWBOOL fbdriver;
        unsigned long rmask;
        unsigned long gmask;
        unsigned long bmask;
        MWCOORD xpos;
        MWCOORD ypos;


        int vs_width;
        int vs_height;
        int ws_width;
        int ws_height;
} MWSCREENINFO, *PMWSCREENINFO;


typedef struct {
        unsigned char * physpixels;

        unsigned char * winpixels;
        int pixtype;
        int bpp;
        int bytespp;
        int pitch;
        int x, y;
        int portrait_mode;
        MWCOORD xres;
        MWCOORD yres;
        MWCOORD xvirtres;
        MWCOORD yvirtres;
} MWWINDOWFBINFO;


typedef struct {
        int maxwidth;
        int height;
        int baseline;
        int firstchar;
        int lastchar;
        MWBOOL fixed;
        MWUCHAR widths[256];
} MWFONTINFO, *PMWFONTINFO;


typedef struct {
        char *ttname;
        char *mwname;
} MWFONTLIST, *PMWFONTLIST;
# 311 "../include/mwtypes.h"
typedef struct {
        long lfHeight;
        long lfWidth;
        long lfEscapement;
        long lfOrientation;
        long lfWeight;
        MWUCHAR lfItalic;
        MWUCHAR lfUnderline;
        MWUCHAR lfStrikeOut;
        MWUCHAR lfCharSet;
        MWUCHAR lfOutPrecision;
        MWUCHAR lfClipPrecision;
        MWUCHAR lfQuality;


        MWUCHAR lfRoman;
        MWUCHAR lfSerif;
        MWUCHAR lfSansSerif;
        MWUCHAR lfModern;
        MWUCHAR lfMonospace;
        MWUCHAR lfProportional;
        MWUCHAR lfOblique;
        MWUCHAR lfSmallCaps;
        MWUCHAR lfPitch;

        char lfFaceName[64];
} MWLOGFONT, *PMWLOGFONT;
# 402 "../include/mwtypes.h"
typedef struct {
        MWCOORD x;
        MWCOORD y;
} MWPOINT;


typedef struct {
        MWCOORD left;
        MWCOORD top;
        MWCOORD right;
        MWCOORD bottom;
} MWRECT;


typedef struct {
        int size;
        int numRects;
        int type;
        MWRECT *rects;
        MWRECT extents;
} MWCLIPREGION;
# 440 "../include/mwtypes.h"
typedef struct {
        MWUCHAR r;
        MWUCHAR g;
        MWUCHAR b;
} MWPALENTRY;






typedef struct {
        int width;
        int height;
        int planes;
        int bpp;
        int pitch;
        int bytesperpixel;
        int compression;
        int palsize;
        long transcolor;
        MWPALENTRY * palette;
        MWUCHAR * imagebits;
} MWIMAGEHDR, *PMWIMAGEHDR;


typedef struct {
        int id;
        int width;
        int height;
        int planes;
        int bpp;
        int pitch;
        int bytesperpixel;
        int compression;
        int palsize;
        MWPALENTRY palette[256];
} MWIMAGEINFO, *PMWIMAGEINFO;




typedef struct {
        int width;
        int height;
        MWCOORD hotx;
        MWCOORD hoty;
        MWCOLORVAL fgcolor;
        MWCOLORVAL bgcolor;
        MWIMAGEBITS image[16];
        MWIMAGEBITS mask[16];
} MWCURSOR, *PMWCURSOR;

typedef struct _mwfont * PMWFONT;
# 534 "../include/mwtypes.h"
typedef unsigned short MWKEY;
typedef unsigned char MWSCANCODE;
# 660 "../include/mwtypes.h"
typedef struct {
        int led;
        int led_mode;
} MWKBINFO, *PMWKBINFO;
# 11 "../include/device.h" 2
# 30 "../include/device.h"
typedef struct _mwscreendevice *PSD;


typedef struct {
        char * name;
        int maxwidth;
        int height;
        int ascent;
        int firstchar;
        int size;
        MWIMAGEBITS * bits;
        unsigned short *offset;
        unsigned char * width;
} MWCFONT, *PMWCFONT;


typedef struct {
        int encoding;
        MWBOOL (*GetFontInfo)(PMWFONT pfont, PMWFONTINFO pfontinfo);
        void (*GetTextSize)(PMWFONT pfont, const void *text, int cc,
                        MWCOORD *pwidth, MWCOORD *pheight, MWCOORD *pbase);
        void (*GetTextBits)(PMWFONT pfont, int ch, MWIMAGEBITS *retmap,
                        MWCOORD *pwidth, MWCOORD *pheight, MWCOORD *pbase);
        void (*DestroyFont)(PMWFONT pfont);
        void (*DrawText)(PMWFONT pfont, PSD psd, MWCOORD x, MWCOORD y,
                        const void *str, int count, int flags);
        void (*SetFontSize)(PMWFONT pfont, MWCOORD fontsize);
        void (*SetFontRotation)(PMWFONT pfont, int tenthdegrees);
        void (*SetFontAttr)(PMWFONT pfont, int setflags, int clrflags);
} MWFONTPROCS, *PMWFONTPROCS;


typedef struct _mwfont {
        PMWFONTPROCS fontprocs;
        MWCOORD fontsize;
        int fontrotation;
        int fontattr;

} MWFONT;





typedef struct {
        PMWFONTPROCS fontprocs;
        MWCOORD fontsize;
        int fontrotation;
        int fontattr;

        char * name;
        PMWCFONT cfont;
} MWCOREFONT, *PMWCOREFONT;




typedef struct {
        MWCOORD dstx, dsty, dstw, dsth, dst_linelen;
        MWCOORD srcx, srcy, src_linelen;
        void *pixels, *misc;
        MWPIXELVAL bg_color, fg_color;
        int gr_usebg;
} driver_gc_t;
# 104 "../include/device.h"
typedef struct {
        PSD dstpsd;
        MWCOORD dstx, dsty;
        MWCOORD dstw, dsth;
        MWCOORD srcx, srcy;
        MWCOORD srcw, srch;
        PSD srcpsd;
        unsigned long rop;
        PSD alphachan;
        MWPIXELVAL fgcolor;
        MWPIXELVAL bgcolor;
        MWPIXELVAL transcolor;
} MWBLITARGS, *PMWBLITARGS;



typedef struct {
        int (*Init)(PSD psd);
        void (*DrawPixel)(PSD psd, MWCOORD x, MWCOORD y, MWPIXELVAL c);
        MWPIXELVAL (*ReadPixel)(PSD psd, MWCOORD x, MWCOORD y);
        void (*DrawHorzLine)(PSD psd, MWCOORD x1, MWCOORD x2, MWCOORD y,
                        MWPIXELVAL c);
        void (*DrawVertLine)(PSD psd, MWCOORD x, MWCOORD y1, MWCOORD y2,
                        MWPIXELVAL c);
        void (*FillRect)(PSD psd,MWCOORD x1,MWCOORD y1,MWCOORD x2,
                        MWCOORD y2,MWPIXELVAL c);
        void (*Blit)(PSD destpsd, MWCOORD destx, MWCOORD desty, MWCOORD w,
                        MWCOORD h,PSD srcpsd,MWCOORD srcx,MWCOORD srcy,long op);
        void (*DrawArea)(PSD psd, driver_gc_t *gc, int op);
        void (*StretchBlit)(PSD destpsd, MWCOORD destx, MWCOORD desty,
                        MWCOORD dstw, MWCOORD dsth, PSD srcpsd, MWCOORD srcx,
                        MWCOORD srcy, MWCOORD srcw, MWCOORD srch, long op);
} SUBDRIVER, *PSUBDRIVER;





typedef struct _mwscreendevice {
        MWCOORD xres;
        MWCOORD yres;
        MWCOORD xvirtres;
        MWCOORD yvirtres;
        int planes;
        int bpp;
        int linelen;

        int size;
        long ncolors;
        int pixtype;
        int flags;
        void * addr;

        PSD (*Open)(PSD psd);
        void (*Close)(PSD psd);
        void (*GetScreenInfo)(PSD psd,PMWSCREENINFO psi);
        void (*SetPalette)(PSD psd,int first,int count,MWPALENTRY *pal);
        void (*DrawPixel)(PSD psd,MWCOORD x,MWCOORD y,MWPIXELVAL c);
        MWPIXELVAL (*ReadPixel)(PSD psd,MWCOORD x,MWCOORD y);
        void (*DrawHorzLine)(PSD psd,MWCOORD x1,MWCOORD x2,MWCOORD y,
                        MWPIXELVAL c);
        void (*DrawVertLine)(PSD psd,MWCOORD x,MWCOORD y1,MWCOORD y2,
                        MWPIXELVAL c);
        void (*FillRect)(PSD psd,MWCOORD x1,MWCOORD y1,MWCOORD x2,MWCOORD y2,
                        MWPIXELVAL c);
        PMWCOREFONT builtin_fonts;




        void (*Blit)(PSD destpsd,MWCOORD destx,MWCOORD desty,MWCOORD w,
                        MWCOORD h,PSD srcpsd,MWCOORD srcx,MWCOORD srcy,long op);
        void (*PreSelect)(PSD psd);
        void (*DrawArea)(PSD psd, driver_gc_t *gc, int op);
        int (*SetIOPermissions)(PSD psd);
        PSD (*AllocateMemGC)(PSD psd);
        MWBOOL (*MapMemGC)(PSD mempsd,MWCOORD w,MWCOORD h,int planes,int bpp,
                        int linelen,int size,void *addr);
        void (*FreeMemGC)(PSD mempsd);
        void (*StretchBlit)(PSD destpsd,MWCOORD destx,MWCOORD desty,
                        MWCOORD destw,MWCOORD desth,PSD srcpsd,MWCOORD srcx,
                        MWCOORD srcy,MWCOORD srcw,MWCOORD srch,long op);
        void (*SetPortrait)(PSD psd,int portraitmode);
        int portrait;
        PSUBDRIVER orgsubdriver;
} SCREENDEVICE;
# 200 "../include/device.h"
typedef struct _mousedevice {
        int (*Open)(struct _mousedevice *);
        void (*Close)(void);
        int (*GetButtonInfo)(void);
        void (*GetDefaultAccel)(int *pscale,int *pthresh);
        int (*Read)(MWCOORD *dx,MWCOORD *dy,MWCOORD *dz,int *bp);
        int (*Poll)(void);
} MOUSEDEVICE;


typedef struct _kbddevice {
        int (*Open)(struct _kbddevice *pkd);
        void (*Close)(void);
        void (*GetModifierInfo)(MWKEYMOD *modifiers, MWKEYMOD *curmodifiers);
        int (*Read)(MWKEY *buf,MWKEYMOD *modifiers,MWSCANCODE *scancode);
        int (*Poll)(void);
} KBDDEVICE;







typedef struct {
        MWCOORD x;
        MWCOORD y;
        MWCOORD width;
        MWCOORD height;
} MWCLIPRECT;
# 422 "../include/device.h"
PSD GdOpenScreen(void);
void GdCloseScreen(PSD psd);
int GdSetPortraitMode(PSD psd, int portraitmode);
int GdSetMode(int mode);
MWBOOL GdSetUseBackground(MWBOOL flag);
MWPIXELVAL GdSetForeground(MWPIXELVAL fg);
MWPIXELVAL GdSetBackground(MWPIXELVAL bg);
void GdResetPalette(void);
void GdSetPalette(PSD psd,int first, int count, MWPALENTRY *palette);
int GdGetPalette(PSD psd,int first, int count, MWPALENTRY *palette);
MWPIXELVAL GdFindColor(MWCOLORVAL c);
MWPIXELVAL GdFindNearestColor(MWPALENTRY *pal, int size, MWCOLORVAL cr);
int GdCaptureScreen(char *path);
void GdGetScreenInfo(PSD psd,PMWSCREENINFO psi);
void GdPoint(PSD psd,MWCOORD x, MWCOORD y);
void GdLine(PSD psd,MWCOORD x1,MWCOORD y1,MWCOORD x2,MWCOORD y2,
                MWBOOL bDrawLastPoint);
void GdRect(PSD psd,MWCOORD x, MWCOORD y, MWCOORD width, MWCOORD height);
void GdFillRect(PSD psd,MWCOORD x, MWCOORD y, MWCOORD width, MWCOORD height);
void GdBitmap(PSD psd,MWCOORD x,MWCOORD y,MWCOORD width,MWCOORD height,
                MWIMAGEBITS *imagebits);
MWBOOL GdColorInPalette(MWCOLORVAL cr,MWPALENTRY *palette,int palsize);
void GdMakePaletteConversionTable(PSD psd,MWPALENTRY *palette,int palsize,
                MWPIXELVAL *convtable,int fLoadType);
void GdDrawImage(PSD psd,MWCOORD x, MWCOORD y, PMWIMAGEHDR pimage);
void GdPoly(PSD psd,int count, MWPOINT *points);
void GdFillPoly(PSD psd,int count, MWPOINT *points);
void GdReadArea(PSD psd,MWCOORD x,MWCOORD y,MWCOORD width,MWCOORD height,
                MWPIXELVAL *pixels);
void GdArea(PSD psd,MWCOORD x,MWCOORD y,MWCOORD width,MWCOORD height,
                void *pixels, int pixtype);
void GdTranslateArea(MWCOORD width, MWCOORD height, void *in, int inpixtype,
                MWCOORD inpitch, void *out, int outpixtype, int outpitch);
void GdCopyArea(PSD psd,MWCOORD srcx,MWCOORD srcy,MWCOORD width,
                MWCOORD height, MWCOORD destx, MWCOORD desty);
void GdBlit(PSD dstpsd, MWCOORD dstx, MWCOORD dsty, MWCOORD width,
                MWCOORD height,PSD srcpsd,MWCOORD srcx,MWCOORD srcy,long rop);
void GdStretchBlit(PSD dstpsd, MWCOORD dstx, MWCOORD dsty, MWCOORD dstw,
                MWCOORD dsth, PSD srcpsd, MWCOORD srcx, MWCOORD srcy,
                MWCOORD srcw, MWCOORD srch, long rop);
int GdCalcMemGCAlloc(PSD psd, unsigned int width, unsigned int height,
                int planes, int bpp, int *size, int *linelen);
extern SCREENDEVICE scrdev;



void GdArcAngle(PSD psd, MWCOORD x0, MWCOORD y0, MWCOORD rx, MWCOORD ry,
                MWCOORD angle1, MWCOORD angle2, int type);

void GdArc(PSD psd, MWCOORD x0, MWCOORD y0, MWCOORD rx, MWCOORD ry,
                MWCOORD ax, MWCOORD ay, MWCOORD bx, MWCOORD by, int type);
void GdEllipse(PSD psd,MWCOORD x, MWCOORD y, MWCOORD rx, MWCOORD ry,
                MWBOOL fill);


void GdClearFontList(void);
int GdAddFont(char *fndry, char *family, char *fontname, PMWLOGFONT lf,
                  unsigned int flags);
PMWFONT GdSetFont(PMWFONT pfont);
PMWFONT GdCreateFont(PSD psd, const char *name, MWCOORD height,
                const PMWLOGFONT plogfont);
MWCOORD GdSetFontSize(PMWFONT pfont, MWCOORD fontsize);
void GdGetFontList(MWFONTLIST ***list, int *num);
void GdFreeFontList(MWFONTLIST ***list, int num);
int GdSetFontRotation(PMWFONT pfont, int tenthdegrees);
int GdSetFontAttr(PMWFONT pfont, int setflags, int clrflags);
void GdDestroyFont(PMWFONT pfont);
MWBOOL GdGetFontInfo(PMWFONT pfont, PMWFONTINFO pfontinfo);
int GdConvertEncoding(const void *istr, int iflags, int cc, void *ostr,
                int oflags);
void GdGetTextSize(PMWFONT pfont, const void *str, int cc, MWCOORD *pwidth,
                MWCOORD *pheight, MWCOORD *pbase, int flags);
int GdGetTextSizeEx(PMWFONT pfont, const void *str, int cc,
                int nMaxExtent, int *lpnFit, int *alpDx, MWCOORD *pwidth,
                MWCOORD *pheight, MWCOORD *pbase, int flags);
void GdText(PSD psd,MWCOORD x,MWCOORD y,const void *str,int count,int flags);


void GdSetClipRects(PSD psd,int count,MWCLIPRECT *table);
MWBOOL GdClipPoint(PSD psd,MWCOORD x,MWCOORD y);
int GdClipArea(PSD psd,MWCOORD x1, MWCOORD y1, MWCOORD x2, MWCOORD y2);
extern MWCOORD clipminx, clipminy, clipmaxx, clipmaxy;


void GdSetClipRegion(PSD psd, MWCLIPREGION *reg);


MWBOOL GdPtInRegion(MWCLIPREGION *rgn, MWCOORD x, MWCOORD y);
int GdRectInRegion(MWCLIPREGION *rgn, const MWRECT *rect);
MWBOOL GdEqualRegion(MWCLIPREGION *r1, MWCLIPREGION *r2);
MWBOOL GdEmptyRegion(MWCLIPREGION *rgn);
MWCLIPREGION *GdAllocRegion(void);
MWCLIPREGION *GdAllocRectRegion(MWCOORD left,MWCOORD top,MWCOORD right,MWCOORD bottom);
MWCLIPREGION *GdAllocRectRegionIndirect(MWRECT *prc);
void GdSetRectRegion(MWCLIPREGION *rgn, MWCOORD left, MWCOORD top,
                MWCOORD right, MWCOORD bottom);
void GdSetRectRegionIndirect(MWCLIPREGION *rgn, MWRECT *prc);
void GdDestroyRegion(MWCLIPREGION *rgn);
void GdOffsetRegion(MWCLIPREGION *rgn, MWCOORD x, MWCOORD y);
int GdGetRegionBox(MWCLIPREGION *rgn, MWRECT *prc);
void GdUnionRectWithRegion(const MWRECT *rect, MWCLIPREGION *rgn);
void GdSubtractRectFromRegion(const MWRECT *rect, MWCLIPREGION *rgn);
void GdCopyRegion(MWCLIPREGION *d, MWCLIPREGION *s);
void GdIntersectRegion(MWCLIPREGION *d, MWCLIPREGION *s1, MWCLIPREGION *s2);
void GdUnionRegion(MWCLIPREGION *d, MWCLIPREGION *s1, MWCLIPREGION *s2);
void GdSubtractRegion(MWCLIPREGION *d, MWCLIPREGION *s1, MWCLIPREGION *s2);
void GdXorRegion(MWCLIPREGION *d, MWCLIPREGION *s1, MWCLIPREGION *s2);


MWCLIPREGION *GdAllocPolygonRegion(MWPOINT *points, int count, int mode);
MWCLIPREGION *GdAllocPolyPolygonRegion(MWPOINT *points, int *count,
                int nbpolygons, int mode);


int GdOpenMouse(void);
void GdCloseMouse(void);
void GdGetButtonInfo(int *buttons);
void GdRestrictMouse(MWCOORD newminx,MWCOORD newminy,MWCOORD newmaxx,
                MWCOORD newmaxy);
void GdSetAccelMouse(int newthresh, int newscale);
void GdMoveMouse(MWCOORD newx, MWCOORD newy);
int GdReadMouse(MWCOORD *px, MWCOORD *py, int *pb);
void GdMoveCursor(MWCOORD x, MWCOORD y);
MWBOOL GdGetCursorPos(MWCOORD *px, MWCOORD *py);
void GdSetCursor(PMWCURSOR pcursor);
int GdShowCursor(PSD psd);
int GdHideCursor(PSD psd);
void GdCheckCursor(PSD psd,MWCOORD x1,MWCOORD y1,MWCOORD x2,MWCOORD y2);
void GdFixCursor(PSD psd);
extern MOUSEDEVICE mousedev;


int GdOpenKeyboard(void);
void GdCloseKeyboard(void);
void GdGetModifierInfo(MWKEYMOD *modifiers, MWKEYMOD *curmodifiers);
int GdReadKeyboard(MWKEY *buf, MWKEYMOD *modifiers, MWSCANCODE *scancode);
extern KBDDEVICE kbddev;



int GdLoadImageFromBuffer(PSD psd, void *buffer, int size, int flags);
void GdDrawImageFromBuffer(PSD psd, MWCOORD x, MWCOORD y, MWCOORD width,
                 MWCOORD height, void *buffer, int size, int flags);
void GdDrawImageFromFile(PSD psd, MWCOORD x, MWCOORD y, MWCOORD width,
                MWCOORD height, char *path, int flags);
int GdLoadImageFromFile(PSD psd, char *path, int flags);
void GdDrawImageToFit(PSD psd, MWCOORD x, MWCOORD y, MWCOORD width,
                MWCOORD height, int id);
void GdFreeImage(int id);
MWBOOL GdGetImageInfo(int id, PMWIMAGEINFO pii);
void GdStretchImage(PMWIMAGEHDR src, MWCLIPRECT *srcrect, PMWIMAGEHDR dst,
                MWCLIPRECT *dstrect);





void * GdItemAlloc(unsigned int size);
void GdListAdd(PMWLISTHEAD pHead,PMWLIST pItem);
void GdListInsert(PMWLISTHEAD pHead,PMWLIST pItem);
void GdListRemove(PMWLISTHEAD pHead,PMWLIST pItem);
# 591 "../include/device.h"
# 1 "/projects/or32-uclinux/include/sys/time.h" 1
# 24 "/projects/or32-uclinux/include/sys/time.h"
# 1 "/projects/or32-uclinux/include/bits/types.h" 1
# 29 "/projects/or32-uclinux/include/bits/types.h"
# 1 "/projects/or32-uclinux/lib/gcc-lib/or32-uclinux/3.1/include/stddef.h" 1
# 201 "/projects/or32-uclinux/lib/gcc-lib/or32-uclinux/3.1/include/stddef.h"
typedef unsigned int size_t;
# 30 "/projects/or32-uclinux/include/bits/types.h" 2


typedef unsigned char __u_char;
typedef unsigned short __u_short;
typedef unsigned int __u_int;
typedef unsigned long __u_long;

__extension__ typedef unsigned long long int __u_quad_t;
__extension__ typedef long long int __quad_t;
# 49 "/projects/or32-uclinux/include/bits/types.h"
typedef signed char __int8_t;
typedef unsigned char __uint8_t;
typedef signed short int __int16_t;
typedef unsigned short int __uint16_t;
typedef signed int __int32_t;
typedef unsigned int __uint32_t;

__extension__ typedef signed long long int __int64_t;
__extension__ typedef unsigned long long int __uint64_t;

typedef __quad_t *__qaddr_t;



typedef __u_int __dev_t;
typedef __u_int __uid_t;
typedef __u_int __gid_t;
typedef __u_int __ino_t;
typedef __u_int __mode_t;
typedef __u_short __nlink_t;
typedef long int __off_t;
typedef __quad_t __loff_t;
typedef int __pid_t;
typedef int __ssize_t;
typedef __u_long __rlim_t;
typedef __u_quad_t __rlim64_t;
typedef __u_int __id_t;

typedef struct
  {
    int __val[2];
  } __fsid_t;


typedef int __daddr_t;
typedef char *__caddr_t;
typedef long int __time_t;
typedef unsigned int __useconds_t;
typedef long int __suseconds_t;
typedef long int __swblk_t;

typedef long int __clock_t;


typedef int __clockid_t;


typedef int __timer_t;






typedef int __key_t;


typedef unsigned short int __ipc_pid_t;



typedef long int __blksize_t;




typedef long int __blkcnt_t;
typedef __quad_t __blkcnt64_t;


typedef __u_long __fsblkcnt_t;
typedef __u_quad_t __fsblkcnt64_t;


typedef __u_long __fsfilcnt_t;
typedef __u_quad_t __fsfilcnt64_t;


typedef __u_quad_t __ino64_t;


typedef __loff_t __off64_t;


typedef long int __t_scalar_t;
typedef unsigned long int __t_uscalar_t;


typedef int __intptr_t;


typedef unsigned int __socklen_t;




# 1 "/projects/or32-uclinux/include/bits/pthreadtypes.h" 1
# 23 "/projects/or32-uclinux/include/bits/pthreadtypes.h"
# 1 "/projects/or32-uclinux/include/bits/sched.h" 1
# 68 "/projects/or32-uclinux/include/bits/sched.h"
struct __sched_param
  {
    int __sched_priority;
  };
# 24 "/projects/or32-uclinux/include/bits/pthreadtypes.h" 2


struct _pthread_fastlock
{
  long int __status;
  int __spinlock;

};



typedef struct _pthread_descr_struct *_pthread_descr;





typedef struct __pthread_attr_s
{
  int __detachstate;
  int __schedpolicy;
  struct __sched_param __schedparam;
  int __inheritsched;
  int __scope;
  size_t __guardsize;
  int __stackaddr_set;
  void *__stackaddr;
  size_t __stacksize;
} pthread_attr_t;



typedef struct
{
  struct _pthread_fastlock __c_lock;
  _pthread_descr __c_waiting;
} pthread_cond_t;



typedef struct
{
  int __dummy;
} pthread_condattr_t;


typedef unsigned int pthread_key_t;





typedef struct
{
  int __m_reserved;
  int __m_count;
  _pthread_descr __m_owner;
  int __m_kind;
  struct _pthread_fastlock __m_lock;
} pthread_mutex_t;



typedef struct
{
  int __mutexkind;
} pthread_mutexattr_t;



typedef int pthread_once_t;
# 140 "/projects/or32-uclinux/include/bits/pthreadtypes.h"
typedef unsigned long int pthread_t;
# 146 "/projects/or32-uclinux/include/bits/types.h" 2
# 25 "/projects/or32-uclinux/include/sys/time.h" 2

# 1 "/projects/or32-uclinux/include/time.h" 1
# 70 "/projects/or32-uclinux/include/time.h"
typedef __time_t time_t;
# 27 "/projects/or32-uclinux/include/sys/time.h" 2

# 1 "/projects/or32-uclinux/include/bits/time.h" 1
# 63 "/projects/or32-uclinux/include/bits/time.h"
struct timeval
  {
    __time_t tv_sec;
    __suseconds_t tv_usec;
  };
# 29 "/projects/or32-uclinux/include/sys/time.h" 2

# 1 "/projects/or32-uclinux/include/sys/select.h" 1
# 31 "/projects/or32-uclinux/include/sys/select.h"
# 1 "/projects/or32-uclinux/include/bits/select.h" 1
# 32 "/projects/or32-uclinux/include/sys/select.h" 2


# 1 "/projects/or32-uclinux/include/bits/sigset.h" 1
# 23 "/projects/or32-uclinux/include/bits/sigset.h"
typedef int __sig_atomic_t;




typedef struct
  {
    unsigned long int __val[(1024 / (8 * sizeof (unsigned long int)))];
  } __sigset_t;
# 35 "/projects/or32-uclinux/include/sys/select.h" 2



typedef __sigset_t sigset_t;




# 1 "/projects/or32-uclinux/include/time.h" 1
# 106 "/projects/or32-uclinux/include/time.h"
struct timespec
  {
    long int tv_sec;
    long int tv_nsec;
  };
# 44 "/projects/or32-uclinux/include/sys/select.h" 2

# 1 "/projects/or32-uclinux/include/bits/time.h" 1
# 46 "/projects/or32-uclinux/include/sys/select.h" 2



typedef long int __fd_mask;







typedef struct
  {






    __fd_mask __fds_bits[1024 / (8 * sizeof (__fd_mask))];


  } fd_set;






typedef __fd_mask fd_mask;
# 89 "/projects/or32-uclinux/include/sys/select.h"







extern int select (int __nfds, fd_set *__restrict __readfds,
                   fd_set *__restrict __writefds,
                   fd_set *__restrict __exceptfds,
                   struct timeval *__restrict __timeout) ;
# 112 "/projects/or32-uclinux/include/sys/select.h"

# 31 "/projects/or32-uclinux/include/sys/time.h" 2


typedef __suseconds_t suseconds_t;





# 56 "/projects/or32-uclinux/include/sys/time.h"
struct timezone
  {
    int tz_minuteswest;
    int tz_dsttime;
  };

typedef struct timezone *__restrict __timezone_ptr_t;
# 72 "/projects/or32-uclinux/include/sys/time.h"
extern int gettimeofday (struct timeval *__restrict __tv,
                         __timezone_ptr_t __tz) ;




extern int settimeofday (__const struct timeval *__tv,
                         __const struct timezone *__tz) ;





extern int adjtime (__const struct timeval *__delta,
                    struct timeval *__olddelta) ;




enum __itimer_which
  {

    ITIMER_REAL = 0,


    ITIMER_VIRTUAL = 1,



    ITIMER_PROF = 2

  };



struct itimerval
  {

    struct timeval it_interval;

    struct timeval it_value;
  };






typedef int __itimer_which_t;




extern int getitimer (__itimer_which_t __which,
                      struct itimerval *__value) ;




extern int setitimer (__itimer_which_t __which,
                      __const struct itimerval *__restrict __new,
                      struct itimerval *__restrict __old) ;



extern int utimes (__const char *__file, __const struct timeval __tvp[2])
     ;
# 171 "/projects/or32-uclinux/include/sys/time.h"

# 592 "../include/device.h" 2

typedef void (*MWTIMERCB)(void *);




typedef struct mw_timer MWTIMER;
struct mw_timer {
        struct timeval timeout;
        MWTIMERCB callback;
        void *arg;
        MWTIMER *next;
        MWTIMER *prev;
    int type;
    MWTIMEOUT period;
};

MWTIMER *GdAddTimer(MWTIMEOUT timeout, MWTIMERCB callback, void *arg);
MWTIMER *GdAddPeriodicTimer(MWTIMEOUT timeout, MWTIMERCB callback, void *arg);
void GdDestroyTimer(MWTIMER *timer);
MWTIMER *GdFindTimer(void *arg);
MWBOOL GdGetNextTimeout(struct timeval *tv, MWTIMEOUT timeout);
MWBOOL GdTimeout(void);




int GdError(const char *format, ...);
int GdErrorNull(const char *format, ...);
# 23 "vgaplan4.c" 2
# 1 "vgaplan4.h" 1
# 23 "vgaplan4.h"
# 1 "/projects/or32-uclinux/include/sys/io.h" 1
# 24 "/projects/or32-uclinux/include/sys/io.h"





extern int ioperm (unsigned long int __from, unsigned long int __num,
                   int __turn_on) ;




extern int iopl (int __level) ;
# 49 "/projects/or32-uclinux/include/sys/io.h"
extern unsigned char inb (unsigned long int port) ;
extern unsigned short int inw (unsigned long int port) ;
extern unsigned long int inl (unsigned long int port) ;

extern void outb (unsigned char value, unsigned long int port) ;
extern void outw (unsigned short value, unsigned long int port) ;
extern void outl (unsigned long value, unsigned long int port) ;



# 24 "vgaplan4.h" 2



# 1 "/projects/or32-uclinux/include/unistd.h" 1
# 28 "/projects/or32-uclinux/include/unistd.h"

# 175 "/projects/or32-uclinux/include/unistd.h"
# 1 "/projects/or32-uclinux/include/bits/posix_opt.h" 1
# 176 "/projects/or32-uclinux/include/unistd.h" 2
# 193 "/projects/or32-uclinux/include/unistd.h"
typedef __ssize_t ssize_t;





# 1 "/projects/or32-uclinux/lib/gcc-lib/or32-uclinux/3.1/include/stddef.h" 1
# 200 "/projects/or32-uclinux/include/unistd.h" 2
# 240 "/projects/or32-uclinux/include/unistd.h"
typedef __intptr_t intptr_t;






typedef __socklen_t socklen_t;
# 260 "/projects/or32-uclinux/include/unistd.h"
extern int access (__const char *__name, int __type) ;
# 291 "/projects/or32-uclinux/include/unistd.h"
extern __off_t lseek (int __fd, __off_t __offset, int __whence) ;
# 307 "/projects/or32-uclinux/include/unistd.h"
extern int close (int __fd) ;



extern ssize_t read (int __fd, void *__buf, size_t __nbytes) ;


extern ssize_t write (int __fd, __const void *__buf, size_t __n) ;
# 354 "/projects/or32-uclinux/include/unistd.h"
extern int pipe (int __pipedes[2]) ;
# 363 "/projects/or32-uclinux/include/unistd.h"
extern unsigned int alarm (unsigned int __seconds) ;
# 372 "/projects/or32-uclinux/include/unistd.h"
extern unsigned int sleep (unsigned int __seconds) ;






extern __useconds_t ualarm (__useconds_t __value, __useconds_t __interval)
     ;



extern int usleep (__useconds_t __useconds) ;





extern int pause (void) ;



extern int chown (__const char *__file, __uid_t __owner, __gid_t __group)
     ;



extern int fchown (int __fd, __uid_t __owner, __gid_t __group) ;




extern int lchown (__const char *__file, __uid_t __owner, __gid_t __group)
     ;




extern int chdir (__const char *__path) ;



extern int fchdir (int __fd) ;
# 424 "/projects/or32-uclinux/include/unistd.h"
extern char *getcwd (char *__buf, size_t __size) ;
# 438 "/projects/or32-uclinux/include/unistd.h"
extern char *getwd (char *__buf) ;




extern int dup (int __fd) ;


extern int dup2 (int __fd, int __fd2) ;


extern char **__environ;







extern int execve (__const char *__path, char *__const __argv[],
                   char *__const __envp[]) ;
# 470 "/projects/or32-uclinux/include/unistd.h"
extern int execv (__const char *__path, char *__const __argv[]) ;



extern int execle (__const char *__path, __const char *__arg, ...) ;



extern int execl (__const char *__path, __const char *__arg, ...) ;



extern int execvp (__const char *__file, char *__const __argv[]) ;




extern int execlp (__const char *__file, __const char *__arg, ...) ;




extern int nice (int __inc) ;




extern void _exit (int __status) __attribute__ ((__noreturn__));





# 1 "/projects/or32-uclinux/include/bits/confname.h" 1
# 25 "/projects/or32-uclinux/include/bits/confname.h"
enum
  {
    _PC_LINK_MAX,

    _PC_MAX_CANON,

    _PC_MAX_INPUT,

    _PC_NAME_MAX,

    _PC_PATH_MAX,

    _PC_PIPE_BUF,

    _PC_CHOWN_RESTRICTED,

    _PC_NO_TRUNC,

    _PC_VDISABLE,

    _PC_SYNC_IO,

    _PC_ASYNC_IO,

    _PC_PRIO_IO,

    _PC_SOCK_MAXBUF,

    _PC_FILESIZEBITS,

    _PC_REC_INCR_XFER_SIZE,

    _PC_REC_MAX_XFER_SIZE,

    _PC_REC_MIN_XFER_SIZE,

    _PC_REC_XFER_ALIGN,

    _PC_ALLOC_SIZE_MIN,

    _PC_SYMLINK_MAX

  };


enum
  {
    _SC_ARG_MAX,

    _SC_CHILD_MAX,

    _SC_CLK_TCK,

    _SC_NGROUPS_MAX,

    _SC_OPEN_MAX,

    _SC_STREAM_MAX,

    _SC_TZNAME_MAX,

    _SC_JOB_CONTROL,

    _SC_SAVED_IDS,

    _SC_REALTIME_SIGNALS,

    _SC_PRIORITY_SCHEDULING,

    _SC_TIMERS,

    _SC_ASYNCHRONOUS_IO,

    _SC_PRIORITIZED_IO,

    _SC_SYNCHRONIZED_IO,

    _SC_FSYNC,

    _SC_MAPPED_FILES,

    _SC_MEMLOCK,

    _SC_MEMLOCK_RANGE,

    _SC_MEMORY_PROTECTION,

    _SC_MESSAGE_PASSING,

    _SC_SEMAPHORES,

    _SC_SHARED_MEMORY_OBJECTS,

    _SC_AIO_LISTIO_MAX,

    _SC_AIO_MAX,

    _SC_AIO_PRIO_DELTA_MAX,

    _SC_DELAYTIMER_MAX,

    _SC_MQ_OPEN_MAX,

    _SC_MQ_PRIO_MAX,

    _SC_VERSION,

    _SC_PAGESIZE,


    _SC_RTSIG_MAX,

    _SC_SEM_NSEMS_MAX,

    _SC_SEM_VALUE_MAX,

    _SC_SIGQUEUE_MAX,

    _SC_TIMER_MAX,




    _SC_BC_BASE_MAX,

    _SC_BC_DIM_MAX,

    _SC_BC_SCALE_MAX,

    _SC_BC_STRING_MAX,

    _SC_COLL_WEIGHTS_MAX,

    _SC_EQUIV_CLASS_MAX,

    _SC_EXPR_NEST_MAX,

    _SC_LINE_MAX,

    _SC_RE_DUP_MAX,

    _SC_CHARCLASS_NAME_MAX,


    _SC_2_VERSION,

    _SC_2_C_BIND,

    _SC_2_C_DEV,

    _SC_2_FORT_DEV,

    _SC_2_FORT_RUN,

    _SC_2_SW_DEV,

    _SC_2_LOCALEDEF,


    _SC_PII,

    _SC_PII_XTI,

    _SC_PII_SOCKET,

    _SC_PII_INTERNET,

    _SC_PII_OSI,

    _SC_POLL,

    _SC_SELECT,

    _SC_UIO_MAXIOV,

    _SC_IOV_MAX = _SC_UIO_MAXIOV,

    _SC_PII_INTERNET_STREAM,

    _SC_PII_INTERNET_DGRAM,

    _SC_PII_OSI_COTS,

    _SC_PII_OSI_CLTS,

    _SC_PII_OSI_M,

    _SC_T_IOV_MAX,



    _SC_THREADS,

    _SC_THREAD_SAFE_FUNCTIONS,

    _SC_GETGR_R_SIZE_MAX,

    _SC_GETPW_R_SIZE_MAX,

    _SC_LOGIN_NAME_MAX,

    _SC_TTY_NAME_MAX,

    _SC_THREAD_DESTRUCTOR_ITERATIONS,

    _SC_THREAD_KEYS_MAX,

    _SC_THREAD_STACK_MIN,

    _SC_THREAD_THREADS_MAX,

    _SC_THREAD_ATTR_STACKADDR,

    _SC_THREAD_ATTR_STACKSIZE,

    _SC_THREAD_PRIORITY_SCHEDULING,

    _SC_THREAD_PRIO_INHERIT,

    _SC_THREAD_PRIO_PROTECT,

    _SC_THREAD_PROCESS_SHARED,


    _SC_NPROCESSORS_CONF,

    _SC_NPROCESSORS_ONLN,

    _SC_PHYS_PAGES,

    _SC_AVPHYS_PAGES,

    _SC_ATEXIT_MAX,

    _SC_PASS_MAX,


    _SC_XOPEN_VERSION,

    _SC_XOPEN_XCU_VERSION,

    _SC_XOPEN_UNIX,

    _SC_XOPEN_CRYPT,

    _SC_XOPEN_ENH_I18N,

    _SC_XOPEN_SHM,


    _SC_2_CHAR_TERM,

    _SC_2_C_VERSION,

    _SC_2_UPE,


    _SC_XOPEN_XPG2,

    _SC_XOPEN_XPG3,

    _SC_XOPEN_XPG4,


    _SC_CHAR_BIT,

    _SC_CHAR_MAX,

    _SC_CHAR_MIN,

    _SC_INT_MAX,

    _SC_INT_MIN,

    _SC_LONG_BIT,

    _SC_WORD_BIT,

    _SC_MB_LEN_MAX,

    _SC_NZERO,

    _SC_SSIZE_MAX,

    _SC_SCHAR_MAX,

    _SC_SCHAR_MIN,

    _SC_SHRT_MAX,

    _SC_SHRT_MIN,

    _SC_UCHAR_MAX,

    _SC_UINT_MAX,

    _SC_ULONG_MAX,

    _SC_USHRT_MAX,


    _SC_NL_ARGMAX,

    _SC_NL_LANGMAX,

    _SC_NL_MSGMAX,

    _SC_NL_NMAX,

    _SC_NL_SETMAX,

    _SC_NL_TEXTMAX,


    _SC_XBS5_ILP32_OFF32,

    _SC_XBS5_ILP32_OFFBIG,

    _SC_XBS5_LP64_OFF64,

    _SC_XBS5_LPBIG_OFFBIG,


    _SC_XOPEN_LEGACY,

    _SC_XOPEN_REALTIME,

    _SC_XOPEN_REALTIME_THREADS,


    _SC_ADVISORY_INFO,

    _SC_BARRIERS,

    _SC_BASE,

    _SC_C_LANG_SUPPORT,

    _SC_C_LANG_SUPPORT_R,

    _SC_CLOCK_SELECTION,

    _SC_CPUTIME,

    _SC_THREAD_CPUTIME,

    _SC_DEVICE_IO,

    _SC_DEVICE_SPECIFIC,

    _SC_DEVICE_SPECIFIC_R,

    _SC_FD_MGMT,

    _SC_FIFO,

    _SC_PIPE,

    _SC_FILE_ATTRIBUTES,

    _SC_FILE_LOCKING,

    _SC_FILE_SYSTEM,

    _SC_MONOTONIC_CLOCK,

    _SC_MULTI_PROCESS,

    _SC_SINGLE_PROCESS,

    _SC_NETWORKING,

    _SC_READER_WRITER_LOCKS,

    _SC_SPIN_LOCKS,

    _SC_REGEXP,

    _SC_REGEX_VERSION,

    _SC_SHELL,

    _SC_SIGNALS,

    _SC_SPAWN,

    _SC_SPORADIC_SERVER,

    _SC_THREAD_SPORADIC_SERVER,

    _SC_SYSTEM_DATABASE,

    _SC_SYSTEM_DATABASE_R,

    _SC_TIMEOUTS,

    _SC_TYPED_MEMORY_OBJECTS,

    _SC_USER_GROUPS,

    _SC_USER_GROUPS_R,

    _SC_2_PBS,

    _SC_2_PBS_ACCOUNTING,

    _SC_2_PBS_LOCATE,

    _SC_2_PBS_MESSAGE,

    _SC_2_PBS_TRACK,

    _SC_SYMLOOP_MAX,

    _SC_STREAMS,

    _SC_2_PBS_CHECKPOINT,


    _SC_V6_ILP32_OFF32,

    _SC_V6_ILP32_OFFBIG,

    _SC_V6_LP64_OFF64,

    _SC_V6_LPBIG_OFFBIG,


    _SC_HOST_NAME_MAX,

    _SC_TRACE,

    _SC_TRACE_EVENT_FILTER,

    _SC_TRACE_INHERIT,

    _SC_TRACE_LOG

  };





enum
  {
    _CS_PATH,
# 563 "/projects/or32-uclinux/include/bits/confname.h"
    _CS_V6_WIDTH_RESTRICTED_ENVS

  };
# 504 "/projects/or32-uclinux/include/unistd.h" 2


extern long int pathconf (__const char *__path, int __name) ;


extern long int fpathconf (int __fd, int __name) ;


extern long int sysconf (int __name) __attribute__ ((__const__));



extern size_t confstr (int __name, char *__buf, size_t __len) ;




extern __pid_t getpid (void) ;


extern __pid_t getppid (void) ;




extern __pid_t getpgrp (void) ;
# 539 "/projects/or32-uclinux/include/unistd.h"
extern __pid_t __getpgid (__pid_t __pid) ;
# 548 "/projects/or32-uclinux/include/unistd.h"
extern int setpgid (__pid_t __pid, __pid_t __pgid) ;
# 565 "/projects/or32-uclinux/include/unistd.h"
extern int setpgrp (void) ;
# 583 "/projects/or32-uclinux/include/unistd.h"
extern __pid_t setsid (void) ;







extern __uid_t getuid (void) ;


extern __uid_t geteuid (void) ;


extern __gid_t getgid (void) ;


extern __gid_t getegid (void) ;




extern int getgroups (int __size, __gid_t __list[]) ;
# 617 "/projects/or32-uclinux/include/unistd.h"
extern int setuid (__uid_t __uid) ;




extern int setreuid (__uid_t __ruid, __uid_t __euid) ;




extern int seteuid (__uid_t __uid) ;






extern int setgid (__gid_t __gid) ;




extern int setregid (__gid_t __rgid, __gid_t __egid) ;




extern int setegid (__gid_t __gid) ;






extern __pid_t fork (void) ;






extern __pid_t vfork (void) ;





extern char *ttyname (int __fd) ;



extern int ttyname_r (int __fd, char *__buf, size_t __buflen) ;



extern int isatty (int __fd) ;





extern int ttyslot (void) ;




extern int link (__const char *__from, __const char *__to) ;



extern int symlink (__const char *__from, __const char *__to) ;




extern int readlink (__const char *__restrict __path, char *__restrict __buf,
                     size_t __len) ;



extern int unlink (__const char *__name) ;


extern int rmdir (__const char *__path) ;



extern __pid_t tcgetpgrp (int __fd) ;


extern int tcsetpgrp (int __fd, __pid_t __pgrp_id) ;



extern char *getlogin (void) ;
# 721 "/projects/or32-uclinux/include/unistd.h"
extern int setlogin (__const char *__name) ;
# 730 "/projects/or32-uclinux/include/unistd.h"
# 1 "/projects/or32-uclinux/include/getopt.h" 1
# 47 "/projects/or32-uclinux/include/getopt.h"
extern char *optarg;
# 61 "/projects/or32-uclinux/include/getopt.h"
extern int optind;




extern int opterr;



extern int optopt;
# 145 "/projects/or32-uclinux/include/getopt.h"
extern int getopt (int __argc, char *const *__argv, const char *__shortopts);
# 731 "/projects/or32-uclinux/include/unistd.h" 2







extern int gethostname (char *__name, size_t __len) ;






extern int sethostname (__const char *__name, size_t __len) ;



extern int sethostid (long int __id) ;





extern int getdomainname (char *__name, size_t __len) ;
extern int setdomainname (__const char *__name, size_t __len) ;





extern int vhangup (void) ;


extern int revoke (__const char *__file) ;







extern int profil (unsigned short int *__sample_buffer, size_t __size,
                   size_t __offset, unsigned int __scale) ;





extern int acct (__const char *__name) ;



extern char *getusershell (void) ;
extern void endusershell (void) ;
extern void setusershell (void) ;





extern int daemon (int __nochdir, int __noclose) ;






extern int chroot (__const char *__path) ;



extern char *getpass (__const char *__prompt) ;





extern int fsync (int __fd) ;






extern long int gethostid (void) ;


extern void sync (void) ;




extern int getpagesize (void) __attribute__ ((__const__));




extern int truncate (__const char *__file, __off_t __length) ;
# 845 "/projects/or32-uclinux/include/unistd.h"
extern int ftruncate (int __fd, __off_t __length) ;
# 861 "/projects/or32-uclinux/include/unistd.h"
extern int getdtablesize (void) ;
# 870 "/projects/or32-uclinux/include/unistd.h"
extern int brk (void *__addr) ;





extern void *sbrk (intptr_t __delta) ;
# 891 "/projects/or32-uclinux/include/unistd.h"
extern long int syscall (long int __sysno, ...) ;
# 911 "/projects/or32-uclinux/include/unistd.h"
extern int lockf (int __fd, int __cmd, __off_t __len) ;
# 942 "/projects/or32-uclinux/include/unistd.h"
extern int fdatasync (int __fildes) ;
# 987 "/projects/or32-uclinux/include/unistd.h"
extern int pthread_atfork (void (*__prepare) (void),
                           void (*__parent) (void),
                           void (*__child) (void)) ;



# 28 "vgaplan4.h" 2
# 59 "vgaplan4.h"
typedef volatile unsigned char * FARADDR;
# 122 "vgaplan4.h"
FARADDR int10(int ax,int bx);




int ega_init(PSD psd);
void ega_drawpixel(PSD psd,unsigned int x,unsigned int y,
                        MWPIXELVAL c);
MWPIXELVAL ega_readpixel(PSD psd,unsigned int x,unsigned int y);
void ega_drawhorzline(PSD psd,unsigned int x1,unsigned int x2,
                        unsigned int y,MWPIXELVAL c);
void ega_drawvertline(PSD psd,unsigned int x,unsigned int y1,
                        unsigned int y2, MWPIXELVAL c);


void ega_blit(PSD dstpsd, MWCOORD dstx, MWCOORD dsty, MWCOORD w,
                        MWCOORD h,PSD srcpsd,MWCOORD srcx,MWCOORD srcy,long op);



void ega_hwinit(void);
void ega_hwterm(void);
# 24 "vgaplan4.c" 2
# 1 "fb.h" 1
# 9 "fb.h"
extern volatile int mwdrawing;







typedef unsigned char * ADDR8;
typedef unsigned short * ADDR16;
typedef unsigned long * ADDR32;
# 137 "fb.h"
extern int gr_mode;



void ioctl_getpalette(int start, int len, short *red, short *green,short *blue);
void ioctl_setpalette(int start, int len, short *red, short *green,short *blue);


void gen_fillrect(PSD psd,MWCOORD x1,MWCOORD y1,MWCOORD x2,MWCOORD y2,
                MWPIXELVAL c);
MWBOOL set_subdriver(PSD psd, PSUBDRIVER subdriver, MWBOOL init);
void get_subdriver(PSD psd, PSUBDRIVER subdriver);


PSUBDRIVER select_fb_subdriver(PSD psd);
# 25 "vgaplan4.c" 2
# 37 "vgaplan4.c"
static unsigned char mode_table[15 + 1] = {
  0x00, 0x18, 0x10, 0x08,
  0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00,
};


static unsigned char mask[8] = {
        0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01
};


static int
fbvga_setiopermissions(PSD psd)
{

        return ioperm(0x3c0, 0x20, 1);
}



int
ega_init(PSD psd)
{

        if(fbvga_setiopermissions(psd) == -1) {
                GdError("Can't set i/o permissions: %m\n");
                return 0;
        }
# 76 "vgaplan4.c"
        psd->SetIOPermissions = fbvga_setiopermissions;
# 89 "vgaplan4.c"
        psd->size = 0x10000;

        { outw (1|((0x0f)<<8), 0x3ce); };
        { outw (3|((0)<<8), 0x3ce); };
        { outw (5|((0)<<8), 0x3ce); };
        return 1;
}


void
ega_drawpixel(PSD psd,unsigned int x, unsigned int y, MWPIXELVAL c)
{
        ((void) ((x >= 0 && x < psd->xres) || (__assert ("x >= 0 && x < psd->xres", "vgaplan4.c", 101, __PRETTY_FUNCTION__), 0)));
        ((void) ((y >= 0 && y < psd->yres) || (__assert ("y >= 0 && y < psd->yres", "vgaplan4.c", 102, __PRETTY_FUNCTION__), 0)));
        ((void) ((c < psd->ncolors) || (__assert ("c < psd->ncolors", "vgaplan4.c", 103, __PRETTY_FUNCTION__), 0)));

        ++mwdrawing;
        { outw (3|((mode_table[gr_mode])<<8), 0x3ce); };
        { outw ((c)<<8, 0x3ce); };
        { outw (8|((mask[x&7])<<8), 0x3ce); };
        ((*(FARADDR)((FARADDR)((char *)psd->addr) + (x>>3) + y * (psd->linelen))) |= 1);
        --mwdrawing;
}


MWPIXELVAL
ega_readpixel(PSD psd,unsigned int x,unsigned int y)
{
        FARADDR src;
        int plane;
        MWPIXELVAL c = 0;

        ((void) ((x >= 0 && x < psd->xres) || (__assert ("x >= 0 && x < psd->xres", "vgaplan4.c", 121, __PRETTY_FUNCTION__), 0)));
        ((void) ((y >= 0 && y < psd->yres) || (__assert ("y >= 0 && y < psd->yres", "vgaplan4.c", 122, __PRETTY_FUNCTION__), 0)));

        ++mwdrawing;



        src = ((char *)psd->addr) + (x>>3) + y * (psd->linelen);

        for(plane=0; plane<4; ++plane) {
                { outw (4|((plane)<<8), 0x3ce); };
                if((*(FARADDR)(src)) & mask[x&7])
                        c |= 1 << plane;
        }
        --mwdrawing;
        return c;
}


void
ega_drawhorzline(PSD psd, unsigned int x1, unsigned int x2, unsigned int y,
        MWPIXELVAL c)
{
        FARADDR dst, last;

        ((void) ((x1 >= 0 && x1 < psd->xres) || (__assert ("x1 >= 0 && x1 < psd->xres", "vgaplan4.c", 146, __PRETTY_FUNCTION__), 0)));
        ((void) ((x2 >= 0 && x2 < psd->xres) || (__assert ("x2 >= 0 && x2 < psd->xres", "vgaplan4.c", 147, __PRETTY_FUNCTION__), 0)));
        ((void) ((x2 >= x1) || (__assert ("x2 >= x1", "vgaplan4.c", 148, __PRETTY_FUNCTION__), 0)));
        ((void) ((y >= 0 && y < psd->yres) || (__assert ("y >= 0 && y < psd->yres", "vgaplan4.c", 149, __PRETTY_FUNCTION__), 0)));
        ((void) ((c < psd->ncolors) || (__assert ("c < psd->ncolors", "vgaplan4.c", 150, __PRETTY_FUNCTION__), 0)));

        ++mwdrawing;
        { outw ((c)<<8, 0x3ce); };
        { outw (3|((mode_table[gr_mode])<<8), 0x3ce); };





        if(gr_mode == 0) {



                dst = ((char *)psd->addr) + (x1>>3) + y * (psd->linelen);

                if ((x1>>3) == (x2>>3)) {
                        { outw (8|(((0xff >> (x1 & 7)) & (0xff << (7 - (x2 & 7))))<<8), 0x3ce); };
                        ((*(FARADDR)(dst)) |= 1);
                } else {
                        { outw (8|((0xff >> (x1 & 7))<<8), 0x3ce); };
                        ((*(FARADDR)(dst++)) |= 1);

                        { outb (0xff, 0x3cf); };



                        last = ((char *)psd->addr) + (x2>>3) + y * (psd->linelen);

                        while (dst < last)
                                ((*(FARADDR)(dst++)) = (1));

                        { outb (0xff << (7 - (x2 & 7)), 0x3cf); };
                        ((*(FARADDR)(dst)) |= 1);
                }
        } else {

                { outb (8, 0x3ce); };
                while(x1 <= x2) {
                        { outb (mask[x1&7], 0x3cf); };
                        ((*(FARADDR)((FARADDR)((char *)psd->addr) + (x1++>>3) + y * (psd->linelen))) |= 1);
                }
        }
        --mwdrawing;
}


void
ega_drawvertline(PSD psd,unsigned int x, unsigned int y1, unsigned int y2,
        MWPIXELVAL c)
{
        FARADDR dst, last;

        ((void) ((x >= 0 && x < psd->xres) || (__assert ("x >= 0 && x < psd->xres", "vgaplan4.c", 203, __PRETTY_FUNCTION__), 0)));
        ((void) ((y1 >= 0 && y1 < psd->yres) || (__assert ("y1 >= 0 && y1 < psd->yres", "vgaplan4.c", 204, __PRETTY_FUNCTION__), 0)));
        ((void) ((y2 >= 0 && y2 < psd->yres) || (__assert ("y2 >= 0 && y2 < psd->yres", "vgaplan4.c", 205, __PRETTY_FUNCTION__), 0)));
        ((void) ((y2 >= y1) || (__assert ("y2 >= y1", "vgaplan4.c", 206, __PRETTY_FUNCTION__), 0)));
        ((void) ((c < psd->ncolors) || (__assert ("c < psd->ncolors", "vgaplan4.c", 207, __PRETTY_FUNCTION__), 0)));

        ++mwdrawing;
        { outw (3|((mode_table[gr_mode])<<8), 0x3ce); };
        { outw ((c)<<8, 0x3ce); };
        { outw (8|((mask[x&7])<<8), 0x3ce); };




        dst = ((char *)psd->addr) + (x>>3) + y1 * (psd->linelen);
        last = ((char *)psd->addr) + (x>>3) + y2 * (psd->linelen);

        while (dst <= last) {
                ((*(FARADDR)(dst)) |= 1);
                dst += (psd->linelen);
        }
        --mwdrawing;
}


SUBDRIVER vgaplan4 = {
        (void *)ega_init,
        (void *)ega_drawpixel,
        (void *)ega_readpixel,
        (void *)ega_drawhorzline,
        (void *)ega_drawvertline,
        (void *)gen_fillrect,
        (void *)ega_blit
};

Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

© copyright 1999-2025 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.