예제 #1
0
/*
 *  ======== Algorithm_init ========
 */
Void Algorithm_init()
{
    Registry_Result   result;

    /*
     *  No need to reference count for Registry_addModule(), since there
     *  is no way to remove the module.
     */
    if (regInit == 0) {
        /* Register this module for logging */
        result = Registry_addModule(&ti_sdo_ce_algorithm_desc,
                Algorithm_MODNAME);
        Assert_isTrue(result == Registry_SUCCESS, (Assert_Id)NULL);

        if (result == Registry_SUCCESS) {
            /* Set the diags mask to the CE default */
            CESettings_init();
            CESettings_setDiags(Algorithm_MODNAME);
        }
        regInit = 1;
    }

    if (curInit != TRUE) {
        curInit = TRUE;
        RMAN_init();
        Global_atexit((Fxn)Algorithm_exit);
    }
}
예제 #2
0
파일: viddec1.c 프로젝트: mobiaqua/ti-ce
/*
 *  ======== VIDDEC1_create ========
 */
VIDDEC1_Handle VIDDEC1_create(Engine_Handle engine, String name,
    VIDDEC1_Params *params)
{
    Registry_Result   result;
    VIDDEC1_Handle visa;

    /* TODO:M  Race here!  Do we need ATM_Increment in our OSAL? */
    if (regInit == 0) {
        /* Register this module for logging */
        result = Registry_addModule(&ti_sdo_ce_video1_viddec1_desc, MODNAME);
        Assert_isTrue(result == Registry_SUCCESS, (Assert_Id)NULL);

        if (result == Registry_SUCCESS) {
            /* Set the diags mask to the CE default */
            CESettings_init();
            CESettings_setDiags(MODNAME);
        }
        regInit = 1;
    }

    Log_print3(Diags_ENTRY, "[+E] VIDDEC1_create> "
            "Enter (engine=0x%x, name='%s', params=0x%x)",
            (IArg)engine, (IArg)name, (IArg)params);

    visa = VISA_create(engine, name, (IALG_Params *)params,
        sizeof (_VIDDEC1_Msg), VIDDEC1_VISATYPE);

    Log_print1(Diags_EXIT, "[+X] VIDDEC1_create> return (0x%x)", (IArg)visa);

    return (visa);
}
예제 #3
0
/*
 *  ======== Loader_init ========
 */
Void Loader_init(Void)
{
    Registry_Result   result;

    /*
     *  No need to reference count for Registry_addModule(), since there
     *  is no way to remove the module.
     */
    if (regInit == 0) {
        /* Register this module for logging */
        result = Registry_addModule(&ti_sdo_ce_osal_Loader_desc,
                                    Loader_MODNAME);
        Assert_isTrue(result == Registry_SUCCESS, (Assert_Id)NULL);

        if (result == Registry_SUCCESS) {
            /* Set the diags mask to the CE default */
            CESettings_init();
            CESettings_setDiags(Loader_MODNAME);
        }
        regInit = 1;
    }

    if (curInit++ == 0) {
        Global_atexit((Fxn)cleanup);
    }
}
예제 #4
0
파일: main.c 프로젝트: chenguangshen/libdce
Void Ducati_AppTask (UArg arg1, UArg arg2)
{
	FCSettings_init();
	Diags_setMask(FCSETTINGS_MODNAME"+12345678LEXAIZFS");
	CESettings_init();
	Diags_setMask(CESETTINGS_MODNAME"+12345678LEXAIZFS");
//	Diags_setMask("ti.sdo.rcm.RcmServer-12");
//	Diags_setMask("ti.sysbios.utils.Load-4");

    init_IVAHDFrwk();
    HDVICP_Reset(NULL, NULL);
    platform_init();

    /* how do we know when to unload.. */
    while (1) {
        Task_sleep(0x7fffffff);
    }

    /*The test cases will run in this task's context in the init call.
    Once init returns, testcases have exited so do deinit*/
    platform_deinit();

    exit_IVAHDFrwk();

    System_exit(0);
}
예제 #5
0
/*
 *  ======== Global_init ========
 */
Void Global_init(Void)
{
    Int i;
    Registry_Result   result;

    /*
     *  No need to reference count for Registry_addModule(), since there
     *  is no way to remove the module.
     */
    if (regInit == 0) {
        /* Register this module for logging */
        result = Registry_addModule(&ti_sdo_ce_osal_Global_desc,
                                    Global_MODNAME);
        Assert_isTrue(result == Registry_SUCCESS, (Assert_Id)NULL);

        if (result == Registry_SUCCESS) {
            /* Set the diags mask to the CE default */
            CESettings_init();
            CESettings_setDiags(Global_MODNAME);
        }
        regInit = 1;
    }

    if (curInit != TRUE) {
        curInit = TRUE;

        Log_print0(Diags_USER4, "[+4] Global_init> "
                   "This program was built with the following packages:" );
        for (i = 0; Global_buildInfo[i] != NULL; i++) {
            Log_print1(Diags_USER4, "[+4] %s", (IArg)(Global_buildInfo[i]));
        }
    }
}
예제 #6
0
/*
 *  ======== Comm_init ========
 */
Bool Comm_init(Void)
{
    Registry_Result   result;

    /*
     *  No need to reference count for Registry_addModule(), since there
     *  is no way to remove the module.
     */
    if (regInit == 0) {
        /* Register this module for logging */
        result = Registry_addModule(&ti_sdo_ce_ipc_comm_desc, Comm_MODNAME);
        Assert_isTrue(result == Registry_SUCCESS, (Assert_Id)NULL);

        if (result == Registry_SUCCESS) {
            /* Set the diags mask to the CE default */
            CESettings_init();
            CESettings_setDiags(Comm_MODNAME);
        }
        regInit = 1;
    }

    if (curInit++ == 0) {
        /* TODO:M not process safe (right?) */
        userName = getenv("LOGNAME");
        if (userName == NULL) {
            userName = "";
        }
    }

    return (TRUE);
}
예제 #7
0
/*
 *  ======== VIDENCCOPY_TI_alloc ========
 */
Int VIDENCCOPY_TI_alloc(const IALG_Params *algParams,
    IALG_Fxns **pf, IALG_MemRec memTab[])
{
    Registry_Result   result;


    /*
     *  No need to reference count for Registry_addModule(), since there
     *  is no way to remove the module.
     */
    if (regInit == 0) {
        /* Register this module for logging */
        result = Registry_addModule(&ti_sdo_ce_examples_codecs_videnc_copy_desc,
                MODNAME);
        Assert_isTrue(result == Registry_SUCCESS, (Assert_Id)NULL);

        if (result == Registry_SUCCESS) {
            /* Set the diags mask to the CE default */
            CESettings_init();
            CESettings_setDiags(MODNAME);
        }
        regInit = 1;
    }

    Log_print3(Diags_ENTRY, "[+E] VIDENCCOPY_TI_alloc(0x%x, 0x%x, 0x%x)",
            (IArg)algParams, (IArg)pf, (IArg)memTab);

    /* Request memory for my object */
    memTab[0].size = sizeof(VIDENCCOPY_TI_Obj);
    memTab[0].alignment = 0;
    memTab[0].space = IALG_EXTERNAL;
    memTab[0].attrs = IALG_PERSIST;

	// ADD BY ZHENGHANG
   	memTab[1].size = sizeof(char)*25000 * 1024;
    memTab[1].alignment = 0;
    memTab[1].space = IALG_EXTERNAL;//IALG_DARAM0;
    memTab[1].attrs = IALG_PERSIST;

	// ADD BY ZHOULU	
	memTab[2].size = sizeof(char) * 150000 * 1024;
	memTab[2].alignment = 0;
	memTab[2].space = IALG_EXTERNAL;
	memTab[2].attrs = IALG_PERSIST;

	memTab[3].size = sizeof(char) * 127*1024;
	memTab[3].alignment = 0;
	memTab[3].space = IALG_DARAM0;
	memTab[3].attrs = IALG_PERSIST;

//IALG_DARAM0;
    return (4);
}
예제 #8
0
/*
 *  ======== Memory_init ========
 */
Bool Memory_init(Void)
{
    Registry_Result   result;

    /*
     *  No need to reference count for Registry_addModule(), since there
     *  is no way to remove the module.
     */
    if (regInit == 0) {
        /* Register this module for logging */
        result = Registry_addModule(&ti_sdo_ce_osal_Memory_desc,
                Memory_MODNAME);
        Assert_isTrue(result == Registry_SUCCESS, (Assert_Id)NULL);

        if (result == Registry_SUCCESS) {
            /* Set the diags mask to the CE default */
            CESettings_init();
            CESettings_setDiags(Memory_MODNAME);
        }
        regInit = 1;
    }

    if (curInit != TRUE) {
        curInit = TRUE;
        moduleLock = Lock_create(NULL);
        if (moduleLock == NULL) {
            Log_print0(Diags_USER7, "[+7] Memory_init> "
                    "ERROR: could not create pthread mutex.");
            assert(FALSE);
        }

        if (CMEM_init() == -1) {
            Log_print0(Diags_USER7, "[+7] Memory_init> "
                    "ERROR: Failed to initialize CMEM");
        }
        else {
            cmemInitialized = TRUE;
        }

        Global_atexit((Fxn)cleanup);
    }

    return (cmemInitialized);
}
예제 #9
0
/*
 *  ======== Processor_init ========
 */
Void Processor_init(Void)
{
    Registry_Result   result;

    /*
     *  No need to reference count for Registry_addModule(), since there
     *  is no way to remove the module.
     */
    if (regInit == 0) {
        /* Register this module for logging */
        result = Registry_addModule(&ti_sdo_ce_ipc_processor_desc,
                Processor_MODNAME);
        Assert_isTrue(result == Registry_SUCCESS, (Assert_Id)NULL);

        if (result == Registry_SUCCESS) {
            /* Set the diags mask to the CE default */
            CESettings_init();
            CESettings_setDiags(Processor_MODNAME);
        }
        regInit = 1;
    }
}
예제 #10
0
/*
 *  ======== Algorithm_init ========
 */
Void Algorithm_init()
{
    Registry_Result   result;

    /*
     *  No need to reference count for Registry_addModule(), since there
     *  is no way to remove the module.
     */
    if (regInit == 0) {
        /* Register this module for logging */
        result = Registry_addModule(&ti_sdo_ce_algorithm_desc,
                Algorithm_MODNAME);
        Assert_isTrue(result == Registry_SUCCESS, (Assert_Id)NULL);

        if (result == Registry_SUCCESS) {
            /* Set the diags mask to the CE default */
            CESettings_init();
            CESettings_setDiags(Algorithm_MODNAME);
        }
        regInit = 1;
    }

    if (curInit++ == 0) {
        RMAN_init();
        DMAN3_CE_init();

        /*
         *  NOTE: We are calling ALG_init() here rather than calling it in
         *  CERuntime_init(). This simplifies the auto-generation of
         *  CERuntime_init(), since ALG is not used in Algorithm_BIOS.c.
         *  Since ALG_init() is called here, to keep the symmetry, we will
         *  also call ALG_exit() from Algorithm_exit(), rather than having
         *  ALG_init() register its exit function through Global_atexit().
         */
        ALG_init();
        Global_atexit((Fxn)Algorithm_exit);
    }
}
예제 #11
0
파일: rtcfg.c 프로젝트: mobiaqua/ti-ce
/*
 *  ======== 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"));
    }

}
예제 #12
0
파일: svr_rtcfg.c 프로젝트: mobiaqua/ti-ce
/*
 *  ======== 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"));
        }
    }
}
예제 #13
0
/*
 *  ======== Memory_init ========
 */
Bool Memory_init(Void)
{
    Registry_Result   result;
    Int               i;
    Memory_Stat       stat;

    static Bool curInit = FALSE;

    if (curInit != TRUE) {
        curInit = TRUE;
        Memory_DEFAULTPARAMS.seg = (UInt)xdc_runtime_Memory_defaultHeapInstance;

        /* Register this module for logging */
        result = Registry_addModule(&ti_sdo_ce_osal_Memory_desc,
                Memory_MODNAME);
        Assert_isTrue(result == Registry_SUCCESS, (Assert_Id)NULL);

        if (result == Registry_SUCCESS) {
            /* Set the diags mask to the CE default */
            CESettings_init();
            CESettings_setDiags(Memory_MODNAME);
        }

        ti_sdo_ce_osal_Memory_cfgInit();

        /*
         *  Note: Memory_originalBase and Memory_originalSize are only
         *  accessed through the RMS server thread, so we don't need to
         *  alloc these buffers inside a Gate_enter() call.
         */
        if ((Memory_numHeaps > 0) && (Memory_originalBase == NULL)) {
            Memory_originalBase = xdc_runtime_Memory_alloc(NULL,
                    Memory_numHeaps * sizeof(Uint32), 0, NULL);
            if (Memory_originalBase == NULL) {
                Log_print0(Diags_USER7, "Memory_init> Memory_alloc() failed");
                return (FALSE);
            }
        }

        if ((Memory_numHeaps > 0) && (Memory_originalSize == NULL)) {
            Memory_originalSize = xdc_runtime_Memory_alloc(NULL,
                    Memory_numHeaps * sizeof(Uint32), 0, NULL);
            if (Memory_originalSize == NULL) {
                xdc_runtime_Memory_free(NULL, Memory_originalBase,
                        sizeof(Uint32) * Memory_numHeaps);
                Log_print0(Diags_USER7, "Memory_init> Memory_alloc() failed");
                return (FALSE);
            }
        }

        /*
         *  Keep track of original size and base of memory heaps in case
         *  someone does a Memory_redefine() then a Memory_restoreHeap().
         */
        for (i = 0; i < Memory_numHeaps; i++) {
            if (!Memory_segStat(i, &stat)) {
                Log_print1(Diags_USER7, "Memory_init> Memory_segStat(%d) "
                        "failed!", (IArg)i);
                Memory_originalBase[i] = (UInt32)-1;
                Memory_originalSize[i] = 0;
            }
            else {
                Memory_originalBase[i] = stat.base;
                Memory_originalSize[i] = stat.size;
            }
        }
    }

    return (TRUE);
}
/*
 *  ======== Processor_init ========
 */
Void Processor_init(Void)
{
    GateThread_Params params;
    Registry_Result   result;

    /*
     *  No need to reference count for Registry_addModule(), since there
     *  is no way to remove the module.
     */
    if (regInit == 0) {
        /* Register this module for logging */
        result = Registry_addModule(&ti_sdo_ce_ipc_processor_desc,
                Processor_MODNAME);
        Assert_isTrue(result == Registry_SUCCESS, (Assert_Id)NULL);

        if (result == Registry_SUCCESS) {
            /* Set the diags mask to the CE default */
            CESettings_init();
            CESettings_setDiags(Processor_MODNAME);
        }
        regInit = 1;
    }

    if (curInit != TRUE) {
        curInit = TRUE;

        /* Semaphore with count 0, will be posted when a command is present */
        dcmd.cmdPresent = SemThread_create(0, NULL, NULL);

        /* Semaphore with count 0, will be posted when reply is ready */
        dcmd.replyPresent = SemThread_create(0, NULL, NULL);

        /*
         *  Create lock to allow only one thread at a time to send command
         *  to the daemon.
         */
        GateThread_Params_init(&params);
        dcmd.gate = GateThread_create(&params, NULL);

        if ((dcmd.cmdPresent == NULL) || (dcmd.replyPresent == NULL) ||
                (dcmd.gate == NULL)) {
            // TODO: Shouldn't we abort?
            Log_print0(Diags_USER7, "[+7] Processor_init> ERROR: cannot"
                    " create semaphores or lock");
        }

        Log_print0(Diags_USER2, "[+2] Processor_init> SysLink_setup()...");

        SysLink_setup();
        Log_print0(Diags_USER2, "[+2] Processor_init> "
                "... SysLink_setup() done");

        if ((dcmd.dproc = Thread_create((Thread_RunFxn)daemon, NULL, NULL))
                == NULL) {
            Log_print0(Diags_USER7, "[+7] Processor_init> "
                    "ERROR: cannot create DSP daemon");
        }

        if (Thread_start(NULL) != TRUE) {
            Log_print0(Diags_USER7, "[+7] Processor_init> "
                    "ERROR: cannot start threads");
        }

        Global_atexit((Fxn)cleanup);
    }
}