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.

Question about xdm Codec Server and arm process

I have a quick question. I am using DM6446 with Monta vista linux.
I have implemented one algoCodecs.x64P dsp codec server which contains h264 codec and audio echo cancellar. Now I have two separate applications, one is video application which uses h264 codec and another is audio application which uses echo canceller.
 
Now the question is: Can I run these two processes at the same time which are using algoCodecs.x64P codecs combo? (Note that they are not a single application, they are two different applications. If the answer is no then I have to merge this two application into one.)
 
  • Hi,

    You can not run two separate applications at the same time because each application will try to load your codec server.

    You can create a single application with multiple threads. Please see the DVSDK encodedecode demo as an example

    Thanks

    Cesar

  • LAD is provided in Codec Engine to support multiple processes:

    http://processors.wiki.ti.com/index.php/Link_Arbiter_Daemon

    What version of Codec Engine/DSP Link are you using?

    Chris

  • I have tried LAD and got some error: Here is the log of lad.xv5T. I have added "osalGlobal.useLinkArbiter = true;" and "myEngine.linkCfg = "CE_default";" into my *.cfg file.

    I have also highlighted  the error on the log. My Codec engine version is codec_engine_2_25_02_11.

     

    Initializing LAD...
        running LAD config inits...
        opening FIFO: /tmp/LAD/LADCMDS

    LAD_CONNECT:
        client FIFO name = /tmp/LAD/72
        client PID = 72
        assigned client handle = 0
        FIFO /tmp/LAD/72 created
        FIFO /tmp/LAD/72 opened for writing
        sent response 0;0;
    DONE

    LAD_STARTUPDSP:
        cpuId = 0
        configName = CE_default
        imageName = algocodecs.x64P
        absolute server path = /tmp/algocodecs.x64P
        client handle = 0
        lookup of Link config name failed!
        LAD_INVALIDARG
        sent response string 2
    DONE

    LAD_RELEASEDSP:
        client handle = 0
        sent response 3
    DONE

    LAD_DISCONNECT:
        client handle = 0
        closing FIFO /tmp/LAD/72
    DONE

        opening FIFO: /tmp/LAD/LADCMDS

     

    Also the trace with CE_DEBUG=3 is

    @0,611,571us: [+1 T:0x4001ed60 S:0xbef70aac] audio.audio_aec - +ce_open
    spk_vol = -18
    mic_vol = 12
    @0,622,201us: [+0 T:0x4001ed60 S:0xbef70a64] OM - Memory_contigAlloc> Enter(size=1024, align=-1, cached=FALSE, heap=FALSE)
    @0,623,351us: [+4 T:0x4001ed60 S:0xbef70a64] OM - Memory_contigAlloc> CMEM_alloc(1024) = 0x40021000.
    @0,624,282us: [+4 T:0x4001ed60 S:0xbef70a64] OM - Memory_contigAlloc> CMEM_getPhys(0x40021000) = 0x8782c000.
    @0,625,208us: [+1 T:0x4001ed60 S:0xbef70a1c] OM - Memory__addContigBuf> Enter(virtAddr=0x40021000, size=1024, physAddr=0x8782c000)
    @0,626,163us: [+1 T:0x4001ed60 S:0xbef70a1c] OM - Memory__addContigBuf> creating new contigBuf object
    @0,627,115us: [+0 T:0x4001ed60 S:0xbef70a04] OM - Memory_alloc> Enter(0x10)
    @0,628,067us: [+0 T:0x4001ed60 S:0xbef70a04] OM - Memory_alloc> return (0x50850)
    @0,629,002us: [+1 T:0x4001ed60 S:0xbef70a1c] OM - Memory__addContigBuf> returning: cb->phys=0x8782c000, cb->size=1024, cb->virt=0x40021000
    @0,630,125us: [+0 T:0x4001ed60 S:0xbef70a64] OM - Memory_contigAlloc> return (0x40021000)
    @0,631,111us: [+1 T:0x4001ed60 S:0xbef70aac] audio.audio_aec - inBuf addr = 0x40021000.
    @0,632,064us: [+0 T:0x4001ed60 S:0xbef70a64] OM - Memory_contigAlloc> Enter(size=1024, align=-1, cached=FALSE, heap=FALSE)
    @0,633,199us: [+4 T:0x4001ed60 S:0xbef70a64] OM - Memory_contigAlloc> CMEM_alloc(1024) = 0x42af2000.
    @0,634,198us: [+4 T:0x4001ed60 S:0xbef70a64] OM - Memory_contigAlloc> CMEM_getPhys(0x42af2000) = 0x8782f000.
    @0,635,146us: [+1 T:0x4001ed60 S:0xbef70a1c] OM - Memory__addContigBuf> Enter(virtAddr=0x42af2000, size=1024, physAddr=0x8782f000)
    @0,636,154us: [+1 T:0x4001ed60 S:0xbef70a1c] OM - Memory__addContigBuf> creating new contigBuf object
    @0,637,193us: [+0 T:0x4001ed60 S:0xbef70a04] OM - Memory_alloc> Enter(0x10)
    @0,638,192us: [+0 T:0x4001ed60 S:0xbef70a04] OM - Memory_alloc> return (0x50888)
    @0,639,110us: [+1 T:0x4001ed60 S:0xbef70a1c] OM - Memory__addContigBuf> returning: cb->phys=0x8782f000, cb->size=1024, cb->virt=0x42af2000
    @0,640,738us: [+0 T:0x4001ed60 S:0xbef70a64] OM - Memory_contigAlloc> return (0x42af2000)
    @0,641,712us: [+1 T:0x4001ed60 S:0xbef70aac] audio.audio_aec - outBuf addr = 0x42af2000.
    @0,642,762us: [+0 T:0x4001ed60 S:0xbef70a4c] CE - Engine_open> Enter('speexaec', 0x0, 0xbef70abc)
    @0,643,697us: [+0 T:0x4001ed60 S:0xbef70a34] OM - Memory_alloc> Enter(0x2c)
    @0,644,695us: [+0 T:0x4001ed60 S:0xbef70a34] OM - Memory_alloc> return (0x58e10)
    @0,645,671us: [+0 T:0x4001ed60 S:0xbef70a4c] CE - rserverOpen('algocodecs.x64P'), count = 0
    @0,646,597us: [+0 T:0x4001ed60 S:0xbef70a14] OP - Processor_create> Enter(imageName='algocodecs.x64P', linkCfg='CE_default', attrs=0xbef70aa0)
    @0,647,609us: [+0 T:0x4001ed60 S:0xbef709fc] OM - Memory_alloc> Enter(0x24)
    @0,648,550us: [+0 T:0x4001ed60 S:0xbef709fc] OM - Memory_alloc> return (0x589b0)
    @0,649,474us: [+0 T:0x4001ed60 S:0xbef709f4] OP - doCmd> Enter (cmdId=1, proc=0x589b0)
    @0,650,549us: [+0 T:0x4001ed60 S:0xbef709e4] ti.sdo.ce.osal.Sem - Entered Sem_post> sem[0x501c0]
    @0,651,590us: [+0 T:0x40af1490 S:0x40af0d54] ti.sdo.ce.osal.Sem - Leaving Sem_pend> sem[0x501c0] status[0]
    @0,652,529us: [+0 T:0x40af1490 S:0x40af0d74] OP - getCmd_d> Exit (result=1)
    @0,653,447us: [+0 T:0x40af1490 S:0x40af0d74] OP - Processor_create_d> Enter(proc=0x589b0)
    @0,657,539us: [+2 T:0x40af1490 S:0x40af0d74] OP - Processor_create_d> LAD_connect status = 0, handle = 0
    @0,658,492us: [+2 T:0x40af1490 S:0x40af0d74] OP - Processor_create_d> Loading algocodecs.x64P on DSP, linkConfigName= CE_default ...
    @0,661,053us: [+0 T:0x4001ed60 S:0xbef709f4] ti.sdo.ce.osal.Sem - Leaving Sem_post> sem[0x501c0]
    @0,661,887us: [+0 T:0x4001ed60 S:0xbef709d4] ti.sdo.ce.osal.Sem - Entered Sem_pend> sem[0x501d8] timeout[0xffffffff]
    @0,663,121us: [+2 T:0x40af1490 S:0x40af0d74] OP - Processor_create_d> LAD_startupDsp status = 2
    @0,663,943us: [+7 T:0x40af1490 S:0x40af0d74] OP - Processor_create_d> LAD_startupDsp FAILED, status = [0x2]
    @0,664,911us: [+0 T:0x40af1490 S:0x40af0d5c] OP - Processor_delete_d> Enter (proc=0x589b0)
    @0,665,883us: [+2 T:0x40af1490 S:0x40af0d5c] OP - Processor_delete_d> Closing pool...
    @0,667,059us: [+6 T:0x40af1490 S:0x40af0d5c] OP - Processor_delete_d> Closing pool FAILED, status=0x80008000
    @0,668,032us: [+2 T:0x40af1490 S:0x40af0d5c] OP - Processor_delete_d> Detaching before LAD_releaseDsp...
    @0,669,043us: [+6 T:0x40af1490 S:0x40af0d5c] OP - Processor_delete_d> Detaching from DSP FAILED, status=0x80008000
    @0,670,099us: [+2 T:0x40af1490 S:0x40af0d5c] OP - Processor_delete_d> Releasing DSP via LAD_releaseDsp...
    @0,671,605us: [+6 T:0x40af1490 S:0x40af0d5c] OP - Processor_delete_d> LAD_releaseDsp FAILED, status=0x3
    @0,672,630us: [+2 T:0x40af1490 S:0x40af0d5c] OP - Processor_delete_d> Disconnecting from LAD...
    @0,674,608us: [+0 T:0x40af1490 S:0x40af0d74] OP - Processor_delete_d> return
    @0,675,541us: [+2 T:0x40af1490 S:0x40af0d74] OP - Processor_create_d> return (0)
    @0,676,473us: [+0 T:0x40af1490 S:0x40af0d64] ti.sdo.ce.osal.Sem - Entered Sem_post> sem[0x501d8]
    @0,677,449us: [+0 T:0x40af1490 S:0x40af0d74] ti.sdo.ce.osal.Sem - Leaving Sem_post> sem[0x501d8]
    @0,678,385us: [+0 T:0x40af1490 S:0x40af0d74] OP - getCmd_d> Enter (proc=0x40af0de8)
    @0,679,322us: [+0 T:0x40af1490 S:0x40af0d54] ti.sdo.ce.osal.Sem - Entered Sem_pend> sem[0x501c0] timeout[0xffffffff]
    @0,681,158us: [+0 T:0x4001ed60 S:0xbef709d4] ti.sdo.ce.osal.Sem - Leaving Sem_pend> sem[0x501d8] status[0]
    @0,681,983us: [+0 T:0x4001ed60 S:0xbef709f4] OP - doCmd> Exit (result=2)
    @0,683,070us: [+0 T:0x4001ed60 S:0xbef709fc] OP - Processor_delete> Enter(proc=0x589b0)
    @0,684,012us: [+1 T:0x4001ed60 S:0xbef709fc] OP - Processor_delete(0x589b0) freeing object ...
    @0,684,953us: [+0 T:0x4001ed60 S:0xbef709dc] OM - Memory_free> Enter(0x589b0, 0x24)
    @0,685,905us: [+0 T:0x4001ed60 S:0xbef709dc] OM - Memory_free> return (0x1)
    @0,686,821us: [+0 T:0x4001ed60 S:0xbef70a14] OP - Processor_delete> return.
    @0,687,756us: [+6 T:0x4001ed60 S:0xbef70a4c] CE - rserverOpen: can't start 'algocodecs.x64P'; Processor_create failed
    @0,688,698us: [+0 T:0x4001ed60 S:0xbef70a4c] CE - rserverOpen('algocodecs.x64P'): 0x0 done.
    @0,689,758us: [+0 T:0x4001ed60 S:0xbef70a2c] CE - Engine_close(0x58e10)
    @0,690,766us: [+0 T:0x4001ed60 S:0xbef70a0c] CS - Server_disconnectTrace('0x58e10', 0x0)
    @0,691,712us: [+0 T:0x4001ed60 S:0xbef70a0c] CS - Server_connectTrace> return(0)
    @0,692,654us: [+0 T:0x4001ed60 S:0xbef70a2c] OM - Memory_free> Enter(0x58e10, 0x2c)
    @0,693,596us: [+0 T:0x4001ed60 S:0xbef70a2c] OM - Memory_free> return (0x1)
    @0,694,533us: [+0 T:0x4001ed60 S:0xbef70a4c] CE - Engine_open> return(0)
    app: error: can't open engine speexaec
    @0,696,411us: [+1 T:0x4001ed60 S:0xbef70aac] audio.audio_aec - -ce_open

  • The wiki page that Chris pointed is out-of-date wrt/ LAD DSPLink config names. 

    In CE 2.25.02.11 the available DSPLink config names are "user0", "user1", "user2", and "message".  These names correspond to similarly named objects defined in similarly named C files in <codec_engine>/ti/dsplink/utils/lad.  For instance, if you chose "user0" on a DM6446 then the structure named user0_LINKCFG_Config from the file user0_linkcfg_dm6446.c is chosen for the DSPLink configuration used with PROC_setup() in lad.c.  The different DSPLink configurations all exist in the LAD executable and you can choose whichever you like.  Having the 4 different ones in the same executable allows a single LAD executable to load codec servers with different DSPLink configurations (although you can load only one at a time).

    Since DSPLink's configuration needs to match the codec server's configuration (especially for the memory map), one of the pre-built DSPLink configurations needs to match your codec server's configuration.  As it stands with the shipped CE 2.25.02.11, the difference between user0, user1, & user2 are just the names of the objects, hence they serve as placeholders for the user to change as they see fit.  The "message" configuration is different wrt/ the memory map entries, but that's it.

    You are expected to modify and rebuild LAD to match your codec server's needs.  You could even change the config names themselves.  You may not need to change anything if the configuration for one of the names already matches your server's configuration.  If you need to change the LAD DSPLink configuration, pick one of those user?_linkcfg_dm6446.c files and match up the memory map to that of your codec server, and use that name for your "myEngine.linkCfg = ..." line (e.g., "myEngine.linkCfg = "user0";").

    Regards,

    - Rob

  • After I set the value of myEngine.linkCfg = "user0"; the step goes farther and it fails at another point.

    Here is the log for lad.xv5T. I have highlighted the failure.

     

    Initializing LAD...
        running LAD config inits...
        opening FIFO: /tmp/LAD/LADCMDS

    LAD_CONNECT:
        client FIFO name = /tmp/LAD/72
        client PID = 72
        assigned client handle = 0
        FIFO /tmp/LAD/72 created
        FIFO /tmp/LAD/72 opened for writing
        sent response 0;0;
    DONE

    LAD_STARTUPDSP:
        cpuId = 0
        configName = user0
        imageName = algocodecs.x64P
        absolute server path = /tmp/algocodecs.x64P
        client handle = 0
        linkConfigId = 0

    LINKCFG_Object generated for PROC_setup(0x180d8) ...
    linkCfg->gppObject->
      name = "ARM9"
      maxMsgqs = 0x82
      maxChnlQueue = 0x10
      poolTableId = 0xffffffff
      numPools = 0x0

    linkCfg->dspConfigs[0]->dspObject->
      name = "DM6446GEM"
      dspArch = 0x2
      loaderName = "COFF"
      autoStart = FALSE
      execName = "DEFAULT.OUT"
      doDspCtrl = DSP_BootMode_Boot_NoPwr
      resumeAddr = 0x8ff00000
      resetVector = 0x8ff00000
      resetCodeSize = 0x80
      maduSize = 0x1
      cpuFreq = 0xffffffff
      endian = 0x3
      wordSwap = 0x0
      memTableId = 0x0
      memEntries = 0x7
      linkDrvId = 0x0
      arg1 = 0x0
      arg2 = 0x0
      arg3 = 0x0
      arg4 = 0x0
      arg5 = 0xffffffff

    linkCfg->dspConfigs[0]->linkDrvObjects->
      name = "SHMDRV"
      hshkPollCount = 0x5f5e100
      memEntry = 0x3
      ipsTableId = 0x0
      numIpsEntries = 0x2
      poolTableId = 0x0
      numPools = 0x1
      dataTableId = 0x0
      numDataDrivers = 0x1
      mqtId = 0x0
      ringIoTableId = 0x0
      mplistTableId = 0x0
      mpcsTableId = 0x0

    linkCfg->dspConfigs[0]->memTables[0][i].
    entry #0:
      entry = 0x0
      name = "RESETCTRL"
      physAddr = 0x8ff00000
      dspVirtAddr = 0x8ff00000
      gppVirtAddr = 0xffffffff
      size = 0x80
      shared = TRUE
      syncd = FALSE
    entry #1:
      entry = 0x1
      name = "DDR2"
      physAddr = 0x8fa00000
      dspVirtAddr = 0x8fa00000
      gppVirtAddr = 0xffffffff
      size = 0x400000
      shared = TRUE
      syncd = FALSE
    entry #2:
      entry = 0x2
      name = "DSPLINKMEM"
      physAddr = 0x8fe00000
      dspVirtAddr = 0x8fe00000
      gppVirtAddr = 0xffffffff
      size = 0x5000
      shared = TRUE
      syncd = FALSE
    entry #3:
      entry = 0x3
      name = "DSPLINKMEM1"
      physAddr = 0x8fe05000
      dspVirtAddr = 0x8fe05000
      gppVirtAddr = 0xffffffff
      size = 0x2b000
      shared = TRUE
      syncd = FALSE
    entry #4:
      entry = 0x4
      name = "POOLMEM"
      physAddr = 0x8fe30000
      dspVirtAddr = 0x8fe30000
      gppVirtAddr = 0xffffffff
      size = 0xd0000
      shared = TRUE
      syncd = FALSE
    entry #5:
      entry = 0x5
      name = "DSPIRAM"
      physAddr = 0x11800000
      dspVirtAddr = 0x11800000
      gppVirtAddr = 0xffffffff
      size = 0x10000
      shared = TRUE
      syncd = FALSE
    entry #6:
      entry = 0x6
      name = "DSPL1DRAM"
      physAddr = 0x11f04000
      dspVirtAddr = 0x11f04000
      gppVirtAddr = 0xffffffff
      size = 0xc000
      shared = TRUE
      syncd = FALSE

    linkCfg->dspConfigs[0]->ipsTables[0][i].
    entry #0:
      name = "IPS"
      numIpsEvents = 0x20
      memEntry = 0x2
      gppIntId = 0x2e
      dspIntId = 0x10
      dspIntVectorId = 0x4
      arg1 = 0x2faf080
      arg2 = 0x0
    entry #1:
      name = "IPS"
      numIpsEvents = 0x20
      memEntry = 0x3
      gppIntId = 0x2f
      dspIntId = 0x11
      dspIntVectorId = 0x5
      arg1 = 0x2faf080
      arg2 = 0x0

    linkCfg->dspConfigs[0]->poolTables[0][i].

    linkCfg->dspConfigs[0]->dataTables[0][i].
    entry #0:
      name = "ZCPYDATA"
      baseChnlId = 0x0
      numChannels = 0x10
      maxBufSize = 0x4000
      memEntry = 0x3
      poolId = 0x0
      queuePerChnl = 0x1
      ipsId = 0x1
      ipsEventNo = 0x1
      arg1 = 0x0
      arg2 = 0x0

    linkCfg->dspConfigs[0]->mqtObjects->
      name = "ZCPYMQT"
      memEntry = 0x3
      maxMsgSize = 0xffffffff
      ipsId = 0x1
      ipsEventNo = 0x0
      arg1 = 0x0
      arg2 = 0x0

    linkCfg->dspConfigs[0]->ringIoObjects->
      name = "RINGIOTABLE"
      memEntry = 0x2
      maxEntries = 0x40
      ipsId = 0x0
      ipsEventNo = 0x0

    linkCfg->dspConfigs[0]->mplistObjects->
      name = "MPLISTTABLE"
      memEntry = 0x3
      maxEntries = 0x40
      ipsId = 0xffffffff
      ipsEventNo = 0xffffffff

    linkCfg->dspConfigs[0]->mpcsObjects->
      name = "MPCS"
      memEntry = 0x3
      maxEntries = 0x100
      ipsId = 0xffffffff
      ipsEventNo = 0xffffffff

        PROC_setup - OK
        PROC_Attach - OK
        PROC_Load - OK
        POOL_Open - OK
        PROC_Start FAILED 0x80008017
        LAD_FAILURE

        sent response string 1
    DONE

    LAD_RELEASEDSP:
        client handle = 0
        sent response 3
    DONE

    LAD_DISCONNECT:
        client handle = 0
        closing FIFO /tmp/LAD/72
    DONE

        opening FIFO: /tmp/LAD/LADCMDS

     

  • That PROC_start() failure decodes as DSP_ETIMEOUT, from DSPLink.  The ARM DSPLink waits for acknowledgement from the DSP side, and apparently that ack never comes.

    You could hook up CCS and examine the state of the DSP to try to figure out what's going wrong.  The DSP seems to have loaded OK.

    From a high level, I would suggest inspecting your codec server's memory map and see that it matches the DSPLink config that gets printed by LAD (i.e., your log that you included here).  If there are differences, modify your user0_linkcfg_DM6446.c file's memory map in the LINKCFG_memTable_00[] array.

    Regards,

    - Rob