2 * Copyright (C) 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
\r
4 * Permission is hereby granted, free of charge, to any person obtaining a copy of
\r
5 * this software and associated documentation files (the "Software"), to deal in
\r
6 * the Software without restriction, including without limitation the rights to
\r
7 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
\r
8 * the Software, and to permit persons to whom the Software is furnished to do so,
\r
9 * subject to the following conditions:
\r
11 * The above copyright notice and this permission notice shall be included in all
\r
12 * copies or substantial portions of the Software.
\r
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
\r
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
\r
16 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
\r
17 * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
\r
18 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
\r
19 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\r
22 /* This file contains configuration settings for the demos. */
\r
24 #ifndef IOT_CONFIG_H_
\r
25 #define IOT_CONFIG_H_
\r
27 /* Configure the IoT Libraries for FreeRTOS by including the FreeRTOS header and
\r
28 * the FreeRTOS platform types. */
\r
29 #include "FreeRTOS.h"
\r
30 #include "platform/iot_platform_types_freertos.h"
\r
33 * @brief Set a global default for log levels.
\r
35 * This setting is overridden by log level settings of specific libraries.
\r
36 * Undefined library-specific log levels will default to this value.
\r
38 * Possible values: One of the Log levels.
\r
39 * Default value (if undefined): IOT_LOG_NONE.
\r
41 #define IOT_LOG_LEVEL_GLOBAL IOT_LOG_NONE
\r
44 * @brief Set the log level of the platform libraries except the network
\r
47 * Log messages from the platform libraries at or below this setting
\r
48 * will be printed. As the network component is more verbose, its logging
\r
49 * is controlled by its own setting, IOT_LOG_LEVEL_NETWORK.
\r
51 * Possible values: One of the Log levels.
\r
52 * Default value (if undefined): IOT_LOG_LEVEL_GLOBAL; if that is undefined,
\r
53 * then IOT_LOG_NONE.
\r
55 #define IOT_LOG_LEVEL_PLATFORM IOT_LOG_NONE
\r
58 * @brief Set the log level of the platform network library.
\r
60 * Log messages from the platform network library at or below this setting
\r
63 * Possible values: One of the Log levels.
\r
64 * Default value (if undefined): IOT_LOG_LEVEL_GLOBAL; if that is undefined,
\r
65 * then IOT_LOG_NONE.
\r
67 #define IOT_LOG_LEVEL_NETWORK IOT_LOG_WARN
\r
70 * @brief Set the log level of the task pool library.
\r
72 * Log messages from the task pool library at or below this setting will be
\r
75 * Possible values: One of the Log levels.
\r
76 * Default value (if undefined): IOT_LOG_LEVEL_GLOBAL; if that is undefined,
\r
77 * then IOT_LOG_NONE.
\r
79 #define IOT_LOG_LEVEL_TASKPOOL IOT_LOG_WARN
\r
82 * @brief Set the log level of the MQTT library.
\r
84 * Log messages from the MQTT library at or below this setting will be printed.
\r
86 * Possible values: One of the Log levels.
\r
87 * Default value (if undefined): IOT_LOG_LEVEL_GLOBAL; if that is undefined,
\r
88 * then IOT_LOG_NONE.
\r
90 #define IOT_LOG_LEVEL_MQTT IOT_LOG_WARN
\r
93 * @brief The number of recyclable jobs for the task pool to cache.
\r
95 * Caching dynamically allocated jobs (recyclable jobs) helps the application
\r
96 * to limit the number of allocations at runtime. Caching recyclable jobs may
\r
97 * help making the application more responsive and predictable, by removing a
\r
98 * potential for memory allocation failures, but it may also have negative
\r
99 * repercussions on the amount of memory available at any given time. It is up
\r
100 * to the application developer to strike the correct balance among these
\r
101 * competing needs. The task pool will cache a job when the application calls
\r
102 * IotTaskPool_RecycleJob on a job which was created using
\r
103 * IotTaskPool_CreateRecyclableJob API. Any recycled jobs in excess of
\r
104 * IOT_TASKPOOL_JOBS_RECYCLE_LIMIT will be destroyed and its memory will be
\r
107 * Default value (if undefined): 8
\r
109 #define IOT_TASKPOOL_JOBS_RECYCLE_LIMIT 8
\r
112 * @brief Enable/Disable asserts for the task pool library.
\r
114 * Set this to 1 to perform sanity checks when using the task pool library.
\r
115 * Asserts are useful for debugging, but should be disabled in production code.
\r
116 * If this is set to 1, IotTaskPool_Assert can be defined to set the assertion
\r
117 * function; otherwise, the standard library's assert function will be used.
\r
119 * Possible values: 0 (asserts disabled) or 1 (asserts enabled)
\r
120 * Recommended values: 1 when debugging; 0 in production code.
\r
121 * Default value (if undefined): 0
\r
123 #define IOT_TASKPOOL_ENABLE_ASSERTS 1
\r
126 * @brief The number of worker tasks in the task pool.
\r
128 * The full IoT Task Pool Library has many use cases, including Linux
\r
129 * development. Typical FreeRTOS use cases do not require the full
\r
130 * functionality so an optimized implementation is provided specifically for use
\r
131 * with FreeRTOS. The optimized version has a fixed number of tasks in the
\r
132 * task pool, each of which uses statically allocated memory to ensure creation
\r
133 * of the task pool is guaranteed (it does not run out of heap space).
\r
135 #define IOT_TASKPOOL_NUMBER_OF_WORKERS 1
\r
138 * @brief The stack size (in bytes) for each worker task in the task pool.
\r
140 * The minimal version of the of task pool library only supports one task pool
\r
141 * and the configuration of each worker task fixed at the compile time.
\r
143 #define IOT_TASKPOOL_WORKER_STACK_SIZE_BYTES 2048
\r
146 * @brief Enable TLS in the network abstraction.
\r
148 * The TLS implementation requires the mbed TLS library.
\r
150 #define IOT_NETWORK_ENABLE_TLS 1
\r
153 * @brief Enable/Disable asserts for the linear containers library.
\r
155 * Set this to 1 to perform sanity checks when using the linear containers library.
\r
156 * Asserts are useful for debugging, but should be disabled in production code.
\r
157 * If this is set to 1, IotContainers_Assert can be defined to set the assertion
\r
158 * function; otherwise, the standard library's assert function will be used.
\r
160 * Possible values: 0 (asserts disabled) or 1 (asserts enabled)
\r
161 * Recommended values: 1 when debugging; 0 in production code.
\r
162 * Default value (if undefined): 0
\r
164 #define IOT_CONTAINERS_ENABLE_ASSERTS 1
\r
167 * @brief Enable/Disable asserts for the MQTT library.
\r
169 * Set this to 1 to perform sanity checks when using the MQTT library.
\r
170 * Asserts are useful for debugging, but should be disabled in production code.
\r
171 * If this is set to 1, IotMqtt_Assert can be defined to set the assertion
\r
172 * function; otherwise, the standard library's assert function will be used.
\r
174 * Possible values: 0 (asserts disabled) or 1 (asserts enabled)
\r
175 * Recommended values: 1 when debugging; 0 in production code.
\r
176 * Default value (if undefined): 0
\r
178 #define IOT_MQTT_ENABLE_ASSERTS 1
\r
181 * @brief Enable/Disable anonymous metrics collection when using AWS IoT.
\r
183 * This demo does not use TLS and so does not work with AWS IoT. Therefore,
\r
184 * the metric collection must be disabled.
\r
186 #define AWS_IOT_MQTT_ENABLE_METRICS 0
\r
188 /* Common settings for FreeRTOS; settings below this line generally do not need
\r
189 * to be changed. */
\r
191 /* Logging puts function on FreeRTOS. */
\r
192 #define IotLogging_Puts( str ) configPRINTF( ( "%s\r\n", str ) )
\r
194 /* Assert functions on FreeRTOS. */
\r
195 #define IotContainers_Assert( expression ) configASSERT( expression )
\r
196 #define IotTaskPool_Assert( expression ) configASSERT( expression )
\r
197 #define IotMqtt_Assert( expression ) configASSERT( expression )
\r
198 #define Iot_DefaultAssert( expression ) configASSERT( expression )
\r
200 /* Memory allocation functions on FreeRTOS. */
\r
201 #define IotThreads_Malloc pvPortMalloc
\r
202 #define IotThreads_Free vPortFree
\r
204 #define IotLogging_Malloc pvPortMalloc
\r
205 #define IotLogging_Free vPortFree
\r
207 #define IotTaskPool_MallocTaskPool pvPortMalloc
\r
208 #define IotTaskPool_FreeTaskPool vPortFree
\r
209 #define IotTaskPool_MallocJob pvPortMalloc
\r
210 #define IotTaskPool_FreeJob vPortFree
\r
211 #define IotTaskPool_MallocTimerEvent pvPortMalloc
\r
212 #define IotTaskPool_FreeTimerEvent vPortFree
\r
214 #define IotMqtt_MallocConnection pvPortMalloc
\r
215 #define IotMqtt_FreeConnection vPortFree
\r
216 #define IotMqtt_MallocMessage pvPortMalloc
\r
217 #define IotMqtt_FreeMessage vPortFree
\r
218 #define IotMqtt_MallocOperation pvPortMalloc
\r
219 #define IotMqtt_FreeOperation vPortFree
\r
220 #define IotMqtt_MallocSubscription pvPortMalloc
\r
221 #define IotMqtt_FreeSubscription vPortFree
\r
223 #define AwsIotShadow_MallocOperation pvPortMalloc
\r
224 #define AwsIotShadow_FreeOperation vPortFree
\r
225 #define AwsIotShadow_MallocString pvPortMalloc
\r
226 #define AwsIotShadow_FreeString vPortFree
\r
227 #define AwsIotShadow_MallocSubscription pvPortMalloc
\r
228 #define AwsIotShadow_FreeSubscription vPortFree
\r
230 #define Iot_DefaultMalloc pvPortMalloc
\r
231 #define Iot_DefaultFree vPortFree
\r
233 #endif /* ifndef IOT_CONFIG_H_ */
\r