| /***************************************************************************** |
| * Copyright Statement: |
| * -------------------- |
| * This software is protected by Copyright and the information contained |
| * herein is confidential. The software may not be copied and the information |
| * contained herein may not be used or disclosed except with the written |
| * permission of MediaTek Inc. (C) 2005 |
| * |
| * BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES |
| * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE") |
| * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON |
| * AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES, |
| * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF |
| * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT. |
| * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE |
| * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR |
| * SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH |
| * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO |
| * NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S |
| * SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM. |
| * |
| * BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE |
| * LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE, |
| * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE, |
| * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO |
| * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. |
| * |
| * THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE |
| * WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF |
| * LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND |
| * RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER |
| * THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC). |
| * |
| *****************************************************************************/ |
| |
| /***************************************************************************** |
| * Filename: |
| * --------- |
| * custom_em.c |
| * |
| * Project: |
| * -------- |
| * MAUI |
| * |
| * Description: |
| * ------------ |
| * This file is for engineer mode. |
| * |
| * Author: |
| * ------- |
| * ------- |
| * |
| *============================================================================ |
| * HISTORY |
| * Below this line, this part is controlled by ClearCase. DO NOT MODIFY!! |
| *------------------------------------------------------------------------------ |
| * $Log$ |
| * |
| * 08 02 2021 tongkun.zhang |
| * [MOLY00678004] [M80][FM350-GL][harvey.cheng][DIPC][NA][NA][NA]Dipc_config process consultation |
| * |
| * dipc enhance for security |
| * |
| * 07 29 2021 tongkun.zhang |
| * [MOLY00678004] [M80][FM350-GL][harvey.cheng][DIPC][NA][NA][NA]Dipc_config process consultation |
| * |
| * DIPC |
| * |
| * 07 27 2021 tongkun.zhang |
| * [MOLY00678004] [M80][FM350-GL][harvey.cheng][DIPC][NA][NA][NA]Dipc_config process consultation |
| * |
| * DIPC change for pcie control |
| * |
| * 11 10 2020 tongkun.zhang |
| * [MOLY00593154] [L5] patch back L5 from NR15.R3.MD700.MP to NR15.R3.MD700.MP |
| * |
| * [L5][OA] |
| * |
| * 08 06 2020 tongkun.zhang |
| * [MOLY00555238] [L5] patch back L5 to NR15.R3.T700.MP |
| * |
| * [L5][OA]Custom |
| * |
| * 07 19 2020 mingchun.cheng |
| * [MOLY00545496] [L5] patch back L5 to NR15.R3.MT6880.MP |
| * . |
| * |
| * 07 14 2020 tongkun.zhang |
| * [MOLY00545496] [L5] patch back L5 to NR15.R3.MT6880.MP |
| * |
| * L5 OA |
| * 06 23 2020 titi.wu |
| * [MOLY00536776] 97 LG ePDG new CHANNEL |
| * titi-RD |
| * |
| * 07 09 2020 mingchun.cheng |
| * [MOLY00533417] [L5] patch back L5 to NR15.R3.COLGIN.SB.SMT.DEV] |
| * |
| * . |
| * |
| * 09 18 2019 victoria.wang |
| * [MOLY00416922] DHL Legacy Wrapper migration and phase-out |
| * [Remove][DHL] phase out legacy wrapper API |
| * |
| * 07 31 2019 lucien.li |
| * [MOLY00408908] [CODE SYNC] Modem??SAR Sensor??έSARݨD? (VMOLY) |
| * |
| * (SWRD)[SAR Sensor][L4C] |
| * |
| * 05 24 2018 hong.yu |
| * [MOLY00325228] [UMOLYE] Remove NVRAM group header file |
| * include dhl_nvram_def.h |
| * |
| * 06 05 2017 hong.yu |
| * [MOLY00255008] [Gen93] fix build warning |
| * fix build warning |
| * |
| * 12 28 2016 hong.yu |
| * [MOLY00221317] [Gen93] L4 Integration M1 check in |
| * ATP,L4B and L4C M1 check in |
| * |
| * 11 24 2016 allen.hsu |
| * sync MOLY00212575. |
| * |
| * 03 04 2016 bart.liang |
| * [MOLY00164802] [L4C] Revise l4c for klocwork and coverity check |
| * For MSBB activity. |
| * |
| * 09 30 2015 bart.liang |
| * [MOLY00137572] [PS8] 2015 Q3 Build Warning Fix Activity |
| * . |
| * |
| * 07 22 2015 eason.lai |
| * [MOLY00130157] [TK6291][DHL] smart logging migration |
| * . |
| * |
| * 06 23 2015 lexel.yu |
| * [MOLY00123397] [MT6755][BRINGUP_FIRSTCALL] Replace compile option for speech port |
| * . |
| * |
| * 01 14 2015 bart.liang |
| * [MOLY00092425] Revise RF init status in L4C_init |
| * |
| * 11 13 2014 jerry.chang |
| * [MOLY00084326] checkin common custom file to MOLY.W14.42.LTE.p2 |
| * rollback to MOLY.W14.42.LTE.p2 |
| * |
| * 08 29 2014 xuejing.chen |
| * [MOLY00077547] [SGLTE DSDS] AT+EGMR write IMEI change |
| * . |
| * |
| * 05 19 2014 bart.liang |
| * [MOLY00065517] [MT6290] Add API for L4 to query the status of RF_init. |
| * |
| * 03 30 2014 xuejing.chen |
| * [MOLY00061326] [CMCC_SGLTE_P1] [MT6592][SGLTE][Free][EE]Externel (EE),0,0,99,/data/core/,1,modem, |
| * . |
| * |
| * 03 19 2014 lexel.yu |
| * [MOLY00059647] [MT6290E2] SAR feature support for 4G LTE |
| * 4G TX power reduction |
| * |
| * 12 31 2013 vend_bob.chiang |
| * [MOLY00051916] ??G750-T00?�读?�IMEI?�失败�?跟ALPS01209771 ?�象?��? |
| * . |
| * |
| * 12 13 2013 vend_bob.chiang |
| * [MOLY00046566] [Need Patch] [Volunteer Patch] low battery protect |
| * . |
| * |
| * 11 15 2013 ken.liu |
| * [MOLY00046623] [MT6290E1][DHL] Add filter on/off control for META tool |
| * add filter on/off control for META tool. |
| * |
| * 11 14 2013 lexel.yu |
| * [MOLY00013956] [MT6290 Bring-up][MT6290E1][FirstCall] Submit L4 revise for bring up |
| * Disable uart3 |
| * |
| * 07 01 2013 lexel.yu |
| * [MOLY00028040] Customized AT command port setting |
| * PS Port setting refined |
| * |
| * 06 13 2013 lexel.yu |
| * [MOLY00013956] [MT6290 Bring-up][MT6290E1][FirstCall] Submit L4 revise for bring up |
| * Port setting revise for SP boot up. |
| * MBCI revise for MBIM. |
| * |
| * 03 14 2013 xuejing.chen |
| * [MOLY00010058] Remove Driver FakeAPI |
| * Wrap pwm driver related codes with compile option. |
| * |
| * 02 04 2013 xuejing.chen |
| * [MOLY00009887] Rename MT7208 to MT6290 |
| * . |
| * |
| * 12 06 2012 danny.kuo |
| * [MOLY00005824] [NVRAM][MT6280][Change Feature] Support modem switch between RNDIS and HOSTED_DONGLE |
| * Integration change. |
| * |
| * 11 12 2012 chin-chieh.hung |
| * [MOLY00005322] TATAKA merge to MOLY |
| * add thumb2 instruction support & remove uart_port3 in MT7208 project |
| * |
| * 09 20 2012 mingtsung.sun |
| * [MOLY00000284] [PPP][MT6280] 3 PPP Dialup Support |
| * Integration change. - 3PPP + Voice call configuration of USB |
| * |
| * 08 21 2012 lexel.yu |
| * [MOLY00002426] KAL API replacement |
| * Integration change. |
| * |
| * 08 13 2012 lexel.yu |
| * [MOLY00001791] [MT6280] USB 5VCOM port setting |
| * Integration change. |
| * |
| * 08 02 2012 chenhao.gong |
| * [MOLY00000729] [L4C]Fix Moly compile warning |
| * . |
| * |
| * 07 19 2012 chenhao.gong |
| * [MOLY00000729] [L4C]Fix Moly compile warning |
| * . |
| * |
| * 07 10 2012 mingtsung.sun |
| * [MOLY00000284] [PPP][MT6280] 3 PPP Dialup Support |
| * Update port setting for 5VCOM |
| * |
| * 07 06 2012 mingtsung.sun |
| * [MOLY00000284] [PPP][MT6280] 3 PPP Dialup Support |
| * Auto camp on and generate USB COMs when bootup |
| * |
| * 06 01 2012 ray.lin-wang |
| * removed! |
| * . |
| * |
| * 05 30 2012 lexel.yu |
| * removed! |
| * <saved by Perforce> |
| * |
| * 05 25 2012 chenhao.gong |
| * removed! |
| * . |
| * |
| * 05 24 2012 wcpuser_integrator |
| * removed! |
| * Qinghua Yu check in global enum (MSG & SAP) at modem_dev. |
| * |
| * 05 24 2012 wcpuser_integrator |
| * removed! |
| * Qinghua Yu check in global enum (MSG & SAP) at modem_dev. |
| * |
| * 05 24 2012 wcpuser_integrator |
| * removed! |
| * Qinghua Yu check in global enum (MSG & SAP) at modem_dev. |
| * |
| * 05 21 2012 lexel.yu |
| * removed! |
| * 5VCOM - MODEM_DEV |
| * |
| * 05 18 2012 shyla.lan |
| * removed! |
| * Sync with MT6280_DVT_DEV |
| * |
| * 05 04 2012 chenhao.gong |
| * removed! |
| * . |
| * |
| * 04 24 2012 wcpuser_integrator |
| * removed! |
| * . |
| * |
| * 12 27 2011 jianhua.zhao |
| * removed! |
| * . |
| * |
| * 12 13 2011 jianhua.zhao |
| * removed! |
| * . |
| * |
| * 12 08 2011 jianhua.zhao |
| * removed! |
| * . |
| * |
| * 12 08 2011 jianhua.zhao |
| * removed! |
| * . |
| * |
| * 11 24 2011 shengkai.lin |
| * removed! |
| * . |
| * |
| * 11 17 2011 jianhua.zhao |
| * removed! |
| * . |
| * |
| * 11 15 2011 jianhua.zhao |
| * removed! |
| * . |
| * |
| * 11 15 2011 jianhua.zhao |
| * removed! |
| * . |
| * |
| * 11 08 2011 lexel.yu |
| * removed! |
| * MSBB Check in |
| * |
| * 11 04 2011 jianhua.zhao |
| * removed! |
| * . |
| * |
| * 08 04 2011 lexel.yu |
| * removed! |
| * Integration change. |
| * |
| * 08 02 2011 jianhua.zhao |
| * removed! |
| * . |
| * |
| * 08 02 2011 jianhua.zhao |
| * removed! |
| * . |
| * |
| * 06 02 2011 lexel.yu |
| * removed! |
| * Integration change. |
| * |
| * 05 23 2011 jianhua.zhao |
| * removed! |
| * . |
| * |
| * 05 18 2011 jianhua.zhao |
| * removed! |
| * . |
| * |
| * 04 19 2011 pohan.chu |
| * removed! |
| * CUSTOM CODEC PRIORITY |
| * |
| * 03 03 2011 chelun.tsai |
| * removed! |
| * . |
| * |
| * 03 03 2011 jianhua.zhao |
| * removed! |
| * . |
| * |
| * 02 17 2011 xiaojian.long |
| * removed! |
| * Check in TDD EM BLER Statistic |
| * |
| * 02 16 2011 hongwei.zhang |
| * removed! |
| * .SRNC ID display |
| * |
| * 02 15 2011 cylen.yao |
| * removed! |
| * [HAL] MAUI custom module split |
| * |
| * 01 31 2011 jianhua.zhao |
| * removed! |
| * . |
| * |
| * 01 20 2011 jianhua.zhao |
| * removed! |
| * . |
| * |
| * 01 10 2011 jianhua.zhao |
| * removed! |
| * . |
| * |
| * 01 06 2011 jianhua.zhao |
| * removed! |
| * . |
| * |
| * 01 05 2011 jianhua.zhao |
| * removed! |
| * . |
| * |
| * 12 30 2010 jinxing.hu |
| * removed! |
| * . |
| * |
| * 12 28 2010 jianhua.zhao |
| * removed! |
| * removed! |
| * . |
| * |
| * 12 28 2010 jianhua.zhao |
| * removed! |
| * . |
| * |
| * 12 24 2010 gordonjc.kuo |
| * removed! |
| * . |
| * |
| * 12 22 2010 jianhua.zhao |
| * removed! |
| * . |
| * |
| * 12 20 2010 jianhua.zhao |
| * removed! |
| * . |
| * |
| * 12 17 2010 jianhua.zhao |
| * removed! |
| * . |
| * |
| * 12 17 2010 jianhua.zhao |
| * removed! |
| * . |
| * |
| * 12 16 2010 jianhua.zhao |
| * removed! |
| * . |
| * |
| * 12 16 2010 jianhua.zhao |
| * removed! |
| * . |
| * |
| * 12 15 2010 lexel.yu |
| * removed! |
| * Integration change. |
| * |
| * 12 13 2010 jianhua.zhao |
| * removed! |
| * . |
| * |
| * 12 13 2010 jianhua.zhao |
| * removed! |
| * . |
| * |
| * 12 01 2010 yanfei.ding |
| * removed! |
| * [make c,r uas]Merge UL2 EM code backup MAUI. |
| * |
| * 11 30 2010 yongtuan.qiao |
| * removed! |
| * add TDD128 handover sequence info in EM. |
| * |
| * 11 30 2010 lexel.yu |
| * removed! |
| * <saved by Perforce> |
| * |
| * 11 30 2010 lexel.yu |
| * removed! |
| * remove swdbg_sw.h |
| * |
| * 11 28 2010 lexel.yu |
| * removed! |
| * Integration change. |
| * |
| * 11 27 2010 gordonjc.kuo |
| * removed! |
| * . |
| * |
| * 11 26 2010 jianhua.zhao |
| * removed! |
| * . |
| * |
| * 09 26 2010 jianhua.zhao |
| * removed! |
| * . |
| * |
| * 09 03 2010 shengkai.lin |
| * removed! |
| * . |
| * |
| * removed! |
| * removed! |
| * |
| * |
| * removed! |
| * removed! |
| * remove compile option |
| * |
| * removed! |
| * removed! |
| * |
| * |
| * removed! |
| * removed! |
| * |
| * |
| * removed! |
| * removed! |
| * |
| * |
| * removed! |
| * removed! |
| * |
| * |
| * removed! |
| * removed! |
| * volatile type |
| * |
| * removed! |
| * removed! |
| * |
| * |
| * removed! |
| * removed! |
| * |
| * |
| * removed! |
| * removed! |
| * |
| * |
| * removed! |
| * removed! |
| * |
| * |
| * removed! |
| * removed! |
| * |
| * |
| * removed! |
| * removed! |
| * |
| * |
| * removed! |
| * removed! |
| * |
| * |
| * removed! |
| * removed! |
| * |
| * |
| * removed! |
| * removed! |
| * |
| * |
| * removed! |
| * removed! |
| * |
| * |
| * removed! |
| * removed! |
| * |
| * |
| * removed! |
| * removed! |
| * |
| * |
| * removed! |
| * removed! |
| * |
| * |
| * removed! |
| * removed! |
| * |
| * |
| * removed! |
| * removed! |
| * |
| * |
| * removed! |
| * removed! |
| * |
| * |
| * removed! |
| * removed! |
| * |
| * |
| * removed! |
| * removed! |
| * Apply new EM architecture for 3G |
| * |
| * removed! |
| * removed! |
| * |
| * |
| * removed! |
| * removed! |
| * |
| * |
| * removed! |
| * removed! |
| * |
| * |
| * removed! |
| * removed! |
| * |
| * |
| * removed! |
| * removed! |
| * |
| * |
| * removed! |
| * removed! |
| * |
| * |
| * removed! |
| * removed! |
| * |
| * |
| * removed! |
| * removed! |
| * add plutommi compile option |
| * |
| * removed! |
| * removed! |
| * |
| * |
| * removed! |
| * removed! |
| * |
| * |
| * removed! |
| * removed! |
| * Move secure time into custom folder. |
| * |
| * removed! |
| * removed! |
| * Add custom_config_rlc_timer() for customer can set rlc timer value, default = 3 second. |
| * |
| * removed! |
| * removed! |
| * |
| * |
| * removed! |
| * removed! |
| * |
| * |
| * removed! |
| * removed! |
| * |
| * |
| * removed! |
| * removed! |
| * |
| * |
| * removed! |
| * removed! |
| * compile error |
| * |
| * removed! |
| * removed! |
| * Let customer can configure ACM boundary, if acm is exceed the reasonable boundary, turn off ACM check and will not disconnect MO/MT call. |
| * |
| * removed! |
| * rebase maintrunk.MAUI_MSZ on 03/17/2007 11:19:34 PM. |
| * |
| * |
| * removed! |
| * removed! |
| * |
| * |
| * removed! |
| * removed! |
| * |
| * |
| * removed! |
| * removed! |
| * |
| * |
| * removed! |
| * removed! |
| * |
| * |
| * removed! |
| * removed! |
| * Network Events notification mech. support. |
| * |
| * removed! |
| * removed! |
| * Fix MoDIS compile warning. |
| * |
| * removed! |
| * removed! |
| * |
| * |
| * removed! |
| * removed! |
| * |
| * |
| * removed! |
| * removed! |
| * download folder name customization |
| * |
| *------------------------------------------------------------------------------ |
| * Upper this line, this part is controlled by ClearCase. DO NOT MODIFY!! |
| *============================================================================ |
| ****************************************************************************/ |
| |
| #include "kal_general_types.h" |
| //#include "lcm_if.h" |
| #include "kal_public_api.h" |
| #include "string.h" |
| #include "nvram_data_items.h" |
| #include "kal_public_defs.h" |
| //#include "stack_common.h" |
| #include "dcl.h" |
| #include "kal_public_defs.h" //MSBB change #include "stack_config.h" |
| #include "nvram_interface.h" |
| //#include "lcd_if.h" |
| #include "custom_em.h" |
| #include "device.h" |
| #include "l1audio.h" |
| #include "em_struct.h" |
| #include "dcl.h" |
| #include "drv_comm.h" |
| #include "l4c_em.h" |
| #include "dhl_cc_public.h" |
| #include "ps_public_utility.h" |
| #include "dhl_nvram_def.h" |
| |
| #include "svc_sap.h" |
| #include "custom_port.h" |
| |
| typedef struct |
| { |
| kal_uint32 freq[CUSTOM_EM_PWM_TYPE_MAX]; |
| kal_uint32 duty_cycle[CUSTOM_EM_PWM_TYPE_MAX]; |
| } custom_em_pwm_param_set_struct; |
| |
| typedef struct |
| { |
| custom_em_pwm_param_set_struct custom_em_pwm_param; /* PWM Current Setting */ |
| custom_em_pwm_param_set_struct custom_em_pwm_level_param[CUSTOM_EM_PWM_LEVEL_MAX]; /* PWM Level */ |
| } custom_em_param_context_struct; |
| |
| #ifndef __L1_STANDALONE__ |
| static void custom_em_gpio_writeIO(kal_uint8 data, kal_uint8 port); |
| static void custom_em_gpo_writeIO(kal_uint8 data,kal_uint8 port); |
| #endif |
| |
| extern UART_PORT atp_custom_ps_uart_port(void); |
| |
| #ifndef __L1_STANDALONE__ |
| |
| kal_bool g_is_custom_em_init = KAL_FALSE; |
| custom_em_param_context_struct g_em_context; |
| |
| extern void PWM_level(kal_uint8 level); |
| |
| #ifndef DRV_PWM_NOT_EXIST |
| static kal_bool custom_em_init(kal_bool is_reset) |
| { |
| /*----------------------------------------------------------------*/ |
| /* Local Variables */ |
| /*----------------------------------------------------------------*/ |
| //kal_uint32 Ret, len; |
| |
| /*----------------------------------------------------------------*/ |
| /* Code Body */ |
| /*----------------------------------------------------------------*/ |
| kal_mem_set(&g_em_context, 0, sizeof(custom_em_param_context_struct)); |
| g_is_custom_em_init = KAL_TRUE; |
| return KAL_TRUE; |
| } |
| #endif |
| |
| kal_uint8 custom_em_pwm_get_hw_current_level(CUSTOM_EM_PWM_TYPE type) |
| { |
| /*----------------------------------------------------------------*/ |
| /* Local Variables */ |
| /*----------------------------------------------------------------*/ |
| |
| /*----------------------------------------------------------------*/ |
| /* Code Body */ |
| /*----------------------------------------------------------------*/ |
| #ifndef DRV_PWM_NOT_EXIST |
| DCL_HANDLE pwm_handle; |
| DCL_CTRL_DATA_T data; |
| switch (type) |
| { |
| case (CUSTOM_EM_PWM_TYPE_1): |
| pwm_handle=DclPWM_Open(DCL_PWM1,MOD_UEM); |
| DclPWM_Control(pwm_handle,PWM_CMD_GET_CURRENT_LEVEL,&data); |
| DclPWM_Close(pwm_handle); |
| return data.rPWMSaveData.pwm_level; |
| |
| case (CUSTOM_EM_PWM_TYPE_2): |
| return 0; |
| |
| case (CUSTOM_EM_PWM_TYPE_3): |
| pwm_handle=DclPWM_Open(DCL_PWM3, MOD_UEM); |
| DclPWM_Control(pwm_handle,PWM_CMD_GET_CURRENT_LEVEL,&data); |
| DclPWM_Close(pwm_handle); |
| return data.rPWMSaveData.pwm_level; |
| default: |
| ASSERT(0); |
| break; |
| } |
| #endif |
| return 0; |
| } |
| |
| kal_bool custom_em_pwm_get_level_value( |
| CUSTOM_EM_PWM_TYPE type, |
| CUSTOM_EM_PWM_LEVEL level, |
| kal_uint16 *freq, |
| kal_uint8 *duty_cycle) |
| { |
| /*----------------------------------------------------------------*/ |
| /* Local Variables */ |
| /*----------------------------------------------------------------*/ |
| |
| /*----------------------------------------------------------------*/ |
| /* Code Body */ |
| /*----------------------------------------------------------------*/ |
| #ifndef DRV_PWM_NOT_EXIST |
| if (g_is_custom_em_init != KAL_TRUE) |
| { |
| custom_em_init(KAL_FALSE); |
| } |
| |
| if (level >= CUSTOM_EM_PWM_LEVEL_MAX || type >= CUSTOM_EM_PWM_TYPE_MAX) |
| { |
| return KAL_FALSE; |
| } |
| |
| *freq = g_em_context.custom_em_pwm_level_param[level].freq[type]; |
| *duty_cycle = g_em_context.custom_em_pwm_level_param[level].duty_cycle[type]; |
| |
| return KAL_TRUE; |
| #else |
| return KAL_FALSE; |
| #endif |
| } |
| |
| extern void PWM3_level(kal_uint8 level); |
| void custom_em_pwm_set_level(CUSTOM_EM_PWM_TYPE type, kal_uint8 level) |
| { |
| /*----------------------------------------------------------------*/ |
| /* Local Variables */ |
| /*----------------------------------------------------------------*/ |
| |
| /*----------------------------------------------------------------*/ |
| /* Code Body */ |
| /*----------------------------------------------------------------*/ |
| #ifndef DRV_PWM_NOT_EXIST |
| switch (type) |
| { |
| case (CUSTOM_EM_PWM_TYPE_1): |
| PWM_level(level); |
| break; |
| case (CUSTOM_EM_PWM_TYPE_2): |
| break; |
| case (CUSTOM_EM_PWM_TYPE_3): |
| PWM3_level(level); |
| break; |
| default: |
| ASSERT(0); |
| break; |
| } |
| #endif |
| } |
| |
| kal_bool custom_em_pwm_set_level_value( |
| CUSTOM_EM_PWM_TYPE type, |
| CUSTOM_EM_PWM_LEVEL level, |
| kal_uint16 freq, |
| kal_uint8 duty_cycle) |
| { |
| /*----------------------------------------------------------------*/ |
| /* Local Variables */ |
| /*----------------------------------------------------------------*/ |
| |
| /*----------------------------------------------------------------*/ |
| /* Code Body */ |
| /*----------------------------------------------------------------*/ |
| #ifndef DRV_PWM_NOT_EXIST |
| if (g_is_custom_em_init != KAL_TRUE) |
| { |
| custom_em_init(KAL_FALSE); |
| } |
| |
| if (level >= CUSTOM_EM_PWM_LEVEL_MAX || type >= CUSTOM_EM_PWM_TYPE_MAX) |
| { |
| return KAL_FALSE; |
| } |
| |
| g_em_context.custom_em_pwm_level_param[level].freq[type] = freq; |
| g_em_context.custom_em_pwm_level_param[level].duty_cycle[type] = duty_cycle; |
| |
| |
| return KAL_TRUE; |
| #else |
| return KAL_FALSE; |
| #endif |
| } |
| |
| void custom_em_pwm_start(CUSTOM_EM_PWM_TYPE type, kal_uint32 freq, kal_uint32 duty) |
| { |
| /*----------------------------------------------------------------*/ |
| /* Local Variables */ |
| /*----------------------------------------------------------------*/ |
| |
| /*----------------------------------------------------------------*/ |
| /* Code Body */ |
| /*----------------------------------------------------------------*/ |
| #ifndef DRV_PWM_NOT_EXIST |
| DCL_HANDLE pwm_handle; |
| PWM_CMD_CONFIG_OLD_T old_config; |
| //ALERTER_CONFIGURE_T alerter_config; |
| if (g_is_custom_em_init != KAL_TRUE) |
| { |
| custom_em_init(KAL_FALSE); |
| } |
| |
| switch (type) |
| { |
| case (CUSTOM_EM_PWM_TYPE_1): |
| pwm_handle=DclPWM_Open(DCL_PWM1,MOD_UEM); |
| old_config.freq=freq; |
| old_config.duty=duty; |
| DclPWM_Control(pwm_handle,PWM_CMD_CONFIG_OLD,(DCL_CTRL_DATA_T*)&old_config); |
| DclPWM_Control(pwm_handle,PWM_CMD_START,0); |
| DclPWM_Close(pwm_handle); |
| break; |
| |
| case (CUSTOM_EM_PWM_TYPE_2): |
| break; |
| |
| case (CUSTOM_EM_PWM_TYPE_3): |
| pwm_handle=DclPWM_Open(DCL_PWM3,MOD_UEM); |
| old_config.freq=freq; |
| old_config.duty=duty; |
| DclPWM_Control(pwm_handle,PWM_CMD_CONFIG_OLD,(DCL_CTRL_DATA_T*)&old_config); |
| DclPWM_Control(pwm_handle,PWM_CMD_START,0); |
| DclPWM_Close(pwm_handle); |
| break; |
| |
| default: |
| ASSERT(0); |
| break; |
| } |
| #endif |
| } |
| |
| |
| /***************************************************************************** |
| * FUNCTION |
| * custom_em_pwm_stop |
| * DESCRIPTION |
| * |
| * PARAMETERS |
| * type [IN] |
| * RETURNS |
| * void |
| *****************************************************************************/ |
| void custom_em_pwm_stop(CUSTOM_EM_PWM_TYPE type) |
| { |
| /*----------------------------------------------------------------*/ |
| /* Local Variables */ |
| /*----------------------------------------------------------------*/ |
| |
| /*----------------------------------------------------------------*/ |
| /* Code Body */ |
| /*----------------------------------------------------------------*/ |
| #ifndef DRV_PWM_NOT_EXIST |
| DCL_HANDLE pwm_handle; |
| if (g_is_custom_em_init != KAL_TRUE) |
| { |
| custom_em_init(KAL_FALSE); |
| } |
| |
| switch (type) |
| { |
| case (CUSTOM_EM_PWM_TYPE_1): |
| pwm_handle=DclPWM_Open(DCL_PWM1,MOD_UEM); |
| DclPWM_Control(pwm_handle,PWM_CMD_STOP,0); |
| DclPWM_Close(pwm_handle); |
| break; |
| |
| case (CUSTOM_EM_PWM_TYPE_2): |
| break; |
| |
| case (CUSTOM_EM_PWM_TYPE_3): |
| pwm_handle=DclPWM_Open(DCL_PWM3,MOD_UEM); |
| DclPWM_Control(pwm_handle,PWM_CMD_STOP,0); |
| DclPWM_Close(pwm_handle); |
| break; |
| |
| default: |
| ASSERT(0); |
| break; |
| } |
| #endif |
| } |
| |
| void custom_em_pwm_get_value(kal_uint16 *freq, kal_uint8 *duty_cycle) |
| { |
| /*----------------------------------------------------------------*/ |
| /* Local Variables */ |
| /*----------------------------------------------------------------*/ |
| |
| /*----------------------------------------------------------------*/ |
| /* Code Body */ |
| /*----------------------------------------------------------------*/ |
| #ifndef DRV_PWM_NOT_EXIST |
| if (g_is_custom_em_init != KAL_TRUE) |
| { |
| custom_em_init(KAL_FALSE); |
| } |
| |
| kal_mem_cpy(freq, g_em_context.custom_em_pwm_param.freq, sizeof(g_em_context.custom_em_pwm_param.freq)); |
| kal_mem_cpy( |
| duty_cycle, |
| g_em_context.custom_em_pwm_param.duty_cycle, |
| sizeof(g_em_context.custom_em_pwm_param.duty_cycle)); |
| #endif |
| } |
| |
| |
| /***************************************************************************** |
| * FUNCTION |
| * custom_em_pwm_set_value |
| * DESCRIPTION |
| * |
| * PARAMETERS |
| * freq [?] |
| * duty_cycle [?] |
| * RETURNS |
| * void |
| *****************************************************************************/ |
| void custom_em_pwm_set_value(kal_uint16 *freq, kal_uint8 *duty_cycle) |
| { |
| /*----------------------------------------------------------------*/ |
| /* Local Variables */ |
| /*----------------------------------------------------------------*/ |
| |
| /*----------------------------------------------------------------*/ |
| /* Code Body */ |
| /*----------------------------------------------------------------*/ |
| #ifndef DRV_PWM_NOT_EXIST |
| if (g_is_custom_em_init != KAL_TRUE) |
| { |
| custom_em_init(KAL_FALSE); |
| } |
| |
| kal_mem_cpy(g_em_context.custom_em_pwm_param.freq, freq, sizeof(g_em_context.custom_em_pwm_param.freq)); |
| kal_mem_cpy( |
| g_em_context.custom_em_pwm_param.duty_cycle, |
| duty_cycle, |
| sizeof(g_em_context.custom_em_pwm_param.duty_cycle)); |
| #endif |
| } |
| |
| /***************************************************************************** |
| * FUNCTION |
| * custom_em_gpio_start |
| * DESCRIPTION |
| * |
| * PARAMETERS |
| * port [IN] |
| * RETURNS |
| * void |
| *****************************************************************************/ |
| void custom_em_gpio_start(kal_uint8 port) |
| { |
| /*----------------------------------------------------------------*/ |
| /* Local Variables */ |
| /*----------------------------------------------------------------*/ |
| |
| /*----------------------------------------------------------------*/ |
| /* Code Body */ |
| /*----------------------------------------------------------------*/ |
| custom_em_gpio_writeIO(1, port); |
| } |
| |
| /***************************************************************************** |
| * FUNCTION |
| * custom_em_gpio_stop |
| * DESCRIPTION |
| * |
| * PARAMETERS |
| * port [IN] |
| * RETURNS |
| * void |
| *****************************************************************************/ |
| void custom_em_gpio_stop(kal_uint8 port) |
| { |
| /*----------------------------------------------------------------*/ |
| /* Local Variables */ |
| /*----------------------------------------------------------------*/ |
| |
| /*----------------------------------------------------------------*/ |
| /* Code Body */ |
| /*----------------------------------------------------------------*/ |
| custom_em_gpio_writeIO(0, port); |
| } |
| |
| /***************************************************************************** |
| * FUNCTION |
| * custom_em_gpo_writeio |
| * DESCRIPTION |
| * |
| * PARAMETERS |
| * data [IN] |
| * port [IN] |
| * RETURNS |
| * void |
| *****************************************************************************/ |
| void custom_em_gpo_writeio(kal_int8 data, kal_int8 port) |
| { |
| /*----------------------------------------------------------------*/ |
| /* Local Variables */ |
| /*----------------------------------------------------------------*/ |
| |
| /*----------------------------------------------------------------*/ |
| /* Code Body */ |
| /*----------------------------------------------------------------*/ |
| custom_em_gpo_writeIO(data, port); |
| } |
| |
| |
| #endif /* __L1_STANDALONE__ */ |
| |
| static kal_uint8 CTI_UART_PORT = 0; |
| static UART_baudrate CTI_BAUD_RATE = 0; |
| |
| kal_bool High_Speed_SIM = KAL_FALSE; |
| kal_uint8 UART_POWER_SETTING = 0; |
| |
| kal_uint8 g_usb_cdrom_config; |
| |
| #ifdef __TST_MODULE__ |
| extern UART_PORT TST_PORT; |
| extern UART_baudrate TST_BAUDRATE; |
| |
| extern UART_PORT TST_PORT_L1; |
| extern UART_baudrate TST_BAUDRATE_L1; |
| |
| #if defined(__DSP_FCORE4__) |
| extern UART_PORT TST_PORT_DSP; |
| extern UART_baudrate TST_BAUDRATE_DSP; |
| #endif //#if defined(__DSP_FCORE4__) |
| |
| /* This macro can be located at the makefile */ |
| #ifdef __TST_WRITE_TO_FILE__ |
| extern kal_uint8 TST_OUTPUT_MODE; |
| #endif |
| |
| #ifndef L4_NOT_PRESENT |
| extern UART_PORT PS_UART_PORT; |
| extern UART_PORT PS_UART_PORT_2; |
| extern UART_PORT PS_EPDG_CMD_PORT; |
| extern UART_PORT PS_EPDG_URC_PORT; |
| extern UART_PORT PS_EPDG_CMD_PORT_2; |
| extern UART_PORT PS_EPDG_URC_PORT_2; |
| extern UART_baudrate PS_BAUDRATE; |
| #endif /* L4_NOT_PRESENT */ |
| #endif /* __TST_MODULE__ */ |
| extern kal_uint8 SWDBG_Profile; |
| extern kal_uint32 BytesPerCluster; /* will be set to exact value in nvram_get_disk_file_info */ |
| |
| |
| #ifdef __DATA_CARD_SPEECH__ |
| #ifdef __MTK_TARGET__ |
| extern UART_PORT SPEECH_PORT; |
| #endif |
| #endif |
| |
| extern void UART_TurnOnPower(UART_PORT port, kal_bool enable); |
| #ifndef __L1_STANDALONE__ |
| static kal_bool custom_em_is_uart_used(UART_PORT port); |
| #endif |
| |
| extern boot_mode_type stack_query_boot_mode(void); |
| |
| #ifndef __MAUI_BASIC__ |
| |
| static void custom_em_uart_turnon_power(UART_PORT port, kal_bool on); |
| |
| |
| /***************************************************************************** |
| * FUNCTION |
| * nvram_config_com_port |
| * DESCRIPTION |
| * To init COM port setting |
| * PARAMETERS |
| * void |
| * RETURNS |
| * void |
| *****************************************************************************/ |
| void custom_em_nvram_config_com_port(void) |
| { |
| /*----------------------------------------------------------------*/ |
| /* Local Variables */ |
| /*----------------------------------------------------------------*/ |
| kal_uint8 *buffer = NULL; |
| kal_bool result; |
| #if defined(__BOOT_FOR_USBAT__) && defined(__MTK_TARGET__) |
| kal_bool for_usbat = KAL_FALSE; |
| #endif |
| /*----------------------------------------------------------------*/ |
| /* Code Body */ |
| /*----------------------------------------------------------------*/ |
| buffer = (kal_uint8*) get_ctrl_buffer(NVRAM_EF_PORT_SETTING_SIZE); |
| |
| if (buffer) |
| { |
| port_setting_struct *port_setting; |
| |
| result = nvram_external_read_data(NVRAM_EF_PORT_SETTING_LID, 1, buffer, NVRAM_EF_PORT_SETTING_SIZE); |
| |
| /* Ok, now config UART/IrCOMM ports for L4 and TST, and filters to TST */ |
| if (result) |
| { |
| #if defined(__BOOT_FOR_USBAT__) && defined(__MTK_TARGET__) |
| for_usbat = INT_IsBootForUSBAT(); |
| #endif |
| |
| |
| port_setting = (port_setting_struct*) buffer; |
| |
| #ifdef __TST_MODULE__ |
| |
| #ifdef __IRDA_SUPPORT__ |
| if ( (uart_port_irda == (UART_PORT) port_setting->tst_port_ps) || |
| (uart_port_irda == (UART_PORT) port_setting->tst_port_l1)) |
| { |
| init_ircomm_module(); |
| IRDA_Open(); |
| } |
| #endif /* __IRDA_SUPPORT__ */ |
| |
| #if defined(__BOOT_FOR_USBAT__) && defined(__MTK_TARGET__) |
| if (for_usbat) |
| { |
| TST_PORT = (UART_PORT) uart_port1; |
| TST_PORT_L1 = (UART_PORT) uart_port1; |
| } |
| else |
| #endif |
| { |
| TST_PORT = (UART_PORT) port_setting->tst_port_ps; |
| TST_PORT_L1 = (UART_PORT) port_setting->tst_port_l1; |
| } |
| |
| TST_BAUDRATE = port_setting->tst_baudrate_ps; |
| TST_BAUDRATE_L1 = port_setting->tst_baudrate_l1; |
| |
| #ifndef L4_NOT_PRESENT |
| #if defined(__BOOT_FOR_USBAT__) && defined(__MTK_TARGET__) |
| if (for_usbat) |
| { |
| PS_UART_PORT = (UART_PORT) uart_port_usb; |
| } |
| else |
| #endif |
| { |
| kal_uint8 port_mode = CUSTOM_PORT_GET_MODE(CUSTOM_PORT_USER_AT); |
| switch (port_mode) { |
| case PORT_MODE_USB: |
| PS_UART_PORT = (UART_PORT) uart_port_usb; |
| break; |
| case PORT_MODE_PCIE: |
| if(0 != CUSTOM_PORT_GET_PCIE_ENABLE(CUSTOM_PORT_USER_AT)) { |
| PS_UART_PORT = (UART_PORT) uart_port_at_ccci; |
| } else { |
| PS_UART_PORT = (UART_PORT) uart_port_null; |
| } |
| break; |
| default: |
| PS_UART_PORT = (UART_PORT) port_setting->ps_port; |
| } |
| PS_UART_PORT_2 = (UART_PORT) port_setting->ndis_port; |
| PS_EPDG_CMD_PORT = (UART_PORT) port_setting->epdg_cmd_port; |
| PS_EPDG_URC_PORT = (UART_PORT) port_setting->epdg_urc_port; |
| PS_EPDG_CMD_PORT_2 = (UART_PORT) port_setting->epdg_cmd_port_2; |
| PS_EPDG_URC_PORT_2 = (UART_PORT) port_setting->epdg_urc_port_2; |
| } |
| PS_BAUDRATE = port_setting->ps_baudrate; |
| |
| #endif /* L4_NOT_PRESENT */ |
| |
| #if defined(__DSP_FCORE4__) |
| TST_PORT_DSP = (UART_PORT) port_setting->tst_port_dsp; |
| TST_BAUDRATE_DSP = port_setting->tst_baud_rate_dsp; |
| #endif //#if defined(__DSP_FCORE4__) |
| |
| #endif /* __TST_MODULE__ */ |
| |
| High_Speed_SIM = port_setting->High_Speed_SIM_Enabled; |
| |
| if (High_Speed_SIM) |
| { |
| // remove |
| } |
| |
| SWDBG_Profile = port_setting->swdbg; |
| UART_POWER_SETTING = port_setting->uart_power_setting; |
| CTI_UART_PORT = port_setting->cti_uart_port; |
| CTI_BAUD_RATE = port_setting->cti_baudrate; |
| |
| #ifdef __TST_WRITE_TO_FILE__ |
| TST_OUTPUT_MODE = port_setting->tst_output_mode; |
| #endif |
| |
| |
| #ifdef __MTK_TARGET__ |
| #ifndef __L1_STANDALONE__ |
| /* To determine if in META mode */ |
| if (FACTORY_BOOT != kal_query_boot_mode()) |
| { |
| //kal_bool enable; |
| |
| if (custom_em_is_uart_used(uart_port1)) |
| { |
| custom_em_uart_turnon_power(uart_port1, KAL_TRUE); |
| } |
| else |
| { |
| custom_em_uart_turnon_power(uart_port1, KAL_FALSE); |
| } |
| #ifndef __SMART_PHONE_MODEM__ |
| if (custom_em_is_uart_used(uart_port2)) |
| { |
| custom_em_uart_turnon_power(uart_port2, KAL_TRUE); |
| } |
| else |
| { |
| custom_em_uart_turnon_power(uart_port2, KAL_FALSE); |
| } |
| |
| #if 0 |
| /* under construction !*/ |
| /* under construction !*/ |
| /* under construction !*/ |
| /* under construction !*/ |
| /* under construction !*/ |
| /* under construction !*/ |
| /* under construction !*/ |
| /* under construction !*/ |
| #endif |
| #endif |
| } |
| else /* In META Mode, Turn on every UART power */ |
| #endif /* __L1_STANDALONE__ */ |
| { |
| #ifndef __SMART_PHONE_MODEM__ |
| custom_em_uart_turnon_power(uart_port1, KAL_TRUE); |
| custom_em_uart_turnon_power(uart_port2, KAL_TRUE); |
| #if 0 |
| /* under construction !*/ |
| #endif |
| #endif |
| } |
| #endif /* __MTK_TARGET__ */ |
| |
| g_usb_cdrom_config = port_setting->usb_cdrom_config; |
| |
| #ifdef __DATA_CARD_SPEECH__ |
| #ifdef __MTK_TARGET__ |
| SPEECH_PORT = port_setting->speech_port; |
| #endif |
| #endif |
| } |
| |
| free_ctrl_buffer(buffer); |
| } |
| |
| buffer = NULL; |
| } |
| |
| |
| #ifndef __L1_STANDALONE__ |
| static kal_bool custom_em_is_uart_used(UART_PORT port) |
| { |
| #if defined(__TST_MODULE__) |
| if (TST_PORT == port || |
| TST_PORT_L1 == port |
| #if !defined(L4_NOT_PRESENT) |
| || PS_UART_PORT == port |
| || PS_UART_PORT_2 == port |
| || PS_EPDG_CMD_PORT == port |
| || PS_EPDG_URC_PORT == port |
| || PS_EPDG_CMD_PORT_2 == port |
| || PS_EPDG_URC_PORT_2 == port |
| || atp_custom_ps_uart_port() == port |
| #endif |
| #if defined(__DSP_FCORE4__) |
| || TST_PORT_DSP == port |
| #endif |
| ) |
| { |
| return KAL_TRUE; |
| } |
| else |
| #endif //#if defined(__TST_MODULE__) |
| { |
| return KAL_FALSE; |
| } |
| } |
| #endif |
| |
| |
| /***************************************************************************** |
| * FUNCTION |
| * custom_em_get_usb_cdrom_config |
| * DESCRIPTION |
| * To get USB CDROM configure value |
| * PARAMETERS |
| * void |
| * RETURNS |
| * 0 for CDROM, 1 for COM |
| *****************************************************************************/ |
| kal_uint8 custom_em_get_usb_cdrom_config(void) |
| { |
| return g_usb_cdrom_config; |
| } |
| |
| /***************************************************************************** |
| * FUNCTION |
| * custom_em_set_usb_cdrom_config |
| * DESCRIPTION |
| * To set USB CDROM configure value |
| * PARAMETERS |
| * value |
| * RETURNS |
| * void |
| *****************************************************************************/ |
| void custom_em_set_usb_cdrom_config(kal_uint8 cdrom_config) |
| { |
| g_usb_cdrom_config = cdrom_config; |
| } |
| |
| #endif /* #ifndef __MAUI_BASIC__*/ |
| |
| /***************************************************************************** |
| * FUNCTION |
| * nvram_get_cti |
| * DESCRIPTION |
| * To get CTI_UART_PORT |
| * PARAMETERS |
| * void |
| * RETURNS |
| * kal_uint8 [OUT] CTI |
| *****************************************************************************/ |
| void nvram_get_cti(kal_uint8 *port, kal_uint32 *baudrate) |
| { |
| /*----------------------------------------------------------------*/ |
| /* Local Variables */ |
| /*----------------------------------------------------------------*/ |
| |
| /*----------------------------------------------------------------*/ |
| /* Code Body */ |
| /*----------------------------------------------------------------*/ |
| |
| *port = CTI_UART_PORT; |
| *baudrate = (kal_uint32) CTI_BAUD_RATE; |
| return; |
| } |
| |
| |
| |
| /***************************************************************************** |
| * FUNCTION |
| * nvram_get_speech |
| * DESCRIPTION |
| * To get SPEECH_PORT |
| * PARAMETERS |
| * void |
| * RETURNS |
| * kal_uint8 [OUT] CTI |
| *****************************************************************************/ |
| void nvram_get_speech(kal_uint8 *port, kal_uint32 *baudrate) |
| { |
| #ifdef __DATA_CARD_SPEECH__ |
| #ifdef __MTK_TARGET__ |
| *port = SPEECH_PORT; |
| *baudrate = 0; |
| #endif |
| #endif |
| return; |
| } |
| |
| /***************************************************************************** |
| * FUNCTION |
| * nvram_get_swdbg |
| * DESCRIPTION |
| * To get SWDBG_Profile |
| * PARAMETERS |
| * void |
| * RETURNS |
| * kal_uint8 [OUT] swdbg_profile |
| *****************************************************************************/ |
| void nvram_get_swdbg(kal_uint8 *swdbg_profile) |
| { |
| /*----------------------------------------------------------------*/ |
| /* Local Variables */ |
| /*----------------------------------------------------------------*/ |
| |
| /*----------------------------------------------------------------*/ |
| /* Code Body */ |
| /*----------------------------------------------------------------*/ |
| |
| *swdbg_profile = SWDBG_Profile; |
| } |
| |
| void custom_em_uart_turnon_power(UART_PORT port, kal_bool on) |
| { |
| DCL_HANDLE handle; |
| UART_CTRL_POWERON_T data; |
| |
| handle = DclSerialPort_Open(port, 0); |
| data.bFlag_Poweron = on; |
| DclSerialPort_Control(handle, UART_CMD_POWER_ON, (DCL_CTRL_DATA_T*)&data); |
| |
| DclSerialPort_Close(handle); |
| } |
| |
| #ifndef __L1_STANDALONE__ |
| static void custom_em_gpio_writeIO(kal_uint8 data, kal_uint8 port) |
| { |
| DCL_HANDLE handle; |
| |
| handle=DclGPIO_Open(DCL_GPIO, port); |
| |
| if(0 == data) |
| DclGPIO_Control(handle,GPIO_CMD_WRITE_LOW,0); |
| else if(1 == data) |
| DclGPIO_Control(handle,GPIO_CMD_WRITE_HIGH,0); |
| |
| DclGPIO_Close(handle); |
| } |
| |
| static void custom_em_gpo_writeIO(kal_uint8 data,kal_uint8 port) |
| { |
| DCL_HANDLE handle; |
| |
| handle=DclGPIO_Open(DCL_GPO,port); |
| |
| if(0 == data) |
| DclGPIO_Control(handle,GPO_CMD_WRITE_LOW,0); |
| else if(1 == data) |
| DclGPIO_Control(handle,GPO_CMD_WRITE_HIGH,0); |
| |
| DclGPIO_Close(handle); |
| } |
| #endif /* #ifndef __L1_STANDALONE__ */ |
| |
| #ifdef __SP_RIL_SUPPORT__ |
| /***************************************************************************** |
| * FUNCTION |
| * custom_em_thermal_red_ccci_hisr_callback |
| * DESCRIPTION |
| * reduce TX power |
| * PARAMETERS |
| * value [IN] tx reduction unit, byte 3: reserved, byte 2: reserved, byte 1: 3G, byte 0: 2G |
| * RETURNS |
| * void |
| *****************************************************************************/ |
| void custom_em_thermal_red_ccci_hisr_callback(kal_uint32 value) |
| { |
| |
| if (kal_query_boot_mode() == NORMAL_BOOT) |
| { |
| kal_uint8 gsm_tx_pwr_reduction_tbl[4][2][4]; |
| kal_uint8 umts_tx_pwr_reduction_tbl[20][2]; |
| kal_uint8 gsm_tx_pwr_reduction_tbl_tas[4][2][4]; |
| kal_uint8 umts_tx_pwr_reduction_tbl_tas[20][2]; |
| |
| kal_mem_set((void*)gsm_tx_pwr_reduction_tbl, (value & 0x000000FF), 4*2*4); |
| kal_mem_set((void*)umts_tx_pwr_reduction_tbl, ((value & 0x0000FF00) >> 8), 20*2); |
| kal_mem_set((void*)gsm_tx_pwr_reduction_tbl_tas, (value & 0x000000FF), 4*2*4); |
| kal_mem_set((void*)umts_tx_pwr_reduction_tbl_tas, ((value & 0x0000FF00) >> 8), 20*2); |
| |
| l4c_l1_max_tx_pwr_red_req((kal_uint8)0, 1, KAL_TRUE, (kal_uint8***)gsm_tx_pwr_reduction_tbl, (kal_uint8***)gsm_tx_pwr_reduction_tbl_tas, |
| KAL_TRUE, (kal_uint8**)umts_tx_pwr_reduction_tbl, (kal_uint8**)umts_tx_pwr_reduction_tbl_tas, KAL_FALSE, 0, NULL); |
| } |
| } |
| #endif /* __SP_RIL_SUPPORT__ */ |
| |
| /***************************************************************************** |
| * FUNCTION |
| * custom_em_get_imei_rec_by_sim |
| * DESCRIPTION |
| * get mapping based on SIM slot or 3g switched protocol |
| * if defined: SIM slot |
| * if not defined: 3g switched protocol (default) |
| * PARAMETERS |
| * op [IN] 0 for read, 1 for write |
| * slot [IN] SIM slot |
| * RETURNS |
| * sim_interface_enum |
| *****************************************************************************/ |
| sim_interface_enum custom_em_get_imei_rec_by_sim(kal_uint8 op, sim_interface_enum slot) |
| { |
| sim_interface_enum idx; |
| |
| #if defined(__CUSTOM_MAP_SIM_SLOT__) |
| idx = slot; |
| #else |
| idx = l4c_gemini_get_switched_sim_id(slot); |
| #endif /* __CUSTOM_MAP_SIM_SLOT__ */ |
| |
| return idx; |
| } |
| |
| #ifdef __SAR_SENSOR_SUPPORT__ |
| /***************************************************************************** |
| * FUNCTION |
| * custom_sar_mapping |
| * |
| * DESCRIPTION |
| * Needs to be updated by customer. |
| * |
| * PARAMETERS |
| * g_sar_sensor_state [IN] |
| * 0x00 : Far |
| * 0x01 : Near |
| * 0xFD : SAR sensor state disable |
| * 0xFE : SAR sensor state enable |
| * 0xFF : SAR sensor state not support |
| * g_scenario_index [IN] |
| * 1~20: Range of valid values of Scenario index |
| * |
| * RETURNS |
| * scenario_index: kal_int16 |
| * -1: combined scenario index disable |
| * 1~20: Range of valid values of combined scenario index |
| *****************************************************************************/ |
| kal_int16 custom_sar_mapping(kal_uint8 g_sar_sensor_state, kal_uint16 g_scenario_index) |
| { |
| if((g_sar_sensor_state == 255)||(g_sar_sensor_state == 254)||(g_sar_sensor_state == 253)) |
| { |
| return (kal_int16)g_scenario_index;// if the g_sar_sensor_state is unknown then combined scenario index will equal to g_scenario_index |
| } |
| else//customer can modify here |
| { |
| return (1); // Please note that the return value should be -1 or between 1~20 |
| } |
| |
| } |
| |
| |
| /***************************************************************************** |
| * FUNCTION |
| * custom_extant_by_sar_sensor_state |
| * |
| * DESCRIPTION |
| * Needs to be updated by customer. |
| * |
| * PARAMETERS |
| * src_id [IN] Use it as it is in the function l4c_force_tx_ant_req. |
| * |
| * g_sar_sensor_state [IN] |
| * 0xFF: SAR sensor state unknown, or disable |
| * 0x00: Far |
| * 0x01: Near |
| * 0xFD : SAR sensor state disable |
| * 0xFE : SAR sensor state enable |
| * 0xFF : SAR sensor state not support |
| * |
| * g_scenario_index [IN] |
| * 0xFFFF: g_scenario_index unknown, or disable |
| * 1~20: Range of valid values of Scenario index |
| * |
| * is_test_sim [IN] |
| * KAL_TRUE: yes it is a Test SIM |
| * KAL_FALSE: It is a real SIM |
| * |
| * md_product_model_id [IN] |
| * 0xFFFFFFFF : If invalid MD Product Model ID |
| * Any valid 32 bit integer. |
| * |
| * RETURNS |
| * Nothing |
| *****************************************************************************/ |
| void custom_extant_by_sar_sensor_state(kal_uint8 src_id, kal_uint8 g_sar_sensor_state, kal_uint16 g_scenario_index, |
| kal_bool is_test_sim, kal_uint32 md_product_model_id) |
| { |
| /* |
| kal_bool l4c_force_tx_ant_req(kal_uint8 src_id, kal_uint8 mode, kal_uint8 rat, kal_uint8 ant_state, kal_uint8 band, kal_uint8 nvram_write) |
| |
| <mode>: kal_uint8 (0~5) |
| 0: diable force TX antenna |
| 1: enable force TX antenna |
| 2: query antenna |
| 3: restore by band TAS default value in NVRAM (both real SIM and test SIM) |
| 4: force TX antenna by band (both real SIM and test SIM) |
| 5: query |
| |
| <rat>: kal_uint8 (1~4) |
| 1: GSM |
| 2: UMTS |
| 3: LTE |
| 4: C2K |
| |
| <ant_state>: kal_uint8 (0~7) |
| 0: TX_ANTENNA_STATE_0, |
| 1: TX_ANTENNA_STATE_1, |
| 2: TX_ANTENNA_STATE_2, |
| 3: TX_ANTENNA_STATE_3, |
| 4: TX_ANTENNA_STATE_4, |
| 5: TX_ANTENNA_STATE_5, |
| 6: TX_ANTENNA_STATE_6, |
| 7: TX_ANTENNA_STATE_7, |
| 8: TX_ANTENNA_STATE_NUM, |
| 255: TX_ANTENNA_INVALID = 0xFF |
| |
| <band>: kal_uint8 |
| |
| <nvram_write>: kal_uint8 (0~1) |
| 0: No need to save the settings to NVRAM |
| 1: Need to save the settings to NVRAM |
| |
| */ |
| |
| /* example : for mode = 0, or 1 */ |
| /* enable force TX antenna 0 for LTE, and NW write enable */ |
| // l4c_force_tx_ant_req(src_id,1/*mode*/,3/*rat = LTE*/,TX_ANTENNA_STATE_0,0xff,1); |
| /* enable force TX antenna 1 for WCDMA, and NW write disable */ |
| // l4c_force_tx_ant_req(src_id,1/*mode*/,2/*rat = UMTS*/,TX_ANTENNA_STATE_1,0xff,0); |
| /* disable force TX antenna for LTE, and NW write enable */ |
| // l4c_force_tx_ant_req(src_id,0/*mode*/,3/*rat = LTE*/,0xff,0xff,1); |
| /* disable force TX antenna for LTE, and NW write disable */ |
| // l4c_force_tx_ant_req(src_id,0/*mode*/,3/*rat = LTE*/,0xff,0xff,0); |
| |
| |
| /* example : for mode = 3, or 4 */ |
| /* enable force TX antenna 1 for LTE band 3, does not support NV write, and this action only valid when the serving cell RAT & Band is equal */ |
| // l4c_force_tx_ant_req(src_id,4/*mode*/,3/*rat = LTE*/,TX_ANTENNA_STATE_1,0x03,0); |
| /* enable force TX antenna 0 for LTE band 7, does not support NV write, and this action only valid when the serving cell RAT & Band is equal */ |
| // l4c_force_tx_ant_req(src_id,4/*mode*/,3/*rat = LTE*/,TX_ANTENNA_STATE_0,0x07,0); |
| /* restore by band TAS default value in NVRAM (both real SIM and test SIM) for LTE band 3, and this action only valid when the serving cell RAT & Band is equal */ |
| // l4c_force_tx_ant_req(src_id,3/*mode*/,3/*rat = LTE*/,0xff,0x03,0); |
| kal_uint8 count = 0, ret_val = KAL_FALSE; |
| |
| count = l4c_sar_get_tx_ant_req_count(); |
| |
| if (count > 0) |
| { |
| /*this means previous SAR update is ongoing |
| So wait until the previous operation is not finished and then again start the update procedure*/ |
| l4c_sar_set_txant_update_needed(); |
| return; |
| } |
| /*******Customer should call the function l4c_force_tx_ant_req() after this ************/ |
| /* please store the return value of function call l4c_force_tx_ant_req() in ret_val for every call */ |
| //ret_val = l4c_force_tx_ant_req(src_id,4/*mode*/,3/*rat = LTE*/,TX_ANTENNA_STATE_1,0x03,0); |
| //ret_val = l4c_force_tx_ant_req(src_id,4/*mode*/,4/*rat = C2K*/,TX_ANTENNA_STATE_1,0x03,0); |
| /*******Customer should call the function l4c_force_tx_ant_req() before this ************/ |
| |
| if(ret_val == KAL_FALSE) |
| { |
| /*This means AT+ETXANT from the AP is received and modem is making changes corresponding to it. |
| So wait until the previous operation is not finished and then again start the update procedure*/ |
| l4c_sar_set_txant_update_needed(); |
| return; |
| } |
| } |
| |
| |
| /***************************************************************************** |
| * FUNCTION |
| * customer_is_sar_sensor_enable |
| * |
| * DESCRIPTION |
| * Needs to be updated by customer. |
| * |
| * PARAMETERS |
| * md_product_model_id [IN] |
| * 0xFFFFFFFF : If invalid MD Product Model ID |
| * Any valid 32 bit integer. |
| * |
| * RETURNS |
| * custom_sar_setting: kal_int16 |
| * -1: L4C_SAR_IGNORE_ACTION |
| * 0: L4C_SAR_MODEM_TO_AP_DISABLE_ACTION |
| * 1: L4C_SAR_MODEM_TO_AP_ENABLE_ACTION |
| *****************************************************************************/ |
| kal_int8 customer_is_sar_sensor_enable(kal_uint32 md_product_model_id) |
| { |
| //customer can implement this function |
| return -1;//return -1 to ignore sar or sar sensor not supported |
| } |
| #endif |
| |