/*
 * Copyright (c) 2013 TRUSTONIC LIMITED
 * All rights reserved
 *
 * The present software is the confidential and proprietary information of
 * TRUSTONIC LIMITED. You shall not disclose the present software and shall
 * use it only in accordance with the terms of the license agreement you
 * entered into with TRUSTONIC LIMITED. This software may be subject to
 * export or import laws in certain countries.
 */

/**
 * @file   tlAsyncExampleDriverApi.h
 * @brief  Contains trustlet API definitions
 *
 */

#ifndef __TLDRIVERAPI_H__
#define __TLDRIVERAPI_H__

#include "tlStd.h"
#include "TlApi/TlApiError.h"

_TLAPI_EXTERN_C uint32_t tlApi_Encrypt_AES_CTR(uint64_t in_phy_addr, uint8_t* wsm_out_buf, uint8_t *iv, uint8_t *key, uint32_t length, uint32_t *outlen);
_TLAPI_EXTERN_C uint32_t tlApi_Decrypt_AES_CTR(uint8_t* in_buf, uint64_t out_phy_addr, uint8_t *iv, uint8_t *key, uint32_t length, uint32_t *outlen);
_TLAPI_EXTERN_C uint32_t tlApi_Map_Phys_Addr(uint64_t phy_addr, uint64_t *vir_addr, uint32_t length);
_TLAPI_EXTERN_C uint32_t tlApi_Unmap_Addr(uint64_t vir_addr);
_TLAPI_EXTERN_C uint32_t tlApi_Get_SecBuffer(uint64_t in_phy_addr, uint32_t in_length, uint8_t *out_buf);

/**
 * Open session to the driver with given data
 *
 * @return  session id
 */
_TLAPI_EXTERN_C uint32_t tlApi_Async_OpenSession(void);

/**
 * Close session
 *
 * @param sid  session id
 *
 * @return  TLAPI_OK upon success or specific error
 */
_TLAPI_EXTERN_C tlApiResult_t tlApi_Async_CloseSession(uint32_t sid);

/**
 * Executes command
 *
 * @param sid        session id
 * @param commandId  command id
 *
 * @return  TLAPI_OK upon success or specific error
 */
_TLAPI_EXTERN_C tlApiResult_t tlApi_Async_Start(uint32_t sid);

/**
 * Executes command
 *
 * @param sid        session id
 * @param commandId  command id
 *
 * @return  TLAPI_OK upon success or specific error
 */
_TLAPI_EXTERN_C uint32_t tlApi_Async_NotificationQuery(uint32_t sid);

#endif // __TLDRIVERAPI_H__
