change source file mode to 0644 instead of 0755
[profile/mobile/platform/kernel/u-boot-tm1.git] / arch / arm / include / asm / arch-tiger / timer_phy.h
1 /******************************************************************************
2  ** File Name:      timer_phy.h                                                 *
3  ** Author:         DingJi                                                   *
4  ** DATE:           08/09/2010                                                *
5  ** Copyright:      2010 Spreatrum, Incoporated. All Rights Reserved.         *
6  ** Description:    This file define the basic hw interfaces of I2C device.      *
7  ******************************************************************************
8
9  ******************************************************************************
10  **                        Edit History                                       *
11  ** ------------------------------------------------------------------------- *
12  ** DATE                        NAME            DESCRIPTION                               *
13  ** 08/09/2010      DingJi              Create.                                   *
14  ******************************************************************************/
15
16 #ifndef _TIMER_PHY_H_
17 #define _TIMER_PHY_H_
18 /*----------------------------------------------------------------------------*
19  **                         Dependencies                                      *
20  **------------------------------------------------------------------------- */
21
22 #include "sci_types.h"
23
24 /**---------------------------------------------------------------------------*
25  **                             Compiler Flag                                 *
26  **--------------------------------------------------------------------------*/
27 #ifdef   __cplusplus
28 extern   "C"
29 {
30 #endif
31 /**---------------------------------------------------------------------------*
32 **                               Micro Define                                **
33 **---------------------------------------------------------------------------*/
34 typedef enum
35 {
36     TIMER_MODE_FREE,
37     TIMER_MODE_PERIOD,
38 }TIMER_PHY_MODE_E;
39
40 typedef struct 
41 {
42     TIMER_PHY_MODE_E mode; //work mode
43     uint32 clk_freq; //frequency of timer
44     uint32 load_count; //the count which will be load by timer at first, it depends on clk_freq
45     uint32 irq_op; //enable irq or disable irq
46 }TIMER_PHY_CONFIG_T;
47
48 typedef struct
49 {
50     TIMER_PHY_MODE_E mode; //work mode
51
52     uint32 clk_freq; //frequency of timer
53     uint32 max_count; //max load count
54     uint32 max_us; // max load count transfer to max us
55     uint32 cnt_per_timeunit; // how many count for one time unit
56     
57     uint32 current_value; //current count
58     uint32 running_status; //running or stop
59     uint32 irq_status; //irq be enabled or disabled
60 }TIMER_PHY_STATUS_T;
61
62 typedef struct
63 {
64     int32 (*init)(uint32 timer_id);
65     int32 (*enable)(uint32 timer_id);
66     int32 (*disable)(uint32 timer_id);
67     int32 (*config)(uint32 timer_id, TIMER_PHY_CONFIG_T *timer_config);
68     int32 (*query)(uint32 timer_id, TIMER_PHY_STATUS_T *timer_status);
69     int32 (*clr_irq)(uint32 timer_id);
70     int32 (*reload)(uint32 timer_id);
71 } TIMER_PHY_OPERATION_T;
72
73 /**----------------------------------------------------------------------------*
74 **                         Symbol Prototype                           **
75 **----------------------------------------------------------------------------*/
76 extern TIMER_PHY_STATUS_T timer_phy_status[]; 
77
78 /**----------------------------------------------------------------------------*
79 **                           Function Prototype                               **
80 **----------------------------------------------------------------------------*/
81 PUBLIC TIMER_PHY_OPERATION_T *timer_get_phy_operation(void);
82
83 /**----------------------------------------------------------------------------*
84 **                         Compiler Flag                                      **
85 **----------------------------------------------------------------------------*/
86 #ifdef   __cplusplus
87 }
88 #endif
89 /**---------------------------------------------------------------------------*/
90 #endif
91 // End