/**
 * Copyright (C) 2011 Samsung Electronics Co., Ltd. All rights reserved.
 *
 * Mobile Communication Division,
 * Digital Media & Communications Business, Samsung Electronics Co., Ltd.
 *
 * This software and its documentation are confidential and proprietary
 * information of Samsung Electronics Co., Ltd.  No part of the software and
 * documents may be copied, reproduced, transmitted, translated, or reduced to
 * any electronic medium or machine-readable form without the prior written
 * consent of Samsung Electronics.
 *
 * Samsung Electronics makes no representations with respect to the contents,
 * and assumes no responsibility for any errors that might appear in the
 * software and documents. This publication and the contents hereof are subject
 * to change without notice.
 *
 */

 /**
 * @file hdcp2_exynos.h
 * @author
 * @date
 * @brief This file contains all the variable and structure definitions used by exynos chipset
 */

#ifndef _HDCP2_EXYNOS_H_
#define _HDCP2_EXYNOS_H_

#ifdef __cplusplus
extern "C" {
#endif

#include "MobiCoreDriverApi.h"

// TrustLet UUID
/**
 * @def TL_HDCP2_TRANSMITTER_UUID
 *
 * This macro is assigned a value of {{0xff, 0xff, 0xff, 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}} to be maintained everywhere.
 *
 */
#define TL_HDCP2_TRANSMITTER_UUID {{0xff, 0xff, 0xff, 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}}

/**
 * @def TL_HDCP2_RECEIVER_UUID
 *
 * This macro is assigned a value of {{0xff, 0xff, 0xff, 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}} to be maintained everywhere.
 *
 */
#define TL_HDCP2_RECEIVER_UUID {{0xff, 0xff, 0xff, 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5}}

typedef uint32_t tciCommandId_t;
typedef uint32_t tciResponseId_t;
typedef uint32_t tciReturnCode_t;

/**
 * @def RSP_ID_MASK
 *
 * This macro is assigned a value of (1U << 31) to be maintained everywhere.
 *
 */
#define RSP_ID_MASK (1U << 31)

/**
 * @def RSP_ID(cmdId)
 *
 * This macro is assigned a value of (((uint32_t)(cmdId)) | RSP_ID_MASK) to be maintained everywhere.
 *
 */
#define RSP_ID(cmdId) (((uint32_t)(cmdId)) | RSP_ID_MASK)

/**
 * @def IS_CMD(cmdId)
 *
 * This macro is assigned a value of ((((uint32_t)(cmdId)) & RSP_ID_MASK) == 0) to be maintained everywhere.
 *
 */
#define IS_CMD(cmdId) ((((uint32_t)(cmdId)) & RSP_ID_MASK) == 0)


/**
 * @def IS_RSP(cmdId)
 *
 * This macro is assigned a value of ((((uint32_t)(cmdId)) & RSP_ID_MASK) == RSP_ID_MASK) to be maintained everywhere.
 *
 */
#define IS_RSP(cmdId) ((((uint32_t)(cmdId)) & RSP_ID_MASK) == RSP_ID_MASK)

/**
 * @def RET_OK
 *
 * This macro is assigned a value of 1000 to be maintained everywhere.
 *
 */
#define RET_OK	1000 /**< Set, if processing is error free */

/**
 * @def RET_ERR_UNKNOWN_CMD
 *
 * This macro is assigned a value of 1001 to be maintained everywhere.
 *
 */
#define RET_ERR_UNKNOWN_CMD	1001 /**< Unknown command */

/**
 * @def RET_CUSTOM_START
 *
 * This macro is assigned a value of 1002 to be maintained everywhere.
 *
 */

#define RET_CUSTOM_START	1002

/**
 * @def RET_ERR_MAP
 *
 * This macro is assigned a value of 1003 to be maintained everywhere.
 *
 */
#define RET_ERR_MAP	1003

/**
 * @def RET_ERR_UNMAP
 *
 * This macro is assigned a value of 1004 to be maintained everywhere.
 *
 */
#define RET_ERR_UNMAP	1004

/**
 * @def EXIT_ERROR
 *
 * This macro is assigned a value of ((uint32_t)(-1)) to be maintained everywhere.
 *
 */
#define EXIT_ERROR	((uint32_t)(-1))

/**
 * @struct tciCommandHeader_t
 *
 * This structure contains information regarding TCI command header
 */
typedef struct {
	tciCommandId_t commandId; /**< Command ID */
} tciCommandHeader_t;

/**
 * @struct tciResponseHeader_t
 *
 * This structure contains information regarding TCI response header
 */
typedef struct {
	tciResponseId_t responseId; /**< Response ID (must be command ID | RSP_ID_MASK )*/
	tciReturnCode_t returnCode; /**< Return code of command */
} tciResponseHeader_t;

/**
 * @struct request_t
 *
 * This structure contains information regarding request
 */
typedef struct {
	tciCommandHeader_t header;
	uint8_t* buffer;
	uint8_t offset;
	size_t length;
} request_t;

/**
 * @struct response_t
 *
 * This structure contains information regarding response
 */
typedef struct {
	tciResponseHeader_t header;
	size_t length;
	uint8_t buffer[1024];
} response_t;

/**
 * @struct request_static_t
 *
 * This structure contains information regarding common command
 */
typedef struct {
	tciCommandHeader_t header;
	uint8_t buffer[1024];
	uint8_t offset;
	size_t length;
} request_static_t;

/**
 * @union tciMessage_t
 *
 * This union contains information regarding tci
 */
typedef union {
	tciCommandHeader_t commandHeader;
	tciResponseHeader_t responseHeader;
	request_t request;
	response_t response;
	request_static_t request_static;
} tciMessage_t;

/**
 * @struct tci_t
 *
 * This structure contains information regarding trustlet message
 */
typedef struct {
	tciMessage_t message;
} tci_t;

#ifdef __cplusplus
}
#endif

#endif /* !HDCP2_EXYNOS_H_ */
