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

📄 deb_res.cpp

📁 RTL8139 网卡驱动源码 for WinCE.net CEPC
💻 CPP
📖 第 1 页 / 共 3 页
字号:
#define NUM_FLAGS               (sizeof(Flags) /sizeof(Flags[0]))


//****************************************************************************
//                      --- RetResourceOptionMsg ---
//
// Purpose: Return resource Option name
//   Input: UCHAR  uOption - Option code
//  Output: LPCSTR         - Pointer to the option name
// Written: by Alexei A. Piatetsky 7/19/96
//****************************************************************************
LPCSTR RetResourceOptionMsg(UCHAR uOption)
{
    for (int i = 0; Options[i].szName && (Options[i].uType != uOption); i++) ;

    return Options[i].szName ? Options[i].szName : szIO_RESOURCE_UNKNOWN;
}

//****************************************************************************
//                       --- RetResourceTypeMsg ---
//
// Purpose: Return resource tyspe name
//   Input: CM_RESOURCE_TYPE Type - Resource type code
//  Output: LPCSTR                - Pointer to the resource type name
// Written: by Alexei A. Piatetsky 7/19/96
//****************************************************************************
LPCSTR RetResourceTypeMsg(CM_RESOURCE_TYPE Type)
{
    for (int i = 0; Types[i].szName && (Types[i].uType != Type); i++) ;

    return Types[i].szName ? Types[i].szName : szCmResourceTypeUnknown;
}

//****************************************************************************
//                       --- RetResourceShareMsg ---
//
// Purpose: Return resource share disposition name
//   Input: CM_SHARE_DISPOSITION Share - share disposition code
//  Output: LPCSTR                     - pointer to the share disposition name
// Written: by Alexei A. Piatetsky 7/19/96
//****************************************************************************
LPCSTR RetResourceShareMsg(CM_SHARE_DISPOSITION Share)
{
    for (int i = 0; Shares[i].szName && (Shares[i].Type != Share); i++) ;

    return Shares[i].szName ? Shares[i].szName : szCmResourceShareUnknown;
}

//****************************************************************************
//                       --- RetResourceFlagMsg ---
//
// Purpose: Return resource flags description
//   Input: CM_RESOURCE_TYPE Type  - Type of resource
//          USHORT           Flags - Resource flags
//  Output: LPCSTR                 - Pointer to the flags description string
// Written: by Alexei A. Piatetsky 7/19/96
//****************************************************************************
LPCSTR RetResourceFlagMsg(CM_RESOURCE_TYPE Type, USHORT uFlags)
{
    for (int i = 0; Flags[i].szName; i++)
    {
        if (Flags[i].Type == Type && Flags[i].uFlags == uFlags)
            break;
    }

    if (Flags[i].szName)
        return Flags[i].szName;

    static char szBuffer[256];
    *szBuffer = '\0';

    for (i = 0; Flags[i].szName; i++)
    {
        if (Flags[i].Type == Type && uFlags & Flags[i].uFlags)
        {
            uFlags &= ~Flags[i].uFlags;

            if (*szBuffer)
                strcat(szBuffer, " | ");

            strcat(szBuffer, Flags[i].szName);
        }                                   // if (Flags[i].Type == Type && ...
    }                                       // for (i = 0; Flags[i].szName; ...

    if (uFlags)
    {
        if (*szBuffer)
            strcat(szBuffer, " | ");

        sprintf(szBuffer + strlen(szBuffer), "%Xh", uFlags);
    }                                       // if (uFlags)

    return *szBuffer ? szBuffer : szCM_RESOURCE_FLAGS_UNKNOWN;
}

//****************************************************************************
//                         --- RetInterfaceMsg ---
//
// Purpose: Return pointer to the Interface description
//   Input: INTERFACE_TYPE IfaceType - Interface Type
//  Output: LPCSTR                   - Pointer to the error message
// Written: by Alexis A.Piatetsky 20.09.93
//****************************************************************************
LPCSTR RetInterfaceMsg(INTERFACE_TYPE IfaceType)
{
    for (int i = 0; Interfaces[i].szName && (Interfaces[i].IfaceType != IfaceType); i++);

    return Interfaces[i].szName ? Interfaces[i].szName : szUnknownInterface;
}

//****************************************************************************
//                     --- OutIoResourceDescriptor ---
//
// Purpose: Print resource descriptor
//   Input: PIO_RESOURCE_DESCRIPTOR pResourceDescriptor - Pointer to descriptor
//          LPCSTR                  szDescription       - Decription
//  Output: none
// Written: by Alexei A. Piatetsky 7/19/96
//****************************************************************************
void OutIoResourceDescriptor(PIO_RESOURCE_DESCRIPTOR pResourceDescriptor,
                             LPCSTR                  szDescription)
{
//--------------------------- Common parameters ------------------------------

    STRACE_PNPDRV("  IO Resource Descriptor %s:\n", szDescription);
    STRACE_PNPDRV("               Option: %s\n",
                  RetResourceOptionMsg(pResourceDescriptor->Option));
    STRACE_PNPDRV("                 Type: %s (%Xh)\n",
                  RetResourceTypeMsg((CM_RESOURCE_TYPE)pResourceDescriptor->Type),
                                                       pResourceDescriptor->Type);
    STRACE_PNPDRV("    Share disposition: %s\n",
                  RetResourceShareMsg((CM_SHARE_DISPOSITION)
                                      pResourceDescriptor->ShareDisposition));
    STRACE_PNPDRV("                Flags: %s (%Xh)\n",
                  RetResourceFlagMsg((CM_RESOURCE_TYPE)pResourceDescriptor->Type,
                                      pResourceDescriptor->Flags),
                  pResourceDescriptor->Flags);

//--------------------------- I/O Port resource ------------------------------

    if (pResourceDescriptor->Type == CmResourceTypePort)
    {
        STRACE_PNPDRV("               Length: %08lX\n"
                      "            Alignment: %08lX\n"
                      "      Minimum Address: %08lX\n"
                      "      Maximum Address: %08lX\n",
                      pResourceDescriptor->u.Port.Length,
                      pResourceDescriptor->u.Port.Alignment,
                      pResourceDescriptor->u.Port.MinimumAddress.LowPart,
                      pResourceDescriptor->u.Port.MaximumAddress.LowPart);
    }                                       // if (pResourceDescriptor->Type ...

//---------------------------- Memory resource -------------------------------

    else if (pResourceDescriptor->Type == CmResourceTypeMemory)
    {
        STRACE_PNPDRV("               Length: %08lX\n"
                      "            Alignment: %08lX\n"
                      "      Minimum Address: %08lX\n"
                      "      Maximum Address: %08lX\n",
                      pResourceDescriptor->u.Memory.Length,
                      pResourceDescriptor->u.Memory.Alignment,
                      pResourceDescriptor->u.Memory.MinimumAddress.LowPart,
                      pResourceDescriptor->u.Memory.MaximumAddress.LowPart);
    }                                       // if (pResourceDescriptor->...

//-------------------------- Interrupt resource ------------------------------

    else if (pResourceDescriptor->Type == CmResourceTypeInterrupt)
    {
        STRACE_PNPDRV("       Minimum Vector: %08lX\n"
                      "       Maximum Vector: %08lX\n",
                      pResourceDescriptor->u.Interrupt.MinimumVector,
                      pResourceDescriptor->u.Interrupt.MaximumVector);

    }                                       // if (pResourceDescriptor->...

//----------------------------- DMA resource ---------------------------------

    else if (pResourceDescriptor->Type == CmResourceTypeDma)
    {
        STRACE_PNPDRV("      Minimum Channel: %08lX\n"
                      "      Maximum Channel: %08lX\n",
                      pResourceDescriptor->u.Dma.MinimumChannel,
                      pResourceDescriptor->u.Dma.MaximumChannel);
    }                                       // if (pResourceDescriptor->...

//---------------------------- Device Private --------------------------------

    else if (pResourceDescriptor->Type == CmResourceTypeDevicePrivate ||
             pResourceDescriptor->Type == CmResourceTypePcCardConfig  ||
             pResourceDescriptor->Type == CmResourceTypeMfCardConfig)
    {
        STRACE_PNPDRV("              Data[0]: %08lX\n"
                      "              Data[1]: %08lX\n"
                      "              Data[2]: %08lX\n",
                      pResourceDescriptor->u.DevicePrivate.Data[0],
                      pResourceDescriptor->u.DevicePrivate.Data[1],
                      pResourceDescriptor->u.DevicePrivate.Data[2]);
    }                                       // if (pResourceDescriptor->...

//------------------------------ Bus Number ----------------------------------

    else if (pResourceDescriptor->Type == CmResourceTypeBusNumber)
    {
        STRACE_PNPDRV("               Length: %08lX\n"
                      "         MinBusNumber: %08lX\n"
                      "         MaxBusNumber: %08lX\n",
                      pResourceDescriptor->u.BusNumber.Length,
                      pResourceDescriptor->u.BusNumber.MinBusNumber,
                      pResourceDescriptor->u.BusNumber.MaxBusNumber);
    }

//------------------------------ Config data ---------------------------------

    else if (pResourceDescriptor->Type == CmResourceTypeConfigData)
    {
        STRACE_PNPDRV("             Priority: %08lX\n",
                      pResourceDescriptor->u.ConfigData.Priority);
    }
}

//****************************************************************************
//                        --- OutIoResourceList ---
//
// Purpose: Print an IO_RESOURCE_LIST to the serial monitor
//   Input: PIO_RESOURCE_LIST pResourceList - Pointer to the IO_RESOURCE_LIST
//          LPCSTR            szDescription - List description
//  Output: none
// Written: by Alexei A. Piatetsky 7/19/96
//****************************************************************************
void OutIoResourceList(PIO_RESOURCE_LIST pResourceList, LPCSTR szDescription)
{
    STRACE_PNPDRV(" IO Resource List %s:\n"
                  "              Version: %d\n"
                  "             Revision: %d\n"
                  "                 Size: %d\n",
                  szDescription, pResourceList->Version,

⌨️ 快捷键说明

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