Commit | Line | Data |
---|---|---|
15e8442f JA |
1 | /* |
2 | * Copyright (c) 2013 TRUSTONIC LIMITED | |
3 | * All rights reserved | |
4 | * | |
5 | * The present software is the confidential and proprietary information of | |
6 | * TRUSTONIC LIMITED. You shall not disclose the present software and shall | |
7 | * use it only in accordance with the terms of the license agreement you | |
8 | * entered into with TRUSTONIC LIMITED. This software may be subject to | |
9 | * export or import laws in certain countries. | |
10 | */ | |
11 | ||
12 | /** | |
13 | * @file dci.h | |
14 | * @brief Contains DCI (Driver Control | |
15 | * Interface) definitions and data structures | |
16 | * | |
17 | */ | |
18 | ||
19 | #ifndef __DCI_H__ | |
20 | #define __DCI_H__ | |
21 | ||
22 | ||
23 | typedef uint32_t dciCommandId_t; | |
24 | typedef uint32_t dciResponseId_t; | |
25 | typedef uint32_t dciReturnCode_t; | |
26 | ||
27 | /**< Responses have bit 31 set */ | |
28 | #define RSP_ID_MASK (1U << 31) | |
29 | #define RSP_ID(cmdId) (((uint32_t)(cmdId)) | RSP_ID_MASK) | |
30 | #define IS_CMD(cmdId) ((((uint32_t)(cmdId)) & RSP_ID_MASK) == 0) | |
31 | #define IS_RSP(cmdId) ((((uint32_t)(cmdId)) & RSP_ID_MASK) == RSP_ID_MASK) | |
32 | ||
33 | /** | |
34 | * Return codes of driver commands. | |
35 | */ | |
36 | #define RET_OK 0 | |
37 | #define RET_ERR_UNKNOWN_CMD 1 | |
38 | #define RET_ERR_NOT_SUPPORTED 2 | |
39 | #define RET_ERR_INTERNAL_ERROR 3 | |
40 | /* ... add more error codes when needed */ | |
41 | ||
42 | /** | |
43 | * DCI command header. | |
44 | */ | |
45 | typedef struct{ | |
46 | dciCommandId_t commandId; /**< Command ID */ | |
47 | } dciCommandHeader_t; | |
48 | ||
49 | /** | |
50 | * DCI response header. | |
51 | */ | |
52 | typedef struct{ | |
53 | dciResponseId_t responseId; /**< Response ID (must be command ID | RSP_ID_MASK )*/ | |
54 | dciReturnCode_t returnCode; /**< Return code of command */ | |
55 | } dciResponseHeader_t; | |
56 | ||
57 | #endif // __DCI_H__ |