Example #1
0
/*
 *  ======== DSKT2_deactivateAll ========
 */
Int DSKT2_deactivateAll()
{
#ifndef DSKT2_DISABLELAZYD
    IALG_Handle alg;
    Int         i;
#endif
    Int         nActive = 0;

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

#ifndef DSKT2_DISABLELAZYD

    if (_DSKT2_lastActiveAlg == NULL) {
        /*
         *  Memory not yet allocated for _DSKT2_lastActiveAlg ( _DSKT2_init not
         *  yet called), so return "0" active algorithms
         */
        return (nActive);
    }

    /*
     *  Deactivate all algs that have been lazily deactivated.
     */
    for (i = 0; i < DSKT2_NUM_SCRATCH_GROUPS; i++) {

        if ((alg = _DSKT2_lastActiveAlg[i]) != NULL) {
            if (alg->fxns->algDeactivate != NULL) {

                Log_print2(Diags_USER4,
                        "[+4] DSKT2_deactivateAll> Real deactivate of algorithm "
                        "0x%x in scratch group %d", (IArg)alg, (IArg)i);

                alg->fxns->algDeactivate(alg);
            }
            _DSKT2_lastActiveAlg[i] = NULL;
        }

        if (_DSKT2_activeAlg[i] != NULL) {

            Log_print2(Diags_USER2, "[+2] DSKT2_deactivateAll>"
                    " Algorithm 0x%x in scratch group %d still active",
                    (IArg)alg, (IArg)i);

            nActive++;
        }
    }
#endif

    Log_print1(Diags_EXIT, "[+X] DSKT2_deactivateAll Exit (numActive=%d)",
            (IArg)(nActive + _DSKT2_NumYielded));

    return (nActive + _DSKT2_NumYielded);
}
Example #2
0
Int RcmClient_removeSymbol(RcmClient_Object *obj, String name)
{
//  Int status = RcmClient_S_SUCCESS;
    Int status = RcmClient_E_FAIL;


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

    /* TODO */

    Log_print2(Diags_EXIT, "<-- %s: %d", (IArg)FXNN, (IArg)status);
    return(status);
}
Example #3
0
Int RcmClient_alloc(RcmClient_Object *obj, UInt32 dataSize,
    RcmClient_Message **message)
{
    SizeT totalSize;
    RcmClient_Packet *packet;
    Int status = RcmClient_S_SUCCESS;


    Log_print3(Diags_ENTRY,
        "--> RcmClient_alloc: obj: 0x%x, dataSize: %d, message: 0x%x",
        (IArg)obj, (IArg)dataSize, (IArg)message);

    /* ensure minimum size of UInt32[1] */
    dataSize  = (dataSize < sizeof(UInt32) ? sizeof(UInt32) : dataSize);

    /* total memory size (in chars) needed for headers and payload */
    totalSize = sizeof(RcmClient_Packet) - sizeof(UInt32) + dataSize;

    /* allocate the message */
    packet = (RcmClient_Packet*)MessageQ_alloc(obj->heapId, totalSize);

    if (NULL == packet) {
        Log_error1(FXNN": could not allocate message, size = %u",
            (IArg)totalSize);
        status = RcmClient_E_MSGALLOCFAILED;
        goto leave;
    }

    /* Log_info() */
    Log_print2(Diags_INFO,
        FXNN": RcmMessage allocated: addr=0x%x, size=%u (total size)",
        (IArg)packet, (IArg)totalSize);

    /* initialize the packet structure */
    packet->desc = 0;
    packet->msgId = RcmClient_genMsgId_P(obj);
    packet->message.poolId = RcmClient_DEFAULTPOOLID;
    packet->message.jobId = RcmClient_DISCRETEJOBID;
    packet->message.fxnIdx = RcmClient_INVALIDFXNIDX;
    packet->message.result = 0;
    packet->message.dataSize = dataSize;

    /* set message pointer to start of the message struct */
    *message = (RcmClient_Message *)(&(packet->message));


leave:
    Log_print2(Diags_EXIT, "<-- %s: %d", (IArg)FXNN, (IArg)status);
    return(status);
}
Example #4
0
/*
 *  ======== VIDDEC2_processAsync ========
 */
XDAS_Int32 VIDDEC2FRONT_processAsync(VIDDEC2_Handle handle,
        VIDDEC2_InArgs *inArgs, XDM_Context *context,
        VIDDEC2FRONT_OutArgs *outArgs)
{
    XDAS_Int32 retVal = VIDDEC2_EFAIL;

    /*
     * Note, we do this because someday we may allow dynamically changing
     * the global 'VISA_isChecked()' value on the fly.  If we allow that,
     * we need to ensure the value stays consistent in the context of this call.
     */
    Bool checked = VISA_isChecked();

    Log_print4(Diags_ENTRY, "[+E] VIDDEC2_processAsync> "
            "Enter (handle=0x%x, inArgs=0x%x, context=0x%x, outArgs=0x%x)",
            (IArg)handle, (IArg)inArgs, (IArg)context, (IArg)outArgs);

    if (handle) {
        IVIDDEC2FRONT_Handle alg = VISA_getAlgHandle((VISA_Handle)handle);

        if (alg != NULL) {
            if (checked) {
                /* validate inArgs with ranges. */
                if (inArgs->inputID == 0) {

                    Log_print2(Diags_USER7,
                            "[+7] ERROR> app provided codec (0x%x) with out of range "
                            "inArgs->inputID field (0x%x)",
                            (IArg)alg, (IArg)(inArgs->inputID));
                }
#if 0
                /*
                 * Validate inBufs and outBufs.
                 */
                XdmUtils_validateSparseBufDesc1(inBufs, "inBufs");
                XdmUtils_validateSparseBufDesc(outBufs, "outBufs");
#endif
            }

            retVal = processAsync(alg, inArgs, context, outArgs);
        }
    }

    Log_print2(Diags_EXIT, "[+X] VIDDEC2FRONT_processAsync> "
            "Exit (handle=0x%x, retVal=0x%x)", (IArg)handle, (IArg)retVal);

    return (retVal);
}
Example #5
0
Int RcmClient_waitUntilDone(RcmClient_Object *obj,
    UInt16 msgId, RcmClient_Message **returnMsg)
{
    RcmClient_Message *rtnMsg;
    Int rval;
    Int status = RcmClient_S_SUCCESS;


    Log_print4(Diags_ENTRY, "--> %s: (obj=0x%x, msgId=%d, msg=0x%x)",
        (IArg)FXNN, (IArg)obj, (IArg)msgId, (IArg)returnMsg);

    /* get the return message from the server */
    rval = RcmClient_getReturnMsg_P(obj, msgId, &rtnMsg);

    if (rval < 0) {
        *returnMsg = NULL;
        status = rval;
        goto leave;
    }
    *returnMsg = rtnMsg;

leave:
    Log_print2(Diags_EXIT, "<-- %s: %d", (IArg)FXNN, (IArg)status);
    return(status);
}
Example #6
0
/*
 *  ======== Memory_redefine ========
 */
Bool ti_sdo_ce_osal_Memory_redefine(Int segId, Uint32 base, Uint32 size)
{
    HeapMem_Params params;
    HeapMem_Handle heap;
    Memory_Stat    stat;

    if ((segId < 0) || (segId >= Memory_numHeaps)) {
        Log_print2(Diags_USER7, "Memory_redefine> segId (%d) out of range. "
                "Should be < %d", (IArg)segId,
                (IArg)Memory_numHeaps);
        return (FALSE);
    }

    if (!Memory_segStat(segId, &stat)) {
        Log_print0(Diags_USER7, "Memory_redefine> Memory_segStat() failed!");
        return (FALSE);
    }

    if (stat.used > 0) {
        Log_print0(Diags_USER7, "Memory_redefine> Heap in use!");
        return (FALSE);
    }

    heap = ti_sdo_ce_osal_Memory_heapList[segId];

    HeapMem_destruct(HeapMem_struct(heap));

    HeapMem_Params_init(&params);
    params.size = size;
    params.buf = (Ptr)base;

    HeapMem_construct(HeapMem_struct(heap), &params);

    return (TRUE);
}
Example #7
0
/*
 *  ======== Loader_getSymbol ========
 */
UInt32 Loader_getSymbol(Loader_Handle lib, String name)
{
    Void     *sym = NULL;
    String    errString = NULL;

    Log_print2(Diags_ENTRY, "[+E] Loader_getSymbol(0x%lx, %s)",
               (IArg)lib, (IArg)name);

    sym = dlsym(lib->handle, name);

    if (sym == NULL) {
        Log_print1(Diags_USER6, "[+6] Loader_getSymbol(): %s failed",
                   (IArg)name);

        errString = (String)dlerror();

        if (errString != NULL) {
            Log_print1(Diags_USER7, "[+7] Loader_getSymbol> dlsym() error: %s",
                       (IArg)errString);
        }
    }

    Log_print1(Diags_EXIT, "[+X] Loader_getSymbol> Returning 0x%x", (IArg)sym);

    return ((UInt32)sym);
}
/*
 *  ======== WatchdogCC26XX_setReload ========
 */
void WatchdogCC26XX_setReload(Watchdog_Handle handle, uint32_t value)
{
    WatchdogCC26XX_Object        *object;

    /* get the pointer to the object and hwAttrs */
    object = handle->object;

    /* udpate the watchdog object with the new reload value */
    object->reloadValue = value;

    /* unlock the Watchdog configuration registers */
    WatchdogUnlock();

    /* make sure the Watchdog is unlocked before continuing */
    while(WatchdogLockState() == WATCHDOG_LOCK_LOCKED)
    { }

    /* update the reload value */
    WatchdogReloadSet(object->reloadValue);

    /* lock register access */
    WatchdogLock();

    Log_print2(Diags_USER1, "Watchdog: WDT with handle 0x%x has been set to "
               "reload to 0x%x", (UArg)handle, value);
}
Example #9
0
/*!
 *  ======== InterruptM3_intSend ========
 *  Send interrupt to the remote processor
 */
Void InterruptM3_intSend(UInt16 remoteProcId, UArg arg)
{
    Log_print2(Diags_USER1,
        "InterruptM3_intSend: Sending interrupt with payload 0x%x to proc #%d",
        (IArg)arg, (IArg)remoteProcId);
    if (remoteProcId == sysm3ProcId) {
        while(REG32(MAILBOX_FIFOSTATUS(SYSM3_MBX)));
        REG32(MAILBOX_MESSAGE(SYSM3_MBX)) = arg;
    }
    else if (remoteProcId == appm3ProcId) {
        while(REG32(MAILBOX_FIFOSTATUS(APPM3_MBX)));
        /* Write to the mailbox, but this won't trigger an interrupt */
        REG32(MAILBOX_MESSAGE(APPM3_MBX)) = arg;
        /* Actually trigger the interrupt */
        REG16(INTERRUPT_CORE_1) |= 0x1;
    }
    else if (remoteProcId == dspProcId) {
        while(REG32(MAILBOX_FIFOSTATUS(DSP_MBX)));
        REG32(MAILBOX_MESSAGE(DSP_MBX)) = arg;
    }
    else if (remoteProcId == hostProcId) {
        while(REG32(MAILBOX_FIFOSTATUS(HOST_MBX)));
        REG32(MAILBOX_MESSAGE(HOST_MBX)) = arg;
    }
    else {
        /* Should never get here */
        Assert_isTrue(FALSE, NULL);
    }
}
/*
 *  ======== 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);
}
Example #11
0
/*
 *  ======== VIDENCCOPY_TI_dmaGetChannels ========
 *  Declare DMA resource requirement/holdings.
 */
Uns VIDENCCOPY_TI_dmaGetChannels(IALG_Handle handle, IDMA3_ChannelRec dmaTab[])
{
    VIDENCCOPY_TI_Obj *videncObj = (Void *)handle;
    int i;

    Log_print2(Diags_ENTRY, "[+E] VIDENCCOPY_TI_dmaGetChannels(0x%x, 0x%x)",
            (IArg)handle, (IArg)dmaTab);

    /* Initial values on logical channels */
    dmaTab[0].handle = videncObj->dmaHandle1D1D8B;

    dmaTab[0].numTransfers = 1;
    dmaTab[0].numWaits = 1;

    /*
     * Request logical DMA channels for use with ACPY3
     * AND with environment size obtained from ACPY3 implementation
     * AND with low priority.
     */
    for (i = 0; i < NUM_LOGICAL_CH; i++) {
        dmaTab[i].priority = IDMA3_PRIORITY_LOW;
        dmaTab[i].persistent = FALSE;
        dmaTab[i].protocol = &ACPY3_PROTOCOL;
    }

    return (NUM_LOGICAL_CH);
}
Example #12
0
Int RcmClient_construct(RcmClient_Struct *structPtr, String server,
    const RcmClient_Params *params)
{
    RcmClient_Object *obj = (RcmClient_Object*)structPtr;
    Int status = RcmClient_S_SUCCESS;


    Log_print1(Diags_ENTRY, "--> %s: ()", (IArg)FXNN);

    /* TODO: add check that params was initialized correctly */

    Log_print1(Diags_LIFECYCLE, FXNN": instance construct: 0x%x", (IArg)obj);

    /* ensure the constructed object is zeroed */
    _memset((Void *)obj, 0, sizeof(RcmClient_Object));

    /* object-specific initialization */
    status = RcmClient_Instance_init(obj, server, params);

    if (status < 0) {
        RcmClient_Instance_finalize(obj);
        goto leave;
    }


leave:
    Log_print2(Diags_EXIT, "<-- %s: %d", (IArg)FXNN, (IArg)status);
    return(status);
}
Example #13
0
/* ARGSUSED - this line tells the compiler not to warn about unused args. */
IRES_Status IRES_HDVICP2_getMemRecs(IRES_Handle handle,
        IRES_ProtocolArgs * resProtocolArgs, IALG_MemRec *memRecs)
{
    Assert_isTrue(memRecs != NULL, (Assert_Id)NULL);
    Assert_isTrue(resProtocolArgs != NULL, (Assert_Id)NULL);

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

    memRecs[0].alignment = 4;
    memRecs[0].size = sizeof(IRES_HDVICP2_IntObj);

    /*
     * IALG_EXTERNAL because we don't care where this memory is allocated
     */
    memRecs[0].space = IALG_EXTERNAL;

    /*
     * Memory should be persistent.
     */
    memRecs[0].attrs = IALG_PERSIST;

    Log_print2(Diags_USER4,
            "[+4] IRES_HDVICP2_getMemRecs> Amount of memory requested 0x%x, "
            "alignment 0x%x, space IALG_EXTERNAL attrs IALG_PERSIST",
            (IArg)(memRecs[0].size), (IArg)(memRecs[0].alignment));

    Log_print0(Diags_EXIT,
            "[+X] IRES_HDVICP2_getMemRecs> Exit (status=IRES_EOK)");

    return (IRES_OK); /* number of MemRecs */
}
/*
 *  ======== Memory_free ========
 */
Bool Memory_free(Ptr addr, UInt size, Memory_AllocParams *params)
{
    Log_print2(Diags_ENTRY, "[+E] Memory_free(0x%lx, 0x%lx)",
            (IArg)addr, (IArg)size);

    return (Memory_segFree(DEFAULTSEGMENT, addr, size));
}
/*
 *  ======== 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);
}
/*
 *  ======== Memory_contigAlloc ========
 */
Ptr Memory_contigAlloc(UInt size, UInt align)
{
    Log_print2(Diags_ENTRY, "[+E] Memory_contigAlloc(0x%lx, 0x%lx)",
            (IArg)size, (IArg)align);

    return (Memory_segAlloc(DEFAULTSEGMENT, size, align));
}
/*
 *  ======== Memory_contigFree ========
 */
Bool Memory_contigFree(Ptr addr, UInt size)
{
    Log_print2(Diags_ENTRY, "[+E] Memory_contigFree(0x%lx, 0x%lx)",
            (IArg)addr, (IArg)size);

    return (Memory_segFree(DEFAULTSEGMENT, addr, size));
}
/*
 *  ======== USBMSCHFatFsTiva_diskWrite ========
 *  This function writes sector(s) to the disk drive
 *
 *  @param  drv     Drive Number
 *
 *  @param  buf     Pointer to a buffer from which data is read
 *
 *  @param  sector  Sector number to write to
 *
 *  @param  count   Number of sectors to be written
 */
DRESULT USBMSCHFatFsTiva_diskWrite(BYTE drv, const BYTE *buf,
                                   DWORD sector, BYTE count)
{
    unsigned int                key;
    uint32_t                    driveWrite;
    USBMSCHFatFsTiva_Object    *object = USBMSCHFatFs_config->object;

    Log_print2(Diags_USER1, "USBMSCHFatFs: diskWrite: Sector %d, Count %d",
                             sector, count);

    if (!count) {
        Log_print0(Diags_USER1, "USBMSCHFatFs: diskWrite: ERROR");
        return (RES_PARERR);
    }

    if (object->state != USBMSCHFatFsTiva_CONNECTED) {
        Log_print0(Diags_USER1, "USBMSCHFatFs: diskWrite: not initialized");
        return (RES_NOTRDY);
    }

    key = GateMutex_enter(GateMutex_handle(&(object->gateUSBLibAccess)));
    driveWrite = USBHMSCBlockWrite(object->MSCInstance, sector, (uint8_t *)buf, count);
    GateMutex_leave(GateMutex_handle(&(object->gateUSBLibAccess)), key);

    if (driveWrite == 0) {
        Log_print0(Diags_USER2, "USBMSCHFatFs: diskWrite: OK");
        return (RES_OK);
    }
    else {
        Log_print0(Diags_USER2, "USBMSCHFatFs: diskWrite: ERROR");
        return (RES_ERROR);
    }
}
/*
 *  ======== VIDDEC2_processAsync ========
 */
XDAS_Int32 VIDDEC2BACK_processAsync(VIDDEC2FRONT_Handle handle,
        XDM_Context *context, VIDDEC2_OutArgs *outArgs)
{
    XDAS_Int32 retVal = VIDDEC2_EFAIL;

    /*
     * Note, we do this because someday we may allow dynamically changing
     * the global 'VISA_isChecked()' value on the fly.  If we allow that,
     * we need to ensure the value stays consistent in the context of this call.
     */
    Bool checked = VISA_isChecked();

    Log_print4(Diags_ENTRY, "[+E] VIDDEC2BACK_processAsync> "
            "Enter (handle=0x%x, context=0x%x outArgs=0x%x (size=0x%x))",
            (IArg)handle, (IArg)context, (IArg)outArgs,
            (IArg)(outArgs->size));

    if (handle) {
        IVIDDEC2BACK_Handle alg = VISA_getAlgHandle((VISA_Handle)handle);

        if (alg != NULL) {
            if (checked) {
                /* validate context */
            }

            retVal = processAsync(alg, context, outArgs);
        }
    }

    Log_print2(Diags_EXIT, "[+X] VIDDEC2BACK_processAsync> "
            "Exit (handle=0x%x, retVal=0x%x)", (IArg)handle, (IArg)retVal);

    return (retVal);
}
/*
 *  ======== USBMSCHFatFsTiva_diskRead ========
 *  This function reads sector(s) from the disk drive
 *
 *  @param  drv     Drive Number
 *
 *  @param  buf     Pointer to a buffer to which data is written
 *
 *  @param  sector  Sector number to read from
 *
 *  @param  count   Number of sectors to be read
 */
DRESULT USBMSCHFatFsTiva_diskRead(BYTE drv, BYTE *buf,
                                  DWORD sector, BYTE count)
{
    unsigned int                key;
    uint32_t                    driveRead;
    USBMSCHFatFsTiva_Object    *object = USBMSCHFatFs_config->object;

    Log_print2(Diags_USER1, "USBMSCHFatFs: diskRead: Sector %d, Count %d",
                             sector, count);

    if (object->state != USBMSCHFatFsTiva_CONNECTED) {
        Log_print0(Diags_USER1, "USBMSCHFatFs: diskRead: not initialized");
        return (RES_NOTRDY);
    }

    /* READ BLOCK */
    key = GateMutex_enter(GateMutex_handle(&(object->gateUSBLibAccess)));
    driveRead = USBHMSCBlockRead(object->MSCInstance, sector, buf, count);
    GateMutex_leave(GateMutex_handle(&(object->gateUSBLibAccess)), key);

    if (driveRead == 0) {
        Log_print0(Diags_USER2, "USBMSCHFatFs: diskRead: OK");
        return (RES_OK);
    }
    else {
        Log_print0(Diags_USER2, "USBMSCHFatFs: diskRead: ERROR");
        return (RES_ERROR);
    }
}
Example #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);
}
Example #22
0
/*
 *  ======== Comm_create ========
 */
Comm_Handle Comm_create(String queueName, Comm_Attrs *attrs)
{
    Comm_Obj   *comm;
    UInt32      commId;
    Char        commName[ MAXCOMMNAMELEN ];
    key_t       key;

    Assert_isTrue(curInit > 0, (Assert_Id)NULL);

    Log_print2(Diags_ENTRY, "[+E] Comm_create> "
            "Enter(queueName='%s', attrs=0x%x)", (IArg)queueName, (IArg)attrs);

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

    if (queueName == NULL) {
        /* Generate a name to use */
        // TODO: Increment curCommId atomically
        commId = curCommId++;
        sprintf(commName, "queue_%lu_%u", Global_getProcessId(), (Uns)commId);
        key = nameToId(commName);
    }
    else {
        key = nameToId(queueName);
    }

    comm = (Comm_Obj *)Memory_alloc(NULL, sizeof(Comm_Obj), 0, NULL);
    if (comm == NULL) {
        return (NULL);
    }

    comm->type = attrs->type;

    if (comm->type == Comm_PEND) {
        ;
    }
    else if (comm->type == Comm_CALL) {
        comm->callHandle = attrs->callHandle;
        comm->callFxn    = attrs->callFxn;
    }
    else {
        Assert_isTrue(FALSE, (Assert_Id)NULL);  /* unknown Comm type */
    }

    /*
     * Create a new message queue id for the "name" key
     */
    if ((comm->id = msgget(key, IPC_CREAT | 0644)) < 0) {
        fprintf(stderr, "msgget key = 0x%x\n", key);
        perror("Comm_create:msgget");
        Memory_free(NULL, comm, sizeof(Comm_Obj));
        return (NULL);
    }

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

    return (comm);
}
Example #23
0
/*
 *  ======== Memory_getBufferVirtualAddress ========
 *  TODO:H - for multicore devices, we probably need to implement a GLOB_TO_LOC!
 */
Ptr Memory_getBufferVirtualAddress(
        UInt32 physicalAddress, Int sizeInBytes)
{
    Log_print2(Diags_ENTRY, "[+E] Memory_getBufferVirtualAddress(0x%x, 0x%x)",
            (IArg)physicalAddress, (IArg)sizeInBytes);

    return ((Ptr)physicalAddress);
}
/*
 *  ======== UNIVERSAL_processAsync ========
 */
XDAS_Int32 UNIVERSAL_processAsync(UNIVERSAL_Handle handle,
        XDM1_BufDesc *inBufs, XDM1_BufDesc *outBufs, XDM1_BufDesc *inOutBufs,
        IUNIVERSAL_InArgs *inArgs, IUNIVERSAL_OutArgs *outArgs)
{
    XDAS_Int32 retVal = UNIVERSAL_EFAIL;

    /*
     * Note, we assign "VISA_isChecked()" results to a local variable
     * rather than repeatedly query it throughout this fxn because
     * someday we may allow dynamically changing the global
     * 'VISA_isChecked()' value on the fly.  If we allow that, we need
     * to ensure the value stays consistent in the context of this
     * call.
     */
    Bool checked = VISA_isChecked();

    Log_print5(Diags_ENTRY, "[+E] UNIVERSAL_processAsync> "
            "Enter (handle=0x%x, inBufs=0x%x, outBufs=0x%x, inArgs=0x%x, "
            "outArgs=0x%x)",
            (IArg)handle, (IArg)inBufs, (IArg)outBufs, (IArg)inArgs,
            (IArg)outArgs);

    if (handle) {
        IUNIVERSAL_Handle alg = VISA_getAlgHandle((VISA_Handle)handle);

        if (alg != NULL) {
            if (checked) {

                /* validate inArgs and outArgs */
                XdmUtils_validateExtendedStruct(inArgs, sizeof(inArgs),
                        "inArgs");
                XdmUtils_validateExtendedStruct(outArgs, sizeof(outArgs),
                        "outArgs");

                /* Validate inBufs and outBufs. */
                XdmUtils_validateSparseBufDesc1(inBufs, "inBufs");
                XdmUtils_validateSparseBufDesc1(outBufs, "outBufs");

                /*
                 * Zero out the outArgs struct (except for .size field);
                 * it's write-only to the codec, so the app shouldn't pass
                 * values through it, nor should the codec expect to
                 * receive values through it.
                 */
                memset((void *)((XDAS_Int32)(outArgs) + sizeof(outArgs->size)),
                        0, (sizeof(*outArgs) - sizeof(outArgs->size)));
            }

            retVal = processAsync(alg, inBufs, outBufs, inOutBufs, inArgs,
                    outArgs);
        }
    }

    Log_print2(Diags_EXIT, "[+X] UNIVERSAL_processAsync> "
            "Exit (handle=0x%x, retVal=0x%x)", (IArg)handle, (IArg)retVal);

    return (retVal);
}
Int SystemCfg_closeSharedResources(SystemCfg_AppFxn appShutdownFxn, Ptr arg)
{
    Error_Block eb;
    Int status = 0;
    struct SystemCfg *stateObj = &SystemCfg_State;


    Log_print1(Diags_ENTRY, "--> %s: ()", (IArg)FXNN);

    Error_init(&eb);

    /* invoke the application shutdown function */
    if (appShutdownFxn != NULL) {
        status = appShutdownFxn(arg);

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

    /* close shared resources from remote core */

    /* <add code here> */

    /* send close done event to remote core */
    Log_print0(Diags_USER1, FXNN": send EvtCloseDone to remote core");

    status = Notify_sendEvent(stateObj->hostProcId, Global_NotifyLineId,
        Global_HostDspEvtNum, Global_EvtCloseDone, TRUE);

    if (status < 0) {
        /* Log_error() */
        Log_print4(Diags_USER8,
            "Error: %s, line %d: %s: Notify_sendEvent() returned error %d",
            (IArg)__FILE__, (IArg)__LINE__, (IArg)FXNN, (IArg)status);
        goto leave;
    }

    /* wait for close event from remote core */
    Log_print0(Diags_USER1, FXNN": waiting for EvtCloseDone event...");

    SemThread_pend(stateObj->semH, SemThread_FOREVER, &eb);

    if (Error_check(&eb)) {
        /* Log_error() */
        Log_print3(Diags_USER8,
            "Error: %s, line %d: %s:  SemThread_pend() returned with error",
            (IArg)__FILE__, (IArg)__LINE__, (IArg)FXNN);
        status = -1;
        goto leave;
    }
    Log_print0(Diags_USER1, FXNN": ...received EvtCloseDone event");


leave:
    Log_print2(Diags_EXIT, "<-- %s: %d", (IArg)FXNN, (IArg)status);
    return(status);
}
Example #26
0
/*
 *  ======== Memory_cacheWbInv ========
 */
Void Memory_cacheWbInv(Ptr addr, Int sizeInBytes)
{
    Log_print2(Diags_ENTRY, "[+E] Memory_cacheWbInv> "
            "Enter(addr=0x%x, sizeInBytes=%d)", (IArg)addr, (IArg)sizeInBytes);

    Cache_wbInv(addr, sizeInBytes, Cache_Type_ALL, TRUE);

    Log_print0(Diags_EXIT, "[+X] Memory_cacheWbInv> return");
}
Example #27
0
/*
 *  ======== Algorithm_releaseLock ========
 */
Void Algorithm_releaseLock(Int groupId, IALG_Handle alg)
{
    Log_print2(Diags_ENTRY, "[+E] Algorithm_releaseLock> Enter(alg=0x%x,"
            " groupId=%d)", (IArg)alg, (IArg)groupId);

    Log_print0(Diags_ENTRY, "[+E] Algorithm_releaseLock> Feature not "
            "supported on BIOS (yet).");

    Log_print0(Diags_EXIT, "[+X] Algorithm_releaseLock> Exit");
}
Example #28
0
/*
 *  ======== VIDENCCOPY_TI_dmaChangeChannels ========
 *  Update instance object with new logical channel.
 */
Void VIDENCCOPY_TI_dmaChangeChannels(IALG_Handle handle,
    IDMA3_ChannelRec dmaTab[])
{
    VIDENCCOPY_TI_Obj *videncObj = (Void *)handle;

    Log_print2(Diags_ENTRY, "[+E] VIDENCCOPY_TI_dmaChangeChannels(0x%x, 0x%x)",
            (IArg)handle, (IArg)dmaTab);

    videncObj->dmaHandle1D1D8B = dmaTab[0].handle;
}
/*
 *  ======== getVirtualAddress ========
 */
static UInt32 getVirtualAddress(UInt32 physicalAddress, UInt32 sizeInBytes)
{
    UInt32     virtualAddress = 0;
    ContigBuf *cb;

    Log_print2(Diags_USER1, "[+1] Memory__getVirtualAddress> "
            "Enter(physAddr=0x%x, size=0x%x)",
            (IArg)physicalAddress, (IArg)sizeInBytes);

    for (cb = contigBufList; cb != NULL; cb = cb->next) {

        UInt32 startCurrent   = cb->physicalAddress;
        UInt32 endCurrent     = startCurrent + cb->sizeInBytes;
        UInt32 startSubmitted = physicalAddress;
        UInt32 endSubmitted   = physicalAddress + sizeInBytes;

        /* check if the submitted contigbuf is a subset of the current
         * contigbuf.
         */
        if (startCurrent <= startSubmitted &&
            endCurrent   >= endSubmitted) {    /* case 1:  { [      ] } */
            Log_print4(Diags_USER1, "[+1] Memory__getVirtualAddress> "
                    "found in cb(Sc=0x%x, Ec=0x%x, Ss=0x%x, Es=0x%x)",
                    (IArg)startCurrent, (IArg)endCurrent, (IArg)startSubmitted,
                    (IArg)endSubmitted);
            virtualAddress = cb->virtualAddress + startSubmitted - startCurrent;
            break;                             /* result:    ^          */
        }
    }

    if (virtualAddress == 0) {
        Log_print2(Diags_USER7, "[+7] Memory_getVirtualAddress> "
            "ERROR: buffer (physAddr=0x%x, size=0x%x) not found in translation"
            "cache\n\nEnsure that you have registered this buffer with "
            "Memory_registerContigBuf()\n", (IArg)physicalAddress, (IArg)sizeInBytes);
    }

    Log_print1(Diags_USER1, "[+1] Memory__getVirtualAddress> "
            "returning virtAddr=0x%x", (IArg)virtualAddress);

    return (virtualAddress);
}
Example #30
0
/*
 *  ======== Memory_contigFree ========
 */
Bool Memory_contigFree(Ptr addr, UInt size)
{
    Log_print2(Diags_ENTRY, "[+E] Memory_contigFree> "
            "Enter(addr=0x%x, size=%d)", (IArg)addr, (IArg)size);

    segFree(xdc_runtime_Memory_defaultHeapInstance, addr, size);

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

    return (TRUE);
}