merge with master
[platform/core/security/libcryptsvc.git] / include / tci.h
1 /*
2  * tci.h
3  *
4  *  Created on: 05.05.2010
5  *      Author: galkag
6  *      modified ckyu.han@samsung.com
7  */
8
9 #ifndef TCI_H_
10 #define TCI_H_
11
12 #ifdef __cplusplus
13 extern "C"
14 {
15 #endif
16
17 /*
18 typedef unsigned int uint32_t;
19 typedef unsigned char uint8_t;
20 */
21
22 typedef uint32_t tciCommandId_t;
23 typedef uint32_t tciResponseId_t;
24 typedef uint32_t tciReturnCode_t;
25
26 /* Responses have bit 31 set */
27 #define RSP_ID_MASK (1U << 31)
28 #define RSP_ID(cmdId) (((uint32_t)(cmdId)) | RSP_ID_MASK)
29 #define IS_CMD(cmdId) ((((uint32_t)(cmdId)) & RSP_ID_MASK) == 0)
30 #define IS_RSP(cmdId) ((((uint32_t)(cmdId)) & RSP_ID_MASK) == RSP_ID_MASK)
31
32 /* Return codes of Trustlet commands. */
33 #define RET_OK              0            /* Set, if processing is error free */
34 #define RET_ERR_UNKNOWN_CMD 1            /* Unknown command */
35 #define RET_CUSTOM_START    2
36 #define RET_ERR_MAP         3
37 #define RET_ERR_UNMAP       4
38
39 /* TCI command header. */
40 typedef struct {
41         tciCommandId_t commandId;       /* Command ID */
42 } tciCommandHeader_t;
43
44 /* TCI response header. */
45 typedef struct {
46         tciResponseId_t     responseId;         /* Response ID (must be command ID | RSP_ID_MASK )*/
47         tciReturnCode_t     returnCode;         /* Return code of command */
48 } tciResponseHeader_t;
49
50 #ifdef __cplusplus
51 }
52 #endif
53
54 #endif /* TCI_H_ */