add more comments

This commit is contained in:
wmano
2025-11-18 00:40:02 +08:00
parent 9b3e035b75
commit 7e463e56ad
48 changed files with 2334 additions and 497 deletions
+49 -2
View File
@@ -1,3 +1,12 @@
/****************************************************************************
文件名称 : chrg_north.c
完成日期 :
当前版本号 : V1.0
主要功能 : 实现北向通信交互,包括接收命令解析,发送请求命令,切换通路。以独立线程处理。
版本历史 : 创建原始版本
说明 :
******************************************************************************/
#include <string.h>
#include <stdlib.h>
#include <rtthread.h>
@@ -35,7 +44,14 @@ struct chrg_north_t chrgnorth = {
.manual = MANU_AUTO,
};
// 北向通道选择
/*****************************************************************
函数名称: chrg_north_switch
函数描述: 北向通道选择
输入参数: ch: 北向通道
输出参数: -
返回说明: <0: 错误
其它说明: -
*****************************************************************/
int chrg_north_switch (eIDX_NOR_CH ch)
{
if (ch >= TOTAL_NOR_CHS) {
@@ -46,6 +62,14 @@ int chrg_north_switch (eIDX_NOR_CH ch)
chrgios[IDX_GPO_NOR_SW_B].base, (eIDX_CH)ch);
}
/*****************************************************************
函数名称: chrg_north_send
函数描述: 北向通道数据发送
输入参数: *data: 数据 length: 数据长度
输出参数: -
返回说明: <0: 错误 >0:发送数据长度
其它说明: -
*****************************************************************/
int chrg_north_send (rt_uint8_t *data, rt_size_t length)
{
rt_ssize_t ret = -1;
@@ -59,7 +83,14 @@ int chrg_north_send (rt_uint8_t *data, rt_size_t length)
return ret;
}
// 提取3字节帧头
/*****************************************************************
函数名称: chrg_north_frame_head
函数描述: 北向通道数据帧头提取
输入参数: *rb: 缓冲区 *head: 帧头 id:编号
输出参数: -
返回说明: <0: 错误 >0:帧长度
其它说明: 提取3字节帧头
*****************************************************************/
static int chrg_north_frame_head (struct rt_ringbuffer *rb, rt_uint8_t *head, eIDX_ID id)
{
int i = 0;
@@ -123,6 +154,14 @@ static int chrg_north_frame_head (struct rt_ringbuffer *rb, rt_uint8_t *head, eI
return -1;
}
/*****************************************************************
函数名称: chrg_north_pickup_frame
函数描述: 北向通道数据帧提取
输入参数: *rb: 缓冲区 *pFrame: 数据帧 idx:通道
输出参数: -
返回说明: <0: 错误 >0:帧长度
其它说明: -
*****************************************************************/
static int chrg_north_pickup_frame (struct rt_ringbuffer *rb,
struct pickup_info_t *pFrame, eIDX_NOR_CH idx)
{
@@ -208,6 +247,14 @@ static int chrg_north_pickup_frame (struct rt_ringbuffer *rb,
return cnt;
}
/*****************************************************************
函数名称: chrg_north_thread_entry
函数描述: 北向通道数据接收线程体
输入参数: *data: 本线程信息
输出参数: -
返回说明: -
其它说明: -
*****************************************************************/
void chrg_north_thread_entry (void *data)
{
struct chrg_thread_t *pTHR = (struct chrg_thread_t *)data;