Logo
  • Main Page
  • Related Pages
  • Modules
  • Classes
  • Files

mmsfbdevmatrox.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2005-2007 Stefan Schwarzer, Jens Schneider,             *
00003  *                           Matthias Hardt, Guido Madaus                  *
00004  *                                                                         *
00005  *   Copyright (C) 2007-2008 BerLinux Solutions GbR                        *
00006  *                           Stefan Schwarzer & Guido Madaus               *
00007  *                                                                         *
00008  *   Copyright (C) 2009-2013 BerLinux Solutions GmbH                       *
00009  *                                                                         *
00010  *   Authors:                                                              *
00011  *      Stefan Schwarzer   <stefan.schwarzer@diskohq.org>,                 *
00012  *      Matthias Hardt     <matthias.hardt@diskohq.org>,                   *
00013  *      Jens Schneider     <jens.schneider@diskohq.org>,                   *
00014  *      Guido Madaus       <guido.madaus@diskohq.org>,                     *
00015  *      Patrick Helterhoff <patrick.helterhoff@diskohq.org>,               *
00016  *      René Bählkow       <rene.baehlkow@diskohq.org>                     *
00017  *                                                                         *
00018  *   This library is free software; you can redistribute it and/or         *
00019  *   modify it under the terms of the GNU Lesser General Public            *
00020  *   License version 2.1 as published by the Free Software Foundation.     *
00021  *                                                                         *
00022  *   This library is distributed in the hope that it will be useful,       *
00023  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00024  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
00025  *   Lesser General Public License for more details.                       *
00026  *                                                                         *
00027  *   You should have received a copy of the GNU Lesser General Public      *
00028  *   License along with this library; if not, write to the                 *
00029  *   Free Software Foundation, Inc.,                                       *
00030  *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA            *
00031  **************************************************************************/
00032 
00033 #ifdef __HAVE_FBDEV__
00034 
00035 #include "mmsgui/fb/mmsfbdevmatrox.h"
00036 #include <sys/ioctl.h>
00037 #include <cstring>
00038 
00039 #define INITCHECK  if(!this->isinitialized){MMSFB_SetError(0,"MMSFBDevMatrox is not initialized");return false;}
00040 
00041 MMSFBDevMatrox::MMSFBDevMatrox() {
00042     this->scart_rgb_cable = false;
00043     this->tv_std_pal = true;
00044     this->mmio_base = NULL;
00045 }
00046 
00047 MMSFBDevMatrox::~MMSFBDevMatrox() {
00048     closeDevice();
00049 }
00050 
00051 bool MMSFBDevMatrox::openDevice(char *device_file, int console) {
00052     // open frame buffer
00053     if (!MMSFBDev::openDevice(device_file, console))
00054         return false;
00055 
00056     // check fb accel
00057     switch (this->fix_screeninfo.accel) {
00058         case FB_ACCEL_MATROX_MGAG400:
00059             // okay
00060             break;
00061         default:
00062             // not supported
00063             printf("MMSFBDevMatrox: unsupported accelerator %d (%.16s)\n", this->fix_screeninfo.accel, this->fix_screeninfo.id);
00064             closeDevice();
00065             return false;
00066     }
00067 
00068     // map mmio
00069     if (!mapMmio(&this->mmio_base)) {
00070         closeDevice();
00071         return false;
00072     }
00073 
00074     return true;
00075 }
00076 
00077 void MMSFBDevMatrox::closeDevice() {
00078     if (this->mmio_base)
00079         unmapMmio(this->mmio_base);
00080 
00081     // close frame buffer
00082     MMSFBDev::closeDevice();
00083 }
00084 
00085 bool MMSFBDevMatrox::waitForVSync() {
00086     // is initialized?
00087     INITCHECK;
00088 
00089     switch (this->active_screen) {
00090     case 0:
00091         // default fbdev primary screen 0
00092         return MMSFBDev::waitForVSync();
00093     case 1: {
00094         // TVOut screen
00095         volatile unsigned char *mmio = this->mmio_base;
00096         int vdisplay = ((!this->tv_std_pal) ? 480/2 : 576/2) + 1;
00097 
00098 #ifdef FBIO_WAITFORVSYNC
00099         static const int s = 1;
00100         if (ioctl(this->fd, FBIO_WAITFORVSYNC, &s)) {
00101             while ((int)(mga_in32(mmio, C2VCOUNT) & 0x00000fff) != vdisplay);
00102         }
00103 #else
00104         while ((int)(mga_in32(mmio, C2VCOUNT) & 0x00000fff) != vdisplay);
00105 #endif
00106         }
00107         return true;
00108     default:
00109         printf("MMSFBDevMatrox: screen %d is not supported\n", this->active_screen);
00110         break;
00111     }
00112 
00113     return false;
00114 }
00115 
00116 bool MMSFBDevMatrox::testLayer(int layer_id) {
00117     // is initialized?
00118     INITCHECK;
00119 
00120     switch (layer_id) {
00121     case 0:
00122         // default fbdev primary layer 0 on primary screen 0
00123         return MMSFBDev::testLayer(layer_id);
00124     case 2:
00125         // TVOut layer
00126         return true;
00127     default:
00128         printf("MMSFBDevMatrox: layer %d is not supported\n", layer_id);
00129         break;
00130     }
00131 
00132     return false;
00133 }
00134 
00135 
00136 bool MMSFBDevMatrox::initLayer(int layer_id, int width, int height, MMSFBSurfacePixelFormat pixelformat, int backbuffer) {
00137     // is initialized?
00138     INITCHECK;
00139 
00140     switch (layer_id) {
00141     case 0:
00142         // default fbdev primary layer 0 on primary screen 0
00143         return MMSFBDev::initLayer(layer_id, width, height, pixelformat, backbuffer);
00144     case 2:
00145         // TVOut layer
00146         // check input
00147         if (width != 720) {
00148             printf("MMSFBDevMatrox: TVOut needs layer width 720, but %d given\n", width);
00149             return false;
00150         }
00151         if ((height != 576)&&(height != 480)) {
00152             printf("MMSFBDevMatrox: TVOut needs layer height 576 (PAL) or 480 (NTSC), but %d given\n", height);
00153             return false;
00154         }
00155         if ((pixelformat != MMSFB_PF_I420)&&(pixelformat != MMSFB_PF_YV12)) {
00156             printf("MMSFBDevMatrox: TVOut needs pixelformat I420 or YV12, but %s given\n", getMMSFBPixelFormatString(pixelformat).c_str());
00157             return false;
00158         }
00159         if (backbuffer) {
00160             printf("MMSFBDevMatrox: TVOut layer does not support a backbuffer\n");
00161             return false;
00162         }
00163 
00164         // set values
00165         this->layers[layer_id].width = width;
00166         this->layers[layer_id].height = height;
00167         this->layers[layer_id].pixelformat = pixelformat;
00168 
00169         // save buffers
00170         memset(&this->layers[layer_id].buffers, 0, sizeof(this->layers[layer_id].buffers));
00171         this->layers[layer_id].buffers[0].ptr = this->framebuffer_base;
00172         if (width % 128)
00173             this->layers[layer_id].buffers[0].pitch = ((width / 128) + 1) * 128;
00174         else
00175             this->layers[layer_id].buffers[0].pitch = width;
00176         this->layers[layer_id].buffers[0].ptr2 = (char*)this->layers[layer_id].buffers[0].ptr + this->layers[layer_id].height * this->layers[layer_id].buffers[0].pitch;
00177         this->layers[layer_id].buffers[0].ptr3 = (char*)this->layers[layer_id].buffers[0].ptr2 + (this->layers[layer_id].height * this->layers[layer_id].buffers[0].pitch) / 2;
00178         this->layers[layer_id].buffers[0].pitch2 = this->layers[layer_id].buffers[0].pitch / 2;
00179         this->layers[layer_id].buffers[0].pitch3 = this->layers[layer_id].buffers[0].pitch2;
00180         this->layers[layer_id].buffers[0].hwbuffer = true;
00181 
00182         // pal or ntsc?
00183         this->tv_std_pal = (this->layers[layer_id].height == 576);
00184 
00185         // switch to layer
00186         buildCRTC2Regs();
00187         buildCRTC2Buffer();
00188         enableCRTC2();
00189 
00190         // layer is initialized
00191         this->layers[layer_id].isinitialized = true;
00192 
00193         // this layer is on screen 1
00194         this->active_screen = 1;
00195 
00196         printf("MMSFBDevMatrox: TVOut layer %d initialized with %dx%d (%s), pixelformat %s\n",
00197                 layer_id, width, height, (this->tv_std_pal)?"PAL":"NTSC", getMMSFBPixelFormatString(pixelformat).c_str());
00198 
00199         return true;
00200     default:
00201         printf("MMSFBDevMatrox: layer %d is not supported\n", layer_id);
00202         break;
00203     }
00204 
00205     return false;
00206 }
00207 
00208 
00209 bool MMSFBDevMatrox::releaseLayer(int layer_id) {
00210     // is initialized?
00211     INITCHECK;
00212 
00213     switch (layer_id) {
00214     case 0:
00215         // default fbdev primary layer 0 on primary screen 0
00216         printf("MMSFBDevMatrox: layer %d cannot be released\n", layer_id);
00217         return false;
00218     case 2:
00219         // TVOut layer
00220         printf("MMSFBDevMatrox: layer %d cannot be released\n", layer_id);
00221         return false;
00222     default:
00223         printf("MMSFBDevMatrox: layer %d is not supported\n", layer_id);
00224         break;
00225     }
00226 
00227     return false;
00228 }
00229 
00230 bool MMSFBDevMatrox::restoreLayer(int layer_id) {
00231     // is initialized?
00232     INITCHECK;
00233 
00234     switch (layer_id) {
00235     case 0:
00236         // default fbdev primary layer 0 on primary screen 0
00237         printf("MMSFBDevMatrox: layer %d cannot be restored\n", layer_id);
00238         return false;
00239     case 2:
00240         // TVOut layer
00241         printf("MMSFBDevMatrox: layer %d cannot be restored\n", layer_id);
00242         return false;
00243     default:
00244         printf("MMSFBDevMatrox: layer %d is not supported\n", layer_id);
00245         break;
00246     }
00247 
00248     return false;
00249 }
00250 
00251 
00252 void MMSFBDevMatrox::buildCRTC2Regs() {
00253 
00254     // init g450/g550, but we do not support g400!
00255     this->crtc2_regs.c2ctrl = C2CTRL_C2PIXCLKSEL_CRISTAL;
00256 
00257     // we reset this register, so we clear also the bits of the sub-picture layer
00258     // we do not plan to use the sub-picture layer because of it's improper pixelformat
00259     this->crtc2_regs.c2datactrl = 0;
00260 
00261     // pal or ntsc?
00262     if (!this->tv_std_pal)
00263         this->crtc2_regs.c2datactrl |= C2DATACTRL_C2NTSCEN;
00264 
00265     // we do only support pixelformat MMSFB_PF_I420 or MMSFB_PF_YV12
00266     this->crtc2_regs.c2ctrl |= C2CTRL_C2DEPTH_YCBCR420;
00267 
00268     // set offset for interlaced but not separated mode
00269     this->crtc2_regs.c2offset = this->layers[2].buffers[0].pitch * 2;
00270 
00271     // set sync values dependent on tv standard pal/ntsc
00272     int hdisplay, htotal, vdisplay, vtotal;
00273     if (!this->tv_std_pal) {
00274         // ntsc
00275         hdisplay = 720;
00276         htotal = 858;
00277         vdisplay = 480 / 2;
00278         vtotal = 525 / 2;
00279     } else {
00280         // pal
00281         hdisplay = 720;
00282         htotal = 864;
00283         vdisplay = 576 / 2;
00284         vtotal = 625 / 2;
00285     }
00286     this->crtc2_regs.c2hparam = ((hdisplay - 8) << 16) | (htotal - 8);
00287     this->crtc2_regs.c2vparam = ((vdisplay - 1) << 16) | (vtotal - 1);
00288     this->crtc2_regs.c2misc = 0;
00289     this->crtc2_regs.c2misc |= (vdisplay + 1) << 16;
00290 }
00291 
00292 void MMSFBDevMatrox::setCRTC2Regs() {
00293     volatile unsigned char *mmio = this->mmio_base;
00294 
00295     mga_out32(mmio, this->crtc2_regs.c2ctrl,        C2CTRL);
00296     mga_out32(mmio, this->crtc2_regs.c2datactrl,    C2DATACTRL);
00297     mga_out32(mmio, this->crtc2_regs.c2hparam,      C2HPARAM);
00298     mga_out32(mmio, 0,                          C2HSYNC);
00299     mga_out32(mmio, this->crtc2_regs.c2vparam,      C2VPARAM);
00300     mga_out32(mmio, 0,                          C2VSYNC);
00301     mga_out32(mmio, this->crtc2_regs.c2offset,      C2OFFSET);
00302     mga_out32(mmio, this->crtc2_regs.c2misc,        C2MISC);
00303     mga_out32(mmio, 0,                          C2PRELOAD);
00304 }
00305 
00306 void MMSFBDevMatrox::buildCRTC2Buffer() {
00307     // working in interlaced mode, so have to work with an field offset
00308     unsigned int field_offset = this->layers[2].buffers[0].pitch;
00309 
00310     // Y plane
00311     this->crtc2_regs.c2_plane1_start1 = this->fix_screeninfo.smem_start;
00312     this->crtc2_regs.c2_plane1_start0 = this->crtc2_regs.c2_plane1_start1 + field_offset;
00313 
00314     // interlaced, half field offset for U/Y planes
00315     field_offset /= 2;
00316 
00317     switch (this->layers[2].pixelformat) {
00318     case MMSFB_PF_I420:
00319         // U plane
00320         this->crtc2_regs.c2_plane2_start1 = this->crtc2_regs.c2_plane1_start1 + this->layers[2].height * this->layers[2].buffers[0].pitch;
00321         this->crtc2_regs.c2_plane2_start0 = this->crtc2_regs.c2_plane2_start1 + field_offset;
00322         // V plane
00323         this->crtc2_regs.c2_plane3_start1 = this->crtc2_regs.c2_plane2_start1 + (this->layers[2].height * this->layers[2].buffers[0].pitch) / 2;
00324         this->crtc2_regs.c2_plane3_start0 = this->crtc2_regs.c2_plane3_start1 + field_offset;
00325         break;
00326     case MMSFB_PF_YV12:
00327         // V plane
00328         this->crtc2_regs.c2_plane3_start1 = this->crtc2_regs.c2_plane1_start1 + this->layers[2].height * this->layers[2].buffers[0].pitch;
00329         this->crtc2_regs.c2_plane3_start0 = this->crtc2_regs.c2_plane3_start1 + field_offset;
00330         // U plane
00331         this->crtc2_regs.c2_plane2_start1 = this->crtc2_regs.c2_plane3_start1 + (this->layers[2].height * this->layers[2].buffers[0].pitch) / 2;
00332         this->crtc2_regs.c2_plane2_start0 = this->crtc2_regs.c2_plane2_start1 + field_offset;
00333         break;
00334     default:
00335         break;
00336     }
00337 }
00338 
00339 
00340 void MMSFBDevMatrox::setCRTC2Buffer() {
00341     volatile unsigned char *mmio = this->mmio_base;
00342 
00343     mga_out32(mmio, this->crtc2_regs.c2_plane1_start0, C2PLANE1START0);
00344     mga_out32(mmio, this->crtc2_regs.c2_plane1_start1, C2PLANE1START1);
00345     mga_out32(mmio, this->crtc2_regs.c2_plane2_start0, C2PLANE2START0);
00346     mga_out32(mmio, this->crtc2_regs.c2_plane2_start1, C2PLANE2START1);
00347     mga_out32(mmio, this->crtc2_regs.c2_plane3_start0, C2PLANE3START0);
00348     mga_out32(mmio, this->crtc2_regs.c2_plane3_start1, C2PLANE3START1);
00349 }
00350 
00351 
00352 void MMSFBDevMatrox::switchCRTC2(bool on) {
00353     volatile unsigned char *mmio = this->mmio_base;
00354 
00355     if (on)
00356         this->crtc2_regs.c2ctrl |= C2CTRL_C2EN;
00357     else
00358         this->crtc2_regs.c2ctrl &= ~C2CTRL_C2EN;
00359     mga_out32(mmio, this->crtc2_regs.c2ctrl, C2CTRL);
00360 
00361     if (on)
00362         this->crtc2_regs.c2ctrl &= ~C2CTRL_C2PIXCLKDIS;
00363     else
00364         this->crtc2_regs.c2ctrl |= C2CTRL_C2PIXCLKDIS;
00365     mga_out32(mmio, this->crtc2_regs.c2ctrl, C2CTRL);
00366 
00367     if (!on) {
00368         this->crtc2_regs.c2ctrl &= ~C2CTRL_C2INTERLACE;
00369         mga_out32(mmio, this->crtc2_regs.c2ctrl, C2CTRL);
00370     }
00371 }
00372 
00373 
00374 bool MMSFBDevMatrox::enableCRTC2() {
00375     volatile unsigned char *mmio = this->mmio_base;
00376     unsigned char val;
00377 
00378     val = mga_in_dac(mmio, XGENIOCTRL);
00379     val |= 0x40;
00380     mga_out_dac(mmio, val, XGENIOCTRL);
00381     val = mga_in_dac(mmio, XGENIODATA);
00382     val &= ~0x40;
00383     mga_out_dac(mmio, val, XGENIODATA);
00384 
00385     val = mga_in_dac(mmio, XPWRCTRL);
00386     val |= XPWRCTRL_DAC2PDN | XPWRCTRL_CFIFOPDN;
00387     mga_out_dac(mmio, val, XPWRCTRL);
00388 
00389     val = mga_in_dac(mmio, XDISPCTRL);
00390     val &= ~XDISPCTRL_DAC2OUTSEL_MASK;
00391     val |= XDISPCTRL_DAC2OUTSEL_TVE;
00392     mga_out_dac(mmio, val, XDISPCTRL);
00393 
00394     if (this->scart_rgb_cable) {
00395         val = mga_in_dac(mmio, XSYNCCTRL);
00396         val &= ~(XSYNCCTRL_DAC2HSOFF | XSYNCCTRL_DAC2VSOFF | XSYNCCTRL_DAC2HSPOL | XSYNCCTRL_DAC2VSPOL);
00397         mga_out_dac(mmio, val, XSYNCCTRL);
00398     }
00399 
00400     disableMaven();
00401 
00402     switchCRTC2(false);
00403 
00404     setCRTC2Regs();
00405 
00406     setCRTC2Buffer();
00407 
00408     switchCRTC2(true);
00409 
00410     setMavenRegs();
00411 
00412     this->crtc2_regs.c2ctrl |= C2CTRL_C2INTERLACE;
00413     this->crtc2_regs.c2ctrl |= 0x1000;
00414     while ((mga_in32(mmio, C2VCOUNT) & 0x00000fff) != 1);
00415     while ((mga_in32(mmio, C2VCOUNT) & 0x00000fff) != 0);
00416     mga_out32(mmio, this->crtc2_regs.c2ctrl, C2CTRL);
00417 
00418     enableMaven();
00419 
00420     return true;
00421 }
00422 
00423 bool MMSFBDevMatrox::disableCRTC2() {
00424     volatile unsigned char *mmio = this->mmio_base;
00425     unsigned char val;
00426 
00427     disableMaven();
00428     switchCRTC2(false);
00429 
00430     val = mga_in_dac(mmio, XGENIOCTRL);
00431     val &= ~0x40;
00432     mga_out_dac(mmio, val, XGENIOCTRL);
00433     val = mga_in_dac(mmio, XGENIODATA);
00434     val &= ~0x40;
00435     mga_out_dac(mmio, val, XGENIODATA);
00436 
00437     val = mga_in_dac(mmio, XPWRCTRL);
00438     val &= ~(XPWRCTRL_DAC2PDN | XPWRCTRL_CFIFOPDN);
00439     mga_out_dac(mmio, val, XPWRCTRL);
00440 
00441     val = mga_in_dac(mmio, XDISPCTRL);
00442     val &= ~XDISPCTRL_DAC2OUTSEL_MASK;
00443     val |= XDISPCTRL_DAC2OUTSEL_DIS;
00444     mga_out_dac(mmio, val, XDISPCTRL);
00445 
00446     return true;
00447 }
00448 
00449 
00450 void MMSFBDevMatrox::setMavenRegs() {
00451     volatile unsigned char *mmio = this->mmio_base;
00452 
00453     if (this->tv_std_pal) {
00454         // pal
00455         maven_out8(mmio, 0x2a, 0x00);
00456         maven_out8(mmio, 0x09, 0x01);
00457         maven_out8(mmio, 0x8a, 0x02);
00458         maven_out8(mmio, 0xcb, 0x03);
00459         maven_out8(mmio, 0x00, 0x04);
00460         maven_out8(mmio, 0x18, 0x2c);
00461         maven_out8(mmio, 0x7e, 0x08);
00462         maven_out8(mmio, 0x8a, 0x0a);
00463         maven_out8(mmio, 0x3a, 0x09);
00464         maven_out8(mmio, 0x1a, 0x29);
00465         maven_out8(mmio, 0xb4, 0x31);
00466         maven_out8(mmio, 0x00, 0x32);
00467         maven_out8(mmio, 0x9c, 0x17);
00468         maven_out8(mmio, 0x01, 0x18);
00469         maven_out8(mmio, 0x38, 0x0b);
00470         maven_out8(mmio, 0x28, 0x0c);
00471         maven_out8(mmio, 0x00, 0x35);
00472         maven_out8(mmio, 0x46, 0x10);
00473         maven_out8(mmio, 0x01, 0x11);
00474         maven_out8(mmio, 0x46, 0x0e);
00475         maven_out8(mmio, 0x01, 0x0f);
00476         maven_out8(mmio, 0xea, 0x1e);
00477         maven_out8(mmio, 0x00, 0x1f);
00478         maven_out8(mmio, 0xbb, 0x20);
00479         maven_out8(mmio, 0xbb, 0x22);
00480         maven_out8(mmio, 0x00, 0x25);
00481         maven_out8(mmio, 0x49, 0x34);
00482         maven_out8(mmio, 0x16, 0x33);
00483         maven_out8(mmio, 0x00, 0x19);
00484         maven_out8(mmio, 0x1a, 0x12);
00485         maven_out8(mmio, 0x22, 0x3b);
00486         maven_out8(mmio, 0x2a, 0x13);
00487         maven_out8(mmio, 0x22, 0x39);
00488         maven_out8(mmio, 0x05, 0x1d);
00489         maven_out8(mmio, 0x02, 0x3a);
00490         maven_out8(mmio, 0x00, 0x24);
00491         maven_out8(mmio, 0x1c, 0x14);
00492         maven_out8(mmio, 0x3d, 0x15);
00493         maven_out8(mmio, 0x14, 0x16);
00494         maven_out8(mmio, 0x07, 0x2d);
00495         maven_out8(mmio, 0x7e, 0x2e);
00496         maven_out8(mmio, 0x02, 0x2f);
00497         maven_out8(mmio, 0x54, 0x30);
00498         maven_out8(mmio, 0xfe, 0x1a);
00499         maven_out8(mmio, 0x7e, 0x1b);
00500         maven_out8(mmio, 0x60, 0x1c);
00501         maven_out8(mmio, 0x00, 0x23);
00502         maven_out8(mmio, 0x08, 0x26);
00503         maven_out8(mmio, 0x00, 0x28);
00504         maven_out8(mmio, 0x04, 0x27);
00505         maven_out8(mmio, 0x07, 0x21);
00506         maven_out8(mmio, 0x55, 0x2a);
00507         maven_out8(mmio, 0x01, 0x2b);
00508         maven_out8(mmio, 0x00, 0x35);
00509         maven_out8(mmio, 0x46, 0x3c);
00510         maven_out8(mmio, 0x00, 0x3d);
00511         maven_out8(mmio, 0xb9, 0x37);
00512         maven_out8(mmio, 0xdd, 0x38);
00513 
00514         maven_out8(mmio, 0x17, 0x82);
00515         maven_out8(mmio, 0x00, 0x83);
00516         maven_out8(mmio, 0x01, 0x84);
00517         maven_out8(mmio, 0x00, 0x85);
00518     }
00519     else {
00520         // ntsc
00521         maven_out8(mmio, 0x21, 0x00);
00522         maven_out8(mmio, 0xf0, 0x01);
00523         maven_out8(mmio, 0x7c, 0x02);
00524         maven_out8(mmio, 0x1f, 0x03);
00525         maven_out8(mmio, 0x00, 0x04);
00526         maven_out8(mmio, 0x20, 0x2c);
00527         maven_out8(mmio, 0x7e, 0x08);
00528         maven_out8(mmio, 0x76, 0x0a);
00529         maven_out8(mmio, 0x44, 0x09);
00530         maven_out8(mmio, 0x11, 0x29);
00531         maven_out8(mmio, 0xb4, 0x31);
00532         maven_out8(mmio, 0x00, 0x32);
00533         maven_out8(mmio, 0x83, 0x17);
00534         maven_out8(mmio, 0x01, 0x18);
00535         maven_out8(mmio, 0x49, 0x0b);
00536         maven_out8(mmio, 0x00, 0x0c);
00537         maven_out8(mmio, 0x00, 0x35);
00538         maven_out8(mmio, 0x42, 0x10);
00539         maven_out8(mmio, 0x03, 0x11);
00540         maven_out8(mmio, 0x4e, 0x0e);
00541         maven_out8(mmio, 0x03, 0x0f);
00542         maven_out8(mmio, 0xea, 0x1e);
00543         maven_out8(mmio, 0x00, 0x1f);
00544         maven_out8(mmio, 0xae, 0x20);
00545         maven_out8(mmio, 0xae, 0x22);
00546         maven_out8(mmio, 0x00, 0x25);
00547         maven_out8(mmio, 0x02, 0x34);
00548         maven_out8(mmio, 0x14, 0x33);
00549         maven_out8(mmio, 0x00, 0x19);
00550         maven_out8(mmio, 0x17, 0x12);
00551         maven_out8(mmio, 0x15, 0x3b);
00552         maven_out8(mmio, 0x21, 0x13);
00553         maven_out8(mmio, 0x15, 0x39);
00554         maven_out8(mmio, 0x05, 0x1d);
00555         maven_out8(mmio, 0x05, 0x3a);
00556         maven_out8(mmio, 0x02, 0x24);
00557         maven_out8(mmio, 0x1b, 0x14);
00558         maven_out8(mmio, 0x1b, 0x15);
00559         maven_out8(mmio, 0x24, 0x16);
00560         maven_out8(mmio, 0x0f, 0x2d);
00561         maven_out8(mmio, 0x78, 0x2e);
00562         maven_out8(mmio, 0x00, 0x2f);
00563         maven_out8(mmio, 0x00, 0x30);
00564         maven_out8(mmio, 0x0f, 0x1a);
00565         maven_out8(mmio, 0x0f, 0x1b);
00566         maven_out8(mmio, 0x60, 0x1c);
00567         maven_out8(mmio, 0x01, 0x23);
00568         maven_out8(mmio, 0x0a, 0x26);
00569         maven_out8(mmio, 0x00, 0x28);
00570         maven_out8(mmio, 0x05, 0x27);
00571         maven_out8(mmio, 0x04, 0x21);
00572         maven_out8(mmio, 0xff, 0x2a);
00573         maven_out8(mmio, 0x03, 0x2b);
00574         maven_out8(mmio, 0x00, 0x35);
00575         maven_out8(mmio, 0x42, 0x3c);
00576         maven_out8(mmio, 0x03, 0x3d);
00577         maven_out8(mmio, 0xbd, 0x37);
00578         maven_out8(mmio, 0xda, 0x38);
00579 
00580         maven_out8(mmio, 0x14, 0x82);
00581         maven_out8(mmio, 0x00, 0x83);
00582         maven_out8(mmio, 0x01, 0x84);
00583         maven_out8(mmio, 0x00, 0x85);
00584     }
00585 }
00586 
00587 
00588 void MMSFBDevMatrox::enableMaven() {
00589     volatile unsigned char *mmio = this->mmio_base;
00590 
00591     if (this->scart_rgb_cable) {
00592         // SCART RGB
00593         maven_out8(mmio, (this->tv_std_pal) ? 0x41 : 0x43, 0x80);
00594     }
00595     else {
00596         // Composite / S-Video
00597         maven_out8(mmio, (this->tv_std_pal) ? 0x01 : 0x03, 0x80);
00598     }
00599 
00600     maven_out8(mmio, 0x00, 0x3e);
00601 }
00602 
00603 
00604 void MMSFBDevMatrox::disableMaven() {
00605     volatile unsigned char *mmio = this->mmio_base;
00606 
00607     maven_out8(mmio, 0x01, 0x3e);
00608     maven_out8(mmio, 0x00, 0x80);
00609 }
00610 
00611 #endif

Generated by doxygen