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

📄 debug.c

📁 《OSEK/VDX汽车电子嵌入式软件编程技术》中光盘的资料
💻 C
字号:
/************************************************
*
*	$Copyright    2001 Joseph J. Lemieux  ALL RIGHTS RESERVED. $
*
*	$Filename: C:\OSEKBook\src\CH04\src\debug.c $
*
*	Description:  Module that contains routines to aid in
*                  the debugging of an application.
*
************************************************/
#ifndef DEBUGC
#define DEBUGC

/************************************************
*
*	Include files
*
************************************************/

#include "typedefs.h"
#include "os.h"
#include "debug.h"

/************************************************
*
*	Local macros
*
************************************************/

/************************************************
*
*	Local type definitions
*
************************************************/
/***
*
* Type of structure that holds the error information
*
***/

typedef struct ERROR_LOG_TYPEtag {
   StatusType error;
   TaskType task;
   }ERROR_LOG_TYPE;

/************************************************
*
*	Local Function Prototypes
*
************************************************/

/************************************************
*
*	Local Variables
*
************************************************/
/***
*
* Define error log and a pointer to the next
* entry in the log to be updated.
*
***/
ERROR_LOG_TYPE errorLog[10] = {
   {E_OK,(TaskType)0},
   {E_OK,(TaskType)0},
   {E_OK,(TaskType)0},
   {E_OK,(TaskType)0},
   {E_OK,(TaskType)0},
   {E_OK,(TaskType)0},
   {E_OK,(TaskType)0},
   {E_OK,(TaskType)0},
   {E_OK,(TaskType)0},
   {E_OK,(TaskType)0}
   };
ERROR_LOG_TYPE *nextErrorLog = errorLog;
/************************************************
*
*	Local Constants
*
************************************************/

/************************************************
*
*	Functions
*
************************************************/
/************************************************
*
*   Function:     ErrorHook
*
*   Inputs:       StatusType - type of error that occurred.
*
*   Outputs:      Updates the Error Log.
*
*   Returns:      void
*
*   Description:  Adds the error to the log and updates
*                 the pointer.
*
************************************************/
void ErrorHook(StatusType error)
{
/***
*
* Store error and update pointer
*
***/
   nextErrorLog->error = error;
   GetTaskID(&nextErrorLog->task);
   ++nextErrorLog;
/***
*
* Limit pointer to buffer
*
***/
   if(nextErrorLog > &errorLog[9])
   {
      nextErrorLog = errorLog;
   }
}

/************************************************
*
*   Function:     PreTaskHook
*
*   Inputs:       none
*
*   Outputs:      none
*
*   Returns:      void
*
*   Description:  Placeholder for future development
*
************************************************/
void PreTaskHook(void)
{
}

/************************************************
*
*   Function:     PostTaskHook
*
*   Inputs:       none
*
*   Outputs:      none
*
*   Returns:      void
*
*   Description:  Placeholder for future development
*
************************************************/
void PostTaskHook(void)
{
}

#endif /* DEBUGC */

⌨️ 快捷键说明

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