yu.dong | c33b307 | 2024-08-21 23:14:49 -0700 | [diff] [blame^] | 1 | /***************************************************************************** |
| 2 | * Copyright Statement: |
| 3 | * -------------------- |
| 4 | * This software is protected by Copyright and the information contained |
| 5 | * herein is confidential. The software may not be copied and the information |
| 6 | * contained herein may not be used or disclosed except with the written |
| 7 | * permission of MediaTek Inc. (C) 2005 |
| 8 | * |
| 9 | * BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES |
| 10 | * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE") |
| 11 | * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON |
| 12 | * AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES, |
| 13 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF |
| 14 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT. |
| 15 | * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE |
| 16 | * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR |
| 17 | * SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH |
| 18 | * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO |
| 19 | * NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S |
| 20 | * SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM. |
| 21 | * |
| 22 | * BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE |
| 23 | * LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE, |
| 24 | * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE, |
| 25 | * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO |
| 26 | * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. |
| 27 | * |
| 28 | * THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE |
| 29 | * WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF |
| 30 | * LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND |
| 31 | * RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER |
| 32 | * THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC). |
| 33 | * |
| 34 | *****************************************************************************/ |
| 35 | |
| 36 | /***************************************************************************** |
| 37 | * |
| 38 | * Filename: |
| 39 | * --------- |
| 40 | * adcsche.h |
| 41 | * |
| 42 | * Project: |
| 43 | * -------- |
| 44 | * Maui_Software |
| 45 | * |
| 46 | * Description: |
| 47 | * ------------ |
| 48 | * This file is intends for ADC scheduler |
| 49 | * |
| 50 | * Author: |
| 51 | * ------- |
| 52 | * ------- |
| 53 | * |
| 54 | *============================================================================ |
| 55 | * HISTORY |
| 56 | * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!! |
| 57 | *------------------------------------------------------------------------------ |
| 58 | * removed! |
| 59 | * removed! |
| 60 | * removed! |
| 61 | * |
| 62 | * removed! |
| 63 | * removed! |
| 64 | * removed! |
| 65 | * |
| 66 | * removed! |
| 67 | * removed! |
| 68 | * removed! |
| 69 | * |
| 70 | * removed! |
| 71 | * removed! |
| 72 | * removed! |
| 73 | * |
| 74 | * removed! |
| 75 | * removed! |
| 76 | * removed! |
| 77 | * |
| 78 | * removed! |
| 79 | * removed! |
| 80 | * removed! |
| 81 | * |
| 82 | * removed! |
| 83 | * removed! |
| 84 | * removed! |
| 85 | * |
| 86 | * removed! |
| 87 | * removed! |
| 88 | * removed! |
| 89 | * |
| 90 | * removed! |
| 91 | * removed! |
| 92 | * removed! |
| 93 | * |
| 94 | * removed! |
| 95 | * removed! |
| 96 | * removed! |
| 97 | * |
| 98 | * removed! |
| 99 | * removed! |
| 100 | * removed! |
| 101 | * |
| 102 | * removed! |
| 103 | * removed! |
| 104 | * removed! |
| 105 | * |
| 106 | * removed! |
| 107 | * removed! |
| 108 | * removed! |
| 109 | * removed! |
| 110 | * removed! |
| 111 | * removed! |
| 112 | * removed! |
| 113 | * removed! |
| 114 | * removed! |
| 115 | * removed! |
| 116 | * removed! |
| 117 | * removed! |
| 118 | * removed! |
| 119 | * removed! |
| 120 | * |
| 121 | *------------------------------------------------------------------------------ |
| 122 | * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!! |
| 123 | *============================================================================ |
| 124 | ****************************************************************************/ |
| 125 | #ifndef _ADCSCHE_H |
| 126 | #define _ADCSCHE_H |
| 127 | |
| 128 | #include "adc_hw.h" |
| 129 | #include "dcl.h" |
| 130 | |
| 131 | #define ADC_SCHE_MAX_CHANNEL (ADC_MAX_CHANNEL*2+4) /*engineering mode, chargeing mode, and MMI mode*/ |
| 132 | |
| 133 | //typedef void (* ADC_FUNC)(kal_int32 handle, kal_int32 volt_result, double adc_result); |
| 134 | |
| 135 | |
| 136 | /*adcsche.h*/ |
| 137 | typedef struct{ |
| 138 | module_type ownerid; |
| 139 | sap_type sapid; |
| 140 | kal_uint32 period; |
| 141 | kal_uint8 adc_phy_id; |
| 142 | kal_uint8 adc_logic_id; |
| 143 | kal_uint8 evaluate_count; /*how many to average*/ |
| 144 | kal_int32 send_primitive; |
| 145 | kal_bool conti_measure; |
| 146 | eventid adc_sche_event_id; |
| 147 | void (*complete)(signed long adc_handle, signed long volt_result, double adc_result);/*callback for upper layer*/ |
| 148 | }ADCScheMeasParameter; |
| 149 | |
| 150 | typedef struct{ |
| 151 | kal_uint8 *multi_adc_phy_id; |
| 152 | kal_uint8 max_multi_channel_number; |
| 153 | void (*multi_complete)(signed long adc_handle, signed long *volt_result, double *adc_result);/*callback for upper layer*/ |
| 154 | }ADCMultiChanParameter; |
| 155 | |
| 156 | |
| 157 | // The core functions for ADC |
| 158 | // adcsche.c |
| 159 | extern kal_uint32 adc_sche_create_object(ADC_CTRL_CREATE_OBJECT_T *prCreateObj); |
| 160 | extern void adc_sche_modify_parameters(kal_uint32 adc_sche_id, kal_uint32 period, kal_uint8 evaluate_count); |
| 161 | extern void adc_sche_add_item(kal_uint32 adc_sche_id, void (*mea_complete)(signed long handle, signed long volt_result, double adc_result), kal_timer_func_ptr mea_Callback); |
| 162 | extern void adc_sche_remove_item(kal_uint32 adc_sche_id); |
| 163 | extern void adc_sche_init(void); |
| 164 | extern void adc_sche_measure(void* msg_ptr); |
| 165 | extern void adc_sche_get_parameter(kal_uint32 adc_sche_id, ADCScheMeasParameter **para); |
| 166 | extern void adc_pwrdown_disable(void); |
| 167 | extern void adc_pwrdown_enable(void); |
| 168 | extern kal_uint8 adc_sche_get_channel(adc_channel_type type); |
| 169 | extern void adcsche_adc_measure_en(kal_bool adc_measure_enable); |
| 170 | extern void adc_multi_channel_set(DCL_UINT32 adc_sche_id, DCL_MULTI_CHANNEL_PARA_T* pMultiChannelPara); |
| 171 | |
| 172 | // adcmeasure.c |
| 173 | #if defined(DRV_ADC_FULL_FUNC) |
| 174 | extern void adc_tdma_time_setup(kal_uint16 idle_time, kal_uint16 trx_time); |
| 175 | #endif // #if defined(DRV_ADC_FULL_FUNC) |
| 176 | extern void adc_measure_parameter_init(void); |
| 177 | extern void adc_sche_stop_timer(kal_uint8 adc_sche_id); |
| 178 | extern void adc_sche_set_timer(kal_uint8 adc_sche_id, kal_uint32 tick, kal_timer_func_ptr call_func); |
| 179 | extern void adc_read_efuse_data(double *slope, double *offset); |
| 180 | extern void adc_read_calibration_data_inform(void); |
| 181 | extern void adc_set_adc_calibration_data(ilm_struct *lim_ptr); |
| 182 | extern kal_int32 adc_adc2vol(kal_uint8 chann,double adcVoltage); |
| 183 | extern kal_int32 volt2temp(kal_int32 _volt); |
| 184 | extern kal_int32 volt2isense(kal_int32 _volt); |
| 185 | |
| 186 | #endif /*_ADCSCHE_H*/ |
| 187 | |