2020-08-07 06:58:20 +00:00
|
|
|
/* USER CODE BEGIN Header */
|
|
|
|
/**
|
|
|
|
******************************************************************************
|
|
|
|
* File Name : freertos.c
|
|
|
|
* Description : Code for freertos applications
|
|
|
|
******************************************************************************
|
|
|
|
* @attention
|
|
|
|
*
|
|
|
|
* <h2><center>© Copyright (c) 2020 STMicroelectronics.
|
|
|
|
* All rights reserved.</center></h2>
|
|
|
|
*
|
|
|
|
* This software component is licensed by ST under Ultimate Liberty license
|
|
|
|
* SLA0044, the "License"; You may not use this file except in compliance with
|
|
|
|
* the License. You may obtain a copy of the License at:
|
|
|
|
* www.st.com/SLA0044
|
|
|
|
*
|
|
|
|
******************************************************************************
|
|
|
|
*/
|
|
|
|
/* USER CODE END Header */
|
|
|
|
|
|
|
|
/* Includes ------------------------------------------------------------------*/
|
|
|
|
#include "FreeRTOS.h"
|
|
|
|
#include "task.h"
|
|
|
|
#include "main.h"
|
|
|
|
|
|
|
|
/* Private includes ----------------------------------------------------------*/
|
2020-09-29 23:18:30 +00:00
|
|
|
/* USER CODE BEGIN Includes */
|
2020-08-26 08:43:18 +00:00
|
|
|
#include <stdbool.h>
|
2020-08-07 06:58:20 +00:00
|
|
|
|
|
|
|
/* USER CODE END Includes */
|
|
|
|
|
|
|
|
/* Private typedef -----------------------------------------------------------*/
|
|
|
|
/* USER CODE BEGIN PTD */
|
|
|
|
|
|
|
|
/* USER CODE END PTD */
|
|
|
|
|
|
|
|
/* Private define ------------------------------------------------------------*/
|
|
|
|
/* USER CODE BEGIN PD */
|
|
|
|
|
|
|
|
/* USER CODE END PD */
|
|
|
|
|
|
|
|
/* Private macro -------------------------------------------------------------*/
|
|
|
|
/* USER CODE BEGIN PM */
|
|
|
|
|
|
|
|
/* USER CODE END PM */
|
|
|
|
|
|
|
|
/* Private variables ---------------------------------------------------------*/
|
|
|
|
/* USER CODE BEGIN Variables */
|
|
|
|
|
|
|
|
/* USER CODE END Variables */
|
|
|
|
|
|
|
|
/* Private function prototypes -----------------------------------------------*/
|
|
|
|
/* USER CODE BEGIN FunctionPrototypes */
|
2020-09-29 23:18:30 +00:00
|
|
|
|
2020-08-07 06:58:20 +00:00
|
|
|
/* USER CODE END FunctionPrototypes */
|
|
|
|
|
|
|
|
/* GetIdleTaskMemory prototype (linked to static allocation support) */
|
2020-10-02 06:32:11 +00:00
|
|
|
void vApplicationGetIdleTaskMemory(
|
|
|
|
StaticTask_t** ppxIdleTaskTCBBuffer,
|
|
|
|
StackType_t** ppxIdleTaskStackBuffer,
|
|
|
|
uint32_t* pulIdleTaskStackSize);
|
2020-08-07 06:58:20 +00:00
|
|
|
|
|
|
|
/* GetTimerTaskMemory prototype (linked to static allocation support) */
|
2020-10-02 06:32:11 +00:00
|
|
|
void vApplicationGetTimerTaskMemory(
|
|
|
|
StaticTask_t** ppxTimerTaskTCBBuffer,
|
|
|
|
StackType_t** ppxTimerTaskStackBuffer,
|
|
|
|
uint32_t* pulTimerTaskStackSize);
|
2020-08-07 06:58:20 +00:00
|
|
|
|
|
|
|
/* Hook prototypes */
|
|
|
|
void vApplicationIdleHook(void);
|
|
|
|
|
|
|
|
/* USER CODE BEGIN 2 */
|
2020-09-29 23:18:30 +00:00
|
|
|
__weak void vApplicationIdleHook(void) {
|
|
|
|
/* vApplicationIdleHook() will only be called if configUSE_IDLE_HOOK is set
|
2020-08-07 06:58:20 +00:00
|
|
|
to 1 in FreeRTOSConfig.h. It will be called on each iteration of the idle
|
|
|
|
task. It is essential that code added to this hook function never attempts
|
|
|
|
to block in any way (for example, call xQueueReceive() with a block time
|
|
|
|
specified, or call vTaskDelay()). If the application makes use of the
|
|
|
|
vTaskDelete() API function (as this demo application does) then it is also
|
|
|
|
important that vApplicationIdleHook() is permitted to return to its calling
|
|
|
|
function, because it is the responsibility of the idle task to clean up
|
|
|
|
memory allocated by the kernel to any task that has since been deleted. */
|
|
|
|
}
|
|
|
|
/* USER CODE END 2 */
|
|
|
|
|
|
|
|
/* USER CODE BEGIN GET_IDLE_TASK_MEMORY */
|
|
|
|
static StaticTask_t xIdleTaskTCBBuffer;
|
|
|
|
static StackType_t xIdleStack[configMINIMAL_STACK_SIZE];
|
2020-09-29 23:18:30 +00:00
|
|
|
|
2020-10-02 06:32:11 +00:00
|
|
|
void vApplicationGetIdleTaskMemory(
|
|
|
|
StaticTask_t** ppxIdleTaskTCBBuffer,
|
|
|
|
StackType_t** ppxIdleTaskStackBuffer,
|
|
|
|
uint32_t* pulIdleTaskStackSize) {
|
2020-09-29 23:18:30 +00:00
|
|
|
*ppxIdleTaskTCBBuffer = &xIdleTaskTCBBuffer;
|
|
|
|
*ppxIdleTaskStackBuffer = &xIdleStack[0];
|
|
|
|
*pulIdleTaskStackSize = configMINIMAL_STACK_SIZE;
|
|
|
|
/* place for user code */
|
|
|
|
}
|
2020-08-07 06:58:20 +00:00
|
|
|
/* USER CODE END GET_IDLE_TASK_MEMORY */
|
|
|
|
|
|
|
|
/* USER CODE BEGIN GET_TIMER_TASK_MEMORY */
|
|
|
|
static StaticTask_t xTimerTaskTCBBuffer;
|
|
|
|
static StackType_t xTimerStack[configTIMER_TASK_STACK_DEPTH];
|
2020-09-29 23:18:30 +00:00
|
|
|
|
2020-10-02 06:32:11 +00:00
|
|
|
void vApplicationGetTimerTaskMemory(
|
|
|
|
StaticTask_t** ppxTimerTaskTCBBuffer,
|
|
|
|
StackType_t** ppxTimerTaskStackBuffer,
|
|
|
|
uint32_t* pulTimerTaskStackSize) {
|
2020-09-29 23:18:30 +00:00
|
|
|
*ppxTimerTaskTCBBuffer = &xTimerTaskTCBBuffer;
|
|
|
|
*ppxTimerTaskStackBuffer = &xTimerStack[0];
|
|
|
|
*pulTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH;
|
|
|
|
/* place for user code */
|
|
|
|
}
|
2020-08-07 06:58:20 +00:00
|
|
|
/* USER CODE END GET_TIMER_TASK_MEMORY */
|
|
|
|
|
|
|
|
/* Private application code --------------------------------------------------*/
|
|
|
|
/* USER CODE BEGIN Application */
|
2020-08-26 08:43:18 +00:00
|
|
|
bool task_equal(TaskHandle_t a, TaskHandle_t b) {
|
|
|
|
if(a == NULL || b == NULL) return false;
|
|
|
|
|
|
|
|
return a == b;
|
|
|
|
}
|
2020-09-29 23:18:30 +00:00
|
|
|
|
2020-08-07 06:58:20 +00:00
|
|
|
/* USER CODE END Application */
|
|
|
|
|
|
|
|
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|