#ifndef TZ_HDM_OPERATIONS_H_
#define TZ_HDM_OPERATIONS_H_

#include "hdm_tata_common.h"

typedef enum hdm_error_code {
    HDM_TATA_SUCCESS = 0,
    HDM_PERMISSION_DENIED,
    HDM_UNKNOWN_TYPE,
    HDM_COMMAND_DENY,
    HDM_ERROR_SESSION_FAILED,
    HDM_ERROR_COMMAND_FAILED,
    HDM_KG_UNBLOCK_ERROR,
    HDM_KG_BLOCK_ERROR,
    HDM_KG_NOT_ACTIVATED,
    HDM_TATA_ERROR = 0xFFFFFFFF
} hdm_error_code_t;

/*
 *
 * KG Commands
 * 
 */
#define KG_BLOCK_CMD        0x00000001
#define KG_UNBLOCK_CMD      0x00000002
#define KG_GET_STATUS_CMD   0x00000003

#define HDM_STATUS_RELEASED KG_UNBLOCK_CMD
#define HDM_STATUS_APPLIED KG_BLOCK_CMD

/**
 * Method to release (unblock) an HDM policy configured by KG.
 * Release flow consists in the following steps:
 * 1. Call TA_Communication_kg_release in Secure World
 * 
 * @return HDM_TATA_SUCCESS or HDM_TATA_ERROR indicating if the operation was success or not
 */
uint32_t TA_Communication_kg_release ();

/**
 * Method to apply (block) an HDM policy configured by KG.
 * Apply flow consists in the following steps:
 * 1. Call TA_Communication_kg_apply in Secure World
 * 
 * @return HDM_TATA_SUCCESS or HDM_TATA_ERROR indicating if the operation was success or not
 */
uint32_t TA_Communication_kg_apply ();

/**
 * Method to get status of HDM policy configured by KG.
 * @param *kg_status[out] KG Status struct
 * 
 * @return
 * Return and kg_status will be HDM_TATA_ERROR if error occurs
 * For success case HDM_TATA_SUCCESS will be returned and kg_status will be filled with KG policy info
 */
uint32_t TA_Communication_kg_get_status(tz_hdm_kg_status_t *kg_status);

#endif
