104 lines
2.9 KiB
C
104 lines
2.9 KiB
C
/* USER CODE BEGIN Header */
|
|
/**
|
|
******************************************************************************
|
|
* @file app_threadx.c
|
|
* @author MCD Application Team
|
|
* @brief ThreadX applicative file
|
|
******************************************************************************
|
|
* @attention
|
|
*
|
|
* Copyright (c) 2020-2021 STMicroelectronics.
|
|
* All rights reserved.
|
|
*
|
|
* This software is licensed under terms that can be found in the LICENSE file
|
|
* in the root directory of this software component.
|
|
* If no LICENSE file comes with this software, it is provided AS-IS.
|
|
*
|
|
******************************************************************************
|
|
*/
|
|
/* USER CODE END Header */
|
|
|
|
/* Includes ------------------------------------------------------------------*/
|
|
#include "app_threadx.h"
|
|
|
|
/* Private includes ----------------------------------------------------------*/
|
|
/* USER CODE BEGIN Includes */
|
|
#include "app.h"
|
|
/* 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 PV */
|
|
static TX_THREAD app_thread;
|
|
/* USER CODE END PV */
|
|
|
|
/* Private function prototypes -----------------------------------------------*/
|
|
/* USER CODE BEGIN PFP */
|
|
|
|
/* USER CODE END PFP */
|
|
|
|
/**
|
|
* @brief Application ThreadX Initialization.
|
|
* @param memory_ptr: memory pointer
|
|
* @retval int
|
|
*/
|
|
UINT App_ThreadX_Init(VOID *memory_ptr)
|
|
{
|
|
UINT ret = TX_SUCCESS;
|
|
/* USER CODE BEGIN App_ThreadX_MEM_POOL */
|
|
TX_BYTE_POOL* pool = (TX_BYTE_POOL*)memory_ptr;
|
|
void* app_thread_stack;
|
|
if (tx_byte_allocate(pool, &app_thread_stack, THREAD_STACK_SIZE,
|
|
TX_NO_WAIT) != TX_SUCCESS) {
|
|
Error_Handler();
|
|
}
|
|
/* USER CODE END App_ThreadX_MEM_POOL */
|
|
|
|
/* USER CODE BEGIN App_ThreadX_Init */
|
|
if (tx_thread_create(&app_thread, "Main Thread", app_thread_entry, 0,
|
|
app_thread_stack, THREAD_STACK_SIZE, THREAD_PRIO_APP,
|
|
THREAD_PRIO_APP, TX_NO_TIME_SLICE,
|
|
TX_AUTO_START) != TX_SUCCESS) {
|
|
Error_Handler();
|
|
}
|
|
/* USER CODE END App_ThreadX_Init */
|
|
|
|
return ret;
|
|
}
|
|
|
|
/**
|
|
* @brief Function that implements the kernel's initialization.
|
|
* @param None
|
|
* @retval None
|
|
*/
|
|
void MX_ThreadX_Init(void)
|
|
{
|
|
/* USER CODE BEGIN Before_Kernel_Start */
|
|
|
|
/* USER CODE END Before_Kernel_Start */
|
|
|
|
tx_kernel_enter();
|
|
|
|
/* USER CODE BEGIN Kernel_Start_Error */
|
|
|
|
/* USER CODE END Kernel_Start_Error */
|
|
}
|
|
|
|
/* USER CODE BEGIN 1 */
|
|
|
|
/* USER CODE END 1 */
|