Files
BR_YKC/Core/User/Os/os_task.c

94 lines
2.9 KiB
C
Raw Normal View History

2026-03-31 15:46:04 +08:00
/**
******************************************************************************
* @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"
/*-任务句柄-*/
2026-05-21 10:01:28 +08:00
osThreadId SysTaskHandle; /* 系统任务句柄 */
2026-03-31 15:46:04 +08:00
osThreadId UDPTaskHandle; /* UDP 消息队列接受任务句柄 */
osThreadId UDP_ParseTaskHandle; /* UDP 消息队列解析任务句柄 */
2026-05-21 10:01:28 +08:00
osThreadId Air724_ParseTaskHandle; /* 4G消息队列解析任务句柄 */
2026-03-31 15:46:04 +08:00
osThreadId YkcTaskHandle; /* 云快充平台交互任务句柄 */
/*-函数声明-*/
2026-05-21 10:01:28 +08:00
void sys_task_function(void const *argument); // 系统任务
2026-03-31 15:46:04 +08:00
2026-05-21 10:01:28 +08:00
void udp_recv_task_function(void const *argument); // UDP 接受任务
2026-03-31 15:46:04 +08:00
2026-05-21 10:01:28 +08:00
void udp_parse_task_function(void const *argument); //UDP消息解析任务
2026-03-31 15:46:04 +08:00
2026-05-21 10:01:28 +08:00
void ykc_task_function(void const *argument); // 云快充平台交互主任务
2026-03-31 15:46:04 +08:00
2026-05-21 10:01:28 +08:00
void air724_recv_task_function(void const *argument); // 云快充 TCP 消息解析任务
2026-03-31 15:46:04 +08:00
/* code -----------------------------------------------------------------------*/
/**
* @brief Os_Task_Init
*
* @note definition and creation of xxxTask
*
* @param none
*
* @retval none
*/
void Os_Task_Init(void) /*任务入口函数、任务名字、任务栈大小、任务入口函数参数、任务优先级、任务控制块指针*/
{
BaseType_t xReturn = pdPASS;
2026-05-21 10:01:28 +08:00
/* 系统任务 */
xReturn = xTaskCreate((TaskFunction_t)sys_task_function, "SysTask", 128, NULL, (UBaseType_t)osPriorityLow, &SysTaskHandle);
/* 云快充 TCP 消息解析任务 */
xReturn = xTaskCreate((TaskFunction_t)air724_recv_task_function, "Air724RecvTask", 1024, NULL, osPriorityAboveNormal, &Air724_ParseTaskHandle);
2026-03-31 15:46:04 +08:00
/* UDP 消息队列接受任务 */
2026-05-21 10:01:28 +08:00
xReturn = xTaskCreate((TaskFunction_t)udp_recv_task_function, "UDPRecvTask", 1536, NULL, osPriorityHigh, &UDPTaskHandle);
2026-03-31 15:46:04 +08:00
/* UDP 消息解析任务 */
2026-05-21 10:01:28 +08:00
xReturn = xTaskCreate((TaskFunction_t)udp_parse_task_function, "UDPParseTask", 2048, NULL, osPriorityAboveNormal, &UDP_ParseTaskHandle);
2026-03-31 15:46:04 +08:00
/* 云快充平台交互任务 */
2026-05-21 10:01:28 +08:00
xReturn = xTaskCreate((TaskFunction_t)ykc_task_function, "YKC_Task", 1024, NULL, osPriorityAboveNormal, &YkcTaskHandle);
2026-03-31 15:46:04 +08:00
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);
}
}