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

📄 lut.c

📁 WinCE 3.0 BSP, 包含Inter SA1110, Intel_815E, Advantech_PCM9574 等
💻 C
字号:
//
// Permedia3 Sample Display Driver
// lut.c
//
// Copyright (c) 2000 Microsoft Corporation. All rights reserved.
//
// This module contains the code for managing the DACs look-up table (LUT.)
// This look-up table is used for gamma correction in direct color display
// mode and as a palette in color indexed modes.

#include "pch.h"  // Precompiled header support. 
#include "debug.h"
#include "const.h"
#include "struct.h"
#include "proto.h"
#include "register.h"

void
GetGammaRamp(
  BYTE * RedRamp,
  BYTE * GreenRamp,
  BYTE * BlueRamp
  )
{
  // GetGammaRamp
  // This function loads the current lut values into the user's arrays.
  // It assumes that there are exactly NUM_LUT_ENTRIES in each of the
  // Ramp arrays.

  // Local variables.

  ULONG i;

  // Check parameters.

  AssertWritePtr(RedRamp, sizeof(BYTE) * NUM_LUT_ENTRIES);
  AssertWritePtr(GreenRamp, sizeof(BYTE) * NUM_LUT_ENTRIES);
  AssertWritePtr(BlueRamp, sizeof(BYTE) * NUM_LUT_ENTRIES);

  Enter(L"GetGammaRamp");

  // !TODO! Wait for FIFO Space?

  // Load the initial read address. After each blue read cycle, this
  // address is autoincremented.

  WriteRegByte(r_RDPaletteReadAddress, 0);

  for (i = 0; i < NUM_LUT_ENTRIES; i++) {

    RedRamp[i]   = ReadRegByte(r_RDPaletteData);
    GreenRamp[i] = ReadRegByte(r_RDPaletteData);
    BlueRamp[i]  = ReadRegByte(r_RDPaletteData);
  }

  Exit(L"GetGammaRamp");
}

void
SetGammaRamp(
  BYTE * RedRamp,
  BYTE * GreenRamp,
  BYTE * BlueRamp
  )
{
  // SetRedRamp
  // This function loads the lut with the lookup values provided in
  // the Ramp parameters. This function assumes that there are exactly
  // NUM_LUT_ENTRIES in each of the Ramp arrays. It may be necessary to
  // wait for a vertical blanking period before calling this function
  // in order to insure there are no artifacts.

  // Local variables.

  ULONG i;

  // Check parameters.

  AssertReadPtr(RedRamp, sizeof(BYTE) * NUM_LUT_ENTRIES);
  AssertReadPtr(GreenRamp, sizeof(BYTE) * NUM_LUT_ENTRIES);
  AssertReadPtr(BlueRamp, sizeof(BYTE) * NUM_LUT_ENTRIES);

  Enter(L"SetGammaRamp");

  // !TODO! Wait for FIFO space?

  // Load the initial write address. After each blue write cycle, this
  // address will be auto-incremented, so we don't need to write it
  // repeatedly to load the whole table.

  WriteRegByte(r_RDPaletteWriteAddress, 0);

  for (i = 0; i < NUM_LUT_ENTRIES; i++) {

    WriteRegByte(r_RDPaletteData, RedRamp[i]);
    WriteRegByte(r_RDPaletteData, GreenRamp[i]);
    WriteRegByte(r_RDPaletteData, BlueRamp[i]);
  }

  Exit(L"SetGammaRamp");
}

⌨️ 快捷键说明

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