// Copyright (c) Qualcomm Technologies, Inc.
// All Rights Reserved.
// Confidential and Proprietary - Qualcomm Technologies, Inc.

include "ITrustedCameraDriverNotify.idl"

/**
 * @addtogroup ITrustedCameraDriver
 * @{
 */

/** @cond */

/**
 * Maximum no. of ports which can be configured
 */
const uint16 PORT_MAX = 65;

/**
 * Flag to configure the state of a port
 */
const uint8 PROTECT_PORT = 1;
const uint8 UNPROTECT_PORT = 0;

/**
 * Struct containing values for programming of domain ID
 *
 * @version:            Version info
 * @protect:            To protect or reset the lanes
 * @csid_hw_idx_mask:   Bit position denoting CSID in use
 * @cdm_hw_idx_mask:    Bit position denoting CDM in use
 * @vc_mask:            VC mask for identifying domain
 * @phy_lane_sel_mask:  PHY lane info - contains CPHY, DPHY and PHY ID values
 *                      0-15 bits -- PHY index
 *                      16-23 bits -- CPHY lanes
 *                      24-31 bits -- DPHY lanes
 * @reserved:           Reserved bit
 */
struct ITCDriverSensorInfo {
    uint32 version;
    uint32 protect;
    uint32 csid_hw_idx_mask;
    uint32 cdm_hw_idx_mask;
    uint64 vc_mask;
    uint64 phy_lane_sel_mask;
    uint64 reserved;
};

/**
 * Struct containing values for configuration of ports
 *
 * @hw_type:            Type of device to be configured(IFE, IFE LITE, IPE,..)
 * @hw_id_mask:         Mask for IDs of the devices
 * @protect:            Protect or unprotect the ports
 * @phy_id:             Phy ID for real time engines only
 * @num_ports:          Number of ports that are going to get configured
 * @port_config_id:     To specify what all ports need to be configured
 *                      for the device(s) specified in the mask of type enum.
 *                      It's an array of size PORT_MAX, which indicates
 *                      the maximum number of ports available for any device.
 *                      The number of ports to be configured from this array is
 *                      defined by 'num_ports'
 */

struct PortInfo {
	uint32 hw_type;
	uint32 hw_id_mask;
	uint32 protect;
	uint32 phy_id;
	uint32 num_ports;
	uint32[65] port_id;
};

//--------------------------------------------------------
//  Corresponds to enum tfe_output_port_id.
//--------------------------------------------------------

/**
 * Specifies all the ports possible in TFE.
 */

const uint32 TFE_FULL = 0;
const uint32 TFE_DC4_Y = 1;
const uint32 TFE_DC4_C = 2;
const uint32 TFE_DC16_Y = 3;
const uint32 TFE_DC16_C = 4;
const uint32 TFE_DS2_Y = 5;
const uint32 TFE_DS2_C = 6;
const uint32 TFE_FD_Y = 7;
const uint32 TFE_FD_C = 8;
const uint32 TFE_IR_OUT = 9;
const uint32 TFE_PDAF_0 = 10;
const uint32 TFE_PDAF_1 = 11;
const uint32 TFE_PDAF_2 = 12;
const uint32 TFE_PDAF_3 = 13;
const uint32 TFE_RDI_0 = 14;
const uint32 TFE_RDI_1 = 15;
const uint32 TFE_RDI_2 = 16;
const uint32 TFE_RDI_3 = 17;
const uint32 TFE_RDI_4 = 18;
const uint32 TFE_SECURE_FRAME_HEADER = 19;

//--------------------------------------------------------
//  Corresponds to enum ife_lite_output_port_id.
//--------------------------------------------------------

/**
 * Specifies all the ports possible in IFE_LITE.
 */

const uint32 IFE_LITE_RDI_0_OUT = 0;
const uint32 IFE_LITE_RDI_1_OUT = 1;
const uint32 IFE_LITE_RDI_2_OUT = 2;
const uint32 IFE_LITE_RDI_3_OUT = 3;
const uint32 IFE_LITE_GAMMA = 4;
const uint32 IFE_LITE_SECURE_FRAME_HEADER = 5;
const uint32 IFE_LITE_GAMMA_MNDS_Y_CP_EN = 6;
const uint32 IFE_LITE_GAMMA_2 = 7;
const uint32 IFE_LITE_GAMMA_1 = 8;

//--------------------------------------------------------
//  Corresponds to enum ife_output_port_id.
//--------------------------------------------------------

/**
 * Specifies all the ports possible in IFE.
 */

const uint32 IFE_VIDEO_OUT = 0;
const uint32 IFE_FD_OUT = 1;
const uint32 IFE_PIXEL_RAW_DUMP_OUT = 2;
const uint32 IFE_PDAF_OUT = 3;
const uint32 IFE_RDI_0_OUT = 4;
const uint32 IFE_DISPLAY_FULL_OUT = 5;
const uint32 IFE_CAMIF_PD = 6;
const uint32 IFE_LCR = 7;
const uint32 IFE_RDI_1_OUT = 8;
const uint32 IFE_RDI_2_OUT = 9;
const uint32 IFE_BAYER_LTM_OUT = 10;
const uint32 IFE_SECURE_FRAME_HEADER = 11;

//--------------------------------------------------------
//  Corresponds to enum ipe_output_port_id.
//--------------------------------------------------------

/**
 * Specifies all the ports possible in IPE.
 */

const uint32 IPE_DISP_C = 0;
const uint32 IPE_DISP_Y = 1;
const uint32 IPE_VID_C = 2;
const uint32 IPE_VID_Y = 3;
const uint32 IPE_TF_DS4_YC = 4;
const uint32 IPE_TF_C = 5;
const uint32 IPE_TF_Y = 6;
const uint32 IPE_TFI = 7;
const uint32 IPE_PDI = 8;
const uint32 IPE_BLUR_MAP = 9;
const uint32 IPE_APP_Y = 10;
const uint32 IPE_APP_C = 11;
const uint32 IPE_HDR_LM1 = 12;
const uint32 IPE_HDR_LM2 = 13;
const uint32 IPE_LTM_MASK_OUT = 14;
const uint32 IPE_LTM_MAX_MIN = 15;
const uint32 IPE_GS = 16;
const uint32 IPE_HDR_HLW1 = 17;
const uint32 IPE_HDR_HLW2 = 18;
const uint32 IPE_SECURE_FRAME_HEADER = 19;
const uint32 IPE_DS_C = 20;
const uint32 IPE_DS_Y = 21;

/** @endcond */

/** @cond */
interface ITrustedCameraDriver {
/** @endcond */

/**
  Error code
 */
  error ERROR_NOT_ALLOWED;     /**< Invalid request to configure FD port */

/**
    Camera HW types
 */
    const uint32 IFE              = 0;
    const uint32 IFE_LITE         = 1;
    const uint32 IPE              = 2;
    const uint32 TFE              = 3;
    const uint32 HWType_MAX       = 4;

/**
  Description: This method allows protecting a camera sensor based on the sensor information provided.

  @param [in] phy_info: Camera HW settings required for securing the usecase

  @return
  Object_OK on success.
 */
    method dynamicProtectSensor (in ITCDriverSensorInfo phy_info);

/**
  Description: This method gets the current version info.

  @param[out] arch_ver: architecture version info
  @param[out] max_ver: max version info
  @param[out] min_ver: min version info

  @return
  Object_OK on success.
 */
    method getVersion(out uint32 arch_ver, out uint32 max_ver, out uint32 min_ver);

/**
  Description: This method registers a callback to the trusted camera driver.

  @param [in] cb: the callback called by the trusted camera driver

  @return
  Object_OK on success.
 */
    method registerNotifyCB(in ITrustedCameraDriverNotify cb);

/**
  Description: Dynamic configuration to allow secure/non-secure FD port on all the CSIDs

  @param [in] protect: To secure or non-secure the FD port.

  @return
  Object_OK on success.
 */
    method dynamicConfigureFDPort(in uint32 protect);

/**
  Description: This method allows dynamically configuring ports of camera hw_type.

  @param [in] port_info: Array indicating which ports to be configured for the hw_type specified. They can be protected or not-protected depending on the request. 

  @return
  Object_OK on success.
 */
    method dynamicConfigurePortsV2(in PortInfo[] port_info);
};
