Jungtae Kim | 05e7676 | 2012-10-02 16:08:56 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2012 Samsung Electronics Co., LTD |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | |
| 18 | #ifndef TCI_H_ |
| 19 | #define TCI_H_ |
| 20 | |
| 21 | typedef uint32_t tciCommandId_t; |
| 22 | typedef uint32_t tciResponseId_t; |
| 23 | typedef uint32_t tciReturnCode_t; |
| 24 | |
| 25 | /**< Responses have bit 31 set */ |
| 26 | #define RSP_ID_MASK (1U << 31) |
| 27 | #define RSP_ID(cmdId) (((uint32_t)(cmdId)) | RSP_ID_MASK) |
| 28 | #define IS_CMD(cmdId) ((((uint32_t)(cmdId)) & RSP_ID_MASK) == 0) |
| 29 | #define IS_RSP(cmdId) ((((uint32_t)(cmdId)) & RSP_ID_MASK) == RSP_ID_MASK) |
| 30 | |
| 31 | /** |
| 32 | * Return codes of Trustlet commands. |
| 33 | */ |
| 34 | #define RET_OK 0 /**< Set, if processing is error free */ |
| 35 | #define RET_ERR_UNKNOWN_CMD 1 /**< Unknown command */ |
| 36 | #define RET_CUSTOM_START 2 |
| 37 | #define RET_ERR_MAP 3 |
| 38 | #define RET_ERR_UNMAP 4 |
| 39 | |
| 40 | /** |
| 41 | * TCI command header. |
| 42 | */ |
| 43 | typedef struct { |
| 44 | tciCommandId_t commandId; /**< Command ID */ |
| 45 | } tciCommandHeader_t; |
| 46 | |
| 47 | /** |
| 48 | * TCI response header. |
| 49 | */ |
| 50 | typedef struct { |
| 51 | tciResponseId_t responseId; /**< Response ID (must be command ID | RSP_ID_MASK )*/ |
| 52 | tciReturnCode_t returnCode; /**< Return code of command */ |
| 53 | } tciResponseHeader_t; |
| 54 | |
| 55 | #endif // TCI_H_ |