Пример #1
0
McpPoolStatus MCP_POOL_Free(McpPool *pool, void **element)
{
	McpPoolStatus	status = MCP_POOL_STATUS_SUCCESS;
	
	/* Map the element's address to a map index */ 
	McpU32 freedIndex = MCP_POOL_INVALID_ELEMENT_INDEX;

	MCP_FUNC_START("MCP_POOL_Free");
	
	MCP_VERIFY_FATAL((0 != pool), MCP_POOL_STATUS_INTERNAL_ERROR, ("Null pool argument"));
	MCP_VERIFY_FATAL((0 != element), MCP_POOL_STATUS_INTERNAL_ERROR, ("Null element argument"));
	MCP_VERIFY_FATAL((0 != *element), MCP_POOL_STATUS_INTERNAL_ERROR, ("Null *element argument"));
	MCP_VERIFY_FATAL((MCP_FALSE == MCP_POOL_IsDestroyed(pool)), MCP_POOL_STATUS_INTERNAL_ERROR, ("Pool Already Destroyed"));
	
	freedIndex = MCP_POOL_GetElementIndexFromAddress(pool, *element);

	MCP_VERIFY_FATAL((MCP_POOL_INVALID_ELEMENT_INDEX != freedIndex), MCP_POOL_STATUS_INTERNAL_ERROR,
						("Invalid element address"));
	MCP_VERIFY_FATAL(	(MCP_POOL_ALLOCATED_ELEMENT_MAP_INDICATION == pool->allocationMap[freedIndex]),
						MCP_POOL_STATUS_INTERNAL_ERROR, ("Invalid element address"));
	
	pool->allocationMap[freedIndex] = MCP_POOL_FREE_ELEMENT_MAP_INDICATION;
	--(pool->numOfAllocatedElements);

	/* Fill memory in a special value to facilitate identification of dangling pointer usage */
	MCP_HAL_MEMORY_MemSet(	(McpU8 *)MCP_POOL_GetElementAddressFromIndex(pool, freedIndex), 
			MCP_POOL_FREE_MEMORY_VALUE, pool->elementAllocatedSize);

	/* Make sure caller's pointer stops pointing to the freed element */
	*element = 0;
	
	MCP_FUNC_END();
	
	return status;
}
Пример #2
0
McpHalStatus MCP_LoadMngr_StopLoadScript(TLoadMngrCB fCB, void *pUserData)
{
    McpHalStatus    status;

    MCP_FUNC_START("MCP_LoadMngr_StopLoadScript");

    /* check for preliminary conditions that there is a CB */
    MCP_VERIFY_ERR ((NULL != fCB), MCP_HAL_STATUS_FAILED,
                    ("MCP_LoadMngr_LoadScript: NULL CB!"));

    /* Update CB and user data */
    fCb = fCB;
    pUserData = (void*)pUserData;    

    /*Send an MCP_LM_EVENT_ABORT event to the SM*/
    MCP_GenSM_Event (&tDataGenSm, MCP_LM_EVENT_ABORT, NULL);

	/* 
	 * copy the SM status to 'status', to avoid compilation warning and 
	 * allow VERIFY_ERR above to return correct status
	 */
	status = iLoadSmstatus;

    MCP_FUNC_END();

    return status;
}
/* function implementation */
ECCM_VAC_Status _CCM_VAC_AllocationEngine_Create (McpHalChipId chipId,
                                                  McpConfigParser *pConfigParser,
                                                  TCCM_VAC_AllocationEngine **ptAllocEngine)
{
    McpU32      uIndex;

    MCP_FUNC_START ("_CCM_VAC_AllocationEngine_Create");

    *ptAllocEngine = &(tAEObjects[ chipId ]);
    
    /* store ini file configuration object */
    tAEObjects[ chipId ].pConfigParser = pConfigParser;

    /* initialize resources */
    for (uIndex = 0; uIndex < CAL_RESOURCE_MAX_NUM; uIndex++)
    {
        (*ptAllocEngine)->tResources[ uIndex ].uNumberOfOwners = 0;
        (*ptAllocEngine)->tResources[ uIndex ].bAvailable = MCP_FALSE;
        (*ptAllocEngine)->tResources[ uIndex ].tProperties.uPropertiesNumber = 0;
    }

    MCP_FUNC_END ();

    return CCM_VAC_STATUS_SUCCESS;
}
Пример #4
0
void MCP_LoadMngr_Deinit(void)
{
    MCP_FUNC_START("MCP_LoadMngr_Deinit");
    
    /* Currently Nothing */  
    MCP_FUNC_END();
}
McpBool _CCM_VAC_AEIsPairAllowed (TCCM_VAC_AllocationEngine *ptAllocEngine, 
                                  ECAL_Resource eResource,
                                  TCAL_OperationPair *ptPair)
{
    McpU32                      uIndex;
    TCAL_OperationPair          *ptCurrentPair;

    MCP_FUNC_START ("_TCCM_VAC_AEIsPairAllowed");

    /* check all allowed pairs, until a match is found or list is exhusted */
    for (uIndex = 0; 
         uIndex < ptAllocEngine->tConfig.tAllowedPairs[ eResource ].uNumOfAllowedPairs; 
         uIndex++)
    {
        /* get current pair pointer */
        ptCurrentPair = &(ptAllocEngine->tConfig.tAllowedPairs[ eResource ].tOpPairs[ uIndex ]);

        /* compare given pair to current pair (resource order is of no significance) */
        if (((ptCurrentPair->eOperations[ 0 ] == ptPair->eOperations[ 0 ]) && 
             (ptCurrentPair->eOperations[ 1 ] == ptPair->eOperations[ 1 ])) ||
            ((ptCurrentPair->eOperations[ 0 ] == ptPair->eOperations[ 1 ]) && 
             (ptCurrentPair->eOperations[ 1 ] == ptPair->eOperations[ 0 ])))
        {
            /* pairs match - pair is allowed for this resource */
            return MCP_TRUE;
        }
    }

    /* no match was found - pair is not allowed for this resource */
    return MCP_FALSE;

    MCP_FUNC_END ();
}
Пример #6
0
McpPoolStatus MCP_POOL_IsElelementAllocated(McpPool *pool, const void* element, McpBool *answer)
{
	McpPoolStatus	status = MCP_POOL_STATUS_SUCCESS;
	
	/* Map the element's address to a map index */ 
	McpU32 freedIndex = MCP_POOL_INVALID_ELEMENT_INDEX;
	
	MCP_FUNC_START("MCP_POOL_IsElelementAllocated");
	
	MCP_VERIFY_FATAL((0 != pool), MCP_POOL_STATUS_INTERNAL_ERROR, ("Null pool argument"));
	MCP_VERIFY_FATAL((0 != element), MCP_POOL_STATUS_INTERNAL_ERROR, ("Null element argument"));
	MCP_VERIFY_FATAL((0 != answer), MCP_POOL_STATUS_INTERNAL_ERROR, ("Null answer argument"));
	MCP_VERIFY_FATAL((MCP_FALSE == MCP_POOL_IsDestroyed(pool)), MCP_POOL_STATUS_INTERNAL_ERROR, ("Pool Already Destroyed"));

	freedIndex = MCP_POOL_GetElementIndexFromAddress(pool, (void*)element);

	MCP_VERIFY_ERR((MCP_POOL_INVALID_ELEMENT_INDEX != freedIndex), MCP_POOL_STATUS_INVALID_PARM,
					("Invalid element address"));

	if (MCP_POOL_ALLOCATED_ELEMENT_MAP_INDICATION == pool->allocationMap[freedIndex])
	{
		*answer = MCP_TRUE;
	}
	else
	{
		*answer = MCP_FALSE;
	}

	MCP_FUNC_END();
	
	return status;
}
Пример #7
0
McpU32 MCP_POOL_GetElementIndexFromAddress(McpPool *pool, void *element)
{
	McpU32 		elementAddress = (McpU32)element;
	McpU32 		elementsMemoryAddress = (McpU32)(pool->elementsMemory);
	McpU32 		index = MCP_POOL_INVALID_ELEMENT_INDEX;

	MCP_FUNC_START("MCP_POOL_GetElementIndexFromAddress");
	
	/* Verify that the specified address is valid (in the address range and on an element's boundary) */
	
	MCP_VERIFY_FATAL_SET_RETVAR(	(elementAddress >= elementsMemoryAddress), 
									index = MCP_POOL_INVALID_ELEMENT_INDEX,
									("Invalid element Address"));
	MCP_VERIFY_FATAL_SET_RETVAR(	(((elementAddress - elementsMemoryAddress) % pool->elementAllocatedSize) == 0),
									index = MCP_POOL_INVALID_ELEMENT_INDEX, 
									("Invalid element Address"));

	/* Calculate the index */
	index = (elementAddress - elementsMemoryAddress) / pool->elementAllocatedSize;

	/* Verify that its within index bounds */
	MCP_VERIFY_FATAL_SET_RETVAR((index < pool->numOfElements), index = MCP_POOL_INVALID_ELEMENT_INDEX, (""));

	MCP_FUNC_END();
	
	return index;
}
Пример #8
0
_CcmImStatus _CCM_IM_BtTranSm_PerformCompletion(    
                                _CcmIm_BtTranSm_Obj                     *thisObj,
                                _CcmIm_BtTranSm_CompletionEventType eventType,
                                _CcmImStatus                        completionStatus)
{
    _CcmImStatus                        status;
    _CcmIm_BtTranSm_CompletionEvent completionEvent;
        
    MCP_FUNC_START("_CCM_IM_BtTranSm_PerformCompletion");

    MCP_LOG_INFO(("_CCM_IM_BtTranSm_PerformCompletion: BT Tran Off Completed (status: %d), Calling Parent", completionStatus));

    if (thisObj->asyncCompletion == MCP_TRUE)
    {
        /* 
            Notify parent SM (BtTranSm) of completion and its status. BtTranSm is not aware
            of the id of the stack that initiated Bt Tran Off. It is up to the parent SM to record
            this information.
        */
        completionEvent.chipId = thisObj->chipId;
        completionEvent.completionStatus = completionStatus;
        completionEvent.eventType = eventType;
        
        (thisObj->parentCb)(&completionEvent);
    }
        
    status =    _CCM_IM_STATUS_SUCCESS;
    
    MCP_FUNC_END();

    return status;
}
Пример #9
0
McpPoolStatus MCP_POOL_Allocate(McpPool *pool, void ** element)
{
	McpPoolStatus	status = MCP_POOL_STATUS_SUCCESS;
	McpU32 		allocatedIndex = MCP_POOL_INVALID_ELEMENT_INDEX;

	MCP_FUNC_START("MCP_POOL_Allocate");
	
	MCP_VERIFY_FATAL((0 != pool), MCP_POOL_STATUS_INTERNAL_ERROR, ("Null pool argument"));
	MCP_VERIFY_FATAL((0 != element), MCP_POOL_STATUS_INTERNAL_ERROR, ("Null element argument"));
	MCP_VERIFY_FATAL((MCP_FALSE == MCP_POOL_IsDestroyed(pool)), MCP_POOL_STATUS_INTERNAL_ERROR, ("Pool Already Destroyed"));
		
	allocatedIndex = MCP_POOL_GetFreeElementIndex(pool);
	
	if (MCP_POOL_INVALID_ELEMENT_INDEX == allocatedIndex)
	{
		return MCP_POOL_STATUS_NO_RESOURCES;
	}

	++(pool->numOfAllocatedElements);
	pool->allocationMap[allocatedIndex] = MCP_POOL_ALLOCATED_ELEMENT_MAP_INDICATION;

	*element = MCP_POOL_GetElementAddressFromIndex(pool, allocatedIndex);
 
	MCP_FUNC_END();
	
	return status;
}
Пример #10
0
_CcmImStatus _CCM_IM_BtTranSm_Destroy(_CcmIm_BtTranSm_Obj **thisObj)
{
    _CcmImStatus    status;
    BtHciIfStatus       btHciIfStatus;

    MCP_FUNC_START("_CCM_IM_BtTranSm_Create");
    
    status  = _CCM_IM_BtTranOffSm_Destroy(&(*thisObj)->tranOffSmObj);
    MCP_VERIFY_FATAL((status == _CCM_IM_STATUS_SUCCESS), _CCM_IM_STATUS_INTERNAL_ERROR,
                        ("_CCM_IM_BtTranSm_Destroy: _CCM_IM_BtTranOffSm_Destroy Failed"));

    status  = _CCM_IM_BtTranOnSm_Destroy(&(*thisObj)->tranOnSmObj);
    MCP_VERIFY_FATAL((status == _CCM_IM_STATUS_SUCCESS), _CCM_IM_STATUS_INTERNAL_ERROR,
                        ("_CCM_IM_BtTranSm_Destroy: _CCM_IM_BtTranOnSm_Destroy Failed"));

    btHciIfStatus = BT_HCI_IF_Destroy(&((*thisObj)->btHciIfObj));
    MCP_VERIFY_FATAL((btHciIfStatus == _CCM_IM_STATUS_SUCCESS), _CCM_IM_STATUS_INTERNAL_ERROR,
                        ("_CCM_IM_BtTranSm_Destroy: BT_HCI_IF_Destroy Failed"));

    *thisObj = NULL;

    MCP_FUNC_END();
    
    return status;
}
Пример #11
0
/*
    This function receives all the notification from the child BtTranOnSm instance. It maps the notification
    to an SM engine event and calls the engine to process the event
*/
void _CCM_IM_BtTranSm_TranOnSmCb(_CcmIm_BtTranOnSm_CompletionEvent *event)
{
    _CcmIm_BtTranSm_Obj *btTranSmObj = &_ccmIm_BtTranSm_Data.smObjs[event->chipId];

    MCP_FUNC_START("_CCM_IM_BtTranSm_TranOnSmCb");

    MCP_UNUSED_PARAMETER(event);

    if (event->completionStatus == _CCM_IM_STATUS_SUCCESS)
    {
        _CCM_IM_BtTranSm_InternalHandleEvent(btTranSmObj, _CCM_IM_BT_TRAN_SM_EVENT_TRAN_ON_COMPLETE, NULL);
    }
    else if (event->completionStatus == _CCM_IM_STATUS_TRAN_ON_ABORTED)
    {
        _CCM_IM_BtTranSm_InternalHandleEvent(btTranSmObj, _CCM_IM_BT_TRAN_SM_EVENT_TRAN_ON_ABORT_COMPLETE, NULL);
    }
    else if (event->completionStatus == _CCM_IM_STATUS_FAILED)
    {
        _CCM_IM_BtTranSm_InternalHandleEvent(btTranSmObj, _CCM_IM_BT_TRAN_SM_EVENT_TRAN_ON_FAILED, NULL);
    }
    else
    {
        MCP_FATAL_NO_RETVAR(("_CCM_IM_BtTranSm_TranOnSmCb: Unexpected Completion Status (%d)", event->completionStatus));
    }

    MCP_FUNC_END();
}
Пример #12
0
/*------------------------------------------------------------------------------
 *       Call back function for the script processor to send an HCI command
 *------------------------------------------------------------------------------
 */
McpBtsSpStatus MCP_LM_SendHciCmdCB (McpBtsSpContext *context,
                                    McpU16 hciOpcode, 
                                    McpU8 *hciCmdParms, 
                                    McpUint hciCmdParmsLen)
{
    McpBtsSpStatus          status = MCP_BTS_SP_STATUS_PENDING;
    BtHciIfStatus           btHciIfStatus;

    MCP_FUNC_START("MCP_LM_SendHciCmdCB");

    MCP_UNUSED_PARAMETER(context);

    btHciIfStatus = BT_HCI_IF_SendHciCommand(handle,   
                                              (BtHciIfHciOpcode)hciOpcode, 
                                             hciCmdParms, 
                                             (McpU8)hciCmdParmsLen,                                          
                                             BT_HCI_IF_HCI_EVENT_COMMAND_COMPLETE,
                                             NULL);

    MCP_VERIFY_ERR((btHciIfStatus == BT_HCI_IF_STATUS_PENDING), MCP_BTS_SP_STATUS_FAILED,
                   ("MCP_LM_SendHciCmdCB: BT_HCI_IF_SendHciCommand Failed"));

    MCP_FUNC_END();

    return status;
}
Пример #13
0
/*---------------------------------------------------------------------------
 *            MCP_HciSeq_CreateSequence()
 *---------------------------------------------------------------------------
 *
 * Synopsis:  Prepares a HCI sequence to be used
 *
 */
void MCP_HciSeq_CreateSequence (MCP_HciSeq_Context *pContext, 
                                BtHciIfObj *hciIfObj, 
                                McpHalCoreId coreId)
{
    BtHciIfStatus   status;

    MCP_FUNC_START ("MCP_HciSeq_CreateSequence");

    /* nullify variables */
    pContext->uSequenceId = 0;
    pContext->uCommandCount = 0;
    pContext->uCurrentCommandIdx = 0;
    pContext->bPendingCommand = MCP_FALSE;
    /* register a HCI IF client */
    pContext->coreId = coreId;
    if(pContext->coreId == MCP_HAL_CORE_ID_BT)
    {
            status = BT_HCI_IF_RegisterClient(hciIfObj, _MCP_HciSeq_callback, &(pContext->handle));
        MCP_VERIFY_FATAL_NO_RETVAR ((BT_HCI_IF_STATUS_SUCCESS == status),
                                    ("MCP_HciSeq_CreateSequence: BT_HCI_IF_RegisterClient returned status %d",
                                     status));
    }

    MCP_FUNC_END ();
}
Пример #14
0
/*------------------------------------------------------------------------------
 *            Callback function for script execution complete
 *------------------------------------------------------------------------------
 */
void MCP_LM_ExcutionCompleteCB(McpBtsSpContext *context, McpBtsSpStatus status)
{
    MCP_FUNC_START("MCP_LM_ExcutionCompleteCB");

    MCP_UNUSED_PARAMETER(context);

    if (status == MCP_BTS_SP_STATUS_EXECUTION_ABORTED)
    {
        /* Abort was completed successfully sent anMCP_LM_EVENT_ABORT_DONE to the SM */
        MCP_GenSM_Event (&tDataGenSm, MCP_LM_EVENT_ABORT_DONE, NULL);
    }

    else if (status == MCP_BTS_SP_STATUS_SUCCESS)
    {
        /* Load script was successfully sent an event to SM that the load is done */
        MCP_GenSM_Event (&tDataGenSm, MCP_LM_EVENT_LOAD_DONE, NULL);
    }
    else
    {
        /* Load script fail send an event to SM */
        MCP_GenSM_Event(&tDataGenSm, MCP_LM_EVENT_LOAD_FAIL, NULL);
    }

    fCb (status, pUserData);

    MCP_FUNC_END();
}
Пример #15
0
_CcmImStatus _CCM_IM_BtTranSm_StaticInit(void)
{
    _CcmImStatus    status;
    BtHciIfStatus       btHciIfStatus;

    MCP_FUNC_START("_CCM_IM_BtTranSm_StaticInit");
            
    _CCM_IM_BtTranSm_StaticInitSm();
    _CCM_IM_BtTranSm_StaticInitInstances();

    btHciIfStatus = BT_HCI_IF_StaticInit();
    MCP_VERIFY_FATAL((btHciIfStatus == _CCM_IM_STATUS_SUCCESS), _CCM_IM_STATUS_INTERNAL_ERROR,
                        ("_CCM_IM_BtTranSm_StaticInit: BT_HCI_IF_StaticInit Failed"));

    status = _CCM_IM_BtTranOnSm_StaticInit();
    MCP_VERIFY_FATAL((status == _CCM_IM_STATUS_SUCCESS), _CCM_IM_STATUS_INTERNAL_ERROR,
                        ("_CCM_IM_BtTranSm_StaticInit: _CCM_IM_BtTranOnSm_StaticInit Failed"));

    status = _CCM_IM_BtTranOffSm_StaticInit();
    MCP_VERIFY_FATAL((status == _CCM_IM_STATUS_SUCCESS), _CCM_IM_STATUS_INTERNAL_ERROR,
                        ("_CCM_IM_BtTranSm_StaticInit: _CCM_IM_BtTranOffSm_StaticInit Failed"));

    status = _CCM_IM_STATUS_SUCCESS;
    
    MCP_FUNC_END();
    
    return status;
}
Пример #16
0
MCP_STATIC void MCP_LM_Abort(void *pUserData)
{
    McpBtsSpStatus  status;

    MCP_FUNC_START("MCP_LM_Abort");

    MCP_UNUSED_PARAMETER(pUserData);

    /* Abort script execution */
    status = MCP_BTS_SP_AbortScriptExecution(&(context));

    /* Set the return status according to script processor reply */
    switch (status)
    {
        case MCP_BTS_SP_STATUS_SUCCESS:
        case MCP_BTS_SP_STATUS_EXECUTION_ABORTED:
            iLoadSmstatus = MCP_HAL_STATUS_SUCCESS;
            break;

        case MCP_BTS_SP_STATUS_PENDING:
            iLoadSmstatus = MCP_HAL_STATUS_PENDING;
            break;

        default:
            iLoadSmstatus = MCP_HAL_STATUS_FAILED;
            break;
    }

    MCP_FUNC_END();
}
Пример #17
0
McpConfigParserStatus MCP_CONFIG_PARSER_GetIntegerKey (McpConfigParser *pConfigParser,
                                                       McpU8 *pSectionName,
                                                       McpU8 *pKeyName,
                                                       McpS32 *pKeyIntValue)
{
    McpU8       *pKeyAsciiValue;

    MCP_FUNC_START ("MCP_CONFIG_PARSER_GetIntegerKey");

    MCP_LOG_INFO (("MCP_CONFIG_PARSER_GetIntegerKey: looking for key %s in section %s",
                   pKeyName, pSectionName));

    /* search for the ASCII value of this key */
    if (MCP_CONFIG_PARSER_STATUS_SUCCESS == 
        MCP_CONFIG_PARSER_GetAsciiKey (pConfigParser, pSectionName, pKeyName, &pKeyAsciiValue))
    {
        /* key was found */
        *pKeyIntValue = MCP_UTILS_AtoU32((const char *)pKeyAsciiValue);
        return MCP_CONFIG_PARSER_STATUS_SUCCESS;
    }

    /* key or section were not found */
    *pKeyIntValue = 0;
    return MCP_CONFIG_PARSER_STATUS_FAILURE_KEY_DOESNT_EXIST;
}
Пример #18
0
McpPoolStatus MCP_POOL_Destroy(McpPool	 *pool)
{
	McpPoolStatus	status = MCP_POOL_STATUS_SUCCESS;
	McpU32		numOfAllocatedElements;
	
	MCP_FUNC_START("MCP_POOL_Destroy");

	MCP_LOG_INFO(("Destroying Pool %s", pool->name));
		
	MCP_VERIFY_FATAL((0 != pool), MCP_POOL_STATUS_INTERNAL_ERROR, ("Null pool argument"));

	/* It is illegal to destroy a pool while there are allocated elements in the pool */
	status = MCP_POOL_GetNumOfAllocatedElements(pool, &numOfAllocatedElements);
	MCP_VERIFY_ERR_NORET(	(0 == numOfAllocatedElements), 
							("Pool %s still has %d allocated elements", pool->name, numOfAllocatedElements));

	pool->elementsMemory = 0;
	pool->numOfElements = 0;
	pool->elementAllocatedSize = 0;
	pool->numOfAllocatedElements = 0;
	MCP_HAL_STRING_StrCpy(pool->name, "");
	
	MCP_FUNC_END();
	
	return status;
}
Пример #19
0
MCP_STATIC void MCP_LM_Nothing (void *pUserData)
{   
    MCP_FUNC_START("MCP_LM_Nothing");

    MCP_UNUSED_PARAMETER(pUserData);

    MCP_FUNC_END();
}
void _CCM_VAC_MappingEngine_OperationToResourceList (TCCM_VAC_MappingEngine *ptMappEngine, 
                                                     ECAL_Operation eOperation,
                                                     TCAL_ResourceList *ptResourceList)
{
    McpU32                      uIndex, uOptListsIndex;
    TCAL_ResourceList           *ptTempList;

    MCP_FUNC_START ("_CCM_VAC_MappingEngine_OperationToResourceList");

    MCP_LOG_INFO (("_CCM_VAC_MappingEngine_OperationToResourceList: requesting resource list for operation %s",
                   _CCM_VAC_DebugOperationStr(eOperation)));

    /* verify object pointer and list pointer */
    MCP_VERIFY_FATAL_NO_RETVAR ((NULL != ptMappEngine), 
                                ("_CCM_VAC_MappingEngine_OperationToResourceList: NULL object!"));
    MCP_VERIFY_FATAL_NO_RETVAR ((NULL != ptResourceList), 
                                ("_CCM_VAC_MappingEngine_OperationToResourceList: NULL resource list!"));

    /* nullify the output resource list */
    ptResourceList->uNumOfResources = 0;

    /* First copy all mandatory resources */
    ptTempList = &(ptMappEngine->tConfig.tOpToResMap[ eOperation ].tMandatoryResources);
    for (uIndex = 0; uIndex < ptTempList->uNumOfResources; uIndex++)
    {
        ptResourceList->eResources[ ptResourceList->uNumOfResources ] = ptTempList->eResources[ uIndex ];
        ptResourceList->uNumOfResources++;
    }

    /* than copy all optional resources lists currently in use */
    for (uOptListsIndex = 0; 
         uOptListsIndex < ptMappEngine->tConfig.tOpToResMap[ eOperation ].tOptionalResources.uNumOfResourceLists;
         uOptListsIndex++)
    {
        /* if this optional resource is in use at the moment */
        if (MCP_TRUE == 
            ptMappEngine->tConfig.tOpToResMap[ eOperation ].tOptionalResources.tOptionalResourceLists[ uOptListsIndex ].bIsUsed)
        {
            /* copy the optional resource */
            ptResourceList->eResources[ ptResourceList->uNumOfResources ] =
                ptMappEngine->tConfig.tOpToResMap[ eOperation ].tOptionalResources.tOptionalResourceLists[ uOptListsIndex ].eOptionalResource;
            ptResourceList->uNumOfResources++;

            /* set the pointer to the derived resources list */
            ptTempList = 
                &(ptMappEngine->tConfig.tOpToResMap[ eOperation ].tOptionalResources.tOptionalResourceLists[ uOptListsIndex ].tDerivedResourcesList);

            /* now copy all derived resources in the list */
            for (uIndex = 0; uIndex < ptTempList->uNumOfResources; uIndex++)
            {
                ptResourceList->eResources[ ptResourceList->uNumOfResources ] = ptTempList->eResources[ uIndex ];
                ptResourceList->uNumOfResources++;
            }
        }
    }

    MCP_FUNC_END ();
}
Пример #21
0
/*
    The function needs to do the following:
    - Perform CCM "class" static initialization (if necessary - first time)
    - "Create" the instance (again, if it's the first creation of this instance)
*/
CcmStatus CCM_Create(McpHalChipId chipId, CcmObj **thisObj)
{
    CcmStatus       status;
    CcmImStatus     imStatus;
    ECCM_VAC_Status vacStatus;
    McpConfigParserStatus eConfigParserStatus;
	McpUtf8		scriptPath[MCP_HAL_CONFIG_FS_MAX_PATH_LEN_CHARS *
                           MCP_HAL_CONFIG_MAX_BYTES_IN_UTF8_CHAR] = "";
	
    MCP_FUNC_START("CCM_Create");

    MCP_VERIFY_FATAL((chipId < MCP_HAL_MAX_NUM_OF_CHIPS),
                     CCM_STATUS_INTERNAL_ERROR,
                     (("Invalid Chip Id"), chipId));
    
    if (_CCM_StaticData._ccm_Objs[chipId].refCount == 0)
    {
        _CCM_StaticData._ccm_Objs[chipId].chipId = chipId;
		/* read ini file */
		
        MCP_StrCpyUtf8(scriptPath, (const McpUtf8 *)CCM_VAC_CONFIG_PATH_NAME);
        MCP_StrCatUtf8(scriptPath, (const McpUtf8 *)CCM_VAC_CONFIG_FILE_NAME);

		eConfigParserStatus = MCP_CONFIG_PARSER_Open(scriptPath,
                                                     (McpU8*)CCM_VAC_MEM_CONFIG,
                                                     &(_CCM_StaticData._ccm_Objs[chipId].tConfigParser));
		MCP_VERIFY_ERR ((MCP_CONFIG_PARSER_STATUS_SUCCESS == eConfigParserStatus),
						CCM_VAC_STATUS_FAILURE_UNSPECIFIED,
						("_CCM_VAC_ConfigurationEngine_Create: reading config file failed with status %d",
						 eConfigParserStatus));
		
        imStatus = CCM_IM_Create(chipId, &_CCM_StaticData._ccm_Objs[chipId].imObj,
                                 _CCM_NotifyChipOn, &_CCM_StaticData._ccm_Objs[chipId]);
        MCP_VERIFY_FATAL((imStatus == CCM_IM_STATUS_SUCCESS), CCM_STATUS_INTERNAL_ERROR, ("CCM_IM_Create Failed"));

        CAL_Create (chipId, CCM_IMI_GetBtHciIfObj (_CCM_StaticData._ccm_Objs[chipId].imObj),
                    &(_CCM_StaticData._ccm_Objs[chipId].calObj),&(_CCM_StaticData._ccm_Objs[chipId].tConfigParser));
        /* CAL creation cannot fail */

        vacStatus = CCM_VAC_Create (chipId,
                                    _CCM_StaticData._ccm_Objs[chipId].calObj, 
                                    &(_CCM_StaticData._ccm_Objs[chipId].vacObj),
                                    &(_CCM_StaticData._ccm_Objs[chipId].tConfigParser));
        MCP_VERIFY_FATAL ((CCM_VAC_STATUS_SUCCESS == vacStatus), CCM_STATUS_INTERNAL_ERROR,
                          ("CCM_Create: VAC creation failed with status %d", vacStatus));
    }

    ++_CCM_StaticData._ccm_Objs[chipId].refCount;

    /* Set the instance pointer (out parameter) to be used in external references to this instance */
    *thisObj = &_CCM_StaticData._ccm_Objs[chipId];

    status = CCM_STATUS_SUCCESS;
    
    MCP_FUNC_END();

    return status;
}
void _CCM_VAC_AllocationEngine_Destroy (TCCM_VAC_AllocationEngine **ptAllocEngine)
{
    MCP_FUNC_START ("_CCM_VAC_AllocationEngine_Destroy");

    /* nullify the object pointer to avoid future use */
    *ptAllocEngine = NULL;

    MCP_FUNC_END ();
}
void _CCM_VAC_MappingEngine_Destroy (TCCM_VAC_MappingEngine **ptMappEngine)
{
    MCP_FUNC_START ("_CCM_VAC_MappingEngine_Destroy");

    /* nullify the object pointer to avoid future use */
    *ptMappEngine = NULL;

    MCP_FUNC_END ();
}
Пример #24
0
MCP_STATIC void MCP_LM_ActionUnexpected(void *pUserData)
{

    MCP_FUNC_START("MCP_LM_ActionUnexpected");

    MCP_UNUSED_PARAMETER(pUserData);

    MCP_FUNC_END();
}
TCAL_ResourceProperties *_CCM_VAC_AllocationEngine_GetResourceProperties (TCCM_VAC_AllocationEngine *ptAllocEngine,
                                                                          ECAL_Resource eResource)
{
    MCP_FUNC_START ("_CCM_VAC_AESetResourceProperties");

    return &(ptAllocEngine->tResources[ eResource ].tProperties);

    MCP_FUNC_END ();
}
Пример #26
0
void MCP_LoadMngr_NotifyUnload ()
{

    MCP_FUNC_START ("MCP_LoadMngr_NotifyUnload");

    /* Send an MCP_LM_EVENT_UNLOAD_DONE event to the SM */
    MCP_GenSM_Event (&tDataGenSm, MCP_LM_EVENT_UNLOAD_DONE, NULL);

    MCP_FUNC_END();
}
Пример #27
0
MCP_STATIC void MCP_LM_Load_Pending(void *pUserData)
{       
    MCP_FUNC_START("MCP_LM_Load_Pending");

    MCP_UNUSED_PARAMETER (pUserData);

    /* Update Load status return flag */
    iLoadSmstatus = MCP_HAL_STATUS_PENDING;

    MCP_FUNC_END();
}   
Пример #28
0
MCP_STATIC void MCP_LM_Load_Success(void *pUserData)
{   

    MCP_FUNC_START("MCP_LM_Load_Success");

    MCP_UNUSED_PARAMETER(pUserData);

    iLoadSmstatus=MCP_BTS_SP_STATUS_SUCCESS;

    MCP_FUNC_END();
}   
Пример #29
0
void MCP_LoadMngr_Destroy(void)
{
    MCP_FUNC_START("MCP_LoadMngr_Destroy");

    /* Destroy State Machine */
    MCP_GenSM_Destroy(&(tDataGenSm));

    /* De-register IF client*/
    BT_HCI_IF_DeregisterClient(&(handle));

    MCP_FUNC_END();
}
Пример #30
0
void MCP_LoadMngr_Hci_Cmds_callback(BtHciIfClientEvent *event)
{

    MCP_FUNC_START("MCP_LoadMngr_Hci_Cmds_callback");

    MCP_UNUSED_PARAMETER (event);

    /* The command is finished, proceed to the next command */
    MCP_BTS_SP_HciCmdCompleted (&context, NULL, NULL);

    MCP_FUNC_END();
}