⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 vt1622a.cc

📁 Linux下比较早的基于命令行的DVD播放器
💻 CC
字号:
//// Copyright (c) 2004 by Istv醤 V醨adi//// This file is part of dxr3Player, a DVD player written specifically // for the DXR3 (aka Hollywood+) decoder card, but now handles other// hardware as well. These files contain a (mostly) user-space driver // for the Unichrome board found on Via's EPIA motherboards.//// The information for implementing this driver has been gathered// from the following sources://// - The DirectFB Unichrome driver//   Copyright (c) 2003 Andreas Robinson, All rights reserved.//// - Andreas Robinson's MPEG-2 decoder for the Unichrome board.//   Copyright (c) 2003 Andreas Robinson, All rights reserved.//// - Via's Unichrome Framebuffer driver//   Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved.//   Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved.// This program is free software; you can redistribute it and/or modify// it under the terms of the GNU General Public License as published by// the Free Software Foundation; either version 2 of the License, or// (at your option) any later version.//// This program is distributed in the hope that it will be useful,// but WITHOUT ANY WARRANTY; without even the implied warranty of// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the// GNU General Public License for more details.//// You should have received a copy of the GNU General Public License// along with this program; if not, write to the Free Software// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA//------------------------------------------------------------------------------#include "VT1622A.h"#include "IO.h"#include "ModeInfoTemplate.h"#include "util/Log.h"//------------------------------------------------------------------------------using unichrome::IO;using unichrome::ModeInfoTemplate;using unichrome::Mode;using unichrome::VT1622A;//------------------------------------------------------------------------------namespace {/** * Mode info structure. */struct ModeInfo : public ModeInfoTemplate<ModeInfo> {public:    /**     * The number of TV registers.     */    static const size_t numTVRegisters = 75;    /**     * Structure describing a single TV register.     */    struct TVRegister    {        /// The subaddress of the register        unsigned char subAddress;        /// The value of the register        unsigned char value;    };    /**     * The array of mode infos. This must be defined for each     * different mode info.     */    static ModeInfo modeInfos[];    /**     * Find the mode info for the given mode.     */    static ModeInfo* find(const Mode& mode);public:    /**     * The TV registers. There should be numTVRegisters of them.     */    const TVRegister* tvRegisters;    /**     * Construct a ModeInfo structure with the given parameters.     */    ModeInfo(const Mode& mode, const TVRegister* tvRegisters);};inline ModeInfo::ModeInfo(const Mode& mode,                           const TVRegister* tvRegisters) :    ModeInfoTemplate<ModeInfo>(mode),    tvRegisters(tvRegisters){}// TV registers for PAL mode.ModeInfo::TVRegister palTVRegisters[ModeInfo::numTVRegisters] = {    {0x00, 0x04}, {0x01, 0x00}, {0x02, 0x00}, {0x03, 0x06},    {0x04, 0x00}, {0x05, 0x00}, {0x06, 0x20}, {0x07, 0x3f},    {0x08, 0x89}, {0x09, 0x39}, {0x0a, 0x63}, {0x0b, 0x00},    {0x0c, 0x50}, {0x0d, 0x45}, {0x0e, 0x0f}, {0x0f, 0x00},    {0x10, 0x00}, {0x11, 0x00}, {0x12, 0xe8}, {0x13, 0x23},    {0x14, 0x84}, {0x15, 0x20}, {0x16, 0xcb}, {0x17, 0x8a},    {0x18, 0x09}, {0x19, 0x2a}, {0x1a, 0xff}, {0x1b, 0x10},    {0x1c, 0x02}, {0x1d, 0x80}, {0x1e, 0x00}, {0x1f, 0x99},    {0x20, 0x17}, {0x21, 0x0c}, {0x22, 0x6f}, {0x23, 0x79},    {0x24, 0x48},        {0x25, 0x62}, {0x26, 0x34}, {0x27, 0x8e}, {0x28, 0x4f},    {0x29, 0x5b}, {0x2a, 0x15}, {0x2b, 0xa0}, {0x2c, 0x22},    {0x2d, 0x67}, {0x2e, 0xff}, {0x2f, 0x00},        {0x4a, 0x00}, {0x4b, 0x00}, {0x4c, 0x00}, {0x4d, 0x04},    {0x4e, 0x00}, {0x4f, 0x3a},        {0x50, 0x5f}, {0x51, 0xcf}, {0x52, 0x23}, {0x53, 0x70},    {0x54, 0x02}, {0x55, 0x5f}, {0x56, 0xbf}, {0x57, 0x7e},    {0x58, 0x23}, {0x59, 0x94}, {0x5a, 0xd0}, {0x5b, 0x27},    {0x5c, 0x8f}, {0x5d, 0x16},        {0x5e, 0x00}, {0x5f, 0x00}, {0x60, 0x04}, {0x61, 0x00},    {0x62, 0x00}, {0x63, 0x5f}, {0x64, 0x03}};// TV registers for NTSC mode.ModeInfo::TVRegister ntscTVRegisters[ModeInfo::numTVRegisters] = {    {0x00, 0x04}, {0x01, 0x00}, {0x02, 0x00}, {0x03, 0x06},     {0x04, 0x03}, {0x05, 0x00}, {0x06, 0x20}, {0x07, 0x28},     {0x08, 0x52}, {0x09, 0x08}, {0x0a, 0x5b}, {0x0b, 0x00},     {0x0c, 0x50}, {0x0d, 0x40}, {0x0e, 0x0f}, {0x0f, 0x00},     {0x10, 0x00}, {0x11, 0x00}, {0x12, 0x2d}, {0x13, 0x07},     {0x14, 0x28}, {0x15, 0x34}, {0x16, 0x1d}, {0x17, 0x66},     {0x18, 0x66}, {0x19, 0x24}, {0x1a, 0xee}, {0x1b, 0x10},     {0x1c, 0x02}, {0x1d, 0x80}, {0x1e, 0x00}, {0x1f, 0x11},     {0x20, 0x16}, {0x21, 0x08}, {0x22, 0xdf}, {0x23, 0x76},     {0x24, 0x04}, {0x25, 0x56}, {0x26, 0x31}, {0x27, 0x90},     {0x28, 0x51}, {0x29, 0x00}, {0x2a, 0x00}, {0x2b, 0xa3},     {0x2c, 0x29}, {0x2d, 0x5d}, {0x2e, 0xc3}, {0x2f, 0x00},         {0x4a, 0x00}, {0x4b, 0x00}, {0x4c, 0x00}, {0x4d, 0x04},     {0x4e, 0x08}, {0x4f, 0x3a}, {0x50, 0x1f}, {0x51, 0xcf},     {0x52, 0x23}, {0x53, 0x0c}, {0x54, 0x02}, {0x55, 0x1f},     {0x56, 0xce}, {0x57, 0x76}, {0x58, 0x23}, {0x59, 0x88},     {0x5a, 0xc9}, {0x5b, 0xef}, {0x5c, 0xff}, {0x5d, 0x05},     {0x5e, 0x00}, {0x5f, 0x00}, {0x60, 0x00}, {0x61, 0x00},     {0x62, 0x00}, {0x63, 0x1f}, {0x64, 0x03}};ModeInfo ModeInfo::modeInfos[] = {    ModeInfo(Mode(PAL), palTVRegisters),    ModeInfo(Mode(NTSC), ntscTVRegisters)};ModeInfo* ModeInfo::find(const Mode& mode){    size_t index = 0;    return ModeInfoTemplate<ModeInfo>::find(mode, modeInfos,                                            sizeof(modeInfos)/sizeof(ModeInfo),                                            index);}}//------------------------------------------------------------------------------//------------------------------------------------------------------------------VT1622A::VT1622A(IO& io) :    TVEncoder(io){    Log::debug("unichrome::VT1622A: TV encoder is a VT1622A\n");}//------------------------------------------------------------------------------void VT1622A::setMode(const Mode& mode){    const ModeInfo* modeInfo = ModeInfo::find(mode);    if (modeInfo==0) return;        io.i2c.enable();    // Reset TV    io.i2c.write(I2C_ADDR_TVENCODER, 0x1d, 0x00);    io.i2c.write(I2C_ADDR_TVENCODER, 0x1d, 0x80);    for(size_t i = 0; i<ModeInfo::numTVRegisters; ++i) {        io.i2c.write(I2C_ADDR_TVENCODER,                     modeInfo->tvRegisters[i].subAddress,                     modeInfo->tvRegisters[i].value);    }    // Enable all composite and S-Video outputs    io.i2c.write(I2C_ADDR_TVENCODER, 0x0e, 0x00);}    //------------------------------------------------------------------------------

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -