fpc_hcp_common.h
Go to the documentation of this file.
/*
* Copyright (c) 2020 Fingerprint Cards AB
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FPC_HCP_COMMON_H
#define FPC_HCP_COMMON_H
#include <stdint.h>
#include <stdbool.h>
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#define HCP_MIN(x, y) (((x) < (y)) ? (x) : (y))
#define CMD_APP_BASE_VAL 0xE000
#define ARG_APP_BASE_VAL 0x7000
enum fpc_hcp_cmd {
CMD_NONE = 0x0000,
/* Biometry */
CMD_CAPTURE = 0x0001,
CMD_ENROLL = 0x0002,
CMD_IDENTIFY = 0x0003,
CMD_MATCH = 0x0004,
CMD_IMAGE = 0x0005,
CMD_TEMPLATE = 0x0006,
CMD_WAIT = 0x0007,
CMD_SETTINGS = 0x0008,
/* Sensor */
CMD_NAVIGATE = 0x1001,
CMD_SENSOR = 0x1002,
CMD_DEADPIXELS = 0x1003,
/* Security */
CMD_CONNECT = 0x2001,
CMD_RECONNECT = 0x2002,
/* Firmware */
CMD_RESET = 0x3002,
CMD_CANCEL = 0x3003,
CMD_INFO = 0x3004,
/* Storage */
CMD_STORAGE_TEMPLATE = 0x4002,
CMD_STORAGE_CALIBRATION = 0x4003,
CMD_STORAGE_LOG = 0x4004,
CMD_STORAGE_SETTINGS = 0x4005,
/* Hardware */
CMD_TEST = 0x5001,
CMD_MCU = 0x5002,
CMD_GPIO = 0x5003,
/* Communication */
CMD_COMMUNICATION = 0x6001,
/* Application specific commands */
CMD_APP_BASE = CMD_APP_BASE_VAL,
/* Debug */
CMD_DIAG = 0xF003,
CMD_FFFF = 0xFFFF,
};
typedef uint16_t fpc_hcp_cmd_t;
enum fpc_hcp_arg {
ARG_NONE = 0x0000,
/* Biometry */
ARG_FINGER_DOWN = 0x0001,
ARG_FINGER_UP = 0x0002,
ARG_START = 0x0003,
ARG_ADD = 0x0004,
ARG_FINISH = 0x0005,
ARG_ID = 0x0006,
ARG_ALL = 0x0007,
ARG_EXTRACT = 0x0008,
ARG_MATCH_IMAGE = 0x0009,
ARG_MATCH = 0x000A,
/* Data */
ARG_ACQUIRE = 0x1001,
ARG_RELEASE = 0x1002,
ARG_SET = 0x1003,
ARG_GET = 0x1004,
ARG_UPLOAD = 0x1005,
ARG_DOWNLOAD = 0x1006,
ARG_CREATE = 0x1007,
ARG_SAVE = 0x1008,
ARG_DELETE = 0x1009,
ARG_DATA = 0x100A,
ARG_UPDATE = 0x100B,
ARG_SEQ_NR = 0x100C,
ARG_SEQ_LEN = 0x100D,
/* Results */
ARG_RESULT = 0x2001,
ARG_COUNT = 0x2002,
ARG_SIZE = 0x2003,
ARG_LEVEL = 0x2004,
ARG_FORMAT = 0x2005,
ARG_FLAG = 0x2006,
ARG_PROPERTIES = 0x2007,
ARG_SPEED = 0x2008,
ARG_PROD_TEST = 0x2009,
/* Sensor */
ARG_SENSOR_TYPE = 0x3001,
ARG_WIDTH = 0x3002,
ARG_HEIGHT = 0x3003,
ARG_RESET = 0x3004,
ARG_DPI = 0x3005,
ARG_MAX_SPI_CLOCK = 0x3006,
ARG_NUM_SUB_AREAS_WIDTH = 0x3007,
ARG_NUM_SUB_AREAS_HEIGHT = 0x3008,
ARG_IRQ_STATUS = 0x3009,
ARG_RESET_HARD = 0x300A,
/* MCU */
ARG_IDLE = 0x4001,
ARG_SLEEP = 0x4002,
ARG_DEEP_SLEEP = 0x4003,
ARG_POWER_MODE = 0x4004,
ARG_BUSY_WAIT = 0x4005,
/* Misc */
ARG_TIMEOUT = 0x5001,
ARG_DONE = 0x5002,
/* Info */
ARG_BOOT = 0x6001,
ARG_STATUS = 0x6002,
ARG_VERSION = 0x6003,
ARG_UNIQUE_ID = 0x6004,
/* Application specific arguments */
ARG_APP_BASE = ARG_APP_BASE_VAL,
/* VSM */
ARG_NONCE = 0x8001,
ARG_MAC = 0x8002,
ARG_RANDOM = 0x8003,
ARG_CLAIM = 0x8004,
ARG_PUBLIC_KEY = 0x8005,
ARG_CIPHERTEXT = 0x8006,
/* Communication */
ARG_MTU = 0x9001,
/* Debug */
ARG_STACK = 0xE001,
ARG_FILL = 0xE002,
ARG_HEAP = 0xE003,
/* Log */
ARG_MODE = 0xF001,
ARG_DEBUG = 0xF002,
ARG_FFFF = 0xFFFF,
};
typedef uint16_t fpc_hcp_arg_t;
typedef struct fpc_hcp_arg_data {
fpc_hcp_arg_t arg;
uint16_t size;
bool free_data;
uint8_t *data;
} fpc_hcp_arg_data_t;
typedef struct fpc_hcp_packet {
fpc_hcp_cmd_t id;
uint16_t num_args;
fpc_hcp_arg_data_t *arguments;
} fpc_hcp_packet_t;
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* FPC_HCP_COMMON_H */
ARG_SLEEP
Definition: fpc_hcp_common.h:150
ARG_RESET_HARD
Definition: fpc_hcp_common.h:146
fpc_hcp_packet::num_args
uint16_t num_args
Definition: fpc_hcp_common.h:214
ARG_UPLOAD
Definition: fpc_hcp_common.h:115
fpc_hcp_cmd_t
uint16_t fpc_hcp_cmd_t
Definition: fpc_hcp_common.h:92
ARG_NUM_SUB_AREAS_WIDTH
Definition: fpc_hcp_common.h:143
ARG_FINGER_DOWN
Definition: fpc_hcp_common.h:99
ARG_HEAP
Definition: fpc_hcp_common.h:182
fpc_hcp_arg
fpc_hcp_arg
Definition: fpc_hcp_common.h:95
ARG_MODE
Definition: fpc_hcp_common.h:185
CMD_STORAGE_SETTINGS
Definition: fpc_hcp_common.h:73
CMD_APP_BASE_VAL
#define CMD_APP_BASE_VAL
Definition: fpc_hcp_common.h:36
ARG_SENSOR_TYPE
Definition: fpc_hcp_common.h:137
ARG_MAX_SPI_CLOCK
Definition: fpc_hcp_common.h:142
ARG_CREATE
Definition: fpc_hcp_common.h:117
ARG_START
Definition: fpc_hcp_common.h:101
ARG_MTU
Definition: fpc_hcp_common.h:177
CMD_IMAGE
Definition: fpc_hcp_common.h:50
fpc_hcp_packet_t
struct fpc_hcp_packet fpc_hcp_packet_t
Application Command Packet.
fpc_hcp_arg_data::size
uint16_t size
Definition: fpc_hcp_common.h:200
ARG_STACK
Definition: fpc_hcp_common.h:180
ARG_SIZE
Definition: fpc_hcp_common.h:128
CMD_MCU
Definition: fpc_hcp_common.h:77
CMD_NONE
Definition: fpc_hcp_common.h:43
fpc_hcp_arg_data::data
uint8_t * data
Definition: fpc_hcp_common.h:204
ARG_SPEED
Definition: fpc_hcp_common.h:133
fpc_hcp_arg_data::free_data
bool free_data
Definition: fpc_hcp_common.h:202
fpc_hcp_packet
Application Command Packet.
Definition: fpc_hcp_common.h:210
CMD_CAPTURE
Definition: fpc_hcp_common.h:46
CMD_COMMUNICATION
Definition: fpc_hcp_common.h:81
fpc_hcp_packet::id
fpc_hcp_cmd_t id
Definition: fpc_hcp_common.h:212
CMD_GPIO
Definition: fpc_hcp_common.h:78
ARG_LEVEL
Definition: fpc_hcp_common.h:129
CMD_DEADPIXELS
Definition: fpc_hcp_common.h:58
CMD_TEMPLATE
Definition: fpc_hcp_common.h:51
ARG_DPI
Definition: fpc_hcp_common.h:141
CMD_WAIT
Definition: fpc_hcp_common.h:52
ARG_SEQ_LEN
Definition: fpc_hcp_common.h:123
CMD_DIAG
Definition: fpc_hcp_common.h:87
ARG_APP_BASE
Definition: fpc_hcp_common.h:166
ARG_BOOT
Definition: fpc_hcp_common.h:160
ARG_VERSION
Definition: fpc_hcp_common.h:162
ARG_GET
Definition: fpc_hcp_common.h:114
ARG_FINGER_UP
Definition: fpc_hcp_common.h:100
CMD_SENSOR
Definition: fpc_hcp_common.h:57
ARG_MATCH
Definition: fpc_hcp_common.h:108
ARG_PROD_TEST
Definition: fpc_hcp_common.h:134
ARG_FLAG
Definition: fpc_hcp_common.h:131
CMD_STORAGE_TEMPLATE
Definition: fpc_hcp_common.h:70
ARG_NUM_SUB_AREAS_HEIGHT
Definition: fpc_hcp_common.h:144
ARG_CLAIM
Definition: fpc_hcp_common.h:172
ARG_NONCE
Definition: fpc_hcp_common.h:169
ARG_RELEASE
Definition: fpc_hcp_common.h:112
ARG_ACQUIRE
Definition: fpc_hcp_common.h:111
CMD_APP_BASE
Definition: fpc_hcp_common.h:84
CMD_RESET
Definition: fpc_hcp_common.h:65
ARG_ID
Definition: fpc_hcp_common.h:104
ARG_COUNT
Definition: fpc_hcp_common.h:127
ARG_MATCH_IMAGE
Definition: fpc_hcp_common.h:107
CMD_TEST
Definition: fpc_hcp_common.h:76
ARG_PUBLIC_KEY
Definition: fpc_hcp_common.h:173
ARG_EXTRACT
Definition: fpc_hcp_common.h:106
ARG_ADD
Definition: fpc_hcp_common.h:102
fpc_hcp_arg_data
Command Argument.
Definition: fpc_hcp_common.h:196
CMD_NAVIGATE
Definition: fpc_hcp_common.h:56
ARG_STATUS
Definition: fpc_hcp_common.h:161
ARG_UNIQUE_ID
Definition: fpc_hcp_common.h:163
ARG_UPDATE
Definition: fpc_hcp_common.h:121
ARG_NONE
Definition: fpc_hcp_common.h:96
ARG_DELETE
Definition: fpc_hcp_common.h:119
ARG_ALL
Definition: fpc_hcp_common.h:105
ARG_DEBUG
Definition: fpc_hcp_common.h:186
ARG_PROPERTIES
Definition: fpc_hcp_common.h:132
ARG_RANDOM
Definition: fpc_hcp_common.h:171
ARG_IDLE
Definition: fpc_hcp_common.h:149
ARG_FORMAT
Definition: fpc_hcp_common.h:130
CMD_INFO
Definition: fpc_hcp_common.h:67
CMD_CANCEL
Definition: fpc_hcp_common.h:66
ARG_DEEP_SLEEP
Definition: fpc_hcp_common.h:151
fpc_hcp_arg_t
uint16_t fpc_hcp_arg_t
Definition: fpc_hcp_common.h:191
ARG_DONE
Definition: fpc_hcp_common.h:157
ARG_FFFF
Definition: fpc_hcp_common.h:188
ARG_MAC
Definition: fpc_hcp_common.h:170
ARG_BUSY_WAIT
Definition: fpc_hcp_common.h:153
fpc_hcp_packet::arguments
fpc_hcp_arg_data_t * arguments
Definition: fpc_hcp_common.h:216
ARG_SEQ_NR
Definition: fpc_hcp_common.h:122
CMD_CONNECT
Definition: fpc_hcp_common.h:61
ARG_DATA
Definition: fpc_hcp_common.h:120
CMD_STORAGE_LOG
Definition: fpc_hcp_common.h:72
fpc_hcp_cmd
fpc_hcp_cmd
Definition: fpc_hcp_common.h:42
ARG_APP_BASE_VAL
#define ARG_APP_BASE_VAL
Definition: fpc_hcp_common.h:39
CMD_SETTINGS
Definition: fpc_hcp_common.h:53
ARG_RESET
Definition: fpc_hcp_common.h:140
CMD_ENROLL
Definition: fpc_hcp_common.h:47
ARG_HEIGHT
Definition: fpc_hcp_common.h:139
CMD_MATCH
Definition: fpc_hcp_common.h:49
ARG_FINISH
Definition: fpc_hcp_common.h:103
CMD_FFFF
Definition: fpc_hcp_common.h:89
ARG_TIMEOUT
Definition: fpc_hcp_common.h:156
fpc_hcp_arg_data_t
struct fpc_hcp_arg_data fpc_hcp_arg_data_t
Command Argument.
ARG_RESULT
Definition: fpc_hcp_common.h:126
fpc_hcp_arg_data::arg
fpc_hcp_arg_t arg
Definition: fpc_hcp_common.h:198
ARG_SET
Definition: fpc_hcp_common.h:113
CMD_IDENTIFY
Definition: fpc_hcp_common.h:48
ARG_IRQ_STATUS
Definition: fpc_hcp_common.h:145
ARG_SAVE
Definition: fpc_hcp_common.h:118
ARG_CIPHERTEXT
Definition: fpc_hcp_common.h:174
CMD_RECONNECT
Definition: fpc_hcp_common.h:62
CMD_STORAGE_CALIBRATION
Definition: fpc_hcp_common.h:71
ARG_POWER_MODE
Definition: fpc_hcp_common.h:152
ARG_WIDTH
Definition: fpc_hcp_common.h:138
ARG_FILL
Definition: fpc_hcp_common.h:181
ARG_DOWNLOAD
Definition: fpc_hcp_common.h:116