CANopenLinux
CANopenNode on Linux devices
Loading...
Searching...
No Matches
CO_error.h
Go to the documentation of this file.
1
22#ifndef CO_ERROR_H
23#define CO_ERROR_H
24
25#include <stdint.h>
26#include <errno.h>
27#include <string.h>
28#include <linux/can.h>
29#include <net/if.h>
30
31#if __has_include("CO_error_custom.h")
32#include "CO_error_custom.h"
33#else
34#include "CO_error_msgs.h"
35#endif
36
37#ifdef __cplusplus
38extern "C" {
39#endif
40
66void log_printf(int priority, const char* format, ...);
67
81
86#define CO_CANerror_NOACK_MAX 16
87
93#define CO_CANerror_LISTEN_ONLY 10
94
98typedef struct {
99 int fd;
100 char ifName[IFNAMSIZ];
102 volatile unsigned char listenOnly;
103 struct timespec timestamp;
106
116void CO_CANerror_init(CO_CANinterfaceErrorhandler_t* CANerrorhandler, int fd, const char* ifname);
117
124
134
144
155 const struct can_frame* msg);
156
159#ifdef __cplusplus
160}
161#endif /* __cplusplus */
162
163#endif /* CO_ERROR_H */
unsigned int uint16_t
unsigned long int uint32_t
void CO_CANerror_init(CO_CANinterfaceErrorhandler_t *CANerrorhandler, int fd, const char *ifname)
Initialize CAN error handler.
Definition CO_error.c:176
void CO_CANerror_rxMsg(CO_CANinterfaceErrorhandler_t *CANerrorhandler)
Message received event.
Definition CO_error.c:201
void CO_CANerror_disable(CO_CANinterfaceErrorhandler_t *CANerrorhandler)
Reset CAN error handler.
Definition CO_error.c:191
CO_CANinterfaceState_t
driver interface state
Definition CO_error.h:76
CO_CANinterfaceState_t CO_CANerror_rxMsgError(CO_CANinterfaceErrorhandler_t *CANerrorhandler, const struct can_frame *msg)
Error message received event.
Definition CO_error.c:235
CO_CANinterfaceState_t CO_CANerror_txMsg(CO_CANinterfaceErrorhandler_t *CANerrorhandler)
Check if interface is ready for message transmission.
Definition CO_error.c:214
void log_printf(int priority, const char *format,...)
Message logging function.
Definition CO_main_basic.c:136
@ CO_INTERFACE_BUS_OFF
CAN bus off.
Definition CO_error.h:79
@ CO_INTERFACE_LISTEN_ONLY
CAN error passive/active, but currently no other device on bus.
Definition CO_error.h:78
@ CO_INTERFACE_ACTIVE
CAN error passive/active.
Definition CO_error.h:77
socketCAN interface error handling
Definition CO_error.h:98
int fd
interface FD
Definition CO_error.h:99
uint16_t CANerrorStatus
CAN error status bitfield, see CAN error status bitmasks.
Definition CO_error.h:104
uint32_t noackCounter
counts no ACK on CAN transmission
Definition CO_error.h:101
volatile unsigned char listenOnly
set to listen only mode
Definition CO_error.h:102