Host Communication Protocol  2.0
fpc_hcp_common.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2020 Fingerprint Cards AB
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  * https://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 
22 #ifndef FPC_HCP_COMMON_H
23 #define FPC_HCP_COMMON_H
24 
25 #include <stdint.h>
26 #include <stdbool.h>
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif /* __cplusplus */
31 
33 #define HCP_MIN(x, y) (((x) < (y)) ? (x) : (y))
34 
36 #define CMD_APP_BASE_VAL 0xE000
37 
39 #define ARG_APP_BASE_VAL 0x7000
40 
43  CMD_NONE = 0x0000,
44 
45  /* Biometry */
46  CMD_CAPTURE = 0x0001,
47  CMD_ENROLL = 0x0002,
48  CMD_IDENTIFY = 0x0003,
49  CMD_MATCH = 0x0004,
50  CMD_IMAGE = 0x0005,
51  CMD_TEMPLATE = 0x0006,
52  CMD_WAIT = 0x0007,
53  CMD_SETTINGS = 0x0008,
54 
55  /* Sensor */
56  CMD_NAVIGATE = 0x1001,
57  CMD_SENSOR = 0x1002,
58  CMD_DEADPIXELS = 0x1003,
59 
60  /* Security */
61  CMD_CONNECT = 0x2001,
62  CMD_RECONNECT = 0x2002,
63 
64  /* Firmware */
65  CMD_RESET = 0x3002,
66  CMD_CANCEL = 0x3003,
67  CMD_INFO = 0x3004,
68 
69  /* Storage */
72  CMD_STORAGE_LOG = 0x4004,
74 
75  /* Hardware */
76  CMD_TEST = 0x5001,
77  CMD_MCU = 0x5002,
78  CMD_GPIO = 0x5003,
79 
80  /* Communication */
82 
83  /* Application specific commands */
85 
86  /* Debug */
87  CMD_DIAG = 0xF003,
88 
89  CMD_FFFF = 0xFFFF,
90 };
92 typedef uint16_t fpc_hcp_cmd_t;
93 
96  ARG_NONE = 0x0000,
97 
98  /* Biometry */
99  ARG_FINGER_DOWN = 0x0001,
100  ARG_FINGER_UP = 0x0002,
101  ARG_START = 0x0003,
102  ARG_ADD = 0x0004,
103  ARG_FINISH = 0x0005,
104  ARG_ID = 0x0006,
105  ARG_ALL = 0x0007,
106  ARG_EXTRACT = 0x0008,
107  ARG_MATCH_IMAGE = 0x0009,
108  ARG_MATCH = 0x000A,
109 
110  /* Data */
111  ARG_ACQUIRE = 0x1001,
112  ARG_RELEASE = 0x1002,
113  ARG_SET = 0x1003,
114  ARG_GET = 0x1004,
115  ARG_UPLOAD = 0x1005,
116  ARG_DOWNLOAD = 0x1006,
117  ARG_CREATE = 0x1007,
118  ARG_SAVE = 0x1008,
119  ARG_DELETE = 0x1009,
120  ARG_DATA = 0x100A,
121  ARG_UPDATE = 0x100B,
122  ARG_SEQ_NR = 0x100C,
123  ARG_SEQ_LEN = 0x100D,
124 
125  /* Results */
126  ARG_RESULT = 0x2001,
127  ARG_COUNT = 0x2002,
128  ARG_SIZE = 0x2003,
129  ARG_LEVEL = 0x2004,
130  ARG_FORMAT = 0x2005,
131  ARG_FLAG = 0x2006,
132  ARG_PROPERTIES = 0x2007,
133  ARG_SPEED = 0x2008,
134  ARG_PROD_TEST = 0x2009,
135 
136  /* Sensor */
137  ARG_SENSOR_TYPE = 0x3001,
138  ARG_WIDTH = 0x3002,
139  ARG_HEIGHT = 0x3003,
140  ARG_RESET = 0x3004,
141  ARG_DPI = 0x3005,
145  ARG_IRQ_STATUS = 0x3009,
146  ARG_RESET_HARD = 0x300A,
147 
148  /* MCU */
149  ARG_IDLE = 0x4001,
150  ARG_SLEEP = 0x4002,
151  ARG_DEEP_SLEEP = 0x4003,
152  ARG_POWER_MODE = 0x4004,
153  ARG_BUSY_WAIT = 0x4005,
154 
155  /* Misc */
156  ARG_TIMEOUT = 0x5001,
157  ARG_DONE = 0x5002,
158 
159  /* Info */
160  ARG_BOOT = 0x6001,
161  ARG_STATUS = 0x6002,
162  ARG_VERSION = 0x6003,
163  ARG_UNIQUE_ID = 0x6004,
164 
165  /* Application specific arguments */
167 
168  /* VSM */
169  ARG_NONCE = 0x8001,
170  ARG_MAC = 0x8002,
171  ARG_RANDOM = 0x8003,
172  ARG_CLAIM = 0x8004,
173  ARG_PUBLIC_KEY = 0x8005,
174  ARG_CIPHERTEXT = 0x8006,
175 
176  /* Communication */
177  ARG_MTU = 0x9001,
178 
179  /* Debug */
180  ARG_STACK = 0xE001,
181  ARG_FILL = 0xE002,
182  ARG_HEAP = 0xE003,
183 
184  /* Log */
185  ARG_MODE = 0xF001,
186  ARG_DEBUG = 0xF002,
187 
188  ARG_FFFF = 0xFFFF,
189 };
191 typedef uint16_t fpc_hcp_arg_t;
192 
196 typedef struct fpc_hcp_arg_data {
198  fpc_hcp_arg_t arg;
200  uint16_t size;
202  bool free_data;
204  uint8_t *data;
206 
210 typedef struct fpc_hcp_packet {
212  fpc_hcp_cmd_t id;
214  uint16_t num_args;
218 
219 #ifdef __cplusplus
220 }
221 #endif /* __cplusplus */
222 
223 #endif /* FPC_HCP_COMMON_H */
uint16_t fpc_hcp_cmd_t
fpc_hcp_arg
#define CMD_APP_BASE_VAL
struct fpc_hcp_packet fpc_hcp_packet_t
Application Command Packet.
Application Command Packet.
fpc_hcp_cmd_t id
Command Argument.
uint16_t fpc_hcp_arg_t
fpc_hcp_arg_data_t * arguments
fpc_hcp_cmd
#define ARG_APP_BASE_VAL
struct fpc_hcp_arg_data fpc_hcp_arg_data_t
Command Argument.
fpc_hcp_arg_t arg