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

📄 dm_dbghistory.c

📁 优龙YLP270开发板 光盘自带的BIOS和实验例程源码 强烈推荐
💻 C
📖 第 1 页 / 共 2 页
字号:
/******************************************************************************
**
**  COPYRIGHT (C) 2000, 2001 Intel Corporation.
**
**  This software as well as the software described in it is furnished under 
**  license and may only be used or copied in accordance with the terms of the 
**  license. The information in this file is furnished for informational use 
**  only, is subject to change without notice, and should not be construed as 
**  a commitment by Intel Corporation. Intel Corporation assumes no 
**  responsibility or liability for any errors or inaccuracies that may appear 
**  in this document or any software that may be provided in association with 
**  this document. 
**  Except as permitted by such license, no part of this document may be 
**  reproduced, stored in a retrieval system, or transmitted in any form or by 
**  any means without the express written consent of Intel Corporation. 
**
**  FILENAME:       DM_DbgHistory.c
**
**  PURPOSE:        This file contains the procedures for capturing and dumping
**                  the different events in the debug history buffer. 
**
**  LAST MODIFIED:  $Modtime: 7/17/03 1:01p $
******************************************************************************/

/*
*******************************************************************************
*   HEADER FILES
*******************************************************************************
*/

#include <stdio.h>
#include <string.h>
#include <stdarg.h>
#include "systypes.h"
#include "XsOst.h"
#include "timedelays.h"
#include "DM_DbgHistory.h"

static DbgItemT dbgBuff[DM_CONTROL_DEBUG_TOTAL];
static DbgItemT * dbgBuffP = dbgBuff;
static INT currDbgCtrl;

// A table of the debug history switches
static DM_ControlDbgHistoryItemT DM_ControlDbgHistoryTable[DM_DBG_NUM_ASSIGNED+1] =
{
    "DM_DBG_ARP_0",         0,  //   0
    "DM_DBG_DHCP_0",        0,  //   1
    "DM_DBG_ETHERNET_0",    0,  //   2
    "DM_DBG_ICMP_0",        0,  //   3
    "DM_DBG_INET_0",        0,  //   4
    "DM_DBG_IP_0",          0,  //   5
    "DM_DBG_TFTP_0",        0,  //   6
    "DM_DBG_UDP_0",         0,  //   7
    "DM_DBG_LAN91C111_0",    0,  //   8
    "DM_DBG_DMA_0",         0,  //   9
    "DM_DBG_XS_AC97_CTRL",  0,  //   10
    "DM_DBG_UART_0",        0,  //   11
    "DM_DBG_FIR_0",         0,  //   12   
    "DM_DBG_SSP",           0,  //   13
    "DM_DBG_AC97_CODEC",    0,  //   14
    "DM_DBG_XS_INT_CTRL",   0,  //   15
    "DM_DBG_FLASH_0",       0,  //   16
    "DM_DBG_FLASH_1",       0,  //   17
    "DM_DBG_FLASH_LOADER_0",0,  //   18
    "DM_DBG_MMC",           0,  //   19
    "DM_DBG_SA1111_GPIO_0", 0,  //   20
    "DM_DBG_XS_PCMCIA_0",   0,  //   21
    "DM_DBG_SK_PCMCIA_0",   0,  //   22
    "DM_DBG_USB_CLIENT",    0,  //   23
    "DM_DBG_USB_HOST_0",    0,  //   24
    "DM_DBG_USB_HOST_1",    0,  //   25
    "DM_DBG_SCREEN",        0,  //   26
    "DM_DBG_EXPANSION_0",   0,  //   27
    "DM_DBG_MEMEDIT_0",     0,  //   28
    NULL,                   0,
}; 

/*
*******************************************************************************
*
* FUNCTION:         DM_DbgHistoryGetTimeStamp
*
* DESCRIPTION:      This function gets the number of ticks from the OST's OSCR register
*
* INPUT PARAMETERS: none.
*
* RETURNS:          UINT time - the number of ticks from the OST's OSCR register
*
* GLOBAL EFFECTS:
*
* ASSUMPTIONS:
*
* CALLS:
*
* CALLED BY:
*
* PROTOTYPE:        static UINT DM_DbgHistoryGetTimeStamp (VOID);
*
*******************************************************************************
*/

static UINT DM_DbgHistoryGetTimeStamp (VOID)
{
    OSTContextT * ctxP = &Ost;
    volatile OSTRegsT *OstControlRegsP = ctxP->regsP;
    UINT time;

    time = OstControlRegsP->OSCR;
    return time;
}

/*
*******************************************************************************
*
* FUNCTION:         DM_DbgHistoryCheckEnabled
*
* DESCRIPTION:      This function checks if the specific debug switch is enabled 
*
* INPUT PARAMETERS: DM_ControlDbgHistoryT dbgCtrl - the name of the debug switch
*                   from the dbg. history switches table.
*
* RETURNS:          INT - status of the switch from the dbg. history switches table. 
*
* GLOBAL EFFECTS:
*
* ASSUMPTIONS:
*
* CALLS:
*
* CALLED BY:
*
* PROTOTYPE:        static INT DM_DbgHistoryCheckEnabled (DM_ControlDbgHistoryT dbgCtrl);
*
*******************************************************************************
*/
static INT DM_DbgHistoryCheckEnabled (DM_ControlDbgHistoryT dbgCtrl)
{
	return DM_ControlDbgHistoryTable[dbgCtrl].dbgEnable;
}

/*
*******************************************************************************
*
* FUNCTION:         DM_DbgHistoryDisplayCurrControl
*
* DESCRIPTION:      This function displays the status of the currenly displayed
*                   debug switch: enabled or disabled.
*
* INPUT PARAMETERS: two dummy parameters.
*
* RETURNS:          VOID 
*
* GLOBAL EFFECTS:
*
* ASSUMPTIONS:
*
* CALLS:
*
* CALLED BY:
*
* PROTOTYPE:        VOID DM_DbgHistoryDisplayCurrControl (PVOID dummy1, PCHAR dummy2);
*
*******************************************************************************
*/

VOID DM_DbgHistoryDisplayCurrControl (PVOID dummy1, PCHAR dummy2)
{
    PCHAR controlEnabled;

    if (DM_ControlDbgHistoryTable[currDbgCtrl].dbgEnable)
    {
        controlEnabled = "Enabled";
    }
    else
    {
        controlEnabled = "Disabled";
    }

    printf ("Curr Dbg History Switch = %s : %s\r\n",
               DM_ControlDbgHistoryTable[currDbgCtrl].dbgCntrlName, 
               controlEnabled);
    DM_WaitMs (300);
}

/*
*******************************************************************************
*
* FUNCTION:         DM_DbgHistoryEnableControl
*
* DESCRIPTION:      This function enables/disables the debug history switch for 
*                   the specific device from the dbg. history switches table.
*                   This will enable/disable DM_DbgCaptureHistory function start/stop
*                   logging the data into the debug history buffer.
*
* INPUT PARAMETERS: DM_ControlDbgHistoryT dbgCtrl - the name of the debug switch
*                                                   from the dbg. history switches table.
*                   BOOL enable - TRUE enables data logging,
*                                 FALSE disables data logging.
*
* RETURNS:          VOID 
*
* GLOBAL EFFECTS:
*
* ASSUMPTIONS:      The function DM_DbgCaptureHistory was added to the procedure(s) 
*                   where the user wants to get the debugging information from.
*
* CALLS:
*
* CALLED BY:
*
* PROTOTYPE:        VOID DM_DbgHistoryEnableControl (DM_ControlDbgHistoryT dbgCtrl, BOOL enable);
*
*******************************************************************************
*/
VOID DM_DbgHistoryEnableControl (DM_ControlDbgHistoryT dbgCtrl, BOOL enable)
{
    DM_ControlDbgHistoryTable[dbgCtrl].dbgEnable = enable;
}

/*
*******************************************************************************
*
* FUNCTION:         DM_DbgHistoryControlTogle
*
* DESCRIPTION:      This function togles the status of the currenly displayed
*                   debug switch: enabled or disabled.
*
* INPUT PARAMETERS: two dummy parameters.
*
* RETURNS:          VOID 
*
* GLOBAL EFFECTS:
*
* ASSUMPTIONS:
*
* CALLS:
*
* CALLED BY:
*
* PROTOTYPE:        VOID DM_DbgHistoryControlTogle (PVOID dummy1, PCHAR dummy2);
*
*******************************************************************************
*/
VOID DM_DbgHistoryControlTogle (PVOID dummy1, PCHAR dummy2)
{
    DM_ControlDbgHistoryTable[currDbgCtrl].dbgEnable ^= 1;
    DM_DbgHistoryDisplayCurrControl (NULL,NULL);
}


/*
*******************************************************************************
*
* FUNCTION:         DM_DbgHistoryIncrementControl
*
* DESCRIPTION:      This function selects the next debug switch in the dbg. history 
*                   switches table. The selected debug switch will be displayed on 
*                   the screen.

⌨️ 快捷键说明

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