kal_bool L1sim_Set_ClockStopMode_All(sim_clock_stop_enum mode, SIM_ICC_APPLICATION application) { sim_ctrlDriver *simDriver; kal_bool status; kal_uint32 simInterface; sim_HW_cb *hw_cb; simInterface = sim_get_logicalNum_from_app(application); hw_cb = (sim_HW_cb *)(hwCbArray[simInterface]); #if defined (LPWR_SLIM) L1SM_SleepDisable(hw_cb->smHandler); //lock sleep mode #endif if(DRV_SIM_MAX_LOGICAL_INTERFACE <= simInterface) ASSERT(0); if(KAL_TRUE == sim_physicalSlotChanged) simInterface = 1-simInterface; /*find out the hooked function table*/ simDriver = sim_driverTable[simInterface]; ASSERT(0 != simDriver); status = simDriver->setClockStopMode(mode, (sim_HW_cb *)(hwCbArray[simInterface])); #if defined (LPWR_SLIM) L1SM_SleepEnable(hw_cb->smHandler); //unlock sleep mode #endif return status; }
void L1sim_PowerOff_All(SIM_ICC_APPLICATION application) { sim_ctrlDriver *simDriver; kal_uint32 simInterface; sim_HW_cb *hw_cb; simInterface = sim_get_logicalNum_from_app(application); hw_cb = (sim_HW_cb *)(hwCbArray[simInterface]); #if defined (LPWR_SLIM) L1SM_SleepDisable(hw_cb->smHandler); //lock sleep mode #endif if(DRV_SIM_MAX_LOGICAL_INTERFACE <= simInterface) ASSERT(0); if(KAL_TRUE == sim_physicalSlotChanged) simInterface = 1-simInterface; /*find out the hooked function table*/ simDriver = sim_driverTable[simInterface]; ASSERT(0 != simDriver); simDriver->addMessage(SIM_AL_ACTION_POWOFF, simInterface, (kal_uint32)kal_get_current_thread_ID(), 0); simDriver->powerOff((sim_HW_cb *)(hwCbArray[simInterface])); simDriver->addMessage(SIM_AL_ACTION_EOC, simInterface, 0, 0); simDriver->EOC((sim_HW_cb *)(hwCbArray[simInterface])); #if defined (LPWR_SLIM) L1SM_SleepEnable(hw_cb->smHandler); //unlock sleep mode #endif }
kal_bool sim_queryGet9000WhenSelect(SIM_ICC_APPLICATION application) { Sim_Card *SimCard; kal_uint32 simInterface; simInterface = sim_get_logicalNum_from_app(application); SimCard = GET_SIM_CB(simInterface); return SimCard->get9000WhenSelect; }
/*following are pure SW query, no matter of different driver solutions*/ sim_card_speed_type L1sim_Get_CardSpeedType(SIM_ICC_APPLICATION application) { Sim_Card *SimCard; kal_uint32 simInterface; simInterface = sim_get_logicalNum_from_app(application); SimCard = GET_SIM_CB(simInterface); return SimCard->sim_card_speed; }
/*for specific purpose, SIM task should not call this */ void sim_releaseOwner(SIM_ICC_APPLICATION application) { usim_dcb_struct *usim_dcb; kal_uint32 simInterface; simInterface = sim_get_logicalNum_from_app(application); usim_dcb = GET_USIM_CB(simInterface); if(DRV_SIM_MAX_LOGICAL_INTERFACE <= simInterface) ASSERT(0); if(KAL_TRUE == sim_physicalSlotChanged) simInterface = 1-simInterface; usim_dcb->ownerTask = 0; }
void L1sim_Select_Prefer_PhyLayer_All(sim_protocol_phy_enum T, SIM_ICC_APPLICATION application) { sim_ctrlDriver *simDriver; kal_uint32 simInterface; simInterface = sim_get_logicalNum_from_app(application); if(DRV_SIM_MAX_LOGICAL_INTERFACE <= simInterface) ASSERT(0); if(KAL_TRUE == sim_physicalSlotChanged) simInterface = 1-simInterface; /*find out the hooked function table*/ simDriver = sim_driverTable[simInterface]; ASSERT(0 != simDriver); simDriver->selectPreferPhyLayer(T, (sim_HW_cb *)(hwCbArray[simInterface])); }
void L1sim_Get_Card_Info_All(sim_info_struct *info, SIM_ICC_APPLICATION application) { sim_ctrlDriver *simDriver; kal_uint32 simInterface; simInterface = sim_get_logicalNum_from_app(application); if(DRV_SIM_MAX_LOGICAL_INTERFACE <= simInterface) ASSERT(0); if(KAL_TRUE == sim_physicalSlotChanged) simInterface = 1-simInterface; /*find out the hooked function table*/ simDriver = sim_driverTable[simInterface]; ASSERT(0 != simDriver); simDriver->getCardInfo(info, (sim_HW_cb *)(hwCbArray[simInterface])); }
void L1sim_Enable_Enhanced_Speed_All(kal_bool enable, SIM_ICC_APPLICATION application) { #ifdef NO_SLIM_DEF sim_ctrlDriver *simDriver; kal_uint32 simInterface; simInterface = sim_get_logicalNum_from_app(application); if(DRV_SIM_MAX_LOGICAL_INTERFACE <= simInterface) ASSERT(0); if(KAL_TRUE == sim_physicalSlotChanged) simInterface = 1-simInterface; /*find out the hooked function table*/ simDriver = sim_driverTable[simInterface]; ASSERT(0 != simDriver); simDriver->enableEnhancedSpeed(enable, (sim_HW_cb *)(hwCbArray[simInterface])); #endif }
void sim_toutTest_al(kal_uint32 toutValue, SIM_ICC_APPLICATION application) { #ifdef SIM_HW_TEST sim_ctrlDriver *simDriver; kal_uint32 simInterface; simInterface = sim_get_logicalNum_from_app(application); if(DRV_SIM_MAX_LOGICAL_INTERFACE <= simInterface) ASSERT(0); if(KAL_TRUE == sim_physicalSlotChanged) simInterface = 1-simInterface; /*find out the hooked function table*/ simDriver = sim_driverTable[simInterface]; ASSERT(0 != simDriver); simDriver->toutTest(toutValue, (sim_HW_cb *)(hwCbArray[simInterface])); #endif }
sim_status L1sim_Cmd_All(kal_uint8 *txData,kal_uint32 *txSize,kal_uint8 *rxData, kal_uint32 *rxSize, SIM_ICC_APPLICATION application) { sim_ctrlDriver *simDriver; sim_status status; kal_uint32 simInterface; sim_HW_cb *hw_cb; simInterface = sim_get_logicalNum_from_app(application); hw_cb = (sim_HW_cb *)(hwCbArray[simInterface]); #if defined (LPWR_SLIM) L1SM_SleepDisable(hw_cb->smHandler); //lock sleep mode #endif if(DRV_SIM_MAX_LOGICAL_INTERFACE <= simInterface) ASSERT(0); if(KAL_TRUE == sim_physicalSlotChanged) simInterface = 1-simInterface; if(0x0 == txData || 0x0 == txSize || 0x0 == rxSize) ASSERT(0); /*find out the hooked function table*/ simDriver = sim_driverTable[simInterface]; ASSERT(0 != simDriver); simDriver->addMessage(SIM_AL_ACTION_COMMAND, simInterface, (kal_uint32)kal_get_current_thread_ID(), 0); status = simDriver->command(txData, txSize, rxData, rxSize, (sim_HW_cb *)(hwCbArray[simInterface])); simDriver->addMessage(SIM_AL_ACTION_EOC, simInterface, 0, 0); simDriver->EOC((sim_HW_cb *)(hwCbArray[simInterface])); #if defined (LPWR_SLIM) L1SM_SleepEnable(hw_cb->smHandler); //unlock sleep mode #endif return status; }
usim_status_enum L1sim_Reset_All(sim_power_enum ExpectVolt, sim_power_enum *ResultVolt, kal_bool warm, SIM_ICC_APPLICATION application) { sim_ctrlDriver *simDriver; usim_status_enum status; kal_uint32 simInterface; #ifdef __SIM_HOT_SWAP_SUPPORT__ kal_int32 ipcStatus; #if defined (__MD1__) || defined (__SIM_HOT_PLUG_SINGLE_MD_QUERY_STR__) kal_uint8 *query, querystring[25] = "MD1_SIM1_HOT_PLUG_EINT"; #elif defined (__MD2__) kal_uint8 *query, querystring[25] = "MD2_SIM1_HOT_PLUG_EINT"; #else kal_uint8 *query, querystring[20] = "SIM1_HOT_PLUG_EINT"; #endif SIM_ICC_HOT_PLUG iccHotPlug = {KAL_FALSE, KAL_FALSE, KAL_FALSE, 0, 0, 0, 0, 0, 0, NULL, NULL}; query = &querystring[0]; #endif #ifdef SIM_4_CARD_SMT_TEST SIM_ICC_APPLICATION anotherApplication; kal_uint32 anotherSimInterface; sim_power_enum anotherResultVolt; sim_ctrlDriver *anotherSimDriver; usim_status_enum anotherStatus; #endif sim_HW_cb *hw_cb; simInterface = sim_get_logicalNum_from_app(application); hw_cb = (sim_HW_cb *)(hwCbArray[simInterface]); #ifdef SIM_4_CARD_SMT_TEST if(SIM_ICC_APPLICATION_PHONE1 == application) anotherApplication = SIM_ICC_APPLICATION_PHONE3; else if(SIM_ICC_APPLICATION_PHONE2 == application) anotherApplication = SIM_ICC_APPLICATION_PHONE4; else ASSERT(0); anotherSimInterface = sim_get_logicalNum_from_app(anotherApplication); #endif if(DRV_SIM_MAX_LOGICAL_INTERFACE <= simInterface) ASSERT(0); #ifdef SIM_4_CARD_SMT_TEST if(DRV_SIM_MAX_LOGICAL_INTERFACE <= anotherSimInterface) ASSERT(0); #endif if(KAL_TRUE == sim_physicalSlotChanged){ #if !defined( __MAUI_BASIC__) tst_sys_trace("[SIM]:sim interface inversed!!"); #else dbg_print("[SIM]:sim interface inversed!!"); #endif simInterface = 1-simInterface; application = 1-application; // need to switch to get correct hwcb and SIMIF number } if(0x0 == ResultVolt) ASSERT(0); #if defined (LPWR_SLIM) L1SM_SleepDisable(hw_cb->smHandler); //lock sleep mode #endif #ifdef __CUSTOMER_HW_VERIFICATION__ simInterface = 0; /*find out the hooked function table*/ simDriver = sim_driverTable[simInterface]; ASSERT(0 != simDriver); sim_MT6302_addMsg(SIM_MT6302_ACTION_RESET, simInterface, 0, 0); status = simDriver->reset(ExpectVolt, ResultVolt, warm, (sim_HW_cb *)(hwCbArray[simInterface])); sim_MT6302_addMsg(SIM_MT6302_ACTION_EOC, simInterface, drv_get_current_time(), 0); simDriver->EOC((sim_HW_cb *)(hwCbArray[simInterface])); simInterface = 1; /*find out the hooked function table*/ simDriver = sim_driverTable[simInterface]; ASSERT(0 != simDriver); sim_MT6302_addMsg(SIM_MT6302_ACTION_RESET, simInterface, 0, 0); /*when we release single SIM MMI, we only release SIM1 MMI, cusrtomer won't get SIM2 MMI, SIM1 is what MMI need*/ //status = simDriver->reset(ExpectVolt, ResultVolt, warm, simInterface); sim_MT6302_addMsg(SIM_MT6302_ACTION_EOC, simInterface, drv_get_current_time(), 0); simDriver->EOC(simInterface); #else /*find out the hooked function table*/ simDriver = sim_driverTable[simInterface]; ASSERT(0 != simDriver); simDriver->addMessage(SIM_AL_ACTION_RESET, simInterface, (kal_uint32)kal_get_current_thread_ID(), 0); status = simDriver->reset(ExpectVolt, ResultVolt, warm, (sim_HW_cb *)(hwCbArray[simInterface])); #ifdef __SIM_HOT_SWAP_SUPPORT__ /* we should always register eint. If we bootup without plugin simcard, status will display NO_CARD. we will never get insert event because eint is not registered */ #if defined (__MD1__) || defined (__SIM_HOT_PLUG_SINGLE_MD_QUERY_STR__) if (application == SIM_ICC_APPLICATION_PHONE2) query = (kal_uint8 *)"MD1_SIM2_HOT_PLUG_EINT"; #elif defined (__MD2__) if (application == SIM_ICC_APPLICATION_PHONE2) query = (kal_uint8 *)"MD2_SIM2_HOT_PLUG_EINT"; #else if (application == SIM_ICC_APPLICATION_PHONE2) query = (kal_uint8 *)"SIM2_HOT_PLUG_EINT"; #endif /* if any rpc error happens, we should leave register eint */ #if defined (__MD1__) || defined (__MD2__) || defined (__SIM_HOT_PLUG_SINGLE_MD_QUERY_STR__) ipcStatus = IPC_RPC_EINT_GetAttribute(query, 23, SIM_HOT_PLUG_EINT_NUMBER, (void *)&iccHotPlug.eintNo, 4); #else ipcStatus = IPC_RPC_EINT_GetAttribute(query, 19, SIM_HOT_PLUG_EINT_NUMBER, (void *)&iccHotPlug.eintNo, 4); #endif if (ipcStatus < 0) { kal_sprintf(sim_dbg_str,"get eint no fail %d %d, please request HW to check ALPS DWS setting.", ipcStatus, iccHotPlug.eintNo); #if !defined( __MAUI_BASIC__) tst_sys_trace(sim_dbg_str); #else dbg_print(sim_dbg_str); #endif goto LEAVE_REG_EINT; } #if defined (__MD1__) || defined (__MD2__) || defined (__SIM_HOT_PLUG_SINGLE_MD_QUERY_STR__) ipcStatus = IPC_RPC_EINT_GetAttribute(query, 23, SIM_HOT_PLUG_EINT_DEBOUNCETIME, (void *)&iccHotPlug.debounceTime, 4); #else ipcStatus = IPC_RPC_EINT_GetAttribute(query, 19, SIM_HOT_PLUG_EINT_DEBOUNCETIME, (void *)&iccHotPlug.debounceTime, 4); #endif if (ipcStatus < 0) { kal_sprintf(sim_dbg_str,"get debounce fail %d %d, please request HW to check ALPS DWS setting.", ipcStatus, iccHotPlug.debounceTime); #if !defined( __MAUI_BASIC__) tst_sys_trace(sim_dbg_str); #else dbg_print(sim_dbg_str); #endif goto LEAVE_REG_EINT; } #if defined (__MD1__) || defined (__MD2__) || defined (__SIM_HOT_PLUG_SINGLE_MD_QUERY_STR__) ipcStatus = IPC_RPC_EINT_GetAttribute(query, 23, SIM_HOT_PLUG_EINT_POLARITY, (void *)&iccHotPlug.polarity, 4); #else ipcStatus = IPC_RPC_EINT_GetAttribute(query, 19, SIM_HOT_PLUG_EINT_POLARITY, (void *)&iccHotPlug.polarity, 4); #endif if (ipcStatus < 0) { kal_sprintf(sim_dbg_str,"get polarity fail %d %d, please request HW to check ALPS DWS setting.", ipcStatus, iccHotPlug.polarity); #if !defined( __MAUI_BASIC__) tst_sys_trace(sim_dbg_str); #else dbg_print(sim_dbg_str); #endif goto LEAVE_REG_EINT; } #if defined (__MD1__) || defined (__MD2__) || defined (__SIM_HOT_PLUG_SINGLE_MD_QUERY_STR__) ipcStatus = IPC_RPC_EINT_GetAttribute(query, 23, SIM_HOT_PLUG_EINT_SENSITIVITY, (void *)&iccHotPlug.sensitivity, 4); #else ipcStatus = IPC_RPC_EINT_GetAttribute(query, 19, SIM_HOT_PLUG_EINT_SENSITIVITY, (void *)&iccHotPlug.sensitivity, 4); #endif if (ipcStatus < 0) { kal_sprintf(sim_dbg_str,"get sensitivity fail %d %d, please request HW to check ALPS DWS setting.", ipcStatus, iccHotPlug.sensitivity); #if !defined( __MAUI_BASIC__) tst_sys_trace(sim_dbg_str); #else dbg_print(sim_dbg_str); #endif goto LEAVE_REG_EINT; } #if defined (__MD1__) || defined (__MD2__) || defined (__SIM_HOT_PLUG_SINGLE_MD_QUERY_STR__) ipcStatus = IPC_RPC_EINT_GetAttribute(query, 23, SIM_HOT_PLUG_EINT_SOCKETTYPE, (void *)&iccHotPlug.socketType, 4); #else ipcStatus = IPC_RPC_EINT_GetAttribute(query, 19, SIM_HOT_PLUG_EINT_SOCKETTYPE, (void *)&iccHotPlug.socketType, 4); #endif if (ipcStatus < 0) { kal_sprintf(sim_dbg_str,"get socket fail %d %d, please request HW to check ALPS DWS setting.", ipcStatus, iccHotPlug.socketType); #if !defined( __MAUI_BASIC__) tst_sys_trace(sim_dbg_str); #else dbg_print(sim_dbg_str); #endif goto LEAVE_REG_EINT; } sim_reg_hot_plug_eint(application, iccHotPlug.eintNo, iccHotPlug.debounceTime, iccHotPlug.polarity, iccHotPlug.sensitivity, iccHotPlug.socketType); LEAVE_REG_EINT: kal_sprintf(sim_dbg_str,"[SIM_DRV]EINT: %d, %d %d %d %d %d %d", application, ipcStatus, iccHotPlug.eintNo, iccHotPlug.debounceTime, iccHotPlug.polarity, iccHotPlug.sensitivity, iccHotPlug.socketType); #if !defined( __MAUI_BASIC__) tst_sys_trace(sim_dbg_str); #else dbg_print(sim_dbg_str); #endif kal_sprintf(sim_dbg_str,"[SIM_DRV]EINT: %s", query); #if !defined( __MAUI_BASIC__) tst_sys_trace(sim_dbg_str); #else dbg_print(sim_dbg_str); #endif #endif /* End of #ifdef __SIM_HOT_SWAP_SUPPORT__ */ simDriver->addMessage(SIM_AL_ACTION_EOC, simInterface, 0, 0); simDriver->EOC((sim_HW_cb *)(hwCbArray[simInterface])); #ifdef SIM_4_CARD_SMT_TEST /*find out the hooked function table*/ anotherSimDriver = sim_driverTable[anotherSimInterface]; ASSERT(0 != anotherSimDriver); anotherSimDriver->addMessage(SIM_AL_ACTION_RESET, anotherSimInterface, (kal_uint32)kal_get_current_thread_ID(), 0); anotherStatus = anotherSimDriver->reset(UNKNOWN_POWER_CLASS, &anotherResultVolt, warm, (sim_HW_cb *)(hwCbArray[anotherSimInterface])); if(USIM_NO_ERROR == anotherStatus) { #if !defined( __MAUI_BASIC__) tst_sys_trace("another SIM card found!!"); #else dbg_print("another SIM card found!!"); #endif } else { #if !defined( __MAUI_BASIC__) tst_sys_trace("another SIM card not found!!"); #else dbg_print("another SIM card not found!!"); #endif } anotherSimDriver->addMessage(SIM_AL_ACTION_EOC, anotherSimInterface, 0, 0); anotherSimDriver->EOC((sim_HW_cb *)(hwCbArray[anotherSimInterface])); #endif #endif #if defined (LPWR_SLIM) L1SM_SleepEnable(hw_cb->smHandler); //unlock sleep mode #endif return status; }
sim_status L1sim_Cmd_All(kal_uint8 *txData,kal_uint32 *txSize,kal_uint8 *rxData, kal_uint32 *rxSize, SIM_ICC_APPLICATION application) { sim_ctrlDriver *simDriver; sim_status status; kal_uint32 simInterface; sim_HW_cb *hw_cb; #if defined(__SIM_HOT_SWAP_POLL_TIMER__) && defined(__SIM_HOT_SWAP_SUPPORT__) Sim_Card *SimCard; usim_dcb_struct *usim_dcb; #endif simInterface = sim_get_logicalNum_from_app(application); hw_cb = (sim_HW_cb *)(hwCbArray[simInterface]); #if defined (LPWR_SLIM) L1SM_SleepDisable(hw_cb->smHandler); //lock sleep mode #endif if(DRV_SIM_MAX_LOGICAL_INTERFACE <= simInterface) ASSERT(0); if(KAL_TRUE == sim_physicalSlotChanged) simInterface = 1-simInterface; if(0x0 == txData || 0x0 == txSize || 0x0 == rxSize) ASSERT(0); /*find out the hooked function table*/ simDriver = sim_driverTable[simInterface]; ASSERT(0 != simDriver); simDriver->addMessage(SIM_AL_ACTION_COMMAND, simInterface, (kal_uint32)kal_get_current_thread_ID(), 0); status = simDriver->command(txData, txSize, rxData, rxSize, (sim_HW_cb *)(hwCbArray[simInterface])); simDriver->addMessage(SIM_AL_ACTION_EOC, simInterface, 0, 0); simDriver->EOC((sim_HW_cb *)(hwCbArray[simInterface])); #if defined (LPWR_SLIM) L1SM_SleepEnable(hw_cb->smHandler); //unlock sleep mode #endif #if defined(__SIM_HOT_SWAP_POLL_TIMER__) && defined(__SIM_HOT_SWAP_SUPPORT__) SimCard = GET_SIM_CB(hw_cb->simInterface); usim_dcb = GET_USIM_CB(hw_cb->simInterface); if(SimCard->poll_sim_2s || usim_dcb->poll_sim_2s) { sim_hot_swap_poll_timer_rollback(application); SimCard->poll_sim_2s = KAL_FALSE; usim_dcb->poll_sim_2s = KAL_FALSE; #if !defined( __MAUI_BASIC__) tst_sys_trace("[SIM DRV]stop timer\n\r"); #else dbg_print("[SIM DRV]stop timer\n\r"); #endif if(status == 0x0000) { #ifdef __SIM_HOT_SWAP_SUPPORT__ iccHotPlugTable[simInterface].plugOutcb(simInterface); #endif #if !defined( __MAUI_BASIC__) tst_sys_trace("[SIM DRV]real hot plug\n\r"); #else dbg_print("[SIM DRV]real hot plug\n\r"); #endif } } #endif return status; }