如何分开设定sim卡插卡和拔卡的debounce time

来源:互联网 发布:免费的晶体结构数据库 编辑:程序博客网 时间:2024/05/13 00:00

如何分开设定sim卡插卡和拔卡的debounce time

目前MTK的设计,插卡跟拔卡时间是一样的,都是来自于codegen.dws中的配置。
但是有时候客户想插卡和拔卡设定不同的时间,插卡时间可以设置长一些,确保卡放好后再上电,拔卡时可以设短一些,让卡可以及时下电。
这个想法可以实现,修改方法参考如下:
modem侧的代码:custom_sim_driver.c
1. void sim_hot_plug_eint_cb_rm_h_common(kal_uint32 idx, SIM_ICC_APPLICATION app)
{
if (iccHotPlugTable[idx].polarity == LEVEL_HIGH)
{
/* Remove card: polarity LEVEL_HIGH. When interrupt occurs, we should change it to
LEVEL_LOW
otherwise we will alwasy receive interrupt */
iccHotPlugTable[idx].removed = KAL_TRUE;
if (iccHotPlugTable[idx].plugOutcb != NULL)
{
#if defined(__SIM_HOT_SWAP_POLL_TIMER__)
SIM_PlugEvent_Poll_Timer_Cb(app);
#else
iccHotPlugTable[idx].plugOutcb(app);
#ifdef SIM_HOT_SWAP_V2
SIM_PlugEvent_Cb(app);
#endif
#endif
}
#if defined (__DUAL_SIM_HOT_SWAP_CO_DECK_SUPPORT__)
iccHotPlugTable[SIM_ICC_APPLICATION_PHONE2].removed = KAL_TRUE;
if (iccHotPlugTable[SIM_ICC_APPLICATION_PHONE2].plugOutcb != NULL)
{
#if defined(__SIM_HOT_SWAP_POLL_TIMER__)
SIM_PlugEvent_Poll_Timer_Cb(SIM_ICC_APPLICATION_PHONE2);
#else
iccHotPlugTable[SIM_ICC_APPLICATION_PHONE2].plugOutcb(SIM_ICC_APPLICATION_PHONE2);
#ifdef SIM_HOT_SWAP_V2
SIM_PlugEvent_Cb(SIM_ICC_APPLICATION_PHONE2);
#endif
#endif
}
#endif
iccHotPlugTable[idx].polarity = LEVEL_LOW;
#if defined (__DUAL_SIM_HOT_SWAP_CO_DECK_SUPPORT__)
iccHotPlugTable[SIM_ICC_APPLICATION_PHONE2].polarity = LEVEL_LOW;
#endif
kal_sprintf(sim_dbg_custom_str,"[SIM_CUS_DRV:%d]Remove SIM : %x, %x, %x, %x, %x, %x,
%x\n\r", __LINE__,
idx,
app,
iccHotPlugTable[idx].polarity,
iccHotPlugTable[idx].removed,
iccHotPlugTable[SIM_ICC_APPLICATION_PHONE2].polarity,
iccHotPlugTable[SIM_ICC_APPLICATION_PHONE2].removed,
drv_get_current_time());
#if defined (ATEST_DRV_ENABLE)
dbg_print(sim_dbg_custom_str);
#else
tst_sys_trace(sim_dbg_custom_str);
#endif
//添加下面这行,可以直接设定想要的时间,单位是10ms.
EINT_SW_Debounce_Modify(eintNo, debounceTime);//now removed,set plug in debounce time
}
else
{
/* Insert card: polarity LEVEL_LOW. When interrupt occurs, we should change it to
LEVEL_HIGH
otherwise we will alwasy receive interrupt */
iccHotPlugTable[idx].removed = KAL_FALSE;
if (iccHotPlugTable[idx].plugInCb!= NULL)
{
iccHotPlugTable[idx].plugInCb(app);
}
#if defined (__DUAL_SIM_HOT_SWAP_CO_DECK_SUPPORT__)
iccHotPlugTable[SIM_ICC_APPLICATION_PHONE2].removed = KAL_FALSE;
if (iccHotPlugTable[SIM_ICC_APPLICATION_PHONE2].plugInCb!= NULL)
{
iccHotPlugTable[SIM_ICC_APPLICATION_PHONE2].plugInCb(SIM_ICC_APPLICATION_PHONE2);
}
#endif
iccHotPlugTable[idx].polarity = LEVEL_HIGH;
#if defined (__DUAL_SIM_HOT_SWAP_CO_DECK_SUPPORT__)
iccHotPlugTable[SIM_ICC_APPLICATION_PHONE2].polarity = LEVEL_HIGH;
#endif
kal_sprintf(sim_dbg_custom_str,"[SIM_CUS_DRV:%d]Insert SIM : %x, %x, %x, %x, %x, %x,
%x\n\r", __LINE__,
idx,
app,
iccHotPlugTable[idx].polarity,
iccHotPlugTable[idx].removed,
iccHotPlugTable[SIM_ICC_APPLICATION_PHONE2].polarity,
iccHotPlugTable[SIM_ICC_APPLICATION_PHONE2].removed,
drv_get_current_time());
#if defined (ATEST_DRV_ENABLE)
dbg_print(sim_dbg_custom_str);
#else
tst_sys_trace(sim_dbg_custom_str);
#endif
//添加下面这行,可以直接设定想要的时间,单位是10ms.
EINT_SW_Debounce_Modify(eintNo, debounceTime);//now insert,set plug out debounce time
}
}
2.void sim_hot_plug_eint_cb_rm_l_common(kal_uint32 idx, SIM_ICC_APPLICATION app)
{
if (iccHotPlugTable[idx].polarity == LEVEL_LOW)
{
/* Remove card: polarity LEVEL_LOW. When interrupt occurs, we should change it to
LEVEL_HIGH
otherwise we will alwasy receive interrupt */
iccHotPlugTable[idx].removed = KAL_TRUE;
if (iccHotPlugTable[idx].plugOutcb != NULL)
{
#if defined(__SIM_HOT_SWAP_POLL_TIMER__)
SIM_PlugEvent_Poll_Timer_Cb(app);
#else
iccHotPlugTable[idx].plugOutcb(app);
#ifdef SIM_HOT_SWAP_V2
SIM_PlugEvent_Cb(app);
#endif
#endif
}
#if defined (__DUAL_SIM_HOT_SWAP_CO_DECK_SUPPORT__)
iccHotPlugTable[SIM_ICC_APPLICATION_PHONE2].removed = KAL_TRUE;
if (iccHotPlugTable[SIM_ICC_APPLICATION_PHONE2].plugOutcb != NULL)
{
#if defined(__SIM_HOT_SWAP_POLL_TIMER__)
SIM_PlugEvent_Poll_Timer_Cb(SIM_ICC_APPLICATION_PHONE2);
#else
iccHotPlugTable[SIM_ICC_APPLICATION_PHONE2].plugOutcb(SIM_ICC_APPLICATION_PHONE2);
#ifdef SIM_HOT_SWAP_V2
SIM_PlugEvent_Cb(SIM_ICC_APPLICATION_PHONE2);
#endif
#endif
}
#endif
iccHotPlugTable[idx].polarity = LEVEL_HIGH;
#if defined (__DUAL_SIM_HOT_SWAP_CO_DECK_SUPPORT__)
iccHotPlugTable[SIM_ICC_APPLICATION_PHONE2].polarity = LEVEL_HIGH;
#endif
kal_sprintf(sim_dbg_custom_str,"[SIM_CUS_DRV:%d]Remove SIM : %x, %x, %x, %x, %x, %x,
%x", __LINE__,
idx,
app,
iccHotPlugTable[idx].polarity,
iccHotPlugTable[idx].removed,
iccHotPlugTable[SIM_ICC_APPLICATION_PHONE2].polarity,
iccHotPlugTable[SIM_ICC_APPLICATION_PHONE2].removed,
drv_get_current_time());
#if defined (ATEST_DRV_ENABLE)
dbg_print(sim_dbg_custom_str);
#else
tst_sys_trace(sim_dbg_custom_str);
#endif
//添加下面这行,可以直接设定想要的时间,单位是10ms.
EINT_SW_Debounce_Modify(eintNo, debounceTime);//now removed,set plug in debounce time
}
else
{
/* Insert card: polarity LEVEL_HIGH. When interrupt occurs, we should change it to
LEVEL_LOW
otherwise we will alwasy receive interrupt */
iccHotPlugTable[idx].removed = KAL_FALSE;
if (iccHotPlugTable[idx].plugInCb != NULL)
{
iccHotPlugTable[idx].plugInCb(app);
}
#if defined (__DUAL_SIM_HOT_SWAP_CO_DECK_SUPPORT__)
iccHotPlugTable[SIM_ICC_APPLICATION_PHONE2].removed = KAL_FALSE;
if (iccHotPlugTable[SIM_ICC_APPLICATION_PHONE2].plugInCb!= NULL)
{
iccHotPlugTable[SIM_ICC_APPLICATION_PHONE2].plugInCb(SIM_ICC_APPLICATION_PHONE2);
}
#endif
iccHotPlugTable[idx].polarity = LEVEL_LOW;
#if defined (__DUAL_SIM_HOT_SWAP_CO_DECK_SUPPORT__)
iccHotPlugTable[SIM_ICC_APPLICATION_PHONE2].polarity = LEVEL_LOW;
#endif
kal_sprintf(sim_dbg_custom_str,"[SIM_CUS_DRV:%d]Insert SIM : %x, %x, %x, %x, %x, %x,
%x\n\r", __LINE__,
idx,
app,
iccHotPlugTable[idx].polarity,
iccHotPlugTable[idx].removed,
iccHotPlugTable[SIM_ICC_APPLICATION_PHONE2].polarity,
iccHotPlugTable[SIM_ICC_APPLICATION_PHONE2].removed,
drv_get_current_time());
#if defined (ATEST_DRV_ENABLE)
dbg_print(sim_dbg_custom_str);
#else
tst_sys_trace(sim_dbg_custom_str);
#endif
//添加下面这行,可以直接设定想要的时间,单位是10ms.
EINT_SW_Debounce_Modify(eintNo, debounceTime);//now insert,set plug out debounce time
}
}
3.void sim_reg_hot_plug_eint(SIM_ICC_APPLICATION application,
kal_uint32 eintNo,
kal_uint32 debounceTime,
kal_uint32 polarity,
kal_uint32 sensitivity,
kal_uint32 socketType)
{
kal_uint32 loopIndex;
for(loopIndex = 0; loopIndex < iccSlotNum; loopIndex++)
{
if(application == iccMappingTable[loopIndex].application){
if (iccHotPlugTable[loopIndex].registed == KAL_TRUE)
{
kal_sprintf(sim_dbg_custom_str, "[SIM_DRV]sim_registed\n\r");
#if defined (ATEST_DRV_ENABLE)
dbg_print(sim_dbg_custom_str);
#else
tst_sys_trace(sim_dbg_custom_str);
#endif
return;
} else
{
iccHotPlugTable[loopIndex].logicalNum = iccMappingTable[loopIndex].logicalNum;
iccHotPlugTable[loopIndex].application = iccMappingTable[loopIndex].application;
iccHotPlugTable[loopIndex].eintNo = eintNo;
iccHotPlugTable[loopIndex].debounceTime = debounceTime;
iccHotPlugTable[loopIndex].polarity = (kal_bool)polarity;
iccHotPlugTable[loopIndex].sensitivity = sensitivity;
iccHotPlugTable[loopIndex].socketType = socketType;
iccHotPlugTable[loopIndex].registed = KAL_TRUE;
#if defined (__DUAL_SIM_HOT_SWAP_CO_DECK_SUPPORT__)
iccHotPlugTable[SIM_ICC_APPLICATION_PHONE2].logicalNum =
iccMappingTable[SIM_ICC_APPLICATION_PHONE2].logicalNum;
iccHotPlugTable[SIM_ICC_APPLICATION_PHONE2].application = SIM_ICC_APPLICATION_PHONE2;
iccHotPlugTable[SIM_ICC_APPLICATION_PHONE2].eintNo = eintNo;
iccHotPlugTable[SIM_ICC_APPLICATION_PHONE2].debounceTime = debounceTime;
iccHotPlugTable[SIM_ICC_APPLICATION_PHONE2].polarity = (kal_bool)polarity;
iccHotPlugTable[SIM_ICC_APPLICATION_PHONE2].sensitivity = sensitivity;
iccHotPlugTable[SIM_ICC_APPLICATION_PHONE2].socketType = socketType;
iccHotPlugTable[SIM_ICC_APPLICATION_PHONE2].registed = KAL_TRUE;
#endif
break;
}
}
}
// need to set SW debounce & sensitivity before registration
//添加下面这行,可以直接设定想要的时间,单位是10ms.
EINT_SW_Debounce_Modify(eintNo, debounceTime);// init state, plut out debounce time
EINT_Set_Sensitivity(eintNo, sensitivity);
...}

0 0
原创粉丝点击