////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
// All rights reserved.
// Confidential and Proprietary - Qualcomm Technologies, Inc.
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @file  camxcslispdefs.h
/// @brief ISP Hardware Interface Definition
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

#ifndef CAMXCSLISPDEFS_H
#define CAMXCSLISPDEFS_H

#include "camxcsl.h"
#include "camxdefs.h"
#include "camxpacketdefs.h"

CAMX_NAMESPACE_BEGIN

// ISP Resource Type
static const UINT32 ISPResourceIdPort      = 0;
static const UINT32 ISPResourceIdClk       = 1;

// ISP Usage Type
static const UINT32 ISPResourceUsageSingle = 0;
static const UINT32 ISPResourceUsageDual   = 1;

// ISP Color Pattern
static const UINT32 ISPPatternBayerRGRGRG  = 0;
static const UINT32 ISPPatternBayerGRGRGR  = 1;
static const UINT32 ISPPatternBayerBGBGBG  = 2;
static const UINT32 ISPPatternBayerGBGBGB  = 3;
static const UINT32 ISPPatternYUVYCBYCR    = 4;
static const UINT32 ISPPatternYUVYCRYCB    = 5;
static const UINT32 ISPPatternYUVCBYCRY    = 6;
static const UINT32 ISPPatternYUVCRYCBY    = 7;

// ISP Input Format
static const UINT32 ISPFormatMIPIRaw6           = 1;
static const UINT32 ISPFormatMIPIRaw8           = 2;
static const UINT32 ISPFormatMIPIRaw10          = 3;
static const UINT32 ISPFormatMIPIRaw12          = 4;
static const UINT32 ISPFormatMIPIRaw14          = 5;
static const UINT32 ISPFormatMIPIRaw16          = 6;
static const UINT32 ISPFormatMIPIRaw20          = 7;
static const UINT32 ISPFormatRaw8Private        = 8;
static const UINT32 ISPFormatRaw10Private       = 9;
static const UINT32 ISPFormatRaw12Private       = 10;
static const UINT32 ISPFormatRaw14Private       = 11;
static const UINT32 ISPFormatPlain8             = 12;
static const UINT32 ISPFormatPlain168           = 13;
static const UINT32 ISPFormatPlain1610          = 14;
static const UINT32 ISPFormatPlain1612          = 15;
static const UINT32 ISPFormatPlain1614          = 16;
static const UINT32 ISPFormatPlain1616          = 17;
static const UINT32 ISPFormatPlain3220          = 18;
static const UINT32 ISPFormatPlain64            = 19;
static const UINT32 ISPFormatPlain128           = 20;
static const UINT32 ISPFormatARGB               = 21;
static const UINT32 ISPFormatARGB10             = 22;
static const UINT32 ISPFormatARGB12             = 23;
static const UINT32 ISPFormatARGB14             = 24;
static const UINT32 ISPFormatDPCM10610          = 25;
static const UINT32 ISPFormatDPCM10810          = 26;
static const UINT32 ISPFormatDPCM12612          = 27;
static const UINT32 ISPFormatDPCM12812          = 28;
static const UINT32 ISPFormatDPCM14814          = 29;
static const UINT32 ISPFormatDPCM141014         = 30;
static const UINT32 ISPFormatNV21               = 31;
static const UINT32 ISPFormatNV12               = 32;
static const UINT32 ISPFormatTP10               = 33;
static const UINT32 ISPFormatYUV422_8           = 34;
static const UINT32 ISPFormatPD8                = 35;
static const UINT32 ISPFormatPD10               = 36;
static const UINT32 ISPFormatUBWCNV12           = 37;
static const UINT32 ISPFormatUBWCNV124R         = 38;
static const UINT32 ISPFormatUBWCTP10           = 39;
static const UINT32 ISPFormatUBWCP010           = 40;
static const UINT32 ISPFormatPlain8Swap         = 41;
static const UINT32 ISPFormatPlain810           = 42;
static const UINT32 ISPFormatPlain810Swap       = 43;
static const UINT32 ISPFormatYV12               = 44;
static const UINT32 ISPFormatY                  = 45;
static const UINT32 ISPFormatDPCM121012         = 46;
static const UINT32 ISPFormatPlain32            = 47;
static const UINT32 ISPFormatARGB16             = 48;
static const UINT32 ISPFormatYUV422_10          = 50;
static const UINT32 ISPFormatPlain1610LSB       = 51;
static const UINT32 ISPFormatUBWCP016           = 52;
static const UINT32 ISPFormatYUV444_1288        = 53;
static const UINT32 ISPFormatPlain3224          = 54;
static const UINT32 ISPFormatRGB888             = 55;
static const UINT32 ISPFormatBGR888             = 56;
static const UINT32 ISPFormatRGBP888            = 57;
static const UINT32 ISPFormatBGRP888            = 58;
static const UINT32 ISPFormatP01208             = 59;
static const UINT32 ISPFormatP01210             = 60;
static const UINT32 ISPFormatP01208LSB          = 61;
static const UINT32 ISPFormatP01210LSB          = 62;
static const UINT32 ISPFormatP010LSB            = 63;
static const UINT32 ISPFormatP010               = 64;
static const UINT32 ISPFormatYUV444_888         = 65;
static const UINT32 ISPFormatYUV422_888_UYVY    = ISPFormatYUV422_8;
static const UINT32 ISPFormatYUV422_888_YUYV    = 66;
static const UINT32 ISPFormatYUV422_888_VYUY    = 67;
static const UINT32 ISPFormatYUV422_888_YVYU    = 68;
static const UINT32 ISPFormatYUV422_10_UYVY     = ISPFormatYUV422_10;
static const UINT32 ISPFormatYUV422_10_YUYV     = 69;
static const UINT32 ISPFormatYUV422_10_VYUY     = 70;
static const UINT32 ISPFormatYUV422_10_YVYU     = 71;
static const UINT32 ISPFormatMIPIRaw24          = 72;

static const UINT32 ISPFormatUndefined     = 0xFFFFFFFF;

// ISP output resource type
static const UINT32 ISPOutputEncode        = 1000;
static const UINT32 ISPOutputView          = 1001;
static const UINT32 ISPOutputVideo         = 1002;
static const UINT32 ISPOutputRDI0          = 1003;
static const UINT32 ISPOutputRDI1          = 1004;
static const UINT32 ISPOutputRDI2          = 1005;
static const UINT32 ISPOutputRDI3          = 1006;
static const UINT32 ISPOutputStatsAEC      = 1007;
static const UINT32 ISPOutputStatsAF       = 1008;
static const UINT32 ISPOutputStatsAWB      = 1009;
static const UINT32 ISPOutputStatsRS       = 1010;
static const UINT32 ISPOutputStatsCS       = 1011;
static const UINT32 ISPOutputStatsIHIST    = 1012;
static const UINT32 ISPOutputStatsSkin     = 1013;
static const UINT32 ISPOutputStatsBG       = 1014;
static const UINT32 ISPOutputStatsBF       = 1015;
static const UINT32 ISPOutputStatsBE       = 1016;
static const UINT32 ISPOutputStatsBHIST    = 1017;
static const UINT32 ISPOutputStatsBFScale  = 1018;
static const UINT32 ISPOutputStatsHDRBE    = 1019;
static const UINT32 ISPOutputStatsHDRBHIST = 1020;
static const UINT32 ISPOutputStatsAECBG    = 1021;
static const UINT32 ISPOutputCAMIFRaw      = 1022;
static const UINT32 ISPOutputIdealRaw      = 1023;


// ISP input resource type
static const UINT32 ISPInputTestGen        = 1500;
static const UINT32 ISPInputPHY0           = 1501;
static const UINT32 ISPInputPHY1           = 1502;
static const UINT32 ISPInputPHY2           = 1503;
static const UINT32 ISPInputPHY3           = 1504;
static const UINT32 ISPInputFE             = 1505;

// ISP input resource Lane Type
static const UINT32 ISPLaneTypeDPHY        = 0;
static const UINT32 ISPLaneTypeCPHY        = 1;

/* ISP Resurce Composite Group ID */
static const UINT32  ISPOutputGroupIdNONE   = 0;
static const UINT32  ISPOutputGroupId0      = 1;
static const UINT32  ISPOutputGroupId1      = 2;
static const UINT32  ISPOutputGroupId2      = 3;
static const UINT32  ISPOutputGroupId3      = 4;
static const UINT32  ISPOutputGroupId4      = 5;
static const UINT32  ISPOutputGroupId5      = 6;
static const UINT32  ISPOutputGroupId6      = 7;
static const UINT32  ISPOutputGroupIdMAX    = 8;

static const UINT16  ISPAcquireCommonVersion1 = 0x1000;     ///< IFE Common Resource structure Version
static const UINT16  ISPAcquireInputVersion1  = 0x0100;     ///< IFE Input Resource structure Version
static const UINT16  ISPAcquireOutputVersion1 = 0x0100;     ///< IFE Output Resource structure Version

static const UINT16  ISPAcquireCommonVersion2 = 0x2000;     ///< IFE Common Resource structure Version
static const UINT16  ISPAcquireInputVersion2  = 0x0200;     ///< IFE Input Resource structure Version
static const UINT16  ISPAcquireOutputVersion2 = 0x0200;     ///< IFE Output Resource structure Version

static const UINT16  ISPAcquireCommonVersion3 = 0x3000;     ///< IFE Common Resource structure Version
static const UINT16  ISPAcquireInputVersion3  = 0x0300;     ///< IFE Input Resource structure Version
static const UINT16  ISPAcquireOutputVersion3 = 0x0300;     ///< IFE Output Resource structure Version

static const UINT32 ISPMaxVCConfig = 4;
static const UINT32 ISPMaxDTConfig = 4;

static constexpr UINT32 ISPMaxTrailingVCDTConfig = 2;

static const UINT32 ISPMaxOutputPorts = 34; ///< Max IFE Output Ports

static const UINT32 ISPMaxConfigParams = 6; //< Max Configuration Params

// IFE HW Mask same as KMD define
static const UINT32 IFE0HWMask     = 0x1;
static const UINT32 IFE1HWMask     = 0x2;
static const UINT32 IFE0LiteHWMask = 0x4;
static const UINT32 IFE1LiteHWMask = 0x8;
static const UINT32 IFE2LiteHWMask = 0x10;
static const UINT32 IFE3LiteHWMask = 0x20;
static const UINT32 IFE4LiteHWMask = 0x40;
static const UINT32 IFE5LiteHWMask = 0x80;
static const UINT32 IFE2HWMask     = 0x100;
static const UINT32 SFE0HWMask     = 0x1000;
static const UINT32 SFE1HWMask     = 0x2000;
static const UINT32 SFE2HWMask     = 0x4000;
static const UINT32 IFE6LiteHWMask = 0x10000;
static const UINT32 IFE7LiteHWMask = 0x20000;
static const UINT32 IFE8LiteHWMask = 0x40000;
static const UINT32 IFE9LiteHWMask = 0x80000;

static const UINT32 IFEHWMasks = (IFE0HWMask |IFE1HWMask | IFE2HWMask) |
                                 (IFE0LiteHWMask |IFE1LiteHWMask |IFE2LiteHWMask | IFE3LiteHWMask | IFE4LiteHWMask);
static const UINT32 SFEHWMasks = (SFE0HWMask | SFE1HWMask | SFE2HWMask);

// Max IFE HW numbers and Max split HW numbers, same as KMD define
static const UINT32 IFEHWMaxCounts =   5;
static const UINT32 IFEHWMaxSplits =   3;

static const UINT32 IFEWMModeLineBased  = 0x0;  ///< WM Line based Mode
static const UINT32 IFEWMModeFrameBased = 0x1;  ///< WM Frame based Mode
static const UINT32 IFEWMModeIndexBased = 0x2;  ///< WM Index based Mode

// IFE Path Mask same as KMD define
static const UINT32  IFEPXLPathMask  = 0x1;
static const UINT32  IFEPPDPathMask  = 0x2;
static const UINT32  IFELCRPathMask  = 0x4;
static const UINT32  IFERDI0PathMask = 0x8;
static const UINT32  IFERDI1PathMask = 0x10;
static const UINT32  IFERDI2PathMask = 0x20;
static const UINT32  IFERDI3PathMask = 0x40;
static const UINT32  IFERDI4PathMask = 0x80;
static const UINT32  IFEPXL1PathMask = 0x100;
static const UINT32  IFEPXL2PathMask = 0x200;
static const UINT32  IFERDI5PathMask = 0x400;
static const UINT32  IFEVirtualRDI0PathMask = 0x800;
static const UINT32  IFEVirtualRDI1PathMask = 0x1000;
static const UINT32  IFEVirtualRDI2PathMask = 0x2000;
static const UINT32  IFEVirtualRDI3PathMask = 0x4000;
static const UINT32  IFEVirtualRDI4PathMask = 0x8000;
static const UINT32  IFEVirtualRDI5PathMask = 0x10000;

static const UINT32  IFEPathMasks = IFEPXLPathMask |IFEPPDPathMask |IFELCRPathMask| IFERDI0PathMask|
                                        IFERDI1PathMask |IFERDI2PathMask |IFERDI3PathMask|
                                        IFERDI4PathMask| IFERDI5PathMask;

// Feature Flag Indicators
static const UINT32 IFEFeatureMaskFetchSecureMode     = 0x1;    ///< BIT(0)
static const UINT32 IFEFeatureMaskLiteMode            = 0x2;    ///< BIT(1)
static const UINT32 IFEFeatureMaskDynamicSensorSwitch = 0x4;    ///< BIT(2)
static const UINT32 IFEFeatureMaskSFEBinnedEPOCH      = 0x8;    ///< BIT(3)
static const UINT32 IFEFeatureMaskEPDSupport          = 0x10;   ///< BIT(4)
static const UINT32 SFEFeatureMaskOfflineEnableMode   = 0x20;   ///< BIT(5)
static const UINT32 SFEFeatureMaskSHDREnableMode      = 0x40;   ///< BIT(6)
static const UINT32 SFEFeatureMaskAEBEnableMode       = 0x80;   ///< BIT(7)
static const UINT32 IFEFeatureMaskYUV420Stream        = 0x400;   ///< BIT(10)


// CSID DRV Idle paths
static const UINT32  CSIDIdlePathMasks = IFEPXLPathMask |IFEPPDPathMask |IFERDI0PathMask| IFERDI1PathMask|
                                        IFERDI2PathMask |IFERDI3PathMask |IFERDI4PathMask| IFERDI5PathMask;




/// @brief IFE output Resource Information
struct ISPOutResourceInfo
{
    UINT32 resourceType;       ///< Resource type
    UINT32 format;             ///< Format of the output
    UINT32 width;              ///< Width of the output image
    UINT32 height;             ///< Height of the output image
    UINT32 compositeGroupId;   ///< Composite Group id of the group
    UINT32 splitPoint;         ///< Split point in pixels for Dual ISP case
    UINT32 secureMode;         ///< Output port to be secure or non-secure
    UINT32 reserved;           ///< Reserved field
};

/// @brief ISP output Resource Information
struct ISPOutResourceInfoVer2
{
    UINT32 resourceType;       ///< Resource type
    UINT32 format;             ///< Format of the output
    UINT32 width;              ///< Width of the output image
    UINT32 height;             ///< Height of the output image
    UINT32 compositeGroupId;   ///< Composite Group id of the group
    UINT32 splitPoint;         ///< Split point in pixels for Dual ISP case
    UINT32 secureMode;         ///< Output port to be secure or non-secure
    UINT32 wmMode;             ///< WM mode
    UINT32 outPortreserved1;   ///< Reserved field
    UINT32 outPortreserved2;   ///< Reserved field
};


/// @brief ISP output Resource Information
struct ISPOutResourceInfoVer3
{
    UINT32 version;            ///< Version
    UINT32 resourceType;       ///< Resource type
    UINT32 format;             ///< Format of the output
    UINT32 width;              ///< Width of the output image
    UINT32 height;             ///< Height of the output image
    UINT32 compositeGroupId;   ///< Composite Group id of the group
    UINT32 splitPoint;         ///< Split point in pixels for Dual ISP case
    UINT32 secureMode;         ///< Output port to be secure or non-secure
    UINT32 wmMode;             ///< WM mode
    UINT32 tunnelEnable;       ///< Tunneling Enable/Disable
    UINT32 outPortreserved1;   ///< Reserved field
    UINT32 outPortreserved2;   ///< Reserved field
    UINT32 outPortreserved3;   ///< Reserved field
};

/// @brief ISP input resource information
struct ISPInResourceInfo
{
    UINT32             resourceType;      ///< Resource type
    UINT32             laneType;          ///< Lane type (dphy/cphy)
    UINT32             laneNum;           ///< Active lane number
    UINT32             laneConfig;        ///< Lane configurations: 4 bits per lane
    UINT32             VC;                ///< Virtual Channel
    UINT32             DT;                ///< Data Type
    UINT32             format;            ///< Input Image Format
    UINT32             testPattern;       ///< Test Pattern for the TPG
    UINT32             usageType;         ///< Single ISP or Dual ISP
    UINT32             leftStart;         ///< Left input start offset in pixels
    UINT32             leftStop;          ///< Left input stop offset in pixels
    UINT32             leftWidth;         ///< Left input Width in pixels
    UINT32             rightStart;        ///< Right input start offset in pixels
    UINT32             rightStop;         ///< Right input stop offset in pixels
    UINT32             rightWidth;        ///< Right input Width in pixels
    UINT32             lineStart;         ///< Start offset of the pixel line
    UINT32             lineStop;          ///< Stop offset of the pixel line
    UINT32             height;            ///< Input height in lines
    UINT32             pixleClock;        ///< Sensor output clock
    UINT32             batchSize;         ///< Batch size for HFR mode
    UINT32             DSPMode;           ///< DSP Mode
    UINT32             HBICount;          ///< HBI Count
    UINT32             reserved;          ///< Reserved field
    UINT32             numberOutResource; ///< Number of the output resource associated
    ISPOutResourceInfo pDataField[1];     ///< Output Resource starting point
};


/// @brief ISP input resource information
struct ISPInResourceInfoVer2
{
    UINT32                 resourceType;              ///< Resource type
    UINT32                 laneType;                  ///< Lane type (dphy/cphy)
    UINT32                 laneNum;                   ///< Active lane number
    UINT32                 laneConfig;                ///< Lane configurations: 4 bits per lane
    UINT32                 VC[ISPMaxVCConfig];        ///< Virtual Channel
    UINT32                 DT[ISPMaxDTConfig];        ///< Data Type
    UINT32                 numValidVCDT;              ///< Number of valid VC and DT
    UINT32                 format;                    ///< Input Image Format
    UINT32                 testPattern;               ///< Test Pattern for the TPG
    UINT32                 usageType;                 ///< Single ISP or Dual ISP
    UINT32                 leftStart;                 ///< Left input start offset in pixels
    UINT32                 leftStop;                  ///< Left input stop offset in pixels
    UINT32                 leftWidth;                 ///< Left input Width in pixels
    UINT32                 rightStart;                ///< Right input start offset in pixels
    UINT32                 rightStop;                 ///< Right input stop offset in pixels
    UINT32                 rightWidth;                ///< Right input Width in pixels
    UINT32                 lineStart;                 ///< Start offset of the pixel line
    UINT32                 lineStop;                  ///< Stop offset of the pixel line
    UINT32                 height;                    ///< Input height in lines
    UINT32                 pixleClock;                ///< Sensor output clock
    UINT32                 batchSize;                 ///< Batch size for HFR mode
    UINT32                 DSPMode;                   ///< DSP Mode
    UINT32                 HBICount;                  ///< HBI Count
    UINT32                 customNode;                ///< Custom Node (SBI)
    UINT32                 numberOutResource;         ///< Number of the output resource associated
    UINT32                 offlineMode;               ///< Offline mode
    UINT32                 binningConfig;             ///< Binning: 0:15 - Set 1 for Horizontal, 16:31 - Set 1 for Vertical
    UINT32                 QCFABinning;               ///< Quad CFA binning
    UINT32                 inputResourcetype;         ///< Input Resource Type 0:15 SFE Input Type 16:31 IFE Input Type
    UINT32                 featureMask;               ///< Feature Flag indicators
    UINT32                 IFEReserved1;              ///< Reserved field
    UINT32                 sensorId;                  ///< Sensor ID
    ISPOutResourceInfoVer2 pDataField[1];             ///< Output Resource starting point
};


/// @brief ISP input resource information
struct ISPInResourceInfoVer3
{
    UINT32                 resourceType;              ///< Resource type
    UINT32                 laneType;                  ///< Lane type (dphy/cphy)
    UINT32                 laneNum;                   ///< Active lane number
    UINT32                 laneConfig;                ///< Lane configurations: 4 bits per lane
    UINT32                 VC[ISPMaxVCConfig];        ///< Virtual Channel
    UINT32                 DT[ISPMaxDTConfig];        ///< Data Type
    UINT32                 numValidVCDT;              ///< Number of valid VC and DT
    UINT32                 format;                    ///< Input Image Format
    UINT32                 testPattern;               ///< Test Pattern for the TPG
    UINT32                 usageType;                 ///< Single ISP or Dual ISP
    UINT32                 leftStart;                 ///< Left input start offset in pixels
    UINT32                 leftStop;                  ///< Left input stop offset in pixels
    UINT32                 leftWidth;                 ///< Left input Width in pixels
    UINT32                 rightStart;                ///< Right input start offset in pixels
    UINT32                 rightStop;                 ///< Right input stop offset in pixels
    UINT32                 rightWidth;                ///< Right input Width in pixels
    UINT32                 lineStart;                 ///< Start offset of the pixel line
    UINT32                 lineStop;                  ///< Stop offset of the pixel line
    UINT32                 height;                    ///< Input height in lines
    UINT32                 pixleClock;                ///< Sensor output clock
    UINT32                 batchSize;                 ///< Batch size for HFR mode
    UINT32                 DSPMode;                   ///< DSP Mode
    UINT32                 HBICount;                  ///< HBI Count
    UINT32                 customNode;                ///< Custom Node (SBI)
    UINT32                 numberOutResource;         ///< Number of the output resource associated
    UINT32                 offlineMode;               ///< Offline mode: 0:15 - Set 1 for offline mode, 16:31 - Set for groupId
    UINT32                 binningConfig;             ///< Binning: 0:15 - set 1 for Horizontal, 16:31 - set 1 for Vertical
    UINT32                 QuadCFABinning;            ///< Quad CFA binning
    UINT32                 inputResourcetype;         ///< Input Resource Type 0:15 SFE Input Type 16:31 IFE Input Type
    UINT32                 featureMask;               ///< Feature Flag indicators
    UINT32                 IFEReserved1;              ///< Reserved field
    UINT32                 IFEReserved2;              ///< Reserved field
    UINT32                 acquireType;               ///< Acquire Type - 0:None, 1:Virtual, 2:Hybrid, 3:Real
    UINT32                 sensorId;                  ///< Sensor ID
    UINT32                 sensorMode;                ///< Sensor Mode, not used by kmd, consider to remvoe
                                                      ///  refering to kmd API CopyInputInfoVer4
    UINT32                 contextId;                 ///< Context ID, under which the residing pipeline belongs to
    UINT32                 priority;                  ///< Priority indicates the stream priority in kmd for
                                                      ///  requests scheduling, one ife has one stream for now
    ISPOutResourceInfoVer3 pDataField[1];             ///< Output Resource starting point
};


/// @brief ISP resource acquire Information
struct ISPAcquireHWInfo
{
    UINT16 commonInfoVersion;             ///< Common Info Version represents the IFE common resource structure version
                                          ///< currently we dont have any common reosurce strcuture, It is reserved for future
                                          ///< HW changes in KMD
    UINT16 commonInfoSize;                ///< Common Info Size represents IFE common resource strcuture Size
    UINT16 commonInfoOffset;              ///< Common Info Offset represnts the Offset from where the IFE common resource
                                          ///< structure is stored in data
    UINT32 numInputs;                     ///< Number of IFE inpiut resources
    UINT32 inputInfoVersion;              ///< Input Info Strcure Version
    UINT32 inputInfoSize;                 ///< Size of the Input resource
    UINT32 inputInfoOffset;               ///< Offset where the Input resource structure starts in data
    UINT64 data;                          ///< IFE resource data
};

/// @brief IFE acquried Information, it same as KMD return structure
struct IFEAcquiredHWInfo
{
    UINT32    acquired_hw_id[IFEHWMaxCounts];                   ///< IFE HW mask list to show vaild HW used
    UINT32    acquired_hw_path[IFEHWMaxCounts][IFEHWMaxSplits]; ///< Path mask list per every IFEs
                                                                ///  Dual IFE using [0] and [1], others using [0]
    UINT32    valid_acquired_hw;                                ///< it shows how many hw be required
    UINT32    reservedYHWpath[IFEHWMaxCounts][IFEHWMaxSplits];  ///< IFE HW Mask to show Physical RDI port for Y towards YUV420 stream
    UINT32    reservedUVHWpath[IFEHWMaxCounts][IFEHWMaxSplits]; ///< IFE HW Mask to show Physical RDI port for UV towards YUV420 stream
};

/// @brief IFE Core Config
struct IFECoreConfig
{
    UINT32                 version;               ///< Version
    UINT32                 videoDS16R2PDEnable;   ///< Video DS16 R2PD
    UINT32                 videoDS4R2PDEnable;    ///< Video DS4 R2PD
    UINT32                 displayDS16R2PDEnable; ///< Display DS16 R2PD
    UINT32                 displayDS4R2PDEnable;  ///< Display DS4 R2PD
    UINT32                 DSPStreamingTapPoint;  ///< DSP Tap Point
    UINT32                 IHistSrcSel;           ///< IHist Src/tap-out Selection
    UINT32                 HDRBESrcSel;           ///< HDR BE Src/tap-out Selection
    UINT32                 HDRBHistSrcSel;        ///< HDR Bhist Src/tap-out Selection
    UINT32                 inputMuxSelPDAF;       ///< Input Mux selector PDAF
    UINT32                 inputMuxSelPP;         ///< Input Mux selector PP
    UINT32                 IFEPixelRawPort;       ///< IFE pixel raw path that is enabled
    UINT32                 videoFormat;           ///< Format of vido full output
    UINT32                 videoOutPackerEnable;  ///< Video full path output packer
    UINT32                 ai1OutPackerEnable;    ///< AI 1 path output packer
    UINT32                 ai2OutPackerEnable;    ///< AI 1 path output packer
    UINT32                 reserved;              ///< Reserved
};

/// @brief SFE Core Config
struct SFECoreConfig
{
    UINT32 version;                       ///< Version
    UINT32 SFEHDRModeSelect;              ///< SFE Mode Selcetion 1: Non HDR Mode 1:HDR
    UINT32 SFEOperatingModeSelect;        ///< SFE Operation mode whether inline or offline
    UINT32 SFEFSModeSelect;               ///< SFE Fast Shutter Mode Config Select
    UINT32 SFEParams[ISPMaxConfigParams]; ///< SFE Configuration Params Reserved fields for future use
};

/// @brief SFE Scratch Buffer Info
struct SFEScratchBufferInfo
{
    INT32  memHandle;                          ///< Memory Handle of the Scratch Buffer
    UINT32 offset;                             ///< Buffer Offset
    UINT32 width;                              ///< Buffer Width
    UINT32 height;                             ///< Buffer Height
    UINT32 stride;                             ///< Buffer Stride
    UINT32 sliceHeight;                        ///< Buffer Slice Height
    UINT32 resourceType;                       ///< Resource Type
    UINT32 initParams[ISPMaxConfigParams - 1]; ///< Init Params Reserved fileds for future use
};

struct ScratchBufferInfo
{
    INT32  memHandle;                          ///< Memory Handle of the Scratch Buffer
    UINT32 offset;                             ///< Buffer Offset
    UINT32 width;                              ///< Buffer Width
    UINT32 height;                             ///< Buffer Height
    UINT32 stride;                             ///< Buffer Stride
    UINT32 sliceHeight;                        ///< Buffer Slice Height
    UINT32 resourceType;                       ///< Resource Type
    UINT32 initParams[ISPMaxConfigParams - 1]; ///< Init Params Reserved fileds for future use
};

/// @brief IFE Init Scratch Buffer Config
struct IFEInitScratchBufferConfig
{
    UINT32                      numberOfPorts; ///< Number Of Ports that has scratch buffer configuration
    UINT32                      reserved;      ///< Reserved
    struct ScratchBufferInfo    bufferInfo[1]; ///< Buffer Info
};

struct VCDTInfo
{
    UINT32 VC;               ///< VC
    UINT32 DT;               ///< DT
    UINT32 streamSourceType; ///< stream Source Type
};

struct IFETrailingVCDTConfig
{
    UINT32          enableTrailingVCDT;              ///< enable trailing
    UINT32          numberOfValidVCDT;               ///< number of VC/DT need to enable
    struct VCDTInfo VCDT[ISPMaxTrailingVCDTConfig];  ///< trailing VC/DT Config
};

/// @brief SFE Init Scratch Buffer Config
struct SFEInitScratchBufferConfig
{
    UINT32                      numberOfPorts; ///< Number Of Ports that has scratch buffer configuration
    UINT32                      reserved;      ///< Reserved
    struct SFEScratchBufferInfo bufferInfo[1]; ///< Buffer Info
};

/// @brief IFE CPHY testgen core config
struct IFECPHYTesteGenCoreConfig
{
    UINT32 version;                               ///< Version
    UINT32 VCDTPatternId;                         ///< VC DT Pattern for testgen
    UINT32 QCFAEnable;                            ///< Testgen QCFA Output Enable
    UINT32 pixelPattern;                          ///< Pixel Pattern
    UINT32 horizaontalBlanking;                   ///< Horizontal blanking
    UINT32 verticalBlanking;                      ///< Vertical blanking
    UINT32 throttlePattern;                       ///< Throttle Pattern
    UINT32 testgenParams[ISPMaxConfigParams - 3]; ///< Reserved Params for future use
};

/// @brief Bandwidth configuration
struct ISPBwConfigV2
{
    static constexpr UINT8     axiPathSize = 1;
    UINT32                     usageType;                ///< Usage type (Single/Dual)
    UINT32                     numPaths;                 ///< Number of axi data paths
    CSLAXIperPathBWVote        axiPath[axiPathSize];     ///< Per path axi vote info
};

/// @brief IFE WM Config
struct IFEWMConfig
{
    UINT32 portID;         ///< unique ID of output port
    UINT32 mode;           ///< Wm Mode
    UINT32 hInit;          ///< Starting Pixel offset of the current WM stripe. Its in pixels
    UINT32 height;         ///< Height
    UINT32 width;          ///< Image width of the WM port
    UINT32 virtualFrameEn; ///< Virtual Frame enbale bit for WM port
    UINT32 stride;         ///< Stride
    UINT32 offset;         ///< Offset
    UINT32 addrReuseEn;    ///< Addr Re use Enable for the WM Port
    UINT32 packerFormat;   ///< WM Packer Format
    UINT32 reserved3;      ///< Reserved filed for future use
    UINT32 reserved4;      ///< Reserved field for future use
};

/// @brief IFE Out Config
struct IFEOutConfig
{
    UINT32 numOutputPorts;                                  ///< Number Of Output Ports
    UINT32 reserved;                                        ///< Reserved Field for future use
    struct IFEWMConfig outputPortConfig[ISPMaxOutputPorts]; ///< OutputPortConfig
};

/// @brief IFECSID EPD Config
struct IFECSIDEpdConfig
{
    UINT32 isEpdSupported;                                  ///< Filed to check sensor EPD support.
};

// HW type same as KMD defines
static const UINT32  ISPHwBase      = 0;
static const UINT32  ISPHwCSID      = 1;
static const UINT32  ISPHwVFE       = 2;
static const UINT32  ISPHwIFE       = 3;
static const UINT32  ISPHwISPIF     = 4;
static const UINT32  ISPHwIFELite   = 5;
static const UINT32  ISPHwCSIDLite  = 6;
static const UINT32  ISPHwMax       = 7;

/// @brief  A capability info for particular hw type
typedef struct
{
    UINT32       hwType;     ///< Hardware type
    UINT32       numHw;      ///< Number of hardwares of type @ hwType
    CSLVersion   hwVersion;  ///< Hardware version of type @ hwType
}CSLISPDeviceCapInfo;

typedef struct
{
    INT32 hNonSecureIOMMU;  ///< This CSLHw KMD device Non Secure IOMMU handle
    INT32 hSecureIOMMU;     ///< This CSLHw KMD device Secure IOMMU handle
}CSLIommuHandle;

/// @brief  Capabilities info for isp v2
typedef struct
{
    UINT32                      version;            ///< Version
    INT32                       numDevices;         ///< Number of device capabilities
    UINT32                      ispCtxQueueDepth;   ///< isp context queue depth
    UINT32                      reserved;           ///< reserved field
    CSLIommuHandle              hMapIOMMU;          ///< iommu handle for device
    CSLIommuHandle              hMapCDMIOMMU;       ///< iommu handle for CDM
    CSLISPDeviceCapInfo         devCaps[ISPHwMax];  ///< device capability array
} CSLISPCapabilityV2;

/// @brief  Capabilities info for isp
typedef struct
{
    CSLIommuHandle              hMapIOMMU;          ///< iommu handle for device
    CSLIommuHandle              hMapCDMIOMMU;       ///< iommu handle for CDM
    INT32                       numDevices;         ///< Number of device capabilities
    UINT32                      reserved;           ///< reserved field
    CSLISPDeviceCapInfo         devCaps[ISPHwMax];  ///< device capability array
} CSLISPCapability;

/// @brief FFE WM exposure Config
struct SFEWMExposureOrderConfig
{
    UINT32 portID;       ///< CSLPort ID
    UINT32 reserved[5];  ///< Reserved field
};

/// @bried SFE Exposure Config
struct SFEExposureConfig
{
    UINT32 numOutputPorts;                             ///< Number of Output Ports
    UINT32 reserved;                                   ///< Reserved field
    struct SFEWMExposureOrderConfig SFEWMExpConfig[3]; ///< WM Exposure Config
};

/// @brief IFE WM BW Limit Config
struct IFEWMBWLimitConfig
{
    UINT32 portId;                        ///< IFE CSL PortId
    UINT32 IsUpdated;                     ///< Is DisplayFull/VideoFull Enabled
    UINT32 IFEWMBwLimitCounterLimit[3];   ///< IFE WM BW_LIMIT::COUNTER_LIMIT Config Value per Plane
    UINT32 reserved[5];                   ///< Reserved Field
};

/// @brief IFE WM BW Limit Config
struct OfflineIFEBWLIMITConfig
{
    UINT32 numOutputPorts;                  ///< Number Of Output Ports
    UINT32 reserved;                        ///< Reserved field
    struct IFEWMBWLimitConfig BWLimit[2];   ///< IFE WM BW_LIMIT Config per Port
};

///@brief Mode Switch Info
struct IFEModeSwitchUpdateInfo
{
    UINT32 modeUpdateBit;     ///< Mode Update Bit  0: Even vc 1: Odd VC
    UINT32 numberOfExposures; ///< NUmber of exposures
    UINT32 reserved;          ///< Reserved Field
};

///@brief LCR RDI Config
struct IFELCRRDIConfig
{
    UINT32 portID;       ///< LCR RDI Port ID
    UINT32 reserved[5];  ///< Reserved Field
};

///@brief Percentage factor of EPOCH w.r.t Frame Height
struct IFEEPOCHConfig
{
    UINT32 epochFactor;
};

///@brief IFE INIT Config consumed by KMD before Streamon
struct IFEINITConfig
{
    struct IFEEPOCHConfig epochConfig;
    UINT32 additionalParams[19];
};

///@brief DRV CSID Config
struct IFECSIDDRVConfig
{
    UINT32    DRVEnableBit;     ///< DRV enable Bit
    UINT32    timeoutVal;       ///< time out value in GC Cycle
    UINT32    pathIdleEn;       ///< Path Idle
    UINT32    numValidParams;   ///< number of valid params
    UINT32    validParamMask;   ///< valid_param_mask
    UINT32    params[5];        ///< Reserved Field
};

///@brief Indicate which of pixel and stats path is enabled for FCG
static const UINT32 FCGEnableMaskPixel = 0x1;
static const UINT32 FCGEnableMaskStats = 0x2;

///@brief Indicate which channel is being configured for FCG, 1 for IFE, 2 and 4 for SFE
static const UINT32 IFEFCGChannel0 = 0x1;
static const UINT32 SFEFCGChannel1 = 0x2;
static const UINT32 SFEFCGChannel2 = 0x4;

///@brief Indices for channelFCGConfig structs in FCGConfig, FCG on stats and pixel path need to fill same struct
enum FCGChannelIndex
{
    IFEChannelIndex       = 0,      ///< For IFE Channel 0
    SFEChannelIndexShort  = 0,      ///< Assigned to 0 because short channel is always enabled in SFE
    SFEChannelIndexMedium = 1,      ///< Used for medium exposure channel when it is enabled
};

///@brief FCG config predict for future
typedef struct
{
    UINT32 version;          ///< FCG Version
    UINT32 phaseIndexG;      ///< LUT index for G for pixel path
    UINT32 phaseIndexR;      ///< LUT index for R for pixel path
    UINT32 phaseIndexB;      ///< LUT index for B for pixel path
    UINT32 statsIndexG;      ///< LUT index for G for stats path
    UINT32 statsIndexR;      ///< LUT index for R for stats path
    UINT32 statsIndexB;      ///< LUT index for B for stats path
    UINT32 numValidParams;   ///< number of valid params
    UINT32 validParamMask;   ///< valid_param_mask
    UINT32 params[5];        ///< Reserved Field
}PredictFCGConfig;

///@brief FCG Config for a single channel
typedef struct
{
    UINT32           version;                      ///< Version info
    UINT32           FCGChannelId;                 ///< Current channel ID
    UINT32           FCGEnableMask;                ///< Determine which paths are enabled
    UINT32           numValidParams;               ///< number of valid params
    UINT32           validParamMask;               ///< valid_param_mask
    UINT32           params[5];                    ///< Reserved Field
    PredictFCGConfig predictedFCGConfig[3];        ///< FCG prediction for future frames
}ChannelFCGConfig;

///@brief FCG Config for a single frame
typedef struct
{
    UINT32           version;                 ///< Version info
    UINT32           size;                    ///< Size of the FCG Config
    UINT32           numChannels;             ///< Number of channels for FCG
    UINT32           numPredictions;          ///< Number of predictions of each channel
    UINT32           numValidParams;          ///< number of valid params
    UINT32           validParamMask;          ///< valid_param_mask
    UINT32           params[4];               ///< Reserved Field
    ChannelFCGConfig channelFCGConfig[2];     ///< Pointer to fcg config for each channel
}FCGConfig;

CAMX_NAMESPACE_END
#endif // CAMXCSLISPDEFS_H
