Lely core libraries
2.2.5
|
This header file is part of the CAN library; it contains the CAN network interface declarations. More...
Go to the source code of this file.
Typedefs | |
typedef struct __can_net | can_net_t |
An opaque CAN network interface type. | |
typedef struct __can_timer | can_timer_t |
An opaque CAN timer type. | |
typedef struct __can_recv | can_recv_t |
An opaque CAN frame receiver type. | |
typedef int | can_timer_func_t(const struct timespec *tp, void *data) |
The type of a CAN timer callback function, invoked by a CAN timer when the time is updated, or by a CAN network interface when the time at which the next timer triggers is updated. More... | |
typedef int | can_recv_func_t(const struct can_msg *msg, void *data) |
The type of a CAN receive callback function, invoked by a CAN frame receiver when a frame is received. More... | |
typedef int | can_send_func_t(const struct can_msg *msg, void *data) |
The type of a CAN send callback function, invoked by a CAN network interface when a frame needs to be sent. More... | |
Functions | |
can_net_t * | can_net_create (void) |
Creates a new CAN network interface. More... | |
void | can_net_destroy (can_net_t *net) |
Destroys a CAN network interface. More... | |
void | can_net_get_time (const can_net_t *net, struct timespec *tp) |
Retrieves the current time of a CAN network interface. More... | |
int | can_net_set_time (can_net_t *net, const struct timespec *tp) |
Sets the current time of a CAN network interface. More... | |
void | can_net_get_next_func (const can_net_t *net, can_timer_func_t **pfunc, void **pdata) |
Retrieves the callback function invoked when the time at which the next CAN timer triggers is updated. More... | |
void | can_net_set_next_func (can_net_t *net, can_timer_func_t *func, void *data) |
Sets the callback function invoked when the time at which the next CAN timer triggers is updated. More... | |
int | can_net_recv (can_net_t *net, const struct can_msg *msg) |
Receives a CAN frame with a network interface and processes it with the corresponding receiver(s). More... | |
int | can_net_send (can_net_t *net, const struct can_msg *msg) |
Sends a CAN frame from a network interface. More... | |
void | can_net_get_send_func (const can_net_t *net, can_send_func_t **pfunc, void **pdata) |
Retrieves the callback function used to send CAN frames from a network interface. More... | |
void | can_net_set_send_func (can_net_t *net, can_send_func_t *func, void *data) |
Sets the callback function used to send CAN frames from a network interface. More... | |
can_timer_t * | can_timer_create (void) |
Creates a new CAN timer. More... | |
void | can_timer_destroy (can_timer_t *timer) |
Destroys a CAN timer. More... | |
void | can_timer_get_func (const can_timer_t *timer, can_timer_func_t **pfunc, void **pdata) |
Retrieves the callback function invoked when a CAN timer is triggered. More... | |
void | can_timer_set_func (can_timer_t *timer, can_timer_func_t *func, void *data) |
Sets the callback function invoked when a CAN timer is triggered. More... | |
void | can_timer_start (can_timer_t *timer, can_net_t *net, const struct timespec *start, const struct timespec *interval) |
Starts a CAN timer and registers it with a network interface. More... | |
void | can_timer_stop (can_timer_t *timer) |
Stops a CAN timer and unregisters it with a network interface. More... | |
void | can_timer_timeout (can_timer_t *timer, can_net_t *net, int timeout) |
Starts a CAN timer and registers it with a network interface. More... | |
can_recv_t * | can_recv_create (void) |
Creates a new CAN frame receiver. More... | |
void | can_recv_destroy (can_recv_t *recv) |
Destroys a CAN frame receiver. More... | |
void | can_recv_get_func (const can_recv_t *recv, can_recv_func_t **pfunc, void **pdata) |
Retrieves the callback function used to process CAN frames with a receiver. More... | |
void | can_recv_set_func (can_recv_t *recv, can_recv_func_t *func, void *data) |
Sets the callback function used to process CAN frames with a receiver. More... | |
void | can_recv_start (can_recv_t *recv, can_net_t *net, uint_least32_t id, uint_least8_t flags) |
Registers a CAN frame receiver with a network interface and starts processing frames. More... | |
void | can_recv_stop (can_recv_t *recv) |
Stops a CAN frame receiver from processing frames and unregisters it with the network interface. More... | |
This header file is part of the CAN library; it contains the CAN network interface declarations.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Definition in file net.h.
typedef int can_timer_func_t(const struct timespec *tp, void *data) |
The type of a CAN timer callback function, invoked by a CAN timer when the time is updated, or by a CAN network interface when the time at which the next timer triggers is updated.
tp | a pointer to the current time. |
data | a pointer to user-specified data. |
set_errnum()
. typedef int can_recv_func_t(const struct can_msg *msg, void *data) |
The type of a CAN receive callback function, invoked by a CAN frame receiver when a frame is received.
msg | a pointer to the received CAN frame. |
data | a pointer to user-specified data. |
set_errnum()
. typedef int can_send_func_t(const struct can_msg *msg, void *data) |
The type of a CAN send callback function, invoked by a CAN network interface when a frame needs to be sent.
msg | a pointer to the CAN frame to be sent. |
data | a pointer to user-specified data. |
set_errnum()
. can_net_t* can_net_create | ( | void | ) |
Creates a new CAN network interface.
void can_net_destroy | ( | can_net_t * | net | ) |
void can_net_get_time | ( | const can_net_t * | net, |
struct timespec * | tp | ||
) |
Retrieves the current time of a CAN network interface.
net | a pointer to a CAN network interface. |
tp | the address at which to store the current time (can be NULL). |
int can_net_set_time | ( | can_net_t * | net, |
const struct timespec * | tp | ||
) |
Sets the current time of a CAN network interface.
This MAY invoke one or more CAN timer callback functions.
net | a pointer to a CAN network interface. |
tp | a pointer to the current time. |
void can_net_get_next_func | ( | const can_net_t * | net, |
can_timer_func_t ** | pfunc, | ||
void ** | pdata | ||
) |
Retrieves the callback function invoked when the time at which the next CAN timer triggers is updated.
net | a pointer to a CAN network interface. |
pfunc | the address at which to store a pointer to the callback function (can be NULL). |
pdata | the address at which to store a pointer to user-specified data (can be NULL). |
void can_net_set_next_func | ( | can_net_t * | net, |
can_timer_func_t * | func, | ||
void * | data | ||
) |
Sets the callback function invoked when the time at which the next CAN timer triggers is updated.
net | a pointer to a CAN network interface. |
func | a pointer to the function to be invoked by can_net_send(). |
data | a pointer to user-specified data (can be NULL). data is passed as the last parameter to func. |
Receives a CAN frame with a network interface and processes it with the corresponding receiver(s).
This function MAY invoke on or more CAN frame receiver callback functions.
net | a pointer to a CAN network interface. |
msg | a pointer to the CAN frame to be processed. |
Sends a CAN frame from a network interface.
This function invokes the callback function set by can_net_set_send_func().
net | a pointer to a CAN network interface. |
msg | a pointer to the CAN frame to be sent. |
void can_net_get_send_func | ( | const can_net_t * | net, |
can_send_func_t ** | pfunc, | ||
void ** | pdata | ||
) |
Retrieves the callback function used to send CAN frames from a network interface.
net | a pointer to a CAN network interface. |
pfunc | the address at which to store a pointer to the callback function (can be NULL). |
pdata | the address at which to store a pointer to user-specified data (can be NULL). |
void can_net_set_send_func | ( | can_net_t * | net, |
can_send_func_t * | func, | ||
void * | data | ||
) |
Sets the callback function used to send CAN frames from a network interface.
net | a pointer to a CAN network interface. |
func | a pointer to the function to be invoked by can_net_send(). |
data | a pointer to user-specified data (can be NULL). data is passed as the last parameter to func. |
can_timer_t* can_timer_create | ( | void | ) |
void can_timer_destroy | ( | can_timer_t * | timer | ) |
void can_timer_get_func | ( | const can_timer_t * | timer, |
can_timer_func_t ** | pfunc, | ||
void ** | pdata | ||
) |
Retrieves the callback function invoked when a CAN timer is triggered.
timer | a pointer to a CAN timer. |
pfunc | the address at which to store a pointer to the callback function (can be NULL). |
pdata | the address at which to store a pointer to user-specified data (can be NULL). |
void can_timer_set_func | ( | can_timer_t * | timer, |
can_timer_func_t * | func, | ||
void * | data | ||
) |
Sets the callback function invoked when a CAN timer is triggered.
timer | a pointer to a CAN timer. |
func | a pointer to the function to be invoked by can_net_set_time(). |
data | a pointer to user-specified data (can be NULL). data is passed as the last parameter to func. |
void can_timer_start | ( | can_timer_t * | timer, |
can_net_t * | net, | ||
const struct timespec * | start, | ||
const struct timespec * | interval | ||
) |
Starts a CAN timer and registers it with a network interface.
timer | a pointer to a CAN timer. |
net | a pointer to a CAN network interface. |
start | a pointer to the absolute time of the next trigger of the timer. If start is NULL, the next trigger time is given by interval with respect to the current time as obtained with can_net_get_time(). If interval is also NULL, the timer is stopped. |
interval | a pointer to the interval between successive triggers of the timer. If interval is NULL, the timer only triggers once, at the time given by start. |
void can_timer_stop | ( | can_timer_t * | timer | ) |
Stops a CAN timer and unregisters it with a network interface.
void can_timer_timeout | ( | can_timer_t * | timer, |
can_net_t * | net, | ||
int | timeout | ||
) |
Starts a CAN timer and registers it with a network interface.
The timer will trigger only once.
timer | a pointer to a CAN timer. |
net | a pointer to a CAN network interface. |
timeout | the timeout (in milliseconds) with respect to the current time as obtained with can_net_get_time(). If timeout is negative, the timer is stopped. |
can_recv_t* can_recv_create | ( | void | ) |
void can_recv_destroy | ( | can_recv_t * | recv | ) |
void can_recv_get_func | ( | const can_recv_t * | recv, |
can_recv_func_t ** | pfunc, | ||
void ** | pdata | ||
) |
Retrieves the callback function used to process CAN frames with a receiver.
recv | a pointer to a CAN frame receiver. |
pfunc | the address at which to store a pointer to the callback function (can be NULL). |
pdata | the address at which to store a pointer to user-specified data (can be NULL). |
void can_recv_set_func | ( | can_recv_t * | recv, |
can_recv_func_t * | func, | ||
void * | data | ||
) |
Sets the callback function used to process CAN frames with a receiver.
recv | a pointer to a CAN frame receiver. |
func | a pointer to the function to be invoked by can_net_recv(). |
data | a pointer to user-specified data (can be NULL). data is passed as the last parameter to func. |
void can_recv_start | ( | can_recv_t * | recv, |
can_net_t * | net, | ||
uint_least32_t | id, | ||
uint_least8_t | flags | ||
) |
Registers a CAN frame receiver with a network interface and starts processing frames.
recv | a pointer to a CAN frame receiver. |
net | a pointer to a CAN network interface. |
id | the CAN identifier for which the receiver should be invoked. |
flags | the flags that should be set in every accepted frame. |
void can_recv_stop | ( | can_recv_t * | recv | ) |
Stops a CAN frame receiver from processing frames and unregisters it with the network interface.