Host Communication Protocol  2.0
fpc_com_chain.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_COM_CHAIN_H
23 #define FPC_COM_CHAIN_H
24 
25 #include <stdint.h>
26 
27 #include "fpc_com_result.h"
28 #include "fpc_hcp_common.h"
29 #include "fpc_com_packets.h"
30 
40  uint16_t hcp_seq_len;
42  uint16_t hcp_seq_nr;
43 };
44 
50 struct fpc_com_chain {
53 
59  void *(*argument_allocator)(fpc_hcp_cmd_t cmd, fpc_hcp_arg_t arg, uint16_t size,
60  bool *free_data, void *context);
62  void (*argument_free)(fpc_hcp_cmd_t cmd, fpc_hcp_arg_data_t *arg_data, void *context);
66  uint32_t (*crc_calc)(uint32_t start, const void *data, uint32_t size);
67 
73  fpc_com_result_t (*app_tx)(fpc_com_chain_t *chain);
75  fpc_com_result_t (*app_rx)(fpc_com_chain_t *chain);
77  uint16_t (*app_overhead_get)(uint16_t *offset);
79  uint16_t app_packet_size[2];
81  uint16_t app_mtu_size[2];
83  uint8_t *app_mtu_buffer[2];
95  uint16_t (*tsp_overhead_get)(uint16_t *offset);
103  uint16_t (*link_overhead_get)(uint16_t *offset);
113  fpc_com_result_t (*phy_tx)(uint16_t size, const uint8_t *buffer, uint32_t timeout,
114  void *session);
116  fpc_com_result_t (*phy_rx)(uint16_t size, uint8_t *buffer, uint32_t timeout,
117  void *session);
119  uint16_t phy_mtu_size[2];
121  uint8_t *phy_mtu_buffer[2];
123  uint32_t phy_timeout_tx;
125  uint32_t phy_timeout_rx;
130 
137  void *session;
143  void *context;
144 };
145 
149 typedef enum {
153 
154 #endif /* FPC_COM_CHAIN_H */
uint16_t fpc_hcp_cmd_t
Communication result type definitions.
Application Command Packet.
uint32_t phy_timeout_tx
fpc_com_chain_dir_t
Communication chain direction type.
void * session
User session pointer. User private stuff, to be able to pass necessary info from the layer that calls...
void * context
User context pointer. User private stuff, to be able to pass nessecary context to argument_allocator ...
fpc_com_channel_t channel
Command Argument.
uint32_t phy_timeout_rx
uint16_t fpc_hcp_arg_t
uint8_t fpc_com_result_t
fpc_hcp_packet_t * hcp_packet
Definition: fpc_com_chain.h:38
fpc_com_chain_private_t private_vars
uint16_t fpc_com_channel_t
Host Communication Protocol common type definitions.
Communication packet type definitions.