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

📄 mplclient.h

📁 NATIONAL公司DP83816芯片Linux下驱动
💻 H
📖 第 1 页 / 共 4 页
字号:
//*****************************************************************************
//   MplPhyMdioWrite
//      Write Phy register
//
//   Parameters
//      pMplHandle
//         MPL device handle
//      phyDevAddr
//         Device addr of the Phy
//      regIndex
//         Register to write(in terms of MII offset e.g. BMCR = 0x0, BMSR = 0x1)
//      regData
//         Data to write
//
//   Return Value
//     None
//
//*****************************************************************************
NS_VOID
   MplPhyMdioWrite(
      IN NS_VOID   *pMplHandle,
      IN NS_UINT    phyDevAddr,
      IN NS_UINT    regIndex,
      IN NS_UINT32  regData
      );

//+++++ Power Management and WoL APIs
//###################################

//*****************************************************************************
//   MplPowerSetState
//      Set a new power state on the device
//
//   Parameters
//      pMplHandle
//         MPL device handle returned following a call to MplInitialize
//      newState
//         New power state that needs to be set on the device
//      pmeEnable
//         When set to NS_TRUE, MPL enables PME on the device
//         Some OSs do this automatically, some do not
//
//   Return Value
//      NS_STATUS_SUCCESS
//         The new state was successfully set
//      NS_STATUS_FAILURE
//         The device could not be set to the new state
//
//*****************************************************************************
MPL_STATUS
   MplPowerSetState(
      IN NS_VOID         *pMplHandle,
      IN MPL_POWER_STATE  newState,
      IN NS_BOOLEAN       pmeEnable
      );

//*****************************************************************************
//   MplWolCfg
//     Configure the WOL operation on the device
//
//   Parameters
//      pMplHandle
//         MPL device handle returned following a call to MplInitialize
//      wakeEnable
//         Flag to enable (set to NS_TRUE) or disable (set to NS_FALSE) Wol
//      wakeType
//         When WOL is enabled, represents a bit-map of wake-up events that
//         needs to be enabled. It is a logical OR of,
//          MPL_WOL_MAGIC - Enable wake on Magic Pattern.
//          MPL_WOL_PATTERN - Enable wake on pattern match (Patterns needs
//                            to be separately defined).
//          MPL_WOL_BROADCAST - Enable wake on any broadcast packet.
//          MPL_WOL_MULTICAST - Enable wake on multicast packet.
//          MPL_WOL_DIRECTED - Enable wake on directed (unicast) packet to 
//                             the device's address.
//          MPL_WOL_LINK - Enable wake on link status change.
//          MPL_WOL_ARP - Enable wake on any ARP packet.
//
//   Return Value
//      NS_STATUS_SUCCESS
//         The WOL events were successfully enabled or disabled (depending
//         on wakeEnable).
//      NS_STATUS_INVALID_PARM
//         The wake event type is not supported on the device.
//
//*****************************************************************************
MPL_STATUS
   MplWolCfg(
      IN NS_VOID     *pMplHandle,
      IN NS_BOOLEAN   wakeEnable,
      IN NS_UINT      wakeType
      );

// Wol Type Flag bits
#define MPL_WOL_MAGIC      0x00000001
#define MPL_WOL_PATTERNS   0x00000002
#define MPL_WOL_BROADCAST  0x00000004
#define MPL_WOL_MULTICAST  0x00000008
#define MPL_WOL_DIRECTED   0x00000010
#define MPL_WOL_LINK       0x00000020
#define MPL_WOL_ARP        0x00000040

//*****************************************************************************
//   MplWolGetCfg
//     Retrieve the current WOL configuration on the device
//
//   Parameters
//      pMplHandle
//         MPL device handle returned following a call to MplInitialize
//      pWakeType
//         Pointer to caller provider variable in which the bit-map of wake-up
//         events currently enabled is returned. It is a logical OR of,
//          MPL_WOL_MAGIC - Enable wake on Magic Pattern.
//          MPL_WOL_PATTERN - Enable wake on pattern match (Patterns needs to
//                            be separately defined).
//          MPL_WOL_BROADCAST - Enable wake on any broadcast packet.
//          MPL_WOL_MULTICAST - Enable wake on multicast packet.
//          MPL_WOL_DIRECTED - Enable wake on directed (unicast) packet to
//                             the device's address.
//          MPL_WOL_LINK - Enable wake on link status change.
//          MPL_WOL_ARP - Enable wake on any ARP packet.
//
//   Return Value
//      NS_STATUS_SUCCESS
//         The WOL configuration was returned successfully
//
//*****************************************************************************
MPL_STATUS
   MplWolGetCfg(
      IN NS_VOID   *pMplHandle,
      IN NS_UINT   *pWakeType
      );

//*****************************************************************************
//   MplWolClearPattern
//     Clear all WOL wake patterns on the device
//
//   Parameters
//      pMplHandle
//         MPL device handle returned following a call to MplInitialize
//
//   Return Value
//      NS_STATUS_SUCCESS
//         The wake patterns were successfully cleared
//
//*****************************************************************************
MPL_STATUS
   MplWolClearPattern(
      IN NS_VOID   *pMplHandle
      );

//*****************************************************************************
//   MplWolAddPattern
//     Add a new WOL wake pattern to the device
//
//   Parameters
//      pMplHandle
//         MPL device handle returned following a call to MplInitialize
//      pWolPattern
//         Pointer to a MPL_WOL_PATTERN structure in which the new pattern 
//         and its associated mask is noted
//
//   Return Value
//      NS_STATUS_SUCCESS
//         The wake pattern was successfully added.
//      NS_STATUS_RESOURCES
//         The wake pattern not added since it exceeds the maximum supported
//         on this device.
//      NS_STATUS_INVALID_PARM
//         The wake pattern buffer is larger than the maximum supported by
//         the device.
//
//*****************************************************************************
MPL_STATUS
   MplWolAddPattern(
      IN NS_VOID         *pMplHandle,
      IN MPL_WOL_PATTERN *pWolPattern
      );

//*****************************************************************************
//   MplWolRemovePattern
//     Remove a WOL wake pattern from the device
//
//   Parameters
//      pMplHandle
//         MPL device handle returned following a call to MplInitialize
//      pWolPattern
//         Pointer to a MPL_WOL_PATTERN structure in which the pattern 
//         and its associated mask is noted
//
//   Return Value
//      NS_STATUS_SUCCESS
//         The wake pattern was deleted successfully.
//      NS_STATUS_INVALID_PARM
//         The wake pattern was not found in the list
//
//*****************************************************************************
MPL_STATUS
   MplWolRemovePattern(
      IN NS_VOID         *pMplHandle,
      IN MPL_WOL_PATTERN *pWolPattern
      );

//+++++ Miscellaneous APIs
//###################################

//*****************************************************************************
//   MplSetMacAddress
//      Set the MAC's address on the device
//
//   Parameters
//      pMplHandle
//         MPL device handle returned following a call to MplInitialize
//      pMacAddr
//         Pointer to caller supplied variable with the new MAC address
//
//   Return Value
//      NS_STATUS_SUCCESS
//         The MAC address was sucessfully programmed on the device
//
//*****************************************************************************
MPL_STATUS
   MplSetMacAddress (
      IN NS_VOID         *pMplHandle,
      IN MPL_MAC_ADDR    pMacAddr
      );

//*****************************************************************************
//   MplGetMacAddress
//      Get the current MAC's address on the device
//
//   Parameters
//      pMplHandle
//         MPL device handle returned following a call to MplInitialize.
//      eeProm
//         If set to NS_TRUE, the permanent (EEPROM programmed) mac address 
//          for the device is returned back to the caller, else the current
//          active address is returned.
//      pMacAddr
//         Pointer to a caller supplied MPL_MAC_ADDR variable where the current
//          or default network address is returned.
//
//   Return Value
//      NS_STATUS_SUCCESS
//       The mac address was successfully read and is returned.
//      NS_STATUS_FAILURE
//       Failed to get the MAC address
//*****************************************************************************
MPL_STATUS
   MplGetMacAddress (
      IN NS_VOID        *pMplHandle,
      IN NS_BOOLEAN      eeProm,
      OUT MPL_MAC_ADDR   pMacAddr
      );

//*****************************************************************************
//   MplGetDeviceId
//      Get the device Id to identify the MacPhyter version
//
//   Parameters
//      pMplHandle
//         MPL device handle returned following a call to MplInitialize.
//
//   Return Value
//      MPL_DEVICE_ID_DP83815 = Macphyter-I found
//      MPL_DEVICE_ID_DP83816 = Macphyter-II found
//      MPL_DEVICE_ID_DP83818 = Macphyter-III found
//*****************************************************************************
MPL_DEVICE_ID
   MplGetDeviceId(
      IN NS_VOID        *pMplHandle
      );

//*****************************************************************************
//   MplGetRegs
//      Get the current operational registers values
//
//   Parameters
//      pMplHandle
//         MPL device handle returned following a call to MplInitialize.
//      pRegs
//         A caller supplied buffer (atleast 255*4 bytes)
//
//   Return Value
//      None
//*****************************************************************************
NS_VOID
   MplGetRegs(
      IN NS_VOID        *pMplHandle,
      IN NS_UINT32      *pRegs
      );

//*****************************************************************************
//   MplRegRead
//      Read a 32-bit register
//
//   Parameters
//      pMplHandle
//         MPL device handle
//      regIndex
//         Register to read (in terms of absolute offset e.g. CR = 0x0, 
//                             TXCFG = 0x24)
//
//   Return Value
//     Reg data
//
//*****************************************************************************
NS_UINT32
   MplRegRead(
      IN NS_VOID   *pMplHandle,
      IN NS_UINT    regIndex
      );

//*****************************************************************************
//   MplRegWrite
//      Write a 32-bit register
//
//   Parameters
//      pMplHandle
//         MPL device handle
//      regIndex
//         Register to read (in terms of absolute offset e.g. CR = 0x0, 
//                             TXCFG = 0x24)
//      regData
//         Data to write
//
//   Return Value
//     None
//
//*****************************************************************************
NS_VOID
   MplRegWrite(
      IN NS_VOID   *pMplHandle,
      IN NS_UINT    regIndex,
      IN NS_UINT32  regData
      );

//*****************************************************************************
//   MplDumpTransmitRing
//      Dump the Txd ring
//
//   Parameters
//      pMplHandle
//         MPL device handle returned following a call to MplInitialize.
//
//   Return Value
//      None
//*****************************************************************************
NS_VOID
   MplDumpTransmitRing(
      IN NS_VOID        *pMplHandle
      );

//*****************************************************************************
//   MplDumpReceiveRing
//      Dump the Rxd ring
//
//   Parameters
//      pMplHandle
//         MPL device handle returned following a call to MplInitialize.
//
//   Return Value
//      None
//*****************************************************************************
NS_VOID
   MplDumpReceiveRing(
      IN NS_VOID        *pMplHandle
      );

#ifndef MPL_NO_EEPROM
//*****************************************************************************
//   MplEERead
//     Read 16-bit word from a given EEPROM offset 
//
//   Parameters
//      pMplHandle
//         MPL device handle returned following a call to MplInitialize.
//      index
//         Offset from where to read EEPROM contents
//     *pData
//         Caller provided variable where the 16-bit contents is returned
//
//   Return Value
//      NS_STATUS_SUCCESS
//       The EEPROM was successfully read
//      NS_STATUS_INVALID_PARM
//       The EEPROM offset is invalid
//*****************************************************************************
MPL_STATUS
   MplEERead(
      IN NS_VOID    *pMplHandle,
      IN NS_UINT     index,
      IN NS_UINT16  *pData   
      );
#endif// MPL_NO_EEPROM

//+++++ MPL Callbacks into NSM

//*****************************************************************************
//   NsmTransmitDone
//     Transmit Done Notification 
//
//   Parameters
//      pClientDevHndl
//         NSM device handle registered with MPL (during MplInitialize)
//      packetCnt
//         Count of packets whose completion is being reported.
//      pTxDone
//         MPL allocated MPL_TRANSMIT_DONE structure array in which the 
//          NSM packet handles and statuses are returned.
//
//   Return Value
//      None
//*****************************************************************************
NS_VOID
   NsmTransmitDone(
    IN NS_VOID *pClientDevHndl,
    IN NS_UINT  packetCnt,
    IN MPL_TRANSMIT_DONE *pTxDone
    );

//*****************************************************************************
//   NsmReceive
//     Receive Done Notification
//
//   Parameters
//      pClientDevHndl
//         NSM device handle registered with MPL (during MplInitialize)
//      packetCnt
//         Count of packets whose reception is being reported.
//      pPkt
//         MPL allocated MPL_PKT structure array in which 
//         a list of the newly received packets are reported
//
//   Return Value
//      None
//*****************************************************************************
NS_VOID
   NsmReceive(
    IN NS_VOID *pClientDevHndl,
    IN NS_UINT  packetCnt,
    IN MPL_PKT *pPkt
    );

//*****************************************************************************
//   NsmLinkStatusChange
//     Link status change Notification
//
//   Parameters
//      pClientDevHndl
//         NSM device handle registered with MPL (during MplInitialize)
//
//   Return Value
//      None
//*****************************************************************************
NS_VOID
   NsmLinkStatusChange(
    IN NS_VOID *pClientDevHndl
    );

#if defined(__cplusplus)
}
#endif 

#endif // _MPLCLIENT_H_

⌨️ 快捷键说明

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