193 lines
5.5 KiB
C
193 lines
5.5 KiB
C
/* erfShow.c - Event Reporting Framework Library Show routines */
|
|
|
|
/*
|
|
* Copyright (c) 2005, 2010 Wind River Systems, Inc.
|
|
*
|
|
* The right to copy, distribute, modify or otherwise make use
|
|
* of this software may be licensed only pursuant to the terms
|
|
* of an applicable Wind River license agreement.
|
|
*/
|
|
|
|
/*
|
|
modification history
|
|
--------------------
|
|
01c,29jan10,h_k LP64 adaptation.
|
|
01b,24jun05,jmt Allow multiple tasks and auto unregistration
|
|
01a,25mar05,jmt written
|
|
*/
|
|
|
|
/*
|
|
DESCRIPTION
|
|
This module provides a Show routine for the an Event Reporting Framework.
|
|
|
|
INCLUDE FILES: erfLib.h erfLibP.h vxWorks.h stdio.h stdlib.h errnoLib.h
|
|
*/
|
|
|
|
/* includes */
|
|
|
|
#include <vxWorks.h>
|
|
#include <semLib.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include <drv/erf/erfLib.h>
|
|
#include <drv/erf/erfLibP.h>
|
|
#include <drv/erf/erfShow.h>
|
|
|
|
/* defines */
|
|
|
|
/* typedefs */
|
|
|
|
/* globals */
|
|
|
|
extern UCHAR erfLibInitialized; /* set to TRUE when init complete */
|
|
|
|
extern struct eventHandlerStruct ** erfHandlerDb; /* Database of handlers */
|
|
extern struct eventHandlerStruct * erfUnusedHandlerStructs; /* garbage heap */
|
|
extern UINT16 erfHandlerAllocInc; /* Number of new records to allocate */
|
|
extern UINT16 erfMaxNumCat; /* Maximum number of Categories */
|
|
extern UINT16 erfMaxNumType; /* Maximum number of Types */
|
|
extern UINT16 erfMaxNumUserCat; /* Maximum number of User Categories */
|
|
extern UINT16 erfMaxNumUserType; /* Maximum number of User Types */
|
|
extern UINT16 erfNumUserCatDef; /* Number of Defined User Categories */
|
|
extern UINT16 * erfNumUserTypeDef; /* Number of Defined User Types */
|
|
|
|
extern SEM_ID erfDbSem; /* Database Semaphore */
|
|
|
|
extern struct erfQueueStruct * erfDefaultEventQueue; /* Queue for delayed events */
|
|
extern struct erfQueueStruct ** erfCatEventQueues; /* Cat Queues for delayed proc */
|
|
extern size_t erfEventQueueSize; /* Event Queue Size */
|
|
extern int erfEventTaskPriority; /* Default Event Task Priority */
|
|
extern int erfEventTaskOptions; /* Default Event Task Options */
|
|
extern size_t erfEventTaskStackSize; /* Default Event Task Stack Size */
|
|
|
|
/* locals */
|
|
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* erfShow - Shows debug info for this library.
|
|
*
|
|
* RETURNS: Nothing
|
|
*
|
|
* ERRNO
|
|
*/
|
|
|
|
void erfShow
|
|
(
|
|
)
|
|
{
|
|
int Cat, Type;
|
|
|
|
/* display header */
|
|
printf("\nerfLib Status\n\n");
|
|
|
|
if (erfLibInitialized == FALSE)
|
|
{
|
|
printf("Library not initialized\n");
|
|
return;
|
|
}
|
|
|
|
/* display overall status */
|
|
printf("Max Number of Categories: %d\n", erfMaxNumCat);
|
|
printf("Max Number of Types: %d\n", erfMaxNumType);
|
|
printf("Max Number of User Categories: %d\n", erfMaxNumUserCat);
|
|
printf("Max Number of User Types: %d\n", erfMaxNumUserType);
|
|
printf("Number of defined User Cats: %d\n", erfNumUserCatDef);
|
|
|
|
/* display registered handlers */
|
|
printf("\nHandler Database:\n");
|
|
for (Cat=0; Cat<erfMaxNumCat; Cat++)
|
|
{
|
|
for (Type=0; Type<erfMaxNumType; Type++)
|
|
{
|
|
if (erfHandlerDb[(Cat * erfMaxNumType) + Type] != NULL)
|
|
{
|
|
struct eventHandlerStruct * pHandlerStruct =
|
|
erfHandlerDb[(Cat * erfMaxNumType) + Type];
|
|
while (pHandlerStruct != NULL)
|
|
{
|
|
/* display structure */
|
|
printf("Cat: %d, Type: %d, handler=%p, userData=%p\n",
|
|
Cat, Type, pHandlerStruct->pHandler,
|
|
pHandlerStruct->pUserData);
|
|
|
|
/* next */
|
|
pHandlerStruct = pHandlerStruct->next;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
/* display event queue information */
|
|
printf("\nDefault Event Queue:\n");
|
|
|
|
/* display event queue status */
|
|
printf("Event Queue Address: %p\n", erfDefaultEventQueue);
|
|
printf("Event Queue Size: %d\n", erfEventQueueSize);
|
|
if (erfDefaultEventQueue != NULL)
|
|
{
|
|
printf("Event Queue List Size: %d\n", erfDefaultEventQueue->queueSize);
|
|
printf("Event Queue First Element: %d\n", erfDefaultEventQueue->firstElement);
|
|
printf("Event Queue First Free Element: %d\n", erfDefaultEventQueue->firstFreeElement);
|
|
printf("Event Queue Count Semaphore: %p\n", erfDefaultEventQueue->queueCount);
|
|
printf("Event Task Id: %p\n", erfDefaultEventQueue->eventTaskId);
|
|
printf(" Task Priority: 0x%x\n", erfEventTaskPriority);
|
|
printf(" Task Options: 0x%x\n", erfEventTaskOptions);
|
|
printf(" Task Stack Size: 0x%x\n", erfEventTaskStackSize);
|
|
}
|
|
|
|
printf("\n");
|
|
|
|
/* display registered handlers */
|
|
for (Cat=0; Cat<erfMaxNumCat; Cat++)
|
|
{
|
|
if (erfCatEventQueues[Cat] != NULL)
|
|
{
|
|
printf("Event Queue: Cat=%d\n", Cat);
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* erfCategoriesAvailable - Get the maximum number of Categories.
|
|
*
|
|
* RETURNS: Number of categories
|
|
*
|
|
* ERRNO
|
|
*/
|
|
UINT16 erfMaxCategoriesGet (void)
|
|
{
|
|
return erfMaxNumCat;
|
|
}
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* erfCategoriesAvailable - Get the maximum number of Types.
|
|
*
|
|
* RETURNS: Number of types
|
|
*
|
|
* ERRNO
|
|
*/
|
|
UINT16 erfMaxTypesGet (void)
|
|
{
|
|
return erfMaxNumType;
|
|
}
|
|
|
|
/*******************************************************************************
|
|
*
|
|
* erfDefaultQueueSizeGet - Get the size of the default queue.
|
|
*
|
|
* RETURNS: Number of elements that can be stored on the default queue.
|
|
*
|
|
* ERRNO
|
|
*/
|
|
UINT16 erfDefaultQueueSizeGet (void)
|
|
{
|
|
/* adjust the size. The number of elements stored = queueSize-1 */
|
|
return ((UINT16)((erfDefaultEventQueue == NULL) ? 0 : (erfDefaultEventQueue->queueSize-1)));
|
|
}
|
|
|