/******************************************************************************/
/*               Copyright 2001, 2002, 2003 Broadcom Corporation              */
/*                                                                            */
/* This material is the confidential trade secret and proprietary information */
/* of Broadcom Corp.  It may not be reproduced, used, sold or transferred to  */
/* any third party without the prior written consent of Broadcom Corp.        */
/* All rights reserved.                                                       */
/******************************************************************************/

/* $Id: bcm_hmiLcaMsg.h,v 1.29 2004/07/02 12:06:04 eduymeli Exp $ */

#ifndef BCM_HMI_LCA_MSG_H
#define BCM_HMI_LCA_MSG_H

#ifndef BCM_USER_DEF_H
#include "bcm_userdef.h"
#endif

#ifndef LAYOUT_H
#include "bcm_layout.h"
#endif

#define IDF_BASE_APP_ID            0x0400

#define LCA_CONFIG_DEVICE          0x0420
#define LCA_CONFIG_DS_BUFFERS      0x0421
#define LCA_CONFIG_USPORT          0x0422
#define LCA_CONFIG_DSPORT          0x0423
#define LCA_CONFIG_MAC_FILTER      0x0424
#define LCA_DEFINE_MULTICAST_GROUP 0x0425
#define LCA_SET_PROTOCOL_FILTER    0x0426
#define LCA_DEFINE_ATM_HEADERS     0x0427
#define LCA_GET_SNOOP_COUNTERS     0x0428
#define LCA_GET_DEVICE_INFO        0x0429
#define LCA_GET_VERSION            0x042a
#define LCA_GET_LOCATION           0x042b
#define LCA_GET_STATUS             0x042c
#define LCA_GET_COUNTERS           0x042d
#define LCA_GET_SNOOPED_CELLS      0x042e
#define LCA_GET_MAC_ENTRY          0x042f
#define LCA_GET_KEYS               0x0430
#define LCA_TRANSCEIVER_READ       0x0431
#define LCA_TRANSCEIVER_WRITE      0x0432
#define LCA_WRITE_OAM              0x0433
#define LCA_GET_F4F5               0x0434
#define LCA_INJECT_FRAME           0x0435
#define LCA_GET_INTERRUPT_STATUS   0x0436
#define LCA_SET_INTERRUPT_MASK     0x0437
#define LCA_OAM_RETRIEVE           0x0438
#define LCA_MONITOR_MULTICAST      0x0439
#define LCA_LAST_MESSAGE           0x0439

#define LCA_RESET                  (1<<0)
#define LCA_PREFERRED_LINK         (1<<1)
#define LCA_SINGLE_LINK            (1<<2)
#define LCA_DAISYCHAIN             (1<<3)
#define LCA_DISABLE_COUNTER_POLL   (1<<4)
#define LCA_DISABLE_TXVR_POLL      (1<<5)
#define LCA_HANDLE_IGMP            (1<<6)
#define LCA_MASTER                 (1<<7)
#define LCA_ENABLE_FLOODING        (1<<8)

#define LCA_LINK_UP                     0
#define LCA_LINK_SPEED                  1
#define LCA_LINK_OVERFLOW               2

#define LCA_CUP_ENABLE_PORT        (1<<0)
#define LCA_CUP_PREFERRED_LINK     (1<<1)
#define LCA_CUP_ENABLE_PFG_0       (1<<2)
#define LCA_CUP_ENABLE_PFG_1       (1<<3)
#define LCA_CUP_ENABLE_PFG_2       (1<<4)
#define LCA_CUP_ENABLE_PFG_3       (1<<5)
#define LCA_CUP_ATM_OVER_ETH       (1<<6)
#define LCA_CUP_AAL5_OVER_ETH      (1<<7)
#define LCA_CUP_ENABLE_PFG_4       (1<<8)

#define LCA_CDP_CARRY_VPVC_HEC          1

#define LCA_CMF_ENABLE             (1<<0)
#define LCA_CMF_PREFERRED_LINK     (1<<1)
#define LCA_CMF_ENABLE_PFG_0       (1<<2)
#define LCA_CMF_ENABLE_PFG_1       (1<<3)
#define LCA_CMF_ENABLE_PFG_2       (1<<4)
#define LCA_CMF_ENABLE_PFG_3       (1<<5)
#define LCA_CMF_MASK_DOT1P         (1<<6)
#define LCA_CMF_MASK_DOT1Q         (1<<7)
#define LCA_CMF_MASK_MAC           (1<<8)
#define LCA_CMF_MASK_LINK          (1<<9)
#define LCA_CMF_ATM_OVER_ETH      (1<<10)
#define LCA_CMF_AAL5_OVER_ETH     (1<<11)
#define LCA_CMF_PREVENT_OVERFLOW  (1<<12)
#define LCA_CMF_NO_LEARNING       (1<<13)
#define LCA_CMF_ENABLE_PFG_4      (1<<14)

#define LCA_GF_MASK_ETH            (1<<0)
#define LCA_GF_MASK_IP             (1<<1)
#define LCA_GF_MASK_DST_PORT       (1<<2)
#define LCA_GF_MASK_SRC_PORT       (1<<3)
#define LCA_GF_SNOOP_ENABLE        (1<<4)
#define LCA_GF_SNOOP_ON_MATCH      (1<<5)
#define LCA_GF_DROP_ENABLE         (1<<6)
#define LCA_GF_DROP_ON_MATCH       (1<<7)
#define LCA_GF_DROP_OVERRIDE       (1<<8)
#define LCA_GF_PRIORITY            (1<<9)

#define LCA_PF_US_FULLY_CONF_0     (0)
#define LCA_PF_US_FULLY_CONF_1     (1)
#define LCA_PF_US_ETH_ONLY_0       (2)
#define LCA_PF_US_ETH_ONLY_1       (3)
#define LCA_PF_US_BOOTP            (4)
#define LCA_PF_US_IGMP             (5)
#define LCA_PF_US_RARP             (6)
#define LCA_PF_US_VLAN             (7)
#define LCA_PF_US_802_1_X          (8)
#define LCA_PF_US_PPPOE            (9)
#define LCA_PF_US_MULTICAST       (10)
#define LCA_PF_US_ETH_MANAGEMENT  (11)
#define LCA_PF_DS_FULLY_CONF_0    (20)
#define LCA_PF_DS_FULLY_CONF_1    (21)
#define LCA_PF_DS_ETH_ONLY_0      (22)
#define LCA_PF_DS_ETH_ONLY_1      (23)
#define LCA_PF_DS_BOOTP           (24)
#define LCA_PF_DS_IGMP            (25)
#define LCA_PF_DS_RARP            (26)
#define LCA_PF_DS_VLAN            (27)
#define LCA_PF_DS_802_1_X         (28)
#define LCA_PF_DS_PPPOE           (29)
#define LCA_PF_DS_MULTICAST       (30)
#define LCA_PF_DS_ETH_MANAGEMENT  (31)

#define LCA_INT_MAC_ADDRESS_CHANGE   (1<<0)
#define LCA_INT_SNOOPED_FRAMES_UP_0  (1<<1)
#define LCA_INT_SNOOPED_FRAMES_UP_1  (1<<2)
#define LCA_INT_SNOOPED_FRAMES_DO_0  (1<<3)
#define LCA_INT_SNOOPED_FRAMES_DO_1  (1<<4)
#define LCA_INT_UP_OVERFLOW          (1<<5)
#define LCA_INT_DO_OVERFLOW          (1<<6)
#define LCA_INT_SNOOPED_INBAND_DO    (1<<8)
#define LCA_INT_US_FCS_ERROR_DROP    (1<<9)
#define LCA_INT_US_LLC_ERROR_DROP    (1<<10)
#define LCA_INT_US_CAM_REJ_DROP      (1<<11)

#define NO_OF_DS_BUFFERS              512
#define NO_OF_US_BUFFERS              512
#define NO_OF_MAC_ENTRIES             512
#define BROADCAST_MAC_FILTER_0          0
#define BROADCAST_MAC_FILTER_1          1
#define FIRST_USER_FILTER              16
#define BROADCAST_DS_BUFFER_0          16
#define BROADCAST_DS_BUFFER_1          17
#define FIRST_USER_DS_BUFFER           95

#define SUPPORTED_LCA_HMI_MAJOR_VERSION 2
#define SUPPORTED_LCA_HMI_MINOR_VERSION 2

typedef struct {
  uint8  keyId;
  uint8  keyValue;
  uint16 noOfKeys;
  uint8  filterMaxAge;
  uint8  ageTimeExponent;
  uint16 atmFwdEtherType;
  uint8  atmFwdDstMAC[6];
  uint8  atmFwdSrcMAC[6];
  uint16 flags;
} LcaDeviceConfig;

typedef LcaDeviceConfig LcaConfigDeviceMsgReq;
extern  MsgLayout       LcaConfigDeviceLayout;

typedef struct {
  uint16 noOfKeys;
  uint16 dsMemorySize;
} LcaDeviceInfo;

typedef LcaDeviceInfo LcaGetDeviceInfoMsgRep;
extern  MsgLayout     LcaGetDeviceInfoLayout;

typedef struct {
  uint8   status[2];
  uint8   reserved[2];
  uint8   usOverflows[64];
  uint8   dsOverflows[64];
  uint8   usAal5OrFcsErrorDrop[64];
  uint8   usLlcFormatErrorDrop[64];
  uint8   usCamRejectErrorDrop[64];
  uint8   newCamEntries[64];
  uint8   removedCamEntries[64];
} LcaStatus;

typedef uint8     LcaGetStatusMsgReq;
typedef LcaStatus LcaGetStatusMsgRep;
extern  MsgLayout LcaGetStatusLayout;

typedef struct {
  uint32 usPackets;
  uint32 dsPackets;
  uint32 dsFcsErrors;
} LcaLinkCounters;


typedef struct {
  LcaLinkCounters link[2];
} LcaCounters;

typedef uint8       LcaGetCountersMsgReq;
typedef LcaCounters LcaGetCountersMsgRep;
extern  MsgLayout   LcaGetCountersLayout;

typedef struct {
  uint8  number;
  uint8  reserved0[3];
  uint32 subnet;
  uint32 netmask;
  int8   aal5Group;
  uint8  atmHeader;
  uint8  atmPriority;
  uint8  reserved1;
  uint16 atmSCR;
  uint16 atmMBS;
  uint8  buffers[64];
  uint8  filters[64];
  uint8  portPairs[48];
} LcaMulticastGroupDef;

typedef struct {
  uint8  keyId;
  uint8  keyValue;
  uint8  reserved[2];
  LcaMulticastGroupDef group;
} LcaMcastGroupConfig;

typedef LcaMcastGroupConfig LcaDefineMulticastGroupMsgReq;
extern  MsgLayout           LcaDefineMulticastGroupLayout;

typedef struct {
  uint16 link;
  uint16 registerID;
} LcaXcvrReadSpec;

typedef LcaXcvrReadSpec LcaTransceiverReadMsgReq;
typedef uint16          LcaTransceiverReadMsgRep;
extern  MsgLayout       LcaTransceiverReadLayout;

typedef struct {
  uint16 link;
  uint16 registerID;
  uint16 value;
} LcaXcvrWriteSpec;

typedef LcaXcvrWriteSpec LcaTransceiverWriteMsgReq;
extern  MsgLayout        LcaTransceiverWriteLayout;

typedef struct {
  uint64 boardId;
  uint8  pos;
  uint8  reserved[7];
} LcaLocation;

typedef LcaLocation LcaGetLocationMsgRep;
extern  MsgLayout   LcaGetLocationLayout;

typedef struct {
  uint8  keyId;
  uint8  keyValue;
  uint16 filter;
  uint8  pos;
  uint8  line;
  uint8  port;
  uint8  atmHeader;
  uint8  scanLength;
  uint8  reserved;
  uint16 flags;
} LcaUpstreamPortConfig;

typedef LcaUpstreamPortConfig LcaConfigUpstreamPortMsgReq;
extern  MsgLayout             LcaConfigUpstreamPortLayout;

typedef struct {
  uint8  keyId;
  uint8  keyValue;
  uint8  pos;
  uint8  line;
  uint8  portPair;
  int8   aal5Group;
  uint16 buffer[2];
  uint8  atmHeader[2];
  uint8  enable[2];
  uint16 atmSCR;
  uint16 atmMBS;
  uint8  atmPriority;
  uint8  flags;
} LcaDownstreamPortConfig;


typedef LcaDownstreamPortConfig LcaConfigDownstreamPortMsgReq;
extern  MsgLayout               LcaConfigDownstreamPortLayout;

typedef struct {
  uint8  keyId;
  uint8  keyValue;
  uint16 filter;
  uint16 buffer;
  uint8  macAddress[6];
  uint16 vlan;
  uint8  reserved;
  uint8  ageTime;
  uint16 flags;
} LcaMacFilterConfig;

typedef LcaMacFilterConfig LcaConfigMacFilterMsgReq;
extern MsgLayout           LcaConfigMacFilterLayout;

typedef struct {
  uint8  vp;
  uint8  reserved;
  uint16 vc;
} LcaVpVc;

typedef struct {
  LcaVpVc vpvc[32];
} LcaAtmHeaders;

typedef LcaAtmHeaders LcaDefineAtmHeadersMsgReq;
extern MsgLayout      LcaDefineAtmHeadersLayout;

typedef struct {
  uint32 sources[9]; 
  uint8  cells[432];
} LcaSnoopedCells;

typedef struct {
  uint8 direction;
  uint8 priority;
} LcaSnoopId;

typedef LcaSnoopId      LcaGetSnoopedCellsMsgReq;
typedef LcaSnoopedCells LcaGetSnoopedCellsMsgRep;
extern  MsgLayout       LcaGetSnoopedCellsLayout;

typedef struct {
  uint16 majorSoftwareVersion;
  uint8  minorSoftwareVersion; 
  uint8  fixSoftwareVersion;
  uint16 reserved;
  uint8  hmiMajorVersion;
  uint8  hmiMinorVersion;
} LcaVersion;

typedef LcaVersion LcaGetVersionMsgRep;
extern  MsgLayout  LcaGetVersionLayout;

typedef struct {
  uint16 noOfBuffers[8];
} LcaDownstreamBufferConfig;

typedef LcaDownstreamBufferConfig LcaConfigDownstreamBuffersMsgReq;
extern  MsgLayout                 LcaConfigDownstreamBuffersLayout;

typedef struct {
  uint32 status[2];
  uint32 mask[2];
} LcaInterruptStatus;

typedef LcaInterruptStatus LcaGetInterruptStatusMsgRep;
extern  MsgLayout          LcaGetInterruptStatusLayout;

typedef struct {
  uint32 affectedInterrupts[2];
  uint32 newMask[2];
} LcaInterruptMask;

typedef LcaInterruptMask LcaSetInterruptMaskMsgReq;
extern  MsgLayout        LcaSetInterruptMaskLayout;

typedef struct {
  uint8 mac[6];
  uint8 enabled;
} LcaMacEntry;

typedef LcaMacEntry LcaGetMacEntryMsgRep;
typedef uint16      LcaGetMacEntryMsgReq;
extern  MsgLayout   LcaGetMacEntryLayout;

typedef struct {
  uint8  filter;
  uint8  reserved1;
  uint16 etherType;
  uint8  ipProtocol;
  uint8  reserved2;
  uint16 srcPort;
  uint16 dstPort;
  uint8  srcPortMask;
  uint8  dstPortMask;
  uint16 flags;
  uint8  grouping;
  uint8  reserved3;
} LcaProtocolFilterSetting;

typedef LcaProtocolFilterSetting LcaSetProtocolFilterMsgReq;
extern  MsgLayout                LcaSetProtocolFilterLayout;

typedef struct {
  uint8 noOfCells;
  uint8 data[53*8];
} LcaF4F5;

typedef LcaF4F5   LcaGetF4F5MsgRep;
extern  MsgLayout LcaGetF4F5Layout;

typedef struct {
  uint8 buffer;
  uint8 overrideVpvc;
  uint8 endOfFrame;
  uint8 direction; 
  uint8 data[53];
} LcaInjectedCell;

typedef struct {
  uint8 noOfCells;
  LcaInjectedCell cells[8];
} LcaInjectedFrame;

typedef LcaInjectedFrame LcaInjectFrameMsgReq;
extern  MsgLayout        LcaInjectFrameLayout;

typedef uint32      LcaOamCell[12];
typedef LcaOamCell  LcaWriteOamMsgReq;
extern  MsgLayout   LcaWriteOamLayout;

typedef struct {
  Bool   enable;
  uint8  pos;
  uint8  line;
  uint8  port;
  uint16 buffer;
} LcaMonitoredPort;

typedef LcaMonitoredPort LcaMonitorMulticastMsgReq;
extern  MsgLayout        LcaMonitorMulticastLayout;

#endif
