raw.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2016 OTA keys S.A.
3  * SPDX-License-Identifier: LGPL-2.1-only
4  */
5 
6 #pragma once
7 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 #include "sched.h"
28 #include "can/can.h"
29 #include "can/common.h"
30 #include "can/device.h"
31 
32 #ifdef MODULE_CAN_MBOX
33 #include "mbox.h"
34 #endif
35 
36 #ifdef MODULE_TRX
37 #include "can/can_trx.h"
38 #endif
39 
43 #define RAW_CAN_DEV_UNDEF (-1)
44 
59 int raw_can_send(int ifnum, const can_frame_t *frame, kernel_pid_t pid);
60 
74 int raw_can_abort(int ifnum, int handle);
75 
91 int raw_can_subscribe_rx(int ifnum, struct can_filter *filter, kernel_pid_t pid, void *param);
92 
104 int raw_can_unsubscribe_rx(int ifnum, struct can_filter *filter, kernel_pid_t pid, void *param);
105 
117 
127 int raw_can_get_can_opt(int ifnum, can_opt_t *opt);
128 
138 int raw_can_set_can_opt(int ifnum, can_opt_t *opt);
139 
140 #if defined(MODULE_CAN_MBOX) || defined(DOXYGEN)
155 int raw_can_send_mbox(int ifnum, const can_frame_t *frame, mbox_t *mbox);
156 
174 int raw_can_subscribe_rx_mbox(int ifnum, struct can_filter *filter, mbox_t *mbox, void *param);
175 
187 int raw_can_unsubscribe_rx_mbox(int ifnum, struct can_filter *filter, mbox_t *mbox, void *param);
188 #endif
189 
198 int raw_can_power_down(int ifnum);
199 
208 int raw_can_power_up(int ifnum);
209 
217 int raw_can_get_ifnum_by_name(const char *name);
218 
226 const char *raw_can_get_name_by_ifnum(int ifnum);
227 
237 
253 int raw_can_set_bitrate(int ifnum, uint32_t bitrate, uint32_t sample_point);
254 
255 #if defined(MODULE_CAN_TRX) || defined(DOXYGEN)
267 int raw_can_set_trx(int ifnum, can_trx_t *trx);
268 #endif
269 
270 #ifdef __cplusplus
271 }
272 #endif
273 
int raw_can_free_frame(can_rx_data_t *frame)
Free a received frame.
int raw_can_power_down(int ifnum)
Power down a given interface.
int raw_can_get_ifnum_by_name(const char *name)
Get the interface number of a given interface.
int raw_can_send_mbox(int ifnum, const can_frame_t *frame, mbox_t *mbox)
Send a CAN frame.
int raw_can_power_up(int ifnum)
Power up a given interface.
int raw_can_get_can_opt(int ifnum, can_opt_t *opt)
Get a CAN option opt from interface ifnum.
int raw_can_subscribe_rx(int ifnum, struct can_filter *filter, kernel_pid_t pid, void *param)
Subscribe to a CAN filter.
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.
const char * raw_can_get_name_by_ifnum(int ifnum)
Get the interface name of a given interface number.
int raw_can_send(int ifnum, const can_frame_t *frame, kernel_pid_t pid)
Send a CAN frame.
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.
int raw_can_set_can_opt(int ifnum, can_opt_t *opt)
Set a CAN option opt to interface ifnum.
int raw_can_abort(int ifnum, int handle)
Abort a CAN frame.
int raw_can_subscribe_rx_mbox(int ifnum, struct can_filter *filter, mbox_t *mbox, void *param)
Subscribe to a CAN filter.
int raw_can_set_trx(int ifnum, can_trx_t *trx)
Set a transceiver for a given interface.
candev_dev_t * raw_can_get_dev_by_ifnum(int ifnum)
Get the candev descriptor from a given interface number.
int raw_can_set_bitrate(int ifnum, uint32_t bitrate, uint32_t sample_point)
Set the given bitrate/sample_point to the given ifnum.
CAN generic transceiver interface.
int16_t kernel_pid_t
Unique process identifier.
Definition: sched.h:135
Mailbox API.
Scheduler API definition.
Controller Area Network filter.
Definition: can.h:125
Controller Area Network frame.
Definition: can.h:97
Structure to pass a CAN option.
Definition: common.h:81
Received data structure.
Definition: common.h:131
Generic transceiver descriptor.
Definition: can_trx.h:48
candev descriptor to pass to the device thread
Definition: device.h:68
Mailbox struct definition.
Definition: mbox.h:37
Definitions high-level CAN interface.
Definitions of high-level CAN interface.
Definitions of CAN device interface.