Zephyr API Documentation  2.7.0-rc2
A Scalable Open Source RTOS
isotp.h File Reference

Public API for ISO-TP (ISO 15765-2:2016) More...

#include <drivers/can.h>
#include <zephyr/types.h>
#include <net/buf.h>

Go to the source code of this file.

Data Structures

struct  isotp_msg_id
 ISO-TP message id struct. More...
 
struct  isotp_fc_opts
 ISO-TP frame control options struct. More...
 

Macros

#define ISOTP_N_OK   0
 
#define ISOTP_N_TIMEOUT_A   -1
 
#define ISOTP_N_TIMEOUT_BS   -2
 
#define ISOTP_N_TIMEOUT_CR   -3
 
#define ISOTP_N_WRONG_SN   -4
 
#define ISOTP_N_INVALID_FS   -5
 
#define ISOTP_N_UNEXP_PDU   -6
 
#define ISOTP_N_WFT_OVRN   -7
 
#define ISOTP_N_BUFFER_OVERFLW   -8
 
#define ISOTP_N_ERROR   -9
 
#define ISOTP_NO_FREE_FILTER   -10
 
#define ISOTP_NO_NET_BUF_LEFT   -11
 
#define ISOTP_NO_BUF_DATA_LEFT   -12
 
#define ISOTP_NO_CTX_LEFT   -13
 
#define ISOTP_RECV_TIMEOUT   -14
 
#define ISOTP_FIXED_ADDR_SA_POS   (0U)
 
#define ISOTP_FIXED_ADDR_SA_MASK   (0xFF << ISOTP_FIXED_ADDR_SA_POS)
 
#define ISOTP_FIXED_ADDR_TA_POS   (8U)
 
#define ISOTP_FIXED_ADDR_TA_MASK   (0xFF << ISOTP_FIXED_ADDR_TA_POS)
 
#define ISOTP_FIXED_ADDR_PRIO_POS   (26U)
 
#define ISOTP_FIXED_ADDR_PRIO_MASK   (0x7 << ISOTP_FIXED_ADDR_PRIO_POS)
 
#define ISOTP_FIXED_ADDR_RX_MASK   (0x03FFFF00)
 

Typedefs

typedef void(* isotp_tx_callback_t) (int error_nr, void *arg)
 

Functions

int isotp_bind (struct isotp_recv_ctx *ctx, const struct device *can_dev, const struct isotp_msg_id *rx_addr, const struct isotp_msg_id *tx_addr, const struct isotp_fc_opts *opts, k_timeout_t timeout)
 Bind an address to a receiving context. More...
 
void isotp_unbind (struct isotp_recv_ctx *ctx)
 Unbind a context from the interface. More...
 
int isotp_recv (struct isotp_recv_ctx *ctx, uint8_t *data, size_t len, k_timeout_t timeout)
 Read out received data from fifo. More...
 
int isotp_recv_net (struct isotp_recv_ctx *ctx, struct net_buf **buffer, k_timeout_t timeout)
 Get the net buffer on data reception. More...
 
int isotp_send (struct isotp_send_ctx *ctx, const struct device *can_dev, const uint8_t *data, size_t len, const struct isotp_msg_id *tx_addr, const struct isotp_msg_id *rx_addr, isotp_tx_callback_t complete_cb, void *cb_arg)
 Send data. More...
 

Detailed Description

Public API for ISO-TP (ISO 15765-2:2016)

ISO-TP is a transport protocol for CAN (Controller Area Network)