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

📄 phb_handler_startup.c

📁 最新MTK手机软件源码
💻 C
📖 第 1 页 / 共 5 页
字号:
/*****************************************************************************
*  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:
 * ---------
 * phb_handler_startup.c
 *
 * Project:
 * --------
 *   MAUI
 *
 * Description:
 * ------------
 *   This is startup handler of PHB module.
 *
 * 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!
 *
 *------------------------------------------------------------------------------
 * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
 *============================================================================
 ****************************************************************************/
#include "kal_release.h"        /* Basic data type */

#include "stack_common.h"
#include "stack_msgs.h"
#include "app_ltlcom.h" /* Task message communiction */
#include "app_buff_alloc.h"

#include "kal_trace.h"
#include "phb_trc.h"

#include "nvram_struct.h"
#include "nvram_enums.h"
#include "nvram_interface.h"
/* NVRAM_EF_PHB_LID */
// #include "nvram_data_items.h"
#include "nvram_user_defs.h"
// #include "nvram_editor_data_item.h"
#include "custom_nvram_editor_data_item.h"

#include "ps2sim_struct.h"
#include "sim_common_enums.h"
#include "smu_common_enums.h"
#ifdef __SAT__
#include "ps2sat_struct.h"
#endif 

#include "l4_defs.h"
#include "l4_common.h"
#include "ps2sim_struct.h"

#include "l4c2phb_enums.h"
#include "l4c2phb_struct.h"

/* Prerequisite of phb_context.h */
#include "phb_defs.h"
#include "phb_control_block.h"
#include "phb_data_desc.h"
#include "phb_data_entry_table.h"
#include "phb_pindex.h"
#include "phb_name_num_index.h"

#include "phb_context.h"
#include "phb_se.h"

#include "phb_common.h"
#include "phb_utils.h"
#include "phb_ilm.h"

#ifdef __PHB_RECORD_LN_TYPE_SEQ__
#include "phb_handler_write.h"
#endif 

/* SIM access */
#include "phb_sim_access.h"

/* NVRAM_EF_PHB_LID structure */
#include "phb_nvram_data.h"
#include "phb_nvram_access.h"

#include "phb_config.h"
#include "phb_handler_startup.h"

#undef  _FILE_CODE_
#define _FILE_CODE_ _PHB_HANDLER_STARTUP_C_

#define SIM_EF_EXT_SIZE 13
#ifdef __USIM_SUPPORT__
#define PHB_TYPE_1_FILE 0xA8
#define PHB_TYPE_2_FILE 0xA9
#define PHB_TYPE_3_FILE 0xAA
#define PHB_ADN_DO 0xC0
#define PHB_IAP_DO 0xC1
#define PHB_EXT1_DO 0xC2
#define PHB_SNE_DO 0xC3
#define PHB_ANR_DO 0xC4
#define PHB_PBC_DO 0xC5
#define PHB_GRP_DO 0xC6
#define PHB_AAS_DO 0xC7
#define PHB_GAS_DO 0xC8
#define PHB_UID_DO 0xC9
#define PHB_EMAIL_DO 0xCA
#define PHB_CCP1_DO 0xCB


extern kal_bool is_usim_type(void);
#endif /* __USIM_SUPPORT__ */

#ifdef __PHB_USIM_SUPPORT__
static void phb_build_gas_index(ilm_struct *ilm_ptr, control_block_type *control_block);
static void phb_build_grp_index(ilm_struct *ilm_ptr, control_block_type *control_block);
#endif /* __PHB_USIM_SUPPORT__ */ 

static void phb_startup_err_handler(ilm_struct *ilm_ptr, control_block_type *control_block);
void phb_startup_confirm(phb_errno_enum result, control_block_type *control_block);
static void phb_build_index(ilm_struct *ilm_ptr, control_block_type *control_block);

void phb_get_info(ilm_struct *ilm_ptr, control_block_type *control_block);
static void phb_get_info_set_value(ilm_struct *ilm_ptr, control_block_type *control_block);
static void phb_get_info_err_handler(ilm_struct *ilm_ptr, control_block_type *control_block);

static void phb_startup_copy_ln(ilm_struct *ilm_ptr, control_block_type *control_block);

#ifndef __PHB_NVRAM_LN_ONLY__
static void phb_startup_translate_ln_from_sim(kal_uint8 *data, control_block_type *control_block);
#endif 

void phb_init_ln_confirm(phb_errno_enum result, control_block_type *control_block);


/*****************************************************************************
 * FUNCTION
 *  phb_read_ecc
 * DESCRIPTION
 *  This is phb_read_ecc function of PHB module.
 * PARAMETERS
 *  ilm_ptr             [IN]        The primitives
 *  control_block       [?]         
 * RETURNS
 *  void
 *****************************************************************************/
static void phb_read_ecc(ilm_struct *ilm_ptr, control_block_type *control_block)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (ilm_ptr == NULL)
    {
        phb_issue_IO_read(control_block);
    }

    else
    {

        /* Reading ECC */
    #ifdef __USIM_SUPPORT__
        if (is_usim_type())
        {
            if (control_block->data[0] != 0xff)
            {
                kal_mem_cpy(
                    &phb_ptr->ecc.ecc[phb_ptr->ecc.num_ecc * NUM_OF_BYTE_ECC],
                    (void const*)(control_block->data),
                    NUM_OF_BYTE_ECC);
                phb_ptr->ecc.num_ecc++;
            }
        }
        else
    #endif /* __USIM_SUPPORT__ */ 
        {
            kal_uint8 i;
            kal_uint8 num_of_rec = phb_ptr->ecc.num_ecc / NUM_OF_BYTE_ECC;

            phb_ptr->ecc.num_ecc = 0;
            for (i = 0; i < num_of_rec; i++)
            {
                if (control_block->data[i * NUM_OF_BYTE_ECC] != 0xff)
                {
                    kal_mem_cpy(
                        &phb_ptr->ecc.ecc[phb_ptr->ecc.num_ecc * NUM_OF_BYTE_ECC],
                        (void const*)(control_block->data + i * NUM_OF_BYTE_ECC),
                        NUM_OF_BYTE_ECC);
                    phb_ptr->ecc.num_ecc++;
                }
            }
        }
        if (++control_block->actual_count >= control_block->total)
        {
            /* phb_starup_handler */
            (*control_block->controller) (NULL, control_block);
        }
        else
        {
            ++control_block->record_index;
            phb_issue_IO_read(control_block);
        }
    }
}   /* end of phb_build_ecc_index function */


#ifdef __USIM_SUPPORT__
/*****************************************************************************
 * FUNCTION
 *  phb_read_pbr
 * DESCRIPTION
 *  This is phb_read_pbr function of PHB module.
 * PARAMETERS
 *  ilm_ptr             [IN]        The primitives
 *  control_block       [?]         
 * RETURNS
 *  void
 *****************************************************************************/
static void phb_read_pbr(ilm_struct *ilm_ptr, control_block_type *control_block)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (ilm_ptr == NULL)
    {
        phb_issue_IO_read(control_block);
    }

    else
    {
        /* Reading PBR */
        kal_uint8 fileType = 0;
        kal_uint8 pos = 0;
        kal_uint8 anr_num = 0;
        data_desc_enum do_type = 0xFF;

        if (control_block->actual_count == 0)   /* first pbr */
        {
            while (pos < phb_ptr->data_desc[DATA_DESC_PBR].record_size)
            {
                switch (control_block->data[pos])

⌨️ 快捷键说明

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