Beispiel #1
0
Void Audio_systemProcInit (Void)
{
    Int32   status;
    Int16   procId;
    Int16   state;

    /* 
     * SysLink_setup is the first APIs needs to be called by user side
     * application to use any SysLink functionality 
     */
    SysLink_setup ();

    procId = MultiProc_getId ("DSP");

    status = ProcMgr_open (&procMgrHandle, procId);
    if (0 > status) {
        AUDIO_ERROR_PRINT(("AUDIO: ProcMgr_open() Failed \n"));
        goto EXIT;
    }

    state = ProcMgr_getState (procMgrHandle);

EXIT:
    return;
}
int main (int argc, char ** argv)
{
    Int status             = 0;
    //ServiceMgr_Config serviceMgrConfig;

    Int i, j;

    /*
     *  Must be at least one set of procId and outfile. So argc cannot be odd
     */
    if ((argc < 3) || (argc / 2 * 2 == argc) || (argc > 7)) {
        Osal_printf ("uiaDemo <procId> <outfile> [<procId> <outfile>] [<procId> <outfile>]\n");
        return (-1);
    }

    for (i = 0, j = 1 ; i < argc/2; i++, j = j + 2) {
        uiaDemo_procId[i] = strtol (argv [j], NULL, 16);
        uiaDemo_filePath[i] = argv [j + 1];
        uiaDemo_numProcessors++;
    }

    Osal_printf ("Running on %d processors\n", uiaDemo_numProcessors);

    Osal_printf ("Calling SysLink_setup\n");
    SysLink_setup ();

    Osal_printf ("Calling uiaDemo_startup\n");
    status = uiaDemo_startup ();

    /* write to a binary file instead of sending out over Ethernet */
    //ServiceMgr_getConfig (&serviceMgrConfig);
    //strcpy(serviceMgrConfig.fileName, "eventDump");
    //status = ServiceMgr_setConfig (&serviceMgrConfig);
    //Osal_printf ("ServiceMgr_setConfig status = [0x%x]\n", status);

    Osal_printf ("Calling ServiceMgr_start\n");
    ServiceMgr_start();

    Osal_printf ("Calling uiaDemo_execute\n");
    status = uiaDemo_execute ();

    Osal_printf ("Calling ServiceMgr_stop\n");
    ServiceMgr_stop();

    Osal_printf ("Calling uiaDemo_shutdown\n");
    status = uiaDemo_shutdown ();

    Osal_printf ("Calling SysLink_destroy\n");
    SysLink_destroy ();

    return (0);
}
Beispiel #3
0
Int32 System_ipcInit()
{
    printf(" %u: SYSTEM: IPC init in progress !!!\n", OSA_getCurTimeInMsec());

    SysLink_setup ();

    System_ipcMsgQInit();

    System_ipcNotifyInit();


    printf(" %u: SYSTEM: IPC init DONE !!!\n", OSA_getCurTimeInMsec());

    return OSA_SOK;
}
int main (int argc, char ** argv)
{
    Int status             = 0;
    Int i, j;

    /*
     *  Must be at least one set of procId and outfile. So argc cannot be odd
     */
    if ((argc < 3) || (argc / 2 * 2 == argc) || (argc > 7)) {
        Osal_printf ("uiaDaemon <procId> <outfile> [<procId> <outfile>] [<procId> <outfile>]\n");
        return (-1);
    }

    for (i = 0, j = 1 ; i < argc/2; i++, j = j + 2) {
        loader_procId[i] = strtol (argv [j], NULL, 16);
        loader_filePath[i] = argv [j + 1];
        loader_numProcessors++;
    }

    Osal_printf ("Running on %d processors\n", loader_numProcessors);

    Osal_printf ("Calling SysLink_setup\n");
    SysLink_setup ();

    Osal_printf ("Calling loader_startup\n");
    status = loader_startup ();

    Osal_printf ("Calling loader_execute\n");
    status = loader_execute ();

    Osal_printf ("Calling loader_shutdown\n");
    status = loader_shutdown ();

    Osal_printf ("Calling SysLink_destroy\n");
    SysLink_destroy ();

    return (0);
}
/*
 *  ======== 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);
    }
}