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

📄 zl5011xlan.h

📁 Zalink50114----TDMoIP芯片驱动源码
💻 H
字号:
/*******************************************************************************
*
*  File name:              zl5011xLan.h
*
*  Version:                22
*
*  Author:                 MRC
*
*  Date created:           11/06/2002
*
*  Copyright 2002, 2003, 2004, 2005, Zarlink Semiconductor Limited.
*  All rights reserved.
*
*  Module Description:
*
*  This is the header file for the Lan functions.
*
*  Revision History:
*
*  Rev:  Date:       Author:  Comments:
*  1     11/06/2002  MRC      Creation
*  2     14/06/2002  MRC      Added some packet fns
*  3     19/06/2002  MRC      PTX block changed
*  4     21/06/2002  MRC      Added more functions
*  5     28/06/2002  MRC      Added packet Rx functions
*  6     12/07/2002  MRC      Rationalised the 2 enums for CPU queues
*  7     22/07/2002  MRC      Removed temp fns
*  8     06/08/2002  MRC      Added packet Rx filtering fns
*  9     12/09/2002  MRC      Updated following review
*  10    13/09/2002  MRC      Added in PHY and stats functions
*  11    25/10/2002  MRC      Added OS exclusion enable to structs
*  12    31/10/2002  MRC      Added variants + minor fixes
*  13    07/01/2003  MRC      Added zl5011xLanGetPacketStats function
*  14    22/05/2003  MRC      Added Lan port redirection functions
*  15    29/07/2003  APL      Added support for device variants without TDM
*  16    11/08/2003  MRC      Updated
*  17    26/07/2004  MRC      Fixed some compiler warnings
*  18    25/08/2004  MRC      Added PW functions
*  19    06/09/2004  APL      LanContext functions only apply to ZL50130
*  20    06/05/2005  APL      Added function zl5011xLanGetTxSeqNum
*  21    17/05/2005  MRC      Update
*  22    21/07/2005  MRC      Added function to read/write a 32 bit value to the
*                             Packet Tx header
*
*******************************************************************************/

#ifndef _ZL5011X_LAN_H
#define _ZL5011X_LAN_H

#ifdef __cplusplus
extern "C" {
#endif

/*****************   INCLUDE FILES   ******************************************/

/*****************   # DEFINES   **********************************************/

/* the number of classification matches that can be attached to each context
   for mapping from Lan Rx to Wan Tx */
#define ZL5011X_LAN_RX_NUM_MATCHES_PER_CONTEXT    2

/*****************   DATA STRUCTURES and FUNCTION DECLARATIONS   **************/

typedef struct
{
   Uint8T  portNum;
   zl5011xMacTypeE macType;
   Uint8T  macAddress[ZL5011X_MAC_SIZE];
   Uint32T maxPktLength;
   zl5011xBooleanE vlanEnabled;
   zl5011xBooleanE enable64BitMacStats;
   zl5011xBooleanE osExclusionEnable;

   /* for internal use ONLY */
   zl5011xBooleanE filterBroadcastPkts;
   zl5011xBooleanE filterMulticastPkts;
   zl5011xBooleanE filterNonMatchingUnicastPkts;
} zl5011xLanConfigureS;

zlStatusE zl5011xLanConfigureStructInit(zl5011xParamsS *zl5011xParams, zl5011xLanConfigureS *par);
zlStatusE zl5011xLanConfigure(zl5011xParamsS *zl5011xParams, zl5011xLanConfigureS *par);

/********************************/

typedef struct
{
   Uint8T portNum;
   zl5011xPacketQueuePriorityModeE priorityMode;

   zl5011xBooleanE granuleThresholdDropPackets[ZL5011X_PKQ_NUM_QUEUES];
   Uint32T granuleThreshold[ZL5011X_PKQ_NUM_QUEUES];
   Uint32T priorityWeighting[ZL5011X_PKQ_NUM_QUEUES];
   zl5011xBooleanE osExclusionEnable;
} zl5011xLanQueueConfigureS;

zlStatusE zl5011xLanQueueConfigureStructInit(zl5011xParamsS *zl5011xParams,
      zl5011xLanQueueConfigureS *par);
zlStatusE zl5011xLanQueueConfigure(zl5011xParamsS *zl5011xParams, zl5011xLanQueueConfigureS *par);

/********************************/

typedef struct
{
   /* CPU queue to be used for the following filters */
   zl5011xQueueE cpuQueue;

   /* enables for the various MAC address and ethertype filters */
   zl5011xBooleanE filterMulticastEnable;
   zl5011xBooleanE filterBroadcastEnable;
   zl5011xBooleanE filterControlEnable;
   zl5011xBooleanE filterArpEnable;
   zl5011xBooleanE filterRarpEnable;
   zl5011xBooleanE osExclusionEnable;
} zl5011xLanRxFilterS;

zlStatusE zl5011xLanRxFilterStructInit(zl5011xParamsS *zl5011xParams,
      zl5011xLanRxFilterS *par);
zlStatusE zl5011xLanRxFilter(zl5011xParamsS *zl5011xParams,
      zl5011xLanRxFilterS *par);

/********************************/

typedef struct
{
   Uint32T matchNum;
   zl5011xPacketFilterMatchS match;
   zl5011xBooleanE osExclusionEnable;
} zl5011xLanRxSetFilterMatchS;

zlStatusE zl5011xLanRxSetFilterMatchStructInit(zl5011xParamsS *zl5011xParams,
      zl5011xLanRxSetFilterMatchS *par);
zlStatusE zl5011xLanRxSetFilterMatch(zl5011xParamsS *zl5011xParams,
      zl5011xLanRxSetFilterMatchS *par);

/********************************/

typedef struct
{
   Uint32T matchNum;
   zl5011xBooleanE osExclusionEnable;
} zl5011xLanRxDeleteFilterMatchS;

zlStatusE zl5011xLanRxDeleteFilterMatchStructInit(zl5011xParamsS *zl5011xParams,
      zl5011xLanRxDeleteFilterMatchS *par);
zlStatusE zl5011xLanRxDeleteFilterMatch(zl5011xParamsS *zl5011xParams,
      zl5011xLanRxDeleteFilterMatchS *par);

/********************************/

typedef struct
{
   Uint32T matchNum;
   zl5011xPacketProtocolMatchS match;
   zl5011xPacketProtocolOutputS output;
   zl5011xBooleanE osExclusionEnable;
} zl5011xLanRxSetProtocolMatchS;

zlStatusE zl5011xLanRxSetProtocolMatchStructInit(zl5011xParamsS *zl5011xParams,
      zl5011xLanRxSetProtocolMatchS *par);
zlStatusE zl5011xLanRxSetProtocolMatch(zl5011xParamsS *zl5011xParams,
      zl5011xLanRxSetProtocolMatchS *par);

/********************************/

typedef struct
{
   Uint32T matchNum;
   zl5011xBooleanE osExclusionEnable;
} zl5011xLanRxDeleteProtocolMatchS;

zlStatusE zl5011xLanRxDeleteProtocolMatchStructInit(zl5011xParamsS *zl5011xParams,
      zl5011xLanRxDeleteProtocolMatchS *par);
zlStatusE zl5011xLanRxDeleteProtocolMatch(zl5011xParamsS *zl5011xParams,
      zl5011xLanRxDeleteProtocolMatchS *par);

/********************************/

typedef struct
{
   Uint32T context;
   Uint32T matchNum;
   zl5011xPacketClassifyMatchS match;
   zl5011xPacketClassifyOutputS output;
   zl5011xBooleanE osExclusionEnable;
} zl5011xLanRxSetContextMatchS;

zlStatusE zl5011xLanRxSetContextMatchStructInit(zl5011xParamsS *zl5011xParams,
      zl5011xLanRxSetContextMatchS *par);
zlStatusE zl5011xLanRxSetContextMatch(zl5011xParamsS *zl5011xParams,
      zl5011xLanRxSetContextMatchS *par);

/********************************/

typedef struct
{
   Uint32T context;
   zl5011xBooleanE osExclusionEnable;
} zl5011xLanRxDeleteContextMatchS;

zlStatusE zl5011xLanRxDeleteContextMatchStructInit(zl5011xParamsS *zl5011xParams,
      zl5011xLanRxDeleteContextMatchS *par);
zlStatusE zl5011xLanRxDeleteContextMatch(zl5011xParamsS *zl5011xParams,
      zl5011xLanRxDeleteContextMatchS *par);

/********************************/

typedef struct
{
   Uint32T matchNum;
   zl5011xQueueE cpuQueue;
   zl5011xPacketClassifyMatchS match;
   zl5011xBooleanE osExclusionEnable;
} zl5011xLanRxSetHostMatchS;

zlStatusE zl5011xLanRxSetHostMatchStructInit(zl5011xParamsS *zl5011xParams, zl5011xLanRxSetHostMatchS *par);
zlStatusE zl5011xLanRxSetHostMatch(zl5011xParamsS *zl5011xParams, zl5011xLanRxSetHostMatchS *par);

/********************************/

typedef struct
{
   Uint32T matchNum;
   zl5011xBooleanE osExclusionEnable;
} zl5011xLanRxDeleteHostMatchS;

zlStatusE zl5011xLanRxDeleteHostMatchStructInit(zl5011xParamsS *zl5011xParams, zl5011xLanRxDeleteHostMatchS *par);
zlStatusE zl5011xLanRxDeleteHostMatch(zl5011xParamsS *zl5011xParams, zl5011xLanRxDeleteHostMatchS *par);

/********************************/

typedef struct
{
   Uint32T context;
   Uint8T portNum;
   Uint8T queueNum;
   zl5011xPacketTxLowHeaderS header;
   zl5011xBooleanE osExclusionEnable;
} zl5011xLanTxSetLayer2and3HeaderS;

zlStatusE zl5011xLanTxSetLayer2and3HeaderStructInit(zl5011xParamsS *zl5011xParams,
      zl5011xLanTxSetLayer2and3HeaderS *par);
zlStatusE zl5011xLanTxSetLayer2and3Header(zl5011xParamsS *zl5011xParams,
      zl5011xLanTxSetLayer2and3HeaderS *par);

/********************************/

typedef struct
{
   Uint32T context;
   zl5011xPacketTxHighHeaderS header;
   zl5011xBooleanE osExclusionEnable;
} zl5011xLanTxSetLayer4and5HeaderS;

zlStatusE zl5011xLanTxSetLayer4and5HeaderStructInit(zl5011xParamsS *zl5011xParams,
      zl5011xLanTxSetLayer4and5HeaderS *par);
zlStatusE zl5011xLanTxSetLayer4and5Header(zl5011xParamsS *zl5011xParams,
      zl5011xLanTxSetLayer4and5HeaderS *par);

/********************************/

typedef struct
{
   Uint32T context;

   Uint32T pos;
   Uint32T wordValue;
   Uint32T wordMask;

   zl5011xBooleanE osExclusionEnable;
} zl5011xLanTxHeaderWordS;

zlStatusE zl5011xLanTxHeaderWordStructInit(zl5011xParamsS *zl5011xParams, zl5011xLanTxHeaderWordS *par);
zlStatusE zl5011xLanTxSetHeaderWord(zl5011xParamsS *zl5011xParams, zl5011xLanTxHeaderWordS *par);
zlStatusE zl5011xLanTxGetHeaderWord(zl5011xParamsS *zl5011xParams, zl5011xLanTxHeaderWordS *par);

/********************************/

typedef struct
{
   Uint8T phyId;
   Uint8T phyAddress;
   Uint16T phyValue;
} zl5011xLanPhyS;

zlStatusE zl5011xLanPhyStructInit(zl5011xParamsS *zl5011xParams, zl5011xLanPhyS *par);
zlStatusE zl5011xLanPhyRead(zl5011xParamsS *zl5011xParams, zl5011xLanPhyS *par);
zlStatusE zl5011xLanPhyWrite(zl5011xParamsS *zl5011xParams, zl5011xLanPhyS *par);

/********************************/

typedef enum
{
   ZL5011X_COLLECT_ETHER_STATS,
   ZL5011X_COLLECT_IF_STATS,
   ZL5011X_COLLECT_ETHER_AND_IF_STATS
} zl5011xLanStatsModeE;

typedef struct
{
   Uint8T portNum;
   zl5011xLanStatsModeE statsMode;
   zl5011xEtherStatsS etherStats;
   zl5011xIfStatsS ifStats;
   zl5011xBooleanE osExclusionEnable;
} zl5011xLanGetStatsS;

zlStatusE zl5011xLanGetStatsStructInit(zl5011xParamsS *zl5011xParams,
      zl5011xLanGetStatsS *par);
zlStatusE zl5011xLanGetStats(zl5011xParamsS *zl5011xParams,
      zl5011xLanGetStatsS *par);

/********************************/

typedef struct
{
   Uint32T context;

   Uint32T lCount;
   Uint32T lTimeMs;
   Uint32T rCount;
   Uint32T rTimeMs;

   zl5011xBooleanE osExclusionEnable;
} zl5011xLanGetPwStatsS;

zlStatusE zl5011xLanGetPwStatsStructInit(zl5011xParamsS *zl5011xParams,
      zl5011xLanGetPwStatsS *par);
zlStatusE zl5011xLanGetPwStats(zl5011xParamsS *zl5011xParams,
      zl5011xLanGetPwStatsS *par);

/********************************/

typedef struct
{
   Uint32T context;
   Uint32T timestamp;
   zl5011xBooleanE osExclusionEnable;
} zl5011xLanGetRtpTimestampS;

zlStatusE zl5011xLanGetRtpTimestampStructInit(zl5011xParamsS *zl5011xParams,
      zl5011xLanGetRtpTimestampS *par);
zlStatusE zl5011xLanGetRtpTimestamp(zl5011xParamsS *zl5011xParams,
      zl5011xLanGetRtpTimestampS *par);

/********************************/

typedef struct
{
   Uint32T context;
   Uint16T seqNum;
   zl5011xBooleanE osExclusionEnable;
} zl5011xLanGetTxSeqNumS;

zlStatusE zl5011xLanGetTxSeqNumStructInit(zl5011xParamsS *zl5011xParams,
      zl5011xLanGetTxSeqNumS *par);
zlStatusE zl5011xLanGetTxSeqNum(zl5011xParamsS *zl5011xParams,
      zl5011xLanGetTxSeqNumS *par);

/********************************/

typedef struct
{
   Uint32T context;
   zl5011xGetRtpStatsModeE statsMode;

   zl5011xRtpStatsS rtpStats;
   zl5011xWanRtpIncrementTypeE rtpJitterUnits;

   zl5011xBooleanE osExclusionEnable;
} zl5011xLanGetRtpStatsS;

zlStatusE zl5011xLanGetRtpStatsStructInit(zl5011xParamsS *zl5011xParams,
      zl5011xLanGetRtpStatsS *par);
zlStatusE zl5011xLanGetRtpStats(zl5011xParamsS *zl5011xParams,
      zl5011xLanGetRtpStatsS *par);

/********************************/

typedef struct
{
   zl5011xPkcStatsS pktStats;
   zl5011xBooleanE osExclusionEnable;
} zl5011xLanGetPacketStatsS;

zlStatusE zl5011xLanGetPacketStatsStructInit(zl5011xParamsS *zl5011xParams,
      zl5011xLanGetPacketStatsS *par);
zlStatusE zl5011xLanGetPacketStats(zl5011xParamsS *zl5011xParams,
      zl5011xLanGetPacketStatsS *par);


/********************************/

typedef struct
{
   Uint32T context;
   Uint8T portNum;
   Uint8T queueNum;

   zl5011xBooleanE osExclusionEnable;
} zl5011xLanTxPortS;

zlStatusE zl5011xLanTxPortStructInit(zl5011xParamsS *zl5011xParams, zl5011xLanTxPortS *par);
zlStatusE zl5011xLanTxGetPort(zl5011xParamsS *zl5011xParams, zl5011xLanTxPortS *par);
zlStatusE zl5011xLanTxSetPort(zl5011xParamsS *zl5011xParams, zl5011xLanTxPortS *par);

/********************************/

typedef struct
{
   Uint8T fromPortNum;
   Uint8T toPortNum;

   zl5011xBooleanE osExclusionEnable;
} zl5011xLanTxPortRedirectionS;

zlStatusE zl5011xLanTxPortRedirectionStructInit(zl5011xParamsS *zl5011xParams, zl5011xLanTxPortRedirectionS *par);
zlStatusE zl5011xLanTxPortRedirection(zl5011xParamsS *zl5011xParams, zl5011xLanTxPortRedirectionS *par);

/********************************/


/*****************   FUNCTION DECLARATIONS   **********************************/

zlStatusE zl5011xLanRxPurgeContextHeaders(zl5011xParamsS *zl5011xParams, Uint32T contextNum);

#ifdef __cplusplus
}
#endif

#endif

⌨️ 快捷键说明

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