fpc_com_link.c File Reference

Communication link layer implementation. More...

`#include <string.h>`
`#include <stdlib.h>`
`#include "fpc_com_link.h"`
Include dependency graph for fpc_com_link.c:

Go to the source code of this file.

## Functions

fpc_com_result_t | fpc_com_link_transmit (fpc_com_packet_link_t *packet, fpc_com_chain_t *chain)
| Sends a packet over the physical link in blocking mode. More...
fpc_com_result_t | fpc_com_link_receive (fpc_com_packet_link_t *packet, fpc_com_chain_t *chain)
| Receives a packet from the physical link. More...
uint16_t | fpc_com_link_get_overhead (uint16_t *offset)
| Returns the overhead of the layer. More...

## Detailed Description

Communication link layer implementation.

Definition in file fpc_com_link.c.

## Function Documentation

uint16_t fpc_com_link_get_overhead | ( | uint16_t * | offset | ) |

Returns the overhead of the layer.

Parameters

  [out] | offset | The offset to the packet data.

Returns
  Overhead size in bytes.

Definition at line 126 of file fpc_com_link.c.

References fpc_com_packet_link::channel, fpc_com_packet_link::crc, and fpc_com_packet_link::size.

fpc_com_result_t fpc_com_link_receive | ( | fpc_com_packet_link_t * | packet,
|  | fpc_com_chain_t * | chain
| ) |  |

Receives a packet from the physical link.

Parameters

  [in,out] | packet | Packet to populate.
  [in] | chain | The communication chain to use.

Returns
  fpc_com_result_t

Definition at line 73 of file fpc_com_link.c.

References fpc_com_packet_link::channel, fpc_com_packet_link::crc, fpc_com_chain::crc_calc, fpc_com_packet_link::data, FPC_COM_ACK, FPC_COM_CHAIN_RX, FPC_COM_RESULT_INVALID_ARGUMENT, FPC_COM_RESULT_IO_ERROR, FPC_COM_RESULT_OK, fpc_com_chain::phy_mtu_buffer, fpc_com_chain::phy_mtu_size, fpc_com_chain::phy_rx, fpc_com_chain::phy_timeout_rx, fpc_com_chain::phy_timeout_tx, fpc_com_chain::phy_tx, fpc_com_chain::session, and fpc_com_packet_link::size.

fpc_com_result_t fpc_com_link_transmit | ( | fpc_com_packet_link_t * | packet,
|  | fpc_com_chain_t * | chain
| ) |  |

Sends a packet over the physical link in blocking mode.

Parameters

  [in] | packet | Packet to transmit.
  [in] | chain | The communication chain to use.

Returns
  fpc_com_result_t

Definition at line 27 of file fpc_com_link.c.

References fpc_com_packet_link::channel, fpc_com_packet_link::crc, fpc_com_chain::crc_calc, fpc_com_packet_link::data, FPC_COM_ACK, FPC_COM_CHAIN_TX, fpc_com_link_get_overhead(), FPC_COM_RESULT_INVALID_ARGUMENT, FPC_COM_RESULT_IO_ERROR, FPC_COM_RESULT_OK, FPC_COM_RESULT_TIMEOUT, fpc_com_chain::phy_mtu_buffer, fpc_com_chain::phy_rx, fpc_com_chain::phy_timeout_rx, fpc_com_chain::phy_timeout_tx, fpc_com_chain::phy_tx, fpc_com_chain::session, and fpc_com_packet_link::size.

Here is the call graph for this function: