📄 pivlnflt.c
字号:
/*
* 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: pivlnflt.c
*
* Purpose: VLAN ingress filtering setting UI callback functions
*
* Author: Tevin Chen
*
* Date: Jan 08, 2002
*
* Functions:
*
* Revision History:
*
*/
#include "str.h"
#if !defined(__SWSRAM_H__)
#include "swsram.h"
#endif
#include "swvlantb.h"
#include "piportmp.h"
#include "picfgmp.h"
#include "pivlan.h"
#include "pieeprom.h"
#include "pidef.h"
/*--------------------- Static Definitions -------------------------*/
/*--------------------- Static Classes ----------------------------*/
/*--------------------- Static Variables --------------------------*/
/*--------------------- Static Functions --------------------------*/
/*--------------------- Static Macros -----------------------------*/
/*--------------------- Export Variables --------------------------*/
/*--------------------- Export Functions --------------------------*/
// Get config from EEPROM and set into page buf
void PIVLNFLT_vInitPage (SVlanIngrFilterPageCfg *pSPageBuf)
{
PIEEP_vGetCfgFromEep(EEP_ADDR_VLAN_INGRS_FILTER, EEP_SIZE_VLAN_INGRS_FILTER, (PUINT8)pSPageBuf);
PICFGMP_v2bPhyMskTo2bLogPtrMsk( (PUINT8)pSPageBuf, (PUINT8)pSPageBuf );
}
void s_vSetHwFromBuf (SVlanIngrFilterPageCfg *pSPageBuf)
{
SVlanIngrFilterPageCfg SIngrFiltrBuf;
UINT8 byValBuf, si;
// Transfer from buffer mask format into phy format then set into HW
PICFGMP_v2bLogPtrMskTo2bPhyMsk( (PUINT8)pSPageBuf, (PUINT8)&SIngrFiltrBuf );
for (si = 0; si < SWITCH_PORT_NUM; si++)
{
SWSRAM_vExtractBitsByByte(SIngrFiltrBuf.abyCfg, (UINT8)(si*2), (UINT8)(si*2+1), &byValBuf);
SWVLANTB_vSetIngrsFilter(si, byValBuf);
}
}
// Get config from EEPROM and set into hardware
void PIVLNFLT_vSetHwFromEep (SVlanIngrFilterPageCfg *pSPageBuf)
{
PIVLNFLT_vInitPage(pSPageBuf);
s_vSetHwFromBuf(pSPageBuf);
}
// Set default vlan mode into EEPROM
void PIVLNFLT_vSetEepDefault (SVlanIngrFilterPageCfg *pSPageBuf, BOOL bWriteDefault)
{
STR_pvMemset(pSPageBuf, DEFAULT_VLAN_INGRS_FILTER_CFG, EEP_SIZE_VLAN_INGRS_FILTER);
if (bWriteDefault) {
// Set value to nvram software cache
STR_pvMemcpy(g_pu8NVRSwCache + (EEP_ADDR_VLAN_INGRS_FILTER - NVR_ADDR_DATA_AREA_START), (PUINT8)pSPageBuf, EEP_SIZE_VLAN_INGRS_FILTER);
}
else {
PIEEP_vSetCfgIntoEep( (PUINT8)pSPageBuf, EEP_ADDR_VLAN_INGRS_FILTER, EEP_SIZE_VLAN_INGRS_FILTER );
NVRAM_vUpdateChecksum(EEP_SIZE_DATA_AREA);
}
}
// Save current page config into both EEPROM & HW
void PIVLNFLT_vSavePage (SVlanIngrFilterPageCfg *pSPageBuf)
{
SVlanIngrFilterPageCfg SIngrFiltrBuf;
// Transfer from buffer mask format into EEPROM format
PICFGMP_v2bLogPtrMskTo2bPhyMsk( (PUINT8)pSPageBuf, (PUINT8)&SIngrFiltrBuf );
PIEEP_vSetCfgIntoEep( (PUINT8)&SIngrFiltrBuf, EEP_ADDR_VLAN_INGRS_FILTER, EEP_SIZE_VLAN_INGRS_FILTER );
NVRAM_vUpdateChecksum(EEP_SIZE_DATA_AREA);
s_vSetHwFromBuf(pSPageBuf);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -