Build configuration

The build can be configured via C preprocessor definitions using the header file li_can_slv_config.h. The relevant defines therefore can be found in this section.

Mandatory Defines

The defines in this subsection are obligated and have to be set correctly otherwise the stack could not compiled as expected.

Used Feature Set

LI_CAN_SLV_GENERIC

This define should be used if you want to use the stack for a bootloader like openblt.

Todo:

add more documentation for LI_CAN_SLV_BOOT

This define should be used if you want to configure everything by yourself.

LI_CAN_SLV_BASIC

With this define the system alarms and system commands activated by LI_CAN_SLV_USE_SYS and the synchronous process handling activated by LI_CAN_SLV_USE_SYNC are set.

LI_CAN_SLV_FULL

With this define every feature except the upload is activated.

So this means the following defines are set: LI_CAN_SLV_USE_SYS, LI_CAN_SLV_USE_SYNC, LI_CAN_SLV_USE_ASYNC, LI_CAN_SLV_USE_ASYNC_DOWNLOAD and LI_CAN_SLV_USE_ASYNC_TUNNEL. If the upload is also needed add the define LI_CAN_SLV_USE_ASYNC_UPLOAD

Attention

One of the Feature Set must be used otherwise the stack would not work as expected.

Number of logical modules

LI_CAN_SLV_SET_MAX_NR_OF_LOGICAL_MODULES

Defines the maximum number of the usable logical modules.

The current implementation is able to handle 8 logical modules at a time but the real maximum depends on the current CAN hardware and number of message objects used by the activated modules. Default value if not defined is 1.

LI_CAN_SLV_USE_UNKNOWN_MODULE

Use this define to add a UKWN Module if no other module was added.

LI_CAN_SLV_DO_NOT_USE_XLOAD_INFO

Attention

Use this define to disable the xload_info shared memory but then so some of the internal features like sending download end acknowledge or change baud rate and others must be handled outside. Take a look at the lcsa_init() function for a better understanding.

Main/Monitor systems

LI_CAN_SLV_USE_MAIN_MON

Use this define to enable the LCS-Stack for Main/Monitor Systems.

CAN reconnect (Autobaud)

LI_CAN_SLV_USE_RECONNECT_ON_MAIN_NODE

Use the reconnect utility on the CAN Main Node.

LI_CAN_SLV_USE_RECONNECT_CHANGE_BAUDRATE_CALLBACK

Use the reconnect callback on baudrate change.

System alarms and system commands

LI_CAN_SLV_USE_SYS

Use the system message protocol handling.

LI_CAN_SLV_USE_SYS_ERROR_16_BIT

This define is used to enable the error message system with 16 Bit error codes.

LI_CAN_SLV_USE_SYS_ERROR_QUEUE

This define is used to enable the error message queue.

LI_CAN_SLV_USE_SYS_CHANGE_MODULE_NUMBER

Use the change module number feature.

LI_CAN_SLV_USE_SYS_CHANGE_MODULE_TYPE

Use the change module type feature.

LI_CAN_SLV_USE_SYS_FACTORY_RESET_CALLBACK

Use the factory reset feature.

LI_CAN_SLV_USE_SYS_RANDOM_STATUS_ACKNOWLEDGE

Use random status acknowledge feature.

Synchronous data handling

LI_CAN_SLV_USE_SYNC

Use the synchronous protocol handling.

LI_CAN_SLV_SET_SYNC_PROCESS_PERIODE_MAX

Set the maximum process period time in milliseconds, the default value is set to 100 milliseconds.

Attention

More than 200 milliseconds is not recommended and will cause a build warning.

Asynchronous data handling

LI_CAN_SLV_USE_ASYNC

Use the asynchrony protocol handling.

LI_CAN_SLV_USE_ASYNC_DOWNLOAD

Use this define to enable the asynchrony download protocol handling.

LI_CAN_SLV_USE_ASYNC_DOWNLOAD_BUFFER_EXTERNAL

Use this define to enable the asynchrony download protocol handling with external buffer handling.

LI_CAN_SLV_USE_ASYNC_UPLOAD

Use the asynchrony protocol upload handling.

LI_CAN_SLV_USE_ASYNC_TUNNEL

Use the asynchrony protocol tunnel handling.

HW depended settings

LI_CAN_SLV_ARCH_SET_BYTE_ORDER_LITTLE_ENDIAN

Set byte order to LI_CAN_SLV_ARCH_SET_BYTE_ORDER_LITTLE_ENDIAN or LI_CAN_SLV_ARCH_SET_BYTE_ORDER_BIG_ENDIAN.

Attention

The default setting is LI_CAN_SLV_ARCH_SET_BYTE_ORDER_LITTLE_ENDIAN.

LI_CAN_SLV_ARCH_SET_BYTE_ORDER_BIG_ENDIAN

Set byte order see also LI_CAN_SLV_ARCH_SET_BYTE_ORDER_LITTLE_ENDIAN.

LI_CAN_SLV_ARCH_USE_CANPIE_CH1_FOR_MAIN_NODE

Use the the CANPIE channel 1 HW interface for the can main node.

LI_CAN_SLV_ARCH_USE_CANPIE_CH2_FOR_MAIN_NODE

Use the the CANPIE channel 2 HW interface for the can monn node.

LI_CAN_SLV_ARCH_USE_CANPIE_CH2_FOR_MON_NODE

Use the the CANPIE channel 2 HW interface for the can monn node.

LI_CAN_SLV_ARCH_MAIN_NODE_MAX_NOF_MSG_OBJ

Set the maximum of usable message objects.

LI_CAN_SLV_ARCH_MON_NODE_MAX_NOF_MSG_OBJ

Example

This example shows how a li_can_slv_config.h file could look like.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
/****************************************************************************/
/*                                                                          */
/*                     Copyright (c) 2018, Liebherr PME1                    */
/*                         ALL RIGHTS RESERVED                              */
/*                                                                          */
/* This file is part of li_can_slv stack which is free software: you can    */
/* redistribute it and/or modify it under the terms of the GNU General      */
/* Public License as published by the Free Software Foundation, either      */
/* version 3 of the License, or (at your option) any later version.         */
/*                                                                          */
/* The li_can_slv stack is distributed in the hope that it will be useful,  */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of           */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General */
/* Public License for more details.                                         */
/*                                                                          */
/* You should have received a copy of the GNU General Public License which  */
/* should be located in the the root of the Stack. If not, contact Liebherr */
/* to obtain a copy.                                                        */
/****************************************************************************/
/**
 * @brief Liebherr CAN Slave Stack configuration
 * @copyright Liebherr PME1 ALL RIGHTS RESERVED
 * @date 2016
 * @file li_can_slv_config.txt
 * @addtogroup can_config
 * @{
 */

#ifndef LI_CAN_SLV_CONFIG_H_
#define LI_CAN_SLV_CONFIG_H_

#ifdef __cplusplus
extern "C" {
#endif // #ifdef __cplusplus

/*--------------------------------------------------------------------------*/
/* general definitions                                                      */
/*--------------------------------------------------------------------------*/
#define LI_CAN_SLV_BASIC
#define LI_CAN_SLV_SET_MAX_NR_OF_LOGICAL_MODULES (1u)

/*--------------------------------------------------------------------------*/
/* special definitions                                                      */
/*--------------------------------------------------------------------------*/

/*--------------------------------------------------------------------------*/
/* main/monitor definitions                                                 */
/*--------------------------------------------------------------------------*/
#define LI_CAN_SLV_USE_MAIN_MON

/*--------------------------------------------------------------------------*/
/* monitor only definitions                                                 */
/*--------------------------------------------------------------------------*/
#define LI_CAN_SLV_MON

/*--------------------------------------------------------------------------*/
/* reconnect definitions                                                    */
/*--------------------------------------------------------------------------*/
#define LI_CAN_SLV_USE_RECONNECT_ON_MAIN_NODE
#define LI_CAN_SLV_USE_RECONNECT_CHANGE_BAUDRATE_CALLBACK

/*--------------------------------------------------------------------------*/
/* LI_CAN_SLV System protocol definitions                                   */
/*--------------------------------------------------------------------------*/
#define LI_CAN_SLV_USE_SYS_ERROR_16_BIT
#define LI_CAN_SLV_USE_SYS_CHANGE_MODULE_NUMBER
#define LI_CAN_SLV_USE_SYS_FACTORY_RESET_CALLBACK

/*--------------------------------------------------------------------------*/
/* LI_CAN_SLV Synchronous protocol definitions                              */
/*--------------------------------------------------------------------------*/
#define LI_CAN_SLV_SET_SYNC_PROCESS_PERIODE_MAX (50)
#define LI_CAN_SLV_SYNC_CHECK_MODULE_NR_AND_DLC

/*--------------------------------------------------------------------------*/
/* LI_CAN_SLV Asynchronous protocol definitions                             */
/*--------------------------------------------------------------------------*/
#define LI_CAN_SLV_USE_ASYNC
#define LI_CAN_SLV_USE_ASYNC_DOWNLOAD
#define LI_CAN_SLV_USE_ASYNC_TUNNEL
#define LI_CAN_SLV_USE_ASYNC_UPLOAD

/*--------------------------------------------------------------------------*/
/* HW/architecture definitions                                              */
/*--------------------------------------------------------------------------*/
#define LI_CAN_SLV_ARCH_USE_CANPIE_CH1_FOR_MAIN_NODE
#define LI_CAN_SLV_ARCH_SET_BYTE_ORDER_LITTLE_ENDIAN
#define LI_CAN_SLV_ARCH_MAIN_NODE_MAX_NOF_MSG_OBJ	(32)
#define LI_CAN_SLV_ARCH_MON_NODE_MAX_NOF_MSG_OBJ	(32)

#ifdef __cplusplus
}// closing brace for extern "C"
#endif // #ifdef __cplusplus

#endif // #ifndef LI_CAN_SLV_CONFIG_H_

/** @} */