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

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @file  camxcsljpegdefs.h
/// @brief JPEG Hardware Interface Definiation
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

#ifndef CAMXCSLJPEGDEFS_H
#define CAMXCSLJPEGDEFS_H

#include "camxcsl.h"
#include "camxcslresourcedefs.h"
#include "camxdefs.h"

CAMX_BEGIN_PACKED

// JPEG Command Buffer Metadata types
static const UINT32 CSLJPEGENCCmdBufferConfigData       = 0x00; ///< ENC CDM command buffer submitted to HW
static const UINT32 CSLJPEGDMACmdBufferPlane0ConfigData = 0x01; ///< DMA CDM command buffer plane 0 submitted to HW
static const UINT32 CSLJPEGDMACmdBufferPlane1ConfigData = 0x02; ///< DMA CDM command buffer plane 1 submitted to HW
static const UINT32 CSLJPEGPacketINOUTParam             = 0x03; ///< Input Output Params command buffer
static const UINT32 CSLJPEGPacketGenericBlob            = 0x04; ///< Generic Blob command buffer

/// JPEG Generic Blob types
static const UINT32 CSLJPEGBlobTypeThumbSize            = 0x01; ///< Thumbnail threshold size


/// @brief JPEG hardware version information
struct CSLJPEGDeviceVersion
{
    UINT32      size;       ///< Reserved field to force size as a multiple of 64bits
    CSLVersion  version;    ///< Device version
    UINT32      deviceType; ///< Device type for the cap info(CSLJPEGDeviceType)
} CAMX_PACKED;

/// @brief JPEG device capability information
///         Contains information about firmware and its API version along with number of Encoder and DMA resources available
struct CSLJPEGQueryCapabilityCmd
{
    CSLVersion           APIVersion;                                         ///< API version info
    UINT32               numENC;                                             ///< Number of encoders
    UINT32               numDMA;                                             ///< Number of DMA
    CSLJPEGDeviceVersion deviceVersion[CSLJPEGResourceIDMaxNumResources];    ///< Returned device capability array

} CAMX_PACKED;

/// @brief JPEG resource characteristics (dimension and format) information
struct CSLJPEGResourceInfo
{
    UINT32      format;   ///< Image format
    UINT32      width;    ///< Image width
    UINT32      height;   ///< Image height
    UINT32      FPS;      ///< Stream frame per second
} CAMX_PACKED;

/// @brief JPEG acquire device information
struct CSLJPEGAcquireDeviceInfo
{
    UINT32                resourceType;     ///< Resource type (Encoder decoder dma)
    CSLJPEGResourceInfo   inputResource;    ///< Input resource info struct
    CSLJPEGResourceInfo   outputResource;   ///< Input resource info struct
} CAMX_PACKED;

/// @brief JPEG Config Input Params
struct CSLJPEGConfigInputInfo
{
    INT32   clk_index;     ///< jpeg hw clock index to be selected (-1 default)
    INT32   output_size;   ///< jpeg encode/dma output size.
} CAMX_PACKED_ALIGN_N(8);

/// @brief Thumbnail Size threshold
struct CSLJPEGThumbThreshSize
{
    UINT32              thresholdSize;      ///< Size threshold for JPEG Thumbnail
    UINT32              reserved[3];        ///< Reserved for alignment
} CAMX_PACKED;

CAMX_END_PACKED

#endif // CAMXCSLJPEGDEFS_H
