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

📄 evtloglib.c

📁 VxWorks BSP框架源代码包含头文件和驱动
💻 C
📖 第 1 页 / 共 2 页
字号:
/* evtLogLib.c - event logging library *//* Copyright 1994-1998 Wind River Systems, Inc. */#include "copyright_wrs.h"/*modification history--------------------03m,14aug98,cth  removed MEM_ROUND_UP from evtLogPoint03m,10aug98,pr   added i960 function pointers to evtLogFuncBind03l,30jul98,cjtc removed logMsg EVTLOG_RESERVE_BUFF_SPACE macros which resulted		 in stack corruption of the calling task (SPR 21993)03k,13may98,pr   modified logMsg content03j,12may98,pr   added logMsg and stop windview if buffer is full03i,17apr98,cth  removed function evtHeaderLog03h,15apr98,cth  added binding of _func_evtLogReserveTaskName03g,10apr98,cjtc architecture port for i960 processors.		 fixed bug in evtLogT0_noInt in which timestamp was written to		 the event buffer before it was read.		 Removed unused local variable "level" from evtLogT0_noInt03f,09apr98,pr   added evtLogT0_noInt declaration03e,08apr98,pr   modified evtLogO to be of general use. Added evtLogT0_noInt03d,06apr98,nps  68k family nows shares portable code.03c,18mar98,nps  fixed check for 'thin' mode when creating header.03b,17feb98,dvs  added events for memory instrumentation in evtLogO and 	    pr	 fixed evtLogO buffer size.03a,03feb98,cth  changed evtBufferId from static to global02z,27jan98,cth  added evtObjLogFuncBind, evtLogFuncBind, evtBufferBind and		 evtHeaderLog, updated copyright02y,25jan98,pr   changed size in evtLogT1_noTS02x,22jan98,pr   fixed evtsched02w,18dec97,cth  changed include buffer.h to wvBufferP.h, changed tmpBufId to		 evtBufferId02v,16nov97,cth  removed evtBuf and rBuff references 		 changed buffer writes to use generic WV2.0 buffers02u,22oct97,pr   fixed EVTLOG_RESERVE_BUFF_SPACE_L for evtLogT1_noTS02t,21oct97,nps  use modified rBuff API02s,18aug97,nps  fixed bug in evtLogM102r,20jul97,nps  added ring buffer support02q,24jun97,pr   commented the evtLogTIsOn for evtLogPoint02p,08jul96,pr   added evtLogT1_noTS for PPC02o,06dec94,rdc  fixed bogus intlocks that should have been unlocks.02n,08nov94,rdc  added 960 kernel instrumentation routines.02m,02nov94,rdc  added argument to evtLogString to support lockCount param		 in EVENT_TASKNAME.02l,02nov94,rdc  unlocked interrupts before returning because of errors.02k,27may94,smb  now use alignment macros to store data in buffer.02j,23may94,pme  removed taskIdLogin for EVENT_WIND_EXIT_NODISPATCH		 made evtsched equivalent to the 68k assembly version01i,05may94,smb  sparc porting01h,16mar94,smb  removed EVENT_WIND_EXIT_IDLENOT		 level 1 optimisations.01g,22feb94,smb  changed typedef EVENT_TYPE to event_t (SPR #3064)01f,24jan94,smb  fixed return values for eventPoint()01e,19jan94,smb  event buffer fix SPR #290401d,14jan94,c_s  evtLogOInt now handles EVENT_SIGWRAPPER correctly (SPR #2883).01c,04jan94,c_s  evtLogPoint now validates the user event ID correctly. 		   SPR #2724.01b,30dec93,c_s  evtLogPoint now uses memcpy (), rather than strncpy (), to 		   transfer the user's buffer of data for user-defined events		   to the logging area.  SPR #2799.01a,10dec93,smb  created*//*DESCRIPTIONThis library provides routines which log events to the buffer for differenttypes of events generated by the instrumented code.INCLUDE FILES: SEE ALSO: NOMANUAL*/#include "vxWorks.h"#include "intLib.h"#include "logLib.h"#include "wvLib.h"#include "string.h"#include "taskLib.h"#include "sysLib.h"#include "private/taskLibP.h"#include "private/eventP.h"#include "private/kernelLibP.h"#include "private/workQLibP.h"#include "private/wvBufferP.h"#include "private/evtLogLibP.h"#include "private/kernelLibP.h"/* optimized version no longer used for 680X0 */#define evtLogLib_PORTABLE/* defines */#define MAX_WV_TASKS    500        /* should be the same MAX_DSP_TASKS */#define EVTLOG_RESERVE_BUFF_SPACE(EVENT_SIZE)                     \eventBase = (event_t *) evtBufferId->writeRtn (evtBufferId,NULL,EVENT_SIZE);  \                                                                  \if (!eventBase)                                                   \    {                                                             \    wvEvtLogStop();						  \    intUnlock (level);                                            \    return;                                                       \    }#define EVTLOG_RESERVE_BUFF_SPACE_STAT(EVENT_SIZE)                \eventBase = (event_t *) evtBufferId->writeRtn (evtBufferId,NULL,EVENT_SIZE);  \                                                                  \if (!eventBase)                                                   \    {                                                             \    wvEvtLogStop();						  \    intUnlock (level);                                            \    return (ERROR);                                               \    }#define EVTLOG_RESERVE_BUFF_SPACE_L(EVENT_SIZE)                   \eventBase = (event_t *) evtBufferId->writeRtn (evtBufferId,NULL,EVENT_SIZE);  \                                                                  \if (!eventBase)                                                   \    {                                                             \    wvEvtLogStop();						  \    return;                                                       \    }/* globals */IMPORT	Q_HEAD	readyQHead;	/* multi-way ready queue head *//* local */BUFFER_ID evtBufferId;             /* event buffer identifier *//* forward declarations */void evtLogTasks (void);void evtLogOInt  (event_t  action, int nParam, int param1, int param2, 				int param3, int param4, int param5);void evtLogO     (event_t action, int nParam, int param1, int param2, 				int param3, int param4, int param5);void evtLogString (event_t action, int arg1, int arg2, int arg3,				int addrId, const char *string);int evtLogPoint  (event_t action, void * addr, size_t nbytes, 				char * buffer);void evtsched ( event_t action, int arg1, int arg2);void evtLogM0  (event_t action);void evtLogM1  (event_t action, int param1);void evtLogM2  (event_t action, int param1, int param2);void evtLogM3  (event_t action, int param1, int param2, int param3);void evtLogT0  (event_t action);void evtLogT0_noInt  (event_t action);void evtLogT1  (event_t action, int param);#if CPU_FAMILY==PPCvoid evtLogT1_noTS  (event_t action, int param);#endif /* CPU_FAMILY==PPC */#if CPU_FAMILY==I960void windInst1 (void);void windInstDispatch (void);void windInstIdle (void);void windInstIntEnt (void);void windInstIntExit (void);#endif /* CPU_FAMILY==I960 *//********************************************************************************* evtObjLogFuncBind - bind object-level logging functions** This routine binds the function pointers used to log system-object events* to the appropriate functions in this library.** RETURNS: N/A* NOMANUAL*/void evtObjLogFuncBind (void)    {    _func_evtLogO        = (VOIDFUNCPTR) evtLogO;    _func_evtLogOIntLock = (VOIDFUNCPTR) evtLogOInt;    }/********************************************************************************* evtLogFuncBind - bind general event-logging functions** This function binds instrumentation function pointers to logging functions* in this file.  Event logging routines associated with class-1 (object-* class) logging must be bound earlier, with a call to evtObjLogFuncBind.** RETURNS: N/A* NOMANUAL*/void evtLogFuncBind (void)    {    /* Task-transition logging. */    _func_evtLogM0 = (VOIDFUNCPTR) evtLogM0;        _func_evtLogM1 = (VOIDFUNCPTR) evtLogM1;    _func_evtLogM2 = (VOIDFUNCPTR) evtLogM2;    _func_evtLogM3 = (VOIDFUNCPTR) evtLogM3;    /* Context-switch logging. */    _func_evtLogT0 = (VOIDFUNCPTR) evtLogT0;        _func_evtLogT1 = (VOIDFUNCPTR) evtLogT1;    _func_evtLogT0_noInt = (VOIDFUNCPTR) evtLogT0_noInt;#if CPU_FAMILY==PPC    _func_evtLogT1_noTS = (VOIDFUNCPTR) evtLogT1_noTS;#endif /* CPU_FAMILY==PPC */    _func_evtLogTSched = (VOIDFUNCPTR) evtsched;  /* iff portable kernel */    /* Special logging functions. */    _func_evtLogPoint = (FUNCPTR) evtLogPoint;    _func_evtLogString = (VOIDFUNCPTR) evtLogString;    _func_evtLogReserveTaskName = (FUNCPTR) wvTaskNamesBufAdd;    /* i960 specific functione pointers used in windALib.s */#if CPU_FAMILY==I960    _func_windInst1 = (VOIDFUNCPTR) windInst1;    _func_windInstDispatch = (VOIDFUNCPTR) windInstDispatch;    _func_windInstIdle = (VOIDFUNCPTR) windInstIdle;    _func_windInstIntEnt = (VOIDFUNCPTR) windInstIntEnt;    _func_windInstIntExit = (VOIDFUNCPTR) windInstIntExit;#endif /* CPU_FAMILY==I960 */    }/********************************************************************************* evtBufferBind - bind logging routines to a specific event buffer** This routine associates a specific event buffer with the event-logging* routines.** RETURNS: N/A* NOMANUAL*/void evtBufferBind    (    BUFFER_ID bufId	/* bind logging functions to this buffer */    )    {    evtBufferId = bufId;    }#ifdef evtLogLib_PORTABLE/********************************************************************************* evtLogT0 - log event id** This event logging routine stores*       event id        (short )*       time		(int )* This routine is called by level 3 (context switch events) * taskLock, taskUnlock and tickAnnounce.** SEE ALSO:* NOMANUAL*/void evtLogT0    (    event_t action           /* event id */    )    {    int              level;                  /* interrupt level */    event_t *        eventBase;    int *            intBase;    int		     timestamp;    level = intLock ();                 /* LOCK INTERRUPTS */    EVTLOG_RESERVE_BUFF_SPACE(EVTLOG_T0_SIZE);    EVT_STORE_UINT16 (eventBase, action);    intBase = (int *) eventBase;    timestamp = (* _func_tmrStamp) ();    EVT_STORE_UINT32 (intBase, timestamp);    intUnlock (level);                  /* UNLOCK INTERRUPTS */    }/********************************************************************************* evtLogT0_noInt - log event id without locking interrupts ** This event logging routine stores*       event id        (short )*       time            (int )* This routine is called by level 3 (context switch events) when interrupt* are already locked (in particular by arch dependent code).** SEE ALSO:* NOMANUAL*/void evtLogT0_noInt    (    event_t action           /* event id */    )    {    event_t *        eventBase;    int *            intBase;    int		     timestamp;    EVTLOG_RESERVE_BUFF_SPACE_L(EVTLOG_T0_SIZE);    EVT_STORE_UINT16 (eventBase, action);    intBase = (int *) eventBase;    timestamp = (* _func_tmrStamp) ();    EVT_STORE_UINT32 (intBase, timestamp);    }/********************************************************************************* evtLogT1 - log event id** This event logging routine stores*       event id        (short )*       time            (int )*       param           (int )** This routine is called by level 3 (context switch events)* taskLock, taskUnlock and tickAnnounce.** SEE ALSO:* NOMANUAL*/void evtLogT1    (    event_t action,          /* event id */    int     param    )    {    int       	     level;                  /* interrupt level */    event_t *        eventBase = NULL;    int *            intBase = NULL;    int		     timestamp;    level = intLock ();                 /* LOCK INTERRUPTS */    EVTLOG_RESERVE_BUFF_SPACE(EVTLOG_T1_SIZE);    EVT_STORE_UINT16 (eventBase, action);    intBase = (int *) eventBase;    timestamp = (* _func_tmrStamp) ();    EVT_STORE_UINT32 (intBase, timestamp);    EVT_STORE_UINT32 (intBase, param);    intUnlock (level);                  /* UNLOCK INTERRUPTS */    }/********************************************************************************* evtLogM0 - log event id * * This event logging routine stores*	event id	(short )** SEE ALSO:* NOMANUAL*/void evtLogM0     (    event_t action		/* event id */    )    {    int              level;			/* interrupt level */    event_t *        eventBase;    level = intLock ();                 /* LOCK INTERRUPTS */    EVTLOG_RESERVE_BUFF_SPACE(EVTLOG_M0_SIZE);    EVT_STORE_UINT16 (eventBase, action);    intUnlock (level);                  /* UNLOCK INTERRUPTS */    }/********************************************************************************* evtLogM1 - log an event ** This event logging routine stores*       event id        (short )*       param1          (int )** SEE ALSO:* NOMANUAL*/void evtLogM1    (    event_t action,    int     param1    )    {    int              level;    event_t * 	     eventBase;    int *            intBase;    level = intLock ();                 /* LOCK INTERRUPTS */    EVTLOG_RESERVE_BUFF_SPACE(EVTLOG_M1_SIZE);    EVT_STORE_UINT16 (eventBase, action);    intBase = (int *) eventBase;    EVT_STORE_UINT32 (intBase, param1);    intUnlock (level);                  /* UNLOCK INTERRUPTS */    }/********************************************************************************* evtLogM2 - log an event * * This event logging routine stores*	event id	(short )*	param1		(int )*	param2		(int )** SEE ALSO:* NOMANUAL*/void evtLogM2    (    event_t action,     int     param1,     int     param2    )    {    int              level;    event_t *        eventBase;    int *            intBase;    level = intLock ();                 /* LOCK INTERRUPTS */    EVTLOG_RESERVE_BUFF_SPACE(EVTLOG_M2_SIZE);    EVT_STORE_UINT16 (eventBase, action);    intBase = (int *) eventBase;    EVT_STORE_UINT32 (intBase, param1);    EVT_STORE_UINT32 (intBase, param2);    intUnlock (level);                  /* UNLOCK INTERRUPTS */    }/********************************************************************************* evtLogM3 - log an event ** This event logging routine stores*	event id	(short )*	param1		(int )*	param2		(int )*	param3		(int )** SEE ALSO:* NOMANUAL*/void evtLogM3    (    event_t action,    int     param1,    int     param2,    int     param3    )    {    int              level;    event_t *        eventBase;    int *            intBase;    level = intLock ();                 /* LOCK INTERRUPTS */    EVTLOG_RESERVE_BUFF_SPACE(EVTLOG_M3_SIZE);

⌨️ 快捷键说明

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