14#ifndef ZEPHYR_INCLUDE_CANBUS_ISOTP_H_
15#define ZEPHYR_INCLUDE_CANBUS_ISOTP_H_
58#define ISOTP_N_TIMEOUT_A -1
61#define ISOTP_N_TIMEOUT_BS -2
64#define ISOTP_N_TIMEOUT_CR -3
67#define ISOTP_N_WRONG_SN -4
70#define ISOTP_N_INVALID_FS -5
73#define ISOTP_N_UNEXP_PDU -6
76#define ISOTP_N_WFT_OVRN -7
79#define ISOTP_N_BUFFER_OVERFLW -8
82#define ISOTP_N_ERROR -9
87#define ISOTP_NO_FREE_FILTER -10
90#define ISOTP_NO_NET_BUF_LEFT -11
93#define ISOTP_NO_BUF_DATA_LEFT -12
96#define ISOTP_NO_CTX_LEFT -13
99#define ISOTP_RECV_TIMEOUT -14
113#define ISOTP_FIXED_ADDR_SA_POS (CONFIG_ISOTP_FIXED_ADDR_SA_POS)
116#define ISOTP_FIXED_ADDR_SA_MASK (CONFIG_ISOTP_FIXED_ADDR_SA_MASK)
119#define ISOTP_FIXED_ADDR_TA_POS (CONFIG_ISOTP_FIXED_ADDR_TA_POS)
122#define ISOTP_FIXED_ADDR_TA_MASK (CONFIG_ISOTP_FIXED_ADDR_TA_MASK)
125#define ISOTP_FIXED_ADDR_PRIO_POS (CONFIG_ISOTP_FIXED_ADDR_PRIO_POS)
128#define ISOTP_FIXED_ADDR_PRIO_MASK (CONFIG_ISOTP_FIXED_ADDR_PRIO_MASK)
131#define ISOTP_FIXED_ADDR_RX_MASK (CONFIG_ISOTP_FIXED_ADDR_RX_MASK)
145#define ISOTP_MSG_EXT_ADDR BIT(0)
151#define ISOTP_MSG_FIXED_ADDR BIT(1)
154#define ISOTP_MSG_IDE BIT(2)
157#define ISOTP_MSG_FDF BIT(3)
160#define ISOTP_MSG_BRS BIT(4)
225struct isotp_send_ctx;
226struct isotp_recv_ctx;
326 const uint8_t *data,
size_t len,
331#ifdef CONFIG_ISOTP_ENABLE_CONTEXT_BUFFERS
350int isotp_send_ctx_buf(
const struct device *can_dev,
351 const uint8_t *data,
size_t len,
375int isotp_send_net_ctx_buf(
const struct device *can_dev,
384#if defined(CONFIG_ISOTP_USE_TX_BUF) && \
385 defined(CONFIG_ISOTP_ENABLE_CONTEXT_BUFFERS)
405int isotp_send_buf(
const struct device *can_dev,
406 const uint8_t *data,
size_t len,
415struct isotp_callback {
420struct isotp_send_ctx {
423 const struct device *can_dev;
432 struct k_timer timer;
434 struct isotp_callback fin_cb;
435 struct k_sem fin_sem;
451struct isotp_recv_ctx {
453 const struct device *can_dev;
462 struct k_timer timer;
Controller Area Network (CAN) driver API.
int isotp_send(struct isotp_send_ctx *sctx, 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.
int isotp_recv_net(struct isotp_recv_ctx *rctx, struct net_buf **buffer, k_timeout_t timeout)
Get the net buffer on data reception.
void isotp_unbind(struct isotp_recv_ctx *rctx)
Unbind a context from the interface.
int isotp_bind(struct isotp_recv_ctx *rctx, 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.
int isotp_recv(struct isotp_recv_ctx *rctx, uint8_t *data, size_t len, k_timeout_t timeout)
Read out received data from fifo.
void(* isotp_tx_callback_t)(int error_nr, void *arg)
Transmission callback.
Definition isotp.h:223
struct _snode sys_snode_t
Single-linked list node structure.
Definition slist.h:39
state
Definition parser_state.h:29
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
Runtime device structure (in ROM) per driver instance.
Definition device.h:411
ISO-TP frame control options struct.
Definition isotp.h:210
uint8_t stmin
Minimum separation time.
Definition isotp.h:212
uint8_t bs
Block size.
Definition isotp.h:211
ISO-TP message id struct.
Definition isotp.h:169
uint8_t flags
Flags.
Definition isotp.h:194
uint32_t ext_id
Definition isotp.h:178
uint8_t ext_addr
ISO-TP extended address (if used)
Definition isotp.h:181
uint32_t std_id
Definition isotp.h:177
uint8_t dl
ISO-TP frame data length (TX_DL for TX address or RX_DL for RX address).
Definition isotp.h:192
Kernel timeout type.
Definition sys_clock.h:65
A structure used to submit work.
Definition kernel.h:3985
Network buffer representation.
Definition net_buf.h:1006