]> git.sur5r.net Git - freertos/blob - FreeRTOS-Plus/Demo/FreeRTOS_IoT_Libraries/task_pool/iot_config_common.h
Update task pool so tasks and timer are allocated statically.
[freertos] / FreeRTOS-Plus / Demo / FreeRTOS_IoT_Libraries / task_pool / iot_config_common.h
1 /*\r
2  * Amazon FreeRTOS V201906.00 Major\r
3  * Copyright (C) 2019 Amazon.com, Inc. or its affiliates.  All Rights Reserved.\r
4  *\r
5  * Permission is hereby granted, free of charge, to any person obtaining a copy of\r
6  * this software and associated documentation files (the "Software"), to deal in\r
7  * the Software without restriction, including without limitation the rights to\r
8  * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\r
9  * the Software, and to permit persons to whom the Software is furnished to do so,\r
10  * subject to the following conditions:\r
11  *\r
12  * The above copyright notice and this permission notice shall be included in all\r
13  * copies or substantial portions of the Software.\r
14  *\r
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
17  * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r
18  * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r
19  * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
20  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
21  *\r
22  * http://aws.amazon.com/freertos\r
23  * http://www.FreeRTOS.org\r
24  */\r
25 \r
26 /* This file contains default configuration settings for the demos on FreeRTOS. */\r
27 \r
28 #ifndef IOT_CONFIG_COMMON_H_\r
29 #define IOT_CONFIG_COMMON_H_\r
30 \r
31 /* SDK version. */\r
32 #define IOT_SDK_VERSION    "4.0.0"\r
33 \r
34 /* This config file is for the demos; disable any test code. */\r
35 #define IOT_BUILD_TESTS    ( 0 )\r
36 \r
37 /* Logging puts function. */\r
38 #define IotLogging_Puts( str )                 configPRINTF( ( "%s\r\n", str ) )\r
39 \r
40 /* Enable asserts in libraries by default. */\r
41 #ifndef IOT_METRICS_ENABLE_ASSERTS\r
42     #define IOT_METRICS_ENABLE_ASSERTS         ( 1 )\r
43 #endif\r
44 #ifndef IOT_CONTAINERS_ENABLE_ASSERTS\r
45     #define IOT_CONTAINERS_ENABLE_ASSERTS      ( 1 )\r
46 #endif\r
47 #ifndef IOT_TASKPOOL_ENABLE_ASSERTS\r
48     #define IOT_TASKPOOL_ENABLE_ASSERTS        ( 1 )\r
49 #endif\r
50 #ifndef IOT_MQTT_ENABLE_ASSERTS\r
51     #define IOT_MQTT_ENABLE_ASSERTS            ( 1 )\r
52 #endif\r
53 #ifndef AWS_IOT_SHADOW_ENABLE_ASSERTS\r
54     #define AWS_IOT_SHADOW_ENABLE_ASSERTS      ( 1 )\r
55 #endif\r
56 #ifndef AWS_IOT_DEFENDER_ENABLE_ASSERTS\r
57     #define AWS_IOT_DEFENDER_ENABLE_ASSERTS    ( 1 )\r
58 #endif\r
59 #ifndef IOT_BLE_ENABLE_ASSERTS\r
60     #define IOT_BLE_ENABLE_ASSERTS             ( 1 )\r
61 #endif\r
62 \r
63 /* Assert functions. */\r
64 #define IotMetrics_Assert( expression )        configASSERT( expression )\r
65 #define IotContainers_Assert( expression )     configASSERT( expression )\r
66 #define IotTaskPool_Assert( expression )       configASSERT( expression )\r
67 #define IotMqtt_Assert( expression )           configASSERT( expression )\r
68 #define AwsIotShadow_Assert( expression )      configASSERT( expression )\r
69 #define AwsIotDefender_Assert( expression )    configASSERT( expression )\r
70 #define IotBle_Assert( expression )            configASSERT( expression )\r
71 \r
72 /* Control the usage of dynamic memory allocation. */\r
73 #ifndef IOT_STATIC_MEMORY_ONLY\r
74     #define IOT_STATIC_MEMORY_ONLY    ( 0 )\r
75 #endif\r
76 \r
77 /* Memory allocation configuration. Note that these functions will not be affected\r
78  * by IOT_STATIC_MEMORY_ONLY. */\r
79 #define IotNetwork_Malloc    pvPortMalloc\r
80 #define IotNetwork_Free      vPortFree\r
81 #define IotThreads_Malloc    pvPortMalloc\r
82 #define IotThreads_Free      vPortFree\r
83 #define IotLogging_Malloc    pvPortMalloc\r
84 #define IotLogging_Free      vPortFree\r
85 #define IotBle_Malloc        pvPortMalloc\r
86 #define IotBle_Free          vPortFree\r
87 /* #define IotLogging_StaticBufferSize */\r
88 \r
89 /* Memory allocation function configuration for the MQTT and Defender library.\r
90  * These libraries will be affected by IOT_STATIC_MEMORY_ONLY. */\r
91 #if IOT_STATIC_MEMORY_ONLY == 0\r
92     #define IotMetrics_MallocTcpConnection       pvPortMalloc\r
93     #define IotMetrics_FreeTcpConnection         vPortFree\r
94     #define IotMetrics_MallocIpAddress           pvPortMalloc\r
95     #define IotMetrics_FreeIpAddress             vPortFree\r
96 \r
97     #define IotTaskPool_MallocTaskPool           pvPortMalloc\r
98     #define IotTaskPool_FreeTaskPool             vPortFree\r
99     #define IotTaskPool_MallocJob                pvPortMalloc\r
100     #define IotTaskPool_FreeJob                  vPortFree\r
101     #define IotTaskPool_MallocTimerEvent         pvPortMalloc\r
102     #define IotTaskPool_FreeTimerEvent           vPortFree\r
103 \r
104     #define IotMqtt_MallocConnection             pvPortMalloc\r
105     #define IotMqtt_FreeConnection               vPortFree\r
106     #define IotMqtt_MallocMessage                pvPortMalloc\r
107     #define IotMqtt_FreeMessage                  vPortFree\r
108     #define IotMqtt_MallocOperation              pvPortMalloc\r
109     #define IotMqtt_FreeOperation                vPortFree\r
110     #define IotMqtt_MallocSubscription           pvPortMalloc\r
111     #define IotMqtt_FreeSubscription             vPortFree\r
112 \r
113     #define IotSerializer_MallocCborEncoder      pvPortMalloc\r
114     #define IotSerializer_FreeCborEncoder        vPortFree\r
115     #define IotSerializer_MallocCborParser       pvPortMalloc\r
116     #define IotSerializer_FreeCborParser         vPortFree\r
117     #define IotSerializer_MallocCborValue        pvPortMalloc\r
118     #define IotSerializer_FreeCborValue          vPortFree\r
119     #define IotSerializer_MallocDecoderObject    pvPortMalloc\r
120     #define IotSerializer_FreeDecoderObject      vPortFree\r
121 \r
122     #define AwsIotShadow_MallocOperation         pvPortMalloc\r
123     #define AwsIotShadow_FreeOperation           vPortFree\r
124     #define AwsIotShadow_MallocString            pvPortMalloc\r
125     #define AwsIotShadow_FreeString              vPortFree\r
126     #define AwsIotShadow_MallocSubscription      pvPortMalloc\r
127     #define AwsIotShadow_FreeSubscription        vPortFree\r
128 \r
129     #define AwsIotDefender_MallocReport          pvPortMalloc\r
130     #define AwsIotDefender_FreeReport            vPortFree\r
131     #define AwsIotDefender_MallocTopic           pvPortMalloc\r
132     #define AwsIotDefender_FreeTopic             vPortFree\r
133 #endif /* if IOT_STATIC_MEMORY_ONLY == 0 */\r
134 \r
135 /* Default platform thread stack size and priority. */\r
136 #ifndef IOT_THREAD_DEFAULT_STACK_SIZE\r
137     #define IOT_THREAD_DEFAULT_STACK_SIZE    2048\r
138 #endif\r
139 #ifndef IOT_THREAD_DEFAULT_PRIORITY\r
140     #define IOT_THREAD_DEFAULT_PRIORITY      tskIDLE_PRIORITY\r
141 #endif\r
142 \r
143 /* Platform network configuration. */\r
144 #ifndef IOT_NETWORK_RECEIVE_TASK_PRIORITY\r
145     #define IOT_NETWORK_RECEIVE_TASK_PRIORITY      ( tskIDLE_PRIORITY + 1 )\r
146 #endif\r
147 #ifndef IOT_NETWORK_RECEIVE_TASK_STACK_SIZE\r
148     #define IOT_NETWORK_RECEIVE_TASK_STACK_SIZE    IOT_THREAD_DEFAULT_STACK_SIZE\r
149 #endif\r
150 \r
151 /* Platform and SDK name for AWS IoT MQTT metrics. Only used when\r
152  * AWS_IOT_MQTT_ENABLE_METRICS is 1. */\r
153 #define IOT_SDK_NAME             "AmazonFreeRTOS"\r
154 #ifdef configPLATFORM_NAME\r
155     #define IOT_PLATFORM_NAME    configPLATFORM_NAME\r
156 #else\r
157     #define IOT_PLATFORM_NAME    "Unknown"\r
158 #endif\r
159 \r
160 /* Cloud endpoint to which the device connects to. */\r
161 #define IOT_CLOUD_ENDPOINT                    clientcredentialMQTT_BROKER_ENDPOINT\r
162 \r
163 /**\r
164  * @brief Unique identifier used to recognize a device by the cloud.\r
165  * This could be SHA-256 of the device certificate.\r
166  */\r
167 extern const char *getDeviceIdentifier( void );\r
168 #define IOT_DEVICE_IDENTIFIER                getDeviceIdentifier()\r
169 \r
170 /**\r
171  * @brief Metrics emitted by the device.\r
172  */\r
173 extern const char *getDeviceMetrics( void );\r
174 #define AWS_IOT_METRICS_USERNAME     getDeviceMetrics()\r
175 \r
176 /**\r
177  * @brief Length of the metrics emitted by device.\r
178  */\r
179 extern uint16_t getDeviceMetricsLength( void );\r
180 #define AWS_IOT_METRICS_USERNAME_LENGTH getDeviceMetricsLength()\r
181 \r
182 /* Define the data type of metrics connection id as same as Socket_t in aws_secure_socket.h */\r
183 #define IotMetricsConnectionId_t            void *\r
184 \r
185 /* Configuration for defender demo: set format to CBOR. */\r
186 #define AWS_IOT_DEFENDER_FORMAT             AWS_IOT_DEFENDER_FORMAT_CBOR\r
187 \r
188 /* Configuration for defender demo: use long tag for readable output. Please use short tag for the real application. */\r
189 #define AWS_IOT_DEFENDER_USE_LONG_TAG       ( 1 )\r
190 \r
191 #endif /* ifndef IOT_CONFIG_COMMON_H_ */\r