📄 os_probe.c
字号:
/*
*********************************************************************************************************
* uC/Probe uC/OS-II Plug-in
*
* (c) Copyright 2003-2006; Micrium, Inc.; Weston, FL
*
* All rights reserved. Protected by international copyright laws.
* Knowledge of the source code may NOT be used to develop a similar product.
* Please help us continue to provide the Embedded community with the finest
* software available. Your honesty is greatly appreciated.
*********************************************************************************************************
*/
/*
*********************************************************************************************************
*
* uC/Probe
*
* Plug-in for uC/OS-II
*
* Filename : os_probe.c
* Version : V1.30
* Programmer(s) : BAN
*********************************************************************************************************
*/
/*
*********************************************************************************************************
* INCLUDE FILES
*********************************************************************************************************
*/
#define OS_PROBE_GLOBALS
#include <app_cfg.h>
#include <ucos_ii.h>
#include <os_probe.h>
/*
*********************************************************************************************************
* LOCAL CONSTANTS
*********************************************************************************************************
*/
/*
*********************************************************************************************************
* LOCAL DATA TYPES
*********************************************************************************************************
*/
/*
*********************************************************************************************************
* LOCAL TABLES
*********************************************************************************************************
*/
/*
*********************************************************************************************************
* LOCAL GLOBAL VARIABLES
*********************************************************************************************************
*/
#if OS_PROBE_TASK > 0
static OS_STK OSProbe_TaskStk[OS_PROBE_TASK_STK_SIZE];
#endif
/*
*********************************************************************************************************
* LOCAL FUNCTION PROTOTYPES
*********************************************************************************************************
*/
#if OS_PROBE_TASK > 0
static void OSProbe_InitOS(void);
static void OSProbe_Task (void *p_arg);
#endif
/*
*********************************************************************************************************
* LOCAL CONFIGURATION ERRORS
*********************************************************************************************************
*/
/*
*********************************************************************************************************
*********************************************************************************************************
** GLOBAL FUNCTIONS
*********************************************************************************************************
*********************************************************************************************************
*/
/*
*********************************************************************************************************
* OSProbe_Init()
*
* Description : Initialize the uC/Probe Plug-In for uC/OS-II.
*
* Argument(s) : none.
*
* Return(s) : none.
*********************************************************************************************************
*/
void OSProbe_Init (void)
{
#if OS_PROBE_TASK > 0
OSProbe_SetDelay(100);
OSProbe_SetCallback((void (*)(void))0); /* Force terminal callback function to 'nothing' */
(void)OSProbe_TaskCPUUsage;
(void)OSProbe_TaskStkUsage;
OSProbe_InitOS();
#endif
#if OS_PROBE_HOOKS_EN > 0
OSProbe_TmrInit();
OSProbe_CyclesCtr = 0;
OSProbe_TmrCntsPrev = 0;
#endif
}
/*
*********************************************************************************************************
* OSProbe_InitOS()
*
* Description : Create the task for the uC/Probe Plug-In for uC/OS-II.
*
* Argument(s) : none.
*
* Return(s) : none.
*********************************************************************************************************
*/
#if OS_PROBE_TASK > 0
static void OSProbe_InitOS (void)
{
#if OS_TASK_NAME_SIZE > 12
INT8U err;
#endif
#if OS_TASK_CREATE_EXT_EN > 0
#if OS_STK_GROWTH == 1
(void)OSTaskCreateExt(OSProbe_Task,
(void *)0, /* No arguments passed to OSProbe_Task() */
&OSProbe_TaskStk[OS_PROBE_TASK_STK_SIZE - 1], /* Set Top-Of-Stack */
OS_PROBE_TASK_PRIO, /* Lowest priority level */
OS_PROBE_TASK_ID,
&OSProbe_TaskStk[0], /* Set Bottom-Of-Stack */
OS_PROBE_TASK_STK_SIZE,
(void *)0, /* No TCB extension */
OS_TASK_OPT_STK_CHK | OS_TASK_OPT_STK_CLR); /* Enable stack checking + clear stack */
#else
(void)OSTaskCreateExt(OSProbe_Task,
(void *)0, /* No arguments passed to OSProbe_Task() */
&OSProbe_TaskStk[0], /* Set Top-Of-Stack */
OS_PROBE_TASK_PRIO, /* Lowest priority level */
OS_PROBE_TASK_ID,
&OSProbe_TaskStk[OS_PROBE_TASK_STK_SIZE - 1], /* Set Bottom-Of-Stack */
OS_PROBE_TASK_STK_SIZE,
(void *)0, /* No TCB extension */
OS_TASK_OPT_STK_CHK | OS_TASK_OPT_STK_CLR); /* Enable stack checking + clear stack */
#endif
#else
#if OS_STK_GROWTH == 1
(void)OSTaskCreate(OSProbe_Task,
(void *)0,
&OSProbe_TaskStk[OS_PROBE_TASK_STK_SIZE - 1],
OS_PROBE_TASK_PRIO);
#else
(void)OSTaskCreate(OSProbe_Task,
(void *)0,
&OSProbe_TaskStk[0],
OS_PROBE_TASK_PRIO);
#endif
#endif
#if OS_TASK_NAME_SIZE > 20
OSTaskNameSet(OS_PROBE_TASK_PRIO, (INT8U *)"uC/Probe OS Plug-In", &err);
#else
#if OS_TASK_NAME_SIZE > 12
OSTaskNameSet(OS_PROBE_TASK_PRIO, (INT8U *)"uC/Probe OS", &err);
#endif
#endif
}
#endif
/*
*********************************************************************************************************
* OSProbe_SetCallback()
*
* Description : Set the callback function which will be invoked in OSProbe_Task().
*
* Argument(s) : call_back Pointer to the callback function.
*
* Return(s) : none.
*********************************************************************************************************
*/
#if OS_PROBE_TASK > 0
void OSProbe_SetCallback (void (*call_back)(void))
{
OSProbe_CallbackFnct = call_back;
}
#endif
/*
*********************************************************************************************************
* OSProbe_SetDelay()
*
* Description : Set the delay used in OSProbe_Task().
*
* Argument(s) : delay Delay, in milliseconds.
*
* Return(s) : none.
*********************************************************************************************************
*/
#if OS_PROBE_TASK > 0
void OSProbe_SetDelay (INT16U delay)
{
OSProbe_Delay = delay;
}
#endif
/*
*********************************************************************************************************
*********************************************************************************************************
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -