tizen 2.4 release
[profile/mobile/platform/kernel/u-boot-tm1.git] / arch / arm / include / asm / arch-sc9630 / ref_param.h
1 /******************************************************************************
2  ** File Name:      ref_param.h                                               *
3  ** Author:         Xueliang.Wang                                             *
4  ** DATE:           09/03/2003                                                *
5  ** Copyright:      2003 Spreatrum, Incoporated. All Rights Reserved.         *
6  ** Description:    This file contain some Ref parameter.                     *
7  ******************************************************************************
8
9  ******************************************************************************
10  **                        Edit History                                       *
11  ** ------------------------------------------------------------------------- *
12  ** DATE           NAME             DESCRIPTION                               *
13  ** 09/03/2003     Xueliang.Wang    Create.                                   *
14  ******************************************************************************/
15 #ifndef _REF_PARAM_H
16 #define _REF_PARAM_H
17
18 /**---------------------------------------------------------------------------*
19  **                         Dependencies                                      *
20  **---------------------------------------------------------------------------*/
21 #include "os_api.h" 
22
23 /**---------------------------------------------------------------------------*
24  **                         Compiler Flag                                     *
25  **---------------------------------------------------------------------------*/
26 #ifdef __cplusplus
27     extern   "C"
28     {
29 #endif
30
31 /**---------------------------------------------------------------------------*
32  **                         Defines                                           *
33  **---------------------------------------------------------------------------*/
34 /**---------------------------------------------------------------------------*
35  **                         Constant Variables                                *
36  **---------------------------------------------------------------------------*/
37
38
39 /**---------------------------------------------------------------------------*
40  **                         Data Structures                                   *
41  **---------------------------------------------------------------------------*/
42  
43 // Charge Param defined by lin.liu
44 // 
45 #define CHR_TABLE_SIZE    16
46
47 #define LOUD_PARA_COUNT        5
48
49 #define AUDIO_SAMPLERATE_COUNT  9
50
51 // All the voltage unit is mV
52 typedef struct
53 {
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;         //
60     
61     uint16       float_range;         // when the voltage is low(high) than 
62     
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 ];
65     
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 ];
70     
71     // We read ADC result when a tx occur, and after reach the tx_count, then average and report
72     // to chr_stm
73     uint16       tx_count;
74     uint16       battery_count;
75     
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;
84     
85     uint16       warning_count;  // when reach the warning count, will send the voltage warning to client.
86     
87     // send the one or more warning msg before send shutdown msg.
88     uint16       warning_count_before_shutdown; 
89     
90     // we average the adc result in the recent average count
91     uint16       average_count;
92     
93     uint16       reserved[ 11 ];
94 }CHR_PARAM_T;   // Size is 112 bytes
95 //
96 //
97 typedef struct RTC_CALIBRATION_INFO_tag
98 {
99         uint32  last_cal_time;  
100         uint32  last_cal_result;
101         uint8   reserved1;
102         int8    is_update_nv;
103         int16   total_delta_seconds;
104         int32   last_cal_numerator;     
105 } RTC_CALIBRATION_INFO_T;
106
107 typedef struct AUD_ARMREF_PARAM_tag
108 {
109     int16 loud_param[AUDIO_SAMPLERATE_COUNT][LOUD_PARA_COUNT];
110     uint8 lcf_on;
111     uint8 loud_on;
112     uint8 speaker_stereo;
113     uint8 u8reserved[7];
114     int16 s16reserved[4];
115 } AUD_ARMREF_PARAM_T;
116  
117 // Size of this strucure should be 300 bytes !!!
118 #define REF_PARAM_T_SIZE             300
119 typedef struct REF_PARAM_tag
120 {
121     uint32  uart_mode; 
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
128     /* end CR:MS8181 */
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
132     /*end CR:MS8384 */
133     
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
137     // End;    
138     
139     CHR_PARAM_T   chr_param;
140     
141     uint8   reserved1[2];
142     uint32  alarm_time;         // Number of seconds of alarm escaped from 2000-1-1 00:00:00
143     
144     uint32  lcd_brightless;     // the lcd backlight brightless. ( from 0 to 4, 5 level )
145     
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;
155     uint8   reserved[20];
156 } REF_PARAM_T;
157
158 /**---------------------------------------------------------------------------*
159  **                         Function Prototypes                               *
160  **---------------------------------------------------------------------------*/
161 /*****************************************************************************/
162 //  Description:    The function initialize REF parameters which on NVItem.
163 //      Global resource dependence: 
164 //  Author:         Xueliang.Wang
165 //      Note:           
166 /*****************************************************************************/
167 PUBLIC void REFPARAM_InitRefParam(void);
168
169 /*****************************************************************************/
170 //  Description:    The function gets uart mode.
171 //      Global resource dependence: 
172 //  Author:         Xueliang.Wang
173 //      Note:
174 /*****************************************************************************/
175 PUBLIC uint32 REFPARAM_GetUartMode(void);     // Return uart mode.
176
177 /*****************************************************************************/
178 //  Description:    The function sets uart mode.
179 //      Global resource dependence: 
180 //  Author:         Xueliang.Wang
181 //      Note:
182 /*****************************************************************************/
183 PUBLIC void REFPARAM_SetUartMode(
184     uint32  mode                    // The mode value to be set
185     );
186
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);
194
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
203     );
204
205 /*****************************************************************************/
206 //  Description:    The function gets com_debug physical port No.
207 //      Global resource dependence: 
208 //  Author:         Xueliang.Wang
209 //      Note:
210 /*****************************************************************************/
211 PUBLIC uint8 REFPARAM_GetDebugPortPhyNo(void);     // Return uart0 baud rate.
212
213 /*****************************************************************************/
214 //  Description:    The function sets com_debug physical port No
215 //      Global resource dependence: 
216 //  Author:         Xueliang.Wang
217 //      Note:
218 /*****************************************************************************/
219 PUBLIC void REFPARAM_SetDebugPortPhyNo(
220     uint8  phy_port              // The baud rate value to be set
221     );
222
223 /*****************************************************************************/
224 //  Description:    The function gets com_data physical port No.
225 //      Global resource dependence: 
226 //  Author:         Xueliang.Wang
227 //      Note:
228 /*****************************************************************************/
229 PUBLIC uint8 REFPARAM_GetDataPortPhyNo(void);     // Return uart0 baud rate.
230
231 /*****************************************************************************/
232 //  Description:    The function sets com_data physical port No
233 //      Global resource dependence: 
234 //  Author:         Xueliang.Wang
235 //      Note:
236 /*****************************************************************************/
237 PUBLIC void REFPARAM_SetDataPortPhyNo(
238     uint8  phy_port              // The baud rate value to be set
239     );
240
241 /*****************************************************************************/
242 //  Description:    The function gets uart0 baud rate.
243 //      Global resource dependence: 
244 //  Author:         Xueliang.Wang
245 //      Note:
246 /*****************************************************************************/
247 PUBLIC uint32 REFPARAM_GetDebugPortBaudRate(void);     // Return uart0 baud rate.
248
249 /*****************************************************************************/
250 //  Description:    The function sets uart0 baud rate.
251 //      Global resource dependence: 
252 //  Author:         Xueliang.Wang
253 //      Note:
254 /*****************************************************************************/
255 PUBLIC void REFPARAM_SetDebugPortBaudRate(
256     uint32  baud_rate              // The baud rate value to be set
257     );
258
259 /*****************************************************************************/
260 //  Description:    The function gets uart1 baud rate.
261 //      Global resource dependence: 
262 //  Author:         Xueliang.Wang
263 //      Note:
264 /*****************************************************************************/
265 PUBLIC uint32 REFPARAM_GetDataPortBaudRate(void);    // Return uart1 baud rate.
266
267 /*****************************************************************************/
268 //  Description:    The function sets uart1 baud rate.
269 //      Global resource dependence: 
270 //  Author:         Xueliang.Wang
271 //      Note:
272 /*****************************************************************************/
273 PUBLIC void REFPARAM_SetDataPortBaudRate(
274     uint32  baud_rate              // The baud rate value to be set
275     );
276
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.
285
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
295     );
296     
297 /*****************************************************************************/
298 //  Description:    The function gets enable arm sleep flag.
299 //      Global resource dependence: 
300 //  Author:         Xueliang.Wang
301 //      Note:           1: Enable
302 //                  0: Disable
303 /*****************************************************************************/
304 PUBLIC BOOLEAN REFPARAM_GetEnableArmSleepFlag(void);  // Return the flag.
305
306 /*****************************************************************************/
307 //  Description:    The function sets enable arm sleep flag.
308 //      Global resource dependence: 
309 //  Author:         Xueliang.Wang
310 //      Note:           1: Enable
311 //                  0: Disable
312 /*****************************************************************************/
313 PUBLIC void REFPARAM_SetEnableArmSleepFlag(
314     BOOLEAN is_enable_arm_sleep     // The flag value to be set
315     );
316
317 /*****************************************************************************/
318 //  Description:    The function gets enable arm log flag.
319 //      Global resource dependence: 
320 //  Author:         Xueliang.Wang
321 //      Note:           1: Enable
322 //                  0: Disable
323 /*****************************************************************************/
324 PUBLIC BOOLEAN REFPARAM_GetEnableArmLogFlag(void);  // Return the flag.
325
326 /*****************************************************************************/
327 //  Description:    The function sets enable arm log flag.
328 //      Global resource dependence: 
329 //  Author:         Xueliang.Wang
330 //      Note:           1: Enable
331 //                  0: Disable
332 /*****************************************************************************/
333 PUBLIC void REFPARAM_SetEnableArmLogFlag(
334     BOOLEAN is_enable_arm_log     // The flag value to be set
335     );
336
337 /*****************************************************************************/
338 //  Description:    The function gets alarm time.
339 //      Global resource dependence: 
340 //  Author:         Xueliang.Wang
341 //      Note:           
342 /*****************************************************************************/
343 PUBLIC uint32 REFPARAM_GetAlarmTime(void);      // Return alarm time escaped from 2000-1-1 00:00:00.
344
345 /*****************************************************************************/
346 //  Description:    The function sets alarm time.
347 //      Global resource dependence: 
348 //  Author:         Xueliang.Wang
349 //      Note:           
350 /*****************************************************************************/
351 PUBLIC void REFPARAM_SetAlarmTime(
352     uint32  alarm_time  // Alarm time escaped from 2000-1-1 00:00:00.
353     );
354
355 /*****************************************************************************/
356 //  Description:    The function gets RTC calibration information.
357 //      Global resource dependence: 
358 //  Author:         Xueliang.Wang
359 //      Note:           
360 /*****************************************************************************/
361 PUBLIC uint32 REFPARAM_GetRtcCalibrationInfo(
362         RTC_CALIBRATION_INFO_T *rtc_info_ptr
363         );
364
365 /*****************************************************************************/
366 //  Description:    The function sets RTC calibration information.
367 //      Global resource dependence: 
368 //  Author:         Xueliang.Wang
369 //      Note:           
370 /*****************************************************************************/
371 PUBLIC void REFPARAM_SetRtcCalibrationInfo(
372         RTC_CALIBRATION_INFO_T rtc_info
373     );
374
375 /*****************************************************************************/
376 //  Description:    The function get uart mix mode setting.
377 //      Global resource dependence: 
378 //  Author:         
379 //      Note: if in mix mode return SCI_TRUE, or return SCI_FALSE.
380 /*****************************************************************************/
381 PUBLIC BOOLEAN REFPARAM_GetMixMode(void);
382
383 /*****************************************************************************/
384 //  Description:    The function sets uart mix mode or not.
385 //      Global resource dependence: 
386 //  Author:         
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);
390     
391 PUBLIC CHR_PARAM_T * REFPARAM_GetChargeParam( void );    
392
393 PUBLIC uint32 REFPARAM_GetLCDBrightless( void );
394 PUBLIC void   REFPARAM_SetLCDBrightless( uint32 brightless );
395
396 /*****************************************************************************/
397 //  Description:   set marker to verify whether mobile production is ok. 
398 //      Global resource dependence:
399 //  Author:         
400 //      Note:          adc_val : value to set   
401 //                 return value: SCI_TRUE: write success
402 /*****************************************************************************/  
403 PUBLIC BOOLEAN REFPARAM_SetCaliMarkerValue(uint32 adc_val);
404
405 /*****************************************************************************/
406 //  Description:   get marker to verify whether mobile production is ok. 
407 //      Global resource dependence:
408 //  Author:         
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:
415 //  Author:         
416 //      Note:        
417 /*****************************************************************************/  
418 PUBLIC AUD_ARMREF_PARAM_T* REFPARAM_GetAudArmRefRaram(void); 
419
420 /*****************************************************************************/
421 //  Description:    The function gets RTC calibration information.
422 //      Global resource dependence: 
423 //  Author:        
424 //      Note:           
425 /*****************************************************************************/
426 PUBLIC uint8 REFPARAM_GetUartRecvMode( void );
427
428 /*****************************************************************************/
429 //  Description:    The function sets RTC calibration information.
430 //      Global resource dependence: 
431 //  Author:         
432 //      Note:           
433 /*****************************************************************************/
434 PUBLIC void REFPARAM_SeUartRecvmode( uint8  mode  );
435
436
437 /**---------------------------------------------------------------------------*
438  **                         Compiler Flag                                     *
439  **---------------------------------------------------------------------------*/
440 #ifdef __cplusplus
441     }
442 #endif
443
444 #endif  // _REF_PARAM_H