📄 bkcompat.c
字号:
OS_CMD_DEALLOC_MEM(pChipCfg->pChanCfg[ndx]);
}
OS_CMD_DEALLOC_MEM(pChipCfg->pChipLevelCfg);
OS_CMD_DEALLOC_MEM(pChipData->pChipCfg);
}
else
{
/* Exit with error.
The chip configuration parameter is not initialized */
return bb_NO_CHIP_CFG;
}
/* Deallocate memory for AlarmCfg */
if (pChipData->pAlarmCfg)
{
pAlarmCfg = (ixf6048_AlarmCfg_t *) pChipData->pAlarmCfg;
/* Cycle thru the channels */
for(ndx=0; ndx < MAX_NUM_CHANNELS; ndx++)
{
OS_CMD_DEALLOC_MEM(pAlarmCfg->pChanAlarmCfg[ndx]->pMiscAlarmsCfg);
OS_CMD_DEALLOC_MEM(pAlarmCfg->pChanAlarmCfg[ndx]->pPosChanAlarmCfg);
OS_CMD_DEALLOC_MEM(pAlarmCfg->pChanAlarmCfg[ndx]->pAtmChanAlarmCfg);
OS_CMD_DEALLOC_MEM(pAlarmCfg->pChanAlarmCfg[ndx]->pUtopiaAlarmsCfg);
OS_CMD_DEALLOC_MEM(pAlarmCfg->pChanAlarmCfg[ndx]->pOhtChanAlarmCfg);
OS_CMD_DEALLOC_MEM(pAlarmCfg->pChanAlarmCfg[ndx]);
}
OS_CMD_DEALLOC_MEM(pChipData->pAlarmCfg);
}
else
{
/* Exit with error.
The chip configuration parameter is not initialized */
return bb_NO_ALARM_CFG;
}
return bb_NO_ERROR;
}
#endif
/******************************************************************
* Function : Ixf6048InitChip
*-----------------------------------------------------------------
* Description : This routine commits the internal register table
* down to the chip and initializes the bb_ChipData_t
* structure.
*-----------------------------------------------------------------
* Inputs : pChipData : A pointer to an allocated structure.
* pTable : Table to be committed to the device.
* Outputs : None.
*-----------------------------------------------------------------
* Returns : bb_Error_e Returns Error Condition if Not successful
*-----------------------------------------------------------------
* Access Globals : None.
*-----------------------------------------------------------------
******************************************************************/
bb_Error_e
Ixf6048InitChip(bb_ChipData_t* pChipData, InitRegTable_t *pTable)
{
bb_Error_e rc = bb_NO_ERROR;
InitRegTable_t *pRegPtr;
/* Initialize the register pointer */
pRegPtr = pTable;
/* Loop through the array commiting the data down to the chip */
while ((pRegPtr->offset != (ushort*)0xFFFF) &&
(pRegPtr->value != IXF_INIT_DATA_DELIMITER))
{
WRITE_TO_HW((pChipData->BaseAddress +
((ulong) pRegPtr->offset << REG_SHIFT)), pRegPtr->value);
pRegPtr++;
}
return rc;
}
/******************************************************************
* Function : Ixf6048GetWindowSize
*-----------------------------------------------------------------
* Description : Gets the window size for clear and setting
* Degraded B2 error.
*-----------------------------------------------------------------
* Inputs : pChipData : Initialized Chip Data
* section : Determines the section(block) to get the
* window size from.
* mode : The clearing/setting mode.
* Outputs : value : Window size value.
*-----------------------------------------------------------------
* Returns : Status
*-----------------------------------------------------------------
* Access Globals : None.
*-----------------------------------------------------------------
* Comments : None.
******************************************************************/
bb_Error_e
Ixf6048GetWindowSize(bb_ChipData_t* pChipData,
bb_ChipSegment_t *section,
bb_WindowSizeMode_e mode, ulong* value)
{
bb_RegPointer_type BaseAddress = pChipData->BaseAddress;
ushort offset;
uchar channel;
/* Getting the channel number */
channel = ixf6048_GET_CHANNEL_FROM_SECTION_PARAM(section);
/* Get the proper offset */
if (mode == SETTING)
{
offset = (ushort) ixf6048_WINSZ_SDEGB2_CHAN_LSB_OFFSET(channel);
}
else
{
offset = (ushort) ixf6048_WINSZ_CDEGB2_CHAN_LSB_OFFSET(channel);
}
/* Get Windows Size */
*value = ixf6048_GET_NUMB_WINSZ_32BIT(READ_FROM_HW(BaseAddress + offset + 1),
READ_FROM_HW(BaseAddress + offset));
return bb_NO_ERROR;
}
/******************************************************************
* Function : Ixf6048SetWindowSize
*-----------------------------------------------------------------
* Description : Sets the window size for clear and setting
* Degraded B2 error.
*-----------------------------------------------------------------
* Inputs : pChipData : Initialized Chip Data
* section : Determines the section(block) to set the
* window size.
* mode : The clearing/setting mode.
* value : Window size value.
* Outputs : None.
*-----------------------------------------------------------------
* Returns : Status
*-----------------------------------------------------------------
* Access Globals : None.
*-----------------------------------------------------------------
* Comments : None.
******************************************************************/
bb_Error_e
Ixf6048SetWindowSize(bb_ChipData_t* pChipData, bb_ChipSegment_t *section,
bb_WindowSizeMode_e mode, ulong value)
{
bb_RegPointer_type BaseAddress = pChipData->BaseAddress;
uchar channel;
/* Getting the channel */
channel = ixf6048_GET_CHANNEL_FROM_SECTION_PARAM(section);
/* Get the proper offset */
if (mode == SETTING)
{
/* Set Windows Size */
ixf6048_SET_LSB_SDEGB2_WINDOW_SIZE(BaseAddress,
channel, (ushort)(value & 0xFFFF));
ixf6048_SET_MSB_SDEGB2_WINDOW_SIZE(BaseAddress,
channel, (ushort) ((value >> 16) & 0xFFFF));
}
else
{
/* Set Windows Size */
ixf6048_SET_CLR_LSB_DEGB2_WINDOW_SIZE(BaseAddress,
channel, (ushort)(value & 0xFFFF));
ixf6048_SET_CLR_MSB_DEGB2_WINDOW_SIZE(BaseAddress,
channel, (ushort) ((value >> 16) & 0xFFFF));
}
return bb_NO_ERROR;
}
/******************************************************************
* Function : Ixf6048SetOpMode
*-----------------------------------------------------------------
* Description : Sets the operation mode of the chip.
*-----------------------------------------------------------------
* Inputs : pChipData : Initialized Chip Data
* section : Determines the section(block) to get the
* status from.
* opMode : The mode of operation.
* pModeCfg : place to put mode.
* Outputs : None.
*-----------------------------------------------------------------
* Returns : bb_Error_e Returns Error Condition if Not successful
*-----------------------------------------------------------------
* Access Globals : None.
*-----------------------------------------------------------------
* Comments : None.
******************************************************************/
bb_Error_e
Ixf6048SetOpMode(bb_ChipData_t *pChipData, bb_ChipSegment_t *section,
bb_OperMode_e opMode, void *pModeCfg)
{
bb_RegPointer_type BaseAddress = pChipData->BaseAddress;
bb_RegPointer_type pReg;
bb_Error_e rc = bb_NO_ERROR;
ushort chanNum = section->group.channel;
switch (opMode)
{
case ATM_MODE:
if ((section->block.flow == TX) || (section->block.flow == BOTH_FLOWS))
{
pReg = BaseAddress + ixf6048_T_COCNF_CHAN_OFFSET(chanNum);
WRITE_TO_HW(pReg, (READ_FROM_HW(pReg) | ixf6048_bCHAN_MODE_ATM));
}
if ((section->block.flow == RX) || (section->block.flow == BOTH_FLOWS))
{
pReg = BaseAddress + ixf6048_R_COCNF_CHAN_OFFSET(chanNum);
WRITE_TO_HW(pReg, (READ_FROM_HW(pReg) | ixf6048_bCHAN_MODE_ATM));
}
break;
case POS_MODE:
if ((section->block.flow == TX) || (section->block.flow == BOTH_FLOWS))
{
pReg = BaseAddress + ixf6048_T_COCNF_CHAN_OFFSET(chanNum);
WRITE_TO_HW(pReg, (READ_FROM_HW(pReg) | ixf6048_bCHAN_MODE_POS));
}
if ((section->block.flow == RX) || (section->block.flow == BOTH_FLOWS))
{
pReg = BaseAddress + ixf6048_R_COCNF_CHAN_OFFSET(chanNum);
WRITE_TO_HW(pReg, (READ_FROM_HW(pReg) | ixf6048_bCHAN_MODE_POS));
}
break;
case TRANSPARENT_MODE:
if ((section->block.flow == TX) || (section->block.flow == BOTH_FLOWS))
{
pReg = BaseAddress + ixf6048_T_COCNF_CHAN_OFFSET(chanNum);
WRITE_TO_HW(pReg, (READ_FROM_HW(pReg) | ixf6048_bCHAN_MODE_TRANSPARENT));
}
if ((section->block.flow == RX) || (section->block.flow == BOTH_FLOWS))
{
pReg = BaseAddress + ixf6048_R_COCNF_CHAN_OFFSET(chanNum);
WRITE_TO_HW(pReg, (READ_FROM_HW(pReg) | ixf6048_bCHAN_MODE_TRANSPARENT));
}
break;
case TEST_MODE: /* PRBS */
if ((section->block.flow == TX) || (section->block.flow == BOTH_FLOWS))
{
pReg = BaseAddress + ixf6048_T_COCNF_CHAN_OFFSET(chanNum);
WRITE_TO_HW(pReg, (READ_FROM_HW(pReg) | ixf6048_bCHAN_MODE_TEST));
}
if ((section->block.flow == RX) || (section->block.flow == BOTH_FLOWS))
{
pReg = BaseAddress + ixf6048_R_COCNF_CHAN_OFFSET(chanNum);
WRITE_TO_HW(pReg, (READ_FROM_HW(pReg) | ixf6048_bCHAN_MODE_TEST));
}
break;
default:
rc = bb_INV_PARAMETER;
break;
}
return bb_NO_ERROR;
}
ushort
SlowPortRead(bb_RegPointer_type addr)
{
return SWAPNTOHS(*addr);
}
ushort
SlowPortWrite(bb_RegPointer_type addr, ushort val)
{
if(((silicon_rev & 0xF0) >> 4))
{
}
else
{
addr = (bb_RegPointer_type)((int)addr^2);
}
*addr = val;
return bb_NO_ERROR;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -