gonzui


Format: Advanced Search

tkernel_2/driver/tef_em1d/screen/src/screen.hbare sourcepermlink (0.01 seconds)

Search this content:

    1: /*
    2:  *----------------------------------------------------------------------
    3:  *    T-Kernel 2.0 Software Package
    4:  *
    5:  *    Copyright 2011 by Ken Sakamura.
    6:  *    This software is distributed under the latest version of T-License 2.x.
    7:  *----------------------------------------------------------------------
    8:  *
    9:  *    Released by T-Engine Forum(http://www.t-engine.org/) at 2011/05/17.
   10:  *    Modified by TRON Forum(http://www.tron.org/) at 2015/06/01.
   11:  *
   12:  *----------------------------------------------------------------------
   13:  */
   14: 
   15: /*
   16:         screen.h        screen driver : header file
   17:  *
   18:  */
   19: #include <tk/tkernel.h>
   20: #include <libstr.h>
   21: #include <device/screen.h>
   22: #include <device/sdrvif.h>
   23: #include <device/devconf.h>
   24: 
   25: #ifdef  DEBUG
   26: #define DP(exp)         printf exp
   27: #else
   28: #define DP(exp)         /* exp */
   29: #endif
   30: 
   31: /*
   32:         video-related information
   33: */
   34: #define L_OEMNAME       32
   35: #define L_CHIPINF       32
   36: typedef struct {
   37:         B      oemname[L_OEMNAME+1];        /* VESA BIOS OEM name (string) */
   38:         B      chipinf[L_CHIPINF+1];        /* chip information (string)        */
   39:         UH     vesaver;            /* VESA BIOS version              */
   40:         UB     reqmode;            /* request mode                        */
   41:         UB     curmode;            /* current mode                        */
   42:         UW     attr;                       /* video attribute                        */
   43:         UW     paneltype;          /* panel type (LCD)            */
   44:         UW     modemap;            /* mode map                        */
   45:         void   *framebuf_addr;           /* physical address of framebuffer       */
   46:         W      framebuf_total;              /* total size of framebuffer        */
   47:         W      framebuf_rowb;               /* row bytes of framebuffer       */
   48:         W      banksize;            /* bank size (when banks are used)        */
   49:         W      bankshift;           /* bank shift number (when banks are used)        */
   50: 
   51:         W      vfreq;                       /* vertical sync frequency              */
   52:         W      pciaddr;             /* PCI address                      */
   53:         UH     vendorid;           /* PCI vendor ID          */
   54:         UH     deviceid;           /* PCI device ID          */
   55:         UW     maxvfreq;           /* maximum vertical sync frequency            */
   56: 
   57:         W      width;                       /* screen width (pixel)            */
   58:         W      height;                      /* screen height (pixel)\           */
   59:         W      pixbits;             /* number of bits in a pixel              */
   60:         W      act_width;           /* screen width (pixel)            */
   61:         W      act_height;          /* screen height (pixel)\           */
   62: 
   63:         void   *f_addr;          /* real VRAM logical address                */
   64:         void   *v_addr;          /* virtual VRAM logical address       */
   65:         void   *baseaddr;                /* effective VRAM logical address       */
   66:         W      rowbytes;            /* row bytes of effective VRAM                */
   67:         W      vramsz;                      /* effective VRAM size          */
   68:         W      vramrng;             /* VRAM protection level            */
   69: 
   70:         W      cmapent;             /* number of entries in color map  */
   71:         COLOR  *cmap;                    /* color map                        */
   72: 
   73:         W      pixbyte;             /* number of bytes per one pixel     */
   74: 
   75:         W      rotate;                      /* whether screen is rotated                        */
   76:         W      fb_width;            /* framebuffer width (pixel)      */
   77:         W      fb_height;           /* framebuffer height (pixel) */
   78: 
   79:         /* video board- / chip- dependent processing functions */
   80: 
   81:         /* mode setup processing */
   82:         void   (*fn_setmode)(W flg);
   83: 
   84:         /* color map setup processing */
   85:         void   (*fn_setcmap)(COLOR *cmap, W ix, W nent);
   86: 
   87:         /* VRAM bank switch processing */
   88:         void   (*fn_banksw)(W bankno);
   89:         /* screen update processing */
   90:         void   (*fn_updscr)(W x, W y, W dx, W dy);
   91: 
   92:         /* set / get screen brightness */
   93:         ER     (*fn_bright)(W *brightness, BOOL set);
   94: 
   95:         /* screen write processing */
   96:         ER     (*fn_write)(W kind, void *buf, W size);
   97: 
   98:         /* suspend / resume processing (TRUE=suspend, FALSE=resume) */
   99:         void   (*fn_susres)(BOOL suspend);
  100: 
  101:         /* pointer to extended work area */
  102:         void   *extwrk;
  103: } VideoInf;
  104: 
  105: /*
  106:         video attribute  (attr)
  107: */
  108: #define BPP_24                  0x20   /* 24 bpp mode            */
  109: #define DACBITS_8               0x40 /* DAC is 8 bits          */
  110: #define LINEAR_FRAMEBUF         0x80   /* Linear Frame Buffer is effective        */
  111: 
  112: #define SUPPORT_VFREQ           0x0200   /* VFREQ is supported          */
  113: #define USE_VVRAM               0x1000       /* use virtual VRAM forcibly                */
  114: #define NEED_FINPROC            0x10000   /* termination processing is necessary              */
  115: #define NEED_SUSRESPROC         0x20000        /* suspend/resume processing is necessary  */
  116: 
  117: /*
  118:         vertical sync frequency (refresh rate) (Hz)
  119: */
  120: #define MIN_VFREQ       40            /* minimum */
  121: #define MAX_VFREQ       100           /* maximum */
  122: 
  123: /*
  124:         judge whether user process can access real VRAM access or not
  125:                 * this is valid only when virtual VRAM is not used
  126: */
  127: #define allowUserVRAM   (Vinf.vramrng == 3 && !(Vinf.attr & USE_VVRAM))
  128: 
  129: /*
  130:         current video information
  131: */
  132: IMPORT  VideoInf Vinf;
  133: 
  134: /*
  135:         external functions
  136: */
  137: /* common.c */
  138: IMPORT  ER       getMemory(W size, void **ptr);
  139: IMPORT  void*    getPhyMemory(W size, void **phyaddr);
  140: IMPORT  ER       mapFrameBuf(void *paddr, W len, void **laddr);
  141: IMPORT  ER       initSCREEN(void);
  142: IMPORT  ER       finishSCREEN(void);
  143: IMPORT  ER       suspendSCREEN(void);
  144: IMPORT  ER       resumeSCREEN(void);
  145: IMPORT  ER       getSCRXSPEC(DEV_SPEC *spec, W mode);
  146: IMPORT  ER       getSCRSPEC(DEV_SPEC *spec);
  147: IMPORT  W        setModeStr(W mode, TC *str, W pos, W x, W y, W bpp, TC *desc);
  148: IMPORT  INT      getSCRLIST(TC *str);
  149: IMPORT  ER       getsetSCRNO(W *scnum, BOOL suspend, BOOL set);
  150: IMPORT  INT      getsetSCRCOLOR(COLOR *cmap, BOOL set);
  151: IMPORT  ER       getSCRBMP(BMP *bmp);
  152: IMPORT  ER       getsetSCRBRIGHT(W *brightness, BOOL set);
  153: IMPORT  ER       getSCRUPDFN(FP *updfn);
  154: IMPORT  ER       getsetSCRVFREQ(W *vfreq, BOOL set);
  155: IMPORT  ER       getsetSCRADJUST(ScrAdjust *adj, BOOL set);
  156: IMPORT  ER       getSCRDEVINFO(ScrDevInfo *inf);
  157: IMPORT  ER       setSCRUPDRECT(RECT *rp);
  158: IMPORT  ER       setSCRWRITE(W kind, void *buf, W size);
  159: 
  160: /* (controller dependent) */
  161: IMPORT  W        getSpecSCRXSPEC(DEV_SPEC *spec, W mode);
  162: IMPORT  W        getSpecSCRLIST(TC *str, W pos);
  163: 
  164: /* Get "DEVCONF" entry */
  165: IMPORT  W        GetDevConf(UB *name, W *val);