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

/**
 * @brief
 * Common definitions and APIs used for Output Protection
 */
/** @cond */
/** Topology Info **/
struct HdcpTopology {
   uint32 depth;
   /**< Repeater cascade depth. */

   uint32 deviceCount;
   /**< Number of attached downstream devices. */

   uint32 maxDevicesExceeded;
   /**< Topology error indicator. When set to one,
        more than 31 downstream devices are attached */

   uint32 maxCascadeExceeded;
   /**< Topology error indicator. When set to one,
        more than four levels of repeaters have been
        cascaded together. */

   uint32 hdcp2LegacyDeviceDownstream;
   /**< When set to one, indicates presence of an
        HDCP2.0 or HDCP2.1 compliant device in the
        topology. */

   uint32 hdcp1DeviceDownstream;
   /**< When set to one, indicates presence of an
        HDCP1.x compliant device in the topology. */
};
/** @endcond */

/** @cond */
interface IOPS {
/** @endcond */

  /**
   * @addtogroup IOPS
   * @{
   */

  /** @cond */
  /**
   * HDCP Protection levels that can be set or retrieved by DRM and HDCP Tx TAs
   * using Output Protection and HdcpTransmitter interfaces
   *
   * Encryption levels
   * NO HDCP - 0
   * HDCP Level 1.0 - 1
   * HDCP Level 2.0 - 2
   * HDCP Level 2.1 - 3
   * HDCP Level 2.2 - 4
   * HDCP Level 2.3 - 5
   *
   * LOCAL DISPLAY ONLY - 0x0F set by DRM to block external display
   *
   * No Digital Output - 0xFF  HDCP capability
   *
   */
  const uint8 HDCP_LEVEL_0 = 0x00; /* NO HDCP */
  const uint8 HDCP_LEVEL_1 = 0x01; /* HDCP Level 1.0 */
  const uint8 HDCP_LEVEL_2 = 0x02; /* HDCP Level 2.0 */
  const uint8 HDCP_LEVEL_3 = 0x03; /* HDCP Level 2.1 */
  const uint8 HDCP_LEVEL_4 = 0x04; /* HDCP Level 2.2 */
  const uint8 HDCP_LEVEL_5 = 0x05; /* HDCP Level 2.3 */
  const uint8 DRM_LOCAL_DISPLAY_ONLY = 0x0F; /* Local Display only */
  const uint8 NO_DIGITAL_OUTPUT = 0xFF; /* No Digital Output */

  /**
   * Default SRM version
   */
  const uint16 HDCP_SRM_DEFAULT_VERSION = 0;

  /**
   * Corresponds to enum qsee_hdcp_device_t
   * These constants define the device types
   */
  const uint32 HDCP_TXMTR_HDMI    = 0x8001;
  const uint32 HDCP_TXMTR_DP      = 0x8002;
  const uint32 HDCP_TXMTR_WIFI    = 0x8003;
  const uint32 HDCP_TXMTR_DSI0    = 0x8004;
  const uint32 HDCP_TXMTR_DSI1    = 0x8005;
  const uint32 HDCP_TXMTR_DP1     = 0x18004;
  const uint32 HDCP_TXMTR_DP2     = 0x18006;
  const uint32 HDCP_TXMTR_DP3     = 0x18008;
  const uint32 HDCP_TXMTR_DP_MST  = 0x18003;
  const uint32 HDCP_TXMTR_DP1_MST = 0x18005;
  const uint32 HDCP_TXMTR_DP2_MST = 0x18007;
  const uint32 HDCP_TXMTR_DP3_MST = 0x18009;
  const uint32 HDCP_TXMTR_DP4     = 0x18010;
  const uint32 HDCP_TXMTR_DP5     = 0x18012;
  const uint32 HDCP_TXMTR_DP6     = 0x18014;
  const uint32 HDCP_TXMTR_DP7     = 0x18016;
  const uint32 HDCP_TXMTR_DP4_MST = 0x18011;
  const uint32 HDCP_TXMTR_DP5_MST = 0x18013;
  const uint32 HDCP_TXMTR_DP6_MST = 0x18015;
  const uint32 HDCP_TXMTR_DP7_MST = 0x18017;
  /**
   * These constants define the device types for serializer TA
   */
  const uint32 HDCP_TXMTR_DP_SERIALIZER   = 0xA002;
  const uint32 HDCP_TXMTR_DP1_SERIALIZER  = 0xA004;
  const uint32 HDCP_TXMTR_DSI0_SERIALIZER = 0xB002;
  const uint32 HDCP_TXMTR_DSI1_SERIALIZER = 0xB004;
  const uint32 ALL_EXT_DISP       = 0xffff;
  /** @endcond */

  /**
    Gets current OPS implementation version.

    @param[out] version  Version number.

    @return
    Object_OK on success.
  */
   method getOPSVersion(out uint32 version);

  /**
    Gets current and maximum supported HDCP levels.

    @param[out] currHdcpLevel Current HDCP version based on the device
                              itself and the display to which it is connected.
    @param[out] maxHdcpLevel  Maximum supported HDCP version for 
                              device, ignoring any attached device.

    @return
    Object_OK on success.
  */
  method getHDCPCapability(out uint8 currHdcpLevel, out uint8 maxHdcpLevel);

  /**
    - Aggregated topology with received ID list for a particular device.
    - Used by DRM TAs like WFD RX to find the downstream topology for
    each device type.

    @param[in]  deviceId        Topology requested for a particular device.
    @param[out] receiverIdList  Downstream device ID list.
    @param[out] hdcpTopology    Provides receiver ID list and information
                                on connected downstream legacy devices.

    @return
    Object_OK on success.
  */
  method getDeviceTopology(in uint32 deviceId, out uint8[] receiverIdList,
                           out HdcpTopology hdcpTopology);

  /**
    Gets current DRM content protection level enforced by OPS.

    @param[out] cpl  Content protection level = max( all DRM OPLs ).
    @param[out] epl  Final protection level enforced by OPS.
    @param[out] type Type 0 or 1. \n
                     Type enforced by OPS.

    @return
    Object_OK on success.
  */
  method getContentProtectionLevel(out uint8 cpl, out uint8 epl, out uint8 type);
  /* @} */ /* end_addtogroup IOPS */
};

