#ifndef QSEE_SEC_CAMERA_H
#define QSEE_SEC_CAMERA_H

/**
@file qsee_sec_camera.h
@brief Provide Secure Display functionality
*/

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

/*===========================================================================

                            EDIT HISTORY FOR FILE

when       who      what, where, why
--------   ---      ------------------------------------
07/16/17   dr       Add mink callback object registration
03/20/17   dr       Add Haven license support
10/30/16   dr       Add 8998 support and ISPIF/CSID regions
05/12/16   ak       Add streaming status control functions
04/25/16   ak       Add CCI address space access functions
04/18/16   sn       Initial version
===========================================================================*/

#include <stdint.h>
#include <stddef.h>
#include "object.h"
/** @cond */

typedef enum {
  QSEE_SEC_CAM_REG_MMSS_A_CCI    = 0,
  QSEE_SEC_CAM_REG_MMSS_A_CSID_0 = 1,
  QSEE_SEC_CAM_REG_MMSS_A_CSID_1 = 2,
  QSEE_SEC_CAM_REG_MMSS_A_CSID_2 = 3,
  QSEE_SEC_CAM_REG_MMSS_A_CSID_3 = 4,
  QSEE_SEC_CAM_REG_MMSS_A_ISPIF   = 5,
} qsee_sec_cam_register_region_t;
/** @endcond */

/*----------------------------------------------------------------------------
 * Function Declarations and Documentation
 * -------------------------------------------------------------------------*/

/**
  @addtogroup qtee_sec_camera
  @{
*/

/**
  Deprecated API.

  @param[out] sessionID   Current secure camera session ID; 0 if
                          no session is active.

  @return
  SUCCESS -- 0 \n
  FAILURE -- -1

*/
int qsee_sec_camera_get_session(uint32_t *sessionID);

/**
  Deprecated API.

  @param[in] sessionID    Current secure camera session ID.

  @return
  SUCCESS -- 0 \n
  FAILURE -- -1

*/
int qsee_sec_camera_acquire_camera(uint32_t sessionID);

/**
  Deprecated API.

  @param[in] sessionID    Current secure camera session ID.

  @return
  SUCCESS -- 0 \n
  FAILURE -- -1

*/
int qsee_sec_camera_release_camera(uint32_t sessionID);

/**
  Deprecated API.

  @param[in] registerRegionId  Register region identifier, e.g., MMSS_A_CCI.
  @param[in] offset            Offset at register region.
  @param[in] data              Data to write.

  @return
  SUCCESS -- 0 \n
  FAILURE -- -1

*/
int qsee_sec_camera_register_write(qsee_sec_cam_register_region_t registerRegionId,
                                   uint32_t offset, uint32_t data);

/**
  Deprecated API.

  @param[in] registerRegionId  Register region identifier, e.g., MMSS_A_CCI.
  @param[in] offset            Array of offsets at the register region.
  @param[in] offset_len        Number of items in the offset array.
  @param[in] data              Array of data values to write (corresponding to the offsets).
  @param[in] data_len          Number of items in data array.

  @return
  SUCCESS -- 0 \n
  FAILURE -- -1

*/
int qsee_sec_camera_register_bulk_write(qsee_sec_cam_register_region_t registerRegionId,
                                        uint32_t offset[], size_t offset_len,
                                        uint32_t data[], size_t data_len);

/**
  Deprecated API.

  @param[in]  registerRegionId  Register region identifier, e.g., MMSS_A_CCI.
  @param[in]  offset            Offset at the register region.
  @param[out] data_ptr          Returned data.

  @return
  SUCCESS -- 0 \n
  FAILURE -- -1

*/
int qsee_sec_camera_register_read(qsee_sec_cam_register_region_t registerRegionId,
                                  uint32_t offset, uint32_t *data_ptr);

/**
  Deprecated API.

  @param[in]  licenseCert_ptr   Pointer to buffer containing the certificate in DER format.
  @param[in]  licenseCert_len   Certificate data length (in bytes).
  @param[out] havenError_ptr    Haven license validation result.\n
                                0 means success.\n
                                See IHavenTokenApp.h for more details on the error values.

  @detdesc
  Deprecated API.

  @return
  SUCCESS -- 0 \n
  FAILURE -- -1

*/
int qsee_sec_camera_set_haven_license(const uint8_t* licenseCert_ptr, size_t licenseCert_len,
                                      int32_t* havenError_ptr);

/**
  Deprecated API.

  @param [in]  callback_object   MINK object of type ISecureCameraClientEvent.

  @return
  SUCCESS -- 0 \n
  FAILURE -- -1

*/
int qsee_sec_camera_register_callback(Object callback_object);

/** @} */

#endif /* QSEE_SEC_CAMERA_H */
