90 lines
2.8 KiB
C
90 lines
2.8 KiB
C
/**
|
||
******************************************************************************
|
||
* @file User\Os\os_task.c
|
||
* @author 路淮
|
||
* @version v0.1
|
||
* @date 2026-05-21
|
||
* @brief 任务管理
|
||
******************************************************************************
|
||
*/
|
||
|
||
/* Includes -------------------------------------------------------------------*/
|
||
#include "os_task.h"
|
||
|
||
/*-任务句柄-*/
|
||
osThreadId SysTaskHandle; /* 系统任务句柄 */
|
||
|
||
osThreadId UDPTaskHandle; /* UDP 消息队列接受任务句柄 */
|
||
|
||
osThreadId UDP_ParseTaskHandle; /* UDP 消息队列解析任务句柄 */
|
||
|
||
osThreadId Air724_ParseTaskHandle; /* 4G消息队列解析任务句柄 */
|
||
|
||
osThreadId YkcTaskHandle; /* 云快充平台交互任务句柄 */
|
||
|
||
/*-函数声明-*/
|
||
void sys_task_function(void const *argument); // 系统任务
|
||
|
||
void udp_recv_task_function(void const *argument); // UDP 接受任务
|
||
|
||
void udp_parse_task_function(void const *argument); //UDP消息解析任务
|
||
|
||
void ykc_task_function(void const *argument); // 云快充平台交互主任务
|
||
|
||
void air724_recv_task_function(void const *argument); // 云快充 TCP 消息解析任务
|
||
|
||
/* 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)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);
|
||
/* UDP 消息队列接受任务 */
|
||
xReturn = xTaskCreate((TaskFunction_t)udp_recv_task_function, "UDPRecvTask", 1536, NULL, osPriorityHigh, &UDPTaskHandle);
|
||
/* UDP 消息解析任务 */
|
||
xReturn = xTaskCreate((TaskFunction_t)udp_parse_task_function, "UDPParseTask", 2048, NULL, osPriorityAboveNormal, &UDP_ParseTaskHandle);
|
||
/* 云快充平台交互任务 */
|
||
xReturn = xTaskCreate((TaskFunction_t)ykc_task_function, "YKC_Task", 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);
|
||
}
|
||
}
|