📄 ixatmmutopiacfg.c
字号:
/** * @file IxAtmmUtopiaCfg.c * @author Intel Corporation * @date 6-MAR-2002 * * @brief * * * @par * IXP400 SW Release version 2.1 * * -- Copyright Notice -- * * @par * Copyright (c) 2001-2005, Intel Corporation. * All rights reserved. * * @par * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the Intel Corporation nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * * @par * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``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 THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * * @par * -- End of Copyright Notice -- *//* * Put the system defined include files required *//* * Put the user defined include files required */#include "IxOsal.h"#include "IxAtmm.h"#include "IxAtmdAccCtrl.h"#include "IxAtmmUtopiaCfg_p.h"/* * Typedefs. *//* * #defines and macros used in this file. *//* * Max number of loopback ports supported. */#define IX_ATMM_MAX_LOOPBACK_PORTS 1/* * Indicates the number of utopia ports to configure. */#define IX_ATMM_NUM_PORTS_1 1#define IX_ATMM_NUM_PORTS_2 2#define IX_ATMM_NUM_PORTS_3 3#define IX_ATMM_NUM_PORTS_4 4#define IX_ATMM_NUM_PORTS_5 5#define IX_ATMM_NUM_PORTS_6 6#define IX_ATMM_NUM_PORTS_7 7#define IX_ATMM_NUM_PORTS_8 8#define IX_ATMM_NUM_PORTS_9 9#define IX_ATMM_NUM_PORTS_10 10#define IX_ATMM_NUM_PORTS_11 11 #define IX_ATMM_NUM_PORTS_12 12/* * defines for enabling, disabling or ignoring paramaters */#define IX_ATMM_ENABLE 1#define IX_ATMM_DISABLE 0#define IX_ATMM_IGNORE 0/* * ATM Master mode */#define IX_ATMM_ATM_MASTER 0/* * PHY Slave mode */#define IX_ATMM_PHY_SLAVE 1/* * Cell size supported */#define IX_ATMM_RX_CELL_SIZE 53#define IX_ATMM_TX_CELL_SIZE 52/* * These defines specify the vci/vpi, port on which statistics will be gathered. * These are hard coded at compile time. Utopia statistics config cannot be reconfigured * at run time. */#define IX_ATMM_UT_TX_STATS_CONFIG_PHY_ADDR 0#define IX_ATMM_UT_TX_STATS_CONFIG_VPI 100#define IX_ATMM_UT_TX_STATS_CONFIG_VCI 1#define IX_ATMM_UT_TX_STATS_CONFIG_PTI 0#define IX_ATMM_UT_TX_STATS_CONFIG_CLP 0#define IX_ATMM_UT_RX_STATS_CONFIG_PHY_ADDR 0#define IX_ATMM_UT_RX_STATS_CONFIG_VPI 100#define IX_ATMM_UT_RX_STATS_CONFIG_VCI 1 #define IX_ATMM_UT_RX_STATS_CONFIG_PTI 0#define IX_ATMM_UT_RX_STATS_CONFIG_CLP 0/* * Variable declarations global to this file only. Externs are followed by * static variables. */static BOOL ixAtmmLoopbackOn = FALSE;/* * Global variable for show purposes */IxAtmdAccUtopiaConfig ixAtmmUtCfg;/* * Static function prototypes */PRIVATE BOOL phyCfgValidate (unsigned numPorts, IxAtmmPhyMode phyMode, IxAtmmPortCfg portCfgs[]);PRIVATEIX_STATUS utCfgParamsCheck (unsigned numPorts, IxAtmmPhyMode phyMode, IxAtmmPortCfg portCfgs[], IxAtmmUtopiaLoopbackMode loopbackMode);PRIVATE void utopiaConfigCreate (unsigned numPorts, IxAtmmPhyMode phyMode, IxAtmmPortCfg portCfgs[], IxAtmdAccUtopiaConfig *utCfg, IxAtmmUtopiaLoopbackMode loopbackMode);PRIVATE void utopiaTxConfigCreate (unsigned numPorts, IxAtmmPhyMode phyMode, IxAtmmPortCfg portCfgs[], IxAtmdAccUtopiaConfig *utCfg, IxAtmmUtopiaLoopbackMode loopbackMode);PRIVATE void utopiaRxConfigCreate (unsigned numPorts, IxAtmmPhyMode phyMode, IxAtmmPortCfg portCfgs[], IxAtmdAccUtopiaConfig *utCfg, IxAtmmUtopiaLoopbackMode loopbackMode);PRIVATE void utopiaSysConfigCreate (IxAtmdAccUtopiaConfig *utCfg);PRIVATE void utopiaRxTransTableSetup (unsigned numPorts, IxAtmmPortCfg portCfgs[], IxAtmdAccUtopiaConfig *utCfg);PRIVATE void utopiaTxTransTableSetup (unsigned numPorts, IxAtmmPortCfg portCfgs[], IxAtmdAccUtopiaConfig *utCfg);PRIVATE IX_STATUS utCfgShow (void);PRIVATE IX_STATUS utStatusShow (void);PRIVATE voidutopiaSysConfigReset (IxAtmdAccUtopiaConfig *utCfg);IX_STATUS ixAtmdAccUtopiaConfigReset (const IxAtmdAccUtopiaConfig * utConfig);/* ------------------------------------------------------ Function definitions visable to this file only. ------------------------------------------------------ */IX_STATUSixAtmmUtopiaCfgInit (unsigned numPorts, IxAtmmPhyMode phyMode, IxAtmmPortCfg portCfgs[], IxAtmmUtopiaLoopbackMode loopbackMode){ IX_STATUS retval; retval = utCfgParamsCheck (numPorts, phyMode, portCfgs, loopbackMode); /* Loopback mode */ if (retval == IX_SUCCESS) { if (loopbackMode == IX_ATMM_UTOPIA_LOOPBACK_ENABLED) { ixAtmmLoopbackOn = TRUE; } /* Clear the config struct */ ixOsalMemSet (&ixAtmmUtCfg, 0, sizeof (IxAtmdAccUtopiaConfig)); /* Fill out the utopia config structure */ utopiaConfigCreate (numPorts, phyMode, portCfgs, &ixAtmmUtCfg, loopbackMode); /* Call IxAtmdAcc to write the config */ retval = ixAtmdAccUtopiaConfigSet (&ixAtmmUtCfg); } return retval;}IX_STATUSixAtmmUtopiaCfgUninit (void){ IX_STATUS retval; /* Fill out the utopia Sysconfig structure to reset*/ utopiaSysConfigReset (&ixAtmmUtCfg); /* Call IxAtmdAcc to write the Config */ retval = ixAtmdAccUtopiaConfigReset (&ixAtmmUtCfg); /* Clear the Config struct */ ixOsalMemSet (&ixAtmmUtCfg, 0, sizeof (IxAtmdAccUtopiaConfig)); return retval;}PUBLIC IX_STATUSixAtmmUtopiaStatusShow (void){ IX_STATUS retval = IX_SUCCESS; if (IX_SUCCESS != utStatusShow ()) { retval = IX_FAIL; } return retval;}PUBLIC IX_STATUSixAtmmUtopiaCfgShow (void){ IX_STATUS retval = IX_SUCCESS; if ((IX_SUCCESS != utStatusShow ()) || (IX_SUCCESS != utCfgShow ())) { retval = IX_FAIL; } return retval;}/* ------------------------------------------------------ Function definitions visable to this file only. ------------------------------------------------------ */PRIVATEIX_STATUS utCfgParamsCheck (unsigned numPorts, IxAtmmPhyMode phyMode, IxAtmmPortCfg portCfgs[], IxAtmmUtopiaLoopbackMode loopbackMode){ /* Validate input parameters */ if ((numPorts == 0) || (numPorts > IX_UTOPIA_MAX_PORTS)) { return IX_ATMM_RET_INVALID_PORT; } if ((loopbackMode != IX_ATMM_UTOPIA_LOOPBACK_DISABLED) && (loopbackMode != IX_ATMM_UTOPIA_LOOPBACK_ENABLED)) { return IX_FAIL; } /* Loopback allowed on 1 port only */ if ((loopbackMode == IX_ATMM_UTOPIA_LOOPBACK_ENABLED) && (numPorts > IX_ATMM_MAX_LOOPBACK_PORTS)) { return IX_FAIL; }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -