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

📄 pivlnflt.c

📁 VIA VT6524 8口网管交换机源码
💻 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(__BITOP_H__)
#include "bitop.h"
#endif
#include "swvlan.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) DIRECT_FUNTYPE_REENT
{
    PIEEP_vGetCfgFromEep(EEP_ADDR_VLAN_INGRESS_FILTER, EEP_SIZE_VLAN_INGRESS_FILTER, (PBYTE)pSPageBuf);
    PICFGMP_v2bPhyMskTo2bLogPtrMsk( (PBYTE)pSPageBuf, (PBYTE)pSPageBuf );
}

void s_vSetHwFromBuf (SVlanIngrFilterPageCfg *pSPageBuf) DIRECT_FUNTYPE_REENT
{
    SVlanIngrFilterPageCfg  SIngrFiltrBuf;
    UINT8   byValBuf, si;

    // Transfer from buffer mask format into phy format then set into HW
    PICFGMP_v2bLogPtrMskTo2bPhyMsk( (PBYTE)pSPageBuf, (PBYTE)&SIngrFiltrBuf );
    for (si = 0; si < SWITCH_PORT_NUM; si++)
    {
        BITvExtractBits(SIngrFiltrBuf.abyCfg, (UINT8)(si*2), (UINT8)(si*2+1), &byValBuf);
        SWVLAN_vSetIngrsFilter(si, byValBuf);
    }
}


// Get config from EEPROM and set into hardware
void PIVLNFLT_vSetHwFromEep (SVlanIngrFilterPageCfg *pSPageBuf) DIRECT_FUNTYPE_REENT
{
    PIVLNFLT_vInitPage(pSPageBuf);
    s_vSetHwFromBuf(pSPageBuf);
}


// Set default vlan mode into EEPROM
void PIVLNFLT_vSetEepDefault (SVlanIngrFilterPageCfg *pSPageBuf) DIRECT_FUNTYPE_REENT
{
    STRvMemset(pSPageBuf, DEFAULT_VLAN_INFILT_BYTE_CFG, EEP_SIZE_VLAN_INGRESS_FILTER);
    PIEEP_vSetCfgIntoEep( (PBYTE)pSPageBuf, EEP_ADDR_VLAN_INGRESS_FILTER, EEP_SIZE_VLAN_INGRESS_FILTER );
    PIEEP_vUpdateChecksum();
}


// Save current page config into both EEPROM & HW
void PIVLNFLT_vSavePage (SVlanIngrFilterPageCfg *pSPageBuf) DIRECT_FUNTYPE_REENT
{
    SVlanIngrFilterPageCfg  SIngrFiltrBuf;

    // Transfer from buffer mask format into EEPROM format
    PICFGMP_v2bLogPtrMskTo2bPhyMsk( (PBYTE)pSPageBuf, (PBYTE)&SIngrFiltrBuf );
    PIEEP_vSetCfgIntoEep( (PBYTE)&SIngrFiltrBuf, EEP_ADDR_VLAN_INGRESS_FILTER, EEP_SIZE_VLAN_INGRESS_FILTER );
    PIEEP_vUpdateChecksum();
    s_vSetHwFromBuf(pSPageBuf);
}

⌨️ 快捷键说明

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