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

📄 swfwd.c

📁 vt6528芯片交换机API函数和文档运行程序
💻 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:    swfwd.c
 *
 * Purpose: Switch hardware accessing functions related to forwarding operation
 *
 * Author:  Tevin Chen
 *
 * Date:    Nov 15, 2005
 *
 * Functions:
 *
 * Revision History:
 *
 */


#if !defined(__SWCFG_H__)
#include "swcfg.h"
#endif
#if !defined(__SWITCH_H__)
#include "switch.h"
#endif
#if !defined(__SWREG_H__)
#include "swreg.h"
#endif
#if !defined(__SWSRAM_H__)
#include "swsram.h"
#endif
#if !defined(__SWPMACTB_H__)
#include "swpmactb.h"
#endif
#if !defined(__SWFWD_H__)
#include "swfwd.h"
#endif




/*---------------------  Static Definitions  ------------------------*/
// for clear mac table
#define SPEEDUP_AGING_CYCLE         100
#define SPEEDUP_INTER_AGE_TIME      1
#define SPEEDUP_CLR_MACTBL_TIME     50  // 50 ms

// sg_au8AgeCycTimePtn is a lookup table for g_aszAutoAging, and beware array size
static UINT8 sg_au8AgeCycTimePtn[] = {
    0,              // aging off
    27,             // 150 sec  ;150/5.5 = 27.3
    55,             // 300 sec  ;300/5.5 = 54.5
    109             // 600 sec  ;600/5.5 = 109.1
};

/*---------------------  Static Types  ------------------------------*/

/*---------------------  Static Macros  -----------------------------*/

/*---------------------  Static Classes  ----------------------------*/

/*---------------------  Static Variables  --------------------------*/

/*---------------------  Static Functions  --------------------------*/


/*---------------------  Export Variables  --------------------------*/




void SWFWD_vSetAutoAgingCfg (UINT8 u8Opt)
{
    UINT16 u16Data;
    
    
    SWREG_vBitsOffU8(FWDCTL_AUTO_AGE_CFG, AUTO_AGE_EN);
    if (u8Opt != AUTO_AGING_OFF) {
        u16Data = sg_au8AgeCycTimePtn[u8Opt];
        SWREG_vWriteU16(FWDCTL_AUTO_AGE_CYCLE_TIME, u16Data);
        SWREG_vBitsOnU8(FWDCTL_AUTO_AGE_CFG, AUTO_AGE_EN);
    }
}



void SWFWD_vSetMacTblHashMode (BOOL bDriectMap)    
{
    if (bDriectMap) 
        SWREG_vBitsOnU8(FWDCTL_TBL_HASH, FWD_TBL_HASH_ALG_DIRECT);
    else
        SWREG_vBitsOffU8(FWDCTL_TBL_HASH, FWD_TBL_HASH_ALG_DIRECT);
}





⌨️ 快捷键说明

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