1
0
Fork 0

Format some comments including license information.

This commit is contained in:
Janez 2024-07-09 00:49:52 +02:00
parent 90e266ce89
commit 2854ea4a44
12 changed files with 513 additions and 593 deletions

View file

@ -6,21 +6,16 @@
* @author Janez Paternoster * @author Janez Paternoster
* @copyright 2021 Janez Paternoster * @copyright 2021 Janez Paternoster
* *
* This file is part of CANopenNode, an opensource CANopen Stack. * This file is part of <https://github.com/CANopenNode/CANopenNode>, a CANopen Stack.
* Project home page is <https://github.com/CANopenNode/CANopenNode>.
* For more information on CANopen see <http://www.can-cia.org/>.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
* you may not use this file except in compliance with the License. * file except in compliance with the License. You may obtain a copy of the License at
* You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software distributed under the License is
* distributed under the License is distributed on an "AS IS" BASIS, * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* 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.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
#ifndef CO_APPLICATION_H #ifndef CO_APPLICATION_H
@ -47,8 +42,7 @@ extern "C" {
* *
* @param [in,out] bitRate Stored CAN bit rate, can be overridden. * @param [in,out] bitRate Stored CAN bit rate, can be overridden.
* @param [in,out] nodeId Stored CANopen NodeId, can be overridden. * @param [in,out] nodeId Stored CANopen NodeId, can be overridden.
* @param [out] errInfo Variable may indicate error information - index of * @param [out] errInfo Variable may indicate error information - index of erroneous OD entry.
* erroneous OD entry.
* *
* @return @ref CO_ReturnError_t CO_ERROR_NO in case of success. * @return @ref CO_ReturnError_t CO_ERROR_NO in case of success.
*/ */

View file

@ -7,21 +7,16 @@
* @copyright 2004 - 2015 Janez Paternoster, 2017 - 2020 Neuberger Gebaeudeautomation GmbH * @copyright 2004 - 2015 Janez Paternoster, 2017 - 2020 Neuberger Gebaeudeautomation GmbH
* *
* *
* This file is part of CANopenNode, an opensource CANopen Stack. * This file is part of <https://github.com/CANopenNode/CANopenNode>, a CANopen Stack.
* Project home page is <https://github.com/CANopenNode/CANopenNode>.
* For more information on CANopen see <http://www.can-cia.org/>.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
* you may not use this file except in compliance with the License. * file except in compliance with the License. You may obtain a copy of the License at
* You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software distributed under the License is
* distributed under the License is distributed on an "AS IS" BASIS, * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* 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.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
#include <string.h> #include <string.h>
@ -55,7 +50,6 @@ static CO_ReturnError_t CO_CANmodule_addInterface(CO_CANmodule_t *CANmodule,
static const uint32_t CO_INVALID_COB_ID = 0xffffffff; static const uint32_t CO_INVALID_COB_ID = 0xffffffff;
/******************************************************************************/
void CO_CANsetIdentToIndex( void CO_CANsetIdentToIndex(
uint32_t *lookup, uint32_t *lookup,
uint32_t index, uint32_t index,
@ -85,7 +79,6 @@ void CO_CANsetIdentToIndex(
} }
/******************************************************************************/
static uint32_t CO_CANgetIndexFromIdent( static uint32_t CO_CANgetIndexFromIdent(
uint32_t *lookup, uint32_t *lookup,
uint32_t ident) uint32_t ident)
@ -101,7 +94,7 @@ static uint32_t CO_CANgetIndexFromIdent(
#endif /* CO_DRIVER_MULTI_INTERFACE */ #endif /* CO_DRIVER_MULTI_INTERFACE */
/** Disable socketCAN rx ******************************************************/ /* Disable socketCAN rx */
static CO_ReturnError_t disableRx(CO_CANmodule_t *CANmodule) static CO_ReturnError_t disableRx(CO_CANmodule_t *CANmodule)
{ {
uint32_t i; uint32_t i;
@ -124,7 +117,7 @@ static CO_ReturnError_t disableRx(CO_CANmodule_t *CANmodule)
} }
/** Set up or update socketCAN rx filters *************************************/ /* Set up or update socketCAN rx filters */
static CO_ReturnError_t setRxFilters(CO_CANmodule_t *CANmodule) static CO_ReturnError_t setRxFilters(CO_CANmodule_t *CANmodule)
{ {
size_t i; size_t i;
@ -167,7 +160,6 @@ static CO_ReturnError_t setRxFilters(CO_CANmodule_t *CANmodule)
} }
/******************************************************************************/
void CO_CANsetConfigurationMode(void *CANptr) void CO_CANsetConfigurationMode(void *CANptr)
{ {
(void)CANptr; (void)CANptr;
@ -175,7 +167,6 @@ void CO_CANsetConfigurationMode(void *CANptr)
} }
/******************************************************************************/
void CO_CANsetNormalMode(CO_CANmodule_t *CANmodule) void CO_CANsetNormalMode(CO_CANmodule_t *CANmodule)
{ {
CO_ReturnError_t ret; CO_ReturnError_t ret;
@ -191,7 +182,6 @@ void CO_CANsetNormalMode(CO_CANmodule_t *CANmodule)
} }
/******************************************************************************/
CO_ReturnError_t CO_CANmodule_init( CO_ReturnError_t CO_CANmodule_init(
CO_CANmodule_t *CANmodule, CO_CANmodule_t *CANmodule,
void *CANptr, void *CANptr,
@ -263,7 +253,7 @@ CO_ReturnError_t CO_CANmodule_init(
} }
/** enable socketCAN *********************************************************/ /* enable socketCAN */
#if CO_DRIVER_MULTI_INTERFACE == 0 #if CO_DRIVER_MULTI_INTERFACE == 0
static static
#endif #endif
@ -320,7 +310,7 @@ CO_ReturnError_t CO_CANmodule_addInterface(CO_CANmodule_t *CANmodule,
} }
/* enable software time stamp mode (hardware timestamps do not work properly /* enable software time stamp mode (hardware timestamps do not work properly
* on all devices)*/ * on all devices) */
tmp = (SOF_TIMESTAMPING_SOFTWARE | tmp = (SOF_TIMESTAMPING_SOFTWARE |
SOF_TIMESTAMPING_RX_SOFTWARE); SOF_TIMESTAMPING_RX_SOFTWARE);
ret = setsockopt(interface->fd, SOL_SOCKET, SO_TIMESTAMPING, &tmp, sizeof(tmp)); ret = setsockopt(interface->fd, SOL_SOCKET, SO_TIMESTAMPING, &tmp, sizeof(tmp));
@ -387,7 +377,6 @@ CO_ReturnError_t CO_CANmodule_addInterface(CO_CANmodule_t *CANmodule,
} }
/******************************************************************************/
void CO_CANmodule_disable(CO_CANmodule_t *CANmodule) void CO_CANmodule_disable(CO_CANmodule_t *CANmodule)
{ {
uint32_t i; uint32_t i;
@ -423,7 +412,6 @@ void CO_CANmodule_disable(CO_CANmodule_t *CANmodule)
} }
/******************************************************************************/
CO_ReturnError_t CO_CANrxBufferInit( CO_ReturnError_t CO_CANrxBufferInit(
CO_CANmodule_t *CANmodule, CO_CANmodule_t *CANmodule,
uint16_t index, uint16_t index,
@ -477,7 +465,6 @@ CO_ReturnError_t CO_CANrxBufferInit(
#if CO_DRIVER_MULTI_INTERFACE > 0 #if CO_DRIVER_MULTI_INTERFACE > 0
/******************************************************************************/
bool_t CO_CANrxBuffer_getInterface( bool_t CO_CANrxBuffer_getInterface(
CO_CANmodule_t *CANmodule, CO_CANmodule_t *CANmodule,
uint16_t ident, uint16_t ident,
@ -514,7 +501,6 @@ bool_t CO_CANrxBuffer_getInterface(
#endif /* CO_DRIVER_MULTI_INTERFACE */ #endif /* CO_DRIVER_MULTI_INTERFACE */
/******************************************************************************/
CO_CANtx_t *CO_CANtxBufferInit( CO_CANtx_t *CO_CANtxBufferInit(
CO_CANmodule_t *CANmodule, CO_CANmodule_t *CANmodule,
uint16_t index, uint16_t index,
@ -550,7 +536,6 @@ CO_CANtx_t *CO_CANtxBufferInit(
#if CO_DRIVER_MULTI_INTERFACE > 0 #if CO_DRIVER_MULTI_INTERFACE > 0
/******************************************************************************/
CO_ReturnError_t CO_CANtxBuffer_setInterface( CO_ReturnError_t CO_CANtxBuffer_setInterface(
CO_CANmodule_t *CANmodule, CO_CANmodule_t *CANmodule,
uint16_t ident, uint16_t ident,
@ -573,7 +558,7 @@ CO_ReturnError_t CO_CANtxBuffer_setInterface(
#endif /* CO_DRIVER_MULTI_INTERFACE */ #endif /* CO_DRIVER_MULTI_INTERFACE */
#if CO_DRIVER_MULTI_INTERFACE > 0 #if CO_DRIVER_MULTI_INTERFACE > 0
/* send CAN message ***********************************************************/ /* send CAN message */
static CO_ReturnError_t CO_CANCheckSendInterface( static CO_ReturnError_t CO_CANCheckSendInterface(
CO_CANmodule_t *CANmodule, CO_CANmodule_t *CANmodule,
CO_CANtx_t *buffer, CO_CANtx_t *buffer,
@ -660,7 +645,6 @@ static CO_ReturnError_t CO_CANCheckSendInterface(
CO_ReturnError_t CO_CANCheckSend(CO_CANmodule_t *CANmodule, CO_CANtx_t *buffer); CO_ReturnError_t CO_CANCheckSend(CO_CANmodule_t *CANmodule, CO_CANtx_t *buffer);
/******************************************************************************/
CO_ReturnError_t CO_CANsend(CO_CANmodule_t *CANmodule, CO_CANtx_t *buffer) CO_ReturnError_t CO_CANsend(CO_CANmodule_t *CANmodule, CO_CANtx_t *buffer)
{ {
CO_ReturnError_t err; CO_ReturnError_t err;
@ -675,7 +659,6 @@ CO_ReturnError_t CO_CANsend(CO_CANmodule_t *CANmodule, CO_CANtx_t *buffer)
} }
/******************************************************************************/
CO_ReturnError_t CO_CANCheckSend(CO_CANmodule_t *CANmodule, CO_CANtx_t *buffer) CO_ReturnError_t CO_CANCheckSend(CO_CANmodule_t *CANmodule, CO_CANtx_t *buffer)
{ {
uint32_t i; uint32_t i;
@ -765,7 +748,6 @@ CO_ReturnError_t CO_CANsend(CO_CANmodule_t *CANmodule, CO_CANtx_t *buffer)
#endif /* CO_DRIVER_MULTI_INTERFACE == 0 */ #endif /* CO_DRIVER_MULTI_INTERFACE == 0 */
/******************************************************************************/
void CO_CANclearPendingSyncPDOs(CO_CANmodule_t *CANmodule) void CO_CANclearPendingSyncPDOs(CO_CANmodule_t *CANmodule)
{ {
(void)CANmodule; (void)CANmodule;
@ -773,7 +755,6 @@ void CO_CANclearPendingSyncPDOs(CO_CANmodule_t *CANmodule)
} }
/******************************************************************************/
void CO_CANmodule_process(CO_CANmodule_t *CANmodule) void CO_CANmodule_process(CO_CANmodule_t *CANmodule)
{ {
if (CANmodule == NULL || CANmodule->CANinterfaceCount == 0) return; if (CANmodule == NULL || CANmodule->CANinterfaceCount == 0) return;
@ -814,7 +795,7 @@ void CO_CANmodule_process(CO_CANmodule_t *CANmodule)
} }
/* Read CAN message from socket and verify some errors ************************/ /* Read CAN message from socket and verify some errors */
static CO_ReturnError_t CO_CANread( static CO_ReturnError_t CO_CANread(
CO_CANmodule_t *CANmodule, CO_CANmodule_t *CANmodule,
CO_CANinterface_t *interface, CO_CANinterface_t *interface,
@ -877,7 +858,7 @@ static CO_ReturnError_t CO_CANread(
} }
/* find msg inside rxArray and call corresponding CANrx_callback **************/ /* find msg inside rxArray and call corresponding CANrx_callback */
static int32_t CO_CANrxMsg( /* return index of received message in rxArray or -1 */ static int32_t CO_CANrxMsg( /* return index of received message in rxArray or -1 */
CO_CANmodule_t *CANmodule, CO_CANmodule_t *CANmodule,
struct can_frame *msg, /* CAN message input */ struct can_frame *msg, /* CAN message input */
@ -923,7 +904,6 @@ static int32_t CO_CANrxMsg( /* return index of received message
} }
/******************************************************************************/
bool_t CO_CANrxFromEpoll(CO_CANmodule_t *CANmodule, bool_t CO_CANrxFromEpoll(CO_CANmodule_t *CANmodule,
struct epoll_event *ev, struct epoll_event *ev,
CO_CANrxMsg_t *buffer, CO_CANrxMsg_t *buffer,

View file

@ -8,21 +8,16 @@
* @copyright 2004 - 2020 Janez Paternoster * @copyright 2004 - 2020 Janez Paternoster
* @copyright 2018 - 2020 Neuberger Gebaeudeautomation GmbH * @copyright 2018 - 2020 Neuberger Gebaeudeautomation GmbH
* *
* This file is part of CANopenNode, an opensource CANopen Stack. * This file is part of <https://github.com/CANopenNode/CANopenNode>, a CANopen Stack.
* Project home page is <https://github.com/CANopenNode/CANopenNode>.
* For more information on CANopen see <http://www.can-cia.org/>.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
* you may not use this file except in compliance with the License. * file except in compliance with the License. You may obtain a copy of the License at
* You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software distributed under the License is
* distributed under the License is distributed on an "AS IS" BASIS, * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* 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.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
@ -126,6 +121,15 @@ extern "C" {
CO_CONFIG_GLOBAL_FLAG_CALLBACK_PRE) CO_CONFIG_GLOBAL_FLAG_CALLBACK_PRE)
#endif #endif
#define CO_CONFIG_GFC (CO_CONFIG_GFC_ENABLE | \
CO_CONFIG_GFC_CONSUMER | \
CO_CONFIG_GFC_PRODUCER)
#define CO_CONFIG_SRDO (CO_CONFIG_SRDO_ENABLE | \
CO_CONFIG_SRDO_CHECK_TX | \
CO_CONFIG_GLOBAL_FLAG_CALLBACK_PRE | \
CO_CONFIG_GLOBAL_FLAG_TIMERNEXT)
#ifndef CO_CONFIG_GTW #ifndef CO_CONFIG_GTW
#define CO_CONFIG_GTW (CO_CONFIG_GTW_ASCII | \ #define CO_CONFIG_GTW (CO_CONFIG_GTW_ASCII | \
CO_CONFIG_GTW_ASCII_SDO | \ CO_CONFIG_GTW_ASCII_SDO | \

View file

@ -8,21 +8,16 @@
* @copyright 2018 - 2020 Neuberger Gebaeudeautomation GmbH * @copyright 2018 - 2020 Neuberger Gebaeudeautomation GmbH
* *
* *
* This file is part of CANopenNode, an opensource CANopen Stack. * This file is part of <https://github.com/CANopenNode/CANopenNode>, a CANopen Stack.
* Project home page is <https://github.com/CANopenNode/CANopenNode>.
* For more information on CANopen see <http://www.can-cia.org/>.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
* you may not use this file except in compliance with the License. * file except in compliance with the License. You may obtain a copy of the License at
* You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software distributed under the License is
* distributed under the License is distributed on an "AS IS" BASIS, * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* 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.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
/* following macro is necessary for accept4() function call (sockets) */ /* following macro is necessary for accept4() function call (sockets) */

View file

@ -9,21 +9,16 @@
* @copyright 2018 - 2020 Neuberger Gebaeudeautomation GmbH * @copyright 2018 - 2020 Neuberger Gebaeudeautomation GmbH
* *
* *
* This file is part of CANopenNode, an opensource CANopen Stack. * This file is part of <https://github.com/CANopenNode/CANopenNode>, a CANopen Stack.
* Project home page is <https://github.com/CANopenNode/CANopenNode>.
* For more information on CANopen see <http://www.can-cia.org/>.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
* you may not use this file except in compliance with the License. * file except in compliance with the License. You may obtain a copy of the License at
* You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software distributed under the License is
* distributed under the License is distributed on an "AS IS" BASIS, * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* 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.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
#ifndef CO_EPOLL_INTERFACE_H #ifndef CO_EPOLL_INTERFACE_H
@ -122,8 +117,7 @@ typedef struct {
* @param ep This object * @param ep This object
* @param timerInterval_us Timer interval in microseconds * @param timerInterval_us Timer interval in microseconds
* *
* @return @ref CO_ReturnError_t CO_ERROR_NO, CO_ERROR_ILLEGAL_ARGUMENT or * @return @ref CO_ReturnError_t CO_ERROR_NO, CO_ERROR_ILLEGAL_ARGUMENT or CO_ERROR_SYSCALL.
* CO_ERROR_SYSCALL.
*/ */
CO_ReturnError_t CO_epoll_create(CO_epoll_t *ep, uint32_t timerInterval_us); CO_ReturnError_t CO_epoll_create(CO_epoll_t *ep, uint32_t timerInterval_us);
@ -258,8 +252,7 @@ typedef struct {
* @param socketTimeout_ms Timeout for established socket connection in [ms] * @param socketTimeout_ms Timeout for established socket connection in [ms]
* @param localSocketPath File path, if commandInterface is local socket * @param localSocketPath File path, if commandInterface is local socket
* *
* @return @ref CO_ReturnError_t CO_ERROR_NO, CO_ERROR_ILLEGAL_ARGUMENT or * @return @ref CO_ReturnError_t CO_ERROR_NO, CO_ERROR_ILLEGAL_ARGUMENT or CO_ERROR_SYSCALL.
* CO_ERROR_SYSCALL.
*/ */
CO_ReturnError_t CO_epoll_createGtw(CO_epoll_gtw_t *epGtw, CO_ReturnError_t CO_epoll_createGtw(CO_epoll_gtw_t *epGtw,
int epoll_fd, int epoll_fd,
@ -302,6 +295,6 @@ void CO_epoll_processGtw(CO_epoll_gtw_t *epGtw,
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif /*__cplusplus*/ #endif /* __cplusplus */
#endif /* CO_EPOLL_INTERFACE_H */ #endif /* CO_EPOLL_INTERFACE_H */

View file

@ -6,21 +6,16 @@
* @copyright 2018 - 2020 Neuberger Gebaeudeautomation GmbH * @copyright 2018 - 2020 Neuberger Gebaeudeautomation GmbH
* *
* *
* This file is part of CANopenNode, an opensource CANopen Stack. * This file is part of <https://github.com/CANopenNode/CANopenNode>, a CANopen Stack.
* Project home page is <https://github.com/CANopenNode/CANopenNode>.
* For more information on CANopen see <http://www.can-cia.org/>.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
* you may not use this file except in compliance with the License. * file except in compliance with the License. You may obtain a copy of the License at
* You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software distributed under the License is
* distributed under the License is distributed on an "AS IS" BASIS, * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* 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.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
#include <string.h> #include <string.h>
@ -35,7 +30,7 @@
#include "301/CO_driver.h" #include "301/CO_driver.h"
/** /*
* Reset CAN interface and set to listen only mode * Reset CAN interface and set to listen only mode
*/ */
static CO_CANinterfaceState_t CO_CANerrorSetListenOnly( static CO_CANinterfaceState_t CO_CANerrorSetListenOnly(
@ -66,7 +61,7 @@ static CO_CANinterfaceState_t CO_CANerrorSetListenOnly(
} }
/** /*
* Clear listen only * Clear listen only
*/ */
static void CO_CANerrorClearListenOnly( static void CO_CANerrorClearListenOnly(
@ -80,7 +75,7 @@ static void CO_CANerrorClearListenOnly(
} }
/** /*
* Check and handle "bus off" state * Check and handle "bus off" state
*/ */
static CO_CANinterfaceState_t CO_CANerrorBusoff( static CO_CANinterfaceState_t CO_CANerrorBusoff(
@ -104,7 +99,7 @@ static CO_CANinterfaceState_t CO_CANerrorBusoff(
} }
/** /*
* Check and handle controller problems * Check and handle controller problems
*/ */
static CO_CANinterfaceState_t CO_CANerrorCrtl( static CO_CANinterfaceState_t CO_CANerrorCrtl(
@ -165,7 +160,7 @@ static CO_CANinterfaceState_t CO_CANerrorCrtl(
} }
/** /*
* Check and handle controller problems * Check and handle controller problems
*/ */
static CO_CANinterfaceState_t CO_CANerrorNoack( static CO_CANinterfaceState_t CO_CANerrorNoack(
@ -199,7 +194,6 @@ static CO_CANinterfaceState_t CO_CANerrorNoack(
} }
/******************************************************************************/
void CO_CANerror_init( void CO_CANerror_init(
CO_CANinterfaceErrorhandler_t *CANerrorhandler, CO_CANinterfaceErrorhandler_t *CANerrorhandler,
int fd, int fd,
@ -219,7 +213,6 @@ void CO_CANerror_init(
} }
/******************************************************************************/
void CO_CANerror_disable( void CO_CANerror_disable(
CO_CANinterfaceErrorhandler_t *CANerrorhandler) CO_CANinterfaceErrorhandler_t *CANerrorhandler)
{ {
@ -232,7 +225,6 @@ void CO_CANerror_disable(
} }
/******************************************************************************/
void CO_CANerror_rxMsg( void CO_CANerror_rxMsg(
CO_CANinterfaceErrorhandler_t *CANerrorhandler) CO_CANinterfaceErrorhandler_t *CANerrorhandler)
{ {
@ -248,7 +240,6 @@ void CO_CANerror_rxMsg(
} }
/******************************************************************************/
CO_CANinterfaceState_t CO_CANerror_txMsg( CO_CANinterfaceState_t CO_CANerror_txMsg(
CO_CANinterfaceErrorhandler_t *CANerrorhandler) CO_CANinterfaceErrorhandler_t *CANerrorhandler)
{ {
@ -272,7 +263,6 @@ CO_CANinterfaceState_t CO_CANerror_txMsg(
} }
/******************************************************************************/
CO_CANinterfaceState_t CO_CANerror_rxMsgError( CO_CANinterfaceState_t CO_CANerror_rxMsgError(
CO_CANinterfaceErrorhandler_t *CANerrorhandler, CO_CANinterfaceErrorhandler_t *CANerrorhandler,
const struct can_frame *msg) const struct can_frame *msg)

View file

@ -7,21 +7,16 @@
* @copyright 2018 - 2020 Neuberger Gebaeudeautomation GmbH * @copyright 2018 - 2020 Neuberger Gebaeudeautomation GmbH
* *
* *
* This file is part of CANopenNode, an opensource CANopen Stack. * This file is part of <https://github.com/CANopenNode/CANopenNode>, a CANopen Stack.
* Project home page is <https://github.com/CANopenNode/CANopenNode>.
* For more information on CANopen see <http://www.can-cia.org/>.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
* you may not use this file except in compliance with the License. * file except in compliance with the License. You may obtain a copy of the License at
* You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software distributed under the License is
* distributed under the License is distributed on an "AS IS" BASIS, * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* 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.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
@ -68,8 +63,7 @@ extern "C" {
* openlog ("exampleprog", LOG_PID | LOG_PERROR, LOG_USER); * openlog ("exampleprog", LOG_PID | LOG_PERROR, LOG_USER);
* @endcode * @endcode
* *
* @param priority one of LOG_EMERG, LOG_ALERT, LOG_CRIT, LOG_ERR, LOG_WARNING, * @param priority one of LOG_EMERG, LOG_ALERT, LOG_CRIT, LOG_ERR, LOG_WARNING, LOG_NOTICE, LOG_INFO, LOG_DEBUG
* LOG_NOTICE, LOG_INFO, LOG_DEBUG
* @param format format string as in printf * @param format format string as in printf
*/ */
void log_printf(int priority, const char *format, ...); void log_printf(int priority, const char *format, ...);
@ -186,6 +180,6 @@ CO_CANinterfaceState_t CO_CANerror_rxMsgError(
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif /*__cplusplus*/ #endif /* __cplusplus */
#endif /* CO_ERROR_H */ #endif /* CO_ERROR_H */

View file

@ -6,21 +6,16 @@
* @copyright 2020 Neuberger Gebaeudeautomation GmbH * @copyright 2020 Neuberger Gebaeudeautomation GmbH
* *
* *
* This file is part of CANopenNode, an opensource CANopen Stack. * This file is part of <https://github.com/CANopenNode/CANopenNode>, a CANopen Stack.
* Project home page is <https://github.com/CANopenNode/CANopenNode>.
* For more information on CANopen see <http://www.can-cia.org/>.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
* you may not use this file except in compliance with the License. * file except in compliance with the License. You may obtain a copy of the License at
* You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software distributed under the License is
* distributed under the License is distributed on an "AS IS" BASIS, * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* 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.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */

View file

@ -5,21 +5,16 @@
* @author Janez Paternoster * @author Janez Paternoster
* @copyright 2020 Janez Paternoster * @copyright 2020 Janez Paternoster
* *
* This file is part of CANopenNode, an opensource CANopen Stack. * This file is part of <https://github.com/CANopenNode/CANopenNode>, a CANopen Stack.
* Project home page is <https://github.com/CANopenNode/CANopenNode>.
* For more information on CANopen see <http://www.can-cia.org/>.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
* you may not use this file except in compliance with the License. * file except in compliance with the License. You may obtain a copy of the License at
* You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software distributed under the License is
* distributed under the License is distributed on an "AS IS" BASIS, * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* 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.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
#include <stdio.h> #include <stdio.h>
@ -406,7 +401,7 @@ int main (int argc, char *argv[]) {
CANptr.can_ifindex = if_nametoindex(CANdevice); CANptr.can_ifindex = if_nametoindex(CANdevice);
} }
/* Valid NodeId is 1..127 or 0xFF(unconfigured) in case of LSSslaveEnabled*/ /* Valid NodeId is 1..127 or 0xFF(unconfigured) in case of LSSslaveEnabled */
if ((nodeIdFromArgs == 0 || nodeIdFromArgs > 127) if ((nodeIdFromArgs == 0 || nodeIdFromArgs > 127)
&& (!CO_isLSSslaveEnabled(CO) && (!CO_isLSSslaveEnabled(CO)
|| nodeIdFromArgs != CO_LSS_NODE_ID_ASSIGNMENT) || nodeIdFromArgs != CO_LSS_NODE_ID_ASSIGNMENT)

View file

@ -5,21 +5,16 @@
* @author Janez Paternoster * @author Janez Paternoster
* @copyright 2021 Janez Paternoster * @copyright 2021 Janez Paternoster
* *
* This file is part of CANopenNode, an opensource CANopen Stack. * This file is part of <https://github.com/CANopenNode/CANopenNode>, a CANopen Stack.
* Project home page is <https://github.com/CANopenNode/CANopenNode>.
* For more information on CANopen see <http://www.can-cia.org/>.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
* you may not use this file except in compliance with the License. * file except in compliance with the License. You may obtain a copy of the License at
* You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software distributed under the License is
* distributed under the License is distributed on an "AS IS" BASIS, * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* 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.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
#include "CO_storageLinux.h" #include "CO_storageLinux.h"
@ -225,7 +220,7 @@ CO_ReturnError_t CO_storageLinux_init(CO_storage_t *storage,
} }
} }
/* Read data into temporary buffer first. Then verify and copy to addr*/ /* Read data into temporary buffer first. Then verify and copy to addr */
if (!dataCorrupt) { if (!dataCorrupt) {
size_t cnt = fread(buf, 1, entry->len + sizeof(uint16_t), fp); size_t cnt = fread(buf, 1, entry->len + sizeof(uint16_t), fp);

View file

@ -6,21 +6,16 @@
* @author Janez Paternoster * @author Janez Paternoster
* @copyright 2021 Janez Paternoster * @copyright 2021 Janez Paternoster
* *
* This file is part of CANopenNode, an opensource CANopen Stack. * This file is part of <https://github.com/CANopenNode/CANopenNode>, a CANopen Stack.
* Project home page is <https://github.com/CANopenNode/CANopenNode>.
* For more information on CANopen see <http://www.can-cia.org/>.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
* you may not use this file except in compliance with the License. * file except in compliance with the License. You may obtain a copy of the License at
* You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software distributed under the License is
* distributed under the License is distributed on an "AS IS" BASIS, * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* 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.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
#ifndef CO_STORAGE_LINUX_H #ifndef CO_STORAGE_LINUX_H
@ -54,11 +49,9 @@ extern "C" {
* and writes data to addresses specified inside entries. This function * and writes data to addresses specified inside entries. This function
* internally calls @ref CO_storage_init(). * internally calls @ref CO_storage_init().
* *
* @param storage This object will be initialized. It must be defined by * @param storage This object will be initialized. It must be defined by application and must exist permanently.
* application and must exist permanently.
* @param CANmodule CAN device, used for @ref CO_LOCK_OD() macro. * @param CANmodule CAN device, used for @ref CO_LOCK_OD() macro.
* @param OD_1010_StoreParameters OD entry for 0x1010 -"Store parameters". * @param OD_1010_StoreParameters OD entry for 0x1010 -"Store parameters". Entry is optional, may be NULL.
* Entry is optional, may be NULL.
* @param OD_1011_RestoreDefaultParam OD entry for 0x1011 -"Restore default * @param OD_1011_RestoreDefaultParam OD entry for 0x1011 -"Restore default
* parameters". Entry is optional, may be NULL. * parameters". Entry is optional, may be NULL.
* @param entries Pointer to array of storage entries, see @ref CO_storage_init. * @param entries Pointer to array of storage entries, see @ref CO_storage_init.
@ -88,11 +81,9 @@ CO_ReturnError_t CO_storageLinux_init(CO_storage_t *storage,
* into pre-opened file. * into pre-opened file.
* *
* @param storage This object * @param storage This object
* @param closeFiles If true, then all files will be closed. Use on end of the * @param closeFiles If true, then all files will be closed. Use on end of the program.
* program.
* *
* @return 0 on success or bit mask from subIndexOD values, where data was not * @return 0 on success or bit mask from subIndexOD values, where data was not able to be saved.
* able to be saved.
*/ */
uint32_t CO_storageLinux_auto_process(CO_storage_t *storage, uint32_t CO_storageLinux_auto_process(CO_storage_t *storage,
bool_t closeFiles); bool_t closeFiles);

View file

@ -5,21 +5,16 @@
* @author Janez Paternoster * @author Janez Paternoster
* @copyright 2020 Janez Paternoster * @copyright 2020 Janez Paternoster
* *
* This file is part of CANopenNode, an opensource CANopen Stack. * This file is part of <https://github.com/CANopenNode/CANopenNode>, a CANopen Stack.
* Project home page is <https://github.com/CANopenNode/CANopenNode>.
* For more information on CANopen see <http://www.can-cia.org/>.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
* you may not use this file except in compliance with the License. * file except in compliance with the License. You may obtain a copy of the License at
* You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software distributed under the License is
* distributed under the License is distributed on an "AS IS" BASIS, * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* 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.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ */
#include <stdio.h> #include <stdio.h>
@ -101,14 +96,14 @@ static int printReply(int fd_gtw) {
} }
for (;;) { for (;;) {
ssize_t nRead = read(fd_gtw, &replyBuf[count], BUF_SIZE); /* blocking*/ ssize_t nRead = read(fd_gtw, &replyBuf[count], BUF_SIZE); /* blocking */
if(nRead > 0) { if(nRead > 0) {
count += nRead; count += nRead;
replyBuf[count] = 0; replyBuf[count] = 0;
if (firstPass == 1) { if (firstPass == 1) {
/* check for response type. Only response value goes to stdout*/ /* check for response type. Only response value goes to stdout */
if (strstr(replyBuf, "] ERROR:") != NULL if (strstr(replyBuf, "] ERROR:") != NULL
&& strstr(replyBuf, "\r\n") != NULL && strstr(replyBuf, "\r\n") != NULL
) { ) {
@ -198,7 +193,6 @@ static int printReply(int fd_gtw) {
} }
/******************************************************************************/
int main (int argc, char *argv[]) { int main (int argc, char *argv[]) {
/* configurable options */ /* configurable options */
enum {out_all, out_data, out_flat} outputType = out_all; enum {out_all, out_data, out_flat} outputType = out_all;
@ -357,7 +351,7 @@ int main (int argc, char *argv[]) {
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
} }
else { // addrFamily == AF_UNIX else { /* addrFamily == AF_UNIX */
fd_gtw = socket(AF_UNIX, SOCK_STREAM, 0); fd_gtw = socket(AF_UNIX, SOCK_STREAM, 0);
if(fd_gtw == -1) { if(fd_gtw == -1) {
perror("Socket creation failed"); perror("Socket creation failed");
@ -429,14 +423,14 @@ int main (int argc, char *argv[]) {
size_t len = strlen(commBuf); size_t len = strlen(commBuf);
if (len < 1) continue; if (len < 1) continue;
// send command /* send command */
if (write(fd_gtw, commBuf, len) != len) { /* blocking function */ if (write(fd_gtw, commBuf, len) != len) { /* blocking function */
perror("Socket write failed"); perror("Socket write failed");
free(commBuf); free(commBuf);
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
// print reply, if command is complete /* print reply, if command is complete */
if (commBuf[len - 1] == '\n') { if (commBuf[len - 1] == '\n') {
if (printReply(fd_gtw) == EXIT_FAILURE) { if (printReply(fd_gtw) == EXIT_FAILURE) {
ret = EXIT_FAILURE; ret = EXIT_FAILURE;
@ -489,7 +483,7 @@ int main (int argc, char *argv[]) {
if (len < BUF_SIZE-2 && lastChar != '\n') if (len < BUF_SIZE-2 && lastChar != '\n')
continue; continue;
// send command /* send command */
if (write(fd_gtw, commBuf, len) != len) { /* blocking f. */ if (write(fd_gtw, commBuf, len) != len) { /* blocking f. */
perror("Socket write failed"); perror("Socket write failed");
free(commBuf); free(commBuf);
@ -513,14 +507,14 @@ int main (int argc, char *argv[]) {
size_t len = strlen(commBuf); size_t len = strlen(commBuf);
if (len < 1) continue; if (len < 1) continue;
// send command /* send command */
if (write(fd_gtw, commBuf, len) != len) { /* blocking function */ if (write(fd_gtw, commBuf, len) != len) { /* blocking function */
perror("Socket write failed"); perror("Socket write failed");
free(commBuf); free(commBuf);
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
// print reply, if command is complete /* print reply, if command is complete */
if (commBuf[len - 1] == '\n') { if (commBuf[len - 1] == '\n') {
if (printReply(fd_gtw) == EXIT_FAILURE) { if (printReply(fd_gtw) == EXIT_FAILURE) {
ret = EXIT_FAILURE; ret = EXIT_FAILURE;