📄 swprimtb.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: swprimtb.c
*
* Purpose: tos/dscp to 802.1p priority mapping table
*
* Author: Wango Wei
*
* Date: March 24, 2005
*
* Functions:
*
* Revision History:
*
*/
#if !defined(__SWITCH_H__)
#include "switch.h"
#endif
#if !defined(__SWPRIMTB_H__)
#include "swprimtb.h"
#endif
#if !defined(__SWSRAM_H__)
#include "swsram.h"
#endif
/*--------------------- Static Definitions ------------------------*/
#define DCSP_NUM_PER_MEM_ENTYR 8
/*--------------------- Static Types ------------------------------*/
/*--------------------- Static Macros -----------------------------*/
/*--------------------- Static Classes ----------------------------*/
/*--------------------- Static Variables --------------------------*/
/*--------------------- Static Functions --------------------------*/
/*--------------------- Export Variables --------------------------*/
BOOL SWPRIM_bReadEntry (UINT8 u8Dscp, UINT8 *pu8Pri)
{
UINT8 abyEntryBuf[SRAM_ENTRY_SIZE_4Byte], byMemEntryNum, byId;
if ((u8Dscp > DSCP_MAX))
return FALSE;
byMemEntryNum = u8Dscp / DCSP_NUM_PER_MEM_ENTYR;
byId = u8Dscp % DCSP_NUM_PER_MEM_ENTYR;
SWSRAM_bReadEntry(SRAM_TOSDSCP_1P_MAP_TBL_BASE_ADDR + (byMemEntryNum*SRAM_ENTRY_SIZE_4Byte), abyEntryBuf);
SWSRAM_vExtractBitsByByte(abyEntryBuf, (byId*3), (byId*3)+2, pu8Pri);
return TRUE;
}
BOOL SWPRIM_bWriteEntry (UINT8 u8Dscp, UINT8 u8Pri)
{
UINT8 abyEntryBuf[SRAM_ENTRY_SIZE_4Byte], byMemEntryNum, byId;
if ((u8Dscp > DSCP_MAX) || (u8Pri > PRIORITY_MAX))
return FALSE;
byMemEntryNum = u8Dscp / DCSP_NUM_PER_MEM_ENTYR;
byId = u8Dscp % DCSP_NUM_PER_MEM_ENTYR;
SWSRAM_bReadEntry(SRAM_TOSDSCP_1P_MAP_TBL_BASE_ADDR + (byMemEntryNum*SRAM_ENTRY_SIZE_4Byte), abyEntryBuf);
SWSRAM_vModifyBitsByByte(abyEntryBuf, (byId*3), (byId*3)+2, &u8Pri);
SWSRAM_bWriteEntry(SRAM_TOSDSCP_1P_MAP_TBL_BASE_ADDR + (byMemEntryNum*SRAM_ENTRY_SIZE_4Byte), abyEntryBuf);
return TRUE;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -