rjw | 6c1fd8f | 2022-11-30 14:33:01 +0800 | [diff] [blame] | 1 | #ifdef __SIM_DRV_MULTI_DRV_ARCH__ |
| 2 | #include "kal_public_api.h" //MSBB change #include "kal_release.h" |
| 3 | #include "drv_comm.h" |
| 4 | #include "dma_sw.h" |
| 5 | #include "intrCtrl.h" |
| 6 | #include "sim_hw.h" |
| 7 | #include "sim_al.h" |
| 8 | #include "sim_sw_comm.h" |
| 9 | |
| 10 | #include "sim_ca_icc_nagra.h" |
| 11 | #include "multi_icc_custom.h" |
| 12 | |
| 13 | extern sim_ctrlDriver sim_ctrlDriver_MT6302, sim_ctrlDriver_MTK; |
| 14 | extern kal_uint32 hwCbArray[SIM_DRV_MTK_INTERFACE_NUM]; |
| 15 | extern sim_ctrlDriver *sim_driverTable[]; |
| 16 | |
| 17 | extern sim_HW_cb simHWCbArray[]; |
| 18 | |
| 19 | TIccStatus DalIccInit(); |
| 20 | |
| 21 | sim_test_function_sim3() |
| 22 | { |
| 23 | TIccStatus IccStatus; |
| 24 | |
| 25 | |
| 26 | IccStatus = DalIccInit(); |
| 27 | test_icc(); |
| 28 | |
| 29 | } |
| 30 | |
| 31 | sim_test_function_sim1() |
| 32 | { |
| 33 | sim_power_enum resultVoltage; |
| 34 | sim_HW_cb *hw_cb; |
| 35 | usim_status_enum status; |
| 36 | kal_uint32 simInterface; |
| 37 | |
| 38 | simInterface = 0; |
| 39 | hw_cb = &simHWCbArray[simInterface]; |
| 40 | status = sim_ctrlDriver_MT6302.reset(UNKNOWN_POWER_CLASS, &resultVoltage, KAL_FALSE, hw_cb); |
| 41 | sim_ctrlDriver_MT6302.EOC(hw_cb); |
| 42 | } |
| 43 | |
| 44 | sim_test_function_sim2() |
| 45 | { |
| 46 | sim_power_enum resultVoltage; |
| 47 | sim_HW_cb *hw_cb; |
| 48 | usim_status_enum status; |
| 49 | kal_uint32 simInterface; |
| 50 | |
| 51 | |
| 52 | |
| 53 | |
| 54 | simInterface = 2; |
| 55 | hw_cb = &simHWCbArray[simInterface]; |
| 56 | status = sim_ctrlDriver_MT6302.reset(UNKNOWN_POWER_CLASS, &resultVoltage, KAL_FALSE, hw_cb); |
| 57 | sim_ctrlDriver_MT6302.EOC(hw_cb); |
| 58 | |
| 59 | } |
| 60 | |
| 61 | sim_test_reset_phone(SIM_ICC_APPLICATION application) |
| 62 | { |
| 63 | sim_power_enum resultVoltage; |
| 64 | usim_status_enum status; |
| 65 | status = L1sim_Reset_All(UNKNOWN_POWER_CLASS, &resultVoltage, KAL_FALSE, application); |
| 66 | } |
| 67 | |
| 68 | sim_test_phone_selectGSM(SIM_ICC_APPLICATION application) |
| 69 | { |
| 70 | SIM_test_selectGSMFile_multiple(application); |
| 71 | } |
| 72 | |
| 73 | |
| 74 | #if 0 |
| 75 | /* under construction !*/ |
| 76 | /* under construction !*/ |
| 77 | /* under construction !*/ |
| 78 | /* under construction !*/ |
| 79 | /* under construction !*/ |
| 80 | /* under construction !*/ |
| 81 | /* under construction !*/ |
| 82 | /* under construction !*/ |
| 83 | /* under construction !*/ |
| 84 | /* under construction !*/ |
| 85 | /* under construction !*/ |
| 86 | /* under construction !*/ |
| 87 | /* under construction !*/ |
| 88 | /* under construction !*/ |
| 89 | /* under construction !*/ |
| 90 | /* under construction !*/ |
| 91 | /* under construction !*/ |
| 92 | /* under construction !*/ |
| 93 | /* under construction !*/ |
| 94 | /* under construction !*/ |
| 95 | /* under construction !*/ |
| 96 | /* under construction !*/ |
| 97 | /* under construction !*/ |
| 98 | /* under construction !*/ |
| 99 | /* under construction !*/ |
| 100 | /* under construction !*/ |
| 101 | /* under construction !*/ |
| 102 | /* under construction !*/ |
| 103 | /* under construction !*/ |
| 104 | /* under construction !*/ |
| 105 | /* under construction !*/ |
| 106 | /* under construction !*/ |
| 107 | #ifdef GEMINI_UT_MORE_RESET_POWEROFF |
| 108 | /* under construction !*/ |
| 109 | /* under construction !*/ |
| 110 | /* under construction !*/ |
| 111 | /* under construction !*/ |
| 112 | /* under construction !*/ |
| 113 | #else |
| 114 | /* under construction !*/ |
| 115 | /* under construction !*/ |
| 116 | /* under construction !*/ |
| 117 | #endif |
| 118 | /* under construction !*/ |
| 119 | /* under construction !*/ |
| 120 | #ifdef GEMINI_UT_MORE_RESET_POWEROFF |
| 121 | /* under construction !*/ |
| 122 | /* under construction !*/ |
| 123 | /* under construction !*/ |
| 124 | /* under construction !*/ |
| 125 | /* under construction !*/ |
| 126 | #else |
| 127 | /* under construction !*/ |
| 128 | /* under construction !*/ |
| 129 | /* under construction !*/ |
| 130 | #endif |
| 131 | /* under construction !*/ |
| 132 | /* under construction !*/ |
| 133 | #ifdef GEMINI_UT_MORE_RESET_POWEROFF |
| 134 | /* under construction !*/ |
| 135 | /* under construction !*/ |
| 136 | /* under construction !*/ |
| 137 | /* under construction !*/ |
| 138 | #else |
| 139 | /* under construction !*/ |
| 140 | /* under construction !*/ |
| 141 | /* under construction !*/ |
| 142 | /* under construction !*/ |
| 143 | #endif |
| 144 | /* under construction !*/ |
| 145 | /* under construction !*/ |
| 146 | /* under construction !*/ |
| 147 | /* under construction !*/ |
| 148 | /* under construction !*/ |
| 149 | /* under construction !*/ |
| 150 | #endif |
| 151 | |
| 152 | init_all_cb2() |
| 153 | { |
| 154 | sim_init_hwCb(); |
| 155 | DRV_ICC_interface_init(SIM_ICC_APPLICATION_CMMB_SMD); |
| 156 | DRV_ICC_interface_init(SIM_ICC_APPLICATION_PHONE1); |
| 157 | DRV_ICC_interface_init(SIM_ICC_APPLICATION_PHONE2); |
| 158 | } |
| 159 | |
| 160 | init_all_cb() |
| 161 | { |
| 162 | sim_power_enum resultVoltage; |
| 163 | sim_HW_cb *hw_cb; |
| 164 | usim_status_enum status; |
| 165 | kal_uint32 simInterface; |
| 166 | TIccStatus IccStatus; |
| 167 | |
| 168 | #if (2 == SIM_DRV_MTK_INTERFACE_NUM) |
| 169 | { |
| 170 | simInterface = 1; |
| 171 | hw_cb = &simHWCbArray[simInterface]; |
| 172 | hwCbArray[simInterface] = (kal_uint32)hw_cb; |
| 173 | sim_driverTable[simInterface] = &sim_ctrlDriver_MTK; |
| 174 | |
| 175 | hw_cb->mtk_baseAddr = SIM2_base; |
| 176 | hw_cb->mtk_pdnAddr = DRVPDN_CON0; |
| 177 | hw_cb->mtk_pdnBit = DRVPDN_CON0_SIM2; |
| 178 | hw_cb->mtk_pdnDevice = PDN_SIM2; |
| 179 | hw_cb->mtk_dmaMaster = DMA_SIM2; |
| 180 | hw_cb->mtk_lisrCode = IRQ_SIM2_CODE; |
| 181 | hw_cb->simInterface = simInterface; |
| 182 | hw_cb->MT6302Interface = 0xFF; |
| 183 | hw_cb->MT6302PeerInterfaceCb = 0x0; |
| 184 | } |
| 185 | #endif |
| 186 | { |
| 187 | simInterface = 0; |
| 188 | hw_cb = &simHWCbArray[simInterface]; |
| 189 | hwCbArray[simInterface] = (kal_uint32)hw_cb; |
| 190 | hw_cb->mtk_baseAddr = SIM_base; |
| 191 | hw_cb->mtk_pdnAddr = DRVPDN_CON1; |
| 192 | hw_cb->mtk_pdnBit = DRVPDN_CON1_SIM; |
| 193 | hw_cb->mtk_pdnDevice = PDN_SIM; |
| 194 | hw_cb->mtk_dmaMaster = DMA_SIM; |
| 195 | hw_cb->mtk_lisrCode = IRQ_SIM_CODE; |
| 196 | hw_cb->simInterface = simInterface; |
| 197 | hw_cb->MT6302Interface = 0; |
| 198 | hw_cb->MT6302PeerInterfaceCb = &simHWCbArray[2]; |
| 199 | } |
| 200 | |
| 201 | { |
| 202 | simInterface = 2; |
| 203 | hw_cb = &simHWCbArray[simInterface]; |
| 204 | hwCbArray[simInterface] = (kal_uint32)hw_cb; |
| 205 | hw_cb->mtk_baseAddr = SIM_base; |
| 206 | hw_cb->mtk_pdnAddr = DRVPDN_CON1; |
| 207 | hw_cb->mtk_pdnBit = DRVPDN_CON1_SIM; |
| 208 | hw_cb->mtk_pdnDevice = PDN_SIM; |
| 209 | hw_cb->mtk_dmaMaster = DMA_SIM; |
| 210 | hw_cb->mtk_lisrCode = IRQ_SIM_CODE; |
| 211 | hw_cb->simInterface = simInterface; |
| 212 | hw_cb->MT6302Interface = 1; |
| 213 | hw_cb->MT6302PeerInterfaceCb = &simHWCbArray[0]; |
| 214 | } |
| 215 | |
| 216 | |
| 217 | } |
| 218 | |
| 219 | #define SIM_TEST_FUNCTION_NUMBER_MAX 5 |
| 220 | |
| 221 | void multiple_sim_test() |
| 222 | { |
| 223 | kal_uint32 testIndex = 0; |
| 224 | |
| 225 | sim_MT6302_init(); |
| 226 | init_all_cb2(); |
| 227 | |
| 228 | while(1){ |
| 229 | switch( (testIndex % SIM_TEST_FUNCTION_NUMBER_MAX)){ |
| 230 | case 0: |
| 231 | sim_test_function_sim3(); |
| 232 | break; |
| 233 | case 1: |
| 234 | sim_test_reset_phone(SIM_ICC_APPLICATION_PHONE1); |
| 235 | break; |
| 236 | case 2: |
| 237 | sim_test_reset_phone(SIM_ICC_APPLICATION_PHONE2); |
| 238 | break; |
| 239 | case 3: |
| 240 | sim_test_phone_selectGSM(SIM_ICC_APPLICATION_PHONE1); |
| 241 | break; |
| 242 | case 4: |
| 243 | sim_test_phone_selectGSM(SIM_ICC_APPLICATION_PHONE1); |
| 244 | break; |
| 245 | default: |
| 246 | ASSERT(0); |
| 247 | } |
| 248 | testIndex ++; |
| 249 | kal_sleep_task(20); |
| 250 | } |
| 251 | } |
| 252 | #endif /*__SIM_DRV_MULTI_DRV_ARCH__*/ |