1 /*
2  * FreeRTOS V202212.00
3  * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a copy of
6  * this software and associated documentation files (the "Software"), to deal in
7  * the Software without restriction, including without limitation the rights to
8  * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9  * the Software, and to permit persons to whom the Software is furnished to do so,
10  * subject to the following conditions:
11  *
12  * The above copyright notice and this permission notice shall be included in all
13  * copies or substantial portions of the Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17  * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18  * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19  * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21  *
22  * https://www.FreeRTOS.org
23  * https://github.com/FreeRTOS
24  *
25  */
26 
27 /**
28  * @file  iot_demo.c
29  * @brief Demo
30  */
31 
32 #include "FreeRTOS.h"
33 
34 
35 /*-----------------------------------------------------------*/
36 
37 /* configUSE_STATIC_ALLOCATION is set to 1, so the application must provide an
38  * implementation of vApplicationGetIdleTaskMemory() to provide the memory that is
39  * used by the Idle task. */
vApplicationGetIdleTaskMemory(StaticTask_t ** ppxIdleTaskTCBBuffer,StackType_t ** ppxIdleTaskStackBuffer,uint32_t * pulIdleTaskStackSize)40 void vApplicationGetIdleTaskMemory( StaticTask_t ** ppxIdleTaskTCBBuffer,
41                                     StackType_t ** ppxIdleTaskStackBuffer,
42                                     uint32_t * pulIdleTaskStackSize )
43 {
44     /* If the buffers to be provided to the Idle task are declared inside this
45      * function then they must be declared static - otherwise they will be allocated on
46      * the stack and so not exists after this function exits. */
47     static StaticTask_t xIdleTaskTCB;
48     static StackType_t uxIdleTaskStack[ configMINIMAL_STACK_SIZE ];
49 
50     /* Pass out a pointer to the StaticTask_t structure in which the Idle
51      * task's state will be stored. */
52     *ppxIdleTaskTCBBuffer = &xIdleTaskTCB;
53 
54     /* Pass out the array that will be used as the Idle task's stack. */
55     *ppxIdleTaskStackBuffer = uxIdleTaskStack;
56 
57     /* Pass out the size of the array pointed to by *ppxIdleTaskStackBuffer.
58      * Note that, as the array is necessarily of type StackType_t,
59      * configMINIMAL_STACK_SIZE is specified in words, not bytes. */
60     *pulIdleTaskStackSize = configMINIMAL_STACK_SIZE;
61 }
62 /*-----------------------------------------------------------*/
63 
64 /**
65  * @brief This is to provide the memory that is used by the RTOS daemon/time task.
66  *
67  * If configUSE_STATIC_ALLOCATION is set to 1, so the application must provide an
68  * implementation of vApplicationGetTimerTaskMemory() to provide the memory that is
69  * used by the RTOS daemon/time task.
70  */
vApplicationGetTimerTaskMemory(StaticTask_t ** ppxTimerTaskTCBBuffer,StackType_t ** ppxTimerTaskStackBuffer,uint32_t * pulTimerTaskStackSize)71 void vApplicationGetTimerTaskMemory( StaticTask_t ** ppxTimerTaskTCBBuffer,
72                                      StackType_t ** ppxTimerTaskStackBuffer,
73                                      uint32_t * pulTimerTaskStackSize )
74 {
75     /* If the buffers to be provided to the Timer task are declared inside this
76      * function then they must be declared static - otherwise they will be allocated on
77      * the stack and so not exists after this function exits. */
78     static StaticTask_t xTimerTaskTCB;
79     static StackType_t uxTimerTaskStack[ configTIMER_TASK_STACK_DEPTH ];
80 
81     /* Pass out a pointer to the StaticTask_t structure in which the Idle
82      * task's state will be stored. */
83     *ppxTimerTaskTCBBuffer = &xTimerTaskTCB;
84 
85     /* Pass out the array that will be used as the Timer task's stack. */
86     *ppxTimerTaskStackBuffer = uxTimerTaskStack;
87 
88     /* Pass out the size of the array pointed to by *ppxTimerTaskStackBuffer.
89      * Note that, as the array is necessarily of type StackType_t,
90      * configMINIMAL_STACK_SIZE is specified in words, not bytes. */
91     *pulTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH;
92 }
93 /*-----------------------------------------------------------*/
94