📄 vcp2_soft_decisions_example.c
字号:
/* Enable Channel */
CSL_edma3HwChannelControl(hChannel, CSL_EDMA3_CMD_CHANNEL_ENABLE , NULL);
/* Start VCP2 */
VCP2_reset ();
VCP2_emuDisable ();
VCP2_start ();
printf("VCP2 is started...\n");
/* Wait till processing is over */
while (VCP2_statRun());
printf("VCP2 processing of data over\n");
printf("\nRESULTS\n");
printf("~~~~~~~\n");
printf("FMINS = %d\n", ((ouputParams[0] & 0x0FFF0000)>>16));
printf("FMAXS = %d\n", (ouputParams[0] & 0x00000FFF));
printf("FMAXI = %d\n", (ouputParams[1] & 0x0000000F));
/* Get the number of symbols processed */
numSymProc = VCP2_statSymProc();
printf("Number of symbols processed = %d \n", numSymProc);
/* Verify the soft decisions output */
for (index = 0; index < ((vcpParams.frameLen)/4); index++) {
if (soft_decision [index] != soft_decisionRef [index]) {
break;
}
}
if (index == ((vcpParams.frameLen)/4)) {
printf ("\nSoft decisions are computed properly\n");
}
else {
printf ("\nSoft decisions are not computed properly %d\n", index);
VCP2_getErrors(&errors);
if(errors.tbnaErr == FALSE &&
errors.ftlErr == FALSE &&
errors.fctlErr == FALSE &&
errors.maxminErr == FALSE &&
errors.symxErr == FALSE &&
errors.symrErr == FALSE) {
printf("No errors found set\n");
}
}
/* clear the error registers */
chErrClear.missed = TRUE;
chErrClear.secEvt = TRUE;
CSL_edma3HwChannelControl (hChannel, CSL_EDMA3_CMD_CHANNEL_DISABLE, NULL);
CSL_edma3HwChannelControl (hChannel1, CSL_EDMA3_CMD_CHANNEL_DISABLE, NULL);
CSL_edma3HwChannelControl (hChannel, CSL_EDMA3_CMD_CHANNEL_CLEARERR,
&chErrClear);
CSL_edma3HwChannelControl (hChannel1, CSL_EDMA3_CMD_CHANNEL_CLEARERR,
&chErrClear);
CSL_edma3HwChannelControl (hChannel, CSL_EDMA3_CMD_CHANNEL_CLEAR, NULL);
CSL_edma3HwChannelControl (hChannel1, CSL_EDMA3_CMD_CHANNEL_CLEAR, NULL);
/* Close EDMA channels */
CSL_edma3ChannelClose (hChannel);
CSL_edma3ChannelClose (hChannel1);
}
/*
* =============================================================================
* @func vcp2_configEdma
* @desc
* Configures EDMA channels 28 and 29.
* For channel 29 there are 2 param entries(0 &1) which are linked.
* Link 0 transfers the VCP2 input configuration register values.
* Link 1 transfer Branch metrics.
* For channel 28 there 2 param entry (2 & 3).
* Link 2 transfers the soft decisions.
* Link 3 transfers the VCPOUT values
*
* @expected result
* Appropriate message will be logged depending on
* the result
*
* @eg
* vcp2_configEdma();
* =============================================================================
*/
Uint16 vcp2_configEdma(Uint32 inputBM, Uint32 outputHD)
{
volatile Uint16 count;
CSL_Status chStatus, chStatus1;
CSL_edma3Init(&context);
CSL_edma3Open(&edmaObj,CSL_EDMA3,NULL,&chStatus);
/* Channel Configuration for VCP2XEVT event */
/* Channel Open */
chParam.regionNum = CSL_EDMA3_REGION_GLOBAL;
chParam.chaNum = CSL_EDMA3_CHA_VCP2XEVT;
hChannel = CSL_edma3ChannelOpen(&ChObj, CSL_EDMA3, &chParam, &chStatus);
if ((chStatus != CSL_SOK) || (hChannel == NULL)) {
printf("Error in EDMA channel open function\n");
return 0;
}
/* Channel Setup */
if (CSL_SOK != CSL_edma3HwChannelSetupParam(hChannel, 0 /* PaRAM entry */)){
printf("Error in EDMA channel setup for channel #29\n");
return 0;
}
if (CSL_SOK != CSL_edma3HwChannelSetupQue(hChannel, CSL_EDMA3_QUE_0)) {
printf("Error in EDMA channel setup for channel #29\n");
return 0;
}
/* Setup link to transmit Input configuration */
hParam[0] = CSL_edma3GetParamHandle (hChannel, 0, &chStatus);
myParamSetup.option = CSL_EDMA3_OPT_MAKE (FALSE,FALSE,FALSE,FALSE,0,
CSL_EDMA3_TCC_NORMAL,
CSL_EDMA3_FIFOWIDTH_NONE,
FALSE,CSL_EDMA3_SYNC_A,
CSL_EDMA3_ADDRMODE_INCR,
CSL_EDMA3_ADDRMODE_INCR);
myParamSetup.srcAddr = (Uint32)&vcpConfig;
myParamSetup.aCntbCnt = CSL_EDMA3_CNT_MAKE(VCPIC_DMA_SIZE, 1);
myParamSetup.dstAddr = (Uint32)hVcp2Vbus;
myParamSetup.srcDstBidx = CSL_EDMA3_BIDX_MAKE(0, 0);
myParamSetup.linkBcntrld = CSL_EDMA3_LINKBCNTRLD_MAKE(0x20, 0);
/* offset to the next param entry */
myParamSetup.srcDstCidx = CSL_EDMA3_CIDX_MAKE(0, 0);
myParamSetup.cCnt = 1;
if (CSL_SOK != CSL_edma3ParamSetup (hParam[0], &myParamSetup)) {
printf("Error in EDMA paRam setup for entry #0\n");
return 0;
}
/* Setup link to transmit branch metrics */
hParam[1] = CSL_edma3GetParamHandle(hChannel,1,&chStatus);
myParamSetup.option = CSL_EDMA3_OPT_MAKE(FALSE, FALSE, FALSE, FALSE, 0,
CSL_EDMA3_TCC_NORMAL,
CSL_EDMA3_FIFOWIDTH_64BIT,
FALSE,CSL_EDMA3_SYNC_A,
CSL_EDMA3_ADDRMODE_CONST,
CSL_EDMA3_ADDRMODE_INCR);
myParamSetup.srcAddr = (Uint32)branch_metric;
myParamSetup.srcDstBidx = CSL_EDMA3_BIDX_MAKE(DMA_BURST_SIZE, 0);
myParamSetup.dstAddr = (Uint32)&(hVcp2Vbus->VCPWBM);
myParamSetup.linkBcntrld = CSL_EDMA3_LINKBCNTRLD_MAKE(
CSL_EDMA3_LINK_NULL, 0);
myParamSetup.aCntbCnt = CSL_EDMA3_CNT_MAKE(DMA_BURST_SIZE, inputBM);
myParamSetup.cCnt = 1;
if (CSL_SOK != CSL_edma3ParamSetup (hParam[1], &myParamSetup)) {
printf("Error in EDMA paRam setup for entry #1\n");
return 0;
}
/* Channel Configuration for VCP2REVT event */
/* Channel Open */
chParam1.regionNum = CSL_EDMA3_REGION_GLOBAL;
chParam1.chaNum = CSL_EDMA3_CHA_VCP2REVT;
hChannel1 = CSL_edma3ChannelOpen (&ChObj1, CSL_EDMA3, &chParam1,
&chStatus1);
if ((chStatus1 != CSL_SOK) | (hChannel1 == NULL)) {
printf("Error in EDMA channel open function\n");
return 0;
}
/* Channel Setup */
if (CSL_SOK != CSL_edma3HwChannelSetupParam(hChannel1, 2 )) {
printf("Error in EDMA channel setup for channel #29\n");
return 0;
}
if (CSL_SOK != CSL_edma3HwChannelSetupQue(hChannel1, CSL_EDMA3_QUE_0)) {
printf("Error in EDMA channel setup for channel #29\n");
return 0;
}
hParam[2] = CSL_edma3GetParamHandle (hChannel1, 2, &chStatus);
myParamSetup.option = CSL_EDMA3_OPT_MAKE (FALSE, FALSE, FALSE, FALSE, 0,
CSL_EDMA3_TCC_NORMAL,
CSL_EDMA3_FIFOWIDTH_64BIT,
FALSE,CSL_EDMA3_SYNC_A,
CSL_EDMA3_ADDRMODE_INCR,
CSL_EDMA3_ADDRMODE_CONST);
myParamSetup.srcAddr = (Uint32)&(hVcp2Vbus->VCPRDECS);
myParamSetup.aCntbCnt = CSL_EDMA3_CNT_MAKE (outputHD, 1);
myParamSetup.dstAddr = (Uint32)soft_decision;
myParamSetup.srcDstBidx = CSL_EDMA3_BIDX_MAKE (0, outputHD);
myParamSetup.linkBcntrld = CSL_EDMA3_LINKBCNTRLD_MAKE (0x60, 0);
/* offset to the next param entry */
myParamSetup.srcDstCidx = CSL_EDMA3_CIDX_MAKE (0, 0);
myParamSetup.cCnt = 1;
if (CSL_SOK != CSL_edma3ParamSetup (hParam[2], &myParamSetup)) {
printf("Error in EDMA paRam setup for entry #2\n");
return 0;
}
hParam[3] = CSL_edma3GetParamHandle (hChannel1, 3, &chStatus);
myParamSetup.option = CSL_EDMA3_OPT_MAKE (FALSE, FALSE, FALSE, FALSE, 0,
CSL_EDMA3_TCC_NORMAL,
CSL_EDMA3_FIFOWIDTH_NONE,
FALSE,CSL_EDMA3_SYNC_A,
CSL_EDMA3_ADDRMODE_INCR,
CSL_EDMA3_ADDRMODE_INCR);
myParamSetup.srcAddr = (Uint32)&(hVcp2Vbus->VCPOUT0);
myParamSetup.dstAddr = (Uint32)&ouputParams[0];
myParamSetup.aCntbCnt = CSL_EDMA3_CNT_MAKE (VCPOUT_DMA_SIZE, 1);
myParamSetup.linkBcntrld = CSL_EDMA3_LINKBCNTRLD_MAKE (
CSL_EDMA3_LINK_NULL, 0);
if (CSL_SOK != CSL_edma3ParamSetup (hParam[3], &myParamSetup)) {
printf("Error in EDMA paRam setup for entry #3\n");
return 0;
}
return 1;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -