raw.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 
24 #ifndef CAN_RAW_H
25 #define CAN_RAW_H
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
31 #include "sched.h"
32 #include "can/can.h"
33 #include "can/common.h"
34 #include "can/device.h"
35 
36 #ifdef MODULE_CAN_MBOX
37 #include "mbox.h"
38 #endif
39 
40 #ifdef MODULE_TRX
41 #include "can/can_trx.h"
42 #endif
43 
47 #define RAW_CAN_DEV_UNDEF (-1)
48 
63 int raw_can_send(int ifnum, const struct can_frame *frame, kernel_pid_t pid);
64 
78 int raw_can_abort(int ifnum, int handle);
79 
95 int raw_can_subscribe_rx(int ifnum, struct can_filter *filter, kernel_pid_t pid, void *param);
96 
108 int raw_can_unsubscribe_rx(int ifnum, struct can_filter *filter, kernel_pid_t pid, void *param);
109 
121 
131 int raw_can_get_can_opt(int ifnum, can_opt_t *opt);
132 
142 int raw_can_set_can_opt(int ifnum, can_opt_t *opt);
143 
144 #if defined(MODULE_CAN_MBOX) || defined(DOXYGEN)
145 
159 int raw_can_send_mbox(int ifnum, const struct can_frame *frame, mbox_t *mbox);
160 
178 int raw_can_subscribe_rx_mbox(int ifnum, struct can_filter *filter, mbox_t *mbox, void *param);
179 
191 int raw_can_unsubscribe_rx_mbox(int ifnum, struct can_filter *filter, mbox_t *mbox, void *param);
192 #endif
193 
202 int raw_can_power_down(int ifnum);
203 
212 int raw_can_power_up(int ifnum);
213 
221 int raw_can_get_ifnum_by_name(const char *name);
222 
230 const char *raw_can_get_name_by_ifnum(int ifnum);
231 
241 
257 int raw_can_set_bitrate(int ifnum, uint32_t bitrate, uint32_t sample_point);
258 
259 #if defined(MODULE_CAN_TRX) || defined(DOXYGEN)
260 
271 int raw_can_set_trx(int ifnum, can_trx_t *trx);
272 #endif
273 
274 #ifdef __cplusplus
275 }
276 #endif
277 
278 #endif /* CAN_RAW_H */
279 
kernel_pid_t
int16_t kernel_pid_t
Unique process identifier.
Definition: sched.h:125
raw_can_unsubscribe_rx_mbox
int raw_can_unsubscribe_rx_mbox(int ifnum, struct can_filter *filter, mbox_t *mbox, void *param)
Unsubscribe from reception for the given CAN filter and mbox.
can_rx_data
Received data structure.
Definition: common.h:122
raw_can_set_bitrate
int raw_can_set_bitrate(int ifnum, uint32_t bitrate, uint32_t sample_point)
Set the given bitrate/sample_point to the given ifnum.
raw_can_free_frame
int raw_can_free_frame(can_rx_data_t *frame)
Free a received frame.
raw_can_send
int raw_can_send(int ifnum, const struct can_frame *frame, kernel_pid_t pid)
Send a CAN frame.
device.h
Definitions of CAN device interface.
can.h
Definitions high-level CAN interface.
raw_can_get_dev_by_ifnum
candev_dev_t * raw_can_get_dev_by_ifnum(int ifnum)
Get the candev descriptor from a given interface number.
sched.h
Scheduler API definition.
can_filter
Controller Area Network filter.
Definition: can.h:101
raw_can_get_name_by_ifnum
const char * raw_can_get_name_by_ifnum(int ifnum)
Get the interface name of a given interface number.
common.h
Definitions of high-level CAN interface.
can_trx
Generic transceiver descriptor.
Definition: can_trx.h:48
can_trx.h
CAN generic transceiver interface.
mbox_t
Mailbox struct definition.
Definition: mbox.h:41
mbox.h
Mailbox API.
raw_can_subscribe_rx_mbox
int raw_can_subscribe_rx_mbox(int ifnum, struct can_filter *filter, mbox_t *mbox, void *param)
Subscribe to a CAN filter.
raw_can_get_can_opt
int raw_can_get_can_opt(int ifnum, can_opt_t *opt)
Get a CAN option opt from interface ifnum.
can_frame
Controller Area Network frame.
Definition: can.h:88
raw_can_set_can_opt
int raw_can_set_can_opt(int ifnum, can_opt_t *opt)
Set a CAN option opt to interface ifnum.
raw_can_get_ifnum_by_name
int raw_can_get_ifnum_by_name(const char *name)
Get the interface number of a given interface.
raw_can_subscribe_rx
int raw_can_subscribe_rx(int ifnum, struct can_filter *filter, kernel_pid_t pid, void *param)
Subscribe to a CAN filter.
raw_can_power_up
int raw_can_power_up(int ifnum)
Power up a given interface.
raw_can_abort
int raw_can_abort(int ifnum, int handle)
Abort a CAN frame.
candev_dev
candev descriptor to pass to the device thread
Definition: device.h:69
raw_can_set_trx
int raw_can_set_trx(int ifnum, can_trx_t *trx)
Set a transceiver for a given interface.
raw_can_power_down
int raw_can_power_down(int ifnum)
Power down a given interface.
raw_can_unsubscribe_rx
int raw_can_unsubscribe_rx(int ifnum, struct can_filter *filter, kernel_pid_t pid, void *param)
Unsubscribe from reception for the given CAN filter on pid thread.
can_opt_t
Structure to pass a CAN option.
Definition: common.h:72
raw_can_send_mbox
int raw_can_send_mbox(int ifnum, const struct can_frame *frame, mbox_t *mbox)
Send a CAN frame.