1 /*
2  * Percepio DFM v2.1.0
3  * Copyright 2023 Percepio AB
4  * www.percepio.com
5  *
6  * SPDX-License-Identifier: Apache-2.0
7  */
8 
9 /**
10  * @file
11  *
12  * @brief DFM Configuration
13  */
14 
15 #ifndef DFM_CONFIG_H
16 #define DFM_CONFIG_H
17 
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
21 
22 /**
23  * @brief Global flag used to completely exclude all DFM functionality from compilation
24  */
25 #define DFM_CFG_ENABLED CONFIG_PERCEPIO_DFM
26 
27 /**
28  * @brief The firmware version. This needs to be set to differentiate the alerts between versions.
29  */
30 #define DFM_CFG_FIRMWARE_VERSION CONFIG_PERCEPIO_DFM_CFG_FIRMWARE_VERSION
31 
32 /**
33  * @brief An identifier of the product type.
34  */
35 #define DFM_CFG_PRODUCTID CONFIG_PERCEPIO_DFM_CFG_PRODUCTID
36 
37 /* Enable diagnostic messages from DFM_DEBUG(...). Will use DFM_ERROR to output debug information. */
38 #define DFM_CFG_ENABLE_DEBUG_PRINT CONFIG_PERCEPIO_DFM_CFG_ENABLE_DEBUG_PRINT
39 
40 /* Add your serial console print string function here (full printf not needed, only "print") */
41 #define DFM_CFG_PRINT(msg) printk("%s", msg)
42 
43 /* This will be called for errors. Point this to a suitable print function. This will also be used for DFM_DEBUG_PRINT messages. */
44 #define DFM_ERROR_PRINT(msg) DFM_CFG_PRINT(msg)
45 
46 /**
47  * @brief The maximum size of a "chunk" that will be stored or sent.
48  */
49 #define DFM_CFG_MAX_PAYLOAD_CHUNK_SIZE CONFIG_PERCEPIO_DFM_CFG_MAX_PAYLOAD_CHUNK_SIZE
50 
51 /**
52  * @brief The maximum length of the device name.
53  */
54 #define DFM_CFG_DEVICE_NAME_MAX_LEN CONFIG_PERCEPIO_DFM_CFG_DEVICE_NAME_MAX_LEN
55 
56 /**
57  * @brief The maximum number of payloads that can be attached to an alert.
58  */
59 #define DFM_CFG_MAX_PAYLOADS CONFIG_PERCEPIO_DFM_CFG_MAX_PAYLOADS
60 
61 /**
62  * @brief The max number of symptoms for each alert
63  */
64 #define DFM_CFG_MAX_SYMPTOMS CONFIG_PERCEPIO_DFM_CFG_MAX_SYMPTOMS
65 
66 /**
67  * @brief The max firmware version string length
68  */
69 #define DFM_CFG_FIRMWARE_VERSION_MAX_LEN CONFIG_PERCEPIO_DFM_CFG_FIRMWARE_VERSION_MAX_LEN
70 
71 /**
72  * @brief The max description string length
73  */
74 #define DFM_CFG_DESCRIPTION_MAX_LEN CONFIG_PERCEPIO_DFM_CFG_DESCRIPTION_MAX_LEN
75 
76 /**
77  * @brief A value that will be used to create a delay between transfers. Was necessary in certain situations.
78  */
79 #define DFM_CFG_DELAY_BETWEEN_SEND CONFIG_PERCEPIO_DFM_CFG_DELAY_BETWEEN_SEND
80 
81 /**
82  * @brief Enables the Retained Memory feature. Requires a RetainedMemoryPort to be implemented for the kernel/hardware.
83  */
84 #define DFM_CFG_RETAINED_MEMORY CONFIG_PERCEPIO_DFM_CFG_RETAINED_MEMORY
85 
86 /**
87  * @brief The strategy used for storing alerts/payload. Possible values are:
88  *	DFM_STORAGE_STRATEGY_IGNORE			Never store alerts/payloads
89  *	DFM_STORAGE_STRATEGY_OVERWRITE		Overwrite old alerts/payloads if full
90  *	DFM_STORAGE_STRATEGY_SKIP			Skip if full
91  */
92 #if CONFIG_PERCEPIO_DFM_CFG_SELECTED_STORAGE_STRATEGY_IGNORE == 1
93 	#define DFM_CFG_STORAGE_STRATEGY DFM_STORAGE_STRATEGY_IGNORE
94 #elif CONFIG_PERCEPIO_DFM_CFG_SELECTED_STORAGE_STRATEGY_OVERWRITE == 1
95 	#define DFM_CFG_STORAGE_STRATEGY DFM_STORAGE_STRATEGY_OVERWRITE
96 #elif CONFIG_PERCEPIO_DFM_CFG_SELECTED_STORAGE_STRATEGY_SKIP == 1
97 	#define DFM_CFG_STORAGE_STRATEGY DFM_STORAGE_STRATEGY_SKIP
98 #endif
99 
100 /**
101  * @brief The strategy used for sending alerts/payload. Possible values are:
102 *	DFM_CLOUD_STRATEGY_OFFLINE			Will not attempt to send alerts/payloads
103 *	DFM_CLOUD_STRATEGY_ONLINE			Will attempt to send alerts/payloads
104 */
105 #if CONFIG_PERCEPIO_DFM_CFG_SELECTED_CLOUD_STRATEGY_ONLINE == 1
106 	#define DFM_CFG_CLOUD_STRATEGY DFM_CLOUD_STRATEGY_ONLINE
107 #elif CONFIG_PERCEPIO_DFM_CFG_SELECTED_CLOUD_STRATEGY_OFFLINE == 1
108 	#define DFM_CFG_CLOUD_STRATEGY DFM_CLOUD_STRATEGY_OFFLINE
109 #endif
110 
111 /**
112  * @brief The strategy used for acquiring the unique session ID. Possible values are:
113 *	DFM_SESSIONID_STRATEGY_ONSTARTUP	Acquires the unique session ID at startup
114 *	DFM_SESSIONID_STRATEGY_ONALERT		Acquires the unique session ID the first time an alert is generated
115 */
116 #if CONFIG_PERCEPIO_DFM_CFG_SELECTED_SESSIONID_STRATEGY_ONALERT == 1
117 	#define DFM_CFG_SESSIONID_STRATEGY DFM_SESSIONID_STRATEGY_ONALERT
118 #elif CONFIG_PERCEPIO_DFM_CFG_SELECTED_SESSIONID_STRATEGY_ONSTARTUP == 1
119 	#define DFM_CFG_SESSIONID_STRATEGY DFM_SESSIONID_STRATEGY_ONSTARTUP
120 #endif
121 
122 /**
123  * @brief The strategy used for acquiring the device name. Possible values are:
124 * 	DFM_DEVICE_NAME_STRATEGY_SKIP		Some devides don't know their names, skip it
125 *	DFM_DEVICE_NAME_STRATEGY_ONDEVICE	This device knows its' name, get it
126 */
127 /* TODO: Is this one even used? */
128 #define DFM_CFG_DEVICENAME_STRATEGY DFM_DEVICE_NAME_STRATEGY_ONDEVICE
129 
130 #if CONFIG_PERCEPIO_DFM_CFG_ENABLE_COREDUMPS == 1
131 	#define DFM_CFG_ENABLE_COREDUMPS 1
132 #else
133 	#define DFM_CFG_ENABLE_COREDUMPS 0
134 #endif
135 
136 #ifdef __cplusplus
137 }
138 #endif
139 
140 #endif /* DFM_CONFIG_H */
141