mirror of
https://gitee.com/cosyos/cosyos.git
synced 2026-02-05 11:29:44 +08:00
删除文件 System/os_debug.c
This commit is contained in:
@@ -1,141 +0,0 @@
|
||||
/**************************************************************************//**
|
||||
* @item CosyOS-III Kernel
|
||||
* @file os_debug.c
|
||||
* @brief DEBUG接口
|
||||
* @details DEBUG接口,串口发送和接收解析。
|
||||
* @author 迟凯峰
|
||||
* @version V2.1.0
|
||||
* @date 2025.12.15
|
||||
******************************************************************************/
|
||||
|
||||
#include "os_var.h"
|
||||
#if (SYSCFG_DEBUGGING == __ENABLED__)
|
||||
#include "os_api.h"
|
||||
#include "sv_com.h"
|
||||
#include "sv_create.h"
|
||||
#include "sv_task.h"
|
||||
#include "ur_api.h"
|
||||
#include <string.h>
|
||||
|
||||
/**
|
||||
\brief 字符串转整型
|
||||
\param[in] str 字符串指针
|
||||
\return 转换后的整型数据
|
||||
\note Keil C51/C251 标准库中的 atoi() 是非线程安全的,故额外定义此函数,
|
||||
专用于DEBUG接口的串口接收解析。
|
||||
*/
|
||||
static int _atoi_(const char* str)
|
||||
{
|
||||
if(str == OS_NULL || !*str){
|
||||
return 0;
|
||||
}
|
||||
else{
|
||||
int a = 0;
|
||||
int k = 1;
|
||||
s_u8_t i = s_strlen(str);
|
||||
while(i--){
|
||||
if(str[i] >= '0' && str[i] <= '9'){
|
||||
a += (str[i] - '0') * k;
|
||||
k *= 10;
|
||||
}
|
||||
else if(str[i] == '+'){
|
||||
return a;
|
||||
}
|
||||
else if(str[i] == '-'){
|
||||
return -a;
|
||||
}
|
||||
else{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return a;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
\brief 接收解析
|
||||
\details DEBUG接口,串口接收解析。
|
||||
\return 无
|
||||
*/
|
||||
void os_debug_recv(void)
|
||||
{
|
||||
#define p s_debug_recvptr
|
||||
#define len s_debug_recvlen
|
||||
p[len] = '\0';
|
||||
if(len == 9 && !s_memcmp(p, "taskmgr\r\n", 9)){
|
||||
s_taskmgr_sign = true;
|
||||
s_taskmgr_upspeed = 0;
|
||||
s_timqry_handle[OS_TMID_TASKMGR]->timer = s_timqry_handle[OS_TMID_TASKMGR]->reload;
|
||||
}
|
||||
else if(len == 6 && !s_memcmp(p, "exit\r\n", 6)){
|
||||
s_taskmgr_sign = false;
|
||||
}
|
||||
else if(len >= 15 && !s_memcmp(p, "taskmgr /s=", 11)){
|
||||
s_u8_t i;
|
||||
char *mptr = p + 11;
|
||||
for(i = 0; i < 5; i++){
|
||||
if(mptr[i] >= '0' && mptr[i] <= '9');
|
||||
else break;
|
||||
}
|
||||
if(i >= 2 && !s_memcmp(mptr + i, "\r\n", 2)){
|
||||
s_u16_t temp;
|
||||
mptr[i] = '\0';
|
||||
temp = _atoi_(mptr);
|
||||
if(temp >= 50 && temp <= 5000){
|
||||
s_timqry_handle[OS_TMID_TASKMGR]->reload = (temp * 1000UL) / SYSCFG_SYSTICK_CYCLE;
|
||||
}
|
||||
}
|
||||
}
|
||||
#undef p
|
||||
#undef len
|
||||
}
|
||||
|
||||
/**
|
||||
\brief 系统调试器
|
||||
\details 负责系统DEBUG信息的输出,具体包括命令行和任务管理器。
|
||||
\param[in] 定时器ID OS_TMID_DEBUGGER
|
||||
\param[in] 定时查询事件 s_debug_sendtype
|
||||
\param[in] 自动重装载 false
|
||||
\param[in] 任务名称 Debugger
|
||||
\param[in] 任务优先级 SYSCFG_TASKPRIORITY - 1
|
||||
\param[in] 任务栈大小 SYSCFG_STACKSIZE_DEBUGGER
|
||||
\param[in] 安全运行时 0
|
||||
\param[in] 任务名称文本 遗产模式:"Debugger",标准/兼容模式:"系统调试器"
|
||||
\return 无
|
||||
\note 定时查询任务
|
||||
*/
|
||||
#define _taskname "\xCF\xB5\xCD\xB3\xB5\xF7\xCA\xD4\xC6\xF7" /*!< "系统调试器" */
|
||||
uCreateTask_TimQry
|
||||
(
|
||||
OS_TMID_DEBUGGER, s_debug_sendtype, false,
|
||||
Debugger, SYSCFG_TASKPRIORITY - 1, SYSCFG_STACKSIZE_DEBUGGER, 0, _taskname
|
||||
)
|
||||
{
|
||||
#if (SYSCFG_DEBUG_SENDLEN == __DISABLED__)
|
||||
void debug_hook(char _XDATA_MEM_ *p);
|
||||
#else
|
||||
void debug_hook(char _XDATA_MEM_ *p, s_u16_t len);
|
||||
#endif
|
||||
while(true){
|
||||
if(s_debug_sendtype & OS_DEBUG_SEND_TASKMGR){
|
||||
s_debug_sendtype &= ~OS_DEBUG_SEND_TASKMGR;
|
||||
#if (SYSCFG_DEBUG_SENDLEN == __DISABLED__)
|
||||
debug_hook(s_taskmgr_sendbuff);
|
||||
#else
|
||||
debug_hook(s_taskmgr_sendbuff, s_taskmgr_sendlen);
|
||||
#endif
|
||||
}/*
|
||||
else if(s_debug_sendtype & OS_DEBUG_SEND_CMDLINE){
|
||||
s_debug_sendtype &= ~OS_DEBUG_SEND_CMDLINE;
|
||||
#if (SYSCFG_DEBUG_SENDLEN == __DISABLED__)
|
||||
debug_hook(s_cmdline_sendbuff);
|
||||
#else
|
||||
debug_hook(s_cmdline_sendbuff, s_cmdline_sendlen);
|
||||
#endif
|
||||
}*/
|
||||
uSuspendTasking();
|
||||
}
|
||||
}
|
||||
#undef _taskname
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user