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

📄 hal_lut.c

📁 epson公司的一个关于s1d13706的低层驱动程序
💻 C
字号:
/*
**===========================================================================
** HAL_LUT.C - This module contains the LUT routines for the HAL.
**---------------------------------------------------------------------------
** Copyright (c) 2000, 2001 Epson Research and Development, Inc.
** All Rights Reserved.
**===========================================================================
*/

#include "hal.h"
#include "assert.h"
#include "nonsefns.h"

/*-------------------------------------------------------------------------*/

static const char Revision[] = "HAL_LUT.C=$Revision: 6 $";

/*-------------------------------------------------------------------------*/

/*
** _WriteLut()
**
** This function sets either all or a portion of the 256 color LUT.
**
*/
void _WriteLut(BYTE *pLut, int count)
{
   int idx;

   ASSERT(count < 256);


   for (idx = 0; idx < count; idx++)
      {
      seWriteRegByte(REG_LUT_RED_WRITE_DATA, pLut[HAL_RED]);
      seWriteRegByte(REG_LUT_GREEN_WRITE_DATA, pLut[HAL_GREEN]);
      seWriteRegByte(REG_LUT_BLUE_WRITE_DATA, pLut[HAL_BLUE]);

      seWriteRegByte(REG_LUT_WRITE_ADDR, (BYTE) idx);

      pLut += 3;
      }
}

/*-------------------------------------------------------------------------*/

/*
** seWriteLut()
**
** This function sets either all or a portion of the 256 color LUT.
**
*/
void seWriteLut(BYTE *pLUT, int count)
{
   _WriteLut(pLUT, count);
}

/*-------------------------------------------------------------------------*/

/*
** seReadLut()
**
** This routine reads the entire LUT and puts the results in
** the array pointed to by pLut.
*/
void seReadLut(BYTE *pLut, int count)
{
   int idx;
   DWORD val;

   ASSERT( count < 256 );

   for (idx = 0; idx < count; ++idx)
      {
      seWriteRegByte(REG_LUT_READ_ADDR, idx);
      val = seReadRegDword(REG_LUT_BLUE_READ_DATA);
      
      pLut[HAL_RED] = (BYTE) ((val >> 16) & 0xff);
      pLut[HAL_GREEN] = (BYTE) ((val >> 8) & 0xff);
      pLut[HAL_BLUE] = (BYTE) (val & 0xff);

      pLut += 3;
      }
}

/*-------------------------------------------------------------------------*/

/*
** _WriteLutEntry()
**
** This function writes just one LUT entry.
**
** NOTE:
**
** - pColor must point to a valid LUT data entry (BYTE color[3])
**
*/
void _WriteLutEntry(int index, BYTE *pColor)
{
   ASSERT( index < 256 );

   seWriteRegByte(REG_LUT_RED_WRITE_DATA, pColor[HAL_RED]);
   seWriteRegByte(REG_LUT_GREEN_WRITE_DATA, pColor[HAL_GREEN]);
   seWriteRegByte(REG_LUT_BLUE_WRITE_DATA, pColor[HAL_BLUE]);
   
   seWriteRegByte(REG_LUT_WRITE_ADDR, (BYTE) index);
}

/*-------------------------------------------------------------------------*/

/*
** seWriteLutEntry()
**
** This function writes just one LUT entry.
**
** NOTE:
**
** - pColor must point to a valid LUT data entry (BYTE color[3])
**
*/
void seWriteLutEntry(int index, BYTE *pColor)
{
   _WriteLutEntry(index, pColor);
}

/*-------------------------------------------------------------------------*/

/*
** seReadLutEntry()
**
** This function reads just one LUT entry.
**
** NOTE:
** - pColor must point to a valid LUT data entry (BYTE color[3])
*/
void seReadLutEntry(int index, BYTE *pColor)
{
   DWORD val;
   
   ASSERT( index < 256);

   seWriteRegByte(REG_LUT_READ_ADDR, index);
   val = seReadRegDword(REG_LUT_BLUE_READ_DATA);
   
   pColor[HAL_RED] = (BYTE) ((val >> 16) & 0xff);
   pColor[HAL_GREEN] = (BYTE) ((val >> 8) & 0xff);
   pColor[HAL_BLUE] = (BYTE) (val & 0xff);
}

/*-------------------------------------------------------------------------*/

⌨️ 快捷键说明

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