void SYSRPC_MEASMGR_GetDataB_Adc(MeasMngrCnfgReq_t *req, MeasMngrCnfgRsp_t* rsp)
{
	UInt32 tid;
	MsgType_t msgType;
	RPC_ACK_Result_t ackResult;
	tid = RPC_SyncCreateTID( rsp, sizeof( MeasMngrCnfgRsp_t ) );
	CAPI2_SYSRPC_MEASMGR_GetDataB_Adc(tid, SYS_GetClientId(),req);
	RPC_SyncWaitForResponse( tid,SYS_GetClientId(), &ackResult, &msgType, NULL );
}
void HAL_EM_BATTMGR_GetBattTemp(HAL_EM_BATTMGR_Action_GetBatteryTemp_st_t* val)
{
	UInt32 tid;
	MsgType_t msgType;
	RPC_ACK_Result_t ackResult;
	
	tid = RPC_SyncCreateTID( val, sizeof( HAL_EM_BATTMGR_Action_GetBatteryTemp_st_t ) );
	CAPI2_HAL_EM_BATTMGR_GetBattTemp(tid, SYS_GetClientId());
	RPC_SyncWaitForResponse( tid,SYS_GetClientId(), &ackResult, &msgType, NULL );
}
Ejemplo n.º 3
0
void SysApi_GetSimLockStatus(ClientInfo_t *inClientInfoPtr,
			     SYS_SIMLOCK_STATE_t *simlock_state,
			     SYS_SIMLOCK_SIM_DATA_t *sim_data,
			     Boolean is_testsim)
{
#if 1
	Result_t res = RESULT_TIMER_EXPIRED;
	UInt32 tid;
	MsgType_t msgType;
	RPC_ACK_Result_t ackResult;

	tid =
	    RPC_SyncCreateTID((SYS_SIMLOCK_STATE_t *)simlock_state,
			      sizeof(SYS_SIMLOCK_STATE_t));
	inClientInfoPtr->reserved = tid;
	SYS_SimLockApi_GetStatus(tid, SYS_GetClientId(), inClientInfoPtr->simId,
				 (SYS_SIMLOCK_SIM_DATA_t *)sim_data,
				 is_testsim);
	res =
	    RPC_SyncWaitForResponseTimer(tid, inClientInfoPtr->clientId,
					 &ackResult, &msgType, NULL,
					 (TICKS_ONE_SECOND * 5));
#endif

	if (res == RESULT_TIMER_EXPIRED) {
		SYS_TRACE
		    ("SysApi_GetSimLockStatus WARNING!!! (Timeout) Check if AP is handling this message\n");
		simlock_state->network_lock_enabled = FALSE;
		simlock_state->network_subset_lock_enabled = FALSE;
		simlock_state->service_provider_lock_enabled = FALSE;
		simlock_state->corporate_lock_enabled = FALSE;
		simlock_state->phone_lock_enabled = FALSE;

		simlock_state->network_lock = SYS_SIM_SECURITY_OPEN;
		simlock_state->network_subset_lock = SYS_SIM_SECURITY_OPEN;
		simlock_state->service_provider_lock = SYS_SIM_SECURITY_OPEN;
		simlock_state->corporate_lock = SYS_SIM_SECURITY_OPEN;
		simlock_state->phone_lock = SYS_SIM_SECURITY_OPEN;

	}

	SYS_TRACE("SysApi_GetSimLockStatus enabled: %d, %d, %d, %d, %d\r\n",
		  simlock_state->network_lock_enabled,
		  simlock_state->network_subset_lock_enabled,
		  simlock_state->service_provider_lock_enabled,
		  simlock_state->corporate_lock_enabled,
		  simlock_state->phone_lock_enabled);

	SYS_TRACE("SysApi_GetSimLockStatus status: %d, %d, %d, %d, %d\r\n",
		  simlock_state->network_lock,
		  simlock_state->network_subset_lock,
		  simlock_state->service_provider_lock,
		  simlock_state->corporate_lock, simlock_state->phone_lock);
}
int IPC_SendMscXfr(int type, void *buffer, UInt32 first_sector, int count, void *drv_ctx, UInt32 sector_size)

{
    usbMscXfer_t *pXfr;
    USBPayload_t payload;
    UInt32 tid;
    Result_t result;
    RPC_ACK_Result_t ackResult;
    MsgType_t msgType;
    int num_bytes;
    usbMscXfer_t xfr;

    xfr.first_sector = first_sector;
    xfr.count = count;
    xfr.drv_ctx = drv_ctx;
    xfr.sector_size = sector_size;
    xfr.result = 0;
    xfr.buffer = buffer;
//    Log_DebugPrintf(LOGID_USB, "%s IPC_SendMscXfr type:%d buf:%p sec:%d:%d drv:%p size:%d", PROC_TYPE, type, buffer, first_sector,
//        count, drv_ctx, sector_size);

    num_bytes = count * sector_size;
    payload.param1 = type;
    payload.param2 = 0;
    payload.payloadLen = sizeof(usbMscXfer_t) + num_bytes;
    payload.payloadType =MSG_USB_MSC_XFR_IND;
    payload.un.xfr = 𝔵

    tid = RPC_SyncCreateTID( &payload, sizeof(USBPayload_t));

    // Don't let the capi emulator release the response buffer.
    // We need to do a deep copy of the response buffer first.
    RPC_SyncLockResponseBuffer();

    CAPI2_USB_IpcMsg(tid, SYS_GetClientId(),&payload);
    
	result = RPC_SyncWaitForResponse( tid, SYS_GetClientId(), &ackResult, &msgType, NULL );
    if(result |= RESULT_OK)
    {
        return result;
    }

    // Copy the response data.
    pXfr = payload.un.xfr;
    
    xfr.result = pXfr->result;
    memcpy(xfr.buffer, pXfr->buffer, num_bytes);
     
    // Done with the response buffer, so let the capi emulator release the memory.
    RPC_SyncReleaseResponseBuffer();

    return xfr.result;
    
}
void IPC_SendMscInfo(UInt32 type, void* drv_ctx, void**app_ctx, UInt32 num_heads, UInt32 num_sects, UInt32 sector_size)
{
#if defined(JUNGO_USB_STACK) 
    USBPayload_t val;
    usbMscMediaInfo_t xfr;
    UInt32 tid;
    Result_t result;
    RPC_ACK_Result_t ackResult;
    MsgType_t msgType;
    usbMscMediaInfo_t *info;
    USBPayload_t pay;

    xfr.drv_ctx = (UInt32 *)drv_ctx;
    xfr.app_ctx = (UInt32 *)app_ctx;
    xfr.heads = num_heads;
    xfr.sector_count = num_sects;
    xfr.sector_size = sector_size;

    val.param1 = type;
    val.param2 = 0;
    val.payloadLen = sizeof(usbMscMediaInfo_t);
    val.payloadType = MSG_USB_MSC_MEDIA_INFO;
    val.un.mediaInfo = 𝔵

//    Log_DebugPrintf(LOGID_USB, "%s IPC_SendMscInfo type:%d drv:%p hds:%d sects:%d size:%d ", PROC_TYPE, 
//        type, drv_ctx, app_ctx, num_heads, num_sects, sector_size);

    tid = RPC_SyncCreateTID( &pay, sizeof(USBPayload_t));

    // Don't let the capi emulator release the response buffer.
    // We need to do a deep copy of the response buffer first.
    RPC_SyncLockResponseBuffer();

	CAPI2_USB_IpcMsg(tid, SYS_GetClientId(),&val);

    result = RPC_SyncWaitForResponse( tid, SYS_GetClientId(), &ackResult, &msgType, NULL );
    if(result |= RESULT_OK)
    {
        Log_DebugPrintf(LOGID_USB, "CP IPC_SendMscInfo ERROR result:%d", result);
        return ;
    }


    info = pay.un.mediaInfo;
    Log_DebugPrintf(LOGID_USB, "%s IPC_SendMscInfo COMPLETE type:%d info->app_ctx:%p", PROC_TYPE, type, info->app_ctx);
    if(type != USB_IPC_MSC_MEDIA_REMOVE)
        *app_ctx = info->app_ctx;   
     
    // Done with the response buffer, so let the capi emulator release the memory.
    RPC_SyncReleaseResponseBuffer();

#endif //defined(JUNGO_USB_STACK)
    
}
void SYSRPC_HAL_ADC_Ctrl(HAL_ADC_Action_en_t action, HAL_ADC_ReadConfig_st_t *req, HAL_ADC_ReadConfig_st_t *rsp)
{
	UInt32 tid;
	MsgType_t msgType;
	RPC_ACK_Result_t ackResult;
	UInt16* pOld = req->adc_basic.pAdcData;
	
	tid = RPC_SyncCreateTID( rsp, sizeof( HAL_ADC_ReadConfig_st_t ) );
	RPC_SyncLockResponseBuffer();
	CAPI2_SYSRPC_HAL_ADC_Ctrl(tid, SYS_GetClientId(),action,req);
	RPC_SyncWaitForResponse( tid,SYS_GetClientId(), &ackResult, &msgType, NULL );
	*pOld = *(rsp->adc_basic.pAdcData);
	rsp->adc_basic.pAdcData = pOld;
	RPC_SyncReleaseResponseBuffer();
}
UInt32 audio_control_generic(UInt32 param1,UInt32 param2,UInt32 param3,UInt32 param4,UInt32 param5,UInt32 param6)
{
	Audio_Params_t audioParam;
	UInt32 tid;
	MsgType_t msgType;
	RPC_ACK_Result_t ackResult;
	UInt32 val = (UInt32)0;

	audioParam.param1 = param1;
	audioParam.param2 = param2;
	audioParam.param3 = param3;
	audioParam.param4 = param4;
	audioParam.param5 = param5;
	audioParam.param6 = param6;

	tid = RPC_SyncCreateTID( &val, sizeof( UInt32 ) );
	CAPI2_audio_control_generic(tid, audioClientId,&audioParam);
	RPC_SyncWaitForResponse( tid,audioClientId, &ackResult, &msgType, NULL );
	return val;
}
int AT_MTEST_Handler(const UInt8* _P1, const UInt8* _P2, const UInt8* _P3, const UInt8* _P4, const UInt8* _P5, const UInt8* _P6, const UInt8* _P7, const UInt8* _P8, const UInt8* _P9, char *output_text, int output_size)
{
	UInt32 tid;
	MsgType_t msgType;
	RPC_ACK_Result_t ackResult;
	MtestOutput_t val;

	tid = RPC_SyncCreateTID( &val, sizeof( MtestOutput_t ) );
	
	RPC_SyncLockResponseBuffer();
	
	SYS_AT_MTEST_Handler(tid, SYS_GetClientId(),(uchar_ptr_t)_P1,(uchar_ptr_t)_P2,(uchar_ptr_t)_P3,(uchar_ptr_t)_P4,(uchar_ptr_t)_P5,(uchar_ptr_t)_P6,(uchar_ptr_t)_P7,(uchar_ptr_t)_P8,(uchar_ptr_t)_P9,(output_text)?output_size:0);
	
	RPC_SyncWaitForResponse( tid,SYS_GetClientId(), &ackResult, &msgType, NULL );

	if(output_text && output_size > 0)
		memcpy(output_text, val.data, output_size);

	RPC_SyncReleaseResponseBuffer();
	
	return val.res;
}
UInt32 audio_control_dsp(UInt32 param1,UInt32 param2,UInt32 param3,UInt32 param4,UInt32 param5,UInt32 param6)
{
	Audio_Params_t audioParam;
	UInt32 tid;
	MsgType_t msgType;
	RPC_ACK_Result_t ackResult;
	UInt32 val = (UInt32)0;
	Log_DebugPrintf(LOGID_AUDIO, "\n\r\t* audio_control_dsp (AP) param1 %d, param2 %d param3 %d param4 %d *\n\r", param1, param2, param3, param4);

	switch (param1)
	{

#if 0
		case DSPCMD_TYPE_COMMAND_DIGITAL_SOUND:
			RIPCMDQ_DigitalSound((UInt16)param2);
			
			break;

		case DSPCMD_TYPE_COMMAND_SET_ARM2SP:
			RIPCMDQ_SetARM2SP((UInt16)param2, (UInt16)param3);
			
			break;

		case DSPCMD_TYPE_COMMAND_SET_ARM2SP2:
			RIPCMDQ_SetARM2SP2((UInt16)param2, (UInt16)param3);
			
			break;
			
		case DSPCMD_TYPE_COMMAND_SET_BT_NB:
			RIPCMDQ_SetBTNarrowBand((UInt16)param2);
			
			break;

		case DSPCMD_TYPE_COMMAND_USB_HEADSET:
			RIPCMDQ_USBHeadset((UInt16)param2);

			break;		


		case DSPCMD_TYPE_MM_VPU_ENABLE:
				RIPCMDQ_MMVPUEnable((UInt16)param2);
				
			break;
			
		case DSPCMD_TYPE_MM_VPU_DISABLE:
				RIPCMDQ_MMVPUDisable();
				
			break;
			
	// AMCR PCM enable bit is controlled by ARM audio		
		case DSPCMD_TYPE_AUDIO_SET_PCM:
			RIPCMDQ_DigitalSound((UInt16)param2);

			break;			


		case DSPCMD_TYPE_SET_VOCODER_INIT:
			RIPCMD_Vocoder_Init((UInt16)param2);
			
			break;		
		case DSPCMD_TYPE_COMMAND_VOIF_CONTROL:
			RIPCMDQ_VOIFControl((UInt16)param2);
			
			break;	 

		case DSPCMD_TYPE_COMMAND_SP:
			RIPCMDQ_SP((UInt16)param2, (UInt16)param3, (UInt16)param4);
			
			break;	

		case DSPCMD_TYPE_COMMAND_CLEAR_VOIPMODE:
			RIPCMDQ_Clear_VoIPMode( (UInt16) param2 );
			break;
#endif			
		default:
            Log_DebugPrintf(LOGID_AUDIO, "\n\r\t* audio_control_dsp (AP) default case param1 %d, param2 %d param3 %d param4 %d *\n\r", param1, param2, param3, param4);

			audioParam.param1 = param1;
			audioParam.param2 = param2;
			audioParam.param3 = param3;
			audioParam.param4 = param4;
			audioParam.param5 = param5;
			audioParam.param6 = param6;

			tid = RPC_SyncCreateTID( &val, sizeof( UInt32 ) );
			CAPI2_audio_control_dsp(tid, audioClientId,&audioParam);
			RPC_SyncWaitForResponse( tid,audioClientId, &ackResult, &msgType, NULL );
	
			break;
	} 
	
	return val;

}