⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 uem_proc_msg.c

📁 最新MTK手机软件源码
💻 C
📖 第 1 页 / 共 3 页
字号:
/*****************************************************************************
*  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:
 * ---------
 * UEM_PROC_MSG.C
 *
 * Project:
 * --------
 *   MAUI
 *
 * Description:
 * ------------
 *   This file is intends for L4C<-UEM message using.
 *
 * Author:
 * -------
 * -------
 *
 *============================================================================
 *             HISTORY
 * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
 *------------------------------------------------------------------------------
 * 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!
 *
 *------------------------------------------------------------------------------
 * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
 *============================================================================
 ****************************************************************************/

/***************************************************************************** 
* Include
*****************************************************************************/
#include "kal_release.h"

#include "stack_common.h"
#include "stack_msgs.h"
#include "app_ltlcom.h"
#include "kal_trace.h"
#include "stdio.h"
#include "kal_non_specific_general_types.h"
#include "stacklib.h"   /* Basic type for dll, evshed, stacktimer */
#include "stack_timer.h"
#include "event_shed.h"
#include "med_struct.h"

#include "l1audio.h"
#include "drvsignals.h"
#include "keypad_sw.h"
#include "aud_defs.h"
#include "bmt.h"
#include "adc.h"
#include "Rtc_sw.h"
#include "pwic.h"
#include "device.h"
#include "pwm_sw.h"

#include "nvram_editor_data_item.h"
#include "custom_nvram_editor_data_item.h"

#include "l4c2uem_struct.h"
#include "l4c_eq_msg.h"

#include "uem_context.h"
#include "uem_utility.h"
#include "uem_main.h"
#include "uem_proc_msg.h"
#include "uem_trc.h"

#include "custom_equipment.h"
#include "custom_hw_default.h"

/***************************************************************************** 
* Define
*****************************************************************************/

/***************************************************************************** 
* Global/Extern Function
*****************************************************************************/
extern void MMICheckDiskDisplay(void);

#ifdef __MTK_TARGET__
extern DRV_RESET(void);
extern kal_uint8 adc_sche_create_object(
                    module_type ownerid,
                    kal_uint8 adc_channel,
                    kal_uint32 period,
                    kal_uint8 evaluate_count,
                    kal_bool send_primitive);
#endif /* __MTK_TARGET__ */ 

#ifdef __USB_ENABLE__
extern void l4cuem_usbconfig_cnf(kal_uint8 src_id, kal_bool result, kal_uint8 mode, kal_uint32 reserved);
#endif 

/***************************************************************************** 
* Local Function
*****************************************************************************/
static void uem_pmic_power_on_if_needed(kal_uint8 vbat_level);

/******************************************************************************/
/*******************   External Functions *************************************/
/******************************************************************************/
/*****************************************************************************
*   Function 
*      uemdrv_keypad_detect_ind
*   DESCRIPTION
*      The function is used to detect the user pressed or released keypad. 
*      The Driver will callback the function that the keypad is pressed or released and 
*      given the pressed or released key code value.
*   PARAMETERS
*      keypad_status   IN
*      keypad_code      IN   
*   RETURNS
*      void
*   GLOBALS AFFECTED
*****************************************************************************/


/*****************************************************************************
 * FUNCTION
 *  uemdrv_keypad_detect_ind
 * DESCRIPTION
 *  
 * PARAMETERS
 *  drv_get_key_func        [IN]        
 * RETURNS
 *  void
 *****************************************************************************/
void uemdrv_keypad_detect_ind(kal_bool(*drv_get_key_func) (kbd_data *))
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    l4cuem_keypad_detect_ind(drv_get_key_func);
}

/*****************************************************************************
*   Function 
*      uemdrv_alarm_detect_ind
*   DESCRIPTION
*      The function is used to detect the alarm time is up at power off point. 
*      The Driver will callback the function that the alarm is startup.
*   PARAMETERS
*      alarm_status   IN   
*   RETURNS
*      void
*   GLOBALS AFFECTED
*****************************************************************************/


/*****************************************************************************
 * FUNCTION
 *  uemdrv_alarm_detect_ind
 * DESCRIPTION
 *  
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void uemdrv_alarm_detect_ind(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    uem_bmt_struct bmt_status;
    kal_uint8 poweron_mode = uem_get_poweron_mode();

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    kal_trace(TRACE_FUNC, FUNC_UEM_ALARM_DETECT);

    /* this is alarm power on case */
    uem_get_bat_status(&bmt_status);

    RTC_Config(uem_rtc_alarm_format_convert(DEVICE_AL_EN_None), uem_rtc_clock_format_convert(DEVICE_TC_EN_NoChange));

    if (POWERON(poweron_mode))
    {
        t_rtc lrtc;
        rtc_format_struct rtc_time;

        RTC_GetTime(&lrtc);
        rtc_time.rtc_day = lrtc.rtc_day;
        rtc_time.rtc_hour = lrtc.rtc_hour;
        rtc_time.rtc_min = lrtc.rtc_min;
        rtc_time.rtc_sec = lrtc.rtc_sec;
        rtc_time.rtc_year = lrtc.rtc_year;
        rtc_time.rtc_mon = lrtc.rtc_mon;
        rtc_time.rtc_wday = lrtc.rtc_wday;

        l4cuem_alarm_detect_ind(&rtc_time);
    }
}

/*****************************************************************************
*   Function 
*      uemdrv_rtc_period_ind
*   DESCRIPTION
*      The function is used to detect the RTC period time with one minute timer. 
*      The Driver will callback the function that the RTC within the specific time to 
*      generate RTC alarm interrupt.
*   PARAMETERS
*      rtc_type   IN/OUT   
*   RETURNS
*      void
*   GLOBALS AFFECTED
*****************************************************************************/


/*****************************************************************************
 * FUNCTION
 *  uemdrv_rtc_period_ind
 * DESCRIPTION
 *  
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void uemdrv_rtc_period_ind(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    t_rtc lrtc;
    rtc_format_struct rtc_time;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    kal_trace(TRACE_FUNC, FUNC_UEM_RTC_PERIOD);

    RTC_GetTime(&lrtc);

    rtc_time.rtc_day = lrtc.rtc_day;
    rtc_time.rtc_hour = lrtc.rtc_hour;
    rtc_time.rtc_min = lrtc.rtc_min;
    rtc_time.rtc_sec = lrtc.rtc_sec;
    rtc_time.rtc_year = lrtc.rtc_year;
    rtc_time.rtc_mon = lrtc.rtc_mon;
    rtc_time.rtc_wday = lrtc.rtc_wday;

    /* execute the callback function */
    l4cuem_rtc_period_ind(RTC_TIME_CLOCK_IND, &rtc_time);
}

/*****************************************************************************
*   Function 
*      uemdrv_keypad_power_on_ind
*   DESCRIPTION
*      The function is used to keypad power on.
*   PARAMETERS
*      void
*   RETURNS
*      void
*   GLOBALS AFFECTED
*****************************************************************************/


/*****************************************************************************
 * FUNCTION
 *  uemdrv_keypad_power_on_ind
 * DESCRIPTION
 *  
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void uemdrv_keypad_power_on_ind(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    uem_bmt_struct bmt_status;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    kal_trace(TRACE_FUNC, FUNC_UEM_KEYPAD_POWER_ON);

    /* set power on flag */
    uem_set_poweron_mode(POWER_ON_KEYPAD);
    uem_get_bat_status(&bmt_status);

    l4cuem_power_on_ind(POWER_ON_KEYPAD, uem_vbat_level_convert(bmt_status.volt));

    return;
}

/*****************************************************************************
*   Function 
*      uemdrv_exception_power_on_ind
*   DESCRIPTION
*      The function is used to excetption reboot.
*   PARAMETERS
*      void
*   RETURNS
*      void
*   GLOBALS AFFECTED
*****************************************************************************/


/*****************************************************************************
 * FUNCTION
 *  uemdrv_exception_power_on_ind
 * DESCRIPTION
 *  
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void uemdrv_exception_power_on_ind(void)
{

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -