Exemple #1
0
/*
 *  ======== TransportShm_sharedMemReq ========
 */
SizeT TransportShm_sharedMemReq(const TransportShm_Params *params)
{
    SizeT memReq, minAlign;
    UInt16 regionId;
    ListMP_Params listMPParams;

    regionId = SharedRegion_getId(params->sharedAddr);

    minAlign = Memory_getMaxDefaultTypeAlign();
    if (SharedRegion_getCacheLineSize(regionId) > minAlign) {
        minAlign = SharedRegion_getCacheLineSize(regionId);
    }

    /* for the Attrs structure */
    memReq = _Ipc_roundup(sizeof(TransportShm_Attrs), minAlign);

    /* for the second Attrs structure */
    memReq += _Ipc_roundup(sizeof(TransportShm_Attrs), minAlign);

    ListMP_Params_init(&listMPParams);
    listMPParams.regionId = regionId;

    /* for localListMP */
    memReq += ListMP_sharedMemReq(&listMPParams);

    /* for remoteListMP */
    memReq += ListMP_sharedMemReq(&listMPParams);

    return(memReq);
}
Exemple #2
0
/*
 *  ======== ListMP_sharedMemReq ========
 */
SizeT ListMP_sharedMemReq(const ListMP_Params *params)
{
    SizeT  memReq, minAlign;
    UInt16 regionId;

    if (params->sharedAddr == NULL) {
        regionId = params->regionId;
    }
    else {
        regionId = SharedRegion_getId(params->sharedAddr);
    }
    
    /* Assert that the region is valid */
    Assert_isTrue(regionId != SharedRegion_INVALIDREGIONID,
                  ti_sdo_ipc_Ipc_A_addrNotInSharedRegion);

    minAlign = Memory_getMaxDefaultTypeAlign();
    if (SharedRegion_getCacheLineSize(regionId) > minAlign) {
        minAlign = SharedRegion_getCacheLineSize(regionId);
    }

    memReq = _Ipc_roundup(sizeof(ti_sdo_ipc_ListMP_Attrs), minAlign);
    
    return (memReq);
}
Exemple #3
0
/*
 *  ======== GatePetersonN_Instance_init ========
 */
Int GatePetersonN_Instance_init(GatePetersonN_Object *obj,
                               IGateProvider_Handle localGate,
                               const GatePetersonN_Params *params,
                               Error_Block *eb)
{
    SizeT  offset;
    SizeT  minAlign = Memory_getMaxDefaultTypeAlign();
    SizeT  i;

    if (SharedRegion_getCacheLineSize(params->regionId) > minAlign) {
            minAlign = SharedRegion_getCacheLineSize(params->regionId);
    }

    Assert_isTrue(params->sharedAddr != NULL, ti_sdo_ipc_Ipc_A_invParam);
    Assert_isTrue(GatePetersonN_numInstances != 0, ti_sdo_ipc_Ipc_A_invParam);

    obj->localGate      = localGate;
    obj->cacheEnabled   = SharedRegion_isCacheEnabled(params->regionId);
    obj->cacheLineSize  = SharedRegion_getCacheLineSize(params->regionId);
    obj->nested  = 0;

    /* This is not cluster aware:
     * obj->numProcessors  = MultiProc_getNumProcessors();
     * obj->selfId         = MultiProc_self();
     */

    /* Cluster aware initialization */
    obj->numProcessors  = MultiProc_getNumProcsInCluster();

    /* set selfId to 0-based offset within cluster. */
    obj->selfId         = MultiProc_self() - MultiProc_getBaseIdOfCluster();

    /* Assign shared memory addresses for the protocol state variables */

    offset = 0;

    for (i=0; i < obj->numProcessors; i++) {
        obj->enteredStage[i] = (Int32 *)((UArg)(params->sharedAddr) + offset);
        offset += minAlign;
    }

    for (i=0; i < obj->numProcessors - 1; i++) {
	obj->lastProcEnteringStage[i] = (Int32 *)((UArg)(params->sharedAddr)
                                                   + offset);
        offset += minAlign;
    }

    if (!params->openFlag) {
        /* Creating. */
        obj->objType = ti_sdo_ipc_Ipc_ObjType_CREATEDYNAMIC;
        GatePetersonN_postInit(obj);
    }
    else {
        /* Opening. */
        obj->objType = ti_sdo_ipc_Ipc_ObjType_OPENDYNAMIC;
    }

    return (0);
}
/*
 *  ======== NotifyDriverShm_sharedMemReq ========
 */
SizeT NotifyDriverShm_sharedMemReq(const NotifyDriverShm_Params *params)
{
    UInt16 regionId;
    SizeT regionCacheSize;
    SizeT minAlign, memReq;
    
    /* Ensure that params is non-NULL */
    Assert_isTrue(params != NULL, ti_sdo_ipc_Ipc_A_internal);
    
    /* 
     *  Determine obj->cacheEnabled using params->cacheEnabled and SharedRegion
     *  cache flag setting, if applicable.
     */
    minAlign = params->cacheLineSize;
    if (minAlign == 0) {
        /* Fix alignment of zero */        
        minAlign = sizeof(Ptr);
    }
    regionId = SharedRegion_getId(params->sharedAddr);
    if (regionId != SharedRegion_INVALIDREGIONID) {
        regionCacheSize = SharedRegion_getCacheLineSize(regionId);
        /* Override minAlign if the region cache line size is smaller */
        if (regionCacheSize < minAlign) {
            minAlign = regionCacheSize;
        }
    }
    
    /* Determine obj->align which will be used to _Ipc_roundup addresses */
    memReq = ((_Ipc_roundup(sizeof(NotifyDriverShm_ProcCtrl), minAlign)) * 2)
           + ((_Ipc_roundup(sizeof(NotifyDriverShm_EventEntry), minAlign) * 2
              * ti_sdo_ipc_Notify_numEvents));

    return (memReq);
}
Exemple #5
0
/*
 *  ======== SemaphoreMP_sharedMemReq ========
 */
SizeT SemaphoreMP_sharedMemReq(const SemaphoreMP_Params *params)
{
    SizeT memReq, minAlign;
    ListMP_Params listMPParams;
    UInt16 regionId;
    
    if (params->sharedAddr == NULL) {
        regionId = params->regionId;
    }
    else {
        regionId = SharedRegion_getId(params->sharedAddr);
    }
    
    Assert_isTrue(regionId != SharedRegion_INVALIDREGIONID, 
            ti_sdo_ipc_Ipc_A_internal);
            
    minAlign = SharedRegion_getCacheLineSize(regionId);
    
    memReq = _Ipc_roundup(sizeof(SemaphoreMP_Attrs), minAlign);
    
    /*
     *  Add size of ListMP Attrs.  No need to init params since it's not used
     *  to create.
     */
    ListMP_Params_init(&listMPParams);
    listMPParams.regionId = regionId;
    memReq += ListMP_sharedMemReq(&listMPParams);
    
    return (memReq);
}
Exemple #6
0
/*
 *  ======== GatePetersonN_sharedMemReq ========
 */
SizeT GatePetersonN_sharedMemReq(const IGateMPSupport_Params *params)
{
    SizeT  memReq;
    UInt16 numProcessors = MultiProc_getNumProcsInCluster(); /* Cluster aware */
    SizeT  minAlign = Memory_getMaxDefaultTypeAlign();

    if (SharedRegion_getCacheLineSize(params->regionId) > minAlign) {
            minAlign = SharedRegion_getCacheLineSize(params->regionId);
    }

    /*  Allocate aligned memory for shared state variables used in protocol
     *      enteredStage[NUM_PROCESSORS]
     *	    lastProcEnteringStage[NUM_STAGES]
     */
    memReq = ((2 * numProcessors) - 1) *
              SharedRegion_getCacheLineSize(params->regionId);

    return(memReq);
}
Exemple #7
0
/*
 *  ======== Ipc_readConfig ========
 */
Int Ipc_readConfig(UInt16 remoteProcId, UInt32 tag, Ptr cfg, SizeT size)
{
    Int status = Ipc_E_FAIL;
    UInt16 clusterId = ti_sdo_utils_MultiProc_getClusterId(remoteProcId);
    volatile ti_sdo_ipc_Ipc_ConfigEntry *entry;
    Bool cacheEnabled = SharedRegion_isCacheEnabled(0);

    /* Assert that the remoteProc in our cluster and isn't our own */
    Assert_isTrue(clusterId < ti_sdo_utils_MultiProc_numProcsInCluster,
                  ti_sdo_utils_MultiProc_A_invalidMultiProcId);

    if (cacheEnabled) {
        Cache_inv(Ipc_module->procEntry[clusterId].remoteConfigList,
                  SharedRegion_getCacheLineSize(0),
                  Cache_Type_ALL,
                  TRUE);
    }

    entry = (ti_sdo_ipc_Ipc_ConfigEntry *)
            *Ipc_module->procEntry[clusterId].remoteConfigList;

    while ((SharedRegion_SRPtr)entry != ti_sdo_ipc_SharedRegion_INVALIDSRPTR) {
        entry = (ti_sdo_ipc_Ipc_ConfigEntry *)
                SharedRegion_getPtr((SharedRegion_SRPtr)entry);

        /* Traverse the list to find the tag */
        if (cacheEnabled) {
            Cache_inv((Ptr)entry,
                      size + sizeof(ti_sdo_ipc_Ipc_ConfigEntry),
                      Cache_Type_ALL,
                      TRUE);
        }

        if ((entry->remoteProcId == MultiProc_self()) &&
            (entry->localProcId == remoteProcId) &&
            (entry->tag == tag)) {

            if (size == entry->size) {
                memcpy(cfg, (Ptr)((UInt32)entry + sizeof(ti_sdo_ipc_Ipc_ConfigEntry)),
                        entry->size);
                return (Ipc_S_SUCCESS);
            }
            else {
                return (Ipc_E_FAIL);
            }
        }

        entry = (ti_sdo_ipc_Ipc_ConfigEntry *)entry->next;
    }

    return (status);
}
Exemple #8
0
/*
 *  ======== ti_sdo_ipc_Ipc_reservedSizePerProc ========
 */
SizeT ti_sdo_ipc_Ipc_reservedSizePerProc(Void)
{
    SizeT reservedSize = sizeof(ti_sdo_ipc_Ipc_Reserved) *
            ti_sdo_utils_MultiProc_numProcsInCluster;
    SizeT cacheLineSize = SharedRegion_getCacheLineSize(0);

    /* Calculate amount to reserve per processor */
    if (cacheLineSize > reservedSize) {
        /* Use cacheLineSize if larger than reservedSize */
        reservedSize = cacheLineSize;
    }
    else {
        /* Round reservedSize to cacheLineSize */
        reservedSize = _Ipc_roundup(reservedSize, cacheLineSize);
    }

    return (reservedSize);
}
Exemple #9
0
/*
 *  ======== Ipc_attach ========
 */
Int Ipc_attach(UInt16 remoteProcId)
{
    Int i;
    Ptr sharedAddr;
    SizeT memReq;
    volatile ti_sdo_ipc_Ipc_Reserved *slave;
    ti_sdo_ipc_Ipc_ProcEntry *ipc;
    Error_Block eb;
    SharedRegion_Entry entry;
    SizeT reservedSize = ti_sdo_ipc_Ipc_reservedSizePerProc();
    Bool cacheEnabled = SharedRegion_isCacheEnabled(0);
    UInt16 clusterId = ti_sdo_utils_MultiProc_getClusterId(remoteProcId);
    Int status;
    UInt hwiKey;

    /* Assert remoteProcId is in our cluster and isn't our own */
    Assert_isTrue(clusterId < ti_sdo_utils_MultiProc_numProcsInCluster,
                  ti_sdo_utils_MultiProc_A_invalidMultiProcId);
    Assert_isTrue(remoteProcId != MultiProc_self(),
                  ti_sdo_ipc_Ipc_A_invArgument);

    /* Check whether Ipc_start has been called.  If not, fail. */
    if (Ipc_module->ipcSharedAddr == NULL) {
        return (Ipc_E_FAIL);
    }

    /* for checking and incrementing attached below */
    hwiKey = Hwi_disable();

    /* Make sure its not already attached */
    if (Ipc_module->procEntry[clusterId].attached) {
        Ipc_module->procEntry[clusterId].attached++;
        /* restore interrupts and return */
        Hwi_restore(hwiKey);
        return (Ipc_S_ALREADYSETUP);
    }

    /* restore interrupts */
    Hwi_restore(hwiKey);

    /* get region 0 information */
    SharedRegion_getEntry(0, &entry);

    /* Make sure we've attached to owner of SR0 if we're not owner */
    if ((MultiProc_self() != entry.ownerProcId) &&
        (remoteProcId != entry.ownerProcId) &&
        !(Ipc_module->procEntry[ti_sdo_utils_MultiProc_getClusterId(
            entry.ownerProcId)].attached)) {
        return (Ipc_E_FAIL);
    }

    /* Init error block */
    Error_init(&eb);

    /* determine the slave's slot */
    slave = Ipc_getSlaveAddr(remoteProcId, Ipc_module->ipcSharedAddr);

    if (cacheEnabled) {
        Cache_inv((Ptr)slave, reservedSize, Cache_Type_ALL, TRUE);
    }

    /* Synchronize the processors. */
    status = Ipc_procSyncStart(remoteProcId, Ipc_module->ipcSharedAddr);
    if (status < 0) {
        return (status);
    }

    /* must be called before SharedRegion_attach */
    status = ti_sdo_ipc_GateMP_attach(remoteProcId,
            Ipc_module->gateMPSharedAddr);
    if (status < 0) {
        return (status);
    }

    /* retrieves the SharedRegion Heap handles */
    status = ti_sdo_ipc_SharedRegion_attach(remoteProcId);
    if (status < 0) {
        return (status);
    }

    /* get the attach parameters associated with remoteProcId */
    ipc = &(Ipc_module->procEntry[clusterId]);

    /* attach Notify if not yet attached and specified to set internal setup */
    if (!(Notify_intLineRegistered(remoteProcId, 0)) &&
        (ipc->entry.setupNotify)) {
        /* call Notify_attach */
        memReq = Notify_sharedMemReq(remoteProcId, Ipc_module->ipcSharedAddr);
        if (memReq != 0) {
            if (MultiProc_self() < remoteProcId) {
                /*
                 *  calloc required here due to race condition.  Its possible
                 *  that the slave, who creates the instance, tries a sendEvent
                 *  before the master has created its instance because the
                 *  state of memory was enabled from a previous run.
                 */
                sharedAddr = Memory_calloc(SharedRegion_getHeap(0),
                                       memReq,
                                       SharedRegion_getCacheLineSize(0),
                                       &eb);

                /* make sure alloc did not fail */
                if (sharedAddr == NULL) {
                    return (Ipc_E_MEMORY);
                }

                /* if cache enabled, wbInv the calloc above */
                if (cacheEnabled) {
                    Cache_wbInv(sharedAddr, memReq, Cache_Type_ALL, TRUE);
                }

                /* set the notify SRPtr */
                slave->notifySRPtr = SharedRegion_getSRPtr(sharedAddr, 0);
            }
            else {
                /* get the notify SRPtr */
                sharedAddr = SharedRegion_getPtr(slave->notifySRPtr);
            }
        }
        else {
            sharedAddr = NULL;
            slave->notifySRPtr = 0;
        }

        /* call attach to remote processor */
        status = Notify_attach(remoteProcId, sharedAddr);

        if (status < 0) {
            if (MultiProc_self() < remoteProcId && sharedAddr != NULL) {
                /* free the memory back to SharedRegion 0 heap */
                Memory_free(SharedRegion_getHeap(0), sharedAddr, memReq);
            }

            return (Ipc_E_FAIL);
        }
    }

    /* Must come after GateMP_start because depends on default GateMP */
    if (!(ti_sdo_utils_NameServer_isRegistered(remoteProcId)) &&
        (ipc->entry.setupNotify)) {
        memReq = ti_sdo_utils_NameServer_SetupProxy_sharedMemReq(
            Ipc_module->ipcSharedAddr);
        if (memReq != 0) {
            if (MultiProc_self() < remoteProcId) {
                sharedAddr = Memory_alloc(SharedRegion_getHeap(0),
                                     memReq,
                                     SharedRegion_getCacheLineSize(0),
                                     &eb);

                /* make sure alloc did not fail */
                if (sharedAddr == NULL) {
                    return (Ipc_E_MEMORY);
                }

                /* set the NSRN SRPtr */
                slave->nsrnSRPtr = SharedRegion_getSRPtr(sharedAddr, 0);
            }
            else {
                /* get the NSRN SRPtr */
                sharedAddr = SharedRegion_getPtr(slave->nsrnSRPtr);
            }
        }
        else {
            sharedAddr = NULL;
            slave->nsrnSRPtr = 0;
        }

        /* call attach to remote processor */
        status = ti_sdo_utils_NameServer_SetupProxy_attach(remoteProcId,
                                                           sharedAddr);

        if (status < 0) {
            if (MultiProc_self() < remoteProcId && sharedAddr != NULL) {
                /* free the memory back to SharedRegion 0 heap */
                Memory_free(SharedRegion_getHeap(0), sharedAddr, memReq);
            }

            return (Ipc_E_FAIL);
        }
    }

    /* Must come after GateMP_start because depends on default GateMP */
    if (!(ti_sdo_ipc_MessageQ_SetupTransportProxy_isRegistered(remoteProcId)) &&
        (ipc->entry.setupMessageQ)) {
        memReq = ti_sdo_ipc_MessageQ_SetupTransportProxy_sharedMemReq(
            Ipc_module->ipcSharedAddr);

        if (memReq != 0) {
            if (MultiProc_self() < remoteProcId) {
                sharedAddr = Memory_alloc(SharedRegion_getHeap(0),
                    memReq, SharedRegion_getCacheLineSize(0), &eb);

                /* make sure alloc did not fail */
                if (sharedAddr == NULL) {
                    return (Ipc_E_MEMORY);
                }

                /* set the transport SRPtr */
                slave->transportSRPtr = SharedRegion_getSRPtr(sharedAddr, 0);
            }
            else {
                /* get the transport SRPtr */
                sharedAddr = SharedRegion_getPtr(slave->transportSRPtr);
            }
        }
        else {
            sharedAddr = NULL;
            slave->transportSRPtr = 0;
        }

        /* call attach to remote processor */
        status = ti_sdo_ipc_MessageQ_SetupTransportProxy_attach(remoteProcId,
            sharedAddr);

        if (status < 0) {
            if (MultiProc_self() < remoteProcId && sharedAddr != NULL) {
                /* free the memory back to SharedRegion 0 heap */
                Memory_free(SharedRegion_getHeap(0), sharedAddr, memReq);
            }

            return (Ipc_E_FAIL);
        }
    }

    /* writeback invalidate slave's shared memory if cache enabled */
    if (cacheEnabled) {
        if (MultiProc_self() < remoteProcId) {
            Cache_wbInv((Ptr)slave, reservedSize, Cache_Type_ALL, TRUE);
        }
    }

    /* Call user attach fxns */
    for (i = 0; i < ti_sdo_ipc_Ipc_numUserFxns; i++) {
        if (ti_sdo_ipc_Ipc_userFxns[i].userFxn.attach) {
            status = ti_sdo_ipc_Ipc_userFxns[i].userFxn.attach(
                ti_sdo_ipc_Ipc_userFxns[i].arg, remoteProcId);

            if (status < 0) {
                return (status);
            }
        }
    }

    /* Finish the processor synchronization */
    status = ti_sdo_ipc_Ipc_procSyncFinish(remoteProcId,
        Ipc_module->ipcSharedAddr);

    if (status < 0) {
        return (status);
    }

    /* for atomically incrementing attached */
    hwiKey = Hwi_disable();

    /* now attached to remote processor */
    Ipc_module->procEntry[clusterId].attached++;

    /* restore interrupts */
    Hwi_restore(hwiKey);

    return (status);
}
Exemple #10
0
/*
 *  ======== Ipc_writeConfig ========
 */
Int Ipc_writeConfig(UInt16 remoteProcId, UInt32 tag, Ptr cfg, SizeT size)
{
    Int status = Ipc_S_SUCCESS;
    UInt16 clusterId = ti_sdo_utils_MultiProc_getClusterId(remoteProcId);
    SharedRegion_SRPtr curSRPtr, *prevSRPtr;
    ti_sdo_ipc_Ipc_ConfigEntry *entry;
    Error_Block eb;
    Bool cacheEnabled = SharedRegion_isCacheEnabled(0);

    /* Assert that the remoteProc in our cluster */
    Assert_isTrue(clusterId < ti_sdo_utils_MultiProc_numProcsInCluster,
                  ti_sdo_utils_MultiProc_A_invalidMultiProcId);

    Error_init(&eb);

    if (cfg == NULL) {
        status = Ipc_E_FAIL;

        /* get head of local config list and set prevSRPtr to it */
        prevSRPtr = (Ipc_module->procEntry[clusterId].localConfigList);

        /* 
         *  When cfg is NULL, the last memory allocated from a previous
         *  Ipc_writeConfig call with the same remoteProcId, tag, and size
         *  is freed.
         */
        curSRPtr = *prevSRPtr;

        /* loop through list of config entries until matching entry is found */
        while (curSRPtr != ti_sdo_ipc_SharedRegion_INVALIDSRPTR) {
            /* convert Ptr associated with curSRPtr */
            entry = (ti_sdo_ipc_Ipc_ConfigEntry *)
                    (SharedRegion_getPtr(curSRPtr));

            /* make sure entry matches remoteProcId, tag, and size */
            if ((entry->remoteProcId == remoteProcId) &&
                (entry->tag == tag) &&
                (entry->size == size)) {
                /* Update the 'prev' next ptr */
                *prevSRPtr = (SharedRegion_SRPtr)entry->next;

                /* writeback the 'prev' ptr */
                if (cacheEnabled) {
                    Cache_wb(prevSRPtr,
                        sizeof(ti_sdo_ipc_Ipc_ConfigEntry),
                        Cache_Type_ALL,
                        FALSE);
                }

                /* free entry's memory back to shared heap */
                Memory_free(SharedRegion_getHeap(0),
                    entry,
                    size + sizeof(ti_sdo_ipc_Ipc_ConfigEntry));

                /* set the status to success */
                status = Ipc_S_SUCCESS;
                break;
            }

            /* set the 'prev' to the 'cur' SRPtr */
            prevSRPtr = (SharedRegion_SRPtr *)(&entry->next);

            /* point to next config entry */
            curSRPtr = (SharedRegion_SRPtr)entry->next;
        }

        /* return that status */
        return (status);
    }

    /* Allocate memory from the shared heap (System Heap) */
    entry = Memory_alloc(SharedRegion_getHeap(0),
                         size + sizeof(ti_sdo_ipc_Ipc_ConfigEntry),
                         SharedRegion_getCacheLineSize(0),
                         &eb);

    if (entry == NULL) {
        return (Ipc_E_FAIL);
    }

    /* set the entry */
    entry->remoteProcId = remoteProcId;
    entry->localProcId = MultiProc_self();
    entry->tag = tag;
    entry->size = size;
    memcpy((Ptr)((UInt32)entry + sizeof(ti_sdo_ipc_Ipc_ConfigEntry)), cfg,
                  size);
        
    /* point the entry's next to the first entry in the list */
    entry->next = *Ipc_module->procEntry[clusterId].localConfigList;

    /* first write-back the entry if cache is enabled */
    if (cacheEnabled) {
        Cache_wb(entry, size + sizeof(ti_sdo_ipc_Ipc_ConfigEntry),
                 Cache_Type_ALL,
                 FALSE);
    }

    /* set the entry as the new first in the list */
    *Ipc_module->procEntry[clusterId].localConfigList =
        SharedRegion_getSRPtr(entry, 0);

    /* write-back the config list */
    if (cacheEnabled) {
        Cache_wb(Ipc_module->procEntry[clusterId].localConfigList, 
                 SharedRegion_getCacheLineSize(0), 
                 Cache_Type_ALL, 
                 FALSE);
    }

    return (status);
}
Exemple #11
0
/*
 *  ======== ti_sdo_ipc_ListMP_Instance_init ========
 */
Int ti_sdo_ipc_ListMP_Instance_init(ti_sdo_ipc_ListMP_Object *obj,
        const ti_sdo_ipc_ListMP_Params *params,
        Error_Block *eb)
{
    SharedRegion_SRPtr sharedShmBase;
    Ptr localAddr;
    Int status;
    ListMP_Params sparams;
    IHeap_Handle regionHeap;

    if (params->openFlag == TRUE) {
        /* Open by sharedAddr */
        obj->objType = ti_sdo_ipc_Ipc_ObjType_OPENDYNAMIC;
        obj->attrs = (ti_sdo_ipc_ListMP_Attrs *)params->sharedAddr;
        obj->regionId = SharedRegion_getId(&(obj->attrs->head));
        obj->cacheEnabled = SharedRegion_isCacheEnabled(obj->regionId);
        obj->cacheLineSize = SharedRegion_getCacheLineSize(obj->regionId);
    
        /* get the local address of the SRPtr */
        localAddr = SharedRegion_getPtr(obj->attrs->gateMPAddr);
        
        status = GateMP_openByAddr(localAddr, (GateMP_Handle *)&(obj->gate));
        if (status != GateMP_S_SUCCESS) {
            Error_raise(eb, ti_sdo_ipc_Ipc_E_internal, 0, 0);
            return (1);
        }
        
        return (0);
    }

    /* init the gate */
    if (params->gate != NULL) {
        obj->gate = params->gate;
    }
    else {
        obj->gate = (ti_sdo_ipc_GateMP_Handle)GateMP_getDefaultRemote();
    }
    
    if (params->sharedAddr == NULL) {
        /* Creating using a shared region ID */                
        obj->objType = ti_sdo_ipc_Ipc_ObjType_CREATEDYNAMIC_REGION;
        obj->regionId = params->regionId;
        obj->cacheEnabled = SharedRegion_isCacheEnabled(obj->regionId);
        obj->cacheLineSize = SharedRegion_getCacheLineSize(obj->regionId);
                
        /* Need to allocate from the heap */
        ListMP_Params_init(&sparams);
        sparams.regionId = params->regionId;
        obj->allocSize = ListMP_sharedMemReq(&sparams);
            
        regionHeap = SharedRegion_getHeap(obj->regionId);
        Assert_isTrue(regionHeap != NULL, ti_sdo_ipc_SharedRegion_A_noHeap);

        /* The region heap will take care of the alignment */
        obj->attrs = Memory_alloc(regionHeap, obj->allocSize, 0, eb);

        if (obj->attrs == NULL) {
            return (2);
        }
    }
    else {
        /* Creating using sharedAddr */
        obj->regionId = SharedRegion_getId(params->sharedAddr);
            
        /* Assert that the buffer is in a valid shared region */
        Assert_isTrue(obj->regionId != SharedRegion_INVALIDREGIONID, 
                      ti_sdo_ipc_Ipc_A_addrNotInSharedRegion);
                        
        /* set object's cacheEnabled, objType, and attrs  */
        obj->cacheEnabled = SharedRegion_isCacheEnabled(obj->regionId);
        obj->cacheLineSize = SharedRegion_getCacheLineSize(obj->regionId);
        obj->objType = ti_sdo_ipc_Ipc_ObjType_CREATEDYNAMIC;
        obj->attrs = (ti_sdo_ipc_ListMP_Attrs *)params->sharedAddr;

        /* Assert that sharedAddr is cache aligned */
        Assert_isTrue((obj->cacheLineSize == 0) ||
                      ((UInt32)params->sharedAddr % obj->cacheLineSize == 0),
                      ti_sdo_ipc_Ipc_A_addrNotCacheAligned);
    }

    /* init the head (to be empty) */
    ListMP_elemClear(&(obj->attrs->head));
       
    /* store the GateMP sharedAddr in the Attrs */
    obj->attrs->gateMPAddr = ti_sdo_ipc_GateMP_getSharedAddr(obj->gate);

    /* last thing, set the status */
    obj->attrs->status = ti_sdo_ipc_ListMP_CREATED;
        
    if (obj->cacheEnabled) {
        Cache_wbInv(obj->attrs, sizeof(ti_sdo_ipc_ListMP_Attrs), 
                Cache_Type_ALL, TRUE);
    }
        
    /* add to NameServer if name not NULL */
    if (params->name != NULL) {
        sharedShmBase = SharedRegion_getSRPtr(obj->attrs, obj->regionId);
        obj->nsKey = NameServer_addUInt32(
            (NameServer_Handle)ListMP_module->nameServer, params->name,
            (UInt32)sharedShmBase);
        
        if (obj->nsKey == NULL) {
            Error_raise(eb, ti_sdo_ipc_Ipc_E_nameFailed, params->name, 0);
            return (3);
        }
    }

    return (0);
}
Exemple #12
0
/*
 *  ======== NotifyDriverShm_Instance_init ========
 */
Int NotifyDriverShm_Instance_init(NotifyDriverShm_Object *obj,
                                  const NotifyDriverShm_Params *params,
                                  Error_Block *eb)
{
    UInt16 regionId;
    SizeT regionCacheSize, minAlign, procCtrlSize;
    
   /*
    * Check whether remote proc ID has been set and isn't the same as the
    * local proc ID
    */
    Assert_isTrue ((params->remoteProcId != MultiProc_INVALIDID) &&
                   (params->remoteProcId != MultiProc_self()),
                   ti_sdo_ipc_Ipc_A_invParam);
                   
    /* 
     *  Determine obj->cacheEnabled using params->cacheEnabled and SharedRegion
     *  cache flag setting, if applicable.
     */
    obj->cacheEnabled = params->cacheEnabled;
    minAlign = params->cacheLineSize;
    if (minAlign == 0) {
        /* Fix alignment of zero */
        minAlign = sizeof(Ptr);
    }
    regionId = SharedRegion_getId(params->sharedAddr);
    if (regionId != SharedRegion_INVALIDREGIONID) {
        /* 
         *  Override the user cacheEnabled setting if the region 
         *  cacheEnabled is FALSE.
         */
        if (!SharedRegion_isCacheEnabled(regionId)) {
            obj->cacheEnabled = FALSE;
        }
        
        regionCacheSize = SharedRegion_getCacheLineSize(regionId);
        
        /* 
         *  Override the user cache line size setting if the region 
         *  cache line size is smaller.
         */
        if (regionCacheSize < minAlign) {
            minAlign = regionCacheSize;
        }
    }
    
    /* Check if shared memory base addr is aligned to cache line boundary.*/
    Assert_isTrue ((UInt32)params->sharedAddr % minAlign == 0, 
        ti_sdo_ipc_Ipc_A_addrNotCacheAligned);
    
    obj->remoteProcId           = params->remoteProcId;

    /* 
     *  Store all interrupt information so it may be used (if neccessary) by
     *  the IInterrupt delegates
     */
    obj->intInfo.remoteIntId    = params->remoteIntId;
    obj->intInfo.localIntId     = params->localIntId;
    obj->intInfo.intVectorId    = params->intVectorId;

    obj->nesting            = 0;

    if (params->remoteProcId > MultiProc_self()) {
        obj->selfId  = 0;
        obj->otherId = 1;
    }
    else {
        obj->selfId  = 1;
        obj->otherId = 0;
    }
    
    /* Initialize pointers to shared memory regions */
    procCtrlSize = _Ipc_roundup(sizeof(NotifyDriverShm_ProcCtrl), minAlign);

    /* 
     *  Save the eventEntrySize in obj since we will need it at runtime to 
     *  index the event charts
     */
    obj->eventEntrySize = _Ipc_roundup(sizeof(NotifyDriverShm_EventEntry), 
        minAlign);
    
    obj->selfProcCtrl = (NotifyDriverShm_ProcCtrl *)
        ((UInt32)params->sharedAddr + (obj->selfId * procCtrlSize));
    obj->otherProcCtrl = (NotifyDriverShm_ProcCtrl *)
        ((UInt32)params->sharedAddr + (obj->otherId * procCtrlSize));
    obj->selfEventChart  = (NotifyDriverShm_EventEntry *)
        ((UInt32)params->sharedAddr
         + (2 * procCtrlSize)
         + (obj->eventEntrySize * ti_sdo_ipc_Notify_numEvents * obj->selfId));
    obj->otherEventChart  = (NotifyDriverShm_EventEntry *)
         ((UInt32)params->sharedAddr
         + (2 * procCtrlSize)
         + (obj->eventEntrySize * ti_sdo_ipc_Notify_numEvents * obj->otherId));

    /* Allocate memory for regChart and init to (UInt32)-1 (unregistered) */
    obj->regChart = Memory_valloc(
            NotifyDriverShm_Object_heap(),
            (sizeof(UInt32) * ti_sdo_ipc_Notify_numEvents),
            NULL,
            ~0,
            eb);
    if (obj->regChart == NULL) { 
        return (1);
    }

    /* Enable all events initially.*/
    obj->selfProcCtrl->eventEnableMask = 0xFFFFFFFF;
    
    /* Write back our own ProcCtrl */
    if (obj->cacheEnabled) {
        Cache_wbInv(obj->selfProcCtrl, sizeof(NotifyDriverShm_ProcCtrl),
            Cache_Type_ALL, TRUE);
    }

    /* Register the incoming interrupt */
    NotifyDriverShm_InterruptProxy_intRegister(obj->remoteProcId, 
        &(obj->intInfo), (Fxn)NotifyDriverShm_isr, (UArg)obj);

    return (0);
}
Exemple #13
0
/*
 *  ======== SemaphoreMP_Instance_init ========
 */
Int SemaphoreMP_Instance_init(SemaphoreMP_Object *obj, Int count,
        const SemaphoreMP_Params *params, Error_Block *eb)
{
    Ptr localAddr;
    Int status;
    IHeap_Handle regionHeap;
    ListMP_Params listMPParams;
    SharedRegion_SRPtr sharedShmBase;
    
    if (params->openFlag) {
        /* Open by sharedAddr */
        obj->objType = ti_sdo_ipc_Ipc_ObjType_OPENDYNAMIC;
        obj->attrs = (SemaphoreMP_Attrs *)params->sharedAddr;
        obj->regionId = SharedRegion_getId(obj->attrs);
        obj->cacheEnabled = SharedRegion_isCacheEnabled(obj->regionId);
    
        obj->mode = (SemaphoreMP_Mode)obj->attrs->mode;
    
        regionHeap = SharedRegion_getHeap(obj->regionId);
        Assert_isTrue(regionHeap != NULL, ti_sdo_ipc_SharedRegion_A_noHeap);
    
        /* get the local address of the SRPtr */
        localAddr = SharedRegion_getPtr(obj->attrs->gateMPAddr);
        status = GateMP_openByAddr(localAddr, (GateMP_Handle *)&(obj->gate));
        if (status < 0) {
            return (1);
        }
        
        /* Open the ListMP */
        localAddr = (Ptr)_Ipc_roundup(
            (UInt32)obj->attrs + sizeof(SemaphoreMP_Attrs), 
            SharedRegion_getCacheLineSize(obj->regionId));
        status = ListMP_openByAddr(localAddr, (ListMP_Handle *)&(obj->pendQ));
        if (status < 0) {
            /* obj->freeList set to NULL */
            return (4);
        }

        return (0);
    }

    /* init the gate */
    if (params->gate != NULL) {
        obj->gate = params->gate;
    }
    else {
        obj->gate = (ti_sdo_ipc_GateMP_Handle)GateMP_getDefaultRemote();
    }
    obj->mode = params->mode;
    
    if (params->sharedAddr == NULL) {
        /* Creating using a shared region ID */                
        obj->objType = ti_sdo_ipc_Ipc_ObjType_CREATEDYNAMIC_REGION;
        obj->regionId = params->regionId;
        obj->cacheEnabled = SharedRegion_isCacheEnabled(obj->regionId);
                
        /* Need to allocate from the heap */
        obj->allocSize = SemaphoreMP_sharedMemReq(params);
            
        regionHeap = SharedRegion_getHeap(obj->regionId);
        Assert_isTrue(regionHeap != NULL, ti_sdo_ipc_SharedRegion_A_noHeap);

        /* The region heap will take care of the alignment */
        obj->attrs = Memory_alloc(regionHeap, obj->allocSize, 0, eb);
        if (obj->attrs == NULL) {
            return (2);
        }
    }
    else {
        /* Creating using sharedAddr */
        obj->regionId = SharedRegion_getId(params->sharedAddr);
                    
        /* Assert that the buffer is in a valid shared region */
        Assert_isTrue(obj->regionId != SharedRegion_INVALIDREGIONID, 
                      ti_sdo_ipc_Ipc_A_addrNotInSharedRegion);
        
        /* Assert that sharedAddr is cache aligned */
        Assert_isTrue(((UInt32)params->sharedAddr % 
                      SharedRegion_getCacheLineSize(obj->regionId) == 0),
                      ti_sdo_ipc_Ipc_A_addrNotCacheAligned);
                
        /* set object's cacheEnabled, objType, and attrs  */
        obj->cacheEnabled = SharedRegion_isCacheEnabled(obj->regionId);
        obj->objType = ti_sdo_ipc_Ipc_ObjType_CREATEDYNAMIC;
        obj->attrs = (SemaphoreMP_Attrs *)params->sharedAddr;
    }
    
    /* Store the GateMP sharedAddr in the SemaphoreMP Attrs */
    obj->attrs->gateMPAddr = ti_sdo_ipc_GateMP_getSharedAddr(obj->gate);
    obj->attrs->mode = (Bits16)obj->mode;
    obj->attrs->count = count;
    
    /* Create the freeList */
    ListMP_Params_init(&listMPParams);
    listMPParams.sharedAddr = (Ptr)_Ipc_roundup((UInt32)obj->attrs +
            sizeof(SemaphoreMP_Attrs), 
            SharedRegion_getCacheLineSize(obj->regionId));
    listMPParams.gate = (GateMP_Handle)obj->gate;
    obj->pendQ = (ti_sdo_ipc_ListMP_Handle)ListMP_create(&listMPParams);
    if (obj->pendQ == NULL) {
        return (3);
    }
    
    /* Last thing, set the status */
    obj->attrs->status = SemaphoreMP_CREATED;
    if (obj->cacheEnabled) {
        Cache_wbInv(obj->attrs, sizeof(SemaphoreMP_Attrs), Cache_Type_ALL, 
                TRUE);
    }
    
    /* Add entry to NameServer */
    if (params->name != NULL) {
        /* We will store a shared pointer in the NameServer */
        sharedShmBase = SharedRegion_getSRPtr(obj->attrs,
                                              obj->regionId);
        obj->nsKey = NameServer_addUInt32((NameServer_Handle)
                SemaphoreMP_module->nameServer, params->name,
                (UInt32)sharedShmBase);
        if (obj->nsKey == NULL) {
            /* NameServer_addUInt32 failed */
            return (4); 
        }
    }
    
    return (0);
}
Exemple #14
0
/*
 *  ======== TransportShm_Instance_finalize ========
 */
Void TransportShm_Instance_finalize(TransportShm_Object* obj, Int status)
{
    Swi_Handle     swiHandle;

    if (obj->objType == ti_sdo_ipc_Ipc_ObjType_CREATEDYNAMIC) {
        /* clear the self flag */
        obj->self->flag = 0;

        if (obj->cacheEnabled) {
            Cache_wbInv(&(obj->self->flag),
                SharedRegion_getCacheLineSize(obj->regionId), Cache_Type_ALL,
                    TRUE);
        }

        if (obj->localList != NULL) {
            ListMP_delete((ListMP_Handle *)&(obj->localList));
        }

        if (obj->remoteList != NULL) {
            ListMP_delete((ListMP_Handle *)&(obj->remoteList));
        }
    }
    else {
        /* other flag was set by remote proc */
        obj->other->flag = 0;

        if (obj->cacheEnabled) {
            Cache_wbInv(&(obj->other->flag),
                SharedRegion_getCacheLineSize(obj->regionId), Cache_Type_ALL,
                    TRUE);
        }

        if (obj->gate != NULL) {
            GateMP_close((GateMP_Handle *)&(obj->gate));
        }

        if (obj->localList != NULL) {
            ListMP_close((ListMP_Handle *)&(obj->localList));
        }

        if (obj->remoteList != NULL) {
            ListMP_close((ListMP_Handle *)&(obj->remoteList));
        }
    }

    switch(status) {
        case 0:
            /* MessageQ_registerTransport succeeded */
            ti_sdo_ipc_MessageQ_unregisterTransport(obj->remoteProcId, obj->priority);
            /* OK to fall through */
        case 1: /* GateMP open failed */
        case 2: /* ListMP create/open failed */
        case 3: /* Notify_registerEventSingle failed */
        case 4: /* MessageQ_registerTransport failed */
            Notify_unregisterEventSingle(
                obj->remoteProcId,
                0,
                TransportShm_notifyEventId);
            break;
    }

    /* Destruct the swi */
    swiHandle = TransportShm_Instance_State_swiObj(obj);
    if (swiHandle != NULL) {
        Swi_destruct(Swi_struct(swiHandle));
    }
}
Exemple #15
0
/*
 *  ======== TransportShm_Instance_init ========
 */
Int TransportShm_Instance_init(TransportShm_Object *obj,
        UInt16 procId, const TransportShm_Params *params,
        Error_Block *eb)
{
    Int            localIndex;
    Int            remoteIndex;
    Int            status;
    Bool           flag;
    UInt32         minAlign;
    ListMP_Params  listMPParams[2];
    Swi_Handle     swiHandle;
    Swi_Params     swiParams;
    Ptr            localAddr;

    swiHandle = TransportShm_Instance_State_swiObj(obj);

    /*
     *  Determine who gets the '0' slot in shared memory and who gets
     *  the '1' slot. The '0' slot is given to the lower MultiProc id.
     */
    if (MultiProc_self() < procId) {
        localIndex  = 0;
        remoteIndex = 1;
    }
    else {
        localIndex  = 1;
        remoteIndex = 0;
    }

    if (params->openFlag) {
        /* Open by sharedAddr */
        obj->objType = ti_sdo_ipc_Ipc_ObjType_OPENDYNAMIC;
        obj->self = (TransportShm_Attrs *)params->sharedAddr;
        obj->regionId = SharedRegion_getId(params->sharedAddr);
        obj->cacheEnabled = SharedRegion_isCacheEnabled(obj->regionId);

        localAddr = SharedRegion_getPtr(obj->self->gateMPAddr);
        status = GateMP_openByAddr(localAddr, (GateMP_Handle *)&obj->gate);
        if (status < 0) {
            Error_raise(eb, ti_sdo_ipc_Ipc_E_internal, 0, 0);
            return(1);
        }
    }
    else {
        /* init the gate for ListMP create below */
        if (params->gate != NULL) {
            obj->gate = params->gate;
        }
        else {
            obj->gate = (ti_sdo_ipc_GateMP_Handle)GateMP_getDefaultRemote();
        }

        /* Creating using sharedAddr */
        obj->regionId = SharedRegion_getId(params->sharedAddr);

        /* Assert that the buffer is in a valid shared region */
        Assert_isTrue(obj->regionId != SharedRegion_INVALIDREGIONID,
                ti_sdo_ipc_Ipc_A_addrNotInSharedRegion);

        /* Assert that sharedAddr is cache aligned */
        Assert_isTrue(((UInt32)params->sharedAddr %
                SharedRegion_getCacheLineSize(obj->regionId) == 0),
                ti_sdo_ipc_Ipc_A_addrNotCacheAligned);

        /* set object's cacheEnabled, type, self */
        obj->cacheEnabled = SharedRegion_isCacheEnabled(obj->regionId);
        obj->objType = ti_sdo_ipc_Ipc_ObjType_CREATEDYNAMIC;
        obj->self = (TransportShm_Attrs *)params->sharedAddr;
    }

    /* determine the minimum alignment to align to */
    minAlign = Memory_getMaxDefaultTypeAlign();
    if (SharedRegion_getCacheLineSize(obj->regionId) > minAlign) {
        minAlign = SharedRegion_getCacheLineSize(obj->regionId);
    }

    /*
     *  Carve up the shared memory.
     *  If cache is enabled, these need to be on separate cache lines.
     *  This is done with minAlign and _Ipc_roundup function.
     */
    obj->other = (TransportShm_Attrs *)((UInt32)(obj->self) +
        (_Ipc_roundup(sizeof(TransportShm_Attrs), minAlign)));

    ListMP_Params_init(&(listMPParams[0]));
    listMPParams[0].gate = (GateMP_Handle)obj->gate;
    listMPParams[0].sharedAddr = (UInt32 *)((UInt32)(obj->other) +
        (_Ipc_roundup(sizeof(TransportShm_Attrs), minAlign)));

    ListMP_Params_init(&listMPParams[1]);
    listMPParams[1].gate = (GateMP_Handle)obj->gate;
    listMPParams[1].sharedAddr = (UInt32 *)((UInt32)(listMPParams[0].sharedAddr)
        + ListMP_sharedMemReq(&listMPParams[0]));

    obj->priority      = params->priority;
    obj->remoteProcId  = procId;

    Swi_Params_init(&swiParams);
    swiParams.arg0 = (UArg)obj;
    Swi_construct(Swi_struct(swiHandle),
                 (Swi_FuncPtr)TransportShm_swiFxn,
                 &swiParams, eb);

    if (params->openFlag == FALSE) {
        obj->localList = (ti_sdo_ipc_ListMP_Handle)
                ListMP_create(&(listMPParams[localIndex]));
        if (obj->localList == NULL) {
            Error_raise(eb, ti_sdo_ipc_Ipc_E_internal, 0, 0);
            return (2);
        }

        obj->remoteList = (ti_sdo_ipc_ListMP_Handle)
                ListMP_create(&(listMPParams[remoteIndex]));
        if (obj->localList == NULL) {
            Error_raise(eb, ti_sdo_ipc_Ipc_E_internal, 0, 0);
            return (2);
        }
    }
    else {
        /* Open the local ListMP instance */
        status = ListMP_openByAddr(listMPParams[localIndex].sharedAddr,
                                   (ListMP_Handle *)&(obj->localList));

        if (status < 0) {
            Error_raise(eb, ti_sdo_ipc_Ipc_E_internal, 0, 0);
            return (2);
        }

        /* Open the remote ListMP instance */
        status = ListMP_openByAddr(listMPParams[remoteIndex].sharedAddr,
                                   (ListMP_Handle *)&(obj->remoteList));

        if (status < 0) {
            Error_raise(eb, ti_sdo_ipc_Ipc_E_internal, 0, 0);
            return (2);
        }
    }

    /* register the event with Notify */
    status = Notify_registerEventSingle(
                 procId,    /* remoteProcId */
                 0,         /* lineId */
                 TransportShm_notifyEventId,
                 (Notify_FnNotifyCbck)TransportShm_notifyFxn,
                 (UArg)swiHandle);
    if (status < 0) {
        Error_raise(eb, ti_sdo_ipc_Ipc_E_internal, 0, 0);
        return (3);
    }

    /* Register the transport with MessageQ */
    flag = ti_sdo_ipc_MessageQ_registerTransport(
            TransportShm_Handle_upCast(obj), procId, params->priority);
    if (flag == FALSE) {
        Error_raise(eb, ti_sdo_ipc_Ipc_E_internal, 0, 0);
        return (4);
    }

    if (params->openFlag == FALSE) {
        obj->self->creatorProcId = MultiProc_self();
        obj->self->notifyEventId = TransportShm_notifyEventId;
        obj->self->priority = obj->priority;

        /* Store the GateMP sharedAddr in the Attrs */
        obj->self->gateMPAddr = ti_sdo_ipc_GateMP_getSharedAddr(obj->gate);
        obj->self->flag = TransportShm_UP;

        if (obj->cacheEnabled) {
            Cache_wbInv(obj->self, sizeof(TransportShm_Attrs),
                     Cache_Type_ALL, TRUE);
        }
    }
    else {
        obj->other->flag = TransportShm_UP;
        if (obj->cacheEnabled) {
            Cache_wbInv(&(obj->other->flag), minAlign, Cache_Type_ALL, TRUE);
        }
    }

    obj->status = TransportShm_UP;

    return (0);
}
Exemple #16
0
static Int32 AlgLink_createOutObj(AlgLink_Obj * pObj)
{
    AlgLink_OutObj *pOutObj;
    System_LinkChInfo *pOutChInfo;
    Int32 status;
    UInt32 bufIdx;
    Int i,j,queueId,chId;
    UInt32 totalBufCnt;

    for(queueId = 0; queueId < ALG_LINK_MAX_OUT_QUE; queueId++)
    {

        pOutObj = &pObj->outObj[queueId];

        pObj->outObj[queueId].numAllocPools = 1;

        pOutObj->buf_size[0] = UTILS_SCD_GET_OUTBUF_SIZE();
        pOutObj->buf_size[0] = 
          VpsUtils_align(pOutObj->buf_size[0], 
                         SharedRegion_getCacheLineSize(SYSTEM_IPC_SR_CACHED));

        status = Utils_bitbufCreate(&pOutObj->bufOutQue, TRUE, FALSE,
                                    pObj->outObj[queueId].numAllocPools);
        UTILS_assert(status == FVID2_SOK);

        totalBufCnt = 0;
        for (i = 0; i < pOutObj->numAllocPools; i++)
        {
            pOutObj->outNumBufs[i] = (pObj->scdAlg.createArgs.numValidChForSCD * pObj->scdAlg.createArgs.numBufPerCh);

            for (j = 0; j < pObj->scdAlg.createArgs.numValidChForSCD; j++)
            {
                pOutObj->ch2poolMap[j] =  i;
            }

            status = Utils_memBitBufAlloc(&(pOutObj->outBufs[totalBufCnt]),
                                          pOutObj->buf_size[i],
                                          pOutObj->outNumBufs[i]);
            UTILS_assert(status == FVID2_SOK);

            for (bufIdx = 0; bufIdx < pOutObj->outNumBufs[i]; bufIdx++)
            {
                UTILS_assert((bufIdx + totalBufCnt) < ALG_LINK_SCD_MAX_OUT_FRAMES);
                pOutObj->outBufs[bufIdx + totalBufCnt].allocPoolID = i;
                pOutObj->outBufs[bufIdx + totalBufCnt].doNotDisplay =
                    FALSE;
                status =
                    Utils_bitbufPutEmptyBuf(&pOutObj->bufOutQue,
                                            &pOutObj->outBufs[bufIdx +
                                                              totalBufCnt]);
                UTILS_assert(status == FVID2_SOK);
            }
            /* align size to minimum required frame buffer alignment */
            totalBufCnt += pOutObj->outNumBufs[i];
        }
    }
    pObj->info.numQue = ALG_LINK_MAX_OUT_QUE;

    for (queueId = 0u; queueId < ALG_LINK_MAX_OUT_QUE; queueId++)
    {
        pObj->info.queInfo[queueId].numCh = pObj->inQueInfo.numCh;
    }

    for (chId = 0u; chId < pObj->inQueInfo.numCh; chId++)
    {
        for (queueId = 0u; queueId < ALG_LINK_MAX_OUT_QUE; queueId++)
        {
            pOutChInfo = &pObj->info.queInfo[queueId].chInfo[chId];
            pOutChInfo->bufType = SYSTEM_BUF_TYPE_VIDBITSTREAM;
            pOutChInfo->codingformat = NULL;
            pOutChInfo->memType = NULL;
            pOutChInfo->scanFormat = pObj->inQueInfo.chInfo[chId].scanFormat;
            pOutChInfo->width = pObj->inQueInfo.chInfo[chId].width;
            pOutChInfo->height = pObj->inQueInfo.chInfo[chId].height;
        }
    }


    return (status);
}