/*
 *  ======== CERuntime_init ========
 */
Void CERuntime_init(Void)
{

    GT_init();



    /* allow user to over-ride via CE_TRACE. */
    GT_set(Global_getenv("CE_TRACE"));
    Global_init();

    Sem_init();
    SemMP_init();


    Memory_init();
    Queue_init();
    Comm_init();
    Thread_init();
    Processor_init();
    LockMP_init();  /* Must be called before DMAN3_init() */
    Algorithm_init();
    XdmUtils_init();
    Lock_init();

    Engine_init();
    Server_init();

}
Example #2
0
/*
 *  ======== modifyDefaultLinkCfgObjectForCENeeds ========
 *  make changes in the object that are necessary for CE
 *  to work
 */
static Void modifyDefaultLinkCfgObjectForCENeeds()
{
    /* 130 message ques is max */
    ti_sdo_ce_ipc_Processor_linkcfg.gppObject->maxMsgqs = 130;

    /* entry #0 in the IPS table should use DSPLINK mem segment, which is #1 */
    ti_sdo_ce_ipc_Processor_linkcfg.dspConfigs[0]->ipsTables[0]->memEntry = 1;

    /* RINGIO table should use DSPLINK mem segment, which is #1 */
    ti_sdo_ce_ipc_Processor_linkcfg.dspConfigs[0]->ringIoObjects->memEntry = 1;

    /* handshake timeout is infinite if an appropriate env var is set */
    if (Global_getenv("CE_DSPDEBUG") != NULL) {
        ti_sdo_ce_ipc_Processor_linkcfg.dspConfigs[0]->linkDrvObjects->hshkPollCount = -1;
    }
}
Example #3
0
/*
 *  ======== CERuntime_init ========
 */
Void CERuntime_init(Void)
{
    CESettings_init();


    /* if CE_DEBUG is set, turn on tracing and DSP auto trace collection */
    if (Global_getenv("CE_DEBUG") != NULL) {
        extern Bool   Engine_alwaysCollectDspTrace;
        extern String Engine_ceDebugDspTraceMask;

        Engine_alwaysCollectDspTrace = TRUE;

        /*
         * Note the strategy for setting trace masks below...
         * For any mods not yet registered, we set the
         * [FC|CE]SETTINGS_MODNAME mask.  For any mods already
         * registered, we Diags_setMask() them.
         */

        if (Global_getenv("CE_DEBUG")[0] == '1') {
            /* Turn on CE/FC levels 6 and 7 */
            xdc_runtime_Diags_setMask("ti.sdo.ce.%+67");
            xdc_runtime_Diags_setMask("ti.sdo.fc.%+67");

            /* Same for any Servers */
            Engine_ceDebugDspTraceMask = "ti.sdo.ce.%+67;ti.sdo.fc.%+67";
        }
        else if (Global_getenv("CE_DEBUG")[0] == '2') {
            //GT_set(
            //    "*+01234567,CE-3,ti.sdo.ce.osal.SemMP=67,OG=467,OM=4567,OC=67,GT_time=0,GT_prefix=1235");
            // * -> ti.sdo.ce.%, ti.sdo.fc.%
            xdc_runtime_Diags_setMask(CESETTINGS_MODNAME"+EX1234567");
            xdc_runtime_Diags_setMask("ti.sdo.ce.%+EX1234567");
            xdc_runtime_Diags_setMask("ti.sdo.fc.%+EX1234567");

            // CE-3 -> ti.sdo.ce.Engine-3
            xdc_runtime_Diags_setMask("ti.sdo.ce.Engine-3");

            // OG, OM, SemMP -> ti.sdo.xdcruntime.linux
            //xdc_runtime_Diags_setMask("ti.sdo.xdcruntime.linux.%+EX1234567");

            Engine_ceDebugDspTraceMask =
                // Former GT mask:
                //"*+01234567,CR=67,ti.sdo.fc.dman3-2,ti.sdo.fc.dskt2-2,GT_prefix=1235,GT_time=3";
                // Current Diags mask: (time=2 ==> display time in delta usec
                "ti.sdo.ce.%+EX1234567;ti.sdo.fc.%+EX12345678;ti.sdo.ce.rms=67;ti.sdo.fc.dman3-2;ti.sdo.fc.dskt2-2;time=2";
        }
        else if (Global_getenv("CE_DEBUG")[0] == '0') {
            /* Don't set anything if someone tries to turn CE_DEBUG off */
        } else {
            //GT_set("*+01234567,CE-3,GT_time=0,GT_prefix=12345");
            xdc_runtime_Diags_setMask("ti.sdo.ce.%+EX1234567");
            xdc_runtime_Diags_setMask("ti.sdo.fc.%+EX1234567");
            //TEMP (jeh) xdc_runtime_Diags_setMask("ti.sdo.ce.Engine-3");
            //xdc_runtime_Diags_setMask("ti.sdo.xdcruntime.linux.%+EX1234567");

            //Engine_ceDebugDspTraceMask = "*+01234567,GT_prefix=12345,GT_time=3";
            Engine_ceDebugDspTraceMask =
                "time=2;ti.sdo.fc.%+EX1234567;ti.sdo.ce.%+EX1234567;ti.sdo.fc.dskt2-2";
        }
    }
    else {
        //xdc_runtime_Diags_setMask("ti.sdo.ce.Engine-EX1234567");
        //xdc_runtime_Diags_setMask("ti.sdo.ce.VISA-EX1234567");
    }

    if (Global_getenv("CE_CHECK") != NULL) {
        extern Bool VISA_checked;

        /*
         * Currently just change _this_ processor's value... perhaps we should
         * enable remote processors as well?
         */
        if (Global_getenv("CE_CHECK")[0] == '1') {
            VISA_checked = TRUE;
            xdc_runtime_Diags_setMask("ti.sdo.ce.%+7");
        } else if (Global_getenv("CE_CHECK")[0] == '0') {
            VISA_checked = FALSE;
        } else {
            /* leave it whatever it was... maybe we should drop a warning? */
        }
    }

    /* allow user to over-ride via CE_TRACE. */
    if (Global_getenv("CE_TRACE") != NULL) {
        xdc_runtime_Diags_setMask(Global_getenv("CE_TRACE"));
    }
    Global_init();


    ti_sdo_ce_osal_Memory_init();
    Comm_init();
    Processor_init();

    Algorithm_init();
    XdmUtils_init();

    Engine_init();
    _VISA_init();
    Loader_init();
    Server_init();
    if ((Global_getenv("CE_DEBUG") != NULL) &&
        (Global_getenv("CE_DEBUG")[0] == '2')) {

        /* set up masks that must be deferred until the modules have been init'd */
        //    "*+01234567,CE-3,ti.sdo.ce.osal.SemMP=67,OG=467,OM=4567,OC=67,GT_time=0,GT_prefix=1235");
        //xdc_runtime_Diags_setMask(Comm_MODNAME"-EX12345");
        xdc_runtime_Diags_setMask("ti.sdo.ce.osal.%-EX123");
        //xdc_runtime_Diags_setMask(Algorithm_MODNAME"-EX12345");

        // CE-3 -> ti.sdo.ce.Engine-3
        xdc_runtime_Diags_setMask("ti.sdo.ce.Engine-3");

        // OC=67 -> ti.sdo.ce.ipc.Comm=67
        xdc_runtime_Diags_setMask("ti.sdo.ce.ipc.Comm=67");
    }

    RtCfg_init();

    /*
     *  Allow user to over-ride via CE_TRACE. Putting this after module
     *  initialization, since it will have no effect may have no effect
     *  if called before. Only wildcard settings seem to work when placed
     *  before module initialization.
     */
    if (Global_getenv("CE_TRACE") != NULL) {
        xdc_runtime_Diags_setMask(Global_getenv("CE_TRACE"));
    }

}
Example #4
0
/*
 *  ======== CERuntime_init ========
 */
Void CERuntime_init(Void)
{
    if (ceInit++ == 0) {

        CESettings_init();
        FCSettings_init();


        /* if CE_DEBUG is set, turn on tracing and DSP auto trace collection */
        if (Global_getenv("CE_DEBUG") != NULL) {
            extern Bool   Engine_alwaysCollectDspTrace;
            extern String Engine_ceDebugDspTraceMask;

            Engine_alwaysCollectDspTrace = TRUE;

            /*
             * Note the strategy for setting trace masks below...
             * For any mods not yet registered, we set the
             * [FC|CE]SETTINGS_MODNAME mask.  For any mods already
             * registered, we Diags_setMask() them.
             */

            if (Global_getenv("CE_DEBUG")[0] == '1') {
                /* Turn on CE/FC levels 6 and 7 */
                xdc_runtime_Diags_setMask(CESETTINGS_MODNAME"+67");
                xdc_runtime_Diags_setMask(FCSETTINGS_MODNAME"+67");
                xdc_runtime_Diags_setMask("ti.sdo.ce.%+67");
                xdc_runtime_Diags_setMask("ti.sdo.fc.%+67");

                /* Same for any Servers */
                Engine_ceDebugDspTraceMask = "ti.sdo.ce.%+67;ti.sdo.fc.%+67";
            }
            else if (Global_getenv("CE_DEBUG")[0] == '2') {
                xdc_runtime_Diags_setMask(CESETTINGS_MODNAME"+EX1234567");
                xdc_runtime_Diags_setMask(FCSETTINGS_MODNAME"+EX1234567");
                xdc_runtime_Diags_setMask("ti.sdo.ce.%+EX1234567");
                xdc_runtime_Diags_setMask("ti.sdo.fc.%+EX1234567");

                Engine_ceDebugDspTraceMask =
                    // Current Diags mask: (time=2 ==> display time in delta usec
                    "ti.sdo.ce.%+EX1234567;ti.sdo.fc.%+EX12345678;ti.sdo.ce.rms=67;ti.sdo.fc.dman3-2;ti.sdo.fc.dskt2-2;time=2";
            }
            else if (Global_getenv("CE_DEBUG")[0] == '0') {
                /* Don't set anything if someone tries to turn CE_DEBUG off */
            } else {
                xdc_runtime_Diags_setMask("ti.sdo.ce.%+EX1234567");
                xdc_runtime_Diags_setMask("ti.sdo.fc.%+EX1234567");

                Engine_ceDebugDspTraceMask =
                    "time=2;ti.sdo.fc.%+EX1234567;ti.sdo.ce.%+EX1234567;ti.sdo.fc.dskt2-2";
            }
        }
        else {
            //xdc_runtime_Diags_setMask("ti.sdo.ce.Engine-EX1234567");
            //xdc_runtime_Diags_setMask("ti.sdo.ce.VISA-EX1234567");
        }

        if (Global_getenv("CE_CHECK") != NULL) {
            extern Bool VISA_checked;

            /*
             * Currently just change _this_ processor's value... perhaps we
             * should enable remote processors as well?
             */
            if (Global_getenv("CE_CHECK")[0] == '1') {
                VISA_checked = TRUE;
                xdc_runtime_Diags_setMask("ti.sdo.ce.%+7");
            } else if (Global_getenv("CE_CHECK")[0] == '0') {
                VISA_checked = FALSE;
            } else {
                /* leave it whatever it was. maybe we should drop a warning? */
            }
        }

        /* allow user to over-ride via CE_TRACE. */
        if (Global_getenv("CE_TRACE") != NULL) {
            xdc_runtime_Diags_setMask(Global_getenv("CE_TRACE"));
        }
        Global_init();


        ti_sdo_ce_osal_Memory_init();
        Comm_init();
        Processor_init();
        Algorithm_init();
        XdmUtils_init();

        Trace_init();
        RMS_init();
        Global_atexit((Fxn)RMS_exit);

        Engine_init();
        _VISA_init();
        Loader_init();
       Server_init();
        if ((Global_getenv("CE_DEBUG") != NULL) &&
                (Global_getenv("CE_DEBUG")[0] == '2')) {

            /*
             *  set up masks that must be deferred until the modules have been
             *  initialized.
             */
            //xdc_runtime_Diags_setMask(Comm_MODNAME"-EX12345");
            xdc_runtime_Diags_setMask("ti.sdo.ce.osal.%-EX123");
            //xdc_runtime_Diags_setMask(Algorithm_MODNAME"-EX12345");

            xdc_runtime_Diags_setMask("ti.sdo.ce.Engine-3");
            xdc_runtime_Diags_setMask("ti.sdo.ce.ipc.Comm=67");
        }

        /*
         *  Allow user to over-ride via CE_TRACE. Putting this after module
         *  initialization, since it will have no effect if called before.
         *  Only wildcard settings seem to work when placed before module
         *  initialization.
         */
        if (Global_getenv("CE_TRACE") != NULL) {
            xdc_runtime_Diags_setMask(Global_getenv("CE_TRACE"));
        }
    }
}
Example #5
0
/*
 *  ======== procCreate ========
 */
static Bool procCreate(Processor_Handle proc)
{
    DSP_STATUS      status = DSP_SOK;
    ZcpyMqtAttrs    mqtAttrs;
    Bool            retVal;

    GT_1trace(curTrace, GT_ENTER, "Processor_create_d> Enter(proc=0x%x)\n",
            proc);

    /* TODO:L ignoring cpuId string, using 0 for cpuId */
    proc->cpuId = 0;

    /* call power on function -- either the real one, or the empty
     * stub defined by Global.xdt if power is not used.
     */
    if (Power_on(&proc->powerHandle) == Power_EFAIL) {
        retVal = FALSE;
        GT_0trace(curTrace, GT_6CLASS,
            "Processor_create_d> Power_on failed.\n");
        goto procCreate_return;
    }

    /* if using LAD: connect to LAD, startup DSP, attach with Link */
    if (Global_useLinkArbiter) {

        /* connect to LAD */
        ladStatus = LAD_connect(&handle);
        GT_2trace(curTrace, GT_2CLASS, "Processor_create_d> "
            "LAD_connect status = %x, handle = %x\n", ladStatus, handle);

        if (ladStatus != LAD_SUCCESS) {
            GT_1trace(curTrace, GT_7CLASS, "Processor_create_d> "
               "LAD_connect FAILED, status = [0x%x]\n", ladStatus);
            goto ladfail;
        }

        /* startup the DSP (if it isn't already started) */
        GT_2trace(curTrace, GT_2CLASS, "Processor_create_d> "
            "Loading %s on DSP, linkConfigName= %s ...\n", proc->imageName,
            proc->linkConfigName);
        ladStatus = LAD_startupDsp(handle, proc->cpuId, proc->linkConfigName,
            proc->imageName);
        GT_1trace(curTrace, GT_2CLASS, "Processor_create_d> "
            "LAD_startupDsp status = %x\n", ladStatus);

        /* on success, continue */
        if ((ladStatus == LAD_SUCCESS) || (ladStatus == LAD_ALREADYRUNNING)) {
#ifndef WIN32
            /*
             *  Must still call PROC_Attach from this app's process. (For
             *  WinCE, LAD runs in the same process, so PROC_Attach() returns
             *  an error.)
             */
            status = PROC_Attach(proc->cpuId, NULL);
            if (!DSP_SUCCEEDED(status)) {
                GT_1trace(curTrace, GT_7CLASS, "Processor_create_d> "
                    "PROC_Attach following LAD_startupDsp FAILED, "
                    "status=[0x%x]\n", (Uns) status);
                goto ladfail;
            }

            /* must still call POOL_Open from this app (NULL attributes) */
            status = POOL_Open (Global_cePoolId, NULL) ;
            if (!DSP_SUCCEEDED(status)) {
                GT_1trace(curTrace, GT_7CLASS, "Processor_create_d> "
                    "POOL_Open following LAD_startupDsp FAILED, "
                    "status=[0x%x]\n", (Uns) status);
            }
#endif
        }
        /* else, on fail, abort */
        else {
            GT_1trace(curTrace, GT_7CLASS, "Processor_create_d> "
                "LAD_startupDsp FAILED, status = [0x%x]\n", ladStatus);
            goto ladfail;
        }
    } /* end of 'if using LAD' */

    /* else, if no LAD, call Link's startup APIs directly */
    else {

        /*
         *  Create and initialize the PROC object.
         */
        GT_0trace(curTrace, GT_2CLASS, "Processor_create_d> "
            "Initializing DSP PROC...\n");

        modifyDefaultLinkCfgObjectForCENeeds();
        modifyDefaultLinkCfgObjectBasedOnUserCfgData(proc->imageName);

    dumpLinkCfgObj(&ti_sdo_ce_ipc_Processor_linkcfg);

        status = PROC_setup( &ti_sdo_ce_ipc_Processor_linkcfg );

        if (!DSP_SUCCEEDED(status)) {
            goto fail;
        }

        /*
         *  Attach the Dsp.
         */
        GT_0trace(curTrace, GT_2CLASS, "Processor_create_d> "
            "Attaching to DSP PROC...\n");

        status = PROC_Attach(proc->cpuId, NULL);
        if (!DSP_SUCCEEDED(status)) {
            goto fail;
        }

        /*
         *  Open a pool with buffers for both the control messages use by the
         *  transport and the application.
         */
        GT_0trace(curTrace, GT_2CLASS, "Processor_create_d> "
            "Opening MSGQ pool...\n");

        status = POOL_Open(Global_cePoolId, &Global_cePoolAttrs);
        if (!DSP_SUCCEEDED(status)) {
            goto fail;
        }

        /*
         *  Load the executable on the DSP.
         */
        GT_2trace(curTrace, GT_2CLASS, "Processor_create_d> "
            "Loading %s on DSP (%d args)...\n", proc->imageName,
            proc->attrs.argc);

        status = PROC_Load(proc->cpuId, proc->imageName,
            proc->attrs.argc, proc->attrs.argv);
        if (!DSP_SUCCEEDED(status)) {
            goto fail;
        }

        /*
         *  Start execution on DSP.
         */
        GT_0trace(curTrace, GT_2CLASS, "Processor_create_d> "
            "Starting DSP PROC...\n");

        status = PROC_Start(proc->cpuId);
        if (!DSP_SUCCEEDED(status)) {
            goto fail;
        }

        /*
         *  Open the remote transport to the DSP.
         */
        GT_0trace(curTrace, GT_2CLASS, "Processor_create_d> "
            "Opening remote transport...\n");
        /* tell the transport which open pool id to use for ctrl messages */
        mqtAttrs.poolId = Global_cePoolId;

        status = MSGQ_TransportOpen(proc->cpuId, &mqtAttrs);
        if (!DSP_SUCCEEDED(status)) {
            goto fail;
        }

    }  /* end of else to using LAD */

    /*
     *  Connect to the Power on the DSP
     */
    if (Power_connect(proc->powerHandle) == Power_EFAIL) {
        goto fail;
    }

    proc->connected = TRUE;

    if (Global_getenv("CE_DSPDEBUG") != NULL) {
        printf("Codec Engine system message (b/c CE_DSPDEBUG=1) : DSP image "
                "loaded and started, press Enter to continue: ");
        getchar();
    }

    retVal = TRUE;
    goto procCreate_return;

    /* TODO:[4] should try those asyncErrorHandlers that link supports?
     * (MSGQ_SetErrorHandler)
     */

fail:
    GT_4trace(curTrace, GT_7CLASS, "Processor_create_d> "
        "Loading and starting DSP server '%s' FAILED, status=[0x%x] "
        "(look for error code 'DSP_EBASE + 0x%x' in "
        "dsplink*/packages/dsplink/gpp/inc/usr/errbase.h) %s\n",
        proc->imageName, status,
        status & 0x7fff, status == DSP_ERANGE ?
            "This error code typically indicates a problem with the DSP memory "
            "map, i.e. it is different from what the Arm side specified; check "
            "the DSP server's memory map in your Arm application .cfg script, "
            "and make sure you have set 'armDspLinkConfig' "
            "configuration variable correctly (for details, refer to the "
            "documentation for ti.sdo.ce.Engine.xdc). Also, verify that "
            "the DSPLINKMEM segment on the DSP is large enough. "
            : ""
         );

ladfail:

    procDelete(proc);

    retVal = FALSE;

procCreate_return:

    GT_1trace(curTrace, GT_2CLASS, "Processor_create_d> return (%d)\n", retVal);

    return retVal;
}
Example #6
0
/*
 *  ======== CERuntime_init ========
 */
Void CERuntime_init(Void)
{
    extern Void IPC_generatedInit();

    GT_init();


    /* if CE_DEBUG is set, turn on tracing and DSP auto trace collection */
    if (Global_getenv("CE_DEBUG") != NULL) {
        extern Bool   Engine_alwaysCollectDspTrace;
        extern String Engine_ceDebugDspTraceMask;

        Engine_alwaysCollectDspTrace = TRUE;



        if (Global_getenv("CE_DEBUG")[0] == '1') {
            GT_set("*+67,CE-3,GT_time=0,GT_prefix=1235");
            Engine_ceDebugDspTraceMask = "*+67,GT_prefix=1235,GT_time=3";
        }
        else if (Global_getenv("CE_DEBUG")[0] == '2') {
            GT_set(
                "*+01234567,CE-3,ti.sdo.ce.osal.SemMP=67,OG=467,OM=4567,OC=67,GT_time=0,GT_prefix=1235");
            Engine_ceDebugDspTraceMask =
                "*+01234567,CR=67,ti.sdo.fc.dman3-2,ti.sdo.fc.dskt2-2,GT_prefix=1235,GT_time=3";
        } else {
            GT_set("*+01234567,CE-3,GT_time=0,GT_prefix=12345");
            Engine_ceDebugDspTraceMask = "*+01234567,GT_prefix=12345,GT_time=3";
        }
    }

    if (Global_getenv("CE_CHECK") != NULL) {
        extern Bool VISA_checked;

        /*
         * Currently just change _this_ processor's value... perhaps we should
         * enable remote processors as well?
         */
        if (Global_getenv("CE_CHECK")[0] == '1') {
            VISA_checked = TRUE;
            /* turn on all GT_7CLASS trace (errors) */
            GT_set("*+7");
        } else if (Global_getenv("CE_CHECK")[0] == '0') {
            VISA_checked = FALSE;
        } else {
            /* leave it whatever it was... maybe we should drop a warning? */
        }
    }

    /* allow user to over-ride via CE_TRACE. */
    GT_set(Global_getenv("CE_TRACE"));
    IPC_generatedInit();
    Global_init();

    Sem_init();
    SemMP_init();


    Memory_init();
    Queue_init();
    Comm_init();
    Thread_init();
    Processor_init();
    LockMP_init();  /* Must be called before DMAN3_init() */
    Algorithm_init();
    XdmUtils_init();
    Lock_init();

    Engine_init();
    Server_init();

}
/*
 *  ======== procCreate ========
 */
static Bool procCreate(Processor_Handle proc)
{
    Int status = 0;
    Bool retVal;
    ProcMgr_AttachParams attachParams;
    ProcMgr_StartParams  startParams;
    ProcMgr_State        state;
    ProcMgr_AddrInfo     CMEMAddrInfo;
    HeapBufMP_Params heapP;
    CMEM_BlockAttrs cmemBlockAttrs;
    Int blockNum;
    Int nCMEMBlocks;
    Bool createAndRegisterHeap;
    Int16 heapId;
    UInt16 regionId;
    UInt32 numMsgs;
    UInt32 msgSize;
    Char heapName[32];

    Log_print1(Diags_ENTRY, "[+E] Processor_create_d> Enter(proc=0x%x)",
            (IArg)proc);

    /* Create and initialize the PROC object */
    Log_print1(Diags_USER2, "[+2] Processor_create_d> "
    "Retrieving CPU ID for '%s'...", (IArg)(proc->attrs.cpuId));

    proc->cpuId = Processor_getCoreId(proc->attrs.cpuId);
    if (proc->cpuId < 0) {
        Log_print1(Diags_USER7, "[+7] Processor_create_d> "
               "Processor_getCoreId() failed: %d", proc->cpuId);
        goto fail;
    }

    /* Open DSP ProcMgr */
    Log_print2(Diags_USER2, "[+2] Processor_create_d> "
           "Opening %s ProcMgr for cpuId %d...",
           (IArg)proc->attrs.cpuId, proc->cpuId);
    status = ProcMgr_open(&proc->procMgrH, proc->cpuId);

    if (status < 0) {
        Log_print1(Diags_USER7, "[+7] Processor_create_d> "
               "ProcMgr_open() failed: %d", (IArg)status);
        goto fail;
    }

    /* Attach the DSP */
    Log_print1(Diags_USER2, "[+2] Processor_create_d> "
           "Attaching to %s...", (IArg)proc->attrs.cpuId);

    if (proc->useExtLoader == FALSE) {
        /* We load the slave */
        ProcMgr_getAttachParams(NULL, &attachParams);
        status = ProcMgr_attach(proc->procMgrH, &attachParams);
        if (status < 0) {
            Log_print1(Diags_USER7, "[+7] Processor_create_d> "
                    "ProcMgr_attach() failed: %d", (IArg)status);
            goto fail;
        }

        /* Map slave memory */
        if (!mapByFile(proc->procMgrH, proc->memMapName, proc->cpuId, TRUE)) {
            Log_print0(Diags_USER6, "Processor_create_d> mapByFile() failed!");
        }

        /* Load the executable on the DSP */
        Log_print3(Diags_USER2, "[+2] Processor_create_d> "
                "Loading %s on %s (%d args)...",
                (IArg)(proc->imageName), (IArg)(proc->attrs.cpuId),
                (IArg)(proc->attrs.argc));

        status = ProcMgr_load(proc->procMgrH, proc->imageName,
                proc->attrs.argc, proc->attrs.argv, NULL, &proc->fileId);
        if (status < 0) {
            Log_print1(Diags_USER7, "[+7] Processor_create_d> "
                    "ProcMgr_load() failed: %d", status);
            goto fail;
        }

        /* temporary: to be done by SysLink in the future */
        Log_print0(Diags_USER1, "[+2] Processor_create_d> "
                "calling Ipc_control(LOADCALLBACK)...");
        status = Ipc_control(proc->cpuId, Ipc_CONTROLCMD_LOADCALLBACK, NULL);
        Log_print1(Diags_USER1, "[+2] Processor_create_d> "
                "Ipc_control(LOADCALLBACK) status: %d", (IArg)status);

        /* Start execution on DSP */
        Log_print1(Diags_USER2, "[+2] Processor_create_d> Starting %s ...",
                (IArg)proc->attrs.cpuId);

        ProcMgr_getStartParams(proc->procMgrH, &startParams);
        status = ProcMgr_start(proc->procMgrH, &startParams);
        if (status < 0) {
            Log_print1(Diags_USER7, "Processor_create_d> "
                    "ProcMgr_start() failed: %d", status);
            goto fail;
        }
    } // if (proc->useExtLoader == FALSE)
    else {
        /* Check the state of the processor to make sure it's really running */
        state = ProcMgr_getState(proc->procMgrH);
        if (state != ProcMgr_State_Running) {
            Log_print1(Diags_USER7, "Processor_create_d> Invalid processor "
                    "state [%d].", state);
            goto fail;
        }

        Log_print0(Diags_USER1, "[+2] Processor_create_d> "
                "calling Ipc_control(LOADCALLBACK)...");
        status = Ipc_control(proc->cpuId, Ipc_CONTROLCMD_LOADCALLBACK, NULL);
        proc->loadCallBackStatus = status;
        Log_print1(Diags_USER1, "[+2] Processor_create_d> "
                "Ipc_control(LOADCALLBACK) status: %d", (IArg)status);

        if (status < 0) {
            Log_print1(Diags_USER7, "Processor_create_d> "
                    "Ipc_control(LOADCALLBACK) failed: %d", status);
            goto fail;
        }
    }

    status = Ipc_control(proc->cpuId, Ipc_CONTROLCMD_STARTCALLBACK, NULL);
    proc->startCallBackStatus = status;
    Log_print1(Diags_USER1, "[+2] Processor_create_d> "
            "Ipc_control(STARTCALLBACK) status: %d", (IArg)status);
    if (status < 0) {
        Log_print1(Diags_USER7, "Processor_create_d> "
                "Ipc_control(STARTCALLBACK) failed: %d", status);
        goto fail;
    }


    /* get user-specified heapId */
    heapId = perCoreHeapId(proc->cpuId);
    createAndRegisterHeap = FALSE;

    if (heapId == Processor_INVALID) {
        /* runtime validation of user configuration */
        if (perCoreUserCreatedHeapFlag(proc->cpuId) == TRUE ||
                perCoreNumMsgs(proc->cpuId) != Processor_INVALID ||
                perCoreMsgSize(proc->cpuId) != Processor_INVALID ||
                perCoreSharedRegionId(proc->cpuId) != Processor_INVALID) {

            Log_print1(Diags_USER7, "[+7] Processor_create_d> "
                    "Invalid heap configuration for core %d: "
                    "attempting to set other Processor_CommDesc "
                    "elements while Processor_CommDesc.heapId is "
                    "undefined",
                    proc->cpuId);

            goto fail;
        }

        /* will return default heapId since user didn't specify */
        heapId = Processor_getHeapId(proc->cpuId);

        if (defaultHeapRefCount++ == 0) {
            createAndRegisterHeap = TRUE;

            /* tell code below to record heapH in defaultHeapH */
            defaultHeapH = (HeapBufMP_Handle)-1;
        }
    }
    else {
        if (perCoreUserCreatedHeapFlag(proc->cpuId) == FALSE) {
            createAndRegisterHeap = TRUE;
        }
    }

    if (createAndRegisterHeap) {
        /* create a heap for message queue usage */

        /* get either user-config'ed or module default */
        numMsgs = Processor_getNumMsgs(proc->cpuId);
        msgSize = Processor_getMsgSize(proc->cpuId);
        regionId = Processor_getSharedRegionId(proc->cpuId);

        HeapBufMP_Params_init(&heapP);
        heapP.numBlocks = numMsgs;
        heapP.blockSize = msgSize;
        heapP.sharedAddr = NULL;
        heapP.regionId = regionId;
        if (defaultHeapH == (HeapBufMP_Handle)-1) {
            sprintf(heapName, "CE-default");
        }
        else {
            sprintf(heapName, "CE<->Svr%d", proc->cpuId);
        }
        heapP.name = heapName;

        Log_print2(Diags_USER1, "[+2] Processor_create_d> "
                "calling HeapBufMP_create(): nblocks %d, blocksize 0x%x",
                heapP.numBlocks, heapP.blockSize);

        proc->heapH = HeapBufMP_create(&heapP);

        if (proc->heapH == NULL) {
            Log_print0(Diags_USER7, "[+7] Processor_create_d> "
                    "HeapBufMP_create failed");
            goto fail;
        }

        if (defaultHeapH == (HeapBufMP_Handle)-1) {
            /* we've just created the module default heap singleton */
            defaultHeapH = proc->heapH;
        }

        /* register this heap with MessageQ */
        Log_print2(Diags_USER1, "[+2] Processor_create_d> "
                "MessageQ_registerHeap(heapH: 0x%x, heapId: %d)",
                (IArg)(proc->heapH), (IArg)heapId);

        if (MessageQ_registerHeap((Ptr)(proc->heapH), heapId) !=
                    MessageQ_S_SUCCESS) {
        Log_print1(Diags_USER7, "[+7] Processor_create_d> "
                "MessageQ_registerHeap() failed for heapId %d", heapId);

        goto fail;
        }
    }
    else {
        /*
         *  createAndRegisterHeap == FASLE
         *  If using the default heap, need to set proc->heapH for use by
         *  procDelete().
         */
        if (heapId == Processor_defaultHeapId) {
            proc->heapH = defaultHeapH;
        }
    }

    proc->heapId = heapId;

    blockNum = 0;
    nCMEMBlocks = 0;
    status = CMEM_getNumBlocks(&nCMEMBlocks);
    if (status != 0) {
        Log_print1(Diags_USER2, "[+2] Processor_create_d> "
                "CMEM_getNumBlocks() failed, not registering: %d",
                status);
    }

    while (blockNum < nCMEMBlocks) {
        status = CMEM_getBlockAttrs(blockNum, &cmemBlockAttrs);
        if (status != 0) {
            Log_print2(Diags_USER7, "[+7] Processor_create_d> "
                    "CMEM_getBlockAttrs(%d) failed: %d",
                    blockNum, status);

            goto fail;
        }

        CMEMAddrInfo.addr[ProcMgr_AddrType_MasterPhys] =
                cmemBlockAttrs.phys_base;
        CMEMAddrInfo.addr[ProcMgr_AddrType_SlaveVirt] =
                cmemBlockAttrs.phys_base;
        CMEMAddrInfo.size = cmemBlockAttrs.size;
        CMEMAddrInfo.isCached = FALSE;

        Log_print3(Diags_USER1, "[+1] Processor_create_d> CMEM block "
                "#%d found, doing ProcMgr_map(0x%x, 0x%x)...", blockNum,
                (IArg)cmemBlockAttrs.phys_base,
                (IArg)cmemBlockAttrs.size);

        status = ProcMgr_map(proc->procMgrH, ProcMgr_SLAVEVIRT, &CMEMAddrInfo,
                ProcMgr_AddrType_MasterPhys);
        if (status < 0) {
            Log_print1(Diags_USER7, "[+7] Processor_create_d> "
                    "ProcMgr_map() failed: %d", status);
            goto fail;
        }

        if (CMEMAddrInfo.addr[ProcMgr_AddrType_SlaveVirt] !=
                cmemBlockAttrs.phys_base) {
            Log_print2(Diags_USER1, "[+2] Processor_create_d> "
                    "mapped CMEM slave virtual address 0x%x doesn't "
                    "match expected value 0x%x",
                    CMEMAddrInfo.addr[ProcMgr_AddrType_SlaveVirt],
                    cmemBlockAttrs.phys_base);
        }

        blockNum++;
    }

    if (Global_getenv("CE_DSPDEBUG") != NULL) {
        printf("Codec Engine system message (b/c CE_DSPDEBUG=1) : %s image "
               "loaded and started, press Enter to continue: ",
               proc->attrs.cpuId);
        getchar();
    }

    retVal = TRUE;
    goto procCreate_return;

    /* TODO:[4] should try those asyncErrorHandlers that link supports?
     * (MSGQ_SetErrorHandler)
     */

fail:
    Log_print3(Diags_USER7, "[+7] Processor_create_d> "
            "Loading and starting %s server '%s' FAILED, status=[0x%x]",
            (IArg)proc->attrs.cpuId, (IArg)proc->imageName, status);

    procDelete(proc);

    retVal = FALSE;

procCreate_return:

    Log_print1(Diags_USER2, "[+2] Processor_create_d> return (%d)",
            (IArg)retVal);

    return (retVal);
}