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

📄 ixf6048.c

📁 开发Inetl IXP2400平台所必须的硬件诊断和测试程序。该软件包支持的功能包括CPU基本功能检测
💻 C
📖 第 1 页 / 共 5 页
字号:
/*
 *---------------------------------------------------------------------------
 *                                                                      
 *                  I N T E L   P R O P R I E T A R Y                   
 *                                                                      
 *     COPYRIGHT (c)  2001 BY  INTEL  CORPORATION.  ALL RIGHTS          
 *     RESERVED.   NO  PART  OF THIS PROGRAM  OR  PUBLICATION  MAY      
 *     BE  REPRODUCED,   TRANSMITTED,   TRANSCRIBED,   STORED  IN  A    
 *     RETRIEVAL SYSTEM, OR TRANSLATED INTO ANY LANGUAGE OR COMPUTER    
 *     LANGUAGE IN ANY FORM OR BY ANY MEANS, ELECTRONIC, MECHANICAL,    
 *     MAGNETIC,  OPTICAL,  CHEMICAL, MANUAL, OR OTHERWISE,  WITHOUT    
 *     THE PRIOR WRITTEN PERMISSION OF :                                
 *                                                                      
 *                        INTEL  CORPORATION                            
 *                                                                     
 *                     2200 MISSION COLLEGE BLVD                        
 *                                                                      
 *               SANTA  CLARA,  CALIFORNIA  95052-8119                  
 *                                                                      
 *---------------------------------------------------------------------------
 * Project: IXF6048
 *
 * Purpose: Provides the API for Ixf6048 Specific routines.  This
 *          is meant to glue the new and old api together for 
 *          backward compatibilty.
 *			
 * Notes:
 *			
 * --------------------------------------------------------------------------
 */ 

/* --------------------------	--------------------------	
	Header Files To include for Project
   --------------------------	--------------------------	*/
#include "common_types.h"
#include "common_def.h"
#include "ixf_api_d.h" /* BroadBand Utility Definitions and Function headers */
#include "ixf_api_sonet_d.h" /* Include Sonet data definitions */
#include "ixf6048b.h" /* Include additional Amazon-A Bit definitions */
#include "ixf6048d.h" /* Include additional Amazon-A data definitions */
#include "hal.h"


#define Ixf6048SetBitVal(Reg, Bit) ((Reg) = (Bit | Reg))
#define Ixf6048ClrBitVal(Reg, Bit) ((Reg) = (~(Bit) & Reg))

#define Ixf6048SetBit(RegAddr, Bit) (WRITE_TO_HW((bb_RegPointer_type)RegAddr, (Bit | READ_FROM_HW((bb_RegPointer_type)RegAddr))))
#define Ixf6048ClrBit(RegAddr, Bit) (WRITE_TO_HW((bb_RegPointer_type)RegAddr, (~(Bit) & READ_FROM_HW((bb_RegPointer_type)RegAddr))))

/***********************************************************************
 * Static data: C runtime inits to 0
 **********************************************************************/
#if 0
/* Pointer to the Alarm Callback Function */
static ixf6048_pAlarmCallback   pAlarmCallback = NULL;
static boolean AlarmsUsed = FALSE;  /* Only Enable Alarms if this is TRUE */

static ushort _TxUtopiaAlarms;     /* Used for Utopia Tx Interrupt Register*/
static ushort _RxUtopiaAlarms;     /* Used for Utopia Rx Interrupt Register*/
static ushort _PRBSAlarms;         /* Used for PRBS Interrupt Register*/
static ushort _TxAlarmBusAlarms;   /* Used for TxAlarmBus Interrupt Register*/
static ushort _LineSideParityAlarm;/* Used for LSP Interrupt Register*/
#endif

/* Define the Channels Available */
#define ixf6048_CHANEL_0    0
#define ixf6048_CHANEL_1    1
#define ixf6048_CHANEL_2    2
#define ixf6048_CHANEL_3    3

#define IXF6048_VALIDATE_CHANNEL(chan) ((chan > 3) ? FALSE : TRUE)

/*QMode related Constants */
#define SINGLE_CHANNEL_MODE 1
#define QUAD_CHANNEL_MODE   4

const int IXF6048_CHANNEL_MASK_ALARM_ARRAY[MAX_NUM_CHANNELS] = 
{
    ixf6048_mCHAN0_ALARM,  /* 0x1111 Mask for channel 0 alarms */ 
    ixf6048_mCHAN1_ALARM,  /* 0x2222 Mask for channel 1 alarms */
    ixf6048_mCHAN2_ALARM,  /* 0x4444 Mask for channel 2 alarms */
    ixf6048_mCHAN3_ALARM   /* 0x8888 Mask for channel 3 alarms */
};

/* Used to Convert the RcvJn_Cfg bits to bb_TraceFormat_e */
const bb_TraceFormat_e IXF6048_RCV_TRACE_FORMAT_ARR[] = 
{
   bb_1_BYTE,                 /* 00x 1 byte */
   bb_1_BYTE,                 /* 00x 1 byte */
   bb_IGNORE_RX_TRACE,        /* 01X Ignore trace on Rx */
   bb_IGNORE_RX_TRACE,        /* 01X Ignore trace on Rx */
   bb_16_BYTE_WITH_CRC7,      /* 10X 16 bytes, starting with CRC7 (SDH) */
   bb_16_BYTE_WITH_CRC7,      /* 10X 16 bytes, starting with CRC7 (SDH) */
   bb_64_BYTE_FREE_FORM,      /* 110 64 bytes, free form */
   bb_64_BYTE_WITH_LF_CR,     /* 111 64 bytes with LF,CR at end */ 
};

/* Used to Convert the XmtJn_Cfg bits to bb_TraceFormat_e */
const bb_TraceFormat_e IXF6048_TX_TRACE_FORMAT_ARR[] = 
{
   bb_1_BYTE,                   /* 00 1 byte */
   bb_DEFAULT_TX_TRACE,         /* 01 1 byte (0x01) */
   bb_16_BYTE_WITH_CRC7,        /* 10 Ignore trace on Rx */
   bb_64_BYTE_FREE_FORM         /* 11 Ignore trace on Rx */
};

/* ---------------------------------------------------------------------
   Used to Convert ixf6048_LcdFilter_e members to Actual LCD Filter values
      -- Note that the Value is configured as 2 16 byte values to correspond 
         to the 2 registers that make up the LCD filter */
#define NUM_OF_TIME_PERIODS   4    /* 1ms, 2ms, 3ms, 4ms */
#define NUM_OF_OC_TYPES       4    /* OC-1, OC-3, OC-12, OC-48 */
#define NUM_REGISTERS         2    /* Register (1cc)23H and (1cc)22H */

      /* Corresponding Array Offsets */
#define LCD_FILTER_MSB_OFFSET  0
#define LCD_FILTER_LSB_OFFSET  1

#define OC1_INTERFACE   0
#define OC3_INTERFACE   1
#define OC12_INTERFACE  2
#define OC48_INTERFACE  3

const ushort LCD_FILTER_CONFIGURATION_TABLE[NUM_OF_OC_TYPES][NUM_OF_TIME_PERIODS][NUM_REGISTERS] =
{/*  MSB LSB    MSB LSB    MSB LSB    MSB LSB */
   { {0,0x0654},{0,0x0CA8},{0,0x12FC},{0,0x1950} },    /* OC 1 */
   { {0,0x12FC},{0,0x25F8},{0,0x38F4},{0,0x4BF0} },    /* OC 3 */
   { {0,0x4BF0},{0,0x97E0},{0,0xE3D0},{1,0x2FC0} },    /* OC 12*/
   { {1,0x2FC0},{2,0x5F81},{4,0x8F41},{4,0xBF02} }     /* OC 48*/
};

/* --------------- Miscelaneous Constants ------------------- */
/* Used for HDLC Flow Control */
#define HDLC_FLOW_CONTROL_SCALING_FACTOR_256    256

/***********************************************************************
 *
 * Writable area reserved for Driver
 *
 **********************************************************************/

typedef enum
{
    eINT_EFFECT_NONE,
        eINT_EFFECT_MINOR,
        eINT_EFFECT_MAJOR,
        eINT_EFFECT_CATASTROPHIC
} ActiveInterruptEffect_e;

/***********************************************************************
 *
 * Static Function Prototypes -- Private Methods
 *
 **********************************************************************/
/* ------------------ Initialization ------------------ */
#if 0
static bb_Error_e InitChanCfg(ushort*             BaseAddress,
    ixf6048_Side_e      Side,
    ixf6048_ChipCfg_t*  pChipCfg);

/* ------------------ Edit Chip Level Configuration ------------------ */
static bb_Error_e EditChipLevelCfg(ushort*      		   BaseAddress,
    ixf6048_Side_e 		   Side,
    ixf6048_ChipLevelCfg_t* pCfg);

static bb_Error_e EditUtopiaChipCfg(ushort*                  BaseAddress,
    ixf6048_Side_e       	 Side,
    ixf6048_UtopiaChipCfg_t* pCfg);

static bb_Error_e EditPosChipCfg(ushort*               BaseAddress,
    ixf6048_Side_e        Side,
    ixf6048_PosChipCfg_t* pPosChipfg);
#endif
static void SetPosWatermarks( ushort*                  BaseAddress,
    uint                     ChanNum, 
    ixf6048_Side_e           Side,
    ixf6048_PosWatermarks_t* pPosWatermarks);


/* ------------------ Edit the channel configuration  ------------------ */
static bb_Error_e EditChanCfg (ushort*            BaseAddress,
    int                ChanNum,
    ixf6048_Side_e     Side,
    ixf6048_ChanCfg_t* pCfg);

static bb_Error_e EditChanIfCfg(ushort*              BaseAddress,
    uint                 ChanNum,
    ixf6048_Side_e       Side ,
    ixf6048_ChanMode_e   ChanMode,
    ixf6048_ChanIfCfg_t* pCfg);

static bb_Error_e EditOhtChanCfg(ushort*               BaseAddress,
    uint                  ChanNum, 
    ixf6048_Side_e        Side,
    ixf6048_OhtChanCfg_t* pCfg);

static bb_Error_e EditAtmChanCfg(ushort*               BaseAddress,
    uint                  ChanNum, 
    ixf6048_Side_e        Side,
    ixf6048_AtmChanCfg_t* pCfg);

static bb_Error_e EditPosChanCfg(ushort*               BaseAddress,
    uint                  ChanNum, 
    ixf6048_Side_e        Side,
    ixf6048_PosChanCfg_t* pCfg);

/* --------------------- Edit Alarm Configuration ---------------------- */
      /* Enables/Disables for Channel specific Alarms */
static bb_Error_e EditAlarms (ushort*             BaseAddress,
    ixf6048_Side_e      Side,
    ixf6048_ChipCfg_t*  pChipCfg,
    ixf6048_AlarmCfg_t* pAlarmCfg);

bb_Error_e  EditOhtChanAlarms(ushort*                    BaseAddress, 
    uint                       ChanNum, 
    ixf6048_Side_e             Side,
    ixf6048_OhtChanAlarmCfg_t* pOhtChanAlms);

bb_Error_e  EditUtopiaChanAlarms(ushort*                   BaseAddress, 
    uint                      ChanNum, 
    ixf6048_Side_e             Side,
    ixf6048_UtopiaAlarmsCfg_t* pUtopiaChanAlms);

bb_Error_e  EditAtmChanAlarms(ushort*                    BaseAddress, 
    uint                       ChanNum, 
    ixf6048_Side_e             Side,
    ixf6048_AtmChanAlarmCfg_t* pAtmChanAlms);

bb_Error_e  EditPosChanAlarms(ushort*                    BaseAddress, 
    uint                       ChanNum, 
    ixf6048_Side_e             Side,
    ixf6048_PosChanAlarmCfg_t* pPosChanAlms);

bb_Error_e  EditMiscChanAlarms(ushort*                 BaseAddress, 
    uint                     ChanNum, 
    ixf6048_Side_e           Side,
    ixf6048_MiscAlarmsCfg_t* pMiscChanAlms);


/* ------------------ Alarm Handler Functions ------------------ */
#if 0
static void MasterInterruptHandler( ushort*           BaseAddress,  
    ixf6048_GlobalAlarmCfg_t *pGlobAlmCfg);

static void SdhInterruptHandler(ushort*  BaseAddress,   /* Base address of chip */
    ushort ChanNum,
    ushort GlobalAlmChan,
    ActiveInterruptEffect_e* EffectingInterrupt);

static void AtmInterruptHandler(ushort*  BaseAddress,   /* Base address of chip */
    ushort ChanNum,
    ushort GlobalAlmChan,
    ActiveInterruptEffect_e* EffectingInterrupt);

static void PosInterruptHandler(ushort*  BaseAddress,   /* Base address of chip */
    ushort ChanNum,
    ushort GlobalAlmChan,
    ActiveInterruptEffect_e* EffectingInterrupt);

static void UtopiaInterruptHandler(ushort*  BaseAddress,   /* Base address of chip */
    ushort   ChanNum,
    ushort   GlobalAlm,
    boolean* IntsRead,	  /* Enforce a Single Read */
    ActiveInterruptEffect_e* EffectingInterrupt);

static void MiscInterruptHandler(ushort*   BaseAddress,   /* Base address of chip */
    ushort   ChanNum,
    ushort   GlobalAlm,
    boolean* IntsRead,		/* Enforce a Single Read*/
    ActiveInterruptEffect_e* EffectingInterrupt);
#endif

/* ---------- Functions Related to reading/writing Trace Bytes ------------------  */
static bb_Error_e SetRcvJnPathTrace(ushort*           pReg,
    ushort*           pJnCfgMask,
    bb_TraceFormat_e  TraceFormat,
    char*             pTrace);

static bb_Error_e SetTxJnPathTrace(ushort*          pReg,
    ushort*          pJnCfgMask,
    bb_TraceFormat_e TraceFormat,
    char*            pTrace);

static boolean CfgOhtJnString(ushort*  pReg,
    char*   pWorkString, 
    int      StringLen);

static bb_Error_e GetRcvJnPathTrace(ushort*         pReg,
    ushort          pJnCfgMask,
    char*           pTrace, ushort* pLength);

static bb_Error_e GetTxJnPathTrace(ushort*         pReg,
    ushort          pJnCfgMask,
    char*          pTrace,         ushort*         pLength);

static boolean GetOhtJnString(ushort*  pReg,
    char*    pString, 
    int      StringLen);

/* ------------------ Functions Relating to Counters ------------------ */
#if 0
static void GetRstCounters(ushort*             BaseAddress,
    uint                ChanNum,    
    boolean             CntrsBuffFlag,
    bb_RxRstCounters_t* pRxRst);

static void GetMstCounters(ushort*             BaseAddress,
    uint                ChanNum,    
    boolean             CntrsBuffFlag,
    bb_RxMstCounters_t* pRxMst);

⌨️ 快捷键说明

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