📄 csl_vcp2.c
字号:
/* Calculation of reliability length */
/* Identify Fmax for a given constraint length and decision type */
if (decision == VCP2_DECISION_HARD) {
if (constLen == 9) {
fMax = VCP2_MAX_FRAME_SIZE_FOR_HD_CONST9;
rcMax = VCP2_MAX_RELLEN_CONV_DIST_FOR_HD_CONST9;
multiple = VCP2_TRL_STAGES_IN_2_PASSES_FOR_HD_CONST9;
} /* end if constLen == 9 */
if (constLen == 8) {
fMax = VCP2_MAX_FRAME_SIZE_FOR_HD_CONST8;
rcMax = VCP2_MAX_RELLEN_CONV_DIST_FOR_HD_CONST8;
multiple = VCP2_TRL_STAGES_IN_2_PASSES_FOR_HD_CONST8;
} /* end if constLen == 8 */
if (constLen == 7) {
fMax = VCP2_MAX_FRAME_SIZE_FOR_HD_CONST7;
rcMax = VCP2_MAX_RELLEN_CONV_DIST_FOR_HD_CONST7;
multiple = VCP2_TRL_STAGES_IN_2_PASSES_FOR_HD_CONST7;
} /* end if constLen == 7 */
if (constLen == 6) {
fMax = VCP2_MAX_FRAME_SIZE_FOR_HD_CONST6;
rcMax = VCP2_MAX_RELLEN_CONV_DIST_FOR_HD_CONST6;
multiple = VCP2_TRL_STAGES_IN_2_PASSES_FOR_HD_CONST6;
} /* end if constLen == 6 */
if (constLen == 5) {
fMax = VCP2_MAX_FRAME_SIZE_FOR_HD_CONST5;
rcMax = VCP2_MAX_RELLEN_CONV_DIST_FOR_HD_CONST5;
multiple = VCP2_TRL_STAGES_IN_2_PASSES_FOR_HD_CONST5;
} /* end if constLen == 5 */
} /* end if hard decision */
else { /* if soft decision */
if (constLen == 9) {
fMax = VCP2_MAX_FRAME_SIZE_FOR_SD_CONST9;
rcMax = VCP2_MAX_RELLEN_CONV_DIST_FOR_SD_CONST9;
multiple = VCP2_TRL_STAGES_IN_2_PASSES_FOR_SD_CONST9;
} /* end if constLen == 9 */
if (constLen == 8) {
fMax = VCP2_MAX_FRAME_SIZE_FOR_SD_CONST8;
rcMax = VCP2_MAX_RELLEN_CONV_DIST_FOR_SD_CONST8;
multiple = VCP2_TRL_STAGES_IN_2_PASSES_FOR_SD_CONST8;
} /* end if constLen == 8 */
if (constLen == 7) {
fMax = VCP2_MAX_FRAME_SIZE_FOR_SD_CONST7;
rcMax = VCP2_MAX_RELLEN_CONV_DIST_FOR_SD_CONST7;
multiple = VCP2_TRL_STAGES_IN_2_PASSES_FOR_SD_CONST7;
} /* end if constLen == 7 */
if (constLen == 6) {
fMax = VCP2_MAX_FRAME_SIZE_FOR_SD_CONST6;
rcMax = VCP2_MAX_RELLEN_CONV_DIST_FOR_SD_CONST6;
multiple = VCP2_TRL_STAGES_IN_2_PASSES_FOR_SD_CONST6;
} /* end if constLen == 6 */
if (constLen == 5) {
fMax = VCP2_MAX_FRAME_SIZE_FOR_SD_CONST5;
rcMax = VCP2_MAX_RELLEN_CONV_DIST_FOR_SD_CONST5;
multiple = VCP2_TRL_STAGES_IN_2_PASSES_FOR_SD_CONST5;
} /* end if constLen == 5 */
} /* end if soft decision */
/* If mixed or convergent traceback mode */
if ((tbConvrgMode == TRUE) || (frameLen > fMax)) {
if (perf == VCP2_SPEED_MOST_CRITICAL) { /* Speed most critical */
convMultiplier = 3; /* convMultiplier
values - as
specified in the
'TPC2_VCP2_API_
Requirements_v1.4'
spread sheet */
}
else if (perf == VCP2_PERF_CRITICAL) { /* Performance critical */
if (constLen == 9) {
convMultiplier = 6;
}
else {
convMultiplier = 9;
}
}
else if (perf == VCP2_PERF_MOST_CRITICAL) {
/* Performance most critical */
if (constLen == 9) {
convMultiplier = 6;
}
else if (constLen == 8) {
convMultiplier = 12;
}
else {
convMultiplier = 18;
}
}
else { /* for speed critical and default case */
if (constLen == 9) {
convMultiplier = 3;
}
else {
convMultiplier = 6;
}
}
/* Calculation of Reliability length and Convergence distance */
convDist = convMultiplier * (constLen - 1);
nsw = VCP2_normalCeil (frameLen, rcMax - convDist);
relLen = multiple * VCP2_normalCeil (frameLen, nsw * multiple);
if ((decision == VCP2_DECISION_SOFT) & (constLen < 7)) {
while (relLen > VCP2_REL_LEN_LIMIT_FOR_A_SILDING_WINDOW) {
nsw++;
relLen = multiple * VCP2_normalCeil (frameLen, nsw * multiple);
}
}
} /* end if mixed or convergent traceback modes */
/* Trace back mode */
if (tbConvrgMode == TRUE) {
traceBack = VCP2_TRACEBACK_CONVERGENT;
}
else {
if (frameLen > fMax)
traceBack = VCP2_TRACEBACK_MIXED;
else
traceBack = VCP2_TRACEBACK_TAILED;
}
/* Calculation of branch metric buffer length */
/* Number of branch metrics per trellis stage */
if (rate == VCP2_RATE_1_4) {
bmNum = VCP2_BM_PER_TRL_FOR_RATE_1_4;
bmBuffLen = VCP2_SYMX_FOR_128_BYTE_PER_RXEVENT_RATE_1_4;
}
else if (rate == VCP2_RATE_1_3) {
bmNum = VCP2_BM_PER_TRL_FOR_RATE_1_3;
bmBuffLen = VCP2_SYMX_FOR_128_BYTE_PER_RXEVENT_RATE_1_3;
}
else if (rate == VCP2_RATE_1_2) {
bmNum = VCP2_BM_PER_TRL_FOR_RATE_1_2;
bmBuffLen = VCP2_SYMX_FOR_128_BYTE_PER_RXEVENT_RATE_1_2;
}
/* Maximum number of branch metrics */
if (traceBack == VCP2_TRACEBACK_CONVERGENT)
bmCnt = bmNum * (frameLen + convDist);
else
bmCnt = bmNum * (frameLen + constLen - 1);
/* Number of frame transfers */
numBmFrames = VCP2_normalCeil (bmCnt, VCP2_BYTE_COUNT_PER_RXEVENT);
/* Calculation of Decision buffer length */
if (decision == VCP2_DECISION_HARD) {
if (frameLen > VCP2_MAX_HD_IN_OUTFIFO)
decBuffLen = (VCP2_OUTFIFO_WORDS) - 1;
else {
decBuffLen = VCP2_normalCeil (frameLen, VCP2_HD_PER_OUTFIFO_WORD)
- 1;
numDecFrames = 1; /* Not being used here */
}
}
else {
if (frameLen > VCP2_MAX_SD_IN_OUTFIFO)
decBuffLen = (VCP2_OUTFIFO_WORDS) - 1;
else {
decBuffLen = VCP2_normalCeil (frameLen, VCP2_SD_PER_OUTFIFO_WORD)
- 1;
numDecFrames = 1; /* Not being used here */
}
}
pConfigParams->rate = rate;
pConfigParams->constLen = constLen;
pConfigParams->poly0 = poly0;
pConfigParams->poly1 = poly1;
pConfigParams->poly2 = poly2;
pConfigParams->poly3 = poly3;
pConfigParams->yamTh = yamTh;
pConfigParams->frameLen = frameLen;
pConfigParams->relLen = relLen;
pConfigParams->convDist = convDist;
pConfigParams->traceBackEn = tailBitEnable;
pConfigParams->traceBackIndex = traceBackIndex;
pConfigParams->outOrder = outOrder;
pConfigParams->maxSm = maxSm;
pConfigParams->minSm = minSm;
pConfigParams->stateNum = stateNum;
pConfigParams->bmBuffLen = bmBuffLen;
pConfigParams->decBuffLen = decBuffLen;
pConfigParams->traceBack = traceBack;
pConfigParams->readFlag = readFlag;
pConfigParams->decision = decision;
pConfigParams->numBmFrames = numBmFrames;
pConfigParams->numDecFrames = numDecFrames;
}
/** ==========================================================================
* @n@b VCP2_genIc
*
* @b Description
* @n This function generates the required input configuration registers'
* values needed to program the VCP based on the parameters provided by
* VCP2_Params object values.
*
* @b Arguments
@verbatim
pConfigParams Pointer to channel parameters structure.
pConfigIc Pointer to input configuration structure.
@endverbatim
*
* <b> Return Value </b>
* @n None
*
* <b> Pre Condition </b>
* @n The members of the channel parameter structure should
* be populated by calling the function 'VCP2_genParams()'
* before calling this function.
*
* <b> Post Condition </b>
* @n None
*
* @b Modifies
* @n Input VCP2_ConfigIc structure instance pointed by pConfigIc.
*
* @b Example
* @verbatim
VCP2_Params vcpParam;
VCP2_BaseParams vcpBaseParam;
...
vcpBaseParam.rate = VCP2_RATE_1_4;
vcpBaseParam.constLen = 5;
vcpBaseParam.frameLen = 2042;
vcpBaseParam.yamTh = 50;
vcpBaseParam.stateNum = 2048;
vcpBaseParam.tbConvrgMode = FALSE;
vcpBaseParam.decision = VCP2_DECISION_HARD;
vcpBaseParam.readFlag = VCP2_OUTF_YES;
vcpBaseParam.tailBitEnable = FALSE;
vcpBaseParam.traceBackIndex = 0x0;
vcpBaseParam.outOrder = VCP2_OUTORDER_0_31;
vcpBaseParam.perf = VCP2_SPEED_CRITICAL;
...
VCP2_genParams (&vcpBaseParam, &vcpParam);
VCP2_genIc (&vcpParam, &vcpConfig);
@endverbatim
* ============================================================================
*/
#pragma CODE_SECTION (VCP2_genIc, ".text:csl_section:vcp2");
void
VCP2_genIc (
VCP2_Params * restrict pConfigParams,
VCP2_ConfigIc * restrict pConfigIc
)
{
Uint8 poly0 = pConfigParams->poly0;
Uint8 poly1 = pConfigParams->poly1;
Uint8 poly2 = pConfigParams->poly2;
Uint8 poly3 = pConfigParams->poly3;
Uint16 yamTh = pConfigParams->yamTh;
Uint16 frameLen = pConfigParams->frameLen;
Uint16 relLen = pConfigParams->relLen;
Uint16 convDist = pConfigParams->convDist;
Uint16 traceBackIndex = pConfigParams->traceBackIndex;
Bool traceBackEn = pConfigParams->traceBackEn;
Uint8 outOrder = pConfigParams->outOrder;
Int16 minSm = pConfigParams->minSm;
Int16 maxSm = pConfigParams->maxSm;
Uint8 stateNum = pConfigParams->stateNum;
Uint8 bmBuffLen = pConfigParams->bmBuffLen;
Uint8 decBuffLen = pConfigParams->decBuffLen;
Uint8 traceBack = pConfigParams->traceBack;
Uint8 readFlag = pConfigParams->readFlag;
Uint8 decision = pConfigParams->decision;
Uint32 ic0 = 0;
Uint32 ic1 = 0;
Uint32 ic2 = 0;
Uint32 ic3 = 0;
Uint32 ic4 = 0;
Uint32 ic5 = 0;
/* VCPIC0 parameters */
ic0 = CSL_FMK (VCP2_VCPIC0_POLY0, poly0) |
CSL_FMK (VCP2_VCPIC0_POLY1, poly1) |
CSL_FMK (VCP2_VCPIC0_POLY2, poly2) |
CSL_FMK (VCP2_VCPIC0_POLY3, poly3);
/* VCPIC1 parameters */
if (yamTh) {
CSL_FINST (ic1, VCP2_VCPIC1_YAMEN, ENABLE);
CSL_FINS (ic1, VCP2_VCPIC1_YAMT, yamTh);
}
/* VCPIC2 parameters */
ic2 = CSL_FMK (VCP2_VCPIC2_FL, frameLen) |
CSL_FMK (VCP2_VCPIC2_R, relLen);
/* VCPIC3 parameters */
ic3 = CSL_FMK (VCP2_VCPIC3_C, convDist) |
CSL_FMK (VCP2_VCPIC3_ITBI, traceBackIndex) |
CSL_FMK (VCP2_VCPIC3_ITBEN, traceBackEn) |
CSL_FMK (VCP2_VCPIC3_OUT_ORDER, outOrder);
/* VCPIC4 parameters */
ic4 = CSL_FMK (VCP2_VCPIC4_IMAXS, maxSm) |
CSL_FMK (VCP2_VCPIC4_IMINS, minSm);
/* VCPIC5 parameters */
ic5 = CSL_FMK (VCP2_VCPIC5_IMAXI, stateNum) |
CSL_FMK (VCP2_VCPIC5_SYMX, bmBuffLen) |
CSL_FMK (VCP2_VCPIC5_SYMR, decBuffLen) |
CSL_FMK (VCP2_VCPIC5_TB, traceBack) |
CSL_FMK (VCP2_VCPIC5_OUTF, readFlag) |
CSL_FMK (VCP2_VCPIC5_SDHD, decision);
pConfigIc->ic0 = ic0;
pConfigIc->ic1 = ic1;
pConfigIc->ic2 = ic2;
pConfigIc->ic3 = ic3;
pConfigIc->ic4 = ic4;
pConfigIc->ic5 = ic5;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -