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

📄 piqos.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:    pipc_qos.c
 *
 * Purpose: Port control and QoS module shared UI callback functions
 *
 * Author:  Tevin Chen
 *
 * Date:    Jan 08, 2002
 *
 * Functions:
 *
 * Revision History:
 *
 */


#include "str.h"
#include "swport.h"
#include "swqos.h"
#include "piportmp.h"
#include "pigencfg.h"
#include "pieeprom.h"
#include "pipc_qos.h"
#include "pidef.h"


/*---------------------  Static Definitions -------------------------*/

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

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

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

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

/*---------------------  Export Macros  -----------------------------*/

/*---------------------  Export Functions  --------------------------*/

void PIQOS_vSetEepDefault (SQosPageCfg* pSPageCfg_Qos) DIRECT_FUNTYPE_REENT
{
    pSPageCfg_Qos->byQosMode = DEFAULT_QOS_MODE;
    pSPageCfg_Qos->by8021pMap = DEFAULT_8021P_MAP;
    STRvMemset(pSPageCfg_Qos->abyStaticPrior, DEFAULT_STATIC_PRIORITY, EEP_SIZE_PORT_QOS);

    PIEEP_vSetCfgIntoEep((PBYTE)pSPageCfg_Qos, EEP_ADDR_QOS_CFG, EEP_SIZE_QOS_CFG);
    PIEEP_vUpdateChecksum();
}

void PIQOS_vOp(SQosPageCfg* pSPageCfg_Qos, 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_PORT_NUM; byPhyPID++)
        {
            if (dwPhyPortMask & 0x01)
            {
                if (byOp == QOS_OP_EEP_TO_BUF)
                {
                    PIEEP_vGetCfgFromEep(EEP_ADDR_PORT_QOS + byPhyPID,
                                         1,
                                         (PBYTE)(pSPageCfg_Qos->abyStaticPrior + byLogPortIndex));
                    break;
                }
                // buf to eep and hw
                else //if ((byOp == QOS_OP_BUF_TO_HW)||(byOp == QOS_OP_BUF_TO_EEP_HW))
                {
                    // set port priority (if QoS is disabled, disable static priority)
                    if (pSPageCfg_Qos->byQosMode == QOS_FCFS)
                        SWQOS_vSetStaticPrior(byPhyPID, QOS_PORT_PRIORI_DISABLE);
                    else
                        SWQOS_vSetStaticPrior(byPhyPID, pSPageCfg_Qos->abyStaticPrior[byLogPortIndex]);

                    if (byOp == QOS_OP_BUF_TO_EEP_HW)
                        PIEEP_vSetCfgIntoEep((PBYTE)(pSPageCfg_Qos->abyStaticPrior + byLogPortIndex), EEP_ADDR_PORT_QOS + byPhyPID, 1);
                }   // end if byOp
            }   // end if (dwPhyPortMask & 0x01)
            dwPhyPortMask >>= 1;
        } // end for byPhyPID
    } // end for byLogPortIndex

    if (byOp == QOS_OP_EEP_TO_BUF)
    {
        // get qos cfg
        PIEEP_vGetCfgFromEep(EEP_ADDR_MISC_QOS, EEP_SIZE_MISC_QOS, (PBYTE)pSPageCfg_Qos);
    }
    else // if ((byOp == QOS_OP_BUF_TO_HW)||(byOp == QOS_OP_BUF_TO_EEP_HW))
    {
        SWQOS_vSetQosCfg(pSPageCfg_Qos->byQosMode);
        SWQOS_vSet8021pPriorMap(pSPageCfg_Qos->by8021pMap);
    }

    if (QOS_OP_BUF_TO_EEP_HW)
    {
        PIEEP_vSetCfgIntoEep((PBYTE)pSPageCfg_Qos, EEP_ADDR_MISC_QOS, EEP_SIZE_MISC_QOS);
        PIEEP_vUpdateChecksum();
    }
}

⌨️ 快捷键说明

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