Files
BR_YKC/Core/User/Os/os_task.c
2026-03-31 15:46:04 +08:00

98 lines
2.9 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
******************************************************************************
* @file user\os\os_task.c
* @author luhuaishuai
* @version v0.1
* @date 2026-1-12
* @brief Briefly describe the function of your function
******************************************************************************
*/
/* Includes -------------------------------------------------------------------*/
#include "os_task.h"
/*-任务句柄-*/
osThreadId HeartbeatTaskHandle; /* 心跳任务句柄 */
osThreadId UDPTaskHandle; /* UDP 消息队列接受任务句柄 */
osThreadId UDP_ParseTaskHandle; /* UDP 消息队列解析任务句柄 */
osThreadId DownLinkTaskHandle; /* 4G接收消息任务句柄 */
osThreadId YkcTaskHandle; /* 云快充平台交互任务句柄 */
/*-函数声明-*/
void HeartbeatTask_Function(void const *argument); // 心跳任务
void UDPTask_Function(void const *argument); // UDP 接受任务
void UDP_ParseTask_Function(void const *argument); //UDP消息解析任务
void YkcTask_Function(void const *argument); // 云快充平台交互任务
void DownLinkTask_Function(void const *argument); // 4G接收消息任务
/* code -----------------------------------------------------------------------*/
/**
* @brief Os_Task_Init所有任务的创建
*
* @note definition and creation of xxxTask
*
* @param none
*
* @retval none
*/
void Os_Task_Init(void) /*任务入口函数、任务名字、任务栈大小、任务入口函数参数、任务优先级、任务控制块指针*/
{
BaseType_t xReturn = pdPASS;
/* 心跳任务 */
xReturn = xTaskCreate((TaskFunction_t)HeartbeatTask_Function, "HeartbeatTask", 128, NULL, (UBaseType_t)osPriorityLow, &HeartbeatTaskHandle);
/* 4G消息解析任务 */
xReturn = xTaskCreate((TaskFunction_t)DownLinkTask_Function, "DownLinkTask", 1024, NULL, osPriorityAboveNormal, &DownLinkTaskHandle);
/* UDP 消息队列接受任务 */
xReturn = xTaskCreate((TaskFunction_t)UDPTask_Function, "UDPTask", 512, NULL, osPriorityAboveNormal, &UDPTaskHandle);
/* UDP 消息解析任务 */
xReturn = xTaskCreate((TaskFunction_t)UDP_ParseTask_Function, "UDPParseTask", 1024, NULL, osPriorityAboveNormal, &UDP_ParseTaskHandle);
/* 云快充平台交互任务 */
xReturn = xTaskCreate((TaskFunction_t)YkcTask_Function, "YKCTask", 1024, NULL, osPriorityAboveNormal, &YkcTaskHandle);
if (xReturn == pdPASS)
{
;
}
}
/*---------------------------------------Function implementing the xxxTask thread----------------------------------------*/
__weak void HeartbeatTask_Function(void const *argument)
{
for (;;)
{
osDelay(1);
}
}
__weak void DownLinkTask_Function(void const *argument)
{
for (;;)
{
osDelay(1);
}
}
__weak void UPLinkTask_Function(void const *argument)
{
for (;;)
{
osDelay(1);
}
}