This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM2732: HWA dma触发模式无法触发第二个loop的处理

Part Number: AM2732

你好,工程师

我在使用am2732开发板进行HWA相关功能的开发。我将HWA的Paramset的触发方式设置为HWA_TRIG_MODE_DMA,loopCnt为4;在使用CCS进行Debug的过程中发现这组paramset可以由DMA触发,并且正常完成第一个loop的处理,然后由EDMA将数据从hwa membank搬移到L3上,然后由该EDMA触发chain的EDMA通道搬移第二个loop需要的数据到HWA的membank中。在CCS上通过内存查看,第二个loop的数据已经成功搬移到HWA的membank中了,但是没有触发HWA的paramset进行处理,此时查看寄存器loop_cnt的值为2,但是hwa的dest membank中的数据仍为第一个loop的处理结果,即第二个loop没有开始处理;请问为什么会发生上述的问题?loop_cnt=2是否说明hotSignature已经将寄存器DMA2HWA_TRIG中对应的bit进行置位了?

谢谢

  • 能否发一下相关的DMA配置代码?

  • #include <stdlib.h>
    #include <string.h>
    #include <math.h>
    #include <kernel/dpl/DebugP.h>
    #include <kernel/dpl/CycleCounterP.h>
    #include <drivers/hwa.h>
    #include "ti_drivers_config.h"
    #include "ti_drivers_open_close.h"
    #include "ti_board_open_close.h"
    #include "dpedma/dpedma.h"
    #include "dpedma/dpedmahwa.h"
    
    /*global paramset*/
    HWA_Handle  gHwaHandle;
    DPEDMA_ChanCfg gEdmaChannelCfg[10];
    Edma_IntrObject gEdmaIntrObj[10];
    uint32_t gAddressArray[10]={0};
    uint32_t PrevParamsetEndIdx = 0;
    HWA_CommonConfig    COMPRESScommonConfig;
    
    uint16_t CompressedData[1400832];
    #pragma DATA_ALIGN(CompressedData, 256);
    #pragma DATA_SECTION(CompressedData, ".l3ram");
    
    int16_t DataDeCompressed[49152];
    #pragma DATA_ALIGN(DataDeCompressed, 256);
    #pragma DATA_SECTION(DataDeCompressed, ".l3ram");
    
    
    /*function */
    
    static void allocateEDMAShadowChannel(EDMA_Handle edmaHandle, uint32_t *param);
    void DPC_ObjDet_EDMAChannelConfigAssist(EDMA_Handle handle, uint32_t chNum, uint32_t shadowParam, uint32_t eventQueue, DPEDMA_ChanCfg *chanCfg);
    void EDMA_ChannelConfig();
    static  int32_t DPU_DopplerProcHWA_configEdmaDecompressionIn();
    static  int32_t DPU_DopplerProcHWA_configEdmaDecompressionOut();
    
    
    
    
    
    static void allocateEDMAShadowChannel(EDMA_Handle edmaHandle, uint32_t *param)
    {
        int32_t             testStatus = SystemP_SUCCESS;
        EDMA_Config        *config;
        EDMA_Object        *object;
    
        config = (EDMA_Config *) edmaHandle;
        object = config->object;
    
        if((object->allocResource.paramSet[*param/32] & (1U << *param%32)) != (1U << *param%32))
        {
            testStatus = EDMA_allocParam(edmaHandle, param);
            DebugP_assert(testStatus == SystemP_SUCCESS);
        }
    
        return;
    }
    
    
    void DPC_ObjDet_EDMAChannelConfigAssist(EDMA_Handle handle, uint32_t chNum, uint32_t shadowParam, uint32_t eventQueue, DPEDMA_ChanCfg *chanCfg)
    {
        DebugP_assert(chanCfg != NULL);
    
        DPEDMA_allocateEDMAChannel(handle, &chNum, &chNum, &chNum);
    
        chanCfg->channel = chNum;
        chanCfg->tcc = chNum;
        chanCfg->paramId = chNum;
    
        chanCfg->shadowPramId = shadowParam;
    
        allocateEDMAShadowChannel(handle, &shadowParam);
    
        chanCfg->eventQueue = eventQueue;
    
        return;
    }
    
    
    void EDMA_ChannelConfig()
    {
        DPC_ObjDet_EDMAChannelConfigAssist(gEdmaHandle[0],
                                               23,
                                               64+4,
                                               0,
                                               &gEdmaChannelCfg[0]);          //Decompressed dataIn EDMA ping
        DebugP_log("DPC_ObjDet_EDMAChannelConfigAssist 0 \r\n");
        DPC_ObjDet_EDMAChannelConfigAssist(gEdmaHandle[0],
                                           19,
                                           64+8,
                                           0,
                                           &gEdmaChannelCfg[1]); //Decompressed dataIn hot signature ping
        DebugP_log("DPC_ObjDet_EDMAChannelConfigAssist 1 \r\n");
        DPC_ObjDet_EDMAChannelConfigAssist(gEdmaHandle[0],
                                            42,
                                            64+6,
                                            0,
                                            &gEdmaChannelCfg[2]); //Decompressed dataout ping
        DebugP_log("DPC_ObjDet_EDMAChannelConfigAssist 2 \r\n");
        DPC_ObjDet_EDMAChannelConfigAssist(gEdmaHandle[0],
                                                3,
                                                64+5,
                                                0,
                                                &gEdmaChannelCfg[3]);          //Decompressed dataIn EDMA pong
        DebugP_log("DPC_ObjDet_EDMAChannelConfigAssist 3 \r\n");
         DPC_ObjDet_EDMAChannelConfigAssist(gEdmaHandle[0],
                                            20,
                                            64+9,
                                            0,
                                            &gEdmaChannelCfg[4]); //Decompressed dataIn hot signature pong
         DebugP_log("DPC_ObjDet_EDMAChannelConfigAssist 4 \r\n");
         DPC_ObjDet_EDMAChannelConfigAssist(gEdmaHandle[0],
                                             62,
                                             64+7,
                                             0,
                                             &gEdmaChannelCfg[5]); //Decompressed dataout pong
         DebugP_log("DPC_ObjDet_EDMAChannelConfigAssist 5 \r\n");
    }
    
    static int32_t DPU_DopplerProcHWA_configEdmaDecompressionIn()
    {
        DPEDMA_syncABCfg            syncABCfg;
        DPEDMA_ChainingCfg          chainingCfg;
        int32_t                     retVal = 0;
    
        /* PING */
        chainingCfg.chainingChannel                  = gEdmaChannelCfg[1].channel;
        chainingCfg.isIntermediateChainingEnabled = true;
        chainingCfg.isFinalChainingEnabled        = true;
    
        syncABCfg.srcAddress  = (uint32_t)(gAddressArray[0]);
        syncABCfg.destAddress = (uint32_t)(CSL_DSS_HWA_DMA0_RAM_BANK4_BASE);   //bank4
        syncABCfg.aCount      = 4096;
        syncABCfg.bCount      = 1;
        syncABCfg.cCount      = 6;
        syncABCfg.srcBIdx     = 0;
        syncABCfg.dstBIdx     = 0;
        syncABCfg.srcCIdx     = 8192;
        syncABCfg.dstCIdx     = 0;
    
        retVal = DPEDMA_configSyncAB(gEdmaHandle[0],
                                        &gEdmaChannelCfg[0],
                                        &chainingCfg,
                                        &syncABCfg,
                                        false,//isEventTriggered
                                        false, //isIntermediateTransferCompletionEnabled
                                        false,//isTransferCompletionEnabled
                                        NULL, //transferCompletionCallbackFxn
                                        NULL, //transferCompletionCallbackFxnArg
                                        NULL); /* intrObj */
    
        if(retVal!=0)
        {
            DebugP_log("Ping DPEDMA_configSyncAB error , retval=%d\r\n",retVal);
            goto exit;
        }
        if(&gEdmaChannelCfg[1]==NULL)
        {
            DebugP_log("gEdmaChannelCfg[1]==NULL");
        }
        if(gHwaHandle==NULL)
        {
            DebugP_log("gHwaHandle==NULL");
        }
        /* One Hot Signature to trigger the HWA */
        retVal = DPEDMAHWA_configOneHotSignature(gEdmaHandle[0],
                                                      &gEdmaChannelCfg[1],
                                                      gHwaHandle,
                                                      0,     // hwa trigger src = paramset0
                                                      0);
        if(retVal!=0)
         {
             DebugP_log("Ping DPEDMAHWA_configOneHotSignature error , retval=%d\r\n",retVal);
             goto exit;
         }
    
        /*Pong*/
        chainingCfg.chainingChannel                  = gEdmaChannelCfg[4].channel;
        syncABCfg.srcAddress  = (uint32_t)(gAddressArray[0])+4096;
        syncABCfg.destAddress = (uint32_t)(CSL_DSS_HWA_DMA0_RAM_BANK5_BASE);   //bank5
        retVal = DPEDMA_configSyncAB(gEdmaHandle[0],
                                            &gEdmaChannelCfg[3],
                                            &chainingCfg,
                                            &syncABCfg,
                                            false,//isEventTriggered
                                            false, //isIntermediateTransferCompletionEnabled
                                            false,//isTransferCompletionEnabled
                                            NULL, //transferCompletionCallbackFxn
                                            NULL, //transferCompletionCallbackFxnArg
                                            NULL); /* intrObj */
        if(retVal!=0)
        {
            DebugP_log("Ping DPEDMA_configSyncAB error , retval=%d\r\n",retVal);
            goto exit;
        }
        retVal = DPEDMAHWA_configOneHotSignature(gEdmaHandle[0],
                                                         &gEdmaChannelCfg[4],
                                                         gHwaHandle,
                                                         2,     // hwa trigger src = paramset0
                                                         0);
        if(retVal!=0)
          {
                DebugP_log("Pong DPEDMAHWA_configOneHotSignature error , retval=%d\r\n",retVal);
                goto exit;
          }
    
    
    exit:
        return(retVal);
    
    }
    
    uint32_t count = 0;
    static void DPU_DopplerProcHWA_edmaDoneIsrCallback(Edma_IntrHandle intrHandle,
       void *args)
    {
        count++;
    }
    static  int32_t DPU_DopplerProcHWA_configEdmaDecompressionOut()
    {
    
        DPEDMA_syncABCfg            syncABCfg;
        DPEDMA_ChainingCfg          chainingCfg;
        int32_t                     retVal;
    
        /* PING */
        chainingCfg.chainingChannel                  = gEdmaChannelCfg[0].channel;
        chainingCfg.isIntermediateChainingEnabled = true;//true;
        chainingCfg.isFinalChainingEnabled        = false;
    
        syncABCfg.srcAddress  = (uint32_t)(CSL_DSS_HWA_DMA0_RAM_BANK0_BASE);
        syncABCfg.destAddress = (uint32_t)(gAddressArray[1]);
        syncABCfg.aCount      = 8192;
        syncABCfg.bCount      = 1;
        syncABCfg.cCount      = 6;
        syncABCfg.srcBIdx     = 0;
        syncABCfg.dstBIdx     = 0;
        syncABCfg.srcCIdx     = 0;
        syncABCfg.dstCIdx     = 16384;
    
        retVal = DPEDMA_configSyncAB(   gEdmaHandle[0],
                                        &gEdmaChannelCfg[2],
                                        &chainingCfg,
                                        &syncABCfg,
                                        true,//isEventTriggered
                                        false, //isIntermediateTransferCompletionEnabled
                                        false,//isTransferCompletionEnabled
                                        NULL, //transferCompletionCallbackFxn
                                        NULL,//(void *)NULL, //transferCompletionCallbackFxnArg
                                        NULL); /* intrObj  for edma decompress data out */
        DebugP_log("DPU_DopplerProcHWA_configEdmaDecompressionOut Ping retVal=%d\r\n",retVal);
    
        /*PONG*/
        chainingCfg.chainingChannel                  = gEdmaChannelCfg[3].channel;
        syncABCfg.srcAddress  = (uint32_t)(CSL_DSS_HWA_DMA0_RAM_BANK2_BASE);
        syncABCfg.destAddress = (uint32_t)(gAddressArray[1])+8192;
        retVal = DPEDMA_configSyncAB(      gEdmaHandle[0],
                                           &gEdmaChannelCfg[5],
                                           &chainingCfg,
                                           &syncABCfg,
                                           true,//isEventTriggered
                                           true, //isIntermediateTransferCompletionEnabled
                                           true,//isTransferCompletionEnabled
                                           DPU_DopplerProcHWA_edmaDoneIsrCallback, //transferCompletionCallbackFxn
                                           (void*)(&count),//(void *)NULL, //transferCompletionCallbackFxnArg
                                           &gEdmaIntrObj[0]); /* intrObj  for edma decompress data out */
    
        DebugP_log("DPU_DopplerProcHWA_configEdmaDecompressionOut Pong retVal=%d\r\n",retVal);
    
        return(retVal);
    
    }
    
    int32_t HWACompression_config_EGE()
    {
    
           int32_t     errCode = SystemP_SUCCESS;
           uint8_t     paramsetIdx = 0;
           HWA_ParamConfig     hwaParamCfg[2];
    //       uint32_t index;
           HWA_InterruptConfig     paramISRConfig;
           uint8_t destChan;
    
    //       memset((void*)&paramISRConfig,0,sizeof(HWA_InterruptConfig));
           memset(hwaParamCfg, 0, 2*sizeof(HWA_ParamConfig));
    //       for(index = 0; index < 2; index++)
    //       {
    //              errCode = HWA_disableParamSetInterrupt(gHwaHandle, index+PrevParamsetEndIdx ,
    //                      HWA_PARAMDONE_INTERRUPT_TYPE_CPU_INTR1 | HWA_PARAMDONE_INTERRUPT_TYPE_DMA);
    //              if (errCode != 0)
    //              {
    //                  DebugP_log("disable paramset Interrupt error index = %d\r\n",index);
    //                  goto exit;
    //              }
    //       }
    
    
           /*Compress Paramset*/
    //       uint16_t numRx = 8;
    //       uint16_t numRangeBins = 512;
    //       uint16_t numRangeBinsPerBlock = 8;
    //       uint16_t Compressin_SamplesPerBlock = numRangeBinsPerBlock*numRx;  //rangeBins Per block * numRxAntenna Per block;
    //       uint16_t CompressIn_bytesPerSample = 4;        //int16_t complex
    //       uint16_t Compress_numBlocks =numRx*numRangeBins/Compressin_SamplesPerBlock ; //57
    //       uint16_t Compress_inputBytesPerBlock = CompressIn_bytesPerSample*Compressin_SamplesPerBlock; //256
    //       uint16_t Compressout_BytesPerBlock = compRatio*Compress_inputBytesPerBlock;
    //       uint16_t Compressout_bytesPerSample = 4;
    //       uint16_t Compressout_SamplesPerBlock =Compressout_BytesPerBlock/Compressout_bytesPerSample;
           /*Decompress Paramset*/
    //       uint16_t DeCompress_bytesPerSample = 4;        //int16_t complex
    //       uint16_t DeCompressout_SamplesPerBlock =numRx*numRangeBinsPerBlock;
    //       uint16_t DeCompressout_BytesPerBlock = DeCompressout_SamplesPerBlock*DeCompress_bytesPerSample;
    //       uint16_t DeCompress_numBlock = Compress_numBlocks;
    //       uint16_t DeCompress_inputBytesPerBlock = compRatio*DeCompressout_BytesPerBlock; //128
    //       uint16_t DeCompressin_SamplesPerBlock = DeCompress_inputBytesPerBlock/DeCompress_bytesPerSample;  //rangeBins Per block * numRxAntenna Per block;
    
          /*HWA Paramset config*/
          /*Compress EGE Paramset*/
    
    
    //       hwaParamCfg[paramsetIdx].triggerMode = HWA_TRIG_MODE_SOFTWARE;
    //       hwaParamCfg[paramsetIdx].accelMode = HWA_ACCELMODE_COMPRESS;
    //       hwaParamCfg[paramsetIdx].contextswitchCfg = HWA_PARAMSET_CONTEXTSWITCH_DISABLE;
    //
    //       /* ACCELMODE CONFIG */
    //       hwaParamCfg[paramsetIdx].accelModeArgs.compressMode.ditherEnable = HWA_FEATURE_BIT_DISABLE;//HWA_FEATURE_BIT_ENABLE;  // Enable dither to suppress quantization spurs
    //       hwaParamCfg[paramsetIdx].accelModeArgs.compressMode.compressDecompress = HWA_CMP_DCMP_COMPRESS;
    //       hwaParamCfg[paramsetIdx].accelModeArgs.compressMode.method = HWA_COMPRESS_METHOD_EGE;
    //       hwaParamCfg[paramsetIdx].accelModeArgs.compressMode.passSelect = HWA_COMPRESS_PATHSELECT_BOTHPASSES;
    //       hwaParamCfg[paramsetIdx].accelModeArgs.compressMode.headerEnable = HWA_FEATURE_BIT_ENABLE;
    //       hwaParamCfg[paramsetIdx].accelModeArgs.compressMode.scaleFactorBW = 4; //log2(sample bits)
    //
    //       /* SRC CONFIG */
    //       hwaParamCfg[paramsetIdx].source.srcAddr = (uint32_t)HWADRV_ADDR_TRANSLATE_CPU_TO_HWA(COMP_DATA_IN_HWA_SRC_ADDR);
    //
    //       hwaParamCfg[paramsetIdx].source.srcRealComplex = HWA_SAMPLES_FORMAT_COMPLEX;
    //       hwaParamCfg[paramsetIdx].source.srcWidth = HWA_SAMPLES_WIDTH_16BIT;
    //       hwaParamCfg[paramsetIdx].source.srcSign = HWA_SAMPLES_SIGNED;
    //       hwaParamCfg[paramsetIdx].source.srcConjugate = HWA_FEATURE_BIT_DISABLE;
    //       hwaParamCfg[paramsetIdx].source.srcScale = 8;
    //
    //       DebugP_log("%d\t%d\t%d\t%d\t%d\t%d\r\n",hwaParamCfg[paramsetIdx].source.srcAddr,hwaParamCfg[paramsetIdx].source.srcRealComplex,hwaParamCfg[paramsetIdx].source.srcWidth,hwaParamCfg[paramsetIdx].source.srcSign,
    //                  hwaParamCfg[paramsetIdx].source.srcConjugate,hwaParamCfg[paramsetIdx].source.srcScale);
    //
    //       /* DEST CONFIG */
    //       hwaParamCfg[paramsetIdx].dest.dstAddr = (uint32_t)HWADRV_ADDR_TRANSLATE_CPU_TO_HWA(COMP_DATA_OUT_HWA_DST_ADDR);
    //       hwaParamCfg[paramsetIdx].dest.dstRealComplex = HWA_SAMPLES_FORMAT_COMPLEX;
    //       hwaParamCfg[paramsetIdx].dest.dstWidth = HWA_SAMPLES_WIDTH_16BIT; /* 16 bit real, 16 bit imag */
    //       hwaParamCfg[paramsetIdx].dest.dstSign = HWA_SAMPLES_UNSIGNED;
    //       hwaParamCfg[paramsetIdx].dest.dstConjugate = HWA_FEATURE_BIT_DISABLE;
    //       hwaParamCfg[paramsetIdx].dest.dstScale = 0;
    //       hwaParamCfg[paramsetIdx].dest.dstSkipInit = 0;
    //
    //
    //       /*********************************/
    //       /* PING EGE COMPRESSION PARAMSET */
    //       /*********************************/
    //       hwaParamCfg[paramsetIdx].accelModeArgs.compressMode.EGEKarrayLength = 3; //log2(8)
    //
    //       /* SRC CONFIG */
    //       hwaParamCfg[paramsetIdx].source.srcAcnt = Compressin_SamplesPerBlock - 1;
    //       hwaParamCfg[paramsetIdx].source.srcAIdx = CompressIn_bytesPerSample;
    //       hwaParamCfg[paramsetIdx].source.srcBcnt = 1-1;//Compress_numBlocks-1;
    //       hwaParamCfg[paramsetIdx].source.srcBIdx = Compress_inputBytesPerBlock;
    //
    //       DebugP_log("%d\t%d\t%d\t%d\t\r\n",hwaParamCfg[paramsetIdx].source.srcAcnt,hwaParamCfg[paramsetIdx].source.srcAIdx,hwaParamCfg[paramsetIdx].source.srcBcnt,hwaParamCfg[paramsetIdx].source.srcBIdx);
    //
    //       /* DEST CONFIG */
    //       hwaParamCfg[paramsetIdx].dest.dstAcnt = Compressout_SamplesPerBlock - 1;
    //       hwaParamCfg[paramsetIdx].dest.dstAIdx = Compressout_bytesPerSample;
    //       hwaParamCfg[paramsetIdx].dest.dstBIdx = Compressout_BytesPerBlock;
    //
    //       errCode = HWA_configParamSet(gHwaHandle,paramsetIdx,&hwaParamCfg[paramsetIdx],NULL);
    //       if (errCode != 0)
    //       {
    //           DebugP_log("Error:COMPRESS HWA_configParamSet ERROR,errCode=%d\r\n", errCode);
    //           goto exit;
    //       }
    
             /*Decompress dummy paramset Ping*/
    //         hwaParamCfg[paramsetIdx].triggerMode = HWA_TRIG_MODE_DMA;
    //         hwaParamCfg[paramsetIdx].triggerSrc = 0;
    //         hwaParamCfg[paramsetIdx].accelMode = HWA_ACCELMODE_NONE;
    //         DebugP_log("dummy PrevParamsetEndIdx=%d\r\n",PrevParamsetEndIdx);
    //         errCode = HWA_configParamSet(gHwaHandle,
    //                                       PrevParamsetEndIdx,
    //                                       &hwaParamCfg[paramsetIdx],NULL);
    //         if (errCode != 0)
    //         {
    //             DebugP_log("Error:DECOMPRESS DUMMP HWA_configParamSet ERROR,errCode=%d\r\n", errCode);
    //             goto exit;
    //         }
       /*DeCompress EGE Paramset Ping*/
    //      paramsetIdx++;
    //      PrevParamsetEndIdx++;
    
          hwaParamCfg[paramsetIdx].triggerMode = HWA_TRIG_MODE_DMA;//HWA_TRIG_MODE_IMMEDIATE;
          hwaParamCfg[paramsetIdx].triggerSrc = 0;
          hwaParamCfg[paramsetIdx].accelMode = HWA_ACCELMODE_COMPRESS;
    
          /* ACCELMODE CONFIG */
          hwaParamCfg[paramsetIdx].accelModeArgs.compressMode.ditherEnable = HWA_FEATURE_BIT_DISABLE;//HWA_FEATURE_BIT_ENABLE;  // Enable dither to suppress quantization spurs
          hwaParamCfg[paramsetIdx].accelModeArgs.compressMode.compressDecompress = HWA_CMP_DCMP_DECOMPRESS;
          hwaParamCfg[paramsetIdx].accelModeArgs.compressMode.method = HWA_COMPRESS_METHOD_EGE;
          hwaParamCfg[paramsetIdx].accelModeArgs.compressMode.passSelect = HWA_COMPRESS_PATHSELECT_BOTHPASSES;
          hwaParamCfg[paramsetIdx].accelModeArgs.compressMode.headerEnable = HWA_FEATURE_BIT_ENABLE;
          hwaParamCfg[paramsetIdx].accelModeArgs.compressMode.scaleFactorBW = 4; //log2(sample bits)
          hwaParamCfg[paramsetIdx].accelModeArgs.compressMode.EGEKarrayLength = 3; //log2(8)
    
          /* SRC CONFIG */
          hwaParamCfg[paramsetIdx].source.srcAddr = (uint32_t)HWADRV_ADDR_TRANSLATE_CPU_TO_HWA(CSL_DSS_HWA_DMA0_RAM_BANK4_BASE);
    
          hwaParamCfg[paramsetIdx].source.srcRealComplex = HWA_SAMPLES_FORMAT_COMPLEX;
          hwaParamCfg[paramsetIdx].source.srcWidth = HWA_SAMPLES_WIDTH_16BIT;
          hwaParamCfg[paramsetIdx].source.srcSign = HWA_SAMPLES_UNSIGNED;
          hwaParamCfg[paramsetIdx].source.srcConjugate = HWA_FEATURE_BIT_DISABLE;
          hwaParamCfg[paramsetIdx].source.srcScale = 0;
    
          hwaParamCfg[paramsetIdx].source.srcAcnt = 32-1;//DeCompressin_SamplesPerBlock - 1;
          hwaParamCfg[paramsetIdx].source.srcAIdx = 4;//DeCompress_bytesPerSample;
          hwaParamCfg[paramsetIdx].source.srcBcnt = 32 - 1;  //128-1   //3 loops to decompress 48KB one block data
          hwaParamCfg[paramsetIdx].source.srcBIdx = 128;//DeCompressin_SamplesPerBlock*DeCompress_bytesPerSample; //128
    
          DebugP_log("%d\t%d\t%d\t%d\r\n",hwaParamCfg[paramsetIdx].source.srcAcnt,hwaParamCfg[paramsetIdx].source.srcAIdx, hwaParamCfg[paramsetIdx].source.srcBcnt,hwaParamCfg[paramsetIdx].source.srcBIdx);
    
          /* DEST CONFIG */
          hwaParamCfg[paramsetIdx].dest.dstAddr = (uint32_t)HWADRV_ADDR_TRANSLATE_CPU_TO_HWA(CSL_DSS_HWA_DMA0_RAM_BANK0_BASE);
          hwaParamCfg[paramsetIdx].dest.dstRealComplex = HWA_SAMPLES_FORMAT_COMPLEX;
          hwaParamCfg[paramsetIdx].dest.dstWidth = HWA_SAMPLES_WIDTH_16BIT; /* 16 bit real, 16 bit imag */
          hwaParamCfg[paramsetIdx].dest.dstSign = HWA_SAMPLES_SIGNED;
          hwaParamCfg[paramsetIdx].dest.dstConjugate = HWA_FEATURE_BIT_DISABLE;
          hwaParamCfg[paramsetIdx].dest.dstScale = 0;
          hwaParamCfg[paramsetIdx].dest.dstSkipInit = 0;
    
          hwaParamCfg[paramsetIdx].dest.dstAcnt = 64-1;//DeCompressout_SamplesPerBlock - 1;
          hwaParamCfg[paramsetIdx].dest.dstAIdx = 4;//DeCompress_bytesPerSample;
          hwaParamCfg[paramsetIdx].dest.dstBIdx = 256;//DeCompressout_BytesPerBlock;
    
          errCode = HWA_configParamSet(gHwaHandle,PrevParamsetEndIdx,&hwaParamCfg[paramsetIdx],NULL);
          if (errCode != 0)
             {
                 DebugP_log("Error:DECOMPRESS HWA_configParamSet ERROR,errCode=%d\r\n", errCode);
                 goto exit;
             }
          HWA_getDMAChanIndex(gHwaHandle,gEdmaChannelCfg[2].channel,&destChan);
          DebugP_log("destChan = %d\tPrevParamsetEndIdx=%d\r\n",destChan,PrevParamsetEndIdx);
          paramISRConfig.interruptTypeFlag = HWA_PARAMDONE_INTERRUPT_TYPE_DMA;
          paramISRConfig.dma.dstChannel = destChan;
    
          errCode = HWA_enableParamSetInterrupt(gHwaHandle,PrevParamsetEndIdx,&paramISRConfig);
          if (errCode != 0)
          {
              DebugP_log("HWA_enableParamSetInterrupt failed\r\n");
              goto exit;
          }
          /*Pong*/
    
          PrevParamsetEndIdx++;
          paramsetIdx++;
    
          hwaParamCfg[paramsetIdx] = hwaParamCfg[0];
          hwaParamCfg[paramsetIdx].triggerSrc = 2;
          hwaParamCfg[paramsetIdx].accelMode = HWA_ACCELMODE_COMPRESS;
          hwaParamCfg[paramsetIdx].source.srcAddr = (uint32_t)HWADRV_ADDR_TRANSLATE_CPU_TO_HWA(CSL_DSS_HWA_DMA0_RAM_BANK5_BASE);
          hwaParamCfg[paramsetIdx].dest.dstAddr = (uint32_t)HWADRV_ADDR_TRANSLATE_CPU_TO_HWA(CSL_DSS_HWA_DMA0_RAM_BANK2_BASE);
    
          errCode = HWA_configParamSet(gHwaHandle,PrevParamsetEndIdx,&hwaParamCfg[paramsetIdx],NULL);
          if (errCode != 0)
             {
                      DebugP_log("Error:DECOMPRESS HWA_configParamSet ERROR,errCode=%d\r\n", errCode);
                      goto exit;
             }
           HWA_getDMAChanIndex(gHwaHandle,gEdmaChannelCfg[5].channel,&destChan);
           DebugP_log("destChan = %d\tPrevParamsetEndIdx=%d\r\n",destChan,PrevParamsetEndIdx);
           paramISRConfig.interruptTypeFlag = HWA_PARAMDONE_INTERRUPT_TYPE_DMA;
           paramISRConfig.dma.dstChannel = destChan;
    
           errCode = HWA_enableParamSetInterrupt(gHwaHandle,PrevParamsetEndIdx,&paramISRConfig);
           if (errCode != 0)
           {
               DebugP_log("HWA_enableParamSetInterrupt failed\r\n");
               goto exit;
           }
    
    
          /*****************/
          /* COMMON CONFIG */
          /*****************/
    
             memset((void *)&COMPRESScommonConfig, 0, sizeof(HWA_CommonConfig));
             COMPRESScommonConfig.configMask = HWA_COMMONCONFIG_MASK_STATEMACHINE_CFG;
             COMPRESScommonConfig.configMask|=HWA_COMMONCONFIG_MASK_EGECOMRESS_KPARAM;
             COMPRESScommonConfig.paramStartIdx = 0 ;
             COMPRESScommonConfig.paramStopIdx = 1;
             COMPRESScommonConfig.numLoops = 6;
             COMPRESScommonConfig.compressConfig.EGEKparam[0] = 3;
             COMPRESScommonConfig.compressConfig.EGEKparam[1] = 4;
             COMPRESScommonConfig.compressConfig.EGEKparam[2] = 5;
             COMPRESScommonConfig.compressConfig.EGEKparam[3] = 7;
             COMPRESScommonConfig.compressConfig.EGEKparam[4] = 9;
             COMPRESScommonConfig.compressConfig.EGEKparam[5] = 11;
             COMPRESScommonConfig.compressConfig.EGEKparam[6] = 13;
             COMPRESScommonConfig.compressConfig.EGEKparam[7] = 15;
    
             errCode = HWA_configCommon(gHwaHandle, &COMPRESScommonConfig);
             if (errCode != 0)
             {
                 DebugP_log("Error:COMMON CONFIG HWA_configCommon ERROR,errCode=%d\r\n", errCode);
                 goto exit;
             }
    
       exit:
    
       return errCode;
    
    }
    
    
    void hwaHandlefxn(void *args)
    {
        DebugP_log("Start to handle HWA Process\r\n");
        gAddressArray[0] = (uint32_t)(&CompressedData[0]);   // compressed data address
        gAddressArray[1] = (uint32_t)(&DataDeCompressed[0]); //decompressed data address
        DebugP_log("gAddressArray[%d]=%p\r\n",0,gAddressArray[0]);
        DebugP_log("gAddressArray[%d]=%p\r\n",1,gAddressArray[1]);
    
        int32_t  status = SystemP_SUCCESS;
        CycleCounterP_reset(); /* Reset CPU cycle counter */
        gHwaHandle = HWA_open(0, NULL, &status);
        if(gHwaHandle == NULL)
         {
           DebugP_log("Error: Unable to open HWA instance. Error: %d\r\n", status);
           DebugP_assert(gHwaHandle == NULL);
         }
        DebugP_log("HWA Instance has been opened successfully\r\n");
    
        /*EDMA CONFIG*/
        EDMA_ChannelConfig();
    
    
        HWACompression_config_EGE();
        status=DPU_DopplerProcHWA_configEdmaDecompressionIn();
        if(status!=0){DebugP_log("DPU_DopplerProcHWA_configEdmaDecompressionIn failed\r\n");}
        status=DPU_DopplerProcHWA_configEdmaDecompressionOut();
        if(status!=0){DebugP_log("DPU_DopplerProcHWA_configEdmaDecompressionOut failed\r\n");}
        DebugP_log("EDMA Config Done\r\n");
    
    
        /*decompressed one block data*/
    
        HWA_enable(gHwaHandle, 0);
        HWA_configCommon(gHwaHandle, &COMPRESScommonConfig);
        status=HWA_enable(gHwaHandle, 1);
        DebugP_log("numParamset = %d status=%d\r\n",((HWA_Object *)gHwaHandle)->hwAttrs->numHwaParamSets,status);
        status = DPEDMA_edmaStartTransferManualTrigger(gEdmaHandle[0], (uint32_t)gEdmaChannelCfg[0].channel);
        if (status != 0)
          {
              DebugP_log("DPEDMA_edmaStartTransferManualTrigger error status=%d\r\n",status);
          }
          else
          {
              DebugP_log("DPEDMA_edmaStartTransferManualTrigger without error\r\n");
          }
        status = DPEDMA_edmaStartTransferManualTrigger(gEdmaHandle[0], (uint32_t)gEdmaChannelCfg[3].channel);
        if (status != 0)
        {
            DebugP_log("DPEDMA_edmaStartTransferManualTrigger error status=%d\r\n",status);
        }
        else
        {
            DebugP_log("DPEDMA_edmaStartTransferManualTrigger without error\r\n");
        }
    
    
    
    
    
        /* Open HWA driver */
    //    runCmpTest((uint8_t*)(&DataCompressed[0]),0.5);
        /* HWA driver close */
    
    //    HWA_controlPeripheralSuspendMode(gHwaHandle, 0);
    //    status += HWA_close(gHwaHandle);
    //    DebugP_assert(SystemP_SUCCESS == status);
    //
    //    if(status == SystemP_SUCCESS)
    //    {
    //        DebugP_log("\r\n\nHWA BFP Compression/Decompression Test Completed!!\r\n");
    //    }
    
    }
    
    

    代码参照了SDK中 HWA数据解压缩的代码

  • 你好,工程师

    经过测试,我发现可能为函数DPEDMAHWA_configOneHotSignature配置的Ccnt有问题,我将hotSignature的值配置为HWA的loopCnt后,可以成功执行所有的loop,并正常输出到L3上;在SDK中,该函数配置hotSignature的Ccnt=1;请问为什么在我的CCS代码中,该Ccnt耗尽之后不会重新加载?

    谢谢

  • 感谢您对TI产品的关注!由于问题比较复杂,已将您的问题发布在E2E英文技术论坛上,由资深的英文论坛工程师为您提供帮助。工程师需要一些时间看一下问题。
    e2e.ti.com/.../am2732-hwa_trig_mode_dma-trigger-paramset

  • 你好

    我们发现在配置EDMA paramset时,实际使用的EDMA paramset配置没有问题,但是配置的shadow EDMA paramset的参数存在问题;通过查看shadow paramset的寄存器得知,该参数与预设的不同,导致实际的EDMA cnt耗尽之后link到shadow EDMA paramset,拷贝得到的参数配置有问题,导致上述的问题出现;请问,为什么shadow EDMA的配置会有问题?在配置shadow EDMA之前我尝试打印各参数的值,均正常;使用的函数如上附的代码所示是DPEDMA_setup_shadow_link。

    谢谢

  • 你好,工程师

    我最终定位到了问题,在函数DPEDMA_setup_shadow_link中有一个变量edmaParam,该变量在使用函数EDMA_ccPaRAMEntry_init进行初始化后,使用“=”进行结构体赋值,edmaParam = *config;  在赋值后,导致出现了2Byte的偏移,使参数出现错位,导致最终配置的paramset错误;

    我不使用等号进行结构体赋值后,参数配置正常,程序也能正常运行了;

    请让专家帮忙确认,该问题是否是由结构体赋值方式引入的。

    谢谢

  • 已跟进帖子,请关注帖子的回复。