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

📄 evtloglib.c

📁 VXWORKS源代码
💻 C
📖 第 1 页 / 共 2 页
字号:
    EVT_STORE_UINT16 (eventBase, action);    intBase = (int *) eventBase;    EVT_STORE_UINT32 (intBase, param1);    EVT_STORE_UINT32 (intBase, param2);    EVT_STORE_UINT32 (intBase, param3);    intUnlock (level);                  /* UNLOCK INTERRUPTS */    }#endif /* evtLogLib_PORTABLE *//********************************************************************************* evtLogOInt - For level 1s, the object state events.** This event logging routine stores*	event id	(short )*	timestamp	(int )*	param[0..5]	(int )	 - no. of param logged depends on the event id.** This routine is used when interrupts must be locked by this code.** SEE ALSO:* NOMANUAL*/void evtLogOInt     (    event_t  action,		    /* event action */    int      nParam,    int      param1,    int      param2,    int      param3,    int      param4,    int      param5    )    {    int level;    level = intLock();    evtLogO(action, nParam, param1, param2, param3, param4, param5);    intUnlock(level);    }/********************************************************************************* evtLogO - For level 1s, the object state events.** This event logging routine stores*	event id	(short )*	timestamp	(int )*	param[0..5]	(int )	 - no. of param logged depends on the event id.** Called from within an interrupt lock area.** SEE ALSO:* NOMANUAL*/void evtLogO    (    event_t  action,             /* event action */    int      nParam,    int      param1,    int      param2,    int      param3,    int      param4,    int      param5    )    {    event_t * 	     eventBase;    int *            intBase;    int		     timestamp;    EVTLOG_RESERVE_BUFF_SPACE_L(6 + (nParam * 4));    EVT_STORE_UINT16 (eventBase, action);    intBase = (int *) eventBase;    timestamp = (* _func_tmrStamp) ();    EVT_STORE_UINT32 (intBase, timestamp);    switch (nParam)        {        case 5:            EVT_STORE_UINT32 (intBase, param5);        case 4:            EVT_STORE_UINT32 (intBase, param4);        case 3:            EVT_STORE_UINT32 (intBase, param3);        case 2:            EVT_STORE_UINT32 (intBase, param2);        case 1:            EVT_STORE_UINT32 (intBase, param1);        }    }/********************************************************************************* evtLogString - Add a string to the event log.** This event logging routine stores*	event id	(short )*	arg		(int)*	arg		(int)*	arg		(int)*	address		(int)*	string size	(int)   - if size is ZERO the string does not exist.*	string		(char)** SEE ALSO:* NOMANUAL*/void evtLogString    (    event_t 	     action,		/* the event id */    int	       	     arg1,		/* an extra argument */    int	       	     arg2,		/* an extra argument */    int	       	     arg3,		/* an extra argument */    int        	     addrId,		/* an address */    const char *     string		/* series of characters */    )    {    event_t *        eventBase;    int *            intBase;    int              evtSize = strlen (string);    int              level;    evtSize = MEM_ROUND_UP (evtSize);    level = intLock ();                 /* LOCK INTERRUPTS */    EVTLOG_RESERVE_BUFF_SPACE(evtSize + EVTLOG_STR_SIZE);    EVT_STORE_UINT16 (eventBase, action);    intBase = (int *) eventBase;    EVT_STORE_UINT32 (intBase, arg1);    EVT_STORE_UINT32 (intBase, arg2);    EVT_STORE_UINT32 (intBase, arg3);    EVT_STORE_UINT32 (intBase, addrId);    EVT_STORE_UINT32 (intBase, evtSize);    if (evtSize != 0)	{        strncpy ((char *) intBase, string, evtSize);	}    intUnlock (level);                  /* UNLOCK INTERRUPTS */    }/********************************************************************************* evtLogPoint - logs a user defined event or eventpoint via event () or e ().** This event logging routine stores*	event id	(short )*	timestamp	(int)*	address		(int)*	buffer size	(int)	- if size is ZERO the buffer does not exist.*	buffer		(char)** RETURNS: OK, or ERROR if unable to log event point* SEE ALSO:* NOMANUAL*/STATUS evtLogPoint     (    event_t    action,		/* event id */    void *     addr, 		/* pc address */    size_t     nbytes,		/* buffer size */    char *     buffer		/* buffer */    )    {    event_t *        eventBase;    event_t 	     biasedAction;    int * 	     intBase;    int 	     level;    int 	     timestamp;    biasedAction = action + MIN_USER_ID;    /* if (evtLogTIsOn) */	{        /* is event id within the range of user event ids? */        if (biasedAction < MIN_USER_ID || biasedAction > MAX_USER_ID)	    return (ERROR);        level = intLock ();                 /* LOCK INTERRUPTS */        EVTLOG_RESERVE_BUFF_SPACE_STAT(nbytes + EVTLOG_PT_SIZE);        EVT_STORE_UINT16 (eventBase, biasedAction);        intBase = (int *) eventBase;        timestamp = (* _func_tmrStamp) ();	EVT_STORE_UINT32 (intBase, timestamp);        EVT_STORE_UINT32 (intBase, (int) addr);        EVT_STORE_UINT32 (intBase, nbytes);	/* copy buffer contents into event buffer */        if ((nbytes != 0) && (buffer != NULL))	    {	    memcpy ((char *) intBase, buffer, nbytes);	    }        intUnlock (level);                  /* UNLOCK INTERRUPTS */        }    return (OK);    }/********************************************************************************* evtLogTasks -	log name, status and priority of all tasks in the system** SEE ALSO:* NOMANUAL*/void evtLogTasks (void)    {    int         nTasks;                 /* number of task */    int         idList[MAX_WV_TASKS];   /* list of active IDs */    int         ix;                     /* index */    /* get list of tasks in the system */    nTasks = taskIdListGet (idList, NELEMENTS (idList));    /* sort the task list */    taskIdListSort (idList, nTasks);    /* log the name of each task in the system */    for (ix = 0; ix < nTasks; ++ix)        {        if (taskIdVerify (idList[ix]) == OK)            {            evtLogString (EVENT_TASKNAME, 	  	          ((WIND_TCB *)idList[ix])->status,	  	          ((WIND_TCB *)idList[ix])->priority,	  	          ((WIND_TCB *)idList[ix])->lockCnt,		          idList[ix], taskName (idList[ix]));	    }        }    }/******************************************************************************** * evtSched - log events from the portable kernel ** This event logging routine stores*       event id        (short)*	time stamp	(int)*	taskIdCurrent   (int)	|	if event is EVENT_WIND_EXIT_DISPATCH or*	priority	(int)	|	EVENT_WIND_EXIT_NODISPATCH* directly onto the buffer.* It is used for the portable workQLib.* Assume that interrupts are already locked.** SEE ALSO:* NOMANUAL*/void evtsched    (    event_t action,           /* event id */    int     arg1,	      /* taskIdCurrent or not logged */    int     arg2	      /* priority or not logged */    )    {    event_t *        eventBase;    int *            intBase;    int		     timestamp;#if 0 /* need this? NPS */    if (evtBufOverflow)		/* leave if buffer is full */	return;#endif    timestamp = (* _func_tmrStamp) ();    switch (action)    {    case EVENT_WIND_EXIT_IDLE: 	{        EVTLOG_RESERVE_BUFF_SPACE_L(6);        EVT_STORE_UINT16 (eventBase, action);        intBase = (int *) eventBase;        EVT_STORE_UINT32 (intBase, timestamp);	break;	}    case EVENT_WIND_EXIT_NODISPATCH:    case EVENT_WIND_EXIT_NODISPATCH_PI:	{        EVTLOG_RESERVE_BUFF_SPACE_L(10);        EVT_STORE_UINT16 (eventBase, action);        intBase = (int *) eventBase;        EVT_STORE_UINT32 (intBase, timestamp);	EVT_STORE_UINT32 (intBase, arg2);	/* priority */	break;	}    case EVENT_WIND_EXIT_DISPATCH:    case EVENT_WIND_EXIT_DISPATCH_PI:	{        EVTLOG_RESERVE_BUFF_SPACE_L(14);        EVT_STORE_UINT16 (eventBase, action);        intBase = (int *) eventBase;        EVT_STORE_UINT32 (intBase, timestamp);	EVT_STORE_UINT32 (intBase, arg1);	/* taskIdCurrent */	EVT_STORE_UINT32 (intBase, arg2);	/* priority */	}    }    }#if CPU_FAMILY==PPC/********************************************************************************* evtLogT1_noTS - log event id without getting timestamp** This event logging routine stores*       event id        (short )*       time            (int )** This routines is very similar to the evtLogT1. The main difference* is that no timestamp is here. The parameter passed is actually the* current timestamp for this event. This routine is called when an* interrupt is entered. It is used for PPC architecture. PPC generates* only one kind of interrupt. When the interrupt is entered, the timestamp* for windview is obtained. No information about the type of interrupt is* known at that point. Only when the sysIbcIntHandler routine is called,* the interrupt vector handler is obtained and it is passed to this* routine, together with the timestamp.* When this routine is called, interrupts must be locked already.** SEE ALSO:* NOMANUAL*/void evtLogT1_noTS    (    event_t action,           /* event id */    int     param            /* timestamp */    )    {    event_t *        eventBase;    int *            intBase;    EVTLOG_RESERVE_BUFF_SPACE_L(EVTLOG_T0_SIZE);    EVT_STORE_UINT16 (eventBase, action);    intBase = (int *) eventBase;    EVT_STORE_UINT32 (intBase, param);    }#endif /* CPU_FAMILY==PPC */#if CPU_FAMILY==I960/******************************************************************************** * windInst1 - log events from the 960 assembly language kernel ** Interrupts are locked when this is called** SEE ALSO:* NOMANUAL*/void windInst1 (void)    {    EVT_CTX_NODISP ((int)taskIdCurrent,		    taskIdCurrent->priority,		    taskIdCurrent->priNormal);    }/******************************************************************************** * windInstDispatch - ** interrupts are locked out when this is called.** SEE ALSO:* NOMANUAL*/void windInstDispatch (void)    {    /*     * At this point, we need to decide whether to log an event     * EVENT_WIND_EXIT_DISPATCH or EVENT_WIND_EXIT_DISPATCH_PI.     * This is done in the macro EVT_CTX_DISP by comparing     * taskIdCurrent->priority and taskIdCurrent->priNormal. As     * a result, the first parameter to the EVT_CTX_DISP macro is     * not actually used and could be removed in a future code tidy up.     */    EVT_CTX_DISP (EVENT_WIND_EXIT_DISPATCH_PI,		  (int) taskIdCurrent, 		  taskIdCurrent->priority, 		  taskIdCurrent->priNormal);    }/******************************************************************************** * windInstIdle - ** interrupts are locked out when this is called.** SEE ALSO:* NOMANUAL*/void windInstIdle (void)    {    EVT_CTX_IDLE(EVENT_WIND_EXIT_IDLE, &readyQHead);    }/******************************************************************************** * windInstIntEnt -** Interrupts are NOT locked when this is called.* evtAction has already been checked for non-zero.** SEE ALSO:* NOMANUAL*/void windInstIntEnt (void)    {    int 	level;    event_t	evtId;    /*      * shift and mask off bits returned by intLock to obtain     * I960 specific interrupt level. Then convert to event ID     */    level = intLock ();    evtId = (event_t) EVENT_INT_ENT ((level >> 16) & 0x001f);    if ( WV_EVTCLASS_IS_SET(WV_CLASS_1|WV_ON) )	( * _func_evtLogT0_noInt) (evtId);    intUnlock (level);    if (TRG_EVTCLASS_IS_SET(TRG_CLASS_1|TRG_ON))	( * _func_trgCheck) (evtId, TRG_CLASS1_INDEX, 	                     NULL, NULL, NULL, NULL, NULL, NULL);    }/******************************************************************************** * windInstIntExit -** Interrupts are NOT locked when this is called.* evtAction has already been checked for non-zero.** SEE ALSO:* NOMANUAL*/void windInstIntExit (void)    {    int 	level;    event_t	evtId;    level = intLock ();        if (workQIsEmpty)    	evtId = EVENT_INT_EXIT;    else    	evtId = EVENT_INT_EXIT_K;    if ( WV_EVTCLASS_IS_SET(WV_CLASS_1|WV_ON) )	( * _func_evtLogT0_noInt) (evtId);    intUnlock (level);    if (TRG_EVTCLASS_IS_SET(TRG_CLASS_1|TRG_ON))	( * _func_trgCheck) (evtId, TRG_CLASS1_INDEX, 	                     NULL, NULL, NULL, NULL, NULL, NULL);    }#endif /* CPU_FAMILY==I960 */

⌨️ 快捷键说明

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