/*
 * tci.h
 *
 *  Created on: 05.05.2010
 *      Author: galkag
 *  Revision #1 on April 28, 2013 by pning
 *    Removed the definitions of return codes from tci.h to avoid overloading the return codes.
 *    Return codes should always be defined in the Trustlet specific public header file.
 *    For tima_pkm, this file is tima_pkm_api.h.
 */

#ifndef TCI_H_
#define TCI_H_

#include <stdint.h>

typedef uint32_t tciCommandId_t;
typedef uint32_t tciResponseId_t;
typedef uint32_t tciReturnCode_t;

/* Responses have bit 31 set */
#define RSP_ID_MASK (1U << 31)
#define RSP_ID(cmdId) (((uint32_t)(cmdId)) | RSP_ID_MASK)
#define IS_CMD(cmdId) ((((uint32_t)(cmdId)) & RSP_ID_MASK) == 0)
#define IS_RSP(cmdId) ((((uint32_t)(cmdId)) & RSP_ID_MASK) == RSP_ID_MASK)

/* TCI command header. */
typedef struct {
	tciCommandId_t commandId;	/* Command ID */
} tciCommandHeader_t;

/* 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;

#endif /* TCI_H_ */
