#ifndef __DRV_BLULIGHT_DEF_H__
#define __DRV_BLULIGHT_DEF_H__

#include "general.h"

#ifdef _C_MODEL_
#include <stdlib.h>
#define UINT8 unsigned char
#define UINT32 unsigned int
#define INT32 int
#define UINT16 unsigned short
#define INT16 short // new
#define INT64 long long int // new
#define UINT64 unsigned long long int // new
typedef enum{
    true = (1==1),
    false = (0==0)
}BOOL;
#else
#include "typedef.h"
#include "x_debug.h"
#include "x_util.h"
#endif

#define HUE_PHASE 28
#define HUE_PHASE_Y 16
#define SAT_GAIN_NUM 3
#define SAT_POS_NUM 2
#define CCORR_NUM 9

typedef struct {
	UINT8 HSYGainH[HUE_PHASE];
	UINT8 HSYGainS[HUE_PHASE][SAT_GAIN_NUM + SAT_POS_NUM];
	UINT8 HSYGainY[HUE_PHASE_Y];
    INT32 CCORR[CCORR_NUM];
}sBluLightColorRegs;

typedef struct {
    UINT32 X;
    UINT32 Y;
    UINT32 Z;
}XYZ;

typedef struct{
    XYZ R;
    XYZ G;
    XYZ B;
}RGB_XYZ;

typedef struct{
    UINT8 Hidx;
	INT32 H,S1,S2,Y;
}Manual_tune;

typedef struct{
    INT16 cT2Deg;	// rounding
    INT16 cT1Deg;	// rounding
    UINT16 cTOriCT; 	// rounding
    UINT8 strengthLimit;	// *100
    RGB_XYZ Col_XYZ;		
    BOOL remainShiftEn;
    INT32 shiftDx;  // *10000
    INT32 shiftDy;	
    INT32 tuneDx;	
    INT32 tuneDy;	
    INT32 Trg_x;
    INT32 Trg_y;
    INT32 XYZ2RGB[9];	
    INT32 tuneCCORR[9];	
    INT32 invCCORR[9];	

    UINT8 regWgt1,regWgt2;	// *100
    UINT8 regThr1,regThr2;	// *100
    UINT8 sbyhWgt[10];		// *32
    Manual_tune tune[7];
}BluLightReg;

void vDrvBluLightSetEnable(BOOL bEnable);
BOOL vDrvBluLightGetEnable(void);
void vDrvBluLightUpdateParam(void);

void vDrvBluLightSetStrength(UINT8 u1Strength);
UINT8 vDrvBluLightGetStrength(void);

#ifndef _C_MODEL_
void vDrvBlueLightInit(void);
void vDrvBluLightDef(void);
#endif

void vDrvBluLightInitCommon(void);
void vDrvBluLightCalculate(sBluLightColorRegs input, sBluLightColorRegs *output);
#endif
