CANopenLinux
CANopenNode on Linux devices
Loading...
Searching...
No Matches
CO_error_msgs.h
1/*
2 * Definitions for CANopenNode Linux socketCAN Error handling.
3 *
4 * @file CO_Error_msgs.h
5 * @author Martin Wagner
6 * @copyright 2020 Neuberger Gebaeudeautomation GmbH
7 *
8 *
9 * This file is part of <https://github.com/CANopenNode/CANopenNode>, a CANopen Stack.
10 *
11 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
12 * file except in compliance with the License. You may obtain a copy of the License at
13 *
14 * http://www.apache.org/licenses/LICENSE-2.0
15 *
16 * Unless required by applicable law or agreed to in writing, software distributed under the License is
17 * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and limitations under the License.
19 */
20
21#ifndef CO_ERROR_MSGS_H
22#define CO_ERROR_MSGS_H
23
24#ifdef __cplusplus
25extern "C" {
26#endif
27
28/*
29 * Message definitions for Linux CANopen socket driver (notice and errors)
30 */
31#define CAN_NOT_FOUND "(%s) CAN Interface \"%s\" not found", __func__
32#define CAN_INIT_FAILED "(%s) CAN Interface \"%s\" Init failed", __func__
33#define CAN_BINDING_FAILED "(%s) Binding CAN Interface \"%s\" failed", __func__
34#define CAN_ERROR_FILTER_FAILED "(%s) Setting CAN Interface \"%s\" error filter failed", __func__
35#define CAN_FILTER_FAILED "(%s) Setting CAN Interface \"%s\" message filter failed", __func__
36#define CAN_NAMETOINDEX "CAN Interface \"%s\" -> Index %d"
37#define CAN_SOCKET_BUF_SIZE "CAN Interface \"%s\" RX buffer set to %d messages (%d Bytes)"
38#define CAN_RX_SOCKET_QUEUE_OVERFLOW "CAN Interface \"%s\" has lost %d messages"
39#define CAN_BUSOFF "CAN Interface \"%s\" changed to \"Bus Off\". Switching to Listen Only mode..."
40#define CAN_NOACK "CAN Interface \"%s\" no \"ACK\" received. Switching to Listen Only mode..."
41#define CAN_RX_PASSIVE "CAN Interface \"%s\" changed state to \"Rx Passive\""
42#define CAN_TX_PASSIVE "CAN Interface \"%s\" changed state to \"Tx Passive\""
43#define CAN_TX_LEVEL_ACTIVE "CAN Interface \"%s\" changed state to \"Active\""
44#define CAN_RX_BUF_OVERFLOW "CAN Interface \"%s\" Rx buffer overflow. Message dropped"
45#define CAN_TX_BUF_OVERFLOW "CAN Interface \"%s\" Tx buffer overflow. Message dropped"
46#define CAN_RX_LEVEL_WARNING "CAN Interface \"%s\" reached Rx Warning Level"
47#define CAN_TX_LEVEL_WARNING "CAN Interface \"%s\" reached Tx Warning Level"
48
49/*
50 * Message definitions for debugging
51 */
52#define DBG_GENERAL "(%s) Error: %s%d", __func__
53#define DBG_ERRNO "(%s) OS error \"%s\" in %s", __func__, strerror(errno)
54#define DBG_CO_DEBUG "(%s) CO_DEBUG: %s", __func__
55#define DBG_CAN_TX_FAILED "(%s) Transmitting CAN msg OID 0x%03x failed(%s)", __func__
56#define DBG_CAN_RX_PARAM_FAILED "(%s) Setting CAN rx buffer failed (%s)", __func__
57#define DBG_CAN_RX_FAILED "(%s) Receiving CAN msg failed (%s)", __func__
58#define DBG_CAN_ERROR_GENERAL \
59 "(%s) Socket error msg ID: 0x%08x, Data[0..7]: 0x%02x, 0x%02x, 0x%02x, 0x%02x," \
60 " 0x%02x, 0x%02x, 0x%02x, 0x%02x (%s)", \
61 __func__
62#define DBG_CAN_RX_EPOLL "(%s) CAN Epoll error (0x%02x - %s)", __func__
63#define DBG_CAN_SET_LISTEN_ONLY "(%s) %s Set Listen Only", __func__
64#define DBG_CAN_CLR_LISTEN_ONLY "(%s) %s Leave Listen Only", __func__
65
66/* mainline */
67#define DBG_EMERGENCY_RX \
68 "CANopen Emergency message from node 0x%02X: errorCode=0x%04X, errorRegister=0x%02X, errorBit=0x%02X, " \
69 "infoCode=0x%08X"
70#define DBG_NMT_CHANGE "CANopen NMT state changed to: \"%s\" (%d)"
71#define DBG_HB_CONS_NMT_CHANGE "CANopen Remote node ID = 0x%02X (index = %d): NMT state changed to: \"%s\" (%d)"
72#define DBG_ARGUMENT_UNKNOWN "(%s) Unknown %s argument: \"%s\"", __func__
73#define DBG_NOT_TCP_PORT "(%s) -c argument \"%s\" is not a valid tcp port", __func__
74#define DBG_WRONG_NODE_ID "(%s) Wrong node ID \"%d\"", __func__
75#define DBG_WRONG_PRIORITY "(%s) Wrong RT priority \"%d\"", __func__
76#define DBG_NO_CAN_DEVICE "(%s) Can't find CAN device \"%s\"", __func__
77#define DBG_STORAGE "(%s) Error with storage \"%s\"", __func__
78#define DBG_OD_ENTRY "(%s) Error in Object Dictionary entry: 0x%X", __func__
79#define DBG_CAN_OPEN "(%s) CANopen error in %s, err=%d", __func__
80#define DBG_CAN_OPEN_INFO "CANopen device, Node ID = 0x%02X, %s"
81
82/* CO_epoll_interface */
83#define DBG_EPOLL_UNKNOWN "(%s) CAN Epoll error, events=0x%02x, fd=%d", __func__
84#define DBG_COMMAND_LOCAL_BIND "(%s) Can't bind local socket to path \"%s\"", __func__
85#define DBG_COMMAND_TCP_BIND "(%s) Can't bind tcp socket to port \"%d\"", __func__
86#define DBG_COMMAND_STDIO_INFO "CANopen command interface on \"standard IO\" started"
87#define DBG_COMMAND_LOCAL_INFO "CANopen command interface on local socket \"%s\" started"
88#define DBG_COMMAND_TCP_INFO "CANopen command interface on tcp port \"%d\" started"
89
90#ifdef __cplusplus
91}
92#endif /* __cplusplus */
93
94#endif /* CO_ERROR_MSGS_H */