//------------------------------------------------------------------------------
//
//  Copyright (C) 2004-2007, Freescale Semiconductor, Inc. All Rights Reserved.
//  THIS SOURCE CODE, AND ITS USE AND DISTRIBUTION, IS SUBJECT TO THE TERMS
//  AND CONDITIONS OF THE APPLICABLE LICENSE AGREEMENT
//
//------------------------------------------------------------------------------
//
//  File:  sdc.h
//
//  local header file.
//
//------------------------------------------------------------------------------
#include "display_vf.h"

#ifndef __SDC_H__
#define __SDC_H__

#ifdef __cplusplus
extern "C" {
#endif

//------------------------------------------------------------------------------
// Defines

#define SCREEN_PIX_WIDTH_PQVGA      240
#define SCREEN_PIX_HEIGHT_PQVGA     320
#define SCREEN_PIX_WIDTH_VGA        640
#define SCREEN_PIX_HEIGHT_VGA       480
#define SCREEN_PIX_WIDTH_SVGA       800
#define SCREEN_PIX_HEIGHT_SVGA      600
#define SCREEN_PIX_WIDTH_LQVGA      320
#define SCREEN_PIX_HEIGHT_LQVGA     240
#define DISP_MIN_WIDTH              8
#define DISP_MIN_HEIGHT             8
#define DISP_BPP                    16
#define DISP_BYTES_PP               (DISP_BPP / 8)

#define LCD_CONTRAST_MIN            0x00000000
#define LCD_CONTRAST_MAX            0x000000FF
#define LCD_CONTRAST_DEFAULT        0x0000007F
#define LCD_CONTRAST_STEP           0x00000001


//-----------------------------------------------------------------------------
// Types

typedef enum DisplayPlaneEnum
{
    DisplayPlane_0 = IPU_SDC_COM_CONF_GWSEL_BG,
    DisplayPlane_1 = IPU_SDC_COM_CONF_GWSEL_FG
} DisplayPlane;

//------------------------------------------------------------------------------
// Functions

UINT32  InitializeSDC(PANEL_INFO *currentPanel, int bpp, int width, int height, ULONG m_SkipLCDCInit);
void    EnableSDC(void);
void    DisableSDC(void);
void    BackgroundSetSrcBuffer(PHYSICAL_ADDRESS *pAddr);

BOOL    ForegroundWindowConfig(PDISPLAY_SDC_FG_CONFIG_DATA pDispConfigData);
void    ForegroundWindowSetOffset(POINT *ptWinOffset);
void    ForegroundWindowSetSrcBuffer(PHYSICAL_ADDRESS *pAddr);
void    ForegroundWindowRestore();
void    ForegroundWindowEnable();
BOOL    ForegroundWindowDisable();
DWORD   ForegroundWindowGetCurBuf();
void    DisplayPlaneWaitForVSync(DisplayPlane dispPlane, UINT32 timeout);
BOOL    DisplayPlaneIsBusy(DisplayPlane dispPlane);
void    DisplayPlaneWaitForNotBusy(DisplayPlane dispPlane);
BOOL    PeekandPoke(PDEBUG_INFO pvIn);

void 	VSyncInterruptEnable();
void 	VSyncInterruptClear();
void 	WaitForVSyncInterrupt();

#ifdef __cplusplus
}
#endif

#endif // __SDC_H__
