1 /******************************************************************************
2 ** File Name: ref_param.h *
3 ** Author: Xueliang.Wang *
5 ** Copyright: 2003 Spreatrum, Incoporated. All Rights Reserved. *
6 ** Description: This file contain some Ref parameter. *
7 ******************************************************************************
9 ******************************************************************************
11 ** ------------------------------------------------------------------------- *
12 ** DATE NAME DESCRIPTION *
13 ** 09/03/2003 Xueliang.Wang Create. *
14 ******************************************************************************/
18 /**---------------------------------------------------------------------------*
20 **---------------------------------------------------------------------------*/
23 /**---------------------------------------------------------------------------*
25 **---------------------------------------------------------------------------*/
31 /**---------------------------------------------------------------------------*
33 **---------------------------------------------------------------------------*/
34 /**---------------------------------------------------------------------------*
35 ** Constant Variables *
36 **---------------------------------------------------------------------------*/
39 /**---------------------------------------------------------------------------*
41 **---------------------------------------------------------------------------*/
43 // Charge Param defined by lin.liu
45 #define CHR_TABLE_SIZE 16
47 #define LOUD_PARA_COUNT 5
49 #define AUDIO_SAMPLERATE_COUNT 9
51 // All the voltage unit is mV
54 uint16 voltage_warning; // when low than the voltage, send the warning msg to client.
55 uint16 voltage_shutdown; // when low than the voltage, send the shutdown msg to client.
56 uint16 voltage_shutdown_tx; // when the tx voltage is low than the voltage, send the
57 // shutdown msg to client.
58 uint16 adjust_backlight; //
59 uint16 adjust_call; //
61 uint16 float_range; // when the voltage is low(high) than
63 // ADC to Voltage table, from 2.8V to 4.2V, and the last one is 0xFFFF;
64 uint16 adc_voltage_table[ CHR_TABLE_SIZE ];
66 // The table define as following:
67 // If the voltage >= the low WORD of table[n], the capacity is the high WORD of table[n].
68 // The last one item of the table must be 0xFFFFFFFF
69 uint16 voltage_capacity_table[ CHR_TABLE_SIZE ];
71 // We read ADC result when a tx occur, and after reach the tx_count, then average and report
76 // When discharge, if the capacity is descending and reach the "count_1",
77 // then change the capacity that report to client.
78 // if the capacity is ascending and reach the "count_2", then chanrge the capacity.
79 // When charge, it is opposite.
80 // If the capacity is descending and reach the "count_2", then change the capacity.
81 // If the capacity is ascending and reach the "count_1", then change the capacity.
82 uint16 capacity_change_count_1;
83 uint16 capacity_change_count_2;
85 uint16 warning_count; // when reach the warning count, will send the voltage warning to client.
87 // send the one or more warning msg before send shutdown msg.
88 uint16 warning_count_before_shutdown;
90 // we average the adc result in the recent average count
93 uint16 reserved[ 11 ];
94 }CHR_PARAM_T; // Size is 112 bytes
97 typedef struct RTC_CALIBRATION_INFO_tag
100 uint32 last_cal_result;
103 int16 total_delta_seconds;
104 int32 last_cal_numerator;
105 } RTC_CALIBRATION_INFO_T;
107 typedef struct AUD_ARMREF_PARAM_tag
109 int16 loud_param[AUDIO_SAMPLERATE_COUNT][LOUD_PARA_COUNT];
112 uint8 speaker_stereo;
114 int16 s16reserved[4];
115 } AUD_ARMREF_PARAM_T;
117 // Size of this strucure should be 300 bytes !!!
118 #define REF_PARAM_T_SIZE 300
119 typedef struct REF_PARAM_tag
122 uint32 uart_0_baud_rate;
123 uint32 uart_1_baud_rate;
124 uint8 auto_power_on; // 1: Auto PowerOn 0: Don't auto PowerOn
125 /*@jim.zhang CR:MS8181 2004-03-29 */
126 uint8 uart0_as_data; // 1: uart0 used as DATA 0:used as DEBUG
127 // uint8 uart1_as_debug; // 1: uart1 used as debug 0:used as data
129 /* @Jim.zhang CR:MS8384 2004-04-02 */
130 uint8 gprs_debug; //1:GPRS_DEBUG that mix mode(log + AT). 0: not mix mode
131 uint8 sleep_need_emtpy_uart_fifo; // 1: when deep sleep ,the uart tx fifo should be empty. 0: not need empty
134 // @Xueliang.Wang add; CR9390; (2004-05-19)
135 uint8 enable_arm_sleep; // 1:Enable 0:Disable
136 uint8 enable_arm_log; // 1:Enable 0:Disable
139 CHR_PARAM_T chr_param;
142 uint32 alarm_time; // Number of seconds of alarm escaped from 2000-1-1 00:00:00
144 uint32 lcd_brightless; // the lcd backlight brightless. ( from 0 to 4, 5 level )
146 RTC_CALIBRATION_INFO_T rtc_cal_info;
147 uint32 core_voltage; // the core voltage
148 uint8 com_debug; // phy port No for COM_DEBUG ,0xff: idle
149 uint8 com_data; // phy port No for COM_DATA ,0xff: idle
150 uint8 enable_seine_log; // 1:Enable 0:Disable
151 uint8 dsp_volume; // max 255,
152 uint32 arm_log_uart_id; // uart id
153 uint32 dsp_log_uart_id; // uart id
154 AUD_ARMREF_PARAM_T audio_arm_param;
158 /**---------------------------------------------------------------------------*
159 ** Function Prototypes *
160 **---------------------------------------------------------------------------*/
161 /*****************************************************************************/
162 // Description: The function initialize REF parameters which on NVItem.
163 // Global resource dependence:
164 // Author: Xueliang.Wang
166 /*****************************************************************************/
167 PUBLIC void REFPARAM_InitRefParam(void);
169 /*****************************************************************************/
170 // Description: The function gets uart mode.
171 // Global resource dependence:
172 // Author: Xueliang.Wang
174 /*****************************************************************************/
175 PUBLIC uint32 REFPARAM_GetUartMode(void); // Return uart mode.
177 /*****************************************************************************/
178 // Description: The function sets uart mode.
179 // Global resource dependence:
180 // Author: Xueliang.Wang
182 /*****************************************************************************/
183 PUBLIC void REFPARAM_SetUartMode(
184 uint32 mode // The mode value to be set
187 /*****************************************************************************/
188 // Description: The function get usb virtual com or uart using mode.
189 // Global resource dependence:
190 // Author: weihua.wang
191 // Note: for function of usb virtual com
192 /*****************************************************************************/
193 PUBLIC uint32 REFPARAM_GetUSBVcomMode(void);
195 /*****************************************************************************/
196 // Description: The function set usb virtual com or uart using mode.
197 // Global resource dependence:
198 // Author: weihua.wang
199 // Note: for function of usb virtual com
200 /*****************************************************************************/
201 PUBLIC uint32 REFPARAM_SetUSBVcomMode(
202 uint32 mode // The usb virtual com mode value to be set
205 /*****************************************************************************/
206 // Description: The function gets com_debug physical port No.
207 // Global resource dependence:
208 // Author: Xueliang.Wang
210 /*****************************************************************************/
211 PUBLIC uint8 REFPARAM_GetDebugPortPhyNo(void); // Return uart0 baud rate.
213 /*****************************************************************************/
214 // Description: The function sets com_debug physical port No
215 // Global resource dependence:
216 // Author: Xueliang.Wang
218 /*****************************************************************************/
219 PUBLIC void REFPARAM_SetDebugPortPhyNo(
220 uint8 phy_port // The baud rate value to be set
223 /*****************************************************************************/
224 // Description: The function gets com_data physical port No.
225 // Global resource dependence:
226 // Author: Xueliang.Wang
228 /*****************************************************************************/
229 PUBLIC uint8 REFPARAM_GetDataPortPhyNo(void); // Return uart0 baud rate.
231 /*****************************************************************************/
232 // Description: The function sets com_data physical port No
233 // Global resource dependence:
234 // Author: Xueliang.Wang
236 /*****************************************************************************/
237 PUBLIC void REFPARAM_SetDataPortPhyNo(
238 uint8 phy_port // The baud rate value to be set
241 /*****************************************************************************/
242 // Description: The function gets uart0 baud rate.
243 // Global resource dependence:
244 // Author: Xueliang.Wang
246 /*****************************************************************************/
247 PUBLIC uint32 REFPARAM_GetDebugPortBaudRate(void); // Return uart0 baud rate.
249 /*****************************************************************************/
250 // Description: The function sets uart0 baud rate.
251 // Global resource dependence:
252 // Author: Xueliang.Wang
254 /*****************************************************************************/
255 PUBLIC void REFPARAM_SetDebugPortBaudRate(
256 uint32 baud_rate // The baud rate value to be set
259 /*****************************************************************************/
260 // Description: The function gets uart1 baud rate.
261 // Global resource dependence:
262 // Author: Xueliang.Wang
264 /*****************************************************************************/
265 PUBLIC uint32 REFPARAM_GetDataPortBaudRate(void); // Return uart1 baud rate.
267 /*****************************************************************************/
268 // Description: The function sets uart1 baud rate.
269 // Global resource dependence:
270 // Author: Xueliang.Wang
272 /*****************************************************************************/
273 PUBLIC void REFPARAM_SetDataPortBaudRate(
274 uint32 baud_rate // The baud rate value to be set
277 /*****************************************************************************/
278 // Description: The function gets auto PowerOn flag.
279 // Global resource dependence:
280 // Author: Xueliang.Wang
281 // Note: 1: Auto PowerOn
282 // 0: Don't auto PowerOn
283 /*****************************************************************************/
284 PUBLIC BOOLEAN REFPARAM_GetAutoPowerOnFlag(void); // Return the flag.
286 /*****************************************************************************/
287 // Description: The function sets auto PowerOn flag.
288 // Global resource dependence:
289 // Author: Xueliang.Wang
290 // Note: 1: Auto PowerOn
291 // 0: Don't auto PowerOn
292 /*****************************************************************************/
293 PUBLIC void REFPARAM_SetAutoPowerOnFlag(
294 BOOLEAN b_auto_power_on // The flag value to be set
297 /*****************************************************************************/
298 // Description: The function gets enable arm sleep flag.
299 // Global resource dependence:
300 // Author: Xueliang.Wang
303 /*****************************************************************************/
304 PUBLIC BOOLEAN REFPARAM_GetEnableArmSleepFlag(void); // Return the flag.
306 /*****************************************************************************/
307 // Description: The function sets enable arm sleep flag.
308 // Global resource dependence:
309 // Author: Xueliang.Wang
312 /*****************************************************************************/
313 PUBLIC void REFPARAM_SetEnableArmSleepFlag(
314 BOOLEAN is_enable_arm_sleep // The flag value to be set
317 /*****************************************************************************/
318 // Description: The function gets enable arm log flag.
319 // Global resource dependence:
320 // Author: Xueliang.Wang
323 /*****************************************************************************/
324 PUBLIC BOOLEAN REFPARAM_GetEnableArmLogFlag(void); // Return the flag.
326 /*****************************************************************************/
327 // Description: The function sets enable arm log flag.
328 // Global resource dependence:
329 // Author: Xueliang.Wang
332 /*****************************************************************************/
333 PUBLIC void REFPARAM_SetEnableArmLogFlag(
334 BOOLEAN is_enable_arm_log // The flag value to be set
337 /*****************************************************************************/
338 // Description: The function gets alarm time.
339 // Global resource dependence:
340 // Author: Xueliang.Wang
342 /*****************************************************************************/
343 PUBLIC uint32 REFPARAM_GetAlarmTime(void); // Return alarm time escaped from 2000-1-1 00:00:00.
345 /*****************************************************************************/
346 // Description: The function sets alarm time.
347 // Global resource dependence:
348 // Author: Xueliang.Wang
350 /*****************************************************************************/
351 PUBLIC void REFPARAM_SetAlarmTime(
352 uint32 alarm_time // Alarm time escaped from 2000-1-1 00:00:00.
355 /*****************************************************************************/
356 // Description: The function gets RTC calibration information.
357 // Global resource dependence:
358 // Author: Xueliang.Wang
360 /*****************************************************************************/
361 PUBLIC uint32 REFPARAM_GetRtcCalibrationInfo(
362 RTC_CALIBRATION_INFO_T *rtc_info_ptr
365 /*****************************************************************************/
366 // Description: The function sets RTC calibration information.
367 // Global resource dependence:
368 // Author: Xueliang.Wang
370 /*****************************************************************************/
371 PUBLIC void REFPARAM_SetRtcCalibrationInfo(
372 RTC_CALIBRATION_INFO_T rtc_info
375 /*****************************************************************************/
376 // Description: The function get uart mix mode setting.
377 // Global resource dependence:
379 // Note: if in mix mode return SCI_TRUE, or return SCI_FALSE.
380 /*****************************************************************************/
381 PUBLIC BOOLEAN REFPARAM_GetMixMode(void);
383 /*****************************************************************************/
384 // Description: The function sets uart mix mode or not.
385 // Global resource dependence:
387 // Note: use SCI_TRUE to set UART0 as mix mode, SCI_FALSE to not mix mode
388 /*****************************************************************************/
389 PUBLIC void REFPARAM_SetMixMode(BOOLEAN on);
391 PUBLIC CHR_PARAM_T * REFPARAM_GetChargeParam( void );
393 PUBLIC uint32 REFPARAM_GetLCDBrightless( void );
394 PUBLIC void REFPARAM_SetLCDBrightless( uint32 brightless );
396 /*****************************************************************************/
397 // Description: set marker to verify whether mobile production is ok.
398 // Global resource dependence:
400 // Note: adc_val : value to set
401 // return value: SCI_TRUE: write success
402 /*****************************************************************************/
403 PUBLIC BOOLEAN REFPARAM_SetCaliMarkerValue(uint32 adc_val);
405 /*****************************************************************************/
406 // Description: get marker to verify whether mobile production is ok.
407 // Global resource dependence:
409 // Note: return value: saved value in nv, (0xffffffff: return error)
410 /*****************************************************************************/
411 PUBLIC uint32 REFPARAM_GetCaliMarkerValue(void);
412 /*****************************************************************************/
413 // Description: get audio ref param struncture pointer on arm side .
414 // Global resource dependence:
417 /*****************************************************************************/
418 PUBLIC AUD_ARMREF_PARAM_T* REFPARAM_GetAudArmRefRaram(void);
420 /*****************************************************************************/
421 // Description: The function gets RTC calibration information.
422 // Global resource dependence:
425 /*****************************************************************************/
426 PUBLIC uint8 REFPARAM_GetUartRecvMode( void );
428 /*****************************************************************************/
429 // Description: The function sets RTC calibration information.
430 // Global resource dependence:
433 /*****************************************************************************/
434 PUBLIC void REFPARAM_SeUartRecvmode( uint8 mode );
437 /**---------------------------------------------------------------------------*
439 **---------------------------------------------------------------------------*/
444 #endif // _REF_PARAM_H