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

📄 mplcaps.c

📁 NATIONAL公司DP83816芯片Linux下驱动
💻 C
字号:

//******************************************************************************
//
//  MPLCAPS.C
//
//  Copyright (c) 2004 National Semiconductor Corporation.
//  All Rights Reserved
//
//  MPL Device and Software Capability Reporting.
//
//  This file contains the API implementations for
//     o Returning the capabilites of MPL
//
//******************************************************************************

#include <mplinternal.h>

static MPL_CAPS deviceCaps[] = 
{
   {
#define MPL_CAPS_DP83815_INDEX 0
// Below defines MacPhyter-I caps

      { // MPL_CAPS_TRANSMIT
         1,    // priorityQCnt
         2048, // fifoSize - Bytes
         512,  // maxDma - Bytes
          32,  // minDrain - Bytes
          32,  // minFill - Bytes
         2046, // maxPacketSize - Bytes
         0x0   // txFlags - None defined yet
      },

      { // MPL_CAPS_RECEIVE
         1,    // priorityQCnt
         2048, // fifoSize - Bytes
         512,  // maxDma - Bytes
           8,  // minDrain - Bytes
         2046, // maxPacketSize - Bytes
         0x0   // rxFlags - None defined yet     
      },

      { // MPL_CAPS_INTERRUPT
         0x0,   // maxTimerHold - usec 
         0x0,   // maxTransmitHold - Pkt count
         0x0,   // maxReceiveHold - Pkt count
         0x0    // intFlags - None defined yet 
      },

      { // MPL_CAPS_LINK
         MPL_LINK_PAUSE_RECEIVE // linkFlags :  Can receive pause requests, but not transmit
      },

      { // MPL_CAPS_WOL
         0x4, // maxPatterns 
         128  // maxPatternSize - Bytes
      },

      { // MPL_CAPS_TASK
        { // Statistics Task
           NS_FALSE, // supported
           0x0       // statFlags - None defined yet      
        },

        { // Checksum Task
           NS_FALSE, // supported
           0x0       // checksumFlags  - None defined yet     
        },

        { // VLAN Task
           NS_FALSE, // supported
           0x0,      // maxFilterEntries
           0x0       // vlanFlags - None defined yet     
        },

        { // Receive Filter Task
           NS_TRUE,  // supported
           0xFFFF,   // maxFilterEntries- None defined yet
           MPL_TASK_FILTER_MCAST | MPL_TASK_FILTER_UCAST // filterFlags
        }
      }
   },

   {
#define MPL_CAPS_DP83816_INDEX 1
// Below defines MacPhyter-II caps

      { // MPL_CAPS_TRANSMIT
         1,    // priorityQCnt
         2048, // fifoSize - Bytes
         512,  // maxDma - Bytes
          32,  // minDrain - Bytes
          32,  // minFill - Bytes
         2046, // maxPacketSize - Bytes
         0x0   // txFlags
      },

      { // MPL_CAPS_RECEIVE
         1,    // priorityQCnt
         2048, // fifoSize - Bytes
         512,  // maxDma - Bytes
          8,   // minDrain - Bytes
         2046, // maxPacketSize - Bytes
         0x0   // rxFlags
      },

      { // MPL_CAPS_INTERRUPT
         25500, // maxTimerHold - usec 
         0x0,   // maxTransmitHold - Pkt count
         0x0,   // maxReceiveHold - Pkt count
         0x0    // intFlags
      },

      { // MPL_CAPS_LINK
         MPL_LINK_PAUSE_RECEIVE // linkFlags : Can receive pause requests, but not transmit
      },

      { // MPL_CAPS_WOL
         0x4, // maxPatterns
         128  // maxPatternSize - bytes
      },

      { // MPL_CAPS_TASK
        { // Statistics Task
           NS_FALSE, // supported
           0x0       // statFlags
        },

        { // Checksum Task
           NS_FALSE, // supported
           0x0       // checksumFlags
        },

        { // VLAN Task
           NS_FALSE, // supported
           0x0,      // maxFilterEntries
           0x0       // vlanFlags
        },

        { // Receive Filter Task
           NS_TRUE,  // supported
           0xFFFF,   // maxFilterEntries
           MPL_TASK_FILTER_MCAST | MPL_TASK_FILTER_UCAST // filterFlags
        }
      }
   },

   {
#define MPL_CAPS_DP83818_INDEX 2
// Below defines MacPhyter-III caps

      { // MPL_CAPS_TRANSMIT
         4,    // priorityQCnt
         2048, // fifoSize - Bytes
         2048, // maxDma - Bytes
          0,   // minDrain - Bytes
          32,  // minFill - Bytes
         2046, // maxPacketSize - Bytes
         0x0   // txFlags
      },

      { // MPL_CAPS_RECEIVE
         1,    // priorityQCnt
         4096, // fifoSize - Bytes
         2048, // maxDma - Bytes
          0,   // minDrain - Bytes
         2046, // maxPacketSize - Bytes
         0x0   // rxFlags
      },

      { // MPL_CAPS_INTERRUPT
         25500, // maxTimerHold - in usec
         0x1F,  // maxTransmitHold - Pkt count
         0x1F,  // maxReceiveHold - Pkt count
         0x0    // intFlags
      },

      { // MPL_CAPS_LINK
         MPL_LINK_PAUSE_TRANSMIT | MPL_LINK_PAUSE_RECEIVE // linkFlags
      },

      { // MPL_CAPS_WOL
         0x8, // maxPatterns
         128  // maxPatternSize - bytes
      },

      { // MPL_CAPS_TASK
        { // Statistics Task
           NS_FALSE, // supported
           0x0       // statFlag;      
        },

        { // Checksum Task
           NS_FALSE, // supported
           0x0       // checksumFlags      
        },

        { // VLAN Task
           NS_TRUE, // supported
           4096,     // maxVlanEntries in filter table
           MPL_TASK_VLAN_DETECT_TAGS | MPL_TASK_VLAN_REMOVE_TAGS |
            MPL_TASK_VLAN_DISCARD_TAGGED | MPL_TASK_VLAN_DISCARD_UNTAGGED |
             MPL_TASK_VLAN_PERPACKET | MPL_TASK_VLAN_FILTER // vlanFlags      
        },

        { // Receive Filter Task
           NS_TRUE,  // supported
           0xFFFF,   // maxFilterEntries
           MPL_TASK_FILTER_MCAST | MPL_TASK_FILTER_UCAST // filterFlags
        }
      }
   } 
};

//*****************************************************************************
//   MplGetCaps
//      Returns the capabilities of the device and the MPL implementation. 
//
//   Parameters
//      pMplHandle
//         MPL device handle returned following a call to MplInitialize
//      pMplCaps
//         Pointer to a caller allocated MPL_CAPS structure in which the 
//          capabilities of the device and MPL is returned
//
//   Return Value
//      NS_STATUS_SUCCESS
//         The capabilities were successfully returned
//      NS_STATUS_ERROR
//         The device Id was unknown
//
//*****************************************************************************
MPL_STATUS
   MplGetCaps (
      IN NS_VOID      *pMplHandle,
      OUT MPL_CAPS    *pMplCaps
      )
{
   MPL_CONTEXT *pMplCtx = (MPL_CONTEXT *)pMplHandle;
   MPL_STATUS status = NS_STATUS_SUCCESS;

   switch(pMplCtx->devId)
   {
      case MPL_DEVICE_ID_DP83815:
                            *pMplCaps = deviceCaps[MPL_CAPS_DP83815_INDEX];
                            break;
      case MPL_DEVICE_ID_DP83816:
                            *pMplCaps = deviceCaps[MPL_CAPS_DP83816_INDEX];
                            break;
      case MPL_DEVICE_ID_DP83818:
                            *pMplCaps = deviceCaps[MPL_CAPS_DP83818_INDEX];
                            break;
      default             : status = NS_STATUS_FAILURE;
   }

   return status;
}

⌨️ 快捷键说明

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