Exemplo n.º 1
0
/*
 *  ======== RMAN_exit ========
 *  Exit the generic IRES RMAN and free the memory back to the Memory manager
 *  using which it was created.
 */
IRES_Status RMAN_exit()
{
    IArg        key;
    Int         i;
    IRES_Status status = IRES_OK;


    if (rmanInit == 0) {
        return (IRES_ENOINIT);
    }

    Log_print0(Diags_ENTRY, "[+E] RMAN_exit> Enter ");

    rmanInternalState->info.refCount--;

    if (--rmanInit == 0) {
        if (initStatus != IRES_OK) {
            Log_print0(Diags_USER7, "[+7] RMAN_exit> RMAN_init call didn't "
                    "happen successfully. RMAN_exit will not unregister "
                    "any resources.");
            status = IRES_ENOINIT;
        }
        else {
            key = IGateProvider_enter(gate);

            Log_print1(Diags_EXIT, "[+X] RMAN_exit> tableIndex = %d",
                    (IArg)(resTable.tableIndex));

            /* Unregister the entries */
            Log_print0(Diags_EXIT, "[+X] RMAN_exit> Unregistering resources");

            for (i = 0; i < resTable.tableIndex; i++) {
                if (RMAN_TABLE[i] != NULL) {

                    /* Even if there is an error, unregister the rest */
                    if ((status = RMAN_TABLE[i]->exit()) != IRES_OK) {
                        Log_print2(Diags_USER7, "[+7] RMAN_exit> Error "
                                "unregistering the IRESMAN implementation "
                                "0x%x, status = %d",
                                (IArg)(RMAN_TABLE[i]), (IArg)status);
                        status = IRES_EFAIL;
                    }
                }
            }
            /* Free the RMAN object */
            freeInternalState();

            initStatus = IRES_ENOINIT;

            /* Free the gate after leaving it */
            IGateProvider_leave(gate, key);
            OsalSupport_deleteGate(gate);
            gate = NULL;
        }
    }

    Log_print1(Diags_EXIT, "[+X] RMAN_exit> Exit (status=%d)", (IArg)status);

    return (status);
}
/* ARGSUSED - this line tells the compiler not to warn about unused args. */
IRES_Handle IRES_SDMA_constructHandle(
        IRES_ProtocolArgs * resProtocolArgs,
        IALG_MemRec *memRecs,
        IRESMAN_ConstructArgs * constructHandleArgs,
        IRES_Status *status)
{
    IRES_SDMA_Handle handle = (IRES_SDMA_Handle)memRecs[0].base;

    IRES_SDMA_ConstructHandleArgs * constructArgs =
        (IRES_SDMA_ConstructHandleArgs *)constructHandleArgs;

    Log_print3(Diags_ENTRY,
            "[+E] _IRES_SDMA_constructHandle> Enter (resProtcolArgs=0x%x, "
            "memRecs=0x%x, constructHandleArgs=0x%x)",
            (IArg)resProtocolArgs, (IArg)memRecs, (IArg)constructHandleArgs);

    Assert_isTrue(resProtocolArgs != NULL, (Assert_Id)NULL);
    Assert_isTrue(memRecs != NULL, (Assert_Id)NULL);
    Assert_isTrue(constructHandleArgs != NULL, (Assert_Id)NULL);
    Assert_isTrue(status != NULL, (Assert_Id)NULL);

    if (handle == NULL) {

        *status = IRES_ENORESOURCE;

        Log_print0(Diags_USER7,
                "[+7] _IRES_SDMA_constructHandle> NULL handle passed in "
                "memRecs[0].base");

        Log_print1(Diags_EXIT,
                "[+X] _IRES_SDMA_constructHandle> Exit (handle=0x%x, "
                "status=IRES_ENORESOURCE)", (IArg)handle);

        return ((IRES_Handle) NULL);
    }

    ((IRES_SDMA_Handle)handle)->ires.getStaticProperties =
            IRES_SDMA_getStaticProperties;

    /*
     * Use the constructHandleargs to populate the handle
     */
    handle->channel = (SDMA_ChannelDescriptor *)
            (handle + sizeof(IRES_SDMA_Obj));

    handle->ires.persistent = constructArgs->persistent;

    *status = IRES_OK;

    Log_print1(Diags_EXIT,
            "[+X] _IRES_SDMA_constructHandle> Exit (handle=0x%x, status=IRES_OK)",
            (IArg)handle);

    return ((IRES_Handle)handle);
}
Exemplo n.º 3
0
/*
 *  ======== Algorithm_addGroup ========
 */
Bool Algorithm_addGroup(Int groupId)
{
    Bool    retVal = TRUE;

    Log_print1(Diags_ENTRY, "[+E] Algorithm_addGroup> Enter(groupId=%d)",
            (IArg)groupId);

    Log_print1(Diags_EXIT, "[+X] Algorithm_addGroup> Exit (status = %d)",
            (IArg)retVal);

    return (retVal);
}
Exemplo n.º 4
0
/*
 *  ======== procDelete ========
 */
static Void procDelete(Processor_Handle proc)
{
    Int16 heapId;
    Bool unregisterAndDeleteHeap;

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

    if (proc == NULL) {
        goto procDelete_return;
    }

    if (proc->hHeap != NULL) {
        unregisterAndDeleteHeap = FALSE;
        if (proc->hHeap == defaultHeapH) {
            if (--defaultHeapRefCount == 0) {
                /* this is the last one using the default heap */
                unregisterAndDeleteHeap = TRUE;
            }
        }
        else {
            unregisterAndDeleteHeap = TRUE;
        }

        if (unregisterAndDeleteHeap) {
            heapId = proc->heapId;
            if (heapId != Processor_INVALID) {
                Log_print1(Diags_USER1, "[+1] Processor_delete_d> "
                           "MessageQ_unregisterHeap(heapId: %d)",
                           (IArg)heapId);

                if (MessageQ_unregisterHeap(heapId) != MessageQ_S_SUCCESS) {
                    Log_print1(Diags_USER7, "[+7] Processor_delete_d> "
                               "MessageQ_unregisterHeap(heapId: %d) "
                               "failed",
                               heapId);

                }
            }

            /* delete heap used by message queue */
            Log_print1(Diags_USER1, "[+1] Processor_delete_d> "
                       "calling HeapBufMP_delete(hHeap: 0x%x)",
                       (IArg)(proc->hHeap));

            HeapBufMP_delete(&proc->hHeap);
        }
    }

procDelete_return:

    Log_print1(Diags_EXIT, "[+X] Processor_delete_d> return", (IArg)proc);
}
/*
 *  ======== Processor_create ========
 */
Processor_Handle Processor_create(String imageName, String memMap,
    Processor_Attrs *attrs)
{
    Processor_Handle proc = NULL;
    struct stat statBuf;

    Assert_isTrue(curInit == TRUE, (Assert_Id)NULL);

    Log_print3(Diags_ENTRY, "[+E] Processor_create> "
            "Enter(imageName='%s', memMap='%s', attrs=0x%x)",
            (IArg)imageName, (IArg)memMap, (IArg)attrs);

    if (attrs == NULL) {
        attrs = &Processor_ATTRS;
    }

    if (stat(imageName, &statBuf) != 0) {
        Log_print1(Diags_USER7, "[+7] Processor_create> "
                "ERROR: cannot access file %s", (IArg)imageName);
        return (NULL);
    }

    proc = Memory_alloc(sizeof(Processor_Obj), NULL);
    if (proc == NULL) {
        Log_print0(Diags_USER7, "[+7] Processor_create> "
                "ERROR: Memory_alloc failed");
        return (NULL);
    }

    proc->attrs = *attrs;
    proc->imageName = imageName;
    proc->memMapName = memMap;
    proc->loaded = FALSE;
    proc->fileId = 0xffffffff;
    proc->heapH = NULL;
    proc->procMgrH = NULL;
    proc->heapId = Processor_INVALID;
    proc->loadCallBackStatus = -1;
    proc->startCallBackStatus = -1;
    proc->useExtLoader = attrs->useExtLoader;

    if (doCmd(CREATE, proc) != SUCCESS) {
        Processor_delete(proc);
        return (NULL);
    }
    proc->loaded = TRUE;

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

    return (proc);
}
/* ARGSUSED */
int main(Int argc, Char * argv[])
{
    IRES_Status status;
    Int         size = 0;

    // TODO: Use Diags_setMask()
#if 0
    GT_init();
    GT_create(&CURTRACE, "ti.sdo.fc.rman.examples.hdvicp");
        GT_set(MOD_NAME "=01234567");
        GT_set("ti.sdo.fc.rman" "=4567");
        GT_set("ti.sdo.fc.dskt2" "=67");
        GT_set("ti.sdo.fc.ires.hdvicp" "=01234567");
/*      GT_set("ti.sdo.fc.dskt2" "=01234567");*/
#endif

    Log_print0(Diags_ENTRY, "[+E] _main> Enter ");

    status = RMAN_init();
    if (IRES_OK != status) {
        Log_print1(Diags_USER7, "[+7] main> RMAN_init() failed [%d]",
                (IArg)status);
        System_abort("RMAN_init() failed, aborting...\n");
    }

    /*
     * Supply initialization information for the RESMAN while registering
     */
    size = sizeof(IRESMAN_HdVicpParams);

    configParams.baseConfig.allocFxn = RMAN_PARAMS.allocFxn;
    configParams.baseConfig.freeFxn = RMAN_PARAMS.freeFxn;
    configParams.baseConfig.size = size;

    /* Register the HDVICP protocol/resource manager with the
     * generic resource manager */

    status = RMAN_register(&IRESMAN_HDVICP, (IRESMAN_Params *)&configParams);

    if (IRES_OK != status) {
        Log_print1(Diags_USER7, "[+7] main> RMAN_register() failed [%d]",
                (IArg)status);
        System_abort("RMAN_register() failed, aborting...\n");
    }

    Log_print0(Diags_EXIT, "[+X] main> Exit");

    BIOS_start();

    return(0);
}
Exemplo n.º 7
0
Int RcmClient_Instance_finalize(RcmClient_Object *obj)
{
    SemThread_Handle semH;
    Int status = RcmClient_S_SUCCESS;


    Log_print1(Diags_ENTRY, "--> "FXNN": (obj=0x%x)", (IArg)obj);

    if (NULL != obj->newMail) {
        List_delete(&obj->newMail);
    }

    if (NULL != obj->recipients) {
        List_delete(&obj->recipients);
    }

    if (NULL != obj->queueLock) {
        semH = SemThread_Handle_downCast(obj->queueLock);
        SemThread_delete(&semH);
        obj->queueLock = NULL;
    }

    if (NULL != obj->mbxLock) {
        semH = SemThread_Handle_downCast(obj->mbxLock);
        SemThread_delete(&semH);
        obj->mbxLock = NULL;
    }

    if (MessageQ_INVALIDMESSAGEQ != obj->serverMsgQ) {
        MessageQ_close((MessageQ_QueueId *)(&obj->serverMsgQ));
    }

    if (NULL != obj->errorMsgQue) {
        MessageQ_delete(&obj->errorMsgQue);
    }

    if (NULL != obj->msgQue) {
        MessageQ_delete(&obj->msgQue);
    }

    if (NULL != obj->sync) {
        SyncSemThread_delete((SyncSemThread_Handle *)(&obj->sync));
    }

    /* destruct the instance gate */
    GateThread_destruct(&obj->gate);

    Log_print1(Diags_EXIT, "<-- "FXNN": %d", (IArg)status);
    return(status);
}
Exemplo n.º 8
0
/*
 * ======== DSKT2_deactivateAlg ========
 *
 * Performs 'optimistic' algorithm activation/deactivation!
 * That is: alg 'deactivation' does not happen until  some *other* algorithm
 * instance needs to be activated.
 * When activating the new algorithm, the former (i.e.'current') active
 * instance gets deactivated.
 */
Void DSKT2_deactivateAlg(Int scratchId, IALG_Handle alg)
{

#ifndef DSKT2_DISABLELAZYD
    Bool isScratch;
#endif

    Log_print2(Diags_ENTRY, "[+E] DSKT2_deactivateAlg> Enter "
            "(scratchId=%d, algHandle=0x%x)", (IArg)scratchId, (IArg)alg);

#ifndef DSKT2_DISABLELAZYD
    isScratch = (scratchId >= 0) && (scratchId < DSKT2_NUM_SCRATCH_GROUPS);

    if (isScratch) {
        _DSKT2_lastActiveAlg[scratchId] = alg;
        _DSKT2_activeAlg[scratchId] = NULL;

        Log_print1(Diags_USER4, "[+4] DSKT2_deactivateAlg> "
                "Lazy deactivate of algorithm 0x%x", (IArg)alg);
    }
    else {
#endif
        if ((alg != NULL) && (alg->fxns->algDeactivate != NULL)) {

            Log_print1(Diags_USER4,
                    "[+4] DSKT2_deactivateAlg> Real deactivate of algorithm 0x%x",
                    (IArg)alg);

            Log_print1(Diags_USER2, "[+2] DSKT2_deactivateAlg> "
                    "Release lock for scratch group %d", (IArg)scratchId);

            /* Deactivate if alg is not using scratch */
            alg->fxns->algDeactivate(alg);
        }
#ifndef DSKT2_DISABLELAZYD
    }
#endif

    /*
     * Release lock that was acquired during activate
     */
    DSKT2_releaseLock(scratchId);

    if (_DSKT2_yielded) {
        _DSKT2_yielded = 0;
        _DSKT2_NumYielded--;
    }

    Log_print0(Diags_EXIT, "[+X] DSKT2_deactivateAlg> Exit");
}
Int SystemCfg_createResources(SystemCfg_Object *obj)
{
    Error_Block         eb;
    Int                 status = 0;
    HeapBuf_Params      heapBufP;
    IHeap_Handle        heapH;


    Log_print1(Diags_ENTRY | Diags_INFO, "--> "FXNN": (obj=0x%x)",(IArg)obj);
    Error_init(&eb);

    /* allocate heap backing store from SR_0 heap */
    heapH = (IHeap_Handle)SharedRegion_getHeap(0);
    obj->rcmHeapBufSize = 5 * 128;
    obj->rcmHeapBufBase = Memory_alloc(heapH, obj->rcmHeapBufSize, 128, &eb);

    if (Error_check(&eb)) {
        Log_error1(FXNN": out of memory: size=%u", obj->rcmHeapBufSize);
        status = -1;
        goto leave;
    }

    /* create heap for messages */
    HeapBuf_Params_init(&heapBufP);
    heapBufP.blockSize = 128;       // header = 52 B, payload = 76 B
    heapBufP.numBlocks = 5;         // 5 messages, total heap storage = 640 B
    heapBufP.align = 128;           // align on cache line boundary
    heapBufP.buf = obj->rcmHeapBufBase;     // heap storage base address
    heapBufP.bufSize = obj->rcmHeapBufSize; // heap storage size

    obj->rcmHeapH = HeapBuf_create(&heapBufP, &eb);

    if (Error_check(&eb)) {
        Log_error0(FXNN": HeapBuf_create() failed");
        status = -1;
        goto leave;
    }

    /* register this heap with MessageQ */
    Log_print2(Diags_INFO,
        FXNN": MessageQ_registerHeap: (rcmHeapH: 0x%x, heapId: %d)",
        (IArg)(obj->rcmHeapH), (IArg)SystemCfg_RcmMsgHeapId_CompDev);

    MessageQ_registerHeap((Ptr)(obj->rcmHeapH), SystemCfg_RcmMsgHeapId_CompDev);

leave:
    Log_print1(Diags_EXIT, "<-- "FXNN": %d", (IArg)status);
    return(status);
}
Exemplo n.º 10
0
Int RcmClient_destruct(RcmClient_Struct *structPtr)
{
    RcmClient_Object *obj = (RcmClient_Object *)(structPtr);
    Int status = RcmClient_S_SUCCESS;


    Log_print1(Diags_ENTRY, "--> %s: ()", (IArg)FXNN);
    Log_print1(Diags_LIFECYCLE, FXNN": instance destruct: 0x%x", (IArg)obj);

    /* finalize the object */
    status = RcmClient_Instance_finalize(obj);

    Log_print2(Diags_EXIT, "<-- %s: %d", (IArg)FXNN, (IArg)status);
    return(status);
}
Exemplo n.º 11
0
/*
 *  ======== Comm_delete ========
 */
Void Comm_delete(Comm_Handle comm)
{
    Assert_isTrue(curInit > 0, (Assert_Id)NULL);

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

    if (comm != NULL) {
        if (comm->id >= 0) {
            msgctl(comm->id, IPC_RMID, NULL);
        }
        Memory_free(NULL, comm, sizeof(Comm_Obj));
    }

    Log_print1(Diags_EXIT, "[+X] Comm_delete> return", (IArg)comm);
}
Exemplo n.º 12
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]));
        }
    }
}
Exemplo n.º 13
0
/*
 *  ======== Global_exit ========
 *  calls cleanup functions for all the modules that
 *  scheduled it, then cleans up itself
 */
Void Global_exit(Void)
{
    ExitFxnElem *old;

    if (curInit == FALSE) {
        return;
    }

    Log_print0(Diags_ENTRY, "[+E] Global_exit> enter" );

    while( exitFxnList != NULL ) {
        Log_print1(Diags_USER2, "[+2] Global_exit> "
                   "calling function *0x%x()...", (IArg)(exitFxnList->fxn ));
        exitFxnList->fxn();
        old = exitFxnList;
        exitFxnList = exitFxnList->next;
        Memory_free(NULL, old, sizeof(ExitFxnElem));
    }

    /* if the tracing module has its exit function, it must have been
     * the last one, so don't use trace from this point on
     */

    /* do the cleanup of this module */
    curInit          = FALSE;
    exitFxnList      = NULL;  /* unnecessary, NULL already */

    /* we do NOT reset doRegisterAtExit, as we don't want endless pairs of
     * CERuntime_init/exit to keep adding this func to the process' atexit
     * table. Autoexit is a curtesy feature only for those who call
     * CERuntime_init once.
     */
    /* doRegisterAtExit = TRUE; */
}
Exemplo n.º 14
0
/*
 *  ======== Global_atexit ========
 *  TODO: (jeh) Use System_atexit(System_AtexitHandler fxn), where
 *  typedef Void (*System_AtexitHandler)(Int);
 */
Bool Global_atexit(Fxn fxn)
{
    ExitFxnElem *exitFxnElem;


    Log_print1(Diags_ENTRY, "[+E] Global_atexit> enter (fxn=0x%x)", (IArg)fxn);

    exitFxnElem = (ExitFxnElem *)Memory_alloc(NULL, sizeof(ExitFxnElem), 0,
                  NULL);

    if (exitFxnElem == NULL) {
        return (FALSE);
    }

    exitFxnElem->fxn  = fxn;
    exitFxnElem->next = exitFxnList;
    exitFxnList       = exitFxnElem;

    /* register with the real system exit only once in the lifetime */
    if (doRegisterAtExit == TRUE) {
        System_atexit((System_AtexitHandler)Global_exit );
        doRegisterAtExit = FALSE;
    }

    return (TRUE);
}
/*
 *  ======== doCmd ========
 */
static Int doCmd(Int cmdId, Processor_Handle proc)
{
    Int result;
    IArg key;

    Log_print2(Diags_ENTRY, "[+E] doCmd> Enter (cmdId=%d, proc=0x%x)",
            (IArg)cmdId, (IArg)proc);

    //pthread_mutex_lock(&dcmd.gate);
    key = GateThread_enter(dcmd.gate);

    dcmd.proc = proc;
    dcmd.cmdId = cmdId;
    //pthread_cond_signal(&dcmd.cmdPresent);
    SemThread_post(dcmd.cmdPresent, NULL);

    //while (dcmd.reply == NONE) {
    //    pthread_cond_wait(&dcmd.replyPresent, &dcmd.gate);
    //}
    SemThread_pend(dcmd.replyPresent, SemThread_FOREVER, NULL);

    result = dcmd.reply;
    dcmd.reply = NONE;

    //pthread_mutex_unlock(&dcmd.gate);
    GateThread_leave(dcmd.gate, key);

    Log_print1(Diags_EXIT, "[+X] doCmd> Exit (result=%d)", (IArg)result);

    return (result);
}
Exemplo n.º 16
0
/*
 *  ======== Processor_delete ========
 */
Void Processor_delete(Processor_Handle proc)
{
    Log_print1(Diags_ENTRY, "[+E] Processor_delete> Enter(proc=0x%x)",
            (IArg)proc);

#if MESSAGEQ_ENABLED
    if (proc != NULL) {
        procDelete(proc);

        Log_print1(Diags_USER1,
                "[+1] Processor_delete(0x%x) freeing object ...", (IArg)proc);
        xdc_runtime_Memory_free(NULL, proc, sizeof(Processor_Obj));
    }
#endif
    Log_print0(Diags_EXIT, "[+X] Processor_delete> return");
}
Int main(Int argc, Char* argv[])
{
    Error_Block eb;
    Task_Params taskParams;


    Log_print3(Diags_ENTRY,
        "--> %s: (argc: %d, argv: 0x%x)", (IArg)FXNN, (IArg)argc, (IArg)argv);

    /* must initialize the error block before using it */
    Error_init(&eb);

    /* initialize ipc layer */
    Ipc_start();

    /* create main thread (interrupts not enabled in main on BIOS) */
    Task_Params_init(&taskParams);
    taskParams.instance->name = "AppMain_main__P";
    taskParams.arg0 = (UArg)argc;
    taskParams.arg1 = (UArg)argv;
    taskParams.stackSize = 0x4000;
    Task_create(AppMain_main__P, &taskParams, &eb);

    if (Error_check(&eb)) {
        System_abort("main() failed to create application startup thread");
    }

    /* start scheduler, this never returns */
    BIOS_start();
    
    /* should never get here */
    Log_print1(Diags_EXIT, "<-- %s: should never get here", (IArg)FXNN);
    return(0);
}
Exemplo n.º 18
0
/*
 *  ======== 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);
}
Void SystemCfg_notifyCB__P(UInt16 procId, UInt16 lineId, UInt32 eventNum,
        UArg arg, UInt32 payload)
{
    Error_Block eb;
    struct SystemCfg *stateObj = (struct SystemCfg *)arg;


    Log_print4(Diags_ENTRY,
        "--> %s: (prodId: %d, eventNum: %d, payload: 0x%x)",
        (IArg)FXNN, (IArg)procId, (IArg)eventNum, (IArg)payload);

    Error_init(&eb);

    switch (Global_EvtMask & payload) {

        case Global_EvtCreateDone:
        case Global_EvtReady:
        case Global_EvtCloseDone:
        case Global_EvtDone:

            SemThread_post(stateObj->semH, &eb);

            if (Error_check(&eb)) {
                /* Log_error() */
                Log_print3(
                    Diags_USER8,
                    "Error: %s, line %d: %s: SemThread_post() returned error",
                    (IArg)__FILE__, (IArg)__LINE__, (IArg)FXNN);
            }
            break;
    }

    Log_print1(Diags_EXIT, "<-- %s:", (IArg)FXNN);
}
Int SystemCfg_deleteResources(SystemCfg_Object *obj)
{
    Int status = 0;


    Log_print1(Diags_ENTRY | Diags_INFO, "--> "FXNN": (obj=0x%x)",(IArg)obj);

    /* unregister rcm message heap with MessageQ */
    MessageQ_unregisterHeap(SystemCfg_RcmMsgHeapId_CompDev);

    /* delete rcm message heap instance */
    HeapBufMP_delete(&obj->rcmHeapH);

    Log_print1(Diags_EXIT, "<-- "FXNN": %d", (IArg)status);
    return(status);
}
Exemplo n.º 21
0
Int RcmClient_execCmd(RcmClient_Object *obj, RcmClient_Message *msg)
{
    RcmClient_Packet *packet;
    MessageQ_Msg msgqMsg;
    Int rval;
    Int status = RcmClient_S_SUCCESS;


    Log_print2(Diags_ENTRY | Diags_INFO,
        "--> "FXNN": (obj=0x%x, msg=0x%x)", (IArg)obj, (IArg)msg);

    /* classify this message */
    packet = RcmClient_getPacketAddr_P(msg);
    packet->desc |= RcmClient_Desc_CMD << RcmClient_Desc_TYPE_SHIFT;

    /* set the return address to the error message queue */
    msgqMsg = (MessageQ_Msg)packet;
    MessageQ_setReplyQueue(obj->errorMsgQue, msgqMsg);

    /* send the message to the server */
    rval = MessageQ_put((MessageQ_QueueId)obj->serverMsgQ, msgqMsg);

    if (rval < 0) {
        Log_error0(FXNN": unable to send message to server");
        status = RcmClient_E_IPCERROR;
    }

    Log_print1(Diags_EXIT | Diags_INFO, "<-- "FXNN": %d", (IArg)status);
    return(status);
}
Exemplo n.º 22
0
Void smain (UArg arg0, UArg arg1)
{
    int status = 0;

    Log_print0(Diags_ENTRY | Diags_INFO, "--> smain:");

    /* turn on Diags_INFO trace */
    Diags_setMask("Server+F");

    status = NameServerApp_startup();
    if (status < 0) {
        goto leave;
    }

    status = NameServerApp_execute();
    if (status < 0) {
        goto leave;
    }

    status = NameServerApp_shutdown();
    if (status < 0) {
        goto leave;
    }

leave:
    Log_print1(Diags_EXIT, "<-- smain: %d", (IArg)status);
    return;
}
Exemplo n.º 23
0
/*
 *  ======== NODE_delete ========
 */
Int NODE_delete(NODE_Handle node)
{
    Void   *handle;

    /* Should be a DBC_requires */
    Assert_isTrue(node != NULL, (Assert_Id)NULL);
    Assert_isTrue(node->skelFxns != NULL, (Assert_Id)NULL);
    Assert_isTrue(node->skelFxns->apiDestroy != NULL, (Assert_Id)NULL);

    /* delete thread *before* destroying node to ensure thread has no access
     * to node as we are freeing it
     */
    if (node->self) {
        Log_print1(Diags_ENTRY, "[+E] NODE_delete(0x%x)", (IArg)node);

        Thread_delete(&(node->self));
    }

    handle = NODE_getEnv(node);

    if (handle) {
        node->skelFxns->apiDestroy(handle);
    }

    if (node->recv != Comm_INVALIDHANDLE) {
        Comm_delete(node->recv);
    }

    Memory_free(NULL, node, sizeof(NODE_Obj));

    return (NODE_EOK);
}
Exemplo n.º 24
0
Void Dsp_AppTask (UArg arg1, UArg arg2)
{
  OMX_ERRORTYPE eError = OMX_ErrorNone;
  //TIMM_OSAL_ERRORTYPE osalError = TIMM_OSAL_ERR_NONE;

  /*--------------------------------------------------------------------------*/
  /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  /* Initiailize the system. The initialization can include driver, syslink */
  /* cache.  */
  /*--------------------------------------------------------------------------*/
  Log_print0 (Diags_USER1,"DSP: In Dsp_AppTask");
  platform_init ();
  Log_print0 (Diags_USER1,"DSP: Platform Initialized");

  while (TRUE)
  {
    Task_sleep (DSP_APP_TASK_SLEEP_DURATION);
  }

  /*--------------------------------------------------------------------------*/
  /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  /* UnInitiailize the system.  */
  /*--------------------------------------------------------------------------*/
  platform_deinit ();
  Log_print0 (Diags_USER1,"DSP: Platform De-Initialized");

  Log_print0 (Diags_USER1,"DSP: Exiting the system");
  System_exit (0);

//EXIT:
  if (eError != OMX_ErrorNone)
  {
    Log_print1 (Diags_USER1,"Error in executing app. Failed code:%d", eError);
  }
}                               /* Dsp_AppTask */
Exemplo n.º 25
0
/* ARGSUSED */
int main(Int argc, Char * argv[])
{
    IRES_Status status;
    Int         size = 0;

    FCSettings_init();
    Diags_setMask(FCSETTINGS_MODNAME"+EX1234567");
    Diags_setMask("xdc.runtime.Main+EX1234567");
    Diags_setMask("ti.sdo.fc.%+EX1234567");

    Log_print0(Diags_ENTRY, "[+E] _main> Enter");

    status = RMAN_init();
    if (IRES_OK != status) {
        Log_print1(Diags_USER7, "[+7] main> RMAN_init() failed [%d]",
                   (IArg)status);
        System_abort("RMAN_init() failed, aborting...\n");
    }

    Log_print0(Diags_EXIT, "[+X] main> Exit");

    BIOS_start();

    return(0);
}
Exemplo n.º 26
0
/**
 * @name domxtmgr_map_component_name2info
 * @brief Map component name to DOMX Component COre Info Entry
 * @param  component_name  : OMX Component name
 * @param  info            : Info entry to be populated
 * @param  eb              : Used to raise error 
 * @return none
 */
static Void domxtmgr_map_component_name2info (String component_name,
                                              DomxCore_componentCoreInfoEntry
                                                **info,
                                              Error_Block *eb)
{
  Int i;

  Log_print4 (Diags_ENTRY, "Entered: %s (0x%x, 0x%x, 0x%x)",
              (xdc_IArg) __FUNCTION__, (xdc_IArg) component_name,
              (xdc_IArg) info, (xdc_IArg) eb);

  *info = NULL;
  for (i = 0; i < DomxCore_componentCoreInfoTbl.length; i++)
  {
    if (strcmp ((DomxCore_componentCoreInfoTbl.elem[i][0]).name,
                component_name) == 0)
    {
      *info = &(DomxCore_componentCoreInfoTbl.elem[i][0]);
      break;
    }
  }
  DOMX_UTL_TRACE_FUNCTION_ASSERT ((i < DomxCore_componentCoreInfoTbl.length), 
                                  "Component not found in core info table");

  Log_print1 (Diags_EXIT, "Leaving: %s RetVal: void", (xdc_IArg) __FUNCTION__);

}
Exemplo n.º 27
0
/*
 *  ======== taskLoad ========
 */
Void task(UArg arg1, UArg arg2)
{   
    UInt count = 1;
    Int status = Ipc_S_SUCCESS;
    UInt16 remoteProcId = MultiProc_getId("HOST");
    
    do {
        status = Ipc_attach(remoteProcId);
    } while (status < 0);
    
    Notify_registerEvent(remoteProcId, 0, SHUTDOWN,
                         (Notify_FnNotifyCbck)notifyCallbackFxn, 0);

    
    while (shutdownFlag == FALSE) {        
        Semaphore_pend(sem, BIOS_WAIT_FOREVER);
        
        /* Benchmark how long it takes to flip all the bits */
        Log_write1(UIABenchmark_start, (xdc_IArg)"Reverse");
        reverseBits(buffer, sizeof(buffer));
        Log_write1(UIABenchmark_stop, (xdc_IArg)"Reverse");
        
        Log_print1(Diags_USER1, "count = %d", count++);        
    }
    
    /* Start shutdown process */
    Notify_unregisterEvent(remoteProcId, 0, SHUTDOWN,
                           (Notify_FnNotifyCbck)notifyCallbackFxn, 0);
    
    do {
        status = Ipc_detach(remoteProcId);
    } while (status < 0);

    Ipc_stop();
}
Exemplo n.º 28
0
/*
 *  ======== UARTUtils_systemInit ========
 */
Void UARTUtils_systemInit(Int index)
{
    systemHandle = openHandle(index, FALSE);
    if (systemHandle == NULL) {
        Log_print1(Diags_USER1, "Failed to open UART %d", index);
    }
}
Exemplo n.º 29
0
/*
 *  ======== Algorithm_removeGroup ========
 */
Void Algorithm_removeGroup(Int groupId)
{
    Log_print1(Diags_ENTRY, "[+E] Algorithm_removeGroup> Enter(groupId=%d)",
            (IArg)groupId);

    Log_print0(Diags_EXIT, "[+X] Algorithm_removeGroup> Exit");
}
/*
 *  ======== USBMSCHFatFsTiva_diskInitialize ========
 *  This function checks the USB Drive to see if it's ready to be accessed.
 *
 *  This function attempts to read the USBHMSCDriveReady() function up to 10
 *  times to get a good return code. For some reason the first attempt to read
 *  this function doesn't return a good response value. Generally, you should
 *  get a good response on the second attempt.
 *  A gateMutex lock is required to prevent concurrent access to the USB
 *  Library's state machine variables within MSCInstance.
 *
 *  @param  drv Drive Number
 *
 *  @return Returns the disk status to the FatFs module
 */
DSTATUS USBMSCHFatFsTiva_diskInitialize(BYTE drv)
{
    unsigned char               i;
    unsigned int                key;
    uint32_t                    driveReady;
    USBMSCHFatFsTiva_Object    *object = USBMSCHFatFs_config->object;

    /* Determine if the USB Drive is ready up to 10 times */
    for (i = 0; i < 10; i++ ) {

        key = GateMutex_enter(GateMutex_handle(&(object->gateUSBLibAccess)));
        driveReady = USBHMSCDriveReady(object->MSCInstance);
        GateMutex_leave(GateMutex_handle(&(object->gateUSBLibAccess)), key);

        if (driveReady == 0) {
            Log_print1(Diags_USER1, "USBMSCHFatFs: disk initialization: "
                                    "ready after %d tries", i);

            return (0x00); /* Disk OK */
        }
    }

    Log_print0(Diags_USER1, "USBMSCHFatFs: disk initialization: not ready");
    return (STA_NOINIT);
}