📄 csl_tcp2.c
字号:
* @verbatim
extern TCP2_UserData *userData;
TCP2_BaseParams configBase;
TCP2_Params configParams;
TCP2_TailData *xabData;
Uint32 frameLen = 40;
xabData = &userData [frameLen];
// assign the configuration parameters
configBase.frameLen = frameLen;
configBase.inputSign = TCP2_INPUT_SIGN_POSITIVE;
configBase.intFlag = 1;
configBase.maxIter = 8;
configBase.maxStarEn = TRUE;
configBase.standard = TCP2_STANDARD_3GPP;
configBase.crcLen = 0;
configBase.crcPoly = 0;
configBase.minIter = 1;
configBase.numCrcPass = 1;
configBase.outParmFlag = 0;
configBase.outputOrder = TCP2_OUT_ORDER_0_31;
configBase.prologRedEn = FALSE;
configBase.prologSize = 24;
configBase.rate = TCP2_RATE_1_3;
configBase.snr = 0;
for (cnt = 0; cnt < 16; cnt++)
configBase.extrScaling [cnt] = 32;
// setup the TCP configuration registers parameters
TCP2_genParams (&configBase, &configParams);
@endverbatim
* ===========================================================================
*/
Uint32 TCP2_genParams (
TCP2_BaseParams *restrict configBase,
TCP2_Params *restrict configParams
)
{
Uint8 cnt;
Uint32 numSubFrames = 0;
Uint32 frameLen = configBase->frameLen;
/* Assign the configuration parameters */
configParams->standard = configBase->standard;
configParams->rate = configBase->rate;
configParams->intFlag = configBase->intFlag;
configParams->outParmFlag = configBase->outParmFlag;
configParams->prologSize = configBase->prologSize;
configParams->maxIter = configBase->maxIter;
configParams->snr = configBase->snr;
configParams->maxStarEn = configBase->maxStarEn;
configParams->prologRedEn = configBase->prologRedEn;
configParams->minIter = configBase->minIter;
configParams->inputSign = configBase->inputSign;
configParams->outputOrder = configBase->outputOrder;
configParams->numCrcPass = configBase->numCrcPass;
configParams->crcLen = configBase->crcLen;
configParams->crcPoly = configBase->crcPoly;
configParams->map = configBase->map;
for (cnt = 0; cnt < NUM_EXTRINSIC_FACTORS; cnt++)
configParams->extrScaling [cnt] = configBase->extrScaling [cnt];
/* calculate the sub blocks */
configParams->frameLen = frameLen;
if (frameLen <= TCP2_FLEN_MAX) {
/* Configure for Standalone processing */
/* to assign the frame length and mode */
configParams->mode = TCP2_MODE_SA;
/* Calculate the sub blocks, reliabilty length and
* num of sliding windows
*/
TCP2_calcSubBlocksSA (configParams);
}
else { /* Configure for Shared processing */
/*for shared processing assign the paramemters for the second
* configuration structure
*/
TCP2_Params *configParms2 = &configParams [1];
/* Assign the configuration parameters */
configParms2->standard = configBase->standard;
configParms2->rate = configBase->rate;
configParms2->intFlag = configBase->intFlag;
configParms2->outParmFlag = configBase->outParmFlag;
configParms2->prologSize = configBase->prologSize;
configParms2->maxIter = configBase->maxIter;
configParms2->snr = configBase->snr;
configParms2->maxStarEn = configBase->maxStarEn;
configParms2->prologRedEn = configBase->prologRedEn;
configParms2->minIter = configBase->minIter;
configParms2->inputSign = configBase->inputSign;
configParms2->outputOrder = configBase->outputOrder;
configParms2->numCrcPass = configBase->numCrcPass;
configParms2->crcLen = configBase->crcLen;
configParms2->crcPoly = configBase->crcPoly;
configParms2->map = configBase->map;
for (cnt = 0; cnt < NUM_EXTRINSIC_FACTORS; cnt++)
configParms2->extrScaling [cnt] = configBase->extrScaling [cnt];
/* Calculate the number of sub frames, sub blocks, reliabilty length
* and num of sliding windows
*/
numSubFrames = TCP2_calcSubBlocksSP (configParams);
}
return numSubFrames;
} /* end TCP2_genParams */
/** ============================================================================
* @n@b TCP2_calcSubBlocksSA
*
* @b Description
* @n This function calculates the number of sub blocks for the TCP
* standalone processing. The reliability length is also calculated and the
* configParms structure is populated.
*
* @b Arguments
@verbatim
configParms Pointer to the structure holding the TCP
configuration parameters.
@endverbatim
*
* <b> Return Value </b>
* @n None
*
* <b> Pre Condition </b>
* @n None
*
* <b> Post Condition </b>
* @n None
*
* @b Modifies
* @n The configParms argument passed.
*
* @b Example
* @verbatim
extern TCP2_Params *configParms;
...
TCP2_calcSubBlocksSA (configParms);
@endverbatim
* ===========================================================================
*/
void TCP2_calcSubBlocksSA (
TCP2_Params *configParms
)
{
/* calculate the sub blocks and other parameters */
TCP2_calcSubBlocks (configParms);
return;
} /* end TCP2_calcSubBlocksSA () */
/** ============================================================================
* @n@b TCP2_calcSubBlocksSP
*
* @b Description
* @n This function calculates the number of sub blocks for the TCP
* shared processing. The reliability length is also calculated and the
* configParms structure is populated.
*
* @b Arguments
@verbatim
configParms Pointer to the structure holding the TCP
configuration parameters.
@endverbatim
*
* <b> Return Value </b> Uint32
* @n Number of sub frames the frame is divided into
*
* <b> Pre Condition </b>
* @n None
*
* <b> Post Condition </b>
* @n None
*
* @b Modifies
* @n The configParms argument passed.
*
* @b Example
* @verbatim
extern TCP2_Params *configParms;
...
TCP2_calcSubBlocksSP (configParms);
@endverbatim
* ===========================================================================
*/
Uint32 TCP2_calcSubBlocksSP (
TCP2_Params *configParms
)
{
Uint16 numSubFrame;
Uint16 subFrameLen;
Uint16 subFrameLenLast;
TCP2_Params *configParams1 = &configParms [0];
TCP2_Params *configParams2 = &configParms [1];
Uint16 frameLen = configParms->frameLen;
/* calculate the number of sub frames and their lengths */
numSubFrame = TCP2_normalCeil (frameLen, TCP2_SUB_FRAME_SIZE_MAX);
subFrameLen = (TCP2_normalCeil (frameLen, (numSubFrame * 256))) * 256;
/* calculate the last sub frame length */
while (frameLen > TCP2_SUB_FRAME_SIZE_MAX)
frameLen = frameLen - subFrameLen;
if (frameLen > 128)
subFrameLenLast = frameLen;
else {
numSubFrame--;
subFrameLenLast = frameLen + TCP2_SUB_FRAME_SIZE_MAX;
}
/* Assign the config parameters for the first and the middle subframes */
configParams1->mode = TCP2_FIRST_SF;
configParams1->frameLen = subFrameLen;
TCP2_calcSubBlocks (configParams1);
/* Assign the config parameters for the first and the middle subframes */
configParams2->mode = TCP2_LAST_SF;
configParams2->frameLen = subFrameLenLast;
TCP2_calcSubBlocks (configParams2);
return numSubFrame;
} /* end TCP2_calcSubBlocksSP () */
/* ============================================================================
* @n@b TCP2_calcSubBlocks
*
* @b Description
* @n This function calculates the number of sub blocks for the TCP
* processing. The reliability length is also calculated and the
* configParms structure is populated.
*
* @b Arguments
@verbatim
configParms Pointer to the structure holding the TCP
configuration parameters.
@endverbatim
*
* <b> Return Value </b>
* @n None
*
* <b> Pre Condition </b>
* @n None
*
* <b> Post Condition </b>
* @n None
*
* @b Modifies
* @n The configParms argument passed.
*
* @b Example
* @verbatim
extern TCP2_Params *configParms;
...
TCP2_calcSubBlocks (configParms);
@endverbatim
* ===========================================================================
*/
void TCP2_calcSubBlocks (
TCP2_Params *configParms
)
{
Uint16 frameLen = configParms->frameLen;
Uint16 winSize;
Uint16 numSlidingWindow;
Uint16 relLen;
Uint16 numSubBlock = 1;
Uint16 relLenMax = TCP2_RLEN_MAX;
/* calculate the number of sliding windows */
if (frameLen <= 128) {
numSlidingWindow = 1;
relLen = frameLen;
}
else
numSlidingWindow = 2;
/* Calculate the reliability length and number of sub blocks */
if (2 == numSlidingWindow) {
winSize = TCP2_normalCeil (frameLen, numSlidingWindow);
do {
numSubBlock = TCP2_normalCeil (winSize, relLenMax);
relLen = winSize / numSubBlock;
if ((relLen * numSubBlock) < winSize)
relLen++;
relLenMax--;
} while (((numSubBlock * relLen * numSlidingWindow) - frameLen) >=
(relLen - (configParms->prologSize)));
}
configParms->relLen = relLen - 1;
configParms->numSubBlock = numSubBlock;
configParms->numSlideWin = numSlidingWindow - 1;
return;
} /* end TCP2_calcSubBlocks () */
/** ============================================================================
* @n@b TCP2_tailConfig3GPP
*
* @b Description
* @n This function generates the input control values IC6-IC11 for 3GPP
* channels. These values consist of the tail data following the
* systematics and parities data. This function is called from the generic
* TCP2_tailConfig function.
*
* @b Arguments
@verbatim
mode TCP processing mode (SA or SP)
map TCP shared processing MAP
rate TCP data code rate
tailData Pointer to the tail data
configIc Pointer to the IC values structure
@endverbatim
*
* <b> Return Value </b>
* @n None
*
* <b> Pre Condition </b>
* @n None
*
* <b> Post Condition </b>
* @n The configIc structure is assigned the tail configuration values
* based on the tailData.
*
* @b Modifies
* @n The configIc argument passed.
*
* @b Example
* @verbatim
extern TCP2_Params *configParms;
TCP2_ConfigIc *configIc;
TCP2_UserData *xabData = &userData[frameLen];
...
TCP2_tailConfig3GPP (configParms->mode, configParms->map,
configParms->rate,
userData, configIc);
@endverbatim
* ===========================================================================
*/
void TCP2_tailConfig3GPP (
TCP2_Mode mode,
TCP2_Map map,
TCP2_Rate rate,
TCP2_TailData *restrict tailData,
TCP2_ConfigIc *restrict configIc
)
{
Uint32 tail1 = 0, tail2 = 0, tail3 = 0, tail4 = 0, tail5 = 0, tail6 = 0;
Uint32 gie;
if (TCP2_MODE_SA == mode) { /* set the tail bits for SA mode */
switch (rate) {
case TCP2_RATE_1_2:
case TCP2_RATE_1_3:
case TCP2_RATE_3_4: {
/* tail1 = x10(2), x10(1), x10(0) */
/* tail2 = p10(2), p10(1), p10(0) */
/* tail3 = 0, 0, 0 */
/* tail4 = x20(2), x20(1), x20(0) */
/* tail5 = p20(2), p20(1), p20(0) */
/* tail6 = 0, 0, 0 */
tail1 = TCP2_makeTailArgs(tailData [4], tailData [2],
tailData [0]);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -