📄 piport.h
字号:
/*
* Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
* All rights reserved.
*
* This software is copyrighted by and is the sole property of
* VIA Networking Technologies, Inc. This software may only be used
* in accordance with the corresponding license agreement. Any unauthorized
* use, duplication, transmission, distribution, or disclosure of this
* software is expressly forbidden.
*
* This software is provided by VIA Networking Technologies, Inc. "as is"
* and any express or implied warranties, including, but not limited to, the
* implied warranties of merchantability and fitness for a particular purpose
* are disclaimed. In no event shall VIA Networking Technologies, Inc.
* be liable for any direct, indirect, incidental, special, exemplary, or
* consequential damages.
*
*
* File: piport.h
*
* Purpose: Port module UI callback functions
*
* Author: Tevin Chen
*
* Date: Jan 08, 2002
*
*/
#ifndef _PIPORT_H
#define _PIPORT_H
#include "ttype.h"
#if !defined(__SWCFG_H__)
#include "swcfg.h"
#endif
#include "engine.h"
/*--------------------- Export Classes -----------------------------*/
////
// struct of port control
typedef struct tagSMegaPortCfg { // Single port config
BITS8 f1Enable: 1; // port enable
BITS8 f1Auto: 1; // port auto
BITS8 f3SpdDpx: 3; // Auto negotiation ability and Port speed & duplex config
BITS8 f1FC: 1; // Flow control ability
} SMegaPortCfg;
typedef struct tagSGigaPortCfg { // Single port config
BITS8 f2Enable: 2; // port enable
BITS8 f2Auto: 2; // port auto
BITS8 f4SpdDpx: 4; // Auto negotiation ability and Port speed & duplex config
BITS8 f2FC: 2; // Flow control ability
} SGigaPortCfg;
typedef struct tagSPortPageCfg { // Port system config
SMegaPortCfg aSMegaPortCfg[SWITCH_MEGA_PORT_NUM]; // Configuration of each mega port
SGigaPortCfg aSGigaPortCfg[SWITCH_GIGA_PORT_NUM]; // Configuration of each giga port
// for UI engine, it should be put in last for skipping when saving to eeprom
UINT8 abyGigaPortName[SWITCH_GIGA_PORT_NUM];
SStringTableMap aSStrTblMap[SWITCH_GIGA_PORT_NUM][4];
} SPortPageCfg;
// operator for PIPORT_byOp()
enum {
PORT_OP_EEP_TO_BUF,
PORT_OP_BUF_TO_EEP_HW,
PORT_OP_BUF_TO_HW
};
////
// struct of port status
struct tagSPortStatus { // Single port config
BITS8 f2Enable: 2; // port enable
BITS8 f2LinkUp: 2; // If port link state
BITS8 f4SpdDpx: 4; // Auto negotiation ability and Port speed & duplex config
BITS8 f2FlowCtrl: 2; // Flow control ability
};
typedef struct tagSPortStatus SPortStatus;
typedef struct tagSPortStatusPage { // Port system config
SPortStatus aSPortStatus[SWITCH_PORT_NUM];
} SPortStatusPage;
/*--------------------- Export Definitions -------------------------*/
#define EEP_SIZE_PORT_CFG 28 //(sizeof(SMegaPortCfg)*SWITCH_MEGA_PORT_NUM + sizeof(SGigaPortCfg)*SWITCH_GIGA_PORT_NUM)
#define EEP_ADDR_MEGA_PORT_CFG EEP_ADDR_PORT_CFG
#define EEP_SIZE_MEGA_PORT_OFFSET 1 //sizeof(SMegaPortCfg)
#define EEP_SIZE_MEGA_PORT_CFG SWITCH_MEGA_PORT_NUM //(EEP_SIZE_MEGA_PORT_OFFSET * SWITCH_MEGA_PORT_NUM)
#define EEP_ADDR_GIGA_PORT_CFG (EEP_ADDR_PORT_CFG + EEP_SIZE_MEGA_PORT_CFG)
#define EEP_SIZE_GIGA_PORT_OFFSET 2 //sizeof(SGigaPortCfg)
/*--------------------- Export Macro --------------------------*/
// Get config from EEPROM and set into hardware (combine with QOS)
// boot init: eep -> hw
#define PIPORT_vSetHwFromEep(pSPageCfg_Port) do {PIPORT_byOp(pSPageCfg_Port, PORT_OP_EEP_TO_BUF, 0);PIPORT_byOp(pSPageCfg_Port, PORT_OP_BUF_TO_HW, 0);} while (0)
// Get config from EEPROM and set into page buf
// load config: eep -> buf
#define PIPORT_vInitPage(pSPageCfg_Port) PIPORT_byOp(pSPageCfg_Port, PORT_OP_EEP_TO_BUF, 0)
// Write config to EEPROM and set to hardware
// save config: buf -> eep, hw
#define PIPORT_bySavePage(pSPageCfg_Port, pbyRtnPortId) PIPORT_byOp(pSPageCfg_Port, PORT_OP_BUF_TO_EEP_HW, pbyRtnPortId)
/*--------------------- Export Functions --------------------------*/
// Operate within buf, eep, and hw
// shared with piportcl and piqos and used for macros only
UINT8 PIPORT_byOp(SPortPageCfg* pSPageCfg_Port, UINT8 byOp, PUINT8 pbyRtnPortId);
// Write default into EEPROM (combine with QOS)
void PIPORT_vSetEepDefault(SPortPageCfg* pSPageCfg_Port, BOOL bWriteDefault);
// Get port status
void PIPORT_vGetPortStatus(SPortStatusPage* pSPage_PortStatus);
// Definition for page status: the index of string array for N/A
#define LISTBOX_ONOFF_NA 2
#define LISTBOX_ENDIS_NA 2
#define LISTBOX_SPDDPX_NA PORT_SPDPX_NA
#define LISTBOX_LINK_NA 2
#endif /* __PIPORT_H__ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -