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.

About DM8127 ipnc3.0 use DMA copy cmem data to system memory

Genius 3400 points

Hi all!
DM8127 on ipnc3.0,we want to use DMA copy the cmem data to system memory.
Them modifid codes are as follows:

unsigned char *snapbuf = NULL;
#define BUFSIZE (512*1024)

static int count = 0;
int filesize = 0;
int CacheMng_Video_CacheLock(int serial, VIDEO_BLK_INFO * pVidInfo)
{
        .....
    if(snapbuf == NULL)
    {
        snapbuf = malloc(BUFSIZE); //use system memroy
        //use cmem memory
        //CMEM_AllocParams prm;
        //prm.type = CMEM_HEAP;
        //prm.flags = CMEM_NONCACHED;
        //prm.alignment = 32;
        //snapbuf = (Uint8 *)CMEM_alloc(BUFSIZE,&prm);


        if (snapbuf == NULL)
            OSA_printf("#### zhangjp malloc error\n");
        else
        {
            OSA_printf("#### zhangjp malloc ok\n");
            memset(snapbuf,0,BUFSIZE);
        }
    }
    .....
    if (pFrame)
    {
        if(snapbuf != NULL)
        {
            int ret1 = 0;
            char filename[32];

            memset(filename,0,sizeof(filename));
            if(count++%50 == 0)
            {
                filesize = pFrame->realsize;

                memset(snapbuf,0,BUFSIZE);
                CacheMng_MemCpy((void *)snapbuf,
                            (void *) (pVidInfo->start +pFrame->blkindex * pVidInfo->blk_sz),
                            filesize);

                //memcpy(snapbuf,
                            // (char *) (pVidInfo->start +pFrame->blkindex * pVidInfo->blk_sz),
                            // pFrame->realsize);

                usleep(300*1000);

                sprintf(filename,"/tmp/%d.jpg",count);
                ret1 = fileWriteFile(filename,snapbuf,filesize); //save pic to file
                if (ret1 == OSA_SOK)
                {
                    OSA_printf("write ok \n");
                }
        }
    }
}

When we use cmem memory and CacheMng_MemCpy(),or use the system memory and
memcpy(),the save jpg file is ok.But use the system memory and
CacheMng_MemCpy() just as the above code,the save jpg file is wrong ,just as
follows pic:

The first half of snapbuf have valid data ,and the second half value are all 0.

Is CacheMng_MemCpy() only use cmem memory?

Thanks!