📄 chrontel.h
字号:
//
// Copyright (c) Chrontel Inc. All rights reserved.
//
//
// Use of this source code is subject to the terms of the Chrontel end-user
// license agreement (EULA) under which you licensed this SOFTWARE PRODUCT.
// If you did not accept the terms of the EULA, you are not authorized to use
// this source code. For a copy of the EULA, please see the LICENSE.RTF on your
// install media.
//
/*++
THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
PARTICULAR PURPOSE.
Module Name:
LIBI2C.h
Abstract:
Holds definitions for Chrontel's XScale I2C & Register Accessing Functions.
Revision:
Created by Roger Yu. 11/11/02
Notes:
--*/
#ifndef __CHRONTEL_H__
#define __CHRONTEL_H__
#include <windows.h> // include windows.h to add type defines
#include <windev.h>
#include <ceddk.h>
#include <pwingdi.h>
#ifndef WINCEOEM
#define WINCEOEM 1
#endif
#include <Pkfuncs.h>
#define CHDBG(x) NKDbgPrintfW x ;
#include "phyaddr.h"
#include "xslreg.h"
#ifdef __cplusplus
extern "C" {
#endif
//
//$$ Library Functions
//
int MapRegisterZones( void );
int UnmapRegisterZones( void );
__forceinline BOOL wrapVirtualCopy(LPVOID lpvDest, LPVOID lpvSrc, DWORD cbSize, DWORD fdwProtect)
{
return VirtualCopy(lpvDest, lpvSrc, cbSize, fdwProtect);
}
__forceinline BOOL wrapSetKMode(BOOL fMode)
{
return SetKMode(fMode);
}
// In: pPhysicalAddress= the physical address need be mapped
// Out: vpBase= base Virtual address of mapping
// return= the mapped virtual address;
//@@@Note: return = vpBase + (offset within page)
PVOID VirtualAllocCopy(unsigned size,PVOID *vpBase,PVOID pPhysicalAddress);
// Delay time in us with OST timer in PXA2x0
void delay_us( unsigned usVal);
void delay_ms( unsigned msVal);
/*
Driver Information registry.
The display driver or utility will check the registry here
to determine which video output device is using, then it can
open the device based on the "Output" key, and do the
DeviceIoControl.
*/
#define VIDEO_OUTPUT_DEVICE_REG_PATH TEXT("Drivers\\Display\\Chrontel")
#define VOD_REG_DEVICE TEXT("Output")
#define VOD_REG_ROW_RES TEXT("CxScreen")
#define VOD_REG_COL_RES TEXT("CyScreen")
#define VOD_REG_BPP TEXT("ColorDepth")
#define VOD_REG_PANEL_TFT TEXT("IsTFTPanel")
#define VOD_REG_PANEL_DUAL TEXT("IsDualPanel")
#define VOD_REG_SHRINKPIXEL TEXT("ShrinkPixel")
// Function used by display driver or utility to determine video output
// device name.
// return: Device Handler if success, or INVALID_HANDLE_VALUE if failed
int GetVideoParamRegistry(int* cxScreen, int* cyScreen, int* bpp,
int* tft, int* dualpanel, int *hoc);
/* Chrontel VOD class define */
#define VOECLS_UNKNOWN -1
#define VOECLS_7006 0x0
#define VOECLS_7013 0x1
#define VOECLS_7303 0x2
#define VOECLS_7007 0x3
#define VOECLS_7009 0x4
#define VOECLS_7019 0x5
// VOD device attribute byte
#define VOD_ATTR_INVALID 0x0
#define VOD_ATTR_DEFAULT 0x10 // default device w/o VOD (eg. STN/TFT panel)
#define VOD_ATTR_TV 0x08 // Output to TV
#define VOD_ATTR_VGA 0x04 // Output to CRT/VGA bypass
#define VOD_ATTR_DVI 0x02 // Output to DVI
#define VOD_ATTR_LVDS 0x01 // Output to LVDS
#define VOD_ATTR_CHVOE 0x0F // Output to TV/VGA/DVI/LVDS mask
// Initialze the I2C unit in PXA2x0.
// The function need be called after MapRegisterZones has been called successfully.
void I2CInitialize();
//Input: addr= 8-bit I2C Slave address
// index= register index
unsigned I2CReadReg( unsigned addr, unsigned index);
//Input: addr= 8-bit I2C Slave address
// index= register index
void I2CWriteReg( unsigned addr, unsigned index, unsigned value);
// Write register with mask
void I2CWriteRegBits( unsigned addr, unsigned index, unsigned mask, unsigned value);
// return 0 if last I2C operation is OK
int I2CError();
//\\/\\//\\//\\\//
void LcdOnOff(int enable);
void BcrEnable( int enable);
void BcrOnOff( int on);
void LedOn(int on);
//+++ LCD Frame Buffer Memory Handling +++
void CleanupLcdMemory();
int AllocLcdMemory(int sx, int sy, int bpp);
void CleanupLcdMemory();
void SaveLcdPointers();
void RestoreLcdPointers();
typedef struct _TIMING_FLAGS {
unsigned bHSyncPolarity : 1; // Bit 0, 1 = Sync Polarity is Active High
unsigned bVSyncPolarity : 1; // Bit 1, 1 = Sync Polarity is Active High
unsigned bBlankPolarity : 1; // Bit 2, Blank Polarity 1 = Active High, 0 = Active Low
// double in horizontal & vertical to scale up
unsigned bClockDouble : 1; // Bit 3, 0 = 1x Clock, 1 = 2x XScale DPC mode
unsigned bLineDouble : 1; // Bit 4, 1 = bouble each line in vertical, 0: no double
//
unsigned uTVStandard : 2; // Bit 6:5, TV Standard for TV out
// 00: NTSC, 01: PAL
unsigned bTVDual : 1; // Bit 7: Dual display when TV Out (TV+DVI or TV+LVDS)
// 0: TV only, 1: TV+DVI or TV+LVDS
} TIMING_FLAGS;
// define of LCLK flag for core clock
#define LCLK_NOCHANGE (0<<28)
#define LCLK_L27_CHANGE (1<<28)
#define LCLK_L32_CHANGE (2<<28)
#define LCLK_L36_CHANGE (3<<28)
#define LCLK_L40_CHANGE (4<<28)
#define LCLK_L45_CHANGE (5<<28)
typedef struct {
ULONG dwSize; // Size of the Timing Info Structure
ULONG dwDotClock; // Pixel clock in kHz | LCLK flag
ULONG dwHActive; // Active in pixels (PPL)
ULONG dwHSyncWidth; // Horizontal Sync Width pixels (HSW)
ULONG dwHFrontPorch; // From sync to active in pixels (BLW)
ULONG dwHBackPorch; // From active to sync in pixels (ELW)
ULONG dwHRefresh; // Refresh Rate
ULONG dwVActive; // Active lines (LPP)
ULONG dwVSyncWidth; // Vertical Sync in lines (VSW)
ULONG dwVFrontPorch; // From sync to active lines (BFW)
ULONG dwVBackPorch; // From active to sync lines (EFW)
ULONG dwVRefresh; // Refresh Rate
TIMING_FLAGS flFlags; // Timing Flags e.g. Signal Polarity
} DISPTIMING, *PDISPTIMING;
typedef struct _tagContrastCmdParm {
int command;
int parm;
} ContrastCmdParm;
//**********
// Inline functions to use the VOD IOCTL I/F code
//#include "vod_if.h"
int FindEncoder(void);
int vod_Initialize(UINT oc);
int vod_GetConnectStatus(UINT oc);
void vod_GetTiming(UINT oc, PDISPTIMING p);
void vod_SetTiming(UINT oc, PDISPTIMING p);
void vod_SetPower(UINT oc, int powerstate);
void vod_PostSetTiming(UINT oc);
/*--------------------------------------------------------------
//
//
**-------------------------------------------------------------*/
//@@@Add some defines that only visible in DDK kernel
// see the private <pwingdi.h> file
//@@@Add Chrontel defines Call back video function
// Using ESCAPE code start from OEM code base
#define OEMES_CODEBASE 100000
#define DRVESC_DISPLAYPAGE (OEMES_CODEBASE + 1)
#define DRVESC_GETPALETTERAMPHYSICAL (OEMES_CODEBASE + 2)
#define DRVESC_VERTICALBLANKINTERRUPT (OEMES_CODEBASE + 3)
#define DRVESC_OS_SCREENACCESS (OEMES_CODEBASE + 4)
#define DRVESC_SCROLL (OEMES_CODEBASE + 5)
#define DRVESC_I2CRW (OEMES_CODEBASE + 100)
#define DRVESC_GETTIMING (OEMES_CODEBASE + 101)
#define DRVESC_SETTIMING (OEMES_CODEBASE + 102)
//
#define DRVESC_CHANGEVOEDEVICE (OEMES_CODEBASE + 103)
#define DRVESC_GETDIMMENSION (OEMES_CODEBASE + 104)
#define DRVESC_SAVEPOINTERS (OEMES_CODEBASE + 105)
#define DRVESC_RESTOREPOINTERS (OEMES_CODEBASE + 106)
#define DRVESC_SHOWCOLORBAR (OEMES_CODEBASE + 107)
#define DRVESC_GETVOEABILITY (OEMES_CODEBASE + 108)
#define DRVESC_GETVOEDEVICE (OEMES_CODEBASE + 109)
//
// send private Escape code to display driver
typedef int (*func_DisplayEscape)(
int nEscape, //[in] Specifies the escape function to be performed..
int cbInput, //[in] Specifies the number of bytes of data pointed to by the lpszInData parameter.
LPCSTR lpszInData, //[in] Long pointer to the input structure required for the specified escape.
int cbOutput, //[in] Specifies the number of bytes of data pointed to by the lpszOutData parameter.
LPSTR lpszOutData //[out] Long pointer to the structure that receives output from this escape.
);
extern func_DisplayEscape PrivateDisplayEscape;
//---------------------------------------------------------------------\\
// Video callback functions provided by display driver or display
// service driver to VOD device
//
//
//**********
// Inline functions to use the Video Driver Escape code or VOS IOCTL I/F code
//#include "vos_if.h"
#ifdef __cplusplus
}
#endif
#endif __CHRONTEL_H__
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -