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

📄 mmitask.c

📁 MTK手机平台的MMI部分的源代码
💻 C
📖 第 1 页 / 共 5 页
字号:
 *****************************************************************************/
void mmi_frm_power_on_init_procedure(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    static U8 bInit = 0;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/

    if (!bInit)
    {
        InitializeAll();
        OslDumpDataInFile();
        InitNvramData();

        bInit = 1;
    }
}


/*****************************************************************************
 * FUNCTION
 *  MMI_task
 * DESCRIPTION
 *  Entry function for Protocol task
 *  
 *  This receives protocol task events from the stack and forwards it to
 *  MMI task.
 * PARAMETERS
 *  entry_param     [IN]        
 * RETURNS
 *  void
 *****************************************************************************/
void MMI_task(oslEntryType *entry_param)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    MYQUEUE Message;
    oslMsgqid qid;

#ifndef MMI_ON_WIN32
    U32 my_index;
    U32 count = 0;
    U32 queue_node_number = 0;
#endif /* MMI_ON_WIN32 */ 

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
#ifndef MMI_ON_WIN32
    qid = task_info_g[entry_param->task_indx].task_ext_qid;
    mmi_ext_qid = qid;
    InitEventHandlersBeforePowerOn();
#endif /* MMI_ON_WIN32 */ 

    while (1)
    {
    #ifndef MMI_ON_WIN32
        {

            if (g_keypad_flag == MMI_TRUE)
            {
                L4KeyHandle(NULL);
            }

            /* Leo start 20050825 */
/********************************************************************
*   Check if number of events in queue increases.
*   If yes, clear more external queue events, else clear less external queue events.
*   At lease clear one external queue event.
********************************************************************/
            /* Get Total count in external queue */
            msg_get_ext_queue_info(mmi_ext_qid, &queue_node_number);

            if ((queue_node_number == 0) && (OslNumOfCircularQMsgs() == 0) && (g_keypad_flag == MMI_FALSE))
            {
                U8 flag = 0;
                ilm_struct ilm_ptr;

                /* MMI task suspends for the queue */
                OslReceiveMsgExtQ(qid, &Message);
                OslGetMyTaskIndex(&my_index);
                OslStackSetActiveModuleID(my_index, MOD_MMI);

                /* put Message in circular queue */
                ilm_ptr.src_mod_id = Message.src_mod_id;
                ilm_ptr.dest_mod_id = Message.dest_mod_id;
                ilm_ptr.msg_id = Message.msg_id;
                ilm_ptr.sap_id = Message.sap_id;
                ilm_ptr.local_para_ptr = Message.local_para_ptr;
                ilm_ptr.peer_buff_ptr = Message.peer_buff_ptr;

                flag = OslWriteCircularQ(&ilm_ptr);
                MMI_ASSERT(flag == 1);
                /* TIMER use special data in the local_para_ptr field. Can NOT treat as general ILM */
                if (Message.src_mod_id != MOD_TIMER)
                {
                    hold_local_para(ilm_ptr.local_para_ptr);
                    hold_peer_buff(ilm_ptr.peer_buff_ptr);
                    OslFreeInterTaskMsg(&Message);
                }
            }
            else
            {
                mmi_frm_fetch_msg_from_extQ_to_circularQ();
            }

            count = OslNumOfCircularQMsgs();
            while (count > 0)
            {
                OslGetMyTaskIndex(&my_index);
                OslStackSetActiveModuleID(my_index, MOD_MMI);

                if (OslReadCircularQ(&Message))
                {
                    CheckAndPrintMsgId((U16) (Message.msg_id));

                    if (Message.dest_mod_id == MOD_WAP)
                    {
                    #ifdef JATAAYU_SUPPORT
                        extern void mmi_wap_handle_msg(void *msgPtr);

                        mmi_wap_handle_msg((void*)&Message);
                    #endif /* JATAAYU_SUPPORT */ 
                    }
                    else
                    {
                        switch (Message.msg_id)
                        {
                            case MSG_ID_TIMER_EXPIRY:
                            {
                                kal_uint16 msg_len;

                                EvshedMMITimerHandler(get_local_para_ptr(Message.oslDataPtr, &msg_len));
                            }
                                break;

                            case MSG_ID_MMI_EQ_POWER_ON_IND:
                            {
                                mmi_eq_power_on_ind_struct *p = (mmi_eq_power_on_ind_struct*) Message.oslDataPtr;

                                /* To initialize data/time */
                                SetDateTime((void*)&(p->rtc_time));
                                gdi_init();

                                g_pwr_context.PowerOnMMIStatus = MMI_POWER_ON_INDICATION;       /* 0x01: POWER_ON_KEYPAD indication */
                                
                            #ifdef __MMI_TVOUT__
                                mmi_phnset_tvout_check_pwron_start();
                            #endif
                                                            
                                switch (p->poweron_mode)
                                {
                                    case POWER_ON_KEYPAD:
                                        OslMemoryStart(TRUE);
                                        g_charbat_context.PowerOnCharger = 0;
                                        g_pwr_context.PowerOnMode = POWER_ON_KEYPAD;

                                        DTGetRTCTime(&StartUpTime);
                                        memset(&LastDuration, 0, sizeof(LastDuration));

                                        //KP Jerry add for reading correct SIM ID after 06B version when dual SIM support  on 2007-3-20 start
                                        #ifdef __DUAL_SIM_SUPPORT__
                                        mmi_frm_power_on_init_procedure();
					     #endif 
					     //KP Jerry add for reading correct SIM ID after 06B version when dual SIM support  on 2007-3-20 end

                                #if (defined(MMI_ON_HARDWARE_P) && !defined(__MTK_TARGET__)) /* MoDIS only */
                                        mmi_netset_write_auto_test_result(MMI_FALSE);
                                #endif

                                        /* disk check */
                                #ifdef __FLIGHT_MODE_SUPPORT__
                                        g_phnset_cntx.curFlightMode = p->flightmode_state;
                                #endif 
										mmi_bootup_entry_disk_check();

                                        PRINT_INFORMATION((" NORMAL POWER ON SUCCESS!!!!"));
                                        break;

                                    case POWER_ON_PRECHARGE:
                                    case POWER_ON_CHARGER_IN:
                           /************************************** 
                            * Always send charger-in indication
                            * to avoid fast repeating charger 
                            * in-out b4 power-on completes
                            * Lisen 04/13/2004
                           ***************************************/
                                        g_pwr_context.PowerOnMode = p->poweron_mode;    /* Charger/Pre-charge Power On */
                                        InitializeChargingScr();
                                        if (!g_charbat_context.isChargerConnected)
                                        {
                                            QuitSystemOperation();
                                        }

                                        PRINT_INFORMATION((" CHARGER POWER ON SUCCESS!!!!"));
                                        break;

                                    case POWER_ON_ALARM:
                                        g_pwr_context.PowerOnMode = POWER_ON_ALARM;
                                    #ifdef __MMI_SUBLCD__
                                        gdi_lcd_set_active(GDI_LCD_SUB_LCD_HANDLE);
                                        gdi_layer_clear(GDI_COLOR_BLACK);
                                        gdi_lcd_set_active(GDI_LCD_MAIN_LCD_HANDLE);
                                    #endif /* __MMI_SUBLCD__ */ 
                                        gdi_layer_clear(GDI_COLOR_BLACK);
                                        AlmInitRTCPwron();
                                        PRINT_INFORMATION((" ALARM POWER ON SUCCESS!!!!"));
                                        break;
                                    case POWER_ON_EXCEPTION:
                                        g_pwr_context.PowerOnMode = POWER_ON_EXCEPTION;
                                    #ifdef __MMI_SUBLCD__
                                        gdi_lcd_set_active(GDI_LCD_SUB_LCD_HANDLE);
                                        gdi_layer_clear(GDI_COLOR_BLACK);
                                        gdi_lcd_set_active(GDI_LCD_MAIN_LCD_HANDLE);
                                    #endif /* __MMI_SUBLCD__ */ 
                                        gdi_layer_clear(GDI_COLOR_BLACK);
                                        OslMemoryStart(TRUE);
                                        SetAbnormalReset();
                                        InitializeAll();
                                        OslDumpDataInFile();
                                        PRINT_INFORMATION((" Exception POWER ON SUCCESS!!!!"));
                                        ClearInputEventHandler(MMI_DEVICE_ALL);
                                        ClearKeyHandler(KEY_END, KEY_LONG_PRESS);

                           /**************************************
                            * Please note that the order of the following actions matters. 
                            * NVRAM data must be read before InitAllApplications, or there might be 
                            * unexpected errors. 
                           ***************************************/
                                        InitNvramData();
                                        InitAllApplications();

                                    #ifdef __FLIGHT_MODE_SUPPORT__
                                        PhnsetFlightModePowerOnException();
                                    #endif 
                           /***************************************
                            * To check power on display if need restore 
                            ***************************************/
                                        mmi_pwron_exception_check_display();

                                        break;

                                    #ifdef __MMI_USB_SUPPORT__
                                    case POWER_ON_USB:
                                        g_pwr_context.PowerOnMode = POWER_ON_USB;
                           /***************************************
                            * Because Aux task will not init in USB boot mode 
                            * Interrupt service routine for clam detection CLAM_EINT_HISR() 
                            * is not register, force the clam state to open 
                            * If Aux task is necessary in USB mode, this tircky could be removed 
                            * Robin 1209 
                            ***************************************/
                                        gMMIClamState = 1;
                                        InitializeUsbScr();
                           /***************************************
                            * To disable keypad tone state 
                            ***************************************/
                                        mmi_frm_kbd_set_tone_state(MMI_KEY_TONE_DISABLED);
                                        PRINT_INFORMATION((" USB POWER ON SUCCESS!!!!"));
                                        break;
                                    #endif /* __MMI_USB_SUPPORT__ */ 

                                    default:
                                        break;
                                }
                            }
                                break;

                            default:
                                ProtocolEventHandler(
                                    (U16) Message.oslMsgId,
                                    (void*)Message.oslDataPtr,
                                    (int)Message.oslSrcId,
                                    (void*)&Message);
                                break;
                        }

                    }

                    OslFreeInterTaskMsg(&Message);
                }   /* OslReadCircularQ(&Message) */
                msg_get_ext_queue_info(mmi_ext_qid, &queue_node_number);
                count--;
            }
        }
    #else /* MMI_ON_WIN32 */
        {
            qid = task_info_g1[(U16) entry_param].task_ext_qid;
            OslReceiveMsgExtQ(qid, &Message);
            if (!ProcessPCKeyEvent(Message.oslMsgId, (KEYBRD_MESSAGE*) Message.oslDataPtr))
            {
                switch (Message.oslMsgId)
                {
                    case PRT_MMI_TIMER_IND:
                    {
                        oslTimerid timerid;
                        timerid = (oslTimerid)((TIMER_MESSAGE *) Message.oslDataPtr)->id;
                        timerid->tmr_callback(timerid->tmr_callback_arg);
                    }
                        break;
                    
                    case MMI_EQ_POWER_ON_IND:
                    {
                        mmi_eq_power_on_ind_struct *p = (mmi_eq_power_on_ind_struct*) Message.oslDataPtr;

                        gdi_init();
                        g_pwr_context.PowerOnMMIStatus = MMI_POWER_ON_INDICATION;       /* 0x01: POWER_ON_KEYPAD indication */
                        switch (p->poweron_mode)
                        {
                            case POWER_ON_KEYPAD:
                                OslMemoryStart(TRUE);
                        #ifdef MMI_ON_WIN32
                                if (flagMMIStart)
                                {
                                    break;
                                }
                                flagMMIStart = TRUE;
                        #endif /* MMI_ON_WIN32 */ 
                                g_charbat_context.PowerOnCharger = 0;
                                InitializeAll();
                                OslDumpDataInFile();
                        /***************************************
                         * To initialize nvram data
                         ***************************************/
                                InitNvramData();

                                /* diamond, 2005/07/05 Flight mode */
                                //#ifdef __FLIGHT_MODE_SUPPORT__
                                //EntryQueryFlightModeScreen();
                                //#else
                                mmi_pwron_entry_animation_screen();     /* to display power on animation */
                                // #endif

                                PRINT_INFORMATION((" NORMAL POWER ON SUCCESS!!!!"));
                                break;
                            case POWER_ON_PRECHARGE:    /* Cylen, Precharge Power On */
                            case POWER_ON_CHARGER_IN:
                                g_pwr_context.PowerOnMode = p->poweron_mode;    /* Cylen, Precharge Power On */
                                InitializeChargingScr();
                                break;
                            case POWER_ON_ALARM:
                                AlmInitRTCPwron();
                                break;
                     /***************************************
                      * For abnormal reset when invalid SIM 
                      ***************************************/
                            case POWER_ON_EXCEPTION:
                                OslMemoryStart(TRUE);
                                SetAbnormalReset();
                                InitializeAll();
                                OslDumpDataInFile();
                                PRINT_INFORMATION((" Exception POWER ON SUCCESS!!!!"));
                                /* goto_opening_screen(); */
                                ClearInputEventHandler(MMI_DEVICE_ALL);
                                ClearKeyHandler(KEY_END, KEY_LONG_PRESS);
                                InitNvramData();
                                AlmReInitialize();
                                InitAllApplications();

                        /***************************************
                         * To check power on display if need restore 
                         ***************************************/
                                mmi_pwron_exception_check_display();
                                break;
                        }
                    }
                        break;

                    default:
                        ProtocolEventHandler(
                            (U16) Message.oslMsgId,
                            (void*)Message.oslDataPtr,
                            (int)Message.oslSrcId,
                            (void*)Message.oslPeerBuffPtr);
                        break;
                }
            }
            OslFreeInterTaskMsg(&Message);
        }
    #endif /* MMI_ON_WIN32 */ 
    }
}

/* __CUSTPACK_MULTIBIN     Terry   BEGIN */


/*****************************************************************************
 * FUNCTION
 *  IMECheck
 * DESCRIPTION
 *  To Check IME,
 *  
 *  This is used to To Check IME,.
 * PARAMETERS
 *  IME_Mode                [IN]        
 *  all_implement_IME       [IN]        
 * RETURNS
 *  MMI_TRUE : if the IME_Mode is in
 *  MMI_FALSE : if the IME_Mode is not in
 *****************************************************************************/
BOOL IMECheck(U8 IME_Mode, const U8 all_implement_IME[])
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    int i = 0;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    for (;;)
    {
        if ((0xff) != all_implement_IME[i])
        {
            if (IME_Mode == all_implement_IME[i])
            {
                return MMI_TRUE;
            }
        }

⌨️ 快捷键说明

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