コード例 #1
0
ファイル: VirtQueue.c プロジェクト: Hashcode/sysbios-rpmsg
/*!
 * ======== VirtQueue_getAvailBuf ========
 */
Int16 VirtQueue_getAvailBuf(VirtQueue_Handle vq, Void **buf, Int *len)
{
    UInt16 head;

    Log_print6(Diags_USER1, "getAvailBuf vq: 0x%x %d %d %d 0x%x 0x%x\n",
        (IArg)vq, vq->last_avail_idx, vq->vring.avail->idx, vq->vring.num,
        (IArg)&vq->vring.avail, (IArg)vq->vring.avail);

    /* There's nothing available? */
    if (vq->last_avail_idx == vq->vring.avail->idx) {
        /* We need to know about added buffers */
        vq->vring.used->flags &= ~VRING_USED_F_NO_NOTIFY;

        return (-1);
    }
    /*
     * Grab the next descriptor number they're advertising, and increment
     * the index we've seen.
     */
    head = vq->vring.avail->ring[vq->last_avail_idx++ % vq->vring.num];

    *buf = mapPAtoVA(vq->vring.desc[head].addr);
    *len = vq->vring.desc[head].len;

    return (head);
}
コード例 #2
0
/*
 *  ======== UNIVERSAL_processWait ========
 */
XDAS_Int32 UNIVERSAL_processWait(UNIVERSAL_Handle handle,
        XDM1_BufDesc *inBufs, XDM1_BufDesc *outBufs, XDM1_BufDesc *inOutBufs,
        IUNIVERSAL_InArgs *inArgs, IUNIVERSAL_OutArgs *outArgs, UInt timeout)
{
    XDAS_Int32 retVal = UNIVERSAL_EFAIL;
    UNIVERSAL_InArgs refInArgs;

    /*
     * 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_print6(Diags_ENTRY, "[+E] UNIVERSAL_processWait> "
            "Enter (handle=0x%x, inBufs=0x%x, outBufs=0x%x, inOutBufs=0x%x, "
            "inArgs=0x%x, outArgs=0x%x)",
            (IArg)handle, (IArg)inBufs, (IArg)outBufs, (IArg)inOutBufs,
            (IArg)inArgs, (IArg)outArgs);

    if (handle) {
        IUNIVERSAL_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, inBufs, outBufs, inOutBufs, inArgs,
                    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] UNIVERSAL_processWait> "
            "Exit (handle=0x%x, retVal=0x%x)", (IArg)handle, (IArg)retVal);

    return (retVal);
}
コード例 #3
0
ファイル: DomxTunnelMgr.c プロジェクト: andreimironenko/omx
/**
 * @name   domxtmgr_map_connection_handle
 * @brief  Map component handle to connection handle
 * @param  nCompIdx              : Component index in connection table
 * @param  ePeerCompCoreId       : Tunneled peer coreID
 * @param  hTunneledPeerMap      : Pointer to handle of Peer component
 * @param  eb                    : Error block to raise errors
 * @return none
 */
static Void domxtmgr_map_connection_handle (Int nCompIdx,
                                            DomxTypes_coreType ePeerCompCoreId,
                                            OmxRpc_Handle pRpcStubHandle,
                                            OmxTypes_OMX_HANDLETYPE
                                              *hTunneledPeerMap,
                                            Error_Block * eb)
{
  OmxTypes_OMX_HANDLETYPE hCompConnectionHandle;

  DOMX_UTL_TRACE_FUNCTION_ENTRY_LEVEL1 ();

  Log_print6 (Diags_USER1, "Entered: %s (%d, %d, 0x%x, 0x%x, 0x%x)",
              (xdc_IArg) __FUNCTION__, nCompIdx,
              ePeerCompCoreId, (xdc_IArg) pRpcStubHandle,
              (xdc_IArg) hTunneledPeerMap, (xdc_IArg) eb);

  *hTunneledPeerMap = NULL;

  if (FALSE == Error_check (eb))
  {
    domxtmgr_get_connection_handle (nCompIdx, ePeerCompCoreId,
                                    &hCompConnectionHandle);
    if (NULL == hCompConnectionHandle)
    {
      domxtmgr_create_connection (nCompIdx, ePeerCompCoreId,
                                  pRpcStubHandle, &hCompConnectionHandle, eb);
      if (FALSE == Error_check (eb))
      {
        domxtmgr_add_component_connection_info (nCompIdx,
                                                ePeerCompCoreId,
                                                hCompConnectionHandle);
        domxtmgr_get_connection_handle (nCompIdx, ePeerCompCoreId,
                                        &hCompConnectionHandle);
        DOMX_UTL_TRACE_FUNCTION_ASSERT ((NULL != hCompConnectionHandle),
                                        "CompConnectionHandle is NULL");
      }
    }
    else
    {
      domxtmgr_add_component_connection_info (nCompIdx,
                                              ePeerCompCoreId,
                                              hCompConnectionHandle);
    }
  }
  if (FALSE == Error_check (eb))
  {
    *hTunneledPeerMap = hCompConnectionHandle;
  }

  DOMX_UTL_TRACE_FUNCTION_EXIT_LEVEL1 (OMX_ErrorNone);

}
コード例 #4
0
/* ARGSUSED - this line tells the compiler not to warn about unused args. */
void IRES_EDMA3CHAN_getStaticProperties(IRES_Handle resourceHandle, 
        IRES_Properties * resourceProperties)
{
    IRES_EDMA3CHAN_Properties * properties = 
            (IRES_EDMA3CHAN_Properties *)resourceProperties;

    unsigned int * addr = (unsigned int *) internalState.edma3BaseAddress;

    unsigned int cccfg = addr[1];

    Log_print2(Diags_ENTRY,
            "[+E] IRES_EDMA3CHAN_getStaticProperties> Enter (resourceHandle=0x%x, "
            "resourceProperties=0x%x)",
            (IArg)resourceHandle, (IArg)resourceProperties);

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

    properties->numDmaChannels = 
            IRES_EDMA3CHAN_EDMA3REGISTERLAYER_NUMDMACH(cccfg);
    properties->numEvtQueue = 
            IRES_EDMA3CHAN_EDMA3REGISTERLAYER_NUMEVTQUE(cccfg);
    properties->numPaRAMSets =     
            IRES_EDMA3CHAN_EDMA3REGISTERLAYER_NUMPAENTRY(cccfg);
    properties->numQdmaChannels = 
            IRES_EDMA3CHAN_EDMA3REGISTERLAYER_NUMQDMACH(cccfg);
    properties->numRegions = IRES_EDMA3CHAN_EDMA3REGISTERLAYER_NUMREGN(cccfg);
    properties->numTccs = IRES_EDMA3CHAN_EDMA3REGISTERLAYER_NUMINTCH(cccfg);
    properties->numTcs = properties->numEvtQueue;
    properties->dmaChPaRAMMapExists    = 
            IRES_EDMA3CHAN_EDMA3REGISTERLAYER_CHMAPEXIST(cccfg);
    properties->memProtectionExists    = 
            IRES_EDMA3CHAN_EDMA3REGISTERLAYER_MPEXIST(cccfg);
    properties->globalRegs = (IRES_EDMA3CHAN_EDMA3RegisterLayer *)
            internalState.edma3BaseAddress;

    Log_print6(Diags_USER4,
            "[+4] IRES_EDMA3CHAN_getStaticProperties> Properties numDmaChannels %d,"
            " numEvtQueues %d, numPaRAMSets %d, numQdmaChannels %d, numRegions "
            "%d, numTccs %d",
            (IArg)(properties->numDmaChannels),
            (IArg)(properties->numEvtQueue), (IArg)(properties->numPaRAMSets),
            (IArg)(properties->numQdmaChannels), (IArg)(properties->numRegions),
            (IArg)(properties->numTccs));
    

    Log_print0(Diags_EXIT, "[+X] IRES_EDMA3CHAN_getStaticProperties> Exit");
}
コード例 #5
0
ファイル: VirtQueue.c プロジェクト: Hashcode/ipcdev
/*!
 * ======== VirtQueue_getAvailBuf ========
 */
Int16 VirtQueue_getAvailBuf(VirtQueue_Handle vq, Void **buf, Int *len)
{
    Int16 head;
    IArg key;

    key = GateHwi_enter(vq->gateH);
    Log_print6(Diags_USER1, "getAvailBuf vq: 0x%x %d %d %d 0x%x 0x%x\n",
        (IArg)vq, vq->last_avail_idx, vq->vring.avail->idx, vq->vring.num,
        (IArg)&vq->vring.avail, (IArg)vq->vring.avail);

    /*  Clear flag here to avoid race condition with remote processor.
     *  This is a negative flag, clearing it means that we want to
     *  receive an interrupt when a buffer has been added to the pool.
     */
    vq->vring.used->flags &= ~VRING_USED_F_NO_NOTIFY;

    /* There's nothing available? */
    if (vq->last_avail_idx == vq->vring.avail->idx) {
        head = (-1);
    }
    else {
        /* No need to be kicked about added buffers anymore */
        vq->vring.used->flags |= VRING_USED_F_NO_NOTIFY;

        /*
         * Grab the next descriptor number they're advertising, and increment
         * the index we've seen.
         */
        head = vq->vring.avail->ring[vq->last_avail_idx++ % vq->vring.num];

        *buf = mapPAtoVA(vq->vring.desc[head].addr);
        *len = vq->vring.desc[head].len;
    }
    GateHwi_leave(vq->gateH, key);

    return (head);
}
コード例 #6
0
ファイル: viddec1.c プロジェクト: mobiaqua/ti-ce
/*
 *  ======== VIDDEC1_control ========
 *  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 VIDDEC1_control(VIDDEC1_Handle handle, VIDDEC1_Cmd id,
    VIDDEC1_DynamicParams *dynParams, VIDDEC1_Status *status)
{
    XDAS_Int32 retVal = VIDDEC1_EFAIL;

    VIDDEC1_DynamicParams refDynParams;
    XDAS_Int32 refStatusSize;
    XDAS_Int32 refStatusDataBufSize;

    /*
     * 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();

    if (checked) {
        /* Ensure dynParams and status are non-NULL, per the XDM spec */

        if ((!(XdmUtils_validateExtendedStruct(dynParams, sizeof(*dynParams),
                "dynParams"))) || (!(XdmUtils_validateExtendedStruct(status,
                sizeof(*status), "status")))) {
            /* for safety, return here before dereferencing and crashing */
            return (retVal);
        }
    }

    Log_print6(Diags_ENTRY, "[+E] VIDDEC1_control> "
            "Enter (handle=0x%x, id=%d, dynParams=0x%x (size=0x%x), "
            "status=0x%x (size=0x%x)",
            (IArg)handle, (IArg)id, (IArg)dynParams, (IArg)(dynParams->size),
            (IArg)status, (IArg)(status->size));

    if (handle) {
        IVIDDEC1_Fxns *fxns =
            (IVIDDEC1_Fxns *)VISA_getAlgFxns((VISA_Handle)handle);
        IVIDDEC1_Handle alg = VISA_getAlgHandle((VISA_Handle)handle);

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

                /*
                 * Make a reference copy of dynParams, status->size, and
                 * status->data.bufSize so we can check that the codec
                 * didn't modify these read-only fields during control().
                 */
                refDynParams = *dynParams;
                refStatusSize = status->size;
                refStatusDataBufSize = status->data.bufSize;
            }

            //Log_printf(ti_sdo_ce_dvtLog, "%s", (Arg)"VIDDEC1:control",
            //    (Arg)handle, (Arg)0);

            VISA_enter((VISA_Handle)handle);
            retVal = fxns->control(alg, id, dynParams, status);
            VISA_exit((VISA_Handle)handle);

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

                /* ensure the codec didn't change status->size */
                if (status->size != refStatusSize) {
                    Log_print1(Diags_USER7,
                            "[+7] ERROR> codec (0x%x) modified read-only status->size "
                            "field!", (IArg)handle);
                }

                /* ensure the codec didn't change status->data.bufSize */
                if (status->data.bufSize != refStatusDataBufSize) {
                    Log_print1(Diags_USER7,
                            "[+7] ERROR> codec (0x%x) modified read-only "
                            "status->data.bufSize field!", (IArg)handle);
                }
            }
        }
    }

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

    return (retVal);
}
コード例 #7
0
/* 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);
}
コード例 #8
0
/*
 *  ======== doTransfer ========
 */
static Void doTransfer(IDMA3_Handle handle)
{
    unsigned char *src, *dst;
    unsigned char *srcFrameStart, *dstFrameStart;
    ACPY3_PaRamRegs *paRamCache;
    Int numTransfers = handle->numPaRams;
    Int transferNo;
    unsigned short ccnt;
    unsigned short bcnt;
    unsigned short acnt;
    short srcElementIndex;
    short dstElementIndex;
    short srcFrameIndex;
    short dstFrameIndex;

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

    for (transferNo = 0; transferNo < numTransfers; transferNo++) {
        /*
         * Use each transfer's cached paRam settings. The
         */
        paRamCache = (ACPY3_PaRamRegs *)ACPY3_getPaRamCache(handle,
                transferNo);

        src  = paRamCache->src;
        dst  = paRamCache->dst;
        acnt = paRamCache->acnt;
        bcnt = paRamCache->bcnt;

        /*
         *  QDMA can only transfer a single frame, so ccnt must always be 1.
         */
        ccnt = 1;

        srcElementIndex = paRamCache->srcElementIndex;
        dstElementIndex = paRamCache->dstElementIndex;
        srcFrameIndex = paRamCache->srcFrameIndex;
        dstFrameIndex = paRamCache->dstFrameIndex;

        Log_print6(Diags_USER2, "[+2] doTransfer> Transfer %d,"
                " acnt  0x%x, bcnt 0x%x, src 0x%x, dst 0x%x, srcIndex 0x%x, "
                "dstIndex 0x%x",
                (IArg)acnt, (IArg)bcnt, (IArg)src, (IArg)dst,
                (IArg)srcElementIndex, (IArg)dstElementIndex);

        while (ccnt-- > 0) {
            /* Keep track of the start of the frame */
            srcFrameStart = src;
            dstFrameStart = dst;

            /* Copy a frame */
            while (bcnt-- > 0) {

                /* Copy an element */
                while (acnt-- > 0) {
                    *dst++ = *src++;
                }

                /*
                 * Reset ACNT counter.
                 * Advance src/dst ptrs to beginning of next line/1D-vector
                 */
                acnt = paRamCache->acnt;
                src = (src - acnt) + srcElementIndex ;
                dst = (dst - acnt) + dstElementIndex;
            }

            /* adjust src and dst to the beginning of a frame + frameIndex*/
            bcnt = paRamCache->bcnt;
            src = srcFrameStart + srcFrameIndex;
            dst = dstFrameStart + dstFrameIndex;
        }
    } /* for each transfer */

    Log_print0(Diags_EXIT, "[+X] doTransfer> Exit");
}
コード例 #9
0
ファイル: DomxTunnelMgr.c プロジェクト: andreimironenko/omx
/**
 * @name domxtmgr_create_connection
 * @brief Create a DOMXTMgr connection
 * @param  nCompIdx              : Component index in connection table
 * @param  pRpcStubHandle        : Pointer to rpc stub handle
 * @param  ppComponentHandlePtr  : Pointer to Component Handle to be populated
 * @param  eb                    : Error block to raise errors
 * @return none
 */
static Void domxtmgr_create_connection (Int32 nCompIdx,
                                        DomxTypes_coreType eConnectCoreId,
                                        OmxRpc_Handle pRpcStubHandle,
                                        OmxTypes_OMX_HANDLETYPE
                                          *ppComponentHandlePtr,
                                        Error_Block *eb)
{
  OmxRpc_errorType eRpcError;
  OmxCore_OMX_ERRORTYPE eError;

  DOMX_UTL_TRACE_FUNCTION_ENTRY_LEVEL1 ();

  Log_print6 (Diags_USER1, "Entered :%s (%d, %d, 0x%x, 0x%x, 0x%x)",
              (xdc_IArg) __FUNCTION__, nCompIdx, eConnectCoreId,
              (xdc_IArg) pRpcStubHandle, (xdc_IArg) ppComponentHandlePtr,
              (xdc_IArg) eb);

  *ppComponentHandlePtr = NULL;
  if (NULL ==
      DomxTunnelMgr_module->connectionInfoTbl.elem[nCompIdx][0].sRpcSkelInfo.
      pRpcSkelHandle)
  {
    Int status;

    status =
      domxtmgr_create_rpcskel (nCompIdx, eConnectCoreId, pRpcStubHandle, eb);
    if (status >= 0)
    {
      DomxTunnelMgr_module->connectionInfoTbl.elem[nCompIdx][0].sRpcSkelInfo.
        bRpcSkelCreated = TRUE;
    }
  }
  if (FALSE == Error_check (eb))
  {
    OmxTypes_OMX_U32 nRpcRemoteHandle;
    OmxTypes_OMX_HANDLETYPE pProxyLiteHandlePtr;

    nRpcRemoteHandle = (OmxTypes_OMX_U32)
      DomxTunnelMgr_module->connectionInfoTbl.elem[nCompIdx][0].sRpcSkelInfo.
      pRpcSkelHandle;
    DOMX_UTL_TRACE_FUNCTION_ASSERT ((NULL !=
                                     DomxTunnelMgr_module->connectionInfoTbl.
                                     elem[nCompIdx][0].sRpcSkelInfo.
                                     pRpcSkelHandle),
                                    "Invalid skelInfoRegistration");
    eRpcError =
      OmxRpc_stubCreateProxyLite (pRpcStubHandle, nRpcRemoteHandle,
                                  DomxTunnelMgr_module->connectionInfoTbl.
                                  elem[nCompIdx][0].hComponentRealHandle,
                                  (OmxTypes_OMX_S8 *) DomxTunnelMgr_module->
                                  connectionInfoTbl.elem[nCompIdx][0].
                                  cComponentName,
                                  (OmxTypes_OMX_S8 *) DomxTunnelMgr_module->
                                  connectionInfoTbl.elem[nCompIdx][0].
                                  sRpcSkelInfo.cComponentRcmSvrName,
                                  &pProxyLiteHandlePtr, &eError);
    if ((OmxRpc_errorNone != eRpcError) || (OMX_ErrorNone != eError))
    {
      DOMX_UTL_TRACE_FUNCTION_ASSERT ((OmxRpc_errorNone == eRpcError),
                                      "RpcError in OmxRpc_stubCreateProxyLite");
      DOMX_UTL_TRACE_FUNCTION_ASSERT ((OMX_ErrorNone == eError),
                                      "OMXError in OmxRpc_stubCreateProxyLite");
    }
    else
    {
      *ppComponentHandlePtr = pProxyLiteHandlePtr;
      DomxTunnelMgr_module->connectionInfoTbl.elem[nCompIdx][0].
        sCoreConnectionInfo[eConnectCoreId].bProxyLiteCreated = TRUE;
    }
  }

  DOMX_UTL_TRACE_FUNCTION_EXIT_LEVEL1 (OMX_ErrorNone);
}
コード例 #10
0
/*
 *  ======== mapByFile ========
 */
Bool mapByFile(ProcMgr_Handle handle, String mapFile, UInt16 procId,
        int mapFlag)
{
    FILE *f;
    char line[MAXLINE];
    MapStruct mapStruct;
    ProcMgr_AddrInfo addrInfo;
    Int status = 0;
    ProcMgr_ProcInfo *procInfo;
    Int procInfoSize;
    UInt32 maxMemoryRegions;
    int j;

    if (mapFile == NULL) {
        return (TRUE);
    }

    f = fopen(mapFile, "r");

    if (!f) {
        Log_print1(Diags_USER5, "[+5] mapByFile: Unable to open %s "
                "skipping....", (IArg)mapFile);

        /* regardless, we return 'success'.  Malformed lines are skipped */
        return (TRUE);
    }

    while (fgets(line, MAXLINE, f)) {
        if (!isMapLine(line, procId)) {
            Log_print1(Diags_USER5, "malformed line, skipping:\n   %s",
                    (IArg)line);
            continue;
        }

        /* Parse line, if not applicable, continue */
        if (!initFromLine(line, &mapStruct)) {
            continue;
        }

        /* applicable line */
        if (mapFlag) {
            /* map! */
            Log_print6(Diags_USER2,
                    "[+2] mapByFile: Mapping SV: 0x%x, SP: 0x%x, "
                    "MP: 0x%x,\n  size 0x%x, mask 0x%x, cached %d",
                    (IArg)mapStruct.slaveVirt, (IArg)mapStruct.slavePhys,
                    (IArg)mapStruct.masterPhys, (IArg)mapStruct.size,
                    (IArg)mapStruct.mapMask, (IArg)mapStruct.isCached);

            addrInfo.addr[MKV] = -1u;
            addrInfo.addr[ProcMgr_AddrType_MasterUsrVirt] = -1u;
            addrInfo.addr[MP] = mapStruct.masterPhys;
            addrInfo.addr[ProcMgr_AddrType_SlaveVirt] = mapStruct.slaveVirt;
            addrInfo.addr[ProcMgr_AddrType_SlavePhys] = -1u;
            addrInfo.size = mapStruct.size;
            addrInfo.isCached = mapStruct.isCached;

            status = ProcMgr_map(handle, mapStruct.mapMask, &addrInfo, MP);
            if (status < 0) {
                Log_print1(Diags_USER6, "[+6] mapByFile: ProcMgr_map "
                        "failed [0x%x]", (IArg)status);
            }
            else {
                Log_print0(Diags_USER2, "[+2] mapByFile: mapping succeeded");
            }
        }
        else {
            /* unmap! */
            Log_print6(Diags_USER2, "[+2]Unmapping SV: 0x%x, SP: 0x%x, "
                    "MP: 0x%x,\n  size 0x%x, mask 0x%x, cached %d",
                    (IArg)mapStruct.slaveVirt, (IArg)mapStruct.slavePhys,
                    (IArg)mapStruct.masterPhys, (IArg)mapStruct.size,
                    (IArg)mapStruct.mapMask, (IArg)mapStruct.isCached);

            addrInfo.addr[MKV] = -1u;

            /* if unmapping MasterKnlVirt, need to look it up */
            if (mapStruct.mapMask & ProcMgr_MASTERKNLVIRT) {

                maxMemoryRegions = ProcMgr_getMaxMemoryRegions(handle);
                procInfoSize = sizeof(ProcMgr_ProcInfo) +
                           (maxMemoryRegions * sizeof(ProcMgr_MappedMemEntry));
                procInfo = Memory_alloc(procInfoSize, NULL);

                status = ProcMgr_getProcInfo(handle, procInfo);
                if (status < 0) {
                    Log_print0(Diags_USER6, "[+6] Unable to find MKV entry");
                }
                else {
                    for (j = 0; j < procInfo->maxMemoryRegions; j++) {
                        if ((procInfo->memEntries[j].inUse) &&
                                (procInfo->memEntries[j].info.addr[MP]
                                        == mapStruct.masterPhys) &&
                                (procInfo->memEntries[j].info.size ==
                                        mapStruct.size) &&
                                (procInfo->memEntries[j].info.isCached
                                        == mapStruct.isCached)) {
                            /* found it */
                            addrInfo.addr[MKV] =
                                procInfo->memEntries[j].info.addr[MKV];
                            Log_print1(Diags_USER2,
                                    "[+2] Found MKV entry (0x%x)",
                                    (IArg)addrInfo.addr[MKV]);
                            break;
                        }
                    }
                }

                Memory_free(procInfo, procInfoSize, NULL);
            }

            addrInfo.addr[ProcMgr_AddrType_MasterUsrVirt] = -1u;
            addrInfo.addr[MP] = mapStruct.masterPhys;
            addrInfo.addr[ProcMgr_AddrType_SlaveVirt] =
                mapStruct.slaveVirt;
            addrInfo.addr[ProcMgr_AddrType_SlavePhys] = -1u;
            addrInfo.size = mapStruct.size;
            addrInfo.isCached = mapStruct.isCached;

            status = ProcMgr_unmap(handle, mapStruct.mapMask, &addrInfo, MP);
            if (status < 0) {
                Log_print1(Diags_USER6, "[+6] ProcMgr_unmap failed [0x%x]",
                        status);
            }
            else {
                Log_print0(Diags_USER2, "[+2] ProcMgr_unmap succeeded");
            }
        }
    }

    fclose(f);

    /* regardless, we return 'success'.  Malformed lines are skipped */
    return (TRUE);
}