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.

GPP端cache操作问题



我在DM6467 ARM端例程的APP.C 中看到在call DSP端算法前要做

cacheWBINV和cacheINV,call以后要cacheWB。

例程中的buffer大小默认是1024,我做图像处理,需要一次读写一帧图像,

所以我设置的buffer大小是1M

这种情况,cache相关操作要怎么做?

        /*
         *  fread() on this processor is implemented using CCS's stdio, which
         *  is known to write into the cache, not physical memory.  To meet
         *  xDAIS DMA Rule 7, we must writeback the cache into physical
         *  memory.  Also, per DMA Rule 7, we must invalidate the buffer's
         *  cache before providing it to any xDAIS algorithm.
         */

根据这个说明,如果我不使用DMA,是不是可以不做cacheINV这些操作

  • 是否启动DMA要在哪个文件中设置?

  • 你好,

    DSP是否使用EDMA,这是和DSP的代码有关系的。你可以让DSP自己来维护cache管理,而不使用ARM来做。

  • Chris Meng 说:

    你好,

    DSP是否使用EDMA,这是和DSP的代码有关系的。你可以让DSP自己来维护cache管理,而不使用ARM来做。

    Chris 你好

    我的问题不是来自DSP端。

    我修改/ti/sdo/ce/examples/apps/image_copy例程来实现针对单幅图片进行图像增强

    在ARM端程序的app.c文件中有这么一段代码和注释

    #ifdef CACHE_ENABLED
    #ifdef xdc_target__isaCompatible_64P
            /*
             *  fread() on this processor is implemented using CCS's stdio, which
             *  is known to write into the cache, not physical memory.  To meet
             *  xDAIS DMA Rule 7, we must writeback the cache into physical
             *  memory.  Also, per DMA Rule 7, we must invalidate the buffer's
             *  cache before providing it to any xDAIS algorithm.
             */
            Memory_cacheWbInv(inBuf, IFRAMESIZE);
    #else
    #error Unvalidated config - add appropriate fread-related cache maintenance
    #endif
            /* Per DMA Rule 7, our output buffer cache lines must be cleaned */
            Memory_cacheInv(encodedBuf, EFRAMESIZE);
    #endif

    以上这些操作都是在ARM端进行的,我想了解下在什么条件下,我才需要处理这些操作。

    这些操作跟ARM端程序是否使用DMA有关系么?

    如果ARM端程序可以使用DMA,在哪里设置是否使用?

    PS:针对上面的代码,编译条件 如#define CACHE_ENABLED是在哪个文件中定义的

  • 你好,

    请问你的算法是运行在ARM上么?如果是,请参考http://processors.wiki.ti.com/index.php/Codec_Engine_Cache_Per_Alg

    请问你使用的硬件平台是哪一个?Linux上有EDMA的驱动,你是可以调用的。

  • Chris Meng 说:

    你好,

    请问你的算法是运行在ARM上么?如果是,请参考http://processors.wiki.ti.com/index.php/Codec_Engine_Cache_Per_Alg

    请问你使用的硬件平台是哪一个?Linux上有EDMA的驱动,你是可以调用的。

    你好:

    我的算法是运行在DSP端,目前运行没有问题。

    我只是想了解一下,当算法实际上在DSP端运行时,在ARM端进行如下操作的意义是什么。

            /* Deal with cache issues, if necessary */
    #ifdef CACHE_ENABLED
    #ifdef xdc_target__isaCompatible_64P
            /*
             *  fread() on this processor is implemented using CCS's stdio, which
             *  is known to write into the cache, not physical memory.  To meet
             *  xDAIS DMA Rule 7, we must writeback the cache into physical
             *  memory.  Also, per DMA Rule 7, we must invalidate the buffer's
             *  cache before providing it to any xDAIS algorithm.
             */
            Memory_cacheWbInv(inBuf, IFRAMESIZE);
    #else
    #error Unvalidated config - add appropriate fread-related cache maintenance
    #endif
        Memory_cacheInv(outBuf, OFRAMESIZE);
    #endif

    以上的cache操作是否只是针对codec运行在local的情况?

    此外,关于那段代码注释我有两个问题

    1,fread()使用CCS实现,其实际上是写入cache中而非内存

    这是否说明,只要使用fread()来读取本地图片文件,都是将图像数据写入cache中?

    但是我所使用的图片大小都是1MB,必然超过片内L1 L2cache的大小。

    所以我想知道,fread()在执行时,是如何处理cache问题的。

    2, DMA Rule 7问题,DSP端算法没有启用DMA功能,我也知道在配置文件中如何设置DMA功能的开关

    但是针对ARM端程序(非codec运行于ARM端的情况),比如完成简单的图像文件的读取,然后将buffer传递给DSP端的server进行处理

    我如何控制是否启用DMA。