/*****************************************************************************
 函 数 名  : FC_ACORE_CResetCallback
 功能描述  : FcACore需要注册到底软C核复位接口中的回调函数
 输入参数  : DRV_RESET_CALLCBFUN_MOMENT enParam 指示时复位处理前还是复位成功后
             int userdata                       用户自定义数据
 输出参数  : 无
 返 回 值  : VOS_OK/VOS_ERR
 调用函数  :
 被调函数  :

 修改历史      :
  1.日    期   : 2013年4月22日
    作    者   : caikai
    修改内容   : 新生成函数

*****************************************************************************/
VOS_INT FC_ACORE_CResetCallback(DRV_RESET_CALLCBFUN_MOMENT enParam, VOS_INT userdata)
{
    VOS_UINT32                   ulResult;


    if ( DRV_RESET_CALLCBFUN_RESET_BEFORE == enParam )      /* 复位处理时调用 */
    {
        FC_ACORE_CResetSendNotify(ID_FC_ACORE_CRESET_START_IND);

        ulResult = VOS_SmP(g_ulFcACoreCResetDoneSem, FC_ACORE_CRESET_TIMEOUT_LEN);
        if (VOS_OK != ulResult)
        {
            FC_LOG1(PS_PRINT_ERROR,
                          "FC_ACORE_CRESET_Callback, wait g_ulFcACoreResetDoneSem timeout! ulResult = %d\r\n", (VOS_INT32)ulResult);

            return VOS_ERR;
        }
    }
    else if ( DRV_RESET_CALLCBFUN_RESET_AFTER == enParam )   /* 复位成功后调用 */
    {
        FC_ACORE_CResetSendNotify(ID_FC_ACORE_CRESET_END_IND);
    }
    else
    {
        FC_LOG(PS_PRINT_ERROR,"FC_ACORE_CResetCallback, enParam invalid !\n");
        return VOS_ERR;
    }

    return VOS_OK;
}
/*****************************************************************************
 函 数 名  : FC_ACORE_CResetProc
 功能描述  : FcACore收到底软C核复位过程处理模块发来的复位及复位成功的通知后的处理函数
 输入参数  : FC_ACORE_CRESET_MOMENT_ENUM_UINT8 enCResetMoment 指示时复位处理前还是复位成功后
 输出参数  : 无
 返 回 值  : VOS_OK/VOS_ERR
 调用函数  :
 被调函数  :

 修改历史      :
  1.日    期   : 2013年4月22日
    作    者   : caikai
    修改内容   : 新生成函数

*****************************************************************************/
VOS_UINT32 FC_ACORE_CResetProc(FC_ACORE_CRESET_MOMENT_ENUM_UINT8 enCResetMoment)
{
    VOS_UINT32                          ulFcPointLoop;
    FC_POINT_STRU                      *pFcPoint;
    VOS_UINT32                          ulResult;
    FC_MSG_TYPE_ENUM_UINT16             usMsgName;
    FC_ACORE_CRESET_RSP_STRU           *pstMsg;
    VOS_UINT32                          ulRspResult;


    ulRspResult         = 0;

    if ( FC_ACORE_CRESET_BEFORE_RESET == enCResetMoment )
    {
        usMsgName           = ID_FC_ACORE_CRESET_START_RSP;

        /* 复位处理时遍历每个流控点,执行流控点上外部模块注册的reset函数 */
        for ( ulFcPointLoop = 0; ulFcPointLoop < g_stFcPointMgr.ulPointNum; ulFcPointLoop++ )
        {
            pFcPoint    = &g_stFcPointMgr.astFcPoint[ulFcPointLoop];

            if ( pFcPoint->pRstFunc != VOS_NULL_PTR )
            {
                ulResult     = pFcPoint->pRstFunc(pFcPoint->ulParam1, pFcPoint->ulParam2);
                ulRspResult |= ulResult ;
                FC_MNTN_TracePointFcEvent(ID_FC_MNTN_ACORE_CRESET_START_FC, pFcPoint, VOS_TRUE, ulResult);
            }
        }
    }
    else if ( FC_ACORE_CRESET_AFTER_RESET == enCResetMoment )
    {
        usMsgName           = ID_FC_ACORE_CRESET_END_RSP;
    }
    else
    {
        FC_LOG(PS_PRINT_ERROR,"FC_ACORE_CResetProc, enCResetMoment invalid !\n");
        return VOS_ERR;
    }

    /* 申请消息内存: */
    pstMsg = (FC_ACORE_CRESET_RSP_STRU *) VOS_AllocMsg( UEPS_PID_FLOWCTRL_A,
        sizeof(FC_ACORE_CRESET_RSP_STRU) - VOS_MSG_HEAD_LENGTH );

    if(VOS_NULL_PTR == pstMsg)
    {
        FC_LOG(PS_PRINT_ERROR,"FC_ACORE_CResetProc, Alloc Msg Fail\n");
        return VOS_ERR;
    }

    /*填写消息内容:*/
    pstMsg->ulReceiverCpuId = VOS_LOCAL_CPUID;
    pstMsg->ulReceiverPid   = UEPS_PID_FLOWCTRL_A;
    pstMsg->usMsgName       = usMsgName;
    pstMsg->ulResult        = ulRspResult;

    /*发送消息:*/
    VOS_SendMsg(UEPS_PID_FLOWCTRL, pstMsg);

    return VOS_OK;
}
Example #3
0
bool FCApplication::ShouldAutorotateToInterfaceOrientation( FCInterfaceOrientation orient )
{
	FC_TRACE;
	bool ret = false;
	
	switch (orient) {
		case kFCInterfaceOrientation_Landscape:
			FCLua::Instance()->CoreVM()->CallFuncWithSig("SupportsLandscape", true, ">b", &ret);
			if (ret) {
				FC_LOG( std::string("Supports Landscape: yes"));
			} else {
				FC_LOG( std::string("Supports Landscape: no"));
			}
			break;
		case kFCInterfaceOrientation_Portrait:
			FCLua::Instance()->CoreVM()->CallFuncWithSig("SupportsPortrait", true, ">b", &ret);
			if (ret) {
				FC_LOG( std::string("Supports Portrait: yes"));
			} else {
				FC_LOG( std::string("Supports Portrait: no"));
			}
			break;
	}
	return ret;
}
VOS_UINT32  FC_CCORE_Init( VOS_VOID )
{
    VOS_UINT32                          ulResult;


    ulResult = FC_CommInit();

    if ( VOS_OK != ulResult )
    {
        FC_LOG(PS_PRINT_ERROR, "FC_Init, ERROR, FC_CommInit return error!\n");
        return VOS_ERR;
    }

    ulResult    = FC_CPUC_Init();
    if ( VOS_OK != ulResult )
    {
        FC_LOG(PS_PRINT_ERROR, "FC_Init, ERROR, FC_CPUC_Init error!\n");
        return VOS_ERR;
    }

    ulResult    = FC_TEMPERATURE_Init();
    if ( VOS_OK != ulResult )
    {
        FC_LOG(PS_PRINT_ERROR, "FC_Init, ERROR, FC_TEMPERATURE_Init error!\n");
        return VOS_ERR;
    }

    /* 挂接 UL_DATA_POOL 内存池的监测函数 */
    R_ITF_InitFlowCtrl();

    return VOS_OK;
}
VOS_UINT32 FC_TEMPERATURE_SndCtrlMsg
(
    FC_MSG_TYPE_ENUM_UINT16 usMsgName
)
{
    VOS_UINT32                          ulResult;
    FC_TEMPERATURE_IND_STRU            *pstMsg;


    pstMsg = (FC_TEMPERATURE_IND_STRU *)VOS_AllocMsg(UEPS_PID_FLOWCTRL, \
                                        sizeof(FC_TEMPERATURE_IND_STRU) - VOS_MSG_HEAD_LENGTH);

    if(VOS_NULL_PTR == pstMsg)
    {
        FC_LOG(PS_PRINT_ERROR, "FC_SndIntraTemperatureMsg, Alloc Msg Fail\n");
        return VOS_ERR;
    }

    pstMsg->ulReceiverCpuId = VOS_LOCAL_CPUID;
    pstMsg->ulReceiverPid   = UEPS_PID_FLOWCTRL;
    pstMsg->usMsgName       = usMsgName;

    ulResult = VOS_SendMsg(UEPS_PID_FLOWCTRL, pstMsg);

    if (VOS_OK != ulResult)
    {
        FC_LOG(PS_PRINT_ERROR,"FC_SndIntraTemperatureMsg, Send Msg Fail\n");
        return VOS_ERR;
    }

    return VOS_OK;
}
VOS_UINT32  FC_CPUC_Init( VOS_VOID )
{
    VOS_UINT32                          ulResult;


    ulResult = FC_UL_InitFcPoints(FC_POLICY_ID_CPU_C, &(g_stFcCfg.stFcCfgUmUlRateForCpu));

    if ( VOS_OK != ulResult )
    {
        FC_LOG(PS_PRINT_ERROR, "FC_Init, ERROR, Fail to init FC Points for CPU!\n");
        return VOS_ERR;
    }

    VOS_MemSet(&g_stFcCpuCCtrl, 0, sizeof(g_stFcCpuCCtrl));

    ulResult = VOS_StartRelTimer(&g_stFcTraceCpuLoad.pstTraceCpuLoadTHandle, UEPS_PID_FLOWCTRL_C,
                                  g_stFcTraceCpuLoad.ulTraceCpuLoadTimerLen,
                                  TIMER_FC_CCPU_TRACE_CPULOAD, 0,
                                  VOS_RELTIMER_NOLOOP, VOS_TIMER_NO_PRECISION);
    if (VOS_OK != ulResult)
    {
        FC_LOG(PS_PRINT_ERROR, "FC_Init, ERROR, Fail to Start Timer!\n");
        return VOS_ERR;
    }

    return VOS_OK;
}
/*****************************************************************************
 函 数 名  : FC_FidInit
 功能描述  : 流控FID初始化函数
 输入参数  : enum VOS_INIT_PHASE_DEFINE enPhase
 输出参数  : 无
 返 回 值  : VOS_UINT32
 调用函数  :
 被调函数  :

 修改历史      :
  1.日    期   : 2011年12月14日
    作    者   :
    修改内容   : 新生成函数
*****************************************************************************/
VOS_UINT32 FC_CCORE_FidInit(enum VOS_INIT_PHASE_DEFINE enPhase)
{
    VOS_UINT32  ulResult = VOS_ERR;

    switch (enPhase)
    {
        case   VOS_IP_LOAD_CONFIG:

            ulResult = VOS_RegisterPIDInfo(UEPS_PID_FLOWCTRL,
                                           (Init_Fun_Type)VOS_NULL_PTR,
                                           (Msg_Fun_Type)FC_CCORE_MsgProc);
            if (VOS_OK != ulResult)
            {
                FC_LOG(PS_PRINT_ERROR, "FC_FidInit, VOS_RegisterPIDInfo Fail\n");
                return VOS_ERR;
            }

            ulResult = VOS_RegisterTaskPrio(UEPS_FID_FLOWCTRL, TTF_FLOW_CTRL_TASK_PRIO);

            if (VOS_OK != ulResult)
            {
                FC_LOG(PS_PRINT_ERROR, "FC_FidInit, OS_RegisterTaskPrio Fail\n");
                return VOS_ERR;
            }

            ulResult = FC_CCORE_Init();

            if (VOS_OK != ulResult)
            {
                FC_LOG(PS_PRINT_ERROR, "FC_FidInit, Call FC_Init return error!\n");
                return VOS_ERR;
            }

            break;
        case   VOS_IP_FARMALLOC:
        case   VOS_IP_INITIAL:
        case   VOS_IP_ENROLLMENT:
        case   VOS_IP_LOAD_DATA:
        case   VOS_IP_FETCH_DATA:
        case   VOS_IP_STARTUP:
        case   VOS_IP_RIVAL:
        case   VOS_IP_KICKOFF:
        case   VOS_IP_STANDBY:
        case   VOS_IP_BROADCAST_STATE:
        case   VOS_IP_RESTART:
            break;
        default:
            break;
    }

    return VOS_OK;
}
/*****************************************************************************
 函 数 名  : FC_ACORE_CResetSendNotify
 功能描述  : 底软C核复位过程模块通知FcACore进行复位处理或者发送复位成功的通知
 输入参数  : FC_MSG_TYPE_ENUM_UINT16     usMsgName      消息名称
 输出参数  : 无
 返 回 值  : VOS_OK/VOS_ERR
 调用函数  :
 被调函数  :

 修改历史      :
  1.日    期   : 2013年4月22日
    作    者   : caikai
    修改内容   : 新生成函数

*****************************************************************************/
VOS_UINT32  FC_ACORE_CResetSendNotify(FC_MSG_TYPE_ENUM_UINT16     usMsgName)
{
    FC_ACORE_CRESET_IND_STRU    *pstMsg;

    /* 申请消息内存 */
    pstMsg = (FC_ACORE_CRESET_IND_STRU *) VOS_AllocMsg( UEPS_PID_FLOWCTRL_A,
        sizeof(FC_ACORE_CRESET_IND_STRU) - VOS_MSG_HEAD_LENGTH );

    if ( VOS_NULL_PTR == pstMsg )
    {
        FC_LOG(PS_PRINT_ERROR,"FC_ACORE_CResetSendNotify, Alloc Msg Fail\n");
        return VOS_ERR;
    }

    /* 填写消息内容 */
    pstMsg->ulReceiverCpuId = VOS_LOCAL_CPUID;
    pstMsg->ulReceiverPid   = UEPS_PID_FLOWCTRL_A;
    pstMsg->usMsgName       = usMsgName;

    /* 发送消息 */
    VOS_SendMsg(UEPS_PID_FLOWCTRL, pstMsg);

    return VOS_OK;

}
Example #9
0
FCGLShaderRef FCGLShaderManager::AddShader( std::string name )
{
	FCGLShaderRefMapByStringIter ret = m_shaders.find( name );
	
	if( ret == m_shaders.end() )
	{
		FCFile shaderFile;
		shaderFile.Open( std::string("Shaders/") + name, kFCFileOpenModeReadOnly, kFCFileLocationApplicationBundle);
		FCDataRef shaderData = shaderFile.Data();
		
		// process it
		
		eFCShaderType type;
	
		std::string shaderType = name.substr( name.find(".") + 1 );
		
		if ( shaderType == "vsh" ) {
			type = kShaderTypeVertex;
		} else {
			type = kShaderTypeFragment;
		}
		
		FCGLShaderRef shader = FCGLShaderRef( new FCGLShader( type, std::string( shaderData.get(), shaderFile.Size() ) ) );
		
		FC_LOG( std::string("Compiled GL shader: ") + name);
		
		shaderFile.Close();
		
		m_shaders[ name ] = shader;
		
		ret = m_shaders.find( name );
	}
	return ret->second;
}
Example #10
0
FCGLShaderProgramRef FCGLShaderManager::AddProgram( std::string name, std::string shaderName )
{
	FCGLShaderProgramRefMapByStringIter i = m_programs.find( name );
		
	if( i == m_programs.end() ) 
	{
		std::string vertexShaderName = shaderName + ".vsh";
		std::string fragmentShaderName = shaderName + ".fsh";
		
		FCGLShaderRef vertexShader = AddShader( vertexShaderName );
		FCGLShaderRef fragmentShader = AddShader( fragmentShaderName );
		
		// build program
		
		if( name == kFCKeyShaderDebug ) 
		{
			m_programs[ name ] = FCGLShaderProgramRef( new FCGLShaderProgramDebug( vertexShader, fragmentShader ) );
		} 
		else if ( name == kFCKeyShaderWireframe ) 
		{
			m_programs[ name ] = FCGLShaderProgramRef( new FCGLShaderProgramWireframe( vertexShader, fragmentShader ) );
		} 
		else if ( name == kFCKeyShaderFlatUnlit ) 
		{
			m_programs[ name ] = FCGLShaderProgramRef( new FCGLShaderProgramFlatUnlit( vertexShader, fragmentShader ) );
		} 
		else if ( name == kFCKeyShaderNoTexVLit ) 
		{
			m_programs[ name ] = FCGLShaderProgramRef( new FCGLShaderProgramNoTexVLit( vertexShader, fragmentShader ) );
		} 
		else if ( name == kFCKeyShaderNoTexPLit ) 
		{
			m_programs[ name ] = FCGLShaderProgramRef( new FCGLShaderProgramNoTexPLit( vertexShader, fragmentShader ) );
		} 
		else if ( name == kFCKeyShader1TexVLit ) 
		{
			m_programs[ name ] = FCGLShaderProgramRef( new FCGLShaderProgram1TexVLit( vertexShader, fragmentShader ) );
		} 
		else if ( name == kFCKeyShader1TexPLit ) 
		{
			m_programs[ name ] = FCGLShaderProgramRef( new FCGLShaderProgram1TexPLit( vertexShader, fragmentShader ) );
		} 
		else if ( name == kFCKeyShaderTest ) 
		{
			m_programs[ name ] = FCGLShaderProgramRef( new FCGLShaderProgramTest( vertexShader, fragmentShader ) );
		} 
		else {
			FC_FATAL( std::string("Unknown shader: ") + name );
		}
		
		FC_LOG( std::string("Linked GL program: ") + name );
		
//		[self.programs setValue:ret forKey:name];
	}
	
	return m_programs[ name ];
}
Example #11
0
void FCApplication::LoadLuaLanguage()
{
	m_lua->LoadScriptOptional("Languages/en");	// default is English
	
	std::string locale = FCDevice::Instance()->GetCap(kFCDeviceLocale);
	
	FC_LOG( std::string("Locale: ") + locale );
	
	if (locale != "en") {
		m_lua->LoadScriptOptional("Languages/" + locale);	// override with translations
	}
}