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.

map a specific memory region to the DSP MMU only during runtime of the application error

Other Parts Discussed in Thread: OMAP3530

I use the 3730 evm ,Development Environment is:dvsdk:ti-dvsdk_dm3730-evm_4_01_00_09 ,dsplink is dsplink_1_65_00_02. I'd like to map a specific memory region to the DSP MMU only during runtime of the application. there are some guides:http://processors.wiki.ti.com/index.php/DSP_MMU_Faults ,http://processors.wiki.ti.com/index.php/OMAP3_DSP_MMU_Configuration

main_native.c(run arm):

    ProcMemMapInfo mapInfo,mapInfo2; 
    mapInfo.dspAddr = 0x86000000 ;
    mapInfo.size= 510*sizeof(unsigned short);
    PROC_control (ID_PROCESSOR,PROC_CTRL_CMD_MMU_ADD_ENTRY,&mapInfo) ;
    PROC_control (ID_PROCESSOR,PROC_CTRL_CMD_MAP_DSPMEM,&mapInfo) ;
    PROC_write(0, 0x86000000,510*sizeof(unsigned short),div_table);
    
    mapInfo2.dspAddr = 0x86000000+1024*sizeof(unsigned short);
    mapInfo2.size= sizeof(struct  RVM_LookupTable);
    PROC_control (ID_PROCESSOR,PROC_CTRL_CMD_MMU_ADD_ENTRY,&mapInfo2) ;
    PROC_control (ID_PROCESSOR,PROC_CTRL_CMD_MAP_DSPMEM,&mapInfo2) ;
    PROC_write(0, 0x86000000+1024*sizeof(unsigned short),sizeof(struct RVM_LookupTable),appLUT);
    rvt = smain(argc, argv,(void *)user_io_buffers[buf.index].user_addr, appLUT,div_table,dest);
    Engine_close(ce);

app.c (run dsp ):

 ProcMemMapInfo mapInfo,mapInfo2; 
 mapInfo.dspAddr = 0x86000000 ;
 mapInfo.size= 510*sizeof(unsigned short);
   PROC_read (0,mapInfo.dspAddr,mapInfo.size,div_ptr) ;
   /* darklight buf set*/
    darklight_input.descs[0].bufSize=BUF_SIZE*sizeof(XDAS_Int8);
    darklight_input.descs[0].buf=(XDAS_Int8 *) s_ptr;

    darklight_input.descs[1].bufSize=510*sizeof(unsigned short);
    darklight_input.descs[1].buf=(XDAS_Int8 *) div_ptr;


    darklight_output.descs[0].bufSize=BUF_SIZE*sizeof(XDAS_Int8);
    darklight_output.descs[0].buf=darkoutbuf; 

       
 /*status = *///PROC_control (ID_PROCESSOR,PROC_CTRL_CMD_MMU_ADD_ENTRY,&mapInfo) ;
 /*status =*/ //PROC_control (ID_PROCESSOR,PROC_CTRL_CMD_MAP_DSPMEM,&mapInfo) ;

 

 

 


    /* allocate and initialize universal alg on the engine */
    hUniversal_d = UNIVERSAL_create(ce, universaldark,(UNIVERSAL_Params *)params/*NULL*/);
    if (hUniversal_d == NULL) {
        printf( "App-> ERROR: can't open codec %s\n", universaldark);
        goto end;
    }
#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(s_ptr, BUF_SIZE*sizeof(XDAS_Int8));
 Memory_cacheWbInv(div_ptr, BUF_SIZE*sizeof(XDAS_Int8));
#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(darkoutbuf, BUF_SIZE*sizeof(XDAS_Int8));
#endif


    status = UNIVERSAL_process(hUniversal_d, &darklight_input,
                &darklight_output, NULL, &universalInArgs, &universalOutArgs);
#ifdef CACHE_ENABLED
        /*
         * Conditionally writeback the processed buf from the previous
         * call.
         */
        if (XDM_ISACCESSMODE_WRITE(darklight_output.descs[0].accessMask)) {
            Memory_cacheWb(darkoutbuf, BUF_SIZE*sizeof(XDAS_Int8));
        }
#endif

    i = Engine_getCpuLoad(ce);
    //memcpy(inbuf,darkoutbuf,BUF_SIZE*sizeof(XDAS_Int8));
     //inbuf = darkoutbuf;
#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(darkoutbuf, BUF_SIZE*sizeof(XDAS_Int8));
#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(outbuf, BUF_SIZE*sizeof(XDAS_Int8));
#endif
 


 /*status = *///PROC_control (ID_PROCESSOR,PROC_CTRL_CMD_UNMAP_DSPMEM,&mapInfo) ;
 /*status = */ //PROC_control (ID_PROCESSOR,PROC_CTRL_CMD_MMU_DEL_ENTRY,&mapInfo) ;

 mapInfo2.dspAddr = 0x86000000+1024*sizeof(unsigned short);
 mapInfo2.size= sizeof(struct  RVM_LookupTable);
PROC_read (0,mapInfo2.dspAddr,mapInfo2.size,str_ptr) ;
   rvm_input.descs[0].bufSize=BUF_SIZE*sizeof(XDAS_Int8);
   //rvm_input.descs[0].buf= inbuf;
   rvm_input.descs[0].buf= darkoutbuf;

   rvm_input.descs[1].bufSize = MAX_RVM_BLOCK_COUNT * sizeof(unsigned char);
   rvm_input.descs[1].buf = (XDAS_Int8 *)(&(str_ptr->inputBlockHeight[0]));

    rvm_input.descs[2].bufSize = MAX_RVM_BLOCK_COUNT * sizeof(unsigned char);
    rvm_input.descs[2].buf = (XDAS_Int8 *)(&(str_ptr->inputBlockWidth[0]));

    rvm_input.descs[3].bufSize = MAX_RVM_BLOCK_COUNT * sizeof(unsigned long long);
    rvm_input.descs[3].buf = (XDAS_Int8 *)(&(str_ptr->inputBlockOffset[0]));

    rvm_input.descs[4].bufSize = MAX_RVM_BLOCK_COUNT * sizeof(unsigned long long);
    rvm_input.descs[4].buf = (XDAS_Int8 *)(&(str_ptr->outputBlockOffset[0]));

    rvm_input.descs[5].bufSize = MAX_RVM_BLOCK_COUNT * sizeof(long long);
    rvm_input.descs[5].buf = (XDAS_Int8 *)(&(str_ptr->rightEdgePadBytes[0]));

    rvm_input.descs[6].bufSize = MAX_RVM_BLOCK_COUNT * MAX_RVM_BLOCK_SIZE * MAX_RVM_BLOCK_SIZE * sizeof(unsigned short);
    rvm_input.descs[6].buf = (XDAS_Int8 *)(&(str_ptr->param1[0]));

    rvm_input.descs[7].bufSize = MAX_RVM_BLOCK_COUNT * MAX_RVM_BLOCK_SIZE * MAX_RVM_BLOCK_SIZE * sizeof(unsigned int);   
    rvm_input.descs[7].buf = (XDAS_Int8 *)(&(str_ptr->param2[0]));


    rvm_output.descs[0].bufSize=BUF_SIZE*sizeof(XDAS_Int8);
    rvm_output.descs[0].buf=outbuf;
 
 /*status = */PROC_control (ID_PROCESSOR,PROC_CTRL_CMD_MMU_ADD_ENTRY,&mapInfo) ;
 /*status = */PROC_control (ID_PROCESSOR,PROC_CTRL_CMD_MAP_DSPMEM,&mapInfo) ;

 

 


    hUniversal_r = UNIVERSAL_create(ce, universalrvm,NULL);
    if (hUniversal_r == NULL) {
        printf( "App-> ERROR: can't open codec %s\n", universalrvm);
        goto end;
    }
 
  

    status = UNIVERSAL_process(hUniversal_r, &rvm_input,
                &rvm_output, NULL, &universalInArgs, &universalOutArgs);

    //memcpy(s_ptr,outbuf,BUF_SIZE*sizeof(XDAS_Int8));
    //s_ptr = outbuf;
    //buf = outbuf;
 
   //memcpy(buf,outbuf,BUF_SIZE*sizeof(XDAS_Int8));
#ifdef CACHE_ENABLED
        /*
         * Conditionally writeback the processed buf from the previous
         * call.
         */
        if (XDM_ISACCESSMODE_WRITE(rvm_output.descs[0].accessMask)) {
            Memory_cacheWb(outbuf, BUF_SIZE*sizeof(XDAS_Int8));
        }
#endif

#ifdef CACHE_ENABLED
#ifdef xdc_target__isaCompatible_64P
        /* 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(outbuf, BUF_SIZE*sizeof(XDAS_Int8));
#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(dst, BUF_SIZE*sizeof(XDAS_Int8));
#endif


 /*status = */PROC_control (ID_PROCESSOR,PROC_CTRL_CMD_UNMAP_DSPMEM,&mapInfo2) ;
 /*status = */PROC_control (ID_PROCESSOR,PROC_CTRL_CMD_MMU_DEL_ENTRY,&mapInfo2) ;

 

 

 

 

 

 

error:

 8002.87> @0x0004987e:[T:0x4001e320] desay.apps.darkrvm - set camare fmt!!!
 8002.89> Driver buffer:Got 0x40a2d000 from CMEM, phy = 0x84eae000
 8002.89> Driver buffer:Got 0x40ad6000 from CMEM, phy = 0x84e05000
 8002.89> Driver buffer:Got 0x40b7f000 from CMEM, phy = 0x84d5c000
 8002.90> Driver buffer:Got 0x40c28000 from CMEM, phy = 0x84cb3000
 8002.90> @0x0004c920:[T:0x4001e320] desay.apps.darkrvm - SN_H:0
 8003.00> Configuration error: Combined memory entries (starting with ADDRDSPVIRT = 0x86000000) does not have a size that is a multiple of 4KB. Size is 1020.
 8003.01> omap3isp omap3isp: isp_wait: wait is too much
 8003.01> omap3isp omap3isp: ccdc 1 won't become idle!
 8003.01> Unable to handle kernel paging request at virtual address 00ffffff
 8003.01> pgd = cc804000
 8003.03> [00ffffff] *pgd=00000000
 8003.03> Internal error: Oops: 805 [#1]
 8003.03> last sysfs file: /sys/devices/platform/omapdss/manager0/display
 8003.04> Modules linked in: cmemk sdmak lpm_omap3530 dsplinkk bufferclass_ti omaplfb pvrsrvkm [last unloaded: cmemk]
 8003.04> CPU: 0    Not tainted  (2.6.32 #1)
 8003.04> PC is at memcpy+0xfc/0x330
 8003.04> LR is at 0x0
 8003.06> pc : [<c01817fc>]    lr : [<00000000>]    psr: 20000013
 8003.06> sp : cfa85e5c  ip : 00000001  fp : bee0184c
 8003.06> r10: 000003fc  r9 : cfa84000  r8 : 00000001
 8003.06> r7 : bf06109c  r6 : 00000000  r5 : 00000000  r4 : 86000000
 8003.07> r3 : 00000001  r2 : 000003f7  r1 : 0003424d  r0 : 00ffffff
 8003.07> Flags: nzCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment user
 8003.07> Control: 10c5387d  Table: 8c804019  DAC: 00000015
 8003.09> Process app_remote.xv5T (pid: 1658, stack limit = 0xcfa842e8)
 8003.09> Stack: (0xcfa85e5c to 0xcfa86000)
 8003.09> 5e40:                                                                00ffffff
 8003.10> 5e60: 86000000 bf059a6c 86000000 bf04b1fc 000003fc 0003424c 00000001 bf04cef4
 8003.10> 5e80: 0003424c 86000000 00000001 c018e01c bee01864 c018e01c bee01864 bee01864
 8003.14> 5ea0: 00000000 bf05cacc 0003424c 86000000 000003fc bf05de10 cc9e30f4 c0184a3c
 8003.14> 5ec0: 00087e73 00087e03 00086000 00086000 0000e838 cc9e30f4 cc9e30d0 400844ff
 8003.14> 5ee0: 415f7000 00008000 00000000 86000000 000003fc 0003424c 00000260 c00a114c
 8003.14> 5f00: cc9e30d0 cc8330c0 bee01864 c018e01c cc8330c0 c00bb3d4 00000006 cc8330c0
 8003.14> 5f20: 00000006 c00bbad4 cc8330c0 00086000 00000000 00000000 cfa85f48 00000001
 8003.15> 5f40: 00001000 cc8e3928 415f7000 cfb06b38 cfb06b40 cc9d4ac8 cfb64000 cfa84000
 8003.15> 5f60: cfa84000 cc8330c0 00000006 bee01864 c018e01c cc8330c0 c0034068 cfa84000
 8003.17> 5f80: 00000000 c00bbb4c 00000006 00000001 bee01864 bee01bd8 86000000 001f11a8
 8003.17> 5fa0: 00000036 c0033ec0 bee01bd8 86000000 00000006 c018e01c bee01864 00000006
 8003.18> 5fc0: bee01bd8 86000000 001f11a8 00000036 000461e0 00000260 002382c8 bee0184c
 8003.18> 5fe0: 0003424c bee01738 00021778 40115aec 80000010 00000006 00000000 00000000
 8003.18> Code: e4d1e001 c4c03001 a4c04001 e052200c (e4c0e001)
 8003.20> ---[ end trace 9c2458f509849903 ]---

 

 

Please help me!Thanks!