Loading...
Searching...
No Matches
isotp.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2016 OTA keys S.A.
3 *
4 * This file is subject to the terms and conditions of the GNU Lesser
5 * General Public License v2.1. See the file LICENSE in the top level
6 * directory for more details.
7 */
8
20#ifndef CAN_CONN_ISOTP_H
21#define CAN_CONN_ISOTP_H
22
23#ifdef __cplusplus
24extern "C" {
25#endif
26
27#include "can/can.h"
28#include "can/isotp.h"
29#include "mbox.h"
30
31#if defined(MODULE_CONN_CAN_ISOTP_MULTI) || defined(DOXYGEN)
32#include "mutex.h"
33
34#ifndef CONN_CAN_ISOTP_MBOX_SIZE
38#define CONN_CAN_ISOTP_MBOX_SIZE (16)
39#endif
40
51
66
84
97{
98 slave->next = NULL;
99 slave->master = master;
100 slave->rx = NULL;
101}
102#else
103
104#ifndef CONN_CAN_ISOTP_MBOX_SIZE
108#define CONN_CAN_ISOTP_MBOX_SIZE (16)
109#endif
110
114typedef struct conn_can_isotp {
115 struct isotp isotp;
116 int ifnum;
117 int bound;
118 mbox_t mbox;
122#endif /* MODULE_CONN_CAN_ISOTP_MULTI */
123
134int conn_can_isotp_create(conn_can_isotp_t *conn, struct isotp_options *options, int ifnum);
135
146
156
168int conn_can_isotp_recv(conn_can_isotp_t *conn, void *buf, size_t size, uint32_t timeout);
169
182int conn_can_isotp_send(conn_can_isotp_t *conn, const void *buf, size_t size, int flags);
183
184#if defined(MODULE_CONN_CAN_ISOTP_MULTI) || defined(DOXYGEN)
194int conn_can_isotp_select(conn_can_isotp_slave_t **conn, conn_can_isotp_t *master, uint32_t timeout);
195#endif
196
197#ifdef __cplusplus
198}
199#endif
200
201#endif /* CAN_CONN_ISOTP_H */
int conn_can_isotp_recv(conn_can_isotp_t *conn, void *buf, size_t size, uint32_t timeout)
Receive isotp data.
int conn_can_isotp_close(conn_can_isotp_t *conn)
Close can isotp connection socket.
int conn_can_isotp_create(conn_can_isotp_t *conn, struct isotp_options *options, int ifnum)
Create can isotp connection socket.
#define CONN_CAN_ISOTP_MBOX_SIZE
Mailbox size of a conn_can_isotp_t.
Definition isotp.h:38
struct conn_can_isotp_master conn_can_isotp_t
ISO-TP connection.
Definition isotp.h:50
int conn_can_isotp_bind(conn_can_isotp_t *conn, struct isotp_fc_options *fc_options)
Bind a can isotp connection.
static void conn_can_isotp_init_slave(conn_can_isotp_t *master, conn_can_isotp_slave_t *slave)
Initialize a slave connection.
Definition isotp.h:96
struct conn_can_isotp_slave conn_can_isotp_slave_t
ISO-TP salve connection.
int conn_can_isotp_send(conn_can_isotp_t *conn, const void *buf, size_t size, int flags)
Generic can send.
int conn_can_isotp_select(conn_can_isotp_slave_t **conn, conn_can_isotp_t *master, uint32_t timeout)
Wait for reception from multiple connections.
ISO TP high level interface.
Mailbox API.
Mutex for thread synchronization.
Received data structure.
Definition common.h:122
ISO-TP master connection.
Definition isotp.h:70
int bound
1 if connection is bound
Definition isotp.h:76
msg_t mbox_queue[CONN_CAN_ISOTP_MBOX_SIZE]
Connection list message queue.
Definition isotp.h:82
mbox_t mbox
mailbox for the connection list
Definition isotp.h:80
struct conn_can_isotp_slave * next
First slave in the list.
Definition isotp.h:72
struct conn_can_isotp_master * master
Master connection.
Definition isotp.h:73
int ifnum
interface number
Definition isotp.h:75
can_rx_data_t * rx
Buffered rx data.
Definition isotp.h:77
mutex_t lock
Master lock.
Definition isotp.h:79
ISO-TP salve connection.
Definition isotp.h:58
int ifnum
interface number
Definition isotp.h:62
struct conn_can_isotp_slave * next
Next slave in the list.
Definition isotp.h:59
int bound
1 if connection is bound
Definition isotp.h:63
can_rx_data_t * rx
Buffered rx data.
Definition isotp.h:64
struct conn_can_isotp_master * master
Master connection holding the mailbox.
Definition isotp.h:60
The isotp_fc_options struct.
Definition isotp.h:60
The isotp_options struct.
Definition isotp.h:78
The isotp struct.
Definition isotp.h:106
Mailbox struct definition.
Definition mbox.h:41
Describes a message object which can be sent between threads.
Definition msg.h:196
Mutex structure.
Definition mutex.h:146
Definitions high-level CAN interface.