Exemple #1
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__);

}
/* ARGSUSED - this line tells the compiler not to warn about unused args. */
IRES_Status RMAN_deactivateResource(IALG_Handle alg,
        IRES_Handle resourceHandle, IRES_Fxns * resFxns, Int scratchGroupId)
{
    IRES_Status status;

    if (initStatus != IRES_OK) {
        Log_print0(Diags_USER7, "[+7] RMAN_deactivateResource>"
                " RMAN_init call hasn't happened successfully. Please "
                "initialize RMAN before calling any other RMAN API");

        Log_print0(Diags_EXIT, "[+X] RMAN_deactivateResource> "
                "Exit (status=IRES_ENOINIT)");
        return (IRES_ENOINIT);
    }

    Log_print4(Diags_ENTRY, "[+E] RMAN_deactivateResource> "
            "Enter (alg=0x%x, resourceHandle=0x%x, resFxns=0x%x, "
            "scratchGroupId=%d)",
            (IArg)alg, (IArg)resourceHandle, (IArg)resFxns,
            (IArg)scratchGroupId);

    status =  resFxns->deactivateResource(alg, resourceHandle);

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

    return (status);
}
Exemple #3
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);
}
/*
 *  ======== 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);
}
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_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);
}
Exemple #7
0
/*
 *  ======== VIDENCCOPY_TI_control ========
 */
XDAS_Int32 VIDENCCOPY_TI_control(IVIDENC_Handle handle, IVIDENC_Cmd id,
    IVIDENC_DynamicParams *params, IVIDENC_Status *status)
{
    XDAS_Int32 retVal;

    Log_print4(Diags_ENTRY, "[+E] VIDENCCOPY_TI_control(0x%x, 0x%x, 0x%x, "
            "0x%x)", (IArg)handle, (IArg)id, (IArg)params, (IArg)status);

    /* validate arguments - this codec only supports "base" xDM. */
    if ((params->size != sizeof(*params)) ||
        (status->size != sizeof(*status))) {

        Log_print2(Diags_ENTRY,
                "[+E] VIDENCCOPY_TI_control, unsupported size (0x%x, 0x%x)",
                (IArg)(params->size), (IArg)(status->size));

        return (IVIDENC_EFAIL);
    }

    switch (id) {
        case XDM_GETSTATUS:
        case XDM_GETBUFINFO:
            status->extendedError = 0;

            status->bufInfo.minNumInBufs = MININBUFS;
            status->bufInfo.minNumOutBufs = MINOUTBUFS;
            status->bufInfo.minInBufSize[0] = MININBUFSIZE;
            status->bufInfo.minOutBufSize[0] = MINOUTBUFSIZE;

            retVal = IVIDENC_EOK;

            break;

        case XDM_SETPARAMS:
        case XDM_SETDEFAULT:
        case XDM_RESET:
        case XDM_FLUSH:
            /* TODO - for now just return success. */

            retVal = IVIDENC_EOK;
            break;

        default:
            /* unsupported cmd */
            retVal = IVIDENC_EFAIL;

            break;
    }

    return (retVal);
}
Exemple #8
0
/*
 *  ======== VIDENCCOPY_TI_initObj ========
 */
Int VIDENCCOPY_TI_initObj(IALG_Handle handle,
    const IALG_MemRec memTab[], IALG_Handle p,
    const IALG_Params *algParams)
{
    Log_print4(Diags_ENTRY,
            "[+E] VIDENCCOPY_TI_initObj(0x%x, 0x%x, 0x%x, 0x%x)",
            (IArg)handle, (IArg)memTab, (IArg)p, (IArg)algParams);

	VIDENCCOPY_TI_Obj *VIDENC_COPY = (Void*)handle;
	VIDENC_COPY->p_data = memTab[1].base;
	VIDENC_COPY->p_ddr_data = memTab[2].base;
	VIDENC_COPY->p_DARAM0 = memTab[3].base;
    return (IALG_EOK);
}
Exemple #9
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);
}
Exemple #10
0
/*
 *  ======== VIDDEC2_processWait ========
 */
XDAS_Int32 VIDDEC2FRONT_processWait(VIDDEC2FRONT_Handle handle,
        VIDDEC2_InArgs *inArgs, XDM_Context *context,
        VIDDEC2FRONT_OutArgs *outArgs, UInt timeout)
{
    XDAS_Int32 retVal = VIDDEC2_EFAIL;
    VIDDEC2_InArgs refInArgs;

    /*
     * 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] VIDDEC2FRONT_processWait> "
            "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) {
                /*
                 * Make a reference copy of inArgs so we can check that
                 * the codec didn't modify them during process().
                 */
                refInArgs = *inArgs;
            }

            retVal = processWait(alg, inArgs, context, outArgs, timeout);

            if (checked) {
                /* ensure the codec didn't modify the read-only inArgs */
                if (memcmp(&refInArgs, inArgs, sizeof(*inArgs)) != 0) {
                    Log_print1(Diags_USER7,
                            "[+7] ERROR> codec (0x%x) modified read-only inArgs "
                            "struct!", (IArg)handle);
                }
            }
        }
    }

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

    return (retVal);
}
/*
 *  ======== 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);
}
Int SystemCfg_startAck(Void)
{
    Int count;
    Int status = 0;
    struct SystemCfg *stateObj = &SystemCfg_State;


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

    /* initialize the transport between DSP (local) <---> HOST (remote) */
    stateObj->hostProcId = MultiProc_getId("HOST");

    Log_print1(Diags_USER1,
        FXNN": Ipc_attach(hostProcId: %d)", (IArg)stateObj->hostProcId);

    /* connect to remote processor */
    count = 0;
    do {
        status = Ipc_attach(stateObj->hostProcId);
        /* TODO should delay on failure */
    } while ((++count < 500) && (status < 0));

    if (status < 0) {
        /* Log_error() */
        Log_print4(Diags_USER8,
            "Error: %s, line %d: %s:"
            "Ipc_attach() failed to connect after %d tries",
            (IArg)__FILE__, (IArg)__LINE__, (IArg)FXNN, (IArg)count);
        goto leave;
    }
    Log_print1(Diags_USER1,
        FXNN": Ipc_attach completed on try %d", (IArg)count);


leave:
    status = (status >= 0 ? 0 : status);
    Log_print2(Diags_EXIT, "<-- %s: %d", (IArg)FXNN, (IArg)status);
    return(status);
}
Exemple #13
0
Int RcmClient_execNoWait(RcmClient_Object *obj, RcmClient_Message *cmdMsg,
    UInt16 *msgId)
{
    RcmClient_Packet *packet;
    MessageQ_Msg msgqMsg;
    Int rval;
    Int status = RcmClient_S_SUCCESS;


    Log_print4(Diags_ENTRY,
        "--> %s: 0x%x, 0x%x, 0x%x",
        (IArg)FXNN, (IArg)obj, (IArg)cmdMsg, (IArg)msgId);

    /* classify this message */
    packet = RcmClient_getPacketAddr_P(cmdMsg);
    packet->desc |= RcmClient_Desc_RCM_MSG << RcmClient_Desc_TYPE_SHIFT;
    *msgId = packet->msgId;

    /* set the return address to this instance's message queue */
    msgqMsg = (MessageQ_Msg)packet;
    MessageQ_setReplyQueue(obj->msgQue, msgqMsg);

    /* send the message to the server */
    Log_print1(Diags_ANALYSIS, "%s: >>> MessageQ_put", (IArg)FXNN);
    rval = MessageQ_put((MessageQ_QueueId)obj->serverMsgQ, msgqMsg);
    Log_print1(Diags_ANALYSIS, "%s: <<< MessageQ_put", (IArg)FXNN);

    if (rval < 0) {
        *msgId = RcmClient_INVALIDMSGID;
        Log_error0(FXNN": unable to the send message to the server");
        status = RcmClient_E_EXECFAILED;
        goto leave;
    }

leave:
    Log_print2(Diags_EXIT, "<-- %s: %d", (IArg)FXNN, (IArg)status);
    return(status);
}
/*
 *  ======== DebugP_log4 ========
 */
void DebugP_log4(const char *format, uintptr_t p1, uintptr_t p2, uintptr_t p3, uintptr_t p4)
{
    Log_print4(Diags_USER1, format, (xdc_IArg)p1,
              (xdc_IArg)p2, (xdc_IArg)p3, (xdc_IArg)p4);
}
Void AppMain_main__P(UArg arg0, UArg arg1)
{
    Error_Block eb;
    Int status = 0;


    Log_print3(Diags_ENTRY,
        "--> %s: (arg0: 0x%x, arg1: 0x%x)", (IArg)FXNN, (IArg)arg0, (IArg)arg1);


    /* initialize used modules */
    SystemCfg_init();
    Error_init(&eb);

    /* start acknowledgement */
    status = SystemCfg_startAck();

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

    /* system and application configuration */
    status = SystemCfg_createLocalResources();

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

    /* open shared resources */
    status = SystemCfg_openSharedResources(App_startup, NULL);

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

    /* invoke the application entry point */
    status = App_exec(NULL);

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

    /* start the shutdown process */
    status = SystemCfg_closeSharedResources(App_shutdown, NULL);

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

    status = SystemCfg_deleteLocalResources();

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

    /* finalize used modules */
    SystemCfg_exit();


leave:
    Log_print2(Diags_EXIT, "<-- %s: %d", (IArg)FXNN, (IArg)status);
    return;
}
Exemple #16
0
/*
 *  ======== smain ========
 */
Int smain(String progName, String procId, String engineName,
          String inFile, String outFile)
{
    Engine_Handle ce = NULL;
    Engine_Attrs attrs;
    UNIVERSAL_Handle hUniversal = NULL;
    FILE *in = NULL;
    FILE *out = NULL;
    Memory_AllocParams allocParams;
    XDAS_Int8 *inBuf;
    XDAS_Int8 *outBuf;
    XDAS_Int8 *versionBuf;   /* acquire optional version from codecs */

    /* create the input file if it doesn't already exist */
    createInFileIfMissing(inFile);

    Log_print4(Diags_USER1, "[+1] App-> Application started, procId %s "
               "engineName %s input-file %s output-file %s.",
               (IArg)procId, (IArg)engineName, (IArg)inFile, (IArg)outFile);

    /*
     * Allocate buffers.
     * Note that the .flags field (cache) is ignored on BIOS-based systems.
     */
    allocParams.type = Memory_CONTIGPOOL;
    allocParams.flags = Memory_NONCACHED;
    allocParams.align = BUFALIGN;
    allocParams.seg = 0;

    inBuf = (XDAS_Int8 *)Memory_alloc(IFRAMESIZE, &allocParams);
    outBuf = (XDAS_Int8 *)Memory_alloc(OFRAMESIZE, &allocParams);
    versionBuf = (XDAS_Int8 *)Memory_alloc(MAXVERSIONSIZE, &allocParams);

    if ((inBuf == NULL) || (outBuf == NULL) || (versionBuf == NULL)) {
        goto end;
    }

    /* open file streams for input and output */
    if ((in = fopen(inFile, "rb")) == NULL) {
        printf("App-> ERROR: can't read file %s\n", inFile);
        goto end;
    }
    if ((out = fopen(outFile, "wb")) == NULL) {
        printf("App-> ERROR: can't write to file %s\n", outFile);
        goto end;
    }

    /* Initialize attrs fields to default values, and set the procId */
    Engine_initAttrs(&attrs);
    attrs.procId = procId;

    /* Open the Engine */
    if ((ce = Engine_open(engineName, &attrs, NULL)) == NULL) {
        printf("App-> ERROR: can't open engine %s\n", engineName);
        goto end;
    }

    /* allocate and initialize universal alg on the engine */
    hUniversal = UNIVERSAL_create(ce, universalName, NULL);
    if (hUniversal == NULL) {
        printf( "App-> ERROR: can't open codec %s\n", universalName);
        goto end;
    }

    /* use engine to encode, then decode the data */
    processLoop(hUniversal, in, out, inBuf, outBuf, versionBuf);

end:
    /* teardown the codec */
    if (hUniversal) {
        UNIVERSAL_delete(hUniversal);
    }

    /* close the engine */
    if (ce) {
        Engine_close(ce);
    }

    /* close the files */
    if (in) {
        fclose(in);
    }
    if (out) {
        fclose(out);
    }

    /* free buffers */
    if (inBuf) {
        Memory_free(inBuf, IFRAMESIZE, &allocParams);
    }
    if (outBuf) {
        Memory_free(outBuf, OFRAMESIZE, &allocParams);
    }
    if (versionBuf) {
        Memory_free(versionBuf, MAXVERSIONSIZE, &allocParams);
    }

    Log_print0(Diags_USER1, "[+1] app done.");
    return (0);
}
/*
 *  ======== RMAN_register ========
 *  Register the protocol/protocol revision and the device specific resource
 *  manager implementation with the Resource Registry of the RMAN
 */
IRES_Status RMAN_register(IRESMAN_Fxns * resmanFxns, IRESMAN_Params * initArgs)
{
    Int            index = -1;
    Int            i = 0;
    IRESMAN_Fxns * resman = NULL;
    String         protocolName = NULL;
    IRES_Status    status = IRES_OK;
    IArg           key;
    IRES_ProtocolRevision * revNo;

    if (initStatus != IRES_OK) {
        Log_print0(Diags_USER7, "[+7] RMAN_register> RMAN_init call "
                "hasn't happened successfully. Please initialize RMAN "
                "before registering resources");
        Log_print0(Diags_EXIT, "[+X] RMAN_register> Exit "
                "(status=IRES_ENOINIT)");
        return (IRES_ENOINIT);
    }

    Log_print2(Diags_ENTRY, "[+E] RMAN_register> Enter (resmanFxns=0x%x, "
            "initArgs=0x%x)", (IArg)resmanFxns, (IArg)initArgs);

    Assert_isTrue(resmanFxns != NULL, (Assert_Id)NULL);

    protocolName = resmanFxns->getProtocolName();

    Assert_isTrue(protocolName != NULL, (Assert_Id)NULL);

    revNo = resmanFxns->getProtocolRevision();

    Log_print4(Diags_USER4, "[+4] RMAN_register> Registering protocol %s "
            "revision (%d.%d.%d)",
            (IArg)protocolName, (IArg)(revNo->Major), (IArg)(revNo->Source),
            (IArg)(revNo->Radius));

    /*
     * Use the protocolName and revisionNo to log the Resman Implementation
     * in the ResourceRegistry table.
     */

    key = IGateProvider_enter(gate);

    /*
     * First check the entire table to see if there are any duplicates
     */
    for (i = 0; i < resTable.tableIndex; i++) {

        if ((resman = RMAN_TABLE[i]) &&
                !strcmp(protocolName, RMAN_TABLE[i]->getProtocolName()) &&
                checkResMgrAlgRevision(RMAN_TABLE[i]->getProtocolRevision(),
                revNo)) {

            /* Found a match */
            if (resmanFxns == RMAN_TABLE[i]) {
                /* Re-registering the same protocol, do nothing. */
                IGateProvider_leave(gate, key);

                Log_print0(Diags_EXIT, "[+X] RMAN_register> "
                        "Exit (status=IRES_EEXISTS)");

                return (IRES_EEXISTS);
            }

            /*
             * Re-registering a different protocol for an existing entry.
             * Replace current entry with new entry
             */
            index = i;

            if ((status = resman->exit()) != IRES_OK) {
                IGateProvider_leave(gate, key);

                Log_print2(Diags_USER7, "[+7] RMAN_register> Exit failed on"
                        "IRESMAN implementation 0x%x, status: %d",
                        (IArg)resman, (IArg)status);
                Log_print0(Diags_EXIT, "[+X] RMAN_register> Exit "
                        "(status=IRES_EFAIL)");

                return (IRES_EFAIL);
            }
            break;
        }
    }

    /* Registering a new protocol */
    if ((status = resmanFxns->init(initArgs)) != IRES_OK) {
        IGateProvider_leave(gate, key);

        Log_print2(Diags_USER7, "[+7] RMAN_register> Init failed on "
                "IRESMAN implementation 0x%x, status: %d",
                (IArg)resman, (IArg)status);
        Log_print0(Diags_EXIT, "[+X] RMAN_register> Exit "
                "(status=IRES_ENORESOURCE)");

        return (IRES_ENORESOURCE);
    }

    if (index == -1) {
        /* Not found in table. Check for available entry in freeIndex table */
        if (-1 != resTable.freeIndex) {
            index = RMAN_FREE_ENTRIES[resTable.freeIndex];
            resTable.freeIndex--;
        }
        else {
            /* No free entries available, use new one in the registry table */

            /* Should never exceed pre configured table size */
            Assert_isTrue(index < resTable.tableSize, (Assert_Id)NULL);

            index = resTable.tableIndex;
            resTable.tableIndex++;
        }
    }

    /* Add the actual entry to the Resource table */
    RMAN_TABLE[index] = resmanFxns;

    IGateProvider_leave(gate, key);

    Log_print0(Diags_EXIT, "[+X] RMAN_register> Exit (status=IRES_OK)");

    return (IRES_OK);
}
/*
 *  ======== contigAlloc ========
 */
static Ptr contigAlloc(UInt size, UInt align, Bool cacheable, Bool heap)
{
    Ptr    addr = NULL;
    UInt32 physAddr;
    CMEM_AllocParams cmemParams;

    /* lock acquire should be after the trace, but it's unlikely to fail
     * and we get a more consistent/less confusing output this way.
     */
    Lock_acquire(moduleLock);

    Log_print4(Diags_ENTRY, "[+E] Memory_contigAlloc> "
            "Enter(size=0x%x, align=0x%x, cached=%s, heap=%s)", (IArg)size,
            (IArg)align, (IArg)(cacheable ? "TRUE" : "FALSE"),
            (IArg)(heap ? "TRUE" : "FALSE"));

    if (!cmemInitialized) {
        Log_print1(Diags_USER7, "[+7] Memory_contigAlloc> "
                "ERROR: request for size=0x%x failed -- CMEM has not been "
                "initialized.", (IArg)size);
        goto contigAlloc_return;
    }

    if (!heap && (Int)align > CMEMPOOLALIGN) {
        Log_print2(Diags_USER6, "[+6] Memory_contigAlloc> "
                "Warning: alignment %#x not supported for pool-based allocations,"
                " using fixed alignment %#x.",
                (IArg)align, (IArg)CMEMPOOLALIGN);
        /* align is not used for pool-based allocs, but set it anyway */
        align = CMEMPOOLALIGN;
    }

    cmemParams.type = heap ? CMEM_HEAP : CMEM_POOL;
    cmemParams.flags = cacheable ? CMEM_CACHED : CMEM_NONCACHED;
    cmemParams.alignment = align;
    addr = CMEM_alloc(size, &cmemParams);

    Log_print2(Diags_USER4, "[+4] Memory_contigAlloc> CMEM_alloc(0x%x) = 0x%x.",
            (IArg)size, (IArg)addr);

    if (addr != NULL) {

        /* since the allocation succeeded, get physical address now and add the
         * description for this buffer in our list of contiguous buffers.
         */
        physAddr = CMEM_getPhys(addr);
        if (physAddr != 0) {
            Log_print2(Diags_USER4, "[+4] Memory_contigAlloc> "
                    "CMEM_getPhys(0x%x) = 0x%x.", (IArg)addr, (IArg)physAddr);
            addContigBuf((Uint32)addr, size, physAddr);
        } else {
            Log_print1(Diags_USER7, "[+7] Memory_contigAlloc> "
                    "ERROR: CMEM_getPhys(0x%x) (virt-to-phys) failed; "
                    "releasing the block.", (IArg)addr);
            CMEM_free(addr, &cmemParams);
            addr = NULL;
        }
    } else {
        Log_print0(Diags_USER7, "[+7] Memory_contigAlloc> "
                "ERROR: CMEM alloc failed");
    }

contigAlloc_return:

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

    Lock_release(moduleLock);

    return addr;
}
/*
 *  ======== addContigBuf ========
 */
static ContigBuf *addContigBuf(UInt32 virtualAddress, UInt32 sizeInBytes,
    UInt32 physicalAddress)
{
    ContigBuf *cb;
    Int        cbCount = 0;

    Log_print3(Diags_USER1, "[+1] Memory__addContigBuf> "
            "Enter(virtAddr=0x%x, size=0x%x, physAddr=0x%x)",
            (IArg)virtualAddress, (IArg)sizeInBytes, (IArg)physicalAddress);

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

        /* check if the submitted contigbuf intersects current contigbuf;
         * (notation: { } is "current", [ ] is "submitted"
         * 1. if submitted cb is a subset of current cb, return current cb;
         * 2. if current cb is a subset of submitted cb, set current cb
         *    to submitted cb, return current cb
         * 3. if they intersect but neither is a subset of the other,
         *    set current cb to union of current and submitted, return cur
         */
        UInt32 startCurrent   = cb->physicalAddress;
        UInt32 endCurrent     = startCurrent + cb->sizeInBytes;
        UInt32 startSubmitted = physicalAddress;
        UInt32 endSubmitted   = physicalAddress + sizeInBytes;

        if (startCurrent <= startSubmitted &&
            endCurrent   >= endSubmitted) {    /* case 1:  { [      ] } */
            Log_print4(Diags_USER1, "[+1] Memory__addContigBuf> "
                    "case 1 (Sc=0x%x, Ec=0x%x, Ss=0x%x, Es=0x%x",
                    (IArg)startCurrent, (IArg)endCurrent, (IArg)startSubmitted,
                    (IArg)endSubmitted);
            cb->virtualAddress =
                virtualAddress - (startSubmitted - startCurrent);
            break;                             /* current: {          } */
        }

        if (startSubmitted <= startCurrent &&
            endSubmitted   >= endCurrent) {    /* case 2:  [ {      } ] */
            Log_print4(Diags_USER1, "[+1] Memory__addContigBuf> "
                    "case 2 (Sc=0x%x, Ec=0x%x, Ss=0x%x, Es=0x%x",
                    (IArg)startCurrent, (IArg)endCurrent, (IArg)startSubmitted,
                    (IArg)endSubmitted);
            cb->physicalAddress = physicalAddress;
            cb->sizeInBytes     = sizeInBytes;
            cb->virtualAddress  = virtualAddress;
            break;                             /* current: {          } */
        }

        if (startCurrent <= startSubmitted &&
            endCurrent   >  startSubmitted) {  /* case 3a: {  [     } ] */
            /* [dm] per fix for a bug noted in ce-b21: cb's should not be
             * merged if they merely *touch* -- only if they truly overlap;
             * adjacency in the virtual space doesn't guarantee adjacency
             * in physical space, and vice versa; so we merge only
             * if endCurrent > startSubmitted, not if >=.
             */
            Log_print4(Diags_USER1, "[+1] Memory__addContigBuf> "
                    "case 3a (Sc=0x%x, Ec=0x%x, Ss=0x%x, Es=0x%x",
                    (IArg)startCurrent, (IArg)endCurrent, (IArg)startSubmitted,
                    (IArg)endSubmitted);
            cb->sizeInBytes = endSubmitted - startCurrent;
            cb->virtualAddress =
                virtualAddress - (startSubmitted - startCurrent);
            break;                             /* current: {          } */
        }

        if (startSubmitted <= startCurrent &&
            endSubmitted   >  startCurrent) { /* case 3b: [  {     ] } */
            /* ... and here we merge only if endSubmitted > startCurrent. */
            Log_print4(Diags_USER1, "[+1] Memory__addContigBuf> "
                    "case 3b (Sc=0x%x, Ec=0x%x, Ss=0x%x, Es=0x%x",
                    (IArg)startCurrent, (IArg)endCurrent, (IArg)startSubmitted,
                    (IArg)endSubmitted);
            cb->physicalAddress = physicalAddress;
            cb->virtualAddress  = virtualAddress;
            cb->sizeInBytes     = endCurrent - startSubmitted;
            break;                             /* current: {          } */
        }

        /* else submitted and current cb are completely disjoint, so continue
         */

        /* delete any old elements; the caller has the lock acquired. */
        if ((++cbCount > Memory_maxCbListSize) && (cb->next != NULL)) {
            ContigBuf *cbNext = cb->next;
            cb->next = cbNext->next;
            free(cbNext);
        }

    }

    if (cb == NULL) {  /* either because it's the 1st or no match was found */
        Log_print0(Diags_USER1, "[+1] Memory__addContigBuf> "
                "creating new contigBuf object");
        cb = myMalloc(sizeof(ContigBuf));
        if (cb == NULL) {
            goto addContigBuf_return;
        }
        cb->virtualAddress  = virtualAddress;
        cb->sizeInBytes     = sizeInBytes;
        cb->physicalAddress = physicalAddress;

        cb->next = contigBufList;
        contigBufList = cb;
    }

addContigBuf_return:

    if (cb) {
        Log_print3(Diags_USER1, "[+1] Memory__addContigBuf> "
                "returning: cb->phys=0x%x, cb->size=0x%x, cb->virt=0x%x",
                (IArg)(cb->physicalAddress), (IArg)(cb->sizeInBytes),
                (IArg)(cb->virtualAddress));
    }
    else {
        Log_print0(Diags_USER7, "[+7] Memory__addContigBuf> out of Memory");
    }

    return (cb);
}
Int SystemCfg_deleteLocalResources(Void)
{
    Error_Block eb;
    Int status = 0;
    struct SystemCfg *stateObj = &SystemCfg_State;


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

    Error_init(&eb);

    /* unregister heap with MessageQ */
    MessageQ_unregisterHeap(Global_TilerHeapId);

    /* delete heap used for rcm message queue */
    HeapBufMP_delete(&stateObj->heapH);

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

    status = Notify_sendEvent(stateObj->hostProcId, Global_NotifyLineId,
        Global_HostDspEvtNum, Global_EvtDone, 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 done event from remote core */
    Log_print0(Diags_USER1, FXNN": waiting for done 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 done event");

    /* unregister notify callback */
    status = Notify_unregisterEvent(stateObj->hostProcId, Global_NotifyLineId,
        Global_HostDspEvtNum, SystemCfg_notifyCB__P, (UArg)stateObj);

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

    /* delete sync object */
    if (stateObj->semH != NULL) {
        SemThread_destruct(&stateObj->semObj);
        stateObj->semH = NULL;
    }

leave:
    Log_print2(Diags_EXIT, "<-- %s: %d", (IArg)FXNN, (IArg)status);
    return(status);
}
Int SystemCfg_createLocalResources(Void)
{
    Error_Block eb;
    SemThread_Params semThreadP;
    HeapBufMP_Params heapBufMPP;
    Int count;
    Char heapName[32];
    Int status = 0;
    struct SystemCfg *stateObj = &SystemCfg_State;
    static Int heapId = 1;


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

    Error_init(&eb);

    /* create sync object used to wait on remote core startup */
    SemThread_Params_init(&semThreadP);
    semThreadP.mode = SemThread_Mode_COUNTING;
    SemThread_construct(&stateObj->semObj, 0, &semThreadP, &eb);

    if (Error_check(&eb)) {
        /* Log_error() */
        Log_print3(Diags_USER8,
            "Error: %s, line %d: %s: SemThread_construct() failed",
            (IArg)__FILE__, (IArg)__LINE__, (IArg)FXNN);
        status = -1;
        goto leave;
    }
    stateObj->semH = SemThread_handle(&stateObj->semObj);

    /* register notify callback for ready event from remote core */
    status = Notify_registerEvent(stateObj->hostProcId, Global_NotifyLineId,
        Global_HostDspEvtNum, SystemCfg_notifyCB__P, (UArg)stateObj);

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

    /* create a heap for tiler usage */
    Log_print0(Diags_USER2, FXNN": HeapBufMP_create for tiler");

    HeapBufMP_Params_init(&heapBufMPP);
    heapBufMPP.regionId = 0;
    heapBufMPP.blockSize = 0x200;  /* 512 B */
    heapBufMPP.numBlocks = 8;

    /* hack: make a unique heap name */
    System_sprintf(heapName, "rcmHeap-%d", heapId);
    heapBufMPP.name = heapName;

    stateObj->heapH = HeapBufMP_create(&heapBufMPP);

    if (stateObj->heapH == NULL) {
        /* Log_error() */
        Log_print3(Diags_USER8,
            "Error: %s, line %d: %s: HeapBuf_create() failed",
            (IArg)FXNN, (IArg)__FILE__, (IArg)__LINE__);
        status = -1;
        goto leave;
    }

    /* register this heap with MessageQ */
    Log_print2(Diags_USER2,
        FXNN": MessageQ_registerHeap: (heapH: 0x%x, heapId: %d)",
        (IArg)(stateObj->heapH), (IArg)Global_TilerHeapId);

    MessageQ_registerHeap((Ptr)(stateObj->heapH), Global_TilerHeapId);


    /*  Send create done event to remote core. Need to loop in case
     *  the remote core has not yet registered with notify to receive
     *  this event.
     */
    Log_print0(Diags_USER1, FXNN": send EvtCreateDone to remote core");

    count = 0;
    do {
        status = Notify_sendEvent(stateObj->hostProcId, Global_NotifyLineId,
            Global_HostDspEvtNum, Global_EvtCreateDone, TRUE);

        if (status == Notify_E_EVTNOTREGISTERED) {
            Thread_sleep(500, &eb); /* 0.5 ms */
        }
    } while ((++count < 10) && (status == Notify_E_EVTNOTREGISTERED));

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

    /* wait for create done event from remote core */
    Log_print0(Diags_USER1, FXNN": waiting for EvtCreateDone 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 EvtCreatDone event");


leave:
    Log_print2(Diags_EXIT, "<-- %s: %d", (IArg)FXNN, (IArg)status);
    return(status);
}
Exemple #22
0
/*
 *  ======== smain ========
 */
Int smain(String progName, String procId, String engineName,
          String inFile, String outFile)
{
    Engine_Handle ce = NULL;
    Engine_Attrs attrs;
    VIDDEC2_Handle dec = NULL;
    VIDENC1_Handle enc = NULL;
    FILE *in = NULL;
    FILE *out = NULL;
    Memory_AllocParams allocParams;

    createInFileIfMissing(inFile);

    Log_print4(Diags_USER1, "[+1] App-> Application started, procId %s "
               "engineName %s input-file %s output-file %s.",
               (IArg)procId, (IArg)engineName, (IArg)inFile, (IArg)outFile);

    /* allocate input, encoded, and output buffers */
    allocParams.type = Memory_CONTIGPOOL;
    allocParams.flags = Memory_NONCACHED;
    allocParams.align = BUFALIGN;
    allocParams.seg = 0;

    inBuf = (XDAS_Int8 *)Memory_alloc(IFRAMESIZE, &allocParams);
    encodedBuf = (XDAS_Int8 *)Memory_alloc(EFRAMESIZE, &allocParams);
    outBuf = (XDAS_Int8 *)Memory_alloc(OFRAMESIZE, &allocParams);
    versionBuf = (XDAS_Int8 *)Memory_alloc(MAXVERSIONSIZE, &allocParams);

    if ((inBuf == NULL) || (encodedBuf == NULL) || (outBuf == NULL) ||
            (versionBuf == NULL)) {

        goto end;
    }

    /* open file streams for input and output */
    if ((in = fopen(inFile, "rb")) == NULL) {
        printf("App-> ERROR: can't read file %s\n", inFile);
        goto end;
    }
    if ((out = fopen(outFile, "wb")) == NULL) {
        printf("App-> ERROR: can't write to file %s\n", outFile);
        goto end;
    }

    /* Initialize attrs fields to default values, and set the procId */
    Engine_initAttrs(&attrs);
    attrs.procId = procId;

    /* reset, load, and start DSP Engine */
    if ((ce = Engine_open(engineName, &attrs, NULL)) == NULL) {
        fprintf(stderr, "%s: error: can't open engine %s\n",
            progName, engineName);
        goto end;
    }

    /* allocate and initialize video decoder on the engine */
    dec = VIDDEC2_create(ce, decoderName, NULL);
    if (dec == NULL) {
        printf( "App-> ERROR: can't open codec %s\n", decoderName);
        goto end;
    }

    /* allocate and initialize video encoder on the engine */
    enc = VIDENC1_create(ce, encoderName, NULL);
    if (enc == NULL) {
        fprintf(stderr, "%s: error: can't open codec %s\n",
            progName, encoderName);
        goto end;
    }

    /* use engine to encode, then decode the data */
    encode_decode(enc, dec, in, out);

end:
    /* teardown the codecs */
    if (enc) {
        VIDENC1_delete(enc);
    }
    if (dec) {
        VIDDEC2_delete(dec);
    }

    /* close the engine */
    if (ce) {
        Engine_close(ce);
    }

    /* close the files */
    if (in) {
        fclose(in);
    }
    if (out) {
        fclose(out);
    }

    /* free buffers */
    if (inBuf) {
        Memory_free(inBuf, IFRAMESIZE, &allocParams);
    }
    if (encodedBuf) {
        Memory_free(encodedBuf, EFRAMESIZE, &allocParams);
    }
    if (outBuf) {
        Memory_free(outBuf, OFRAMESIZE, &allocParams);
    }
    if (versionBuf) {
        Memory_free(versionBuf, MAXVERSIONSIZE, &allocParams);
    }

    Log_print0(Diags_USER1, "[+1] app done.");
    return (0);
}
/*
 *  ======== RMAN_allocateResources ========
 *  Directly allocate IRES resources by client without implementing IRES_Fxns
 */
IRES_Status RMAN_allocateResources(Int requestId,
        IRES_ResourceDescriptor * resDesc, Int numResources, Int scratchGroupId)
{
    Int              n = 0;
    IRESMAN_Fxns   * resman = NULL;
    IRES_Status      status = IRES_OK;
    IArg             key;


    if (initStatus != IRES_OK) {
        Log_print0(Diags_USER7, "[+7] RMAN_allocateResources> "
                "RMAN_init call hasn't happened successfully. Please "
                "initialize RMAN before calling any other RMAN API");

        Log_print0(Diags_EXIT, "[+X] RMAN_allocateResource> "
                "Exit (status=IRES_ENOINIT)");
        return (IRES_ENOINIT);
    }

    Assert_isTrue(resDesc != NULL, (Assert_Id)NULL);
    Assert_isTrue(numResources >=1, (Assert_Id)NULL);
    Assert_isTrue(RMAN_PARAMS.allocFxn != NULL, (Assert_Id)NULL);
    Assert_isTrue(RMAN_PARAMS.freeFxn != NULL, (Assert_Id)NULL);

    Log_print4(Diags_ENTRY, "[+E] RMAN_allocateResources> Enter "
            "requestId=%d, (resDesc=0x%x, numResources=%d, scratchGroupId=%d)",
            (IArg)requestId, (IArg)resDesc, (IArg)numResources,
            (IArg)scratchGroupId);

    /*
     *  Allocate requested resources one by one.
     */
    if (status == IRES_OK) {
        /* For each requested resource */
        for (n = 0 ; n < numResources; n++) {
            /* If someone populated the resource descriptor improperly, bail */
            if ((resDesc[n].resourceName == NULL) ||
                    (resDesc[n].revision == NULL)) {

                Log_print0(Diags_USER7, "[+7] RMAN_allocateResources> "
                        "Resource protocol and/or version were NULL. "
                        "Most likely an issue  with the algorithm's "
                        "getResourceRequestDescriptor implementation.");

                status = IRES_EALG;
                break;
            }

            resman = getResman(resDesc[n].resourceName, resDesc[n].revision);

            if (resman != NULL) {
                /*
                 *  Call getHandle on the IRESMAN implementation using
                 *  the protocolArgs extracted.
                 */
                Log_print1(Diags_USER2, "[+2] RMAN_allocateResources> Call "
                        "getHandle on the IRESMAN implementation 0x%x",
                        (IArg)resman);

                /* Acquire lock */
                key = IGateProvider_enter(gate);

                resDesc[n].handle = resman->getHandle((IALG_Handle)requestId,
                        &resDesc[n], scratchGroupId, &status);

                /* Release lock */
                IGateProvider_leave(gate, key);

                if (IRES_OK != status) {
                    break;
                }
            }
            else {
                Log_print2(Diags_USER7, "[+7] RMAN_allocateResources> "
                        "Resource protocol %s and version 0x%x didn't match "
                        "any registered protocol.",
                        (IArg)(resDesc[n].resourceName),
                        (IArg)(resDesc[n].revision));

                status = IRES_ENOTFOUND;
                break;
            }
        }
    }

    /*
     * Return those handles to IALG using the appropriate IRES call
     */
    if (FALSE == addVTableEntry((IALG_Handle)requestId, (IRES_Fxns *)NULL)) {
    /* TODO: Add trace */
            status = IRES_EFAIL;

            RMAN_freeAllocatedResources(requestId, resDesc, numResources,
                    scratchGroupId);
    }

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

    return (status);
}
/* ARGSUSED - this line tells the compiler not to warn about unused args. */
IRES_Handle IRES_EDMA3CHAN_constructHandle(
        IRES_ProtocolArgs * resProtocolArgs, 
        IALG_MemRec *memRecs, 
        IRESMAN_ConstructArgs * constructHandleArgs, 
        IRES_Status *status)
{
    int numPaRams = 0;
    int numTccs = 0;
    int i = 0;
    IRES_EDMA3CHAN_PaRamStruct * shadowPaRamsPtr = 0x0;
    unsigned int * paRamAddressPtr = 0x0;
    short * paRamIndexPtr = 0x0;
    short * tccIndexPtr = 0x0;
    short * actualPaRamIndex = 0x0;
    short edmaChannel;
    unsigned int paRamBase;
    IRES_EDMA3CHAN2_Handle handle = (IRES_EDMA3CHAN2_Handle)memRecs[0].base;

    IRESMAN_EDMA3CHAN_ConstructHandleArgs * constructArgs =
        (IRESMAN_EDMA3CHAN_ConstructHandleArgs *)constructHandleArgs;
    Bool shadow = ((IRES_EDMA3CHAN_ProtocolArgs *)resProtocolArgs)
            ->shadowPaRamsAllocation;

    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);


    Log_print3(Diags_ENTRY,
            "[+E] IRES_EDMA3CHAN_constructHandle> Enter (protArgs=0x%x, "
            "memRecs=0x%x, constructHandleArgs=0x%x)",
            (IArg)resProtocolArgs, (IArg)memRecs, (IArg)constructHandleArgs);
    
    if (handle == NULL) {

        *status = IRES_ENORESOURCE;

        Log_print0(Diags_USER7,
                "[+7] IRES_EDMA3CHAN_constructHandle> NULL handle returned through "
                "memRecs");

        Log_print0(Diags_EXIT,
                "[+X] IRES_EDMA3CHAN_constructHandle> Exit (handle=NULL)");

        return ((IRES_Handle)NULL);
    }

    /*
     * Assign the proper IRES_Obj properties to the handle first 
     */
    (handle->ires).getStaticProperties = IRES_EDMA3CHAN_getStaticProperties; 
    (handle->ires).persistent = TRUE; 

    internalState.edma3BaseAddress = constructArgs->edma3CCBaseAddress;

    paRamBase = internalState.edma3BaseAddress + IRES_EDMA3CHAN_PARAMBASEOFFSET;

    actualPaRamIndex = constructArgs->paRamIndex;

    numPaRams = constructArgs->numPaRams;

    numTccs = constructArgs->numTccs;

    /*
     * Point the shadowPaRamsPtr to the address of space allocated for 
     * shadow params .
     * The space gets allocated immediately following the IRES_EDMA3CHAN2_Obj
     * structure. The initialization of the shadow, param and tcc arrays
     * remains compatible for both revs 1 and  2 of the IRES EDMA3CHAN protocol
     */
    shadowPaRamsPtr = (IRES_EDMA3CHAN_PaRamStruct *)((UInt8 *)handle + 
            sizeof(IRES_EDMA3CHAN2_Obj));

    /*
     * Point the paRamAddress pointer to the address of space allocated in 
     * param addresses
     */
    if (shadow) {
        paRamAddressPtr = (unsigned int *)((UInt8 *)shadowPaRamsPtr + 
                (numPaRams * sizeof(IRES_EDMA3CHAN_PaRamStruct)));
    } 
    else {
        paRamAddressPtr =  (unsigned int *)shadowPaRamsPtr;
                shadowPaRamsPtr = NULL;
    }
    /*
     * Point the paRamIndexPtr to the address of space allocated for 
     * paRam indices.
     */
    paRamIndexPtr = (short *)((UInt8 *)paRamAddressPtr + (numPaRams * 
            sizeof(unsigned int)));

    tccIndexPtr = (short *)((UInt8 *)paRamIndexPtr + (numPaRams * 
            sizeof(unsigned short)));

    edmaChannel = constructArgs->edma3Chan;

    /*
     * Use the constructHandleargs to populate the TCC index array 
     */
    for (i = 0; i < numTccs; i++) {
        tccIndexPtr[i] = constructArgs->tccIndex[i];
    } 

    /*
     * Use the constructHandleargs to populate the ShadowPaRams with the 
     * correct link
     */
    if (numPaRams != 0) { 
    
        paRamAddressPtr[0] = paRamBase + ((unsigned int)actualPaRamIndex[0] * 
                sizeof(IRES_EDMA3CHAN_PaRamStruct));
    
        paRamIndexPtr[0] = actualPaRamIndex[0]; 
    
        Log_print6(Diags_USER2,
                "[+2] IRES_EDMA3CHAN_constructHandle> Address of handle 0x%x, "
                "paRamIndices 0x%x, paRamAddresses 0x%x, shadowParams 0x%x,"
                " tccIndices 0x%x, edmaChannel %d",
                (IArg)handle, (IArg)paRamIndexPtr, (IArg)paRamAddressPtr,
                (IArg)shadowPaRamsPtr, (IArg)tccIndexPtr, (IArg)edmaChannel);
    
        for (i = 0 ; i < numPaRams-1; i++) {
    
            /*
             * Copy the actual Param indices to the handle memory
             */
            paRamAddressPtr[i+1] = paRamBase + (actualPaRamIndex[i+1] * 
                    sizeof(IRES_EDMA3CHAN_PaRamStruct));
    
            paRamIndexPtr[i+1] = actualPaRamIndex[i+1]; 
    
            if (shadow) {
                /* First some clean index values */
                (shadowPaRamsPtr[i]).src = 0x0;
                (shadowPaRamsPtr[i]).dst = 0x0;
                (shadowPaRamsPtr[i]).srcElementIndex = 0x0;
                (shadowPaRamsPtr[i]).dstElementIndex = 0x0;
                (shadowPaRamsPtr[i]).srcFrameIndex = 0x0;
                (shadowPaRamsPtr[i]).dstFrameIndex = 0x0;
                (shadowPaRamsPtr[i]).acnt = 0x1;
                (shadowPaRamsPtr[i]).bcnt = 0x1;
                (shadowPaRamsPtr[i]).bCntrld = 0x1;
    
                /*
                 * ccnt is the trigger word, don't write to it
                 */
    
                /*
                 * For each PaRam index (except the last), construct a 
                 * shadowPaRam entry with link to the next PaRam 
                 */
                (shadowPaRamsPtr[i]).link = 
                        ((sizeof(IRES_EDMA3CHAN_PaRamStruct)) * 
                        actualPaRamIndex[i+1]) + IRES_EDMA3CHAN_PARAMBASEOFFSET;
    
                Log_print2(Diags_USER2,
                        "[+2] IRES_EDMA3CHAN_constructHandle> "
                        "shadowPaRamsPtr[%d].link = 0x%x",
                        (IArg)i, (IArg)(shadowPaRamsPtr[i].link));
    
                /*
                 * Set up the OPT, AB_SYNC for all PaRams
                 */
                (shadowPaRamsPtr[i]).opt = 
                        IRES_EDMA3CHAN_PARAMSTRUCT_OPT_ABSYNC; 
            }
        }

        /*
         * Set up the last paRam
         */
        if (shadow ) {
            /* First some clean index values */
            (shadowPaRamsPtr[numPaRams - 1]).src = 0x0;
            (shadowPaRamsPtr[numPaRams - 1]).dst = 0x0;
            (shadowPaRamsPtr[numPaRams - 1]).srcElementIndex = 0x0;
            (shadowPaRamsPtr[numPaRams - 1]).dstElementIndex = 0x0;
            (shadowPaRamsPtr[numPaRams - 1]).srcFrameIndex = 0x0;
            (shadowPaRamsPtr[numPaRams - 1]).dstFrameIndex = 0x0;
            (shadowPaRamsPtr[numPaRams - 1]).acnt = 0x1;
            (shadowPaRamsPtr[numPaRams - 1]).bcnt = 0x1;
            (shadowPaRamsPtr[i]).bCntrld = 0x1;
    
            /*
             * Link to a null PaRam
             */
            (shadowPaRamsPtr[numPaRams - 1]).link = 
                    IRES_EDMA3CHAN_PARAMSTRUCT_NULLLINK;
    
            Log_print2(Diags_USER2,
                    "[+2] IRES_EDMA3CHAN_constructHandle> shadowPaRamsPtr[%d].link ="
                    " 0x%x",
                    (IArg)((numPaRams -1)),
                    (IArg)(shadowPaRamsPtr[numPaRams -1].link));
    
            /*
             * Set OPT for last paRam
             * Static field, interrupt enabled
             * If TCCs requested, use tcc[0] as OPT bit.   
             */
            if (numTccs > 0) {
                (shadowPaRamsPtr[numPaRams - 1]).opt = 
                        IRES_EDMA3CHAN_PARAMSTRUCT_OPT_ABSYNC | 
                        IRES_EDMA3CHAN_PARAMSTRUCT_OPT_TCCINTEN | 
                        IRES_EDMA3CHAN_PARAMSTRUCT_OPT_TCCSTATIC | 
                        IRES_EDMA3CHAN_PARAMSTRUCT_OPT_TCCBITS(tccIndexPtr[0]);
            }
            else {
                (shadowPaRamsPtr[numPaRams - 1]).opt = 
                        IRES_EDMA3CHAN_PARAMSTRUCT_OPT_ABSYNC | 
                        IRES_EDMA3CHAN_PARAMSTRUCT_OPT_TCCINTEN | 
                        IRES_EDMA3CHAN_PARAMSTRUCT_OPT_TCCSTATIC;
            }
        }
    }
    else {
        paRamAddressPtr =  NULL;
                shadowPaRamsPtr = NULL;
        paRamIndexPtr = NULL;
    }

    if (numTccs ==0) {
        tccIndexPtr = NULL;
    }

    /*
     * Populate other fields of handle
     */
    handle->assignedNumPaRams = numPaRams; 
    handle->assignedNumTccs = numTccs;

    handle->assignedQdmaChannelIndex = constructArgs->qdmaChan; 
    handle->assignedEdmaChannelIndex = edmaChannel; 

    Log_print4(Diags_USER2,
            "[+2] IRES_EDMA3CHAN_constructHandle> Num params %d, Num Tccs %d, "
            "Qdma channel %d Edma channel %d",
            (IArg)(handle->assignedNumPaRams), (IArg)(handle->assignedNumTccs),
            (IArg)(handle->assignedQdmaChannelIndex),
            (IArg)(handle->assignedEdmaChannelIndex));

     if (IRES_EDMA3CHAN_CHAN_NONE != edmaChannel) {
         /*
          * Edma channel is assigned, configure ESR correctly
          */
         if ( edmaChannel < 32) {
             handle->esrBitMaskL |= (0x1 << edmaChannel);
             handle->esrBitMaskH = 0x0;
         }
         else {
             handle->esrBitMaskH |= (0x1 <<(edmaChannel -32));
             handle->esrBitMaskL = 0x0;
         }
     }
         else {
                handle->esrBitMaskL = 0x0;
                handle->esrBitMaskH = 0x0;
         }
      
    if (numTccs > 0) {
        if (tccIndexPtr[0] < 32) {
            handle->iprBitMaskH = 0x0;
            handle->iprBitMaskL |= (0x1 << tccIndexPtr[0]);
        }
        else {
            handle->iprBitMaskL = 0x0;
            handle->iprBitMaskH |= (0x1 <<(tccIndexPtr[0] - 32));
        }
    }
        else {
                handle->iprBitMaskL = 0x0;
                handle->iprBitMaskH = 0x0;
        }

    Log_print4(Diags_USER2,
            "[+2] IRES_EDMA3CHAN_constructHandle> ESR 0x%x: 0x%x IPR 0x%x: 0x%x ",
            (IArg)(handle->esrBitMaskH), (IArg)(handle->esrBitMaskL),
            (IArg)(handle->iprBitMaskH), (IArg)(handle->iprBitMaskL));

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

    /* 
     * Adjust the pointers in the IRES_EDMA3CHAN2_Obj to point to the paRam
     * indices and the shadow parameters
     */
    handle->assignedPaRamIndices = paRamIndexPtr;
    handle->shadowPaRams = shadowPaRamsPtr;
    handle->assignedPaRamAddresses = paRamAddressPtr;
    handle->assignedTccIndices = tccIndexPtr;

    *status = IRES_OK;

    Log_print2(Diags_EXIT,
            "[+X] IRES_EDMA3CHAN_constructHandle> Exit (status=%d, handle=0x%x)",
            (IArg)(*status), (IArg)handle);

    return ((IRES_Handle)handle);
}
/*
 *  ======== RMAN_freeAllocatedResources ========
 *  Free resources that were directly allocated by RMAN_allocateResources
 */
IRES_Status RMAN_freeAllocatedResources (Int requestId,
        IRES_ResourceDescriptor * resDesc, Int numResources, Int scratchGroupId)
{
    short           i;
    IRESMAN_Fxns  * resman = NULL;
    IArg            key;
    IRES_Status     status = IRES_OK;

    if (initStatus != IRES_OK) {
        Log_print0(Diags_USER7, "[+7] RMAN_freeAllocatedResources> "
                "RMAN_init call hasn't happened successfully. Please "
                "initialize RMAN before calling any other RMAN API");

        Log_print0(Diags_EXIT, "[+X] RMAN_freeAllocatedResources> "
                "Exit (status=IRES_ENOINIT)");
        return (IRES_ENOINIT);
    }

    Assert_isTrue(RMAN_PARAMS.allocFxn != NULL, (Assert_Id)NULL);
    Assert_isTrue(RMAN_PARAMS.freeFxn != NULL, (Assert_Id)NULL);

    Log_print4(Diags_ENTRY, "[+E] RMAN_freeAllocatedResources> Enter "
            "requestId=%d, (resDesc=0x%x, numResources=%d, scratchGroupId=%d)",
            (IArg)requestId, (IArg)resDesc, (IArg)numResources,
            (IArg)scratchGroupId);

    for (i = 0 ; i < numResources; i++) {
            resman = getResman(resDesc[i].resourceName, resDesc[i].revision);

        if (NULL == resman) {
            Log_print2(Diags_USER7, "[+7] RMAN_freeAllocatedResources> IRESMAN "
                    "handle not found for resource %s version 0x%x",
                    (IArg)(resDesc[i].resourceName),
                    (IArg)(resDesc[i].revision));

            status = IRES_ENOTFOUND;
        }
        else {
            /*
             *  Call freeHandle on resman Implementation and deinit
             *  resources held by the algorithm
             */
            key = IGateProvider_enter(gate);

            status = resman->freeHandle((IALG_Handle)requestId,
                     resDesc[i].handle, &resDesc[i], scratchGroupId);

            IGateProvider_leave(gate, key);

            if (status != IRES_OK) {
                /* TODO: Some SYS ABORT type error here */
                Log_print1(Diags_USER7,
                        "[+7] RMAN_freeAllocatedResources> Free handle failed "
                        "on IRESMAN implementation 0x%x", (IArg)resman);

                status = IRES_EFAIL;
            }
        }
    }

    //if (FALSE == freeVTableEntry((IALG_Fxns *)alg->fxns, resFxns)) {
    if (FALSE == freeVTableEntry((IALG_Handle)requestId, (IRES_Fxns *)NULL)) {
/* TODO: Add trace */
        status = IRES_EFAIL;
    }

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

    return (status);
}
/*
 *  ======== rmanTask ========
 */
Void rmanTask(UArg arg0, UArg arg1)
{
    Int            taskId = (Int)arg0;
    Int            index = (Int)arg1;  /* index into attrsTable */
    IALG_Fxns    * algFxns = (IALG_Fxns *)&DUMALG_TI_IDUMALG;
    IRES_Fxns    * resFxns = &DUMALG_TI_IRES;
    IDUMALG_Handle dumHandle = NULL;
    IDUMALG_Params params;
    Int            scratchId = attrsTable[index].scratchId;
    Int            yieldFlag = attrsTable[index].yieldFlag;
    Int            priority = attrsTable[index].priority;
    Arg            resourceId = (Arg)(&(attrsTable[index].id));
    Int            i;
    IRES_Status    status;

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

    params.size = sizeof(IDUMALG_Params);

    Log_print4(Diags_USER4, "[+4] rmanTask> "
            "Task #%d: ScratchId %d, Priority %d Yield %d",
            (IArg)taskId, (IArg)scratchId, (IArg)priority, (IArg)yieldFlag);

    params.yieldFlag  = yieldFlag;
    params.taskId = taskId;

    for (i = 0; i < NUM_RESOURCES; i++) {
        params.hdvicp[i] = *((IRES_HDVICP_RequestType *)resourceId + i);
        Log_print1(Diags_USER4, "[+4] rmanTask> "
                "Requesting resource %d (2 => ANY)",
                (IArg)((Int)params.hdvicp[i]));
    }

    /*
     * Create an instance of the algorithm using "algFxns"
     */
    SemThread_pend(mutex, SemThread_FOREVER, NULL);
    dumHandle = (IDUMALG_Handle)DSKT2_createAlg((Int)scratchId,
            (IALG_Fxns *)algFxns, NULL,(IALG_Params *)&params);

    if (dumHandle == NULL) {
        Log_print0(Diags_USER7, "[+7] rmanTask> Alg creation failed");
        System_abort("DSKT2_createAlg() failed, aborting...\n");
    }

    SemThread_post(mutex, NULL);

    /* Assign resources to the algorithm */
    status = RMAN_assignResources((IALG_Handle)dumHandle, resFxns, scratchId);
    if (status != IRES_OK) {
        Log_print1(Diags_USER7, "[+7] rmanTask> Assign resource failed [%d]",
                (IArg)status);
        System_abort("RMAN_assignResources() failed, aborting...\n");
    }


    /* Activate the Algorithm */
    DSKT2_activateAlg(scratchId, (IALG_Handle)dumHandle);

    /* Activate All Resources */
    RMAN_activateAllResources((IALG_Handle)dumHandle, resFxns, scratchId);

    /* Use IALG interfaces to do something */
    dumHandle->fxns->useHDVICP(dumHandle, taskId);

    /* Deactivate All Resources */
    RMAN_deactivateAllResources((IALG_Handle)dumHandle, resFxns, scratchId);

    /* Deactivate algorithm */
    DSKT2_deactivateAlg(scratchId, (IALG_Handle)dumHandle);

    /* Free resources assigned to this algorihtm */
    status = RMAN_freeResources((IALG_Handle)(dumHandle), resFxns, scratchId);
    if (status != IRES_OK) {
        Log_print1(Diags_USER7, "[+7] rmanTask> Free resource failed [%d]",
                (IArg)status);
        System_abort("RMAN_freeResources() failed, aborting...\n");
    }

    /*
     * Free instance of the algorithm created
     */
    SemThread_pend(mutex, SemThread_FOREVER, NULL);
    DSKT2_freeAlg(scratchId, (IALG_Handle)dumHandle);
    SemThread_post(mutex, NULL);

    SemThread_post(done, NULL);

    Log_print0(Diags_EXIT, "[+X] rmanTask> Exit ");
}
Exemple #27
0
/*
 *  ======== VIDDEC2FRONT_process ========
 *  This method must be the same for both local and remote invocation;
 *  each call site in the client might be calling different implementations
 *  (one that marshalls & sends and one that simply calls).  This API
 *  abstracts *all* video decoders (both high and low complexity
 *  decoders are envoked using this method).
 */
XDAS_Int32 VIDDEC2FRONT_process(VIDDEC2FRONT_Handle handle,
        VIDDEC2_InArgs *inArgs, XDM_Context *context,
        VIDDEC2FRONT_OutArgs *outArgs)
{
    XDAS_Int32 retVal = VIDDEC2_EFAIL;

    VIDDEC2_InArgs refInArgs;

    /*
     * 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] VIDDEC2FRONT_process> "
            "Enter (handle=0x%x, inArgs=0x%x, context=0x%x, outArgs=0x%x)",
            (IArg)handle, (IArg)inArgs, (IArg)context, (IArg)outArgs);

    if (handle) {
        IVIDDEC2FRONT_Fxns *fxns =
            (IVIDDEC2FRONT_Fxns *)VISA_getAlgFxns((VISA_Handle)handle);
        IVIDDEC2FRONT_Handle alg = VISA_getAlgHandle((VISA_Handle)handle);

        if (fxns && (alg != NULL)) {
            //Log_printf(ti_sdo_ce_dvtLog, "%s", (Arg)"VIDDEC2FRONT:process",
            //    (Arg)handle, (Arg)0);

            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));
                }

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

                /*
                 * Make a reference copy of inArgs so we can check that
                 * the codec didn't modify them during process().
                 */
                refInArgs = *inArgs;

                /* inArgs->inputID == 0 is an application error */
                if (inArgs->inputID == 0) {
                    Log_print1(Diags_USER7,
                            "[+7] ERROR> codec (0x%x) received invalid "
                            "inArgs->inputID == 0!", (IArg)handle);
                }
            }

            VISA_enter((VISA_Handle)handle);
            retVal = fxns->process(alg, inArgs, context, outArgs);
            VISA_exit((VISA_Handle)handle);

            if (checked) {
                /* ensure the codec didn't modify the read-only inArgs */
                if (memcmp(&refInArgs, inArgs, sizeof(*inArgs)) != 0) {
                    Log_print1(Diags_USER7,
                            "[+7] ERROR> codec (0x%x) modified read-only inArgs "
                            "struct!", (IArg)handle);
                }
            }

        }
    }

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

    return (retVal);
}