⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 os_probe.c

📁 ucos-ii 的完整代码
💻 C
📖 第 1 页 / 共 2 页
字号:
/*
*********************************************************************************************************
*                                     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.40
* Programmer(s) : BAN
*********************************************************************************************************
*/

/*
*********************************************************************************************************
*                                              INCLUDE FILES
*********************************************************************************************************
*/

#define  OS_PROBE_MODULE
#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
*********************************************************************************************************
*/


/*
*********************************************************************************************************
*                                             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)
{
    INT8U  err;


#if (OS_TASK_CREATE_EXT_EN > 0)
    #if (OS_STK_GROWTH == 1)
    err = OSTaskCreateExt( OSProbe_Task,
                           (void *)0,
                          &OSProbe_TaskStk[OS_PROBE_TASK_STK_SIZE - 1], /* Set Top-Of-Stack.                            */
                           OS_PROBE_TASK_PRIO,
                           OS_PROBE_TASK_PRIO,
                          &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
    err = OSTaskCreateExt( OSProbe_Task,
                           (void *)0,
                          &OSProbe_TaskStk[0],                          /* Set Top-Of-Stack.                            */
                           OS_PROBE_TASK_PRIO,
                           OS_PROBE_TASK_PRIO,
                          &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)
    err = OSTaskCreate( OSProbe_Task,
                        (void *)0,
                       &OSProbe_TaskStk[OS_PROBE_TASK_STK_SIZE - 1],
                        OS_PROBE_TASK_PRIO);
    #else
    err = OSTaskCreate( OSProbe_Task,
                        (void *)0,
                       &OSProbe_TaskStk[0],
                        OS_PROBE_TASK_PRIO);
    #endif
#endif

#if   (OS_TASK_NAME_SIZE > 15)
    OSTaskNameSet(OS_PROBE_TASK_PRIO, (INT8U *)"Probe OS PlugIn", &err);
#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


/*
*********************************************************************************************************
*********************************************************************************************************
*                                               TASK HOOKS
*********************************************************************************************************
*********************************************************************************************************
*/

/*
*********************************************************************************************************

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -