tw_cli_ints.c
资源名称:cli.rar [点击查看]
上传用户:hujq123
上传日期:2016-04-10
资源大小:153k
文件大小:5k
源码类别:
Telnet服务器
开发平台:
Unix_Linux
- /*
- * Copyright (C) 2002 Koninklijke Philips Electronics N.V.,
- * All Rights Reserved.
- *
- * This source code and any compilation or derivative thereof is the
- * proprietary information of Koninklijke Philips Electronics N.V.
- * and is confidential in nature.
- * Under no circumstances is this software to be exposed to or placed
- * under an Open Source License of any type without the expressed
- * written permission of Koninklijke Philips Electronics N.V.
- *
- *###########################################################
- */
- /*!
- * file tw_cli_ints.c
- *
- * brief -
- *
- */
- /*-----------------------------------------------------------*
- *
- * %version: 3 %
- * instance: DS_6
- * %date_created: Fri Feb 21 08:04:30 2003 %
- *
- *###########################################################
- */
- /*****************************************************************************
- *
- * tw_cli_ints.c - Command line interface commands for interrupt management
- *
- * Description:
- *
- *
- *
- *****************************************************************************/
- #include <stdio.h>
- #include <string.h>
- #include <tw_cli.h>
- #include <pci_intr.h>
- /*****************************************************************************
- *
- * Defines, constants, structures.
- *
- *****************************************************************************/
- /*****************************************************************************
- *
- * Local prototypes
- *
- *****************************************************************************/
- int CliCoProc_IntStats(Cli_cmdSession_t *pSess, char *CmdStr, int Ptr);
- int CliCoVoProc_IntLogThreshold(Cli_cmdSession_t *pSess, char *CmdStr, int Ptr);
- int CliCoProc_IntOffenders(Cli_cmdSession_t *pSess, char *CmdStr, int Ptr);
- /*****************************************************************************
- *
- * Globals
- *
- *****************************************************************************/
- /*
- ** 2nd level CLI Command Option - vr "stats"
- */
- Cli_CmdStruct_t CliCo_IntStats =
- {
- "stats",
- ALL_ACCESS_MODE | ALL_PRODUCT_TYPE,
- NULL,
- "Display stats on interrupt activity",
- NULL,
- CliCoProc_IntStats,
- NULL
- };
- /*
- ** 2nd level CLI Command Option - vr "log_threshold"
- */
- Cli_CmdStruct_t CliCo_IntLogThreshold =
- {
- "log_threshold",
- ALL_ACCESS_MODE | ALL_PRODUCT_TYPE,
- NULL,
- "Set interval for int disable warning THRESHOLD",
- NULL,
- NULL,
- CliCoVoProc_IntLogThreshold
- };
- /*
- ** 2nd level CLI Command Option - vr "offenders"
- */
- Cli_CmdStruct_t CliCo_IntOffenders =
- {
- "offenders",
- ALL_ACCESS_MODE | ALL_PRODUCT_TYPE,
- NULL,
- "Clears interrupt statistics",
- NULL,
- CliCoProc_IntOffenders,
- NULL
- };
- /*
- ** 1st level CLI Command Option - "int"
- */
- Cli_CmdStruct_t *CliRcoOptionList_Int[] =
- {
- &CliCo_IntStats,
- &CliCo_IntLogThreshold,
- &CliCo_IntOffenders,
- NULL
- };
- Cli_CmdStruct_t CliRco_Ints =
- {
- "int",
- ALL_ACCESS_MODE | ALL_PRODUCT_TYPE,
- CliRcoOptionList_Int,
- "Interrupt management commands",
- NULL,
- NULL,
- NULL
- };
- /*****************************************************************************
- *
- * CliCoProc_IntMax - Display maximum interrupt disable interval
- *
- * Globals:
- *
- * Returns:
- * int - 0 on success, -1 on failure.
- *
- * Description:
- *
- *
- * History:
- * 12/19/99 MA Original version
- *
- *****************************************************************************/
- int CliCoProc_IntStats(Cli_cmdSession_t *pSess, char *CmdStr, int Ptr)
- {
- int iHandler;
- if (Cli_Printf(pSess, " Max cycles with interrupts off: %un",
- TwInts_MaxDisableInterval) < 0)
- {
- return -1;
- }
- if (Cli_Printf(pSess, " (task %s isr 0x%02x DisablePC %08x EnablePC %08x)n",
- TwInts_MaxDisableName,
- TwInts_MaxDisableMask,
- TwInts_MaxDisablePC,
- TwInts_MaxEnablePC) < 0)
- {
- return -1;
- }
- if (Cli_Printf(pSess,
- " Isr id Max Min Avg Raten") < 0)
- {
- return -1;
- }
- if (Cli_Printf(pSess,
- " -------------------------------------------------------------n") < 0)
- {
- return -1;
- }
- return 0;
- }
- /*****************************************************************************
- *
- * CliCoVoProc_IntLogThreshold - Set logging threshold for interrupt disable interval
- *
- * Returns:
- * int - 0 on success, -1 on failure.
- *
- * Description:
- *
- *
- * History:
- * 12/7/99 MA Original version
- *
- *****************************************************************************/
- int CliCoVoProc_IntLogThreshold(Cli_cmdSession_t *pSess, char *CmdStr, int Ptr)
- {
- int NewThreshold;
- if (sscanf(CmdStr + Ptr, "%lu", &NewThreshold) != 1)
- {
- return Cli_Printf(pSess, badParamStr);
- }
- TwInts_MaxDisableIntervalThreshold = NewThreshold;
- return 0;
- }
- /*+***************************************************************************
- *
- * CliCoProc_Offenders - Print top interrupt disable offenders
- *
- * Globals:
- *
- * Returns:
- * int - 0 on success, -1 on failure.
- *
- * Description:
- *
- *
- * History:
- * 2/23/00 jvs Original version
- *
- **-**************************************************************************/
- int CliCoProc_IntOffenders(Cli_cmdSession_t *pSess, char *CmdStr, int Ptr)
- {
- TwInts_PrintOffenders((TwInts_Printf_t) Cli_Printf, (void *) pSess) ;
- return 0;
- }