📄 pirate.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: pirate.c
*
* Purpose:
*
* Author: Jenda Jao
*
* Date: 0213, 2003
*
* Functions:
*
* Revision History:
*
*/
#include "swrate.h"
#include "str.h"
#include "piportmp.h"
#include "pigencfg.h"
#include "pieeprom.h"
#include "pirate.h"
/*--------------------- Static Definitions -------------------------*/
/*--------------------- Static Classes ----------------------------*/
/*--------------------- Static Variables --------------------------*/
/*--------------------- Static Functions --------------------------*/
/*--------------------- Export Variables --------------------------*/
/*--------------------- Export Macros -----------------------------*/
/*--------------------- Export Functions --------------------------*/
void PIRATE_vSetEepDefault(SRatePageCfg* pSPageCfg_Rate) DIRECT_FUNTYPE_REENT
{
STRvMemset(pSPageCfg_Rate, 0, EEP_SIZE_RATE_CFG);
PIEEP_vSetCfgIntoEep((PBYTE)pSPageCfg_Rate, EEP_ADDR_RATE_CFG, EEP_SIZE_RATE_CFG);
PIEEP_vUpdateChecksum();
}
void PIRATE_vOp(SRatePageCfg* pSPageCfg_Rate, BYTE byOp) DIRECT_FUNTYPE_REENT
{
UINT32 dwPhyPortMask;
BYTE byPhyPID, byLogPortIndex=0;
for (byLogPortIndex=0; byLogPortIndex<g_byLogIdNum; byLogPortIndex++)
{
dwPhyPortMask = PIPORTMP_dwLogPtrToPhyMsk(byLogPortIndex);
for (byPhyPID=0; byPhyPID<SWITCH_MEGA_PORT_NUM; byPhyPID++)
{
if (dwPhyPortMask & 0x01)
{
if (byOp == RATE_OP_EEP_TO_BUF)
{
PIEEP_vGetCfgFromEep(EEP_ADDR_RATE_CFG + byPhyPID*EEP_SIZE_RATE_PORT_OFFSET,
EEP_SIZE_RATE_PORT_OFFSET,
pSPageCfg_Rate->abyRate + byLogPortIndex*EEP_SIZE_RATE_PORT_OFFSET);
break;
}
// buf to eep and hw
else //if ((byOp == RATE_OP_BUF_TO_HW)||(byOp == RATE_OP_BUF_TO_EEP_HW))
{
// set to hw
SWRATE_vSetRateCtrl(byPhyPID, pSPageCfg_Rate->abyRate[byLogPortIndex*EEP_SIZE_RATE_PORT_OFFSET], pSPageCfg_Rate->abyRate[byLogPortIndex*EEP_SIZE_RATE_PORT_OFFSET+1]);
// save to eep
if (byOp == RATE_OP_BUF_TO_EEP_HW)
PIEEP_vSetCfgIntoEep(pSPageCfg_Rate->abyRate + byLogPortIndex*EEP_SIZE_RATE_PORT_OFFSET,
EEP_ADDR_RATE_CFG + byPhyPID*EEP_SIZE_RATE_PORT_OFFSET,
EEP_SIZE_RATE_PORT_OFFSET);
} // end if byOp
} // end if (dwPhyPortMask & 0x01)
dwPhyPortMask >>= 1;
} // end for byPhyPID
} // end for byLogPortIndex
if (RATE_OP_BUF_TO_EEP_HW)
PIEEP_vUpdateChecksum();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -