fpc_com_chain.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_COM_CHAIN_H
#define FPC_COM_CHAIN_H
#include <stdint.h>
#include "fpc_com_result.h"
#include "fpc_hcp_common.h"
#include "fpc_com_packets.h"
typedef struct fpc_com_chain_private fpc_com_chain_private_t;
struct fpc_com_chain_private {
fpc_hcp_packet_t *hcp_packet;
uint16_t hcp_seq_len;
uint16_t hcp_seq_nr;
};
typedef struct fpc_com_chain fpc_com_chain_t;
struct fpc_com_chain {
bool initialized;
void *(*argument_allocator)(fpc_hcp_cmd_t cmd, fpc_hcp_arg_t arg, uint16_t size,
bool *free_data, void *context);
void (*argument_free)(fpc_hcp_cmd_t cmd, fpc_hcp_arg_data_t *arg_data, void *context);
uint32_t (*crc_calc)(uint32_t start, const void *data, uint32_t size);
fpc_com_result_t (*app_tx)(fpc_com_chain_t *chain);
fpc_com_result_t (*app_rx)(fpc_com_chain_t *chain);
uint16_t (*app_overhead_get)(uint16_t *offset);
uint16_t app_packet_size[2];
uint16_t app_mtu_size[2];
uint8_t *app_mtu_buffer[2];
fpc_com_result_t (*tsp_tx)(fpc_com_packet_tsp_t *packet, fpc_com_chain_t *chain);
fpc_com_result_t (*tsp_rx)(fpc_com_packet_tsp_t *packet, fpc_com_chain_t *chain);
uint16_t (*tsp_overhead_get)(uint16_t *offset);
uint16_t (*link_overhead_get)(uint16_t *offset);
fpc_com_channel_t channel;
fpc_com_result_t (*phy_tx)(uint16_t size, const uint8_t *buffer, uint32_t timeout,
void *session);
fpc_com_result_t (*phy_rx)(uint16_t size, uint8_t *buffer, uint32_t timeout,
void *session);
uint16_t phy_mtu_size[2];
uint8_t *phy_mtu_buffer[2];
uint32_t phy_timeout_tx;
uint32_t phy_timeout_rx;
fpc_com_chain_private_t private_vars;
void *session;
void *context;
};
typedef enum {
FPC_COM_CHAIN_TX = 0,
FPC_COM_CHAIN_RX = 1,
} fpc_com_chain_dir_t;
#endif /* FPC_COM_CHAIN_H */
fpc_hcp_cmd_t
uint16_t fpc_hcp_cmd_t
Definition: fpc_hcp_common.h:92
fpc_com_chain_private::hcp_seq_len
uint16_t hcp_seq_len
Definition: fpc_com_chain.h:40
fpc_com_chain
Definition: fpc_com_chain.h:50
fpc_com_result.h
Communication result type definitions.
FPC_COM_CHAIN_TX
Definition: fpc_com_chain.h:150
fpc_hcp_packet
Application Command Packet.
Definition: fpc_hcp_common.h:210
fpc_com_chain::phy_timeout_tx
uint32_t phy_timeout_tx
Definition: fpc_com_chain.h:123
fpc_com_chain_dir_t
fpc_com_chain_dir_t
Communication chain direction type.
Definition: fpc_com_chain.h:149
fpc_com_chain::session
void * session
User session pointer. User private stuff, to be able to pass necessary info from the layer that calls...
Definition: fpc_com_chain.h:137
fpc_com_packet_transport
Definition: fpc_com_packets.h:37
fpc_com_chain::context
void * context
User context pointer. User private stuff, to be able to pass nessecary context to argument_allocator ...
Definition: fpc_com_chain.h:143
fpc_com_chain::channel
fpc_com_channel_t channel
Definition: fpc_com_chain.h:105
fpc_hcp_arg_data
Command Argument.
Definition: fpc_hcp_common.h:196
fpc_com_chain::initialized
bool initialized
Definition: fpc_com_chain.h:52
fpc_com_chain::phy_timeout_rx
uint32_t phy_timeout_rx
Definition: fpc_com_chain.h:125
FPC_COM_CHAIN_RX
Definition: fpc_com_chain.h:151
fpc_hcp_arg_t
uint16_t fpc_hcp_arg_t
Definition: fpc_hcp_common.h:191
fpc_com_result_t
uint8_t fpc_com_result_t
Definition: fpc_com_result.h:41
fpc_com_chain_private::hcp_packet
fpc_hcp_packet_t * hcp_packet
Definition: fpc_com_chain.h:38
fpc_com_chain::private_vars
fpc_com_chain_private_t private_vars
Definition: fpc_com_chain.h:129
fpc_com_channel_t
uint16_t fpc_com_channel_t
Definition: fpc_com_packets.h:58
fpc_com_chain_private
Definition: fpc_com_chain.h:36
fpc_hcp_common.h
Host Communication Protocol common type definitions.
fpc_com_packets.h
Communication packet type definitions.
fpc_com_chain_private::hcp_seq_nr
uint16_t hcp_seq_nr
Definition: fpc_com_chain.h:42