initedbg.c

来自「WinCE 3.0 BSP, 包含Inter SA1110, Intel_815」· C语言 代码 · 共 74 行

C
74
字号
/*++
THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
PARTICULAR PURPOSE.
Copyright (c) 1995-2000 Microsoft Corporation.  All rights reserved.

Module Name:
        traninit.c
Abstract:
        initialize debug transport for EDBG
Functions:


Notes:

--*/

#include <windows.h>
#include <nkintr.h>
#include <halether.h>
#include <eglobal.h>

void OEMWriteDebugString(unsigned short *str);


void InitDebugEther(void)
{

    // Initialize EDBG - our OEMEthInit function will get called in return.
    //
    if (EdbgInit()) 
    {
        OEMWriteDebugString(TEXT("INFO: Debug ethernet card initialized\r\n")); 

        // Attempt to configure debug services over ethernet.  SetKernelCommDev 
        // will block (calling EdbgRegisterDfltClient) until the desktop 
        // application is started, and will set up the necessary kernel hooks 
        // to route data to the peer.

        /////////////////////////////////////////////////////////////////////
        // Redirect Serial Debug Output to Ether.
        //                                           
        OEMWriteDebugString (TEXT("Switching to ethernet DEBUG msg...\r\n"));
        if ((pDriverGlobals->etherFlags & EDBG_FL_DBGMSG) && 
            SetKernelCommDev(KERNEL_SVC_DBGMSG,KERNEL_COMM_ETHER)) 
        {
            EdbgOutputDebugString("Switched to ethernet for debug messages, host: %s, port: %d\r\n", inet_ntoa(pDriverGlobals->DbgHostAddr.dwIP), ntohs(pDriverGlobals->DbgHostAddr.wPort));                  
        }       

        /////////////////////////////////////////////////////////////////////
        // Redirect PPSh to Ether.
        //                            
        OEMWriteDebugString (TEXT("Switching to ethernet PPSH...\r\n"));    
        if ((pDriverGlobals->etherFlags & EDBG_FL_PPSH) &&
            SetKernelCommDev(KERNEL_SVC_PPSH,KERNEL_COMM_ETHER)) 
        {
            EdbgOutputDebugString("Switched to ethernet for PPSH, host: %s, port: %d\r\n", inet_ntoa(pDriverGlobals->DbgHostAddr.dwIP), ntohs(pDriverGlobals->DbgHostAddr.wPort));                  
        }         

        /////////////////////////////////////////////////////////////////////
        // Redirect KDBG to Ether.
        //        
        OEMWriteDebugString (TEXT("Switch to ethernet KDBG...\r\n"));
        if ((pDriverGlobals->etherFlags & EDBG_FL_KDBG) &&
            SetKernelCommDev(KERNEL_SVC_KDBG,KERNEL_COMM_ETHER)) 
        {
            EdbgOutputDebugString("Switched to ethernet for KDBG, host: %s, port: %d\r\n", inet_ntoa(pDriverGlobals->KdbgHostAddr.dwIP), ntohs(pDriverGlobals->KdbgHostAddr.wPort));
        }
    } 
    else
        OEMWriteDebugString(TEXT("ERROR: Debug ethernet card not present or failed init\r\n"));        
}

⌨️ 快捷键说明

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