include/can/common.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 General
5  * Public License v2.1. See the file LICENSE in the top level directory for more
6  * details.
7  */
8 
26 #ifndef CAN_COMMON_H
27 #define CAN_COMMON_H
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
33 #include <stdint.h>
34 #include <sys/uio.h>
35 
36 #include "timex.h"
37 #include "thread.h"
38 #ifdef MODULE_CAN_MBOX
39 #include "mbox.h"
40 #endif
41 #include "net/gnrc/pktbuf.h"
42 
46 typedef enum {
55 } canopt_t;
56 
62 typedef enum {
68 
69 
73 typedef struct {
74  canopt_t opt;
75  uint16_t context;
76  void *data;
77  uint16_t data_len;
78 } can_opt_t;
79 
83 enum can_msg {
84  /* High level messages */
85  CAN_MSG_ACK = 0x100,
94 #if defined(MODULE_CAN_TRX) || defined(DOXYGEN)
96 #endif
97  /* candev internal messages */
98  CAN_MSG_EVENT = 0x200,
107 #if defined(MODULE_CAN_PM) || defined(DOXYGEN)
109 #endif
110  /* isotp messages */
111 #if defined(MODULE_CAN_ISOTP) || defined(DOXYGEN)
114 #endif
115 };
116 
123 typedef struct can_rx_data {
124  struct iovec data;
125  void *arg;
127 } can_rx_data_t;
128 
129 
133 typedef enum {
135 #if defined(MODULE_CAN_MBOX) || defined(DOXYGEN)
137 #endif
139 
146 typedef struct can_reg_entry {
147  struct can_reg_entry *next;
148  int ifnum;
149  union {
151 #if defined(MODULE_CAN_MBOX) || defined(DOXYGEN)
153 #endif
154  } target;
155 #if defined(MODULE_CAN_MBOX) || defined(DOXYGEN)
156  can_reg_type_t type;
157 #endif
159 
160 #ifdef __cplusplus
161 }
162 #endif
163 
164 #endif /* CAN_COMMON_H */
165 
controller bittiming parameters
uint16_t context
(optional) context for that option
kernel_pid_t pid
pid of the thread when using msg
Last Error Code.
driver reached error warning
Mailbox struct definition.
Definition: mbox.h:39
Mailbox API.
void * arg
upper layer private param
int16_t kernel_pid_t
Unique process identifier.
Definition: kernel_types.h:83
int ifnum
interface number for the entry
canopt_t
CAN options.
driver has been woken up by bus
can_reg_type_t type
entry type
Received data structure.
driver event
set controller state canopt_state_t
a frame has been received
struct can_reg_entry can_reg_entry_t
registry entry
power management event
canopt_state_t
CAN state options.
struct can_reg_entry * next
next for linked list
Interface definition for the global network buffer.
Structure to pass a CAN option.
uint16_t data_len
size of the data / the buffer
there was an error when transmitting
can_reg_type_t
registry entry types
can_msg
Messages which can be sent through the CAN stack.
power on, rx / tx mode
canopt_t opt
the option to get/set
Utility library for comparing and computing timestamps.
struct iovec data
iovec containing received data
Threading API.
void * data
data to set or buffer to read into
registry entry
mbox_t * mbox
mbox pointer
a frame has been sent
gnrc_pktsnip_t * snip
pointer to the allocated snip
set an option
bus-off detected
acknowledgment
set a transceiver
Structure for scatter/gather I/O.
Definition: uio.h:33
there was an error when receiving
Transmit Error Counter.
controller main clock
libc header for scatter/gather I/O
Type to represent parts (either headers or payload) of a packet, called snips.
Receive Error Counter.
driver switched in error passive
default entry (use msg)
struct can_rx_data can_rx_data_t
Received data structure.
get an option
bit timing parameter