📄 drvglobal.c
字号:
////////////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2006-2007 MStar Semiconductor, Inc.
// All rights reserved.
//
// Unless otherwise stipulated in writing, any and all information contained
// herein regardless in any format shall remain the sole proprietary of
// MStar Semiconductor Inc. and be kept in strict confidence
// (¨MStar Confidential Information〃) by the recipient.
// Any unauthorized act including without limitation unauthorized disclosure,
// copying, use, reproduction, sale, distribution, modification, disassembling,
// reverse engineering and compiling of the contents of MStar Confidential
// Information is unlawful and strictly prohibited. MStar hereby reserves the
// rights to any and all damages, losses, costs and expenses resulting therefrom.
//
// Description: Global functions for drivers
//
////////////////////////////////////////////////////////////////////////////////
#define DRV_GLOBAL_C
/******************************************************************************/
/* Header Files */
/* ****************************************************************************/
#include "drvGlobal.h"
#include "panel.h"
#include "analog_reg.h"
#include "board.h"
#include "Drvtimer.h"
#include "msGPIO.h"
#include "drvsys.h"
/******************************************************************************/
/* Local */
/* ****************************************************************************/
/********************************************************************************/
/* Local Function Prototypes */
/********************************************************************************/
/********************************************************************************/
/* Functions */
/********************************************************************************/
#if 0
//*************************************************************************
//Function name: MDrv_WriteRegTbl
//Passing parameter: RegUnitType *pRegTable: register table needed to write
//Return parameter: none
//Description: write table of register values
//*************************************************************************
void MDrv_WriteRegTbl ( MS_REG_TYPE *pRegTable )
{
U16 u16Index; // register index
U16 u16Dummy;
u16Dummy = 65535;
while (1)
{
u16Index = pRegTable->u16Index; // get register index
if (u16Index == _END_OF_TBL_) // check end of table
break;
XBYTE[u16Index] = pRegTable->u8Value; // write register
pRegTable++; // next
if ( (u16Dummy--) == 0 )
break;
} // while
}
//*************************************************************************
//Function name: MDrv_WriteRegTbl2
//Passing parameter: U8 *pRegTable: register table needed to write
//Return parameter: none
//Description: write table of register values
//*************************************************************************
void MDrv_WriteRegTbl2 ( U8 *pRegTable )
{
U8 u8Length;
U16 u16Index; // register index
U16 u16Dummy;
u16Dummy = (U16)-1;
do
{
u16Index = *((U16 *)pRegTable)++;
if (u16Index == 0xFFFF) // check end of table
break;
u8Length = HIGHBYTE(u16Index) >> 6;
u16Index &= 0x3FFF;
while (1)
{
XBYTE[u16Index] = *pRegTable++;
if (u8Length == 0)
break;
u8Length--;
u16Index++;
}
} while (--u16Dummy > 0);
}
#endif
void MDrv_WriteRegTbl3(MS_REG16_TYPE* pu16Table)
{
U8 u8OriginalBank, u8CurrentBank, u8Bank, u8Index;
u8OriginalBank = MDrv_ReadByte(BK_SELECT_00);
u8CurrentBank = u8OriginalBank;
while (1)
{
if ((pu16Table->u16Index) == 0xFFFF) break;
u8Bank = ((pu16Table->u16Index) & 0xFF00) >> 8;
u8Index = ((pu16Table->u16Index) & 0x00FF);
if (u8Bank != u8CurrentBank)
{
MDrv_WriteByte(BK_SELECT_00, u8Bank);
u8CurrentBank = u8Bank;
}
MDrv_Write2Byte(0x2F00 + (u8Index*2), (pu16Table->u16Value));
pu16Table++;
}
MDrv_WriteByte(BK_SELECT_00, u8Bank);
}
void MDrv_WriteRegTbl4(MS_REG_TYPE* pu8Table)
{
U16 u16Index; // register index
while (1)
{
u16Index = (pu8Table->u16Index); // get register index
if (u16Index == _END_OF_TBL_) // check end of table
break;
XBYTE[u16Index] = (pu8Table->u8Value); // write register
pu8Table++;
}
}
void MDrv_Write2ByteA( U16 u16Reg, U16 u16Value)
{
u16Reg=(u16Reg&0xFF00)|((u16Reg&0x00FF)*2);
MDrv_WriteByte(u16Reg,u16Value);
MDrv_WriteByte(u16Reg+1,u16Value>>8);
}
#undef DRV_GLOBAL_C
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -