/*******************************************************************************
 * FUNCTION
 *   FT_WriteTo_NVRAM_CNF
 *
 * DESCRIPTION
 *   Handle the confirmation of writting
 *
 * CALLS
 *
 *
 * PARAMETERS
 *
 * RETURNS
 *   None
 *
 * GLOBALS AFFECTED
 *   None
 *******************************************************************************/
void FT_WriteTo_NVRAM_CNF(nvram_write_cnf_struct* cnf_result)
{
    ilm_struct  ilm_ptr;
    ft_nvram_write_cnf_struct_T *ptrMsg ;
    kal_uint8       ok;

    if (cnf_result->result ==0)
        ok = FT_CNF_OK;
    else
        ok = FT_CNF_FAIL;

    if(ok==FT_CNF_OK)
    {
        switch(cnf_result->file_idx)
        {
            default:
                /**V \brief 2G update runtime value after wrote nvram */
                L1TST_UpdateCalibrationData( cnf_result->file_idx );
#if defined(__UMTS_RAT__) && defined(__MTK_UL1_FDD__)                
                /**V \brief 3G WCDMA update runtime value after wrote nvram */
                FT_UL1TST_UpdateRuntimeReq( cnf_result->file_idx );              
#endif // #if defined(__UMTS_RAT__) && defined(__MTK_UL1_FDD__)                           
                break;
        }
    }
    if(!g_b_ft_nvram_proc_locally || cnf_result->file_idx != NVRAM_EF_CAL_DATA_CHECK_LID)
    {
        FT_ALLOC_MSG(&ilm_ptr, sizeof(ft_nvram_write_cnf_struct_T));
        /* if ptrMsg != NULL*/
        ptrMsg = (ft_nvram_write_cnf_struct_T *)ilm_ptr.local_para_ptr;
        ptrMsg->header.ft_msg_id = FT_NVRAM_WRITE_CNF_ID;
        ptrMsg->file_idx=cnf_result->file_idx;
        ptrMsg->para=cnf_result->para;
        ptrMsg->status = cnf_result->result;
        /* FT_SEND_MSG(src_mod, dest_mod, sap_id, msg_id, ilm_ptr) */
        FT_SEND_MSG(MOD_FT, MOD_TST, FT_TST_SAP, MSG_ID_FT_TO_TST, &ilm_ptr);
    }
    else // write locally complete, return misc confirm to PC side
    {
#if !defined(NVRAM_NOT_PRESENT)
        ft_misc_cal_data_write_to_nvram_cnf(cnf_result);
#endif // #if !defined(NVRAM_NOT_PRESENT)
    }
    if(ok == FT_CNF_OK && g_b_ft_nvram_rec)
    {
       // get the nvram checksum from nvram
       kal_uint16 u2_checksum;
       bool bValid = ft_misc_cal_data_get_checksum((kal_uint16)cnf_result->file_idx,
                    cnf_result->para,&u2_checksum);
       if(bValid)
       {
           // update the misc_buffer
           ft_misc_cal_data_update_local_buf((kal_uint16)cnf_result->file_idx,
                   cnf_result->para, u2_checksum);
       }
    }
}
Exemplo n.º 2
0
/*******************************************************************************
 * FUNCTION
 *   FT_WriteTo_NVRAM_CNF
 *
 * DESCRIPTION
 *   Handle the confirmation of writting
 *
 * CALLS
 *
 *
 * PARAMETERS
 *
 * RETURNS
 *   None
 *
 * GLOBALS AFFECTED
 *   None
 *******************************************************************************/
void FT_WriteTo_NVRAM_CNF(nvram_write_cnf_struct* cnf_result)
{
    ilm_struct* ptr_ilm;
    ft_nvram_write_cnf_struct_T *ptrMsg ;
    kal_uint8       ok;

    if (cnf_result->result ==0)
        ok = FT_CNF_OK;
    else
        ok = FT_CNF_FAIL;

    if(ok==FT_CNF_OK)
    {
        switch(cnf_result->file_idx)
        {
#if defined(__WIFI_SUPPORT__)
            case NVRAM_EF_WNDRV_MAC_ADDRESS_LID:
                if(wndrv_chip_isOK())
                    wndrv_cal_macaddr((wndrv_cal_mac_addr_struct *)&ft_rf_data_pt);
                break;
            case NVRAM_EF_WNDRV_TX_POWER_2400M_LID:
                if(wndrv_chip_isOK())
                    wndrv_cal_txpwr_2400M((wndrv_cal_txpwr_2400M_struct *)&ft_rf_data_pt);
                break;
            case NVRAM_EF_WNDRV_TX_POWER_5000M_LID:
                if(wndrv_chip_isOK())
                    wndrv_cal_txpwr_5000M((wndrv_cal_txpwr_5000M_struct *)&ft_rf_data_pt);
                break;
            case NVRAM_EF_WNDRV_DAC_DC_OFFSET_LID:
                if(wndrv_chip_isOK())
                    wndrv_cal_dac_dc_offset((wndrv_cal_dac_dc_offset_struct *)&ft_rf_data_pt);
                break;
            case NVRAM_EF_WNDRV_TX_ALC_POWER_LID:
                if(wndrv_chip_isOK())
                    wndrv_cal_tx_ALC_power_2400M((wndrv_cal_tx_ALC_2400M_struct *)&ft_rf_data_pt);
                break;
            case NVRAM_EF_WNDRV_ALC_SLOPE_LID:
                if(wndrv_chip_isOK())
                    wndrv_cal_ALC_Slope_2400M((wndrv_cal_ALC_Slope_2400M_struct *)&ft_rf_data_pt);
                break;
#endif
            default:
                /**V \brief 2G update runtime value after wrote nvram */
                L1TST_UpdateCalibrationData( cnf_result->file_idx );
#if defined(__UMTS_RAT__) && defined(__MTK_UL1_FDD__)                
/* under construction !*/
/* under construction !*/
#endif // #if defined(__UMTS_RAT__) && defined(__MTK_UL1_FDD__)                           
                break;
        }
    }
    if(!g_b_ft_nvram_proc_locally || cnf_result->file_idx != NVRAM_EF_CAL_DATA_CHECK_LID)
    {
#if defined(__WIFI_SUPPORT__)
#if defined(__MTK_INTERNAL__)
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
#endif // #if defined(__MTK_INTERNAL__)
#endif // #if defined(__WIFI_SUPPORT__)
        ptr_ilm = FT_ALLOC_MSG( sizeof(ft_nvram_write_cnf_struct_T) );
        /* if ptrMsg != NULL*/
        ptrMsg = (ft_nvram_write_cnf_struct_T *)ptr_ilm->local_para_ptr;
        ptrMsg->header.ft_msg_id = FT_NVRAM_WRITE_CNF_ID;
        ptrMsg->file_idx=cnf_result->file_idx;
        ptrMsg->para=cnf_result->para;
        ptrMsg->status = cnf_result->result;
        /* FT_SEND_MSG(src_mod, dest_mod, sap_id, msg_id, ilm_ptr) */
        FT_SEND_MSG(MOD_FT, MOD_TST, FT_TST_SAP, MSG_ID_FT_TO_TST, ptr_ilm);
    }
    else // write locally complete, return misc confirm to PC side
    {
#if !defined(NVRAM_NOT_PRESENT)
        ft_misc_cal_data_write_to_nvram_cnf(cnf_result);
#endif // #if !defined(NVRAM_NOT_PRESENT)
    }
    if(ok == FT_CNF_OK && g_b_ft_nvram_rec)
    {
       // get the nvram checksum from nvram
       kal_uint16 u2_checksum;
       bool bValid = ft_misc_cal_data_get_checksum((kal_uint16)cnf_result->file_idx,
                    cnf_result->para,&u2_checksum);
       if(bValid)
       {
           // update the misc_buffer
           ft_misc_cal_data_update_local_buf((kal_uint16)cnf_result->file_idx,
                   cnf_result->para, u2_checksum);
       }
    }
}