14#ifndef ZEPHYR_INCLUDE_CANBUS_ISOTP_H_
15#define ZEPHYR_INCLUDE_CANBUS_ISOTP_H_
60#define ISOTP_N_TIMEOUT_A -1
63#define ISOTP_N_TIMEOUT_BS -2
66#define ISOTP_N_TIMEOUT_CR -3
69#define ISOTP_N_WRONG_SN -4
72#define ISOTP_N_INVALID_FS -5
75#define ISOTP_N_UNEXP_PDU -6
78#define ISOTP_N_WFT_OVRN -7
81#define ISOTP_N_BUFFER_OVERFLW -8
84#define ISOTP_N_ERROR -9
89#define ISOTP_NO_FREE_FILTER -10
92#define ISOTP_NO_NET_BUF_LEFT -11
95#define ISOTP_NO_BUF_DATA_LEFT -12
98#define ISOTP_NO_CTX_LEFT -13
101#define ISOTP_RECV_TIMEOUT -14
115#define ISOTP_FIXED_ADDR_SA_POS (CONFIG_ISOTP_FIXED_ADDR_SA_POS)
118#define ISOTP_FIXED_ADDR_SA_MASK (CONFIG_ISOTP_FIXED_ADDR_SA_MASK)
121#define ISOTP_FIXED_ADDR_TA_POS (CONFIG_ISOTP_FIXED_ADDR_TA_POS)
124#define ISOTP_FIXED_ADDR_TA_MASK (CONFIG_ISOTP_FIXED_ADDR_TA_MASK)
127#define ISOTP_FIXED_ADDR_PRIO_POS (CONFIG_ISOTP_FIXED_ADDR_PRIO_POS)
130#define ISOTP_FIXED_ADDR_PRIO_MASK (CONFIG_ISOTP_FIXED_ADDR_PRIO_MASK)
133#define ISOTP_FIXED_ADDR_RX_MASK (CONFIG_ISOTP_FIXED_ADDR_RX_MASK)
147#define ISOTP_MSG_EXT_ADDR BIT(0)
153#define ISOTP_MSG_FIXED_ADDR BIT(1)
156#define ISOTP_MSG_IDE BIT(2)
159#define ISOTP_MSG_FDF BIT(3)
162#define ISOTP_MSG_BRS BIT(4)
227struct isotp_send_ctx;
228struct isotp_recv_ctx;
328 const uint8_t *data,
size_t len,
333#ifdef CONFIG_ISOTP_ENABLE_CONTEXT_BUFFERS
352int isotp_send_ctx_buf(
const struct device *can_dev,
353 const uint8_t *data,
size_t len,
377int isotp_send_net_ctx_buf(
const struct device *can_dev,
386#if defined(CONFIG_ISOTP_USE_TX_BUF) && \
387 defined(CONFIG_ISOTP_ENABLE_CONTEXT_BUFFERS)
407int isotp_send_buf(
const struct device *can_dev,
408 const uint8_t *data,
size_t len,
417struct isotp_callback {
422struct isotp_send_ctx {
425 const struct device *can_dev;
434 struct k_timer timer;
436 struct isotp_callback fin_cb;
437 struct k_sem fin_sem;
439 struct isotp_fc_opts opts;
443 struct isotp_msg_id rx_addr;
444 struct isotp_msg_id tx_addr;
453struct isotp_recv_ctx {
455 const struct device *can_dev;
457 struct net_buf *act_frag;
459 struct net_buf *recv_buf;
464 struct k_timer timer;
466 struct isotp_msg_id rx_addr;
467 struct isotp_msg_id tx_addr;
468 struct isotp_fc_opts opts;
Header file for Controller Area Network (CAN) controller 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:225
struct _snode sys_snode_t
Single-linked list node structure.
Definition slist.h:42
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:513
ISO-TP frame control options struct.
Definition isotp.h:212
uint8_t stmin
Minimum separation time.
Definition isotp.h:214
uint8_t bs
Block size.
Definition isotp.h:213
ISO-TP message id struct.
Definition isotp.h:171
uint8_t flags
Flags.
Definition isotp.h:196
uint32_t ext_id
Definition isotp.h:180
uint8_t ext_addr
ISO-TP extended address (if used).
Definition isotp.h:183
uint32_t std_id
Definition isotp.h:179
uint8_t dl
ISO-TP frame data length (TX_DL for TX address or RX_DL for RX address).
Definition isotp.h:194
Kernel timeout type.
Definition clock.h:65
Network buffer representation.
Definition net_buf.h:1015