tizen 2.4 release
[profile/mobile/platform/kernel/u-boot-tm1.git] / arch / arm / include / asm / arch-sc8830 / isr_drvapi.h
1 /******************************************************************************
2  ** File Name:      isr_drvapi.h                                              *
3  ** Author:         Xuepeng.Zhang                                              *
4  ** DATE:           08/08/2010                                                *
5  ** Copyright:      2010 Spreatrum, Incoporated. All Rights Reserved.         *
6  ** Description:    This file defines the related driver of Interrupt      *
7  ******************************************************************************
8
9  ******************************************************************************
10  **                        Edit History                                       *
11  ** ------------------------------------------------------------------------- *
12  ** DATE           NAME             DESCRIPTION                               *
13   ** 08/08/2010    Xuepeng.Zhang        Create                           *
14 ******************************************************************************/
15 #ifndef _ISR_DRVAPI_H_
16 #define _ISR_DRVAPI_H_
17
18 #include "os_api.h"
19
20 /**---------------------------------------------------------------------------*
21  **                         Dependencies                                      *
22  **---------------------------------------------------------------------------*/
23 typedef struct
24 {
25     uint32   message;
26     uint32   wparam;
27     void     *lparam;
28 } TB_MSG;
29
30 typedef enum
31 {
32    ISR_DONE = 0x0,
33    CALL_HISR = 0x5a5
34
35 }ISR_EXE_T;
36
37 // ISR function pointer prototype.
38 typedef ISR_EXE_T (* TB_ISR) (uint32);
39
40 // CallBack function pointer prototype.
41 typedef void (* TB_CALLBACK) (TB_MSG *);
42
43
44 // Return value.
45 #define TB_NULL                 0x0
46 #define TB_SUCCESS              0x00
47 #define TB_ISR_NULL             0x01
48 #define TB_NO_CALLBACK          0x02
49 #define TB_CALLBACK_ASSIGNED    0x03
50 #define TB_ISR_ASSIGNED         0x0E
51 #define TB_PTR_ERROR            0x0F
52 #define TB_INT_ERROR            0x10
53 #define TB_PARAM_ERROR          0x20
54
55 //hisr 
56 typedef enum
57 {
58     CHIPDRV_HISR_PRIO_0 = SCI_PRIORITY_TIME_CRITICAL, //The highest priority
59     CHIPDRV_HISR_PRIO_1 = SCI_PRIORITY_HIGHEST,
60     CHIPDRV_HISR_PRIO_2,
61
62 } CHIPDRV_HISR_PRI_E;
63
64 typedef void hisr_func_t(uint32 count, void* data);
65
66 //
67
68
69 /**---------------------------------------------------------------------------*
70  **                         Compiler Flag                                     *
71  **---------------------------------------------------------------------------*/
72 #ifdef   __cplusplus
73 extern   "C"
74 {
75 #endif
76
77 /**---------------------------------------------------------------------------*
78  **                         Constant Variables                                *
79  **---------------------------------------------------------------------------*/
80
81 /*****************************************************************************/
82 //  Description:    This function should be called at the startup of the
83 //                  application. It initializes TBIOS interrupt resources.
84 //                  This must be called before installing an IRQ handler.
85 //  Dependency:     irq_isr_array
86 //  Author:         Richard.Yang
87 //  Note:
88 /*****************************************************************************/
89 void ISR_Init (void);
90
91 /*****************************************************************************/
92 //  Description:    This function is called when an IRQ happens.
93 //  Dependency:     irq_isr_array
94 //  Author:         Richard.Yang
95 //  Note:
96 /*****************************************************************************/
97 //void ISR_Handler(void);
98 void ISR_HandlerAll (void);
99
100 /*****************************************************************************/
101 //  Description:    This function is called to register a new ISR.
102 //  Dependency:     irq_isr_array
103 //  Author:         Richard.Yang
104 //  Note:           If success, the function returns TB_SUCCESS;
105 //                  if isr_handler is NULL, returns TB_PTR_ERROR;
106 //                  if int_num is a invalid number, returns TB_INT_ERROR;
107 //                  if the isr_handler is installed before, returns
108 //                  TB_ISR_ASSIGNED.
109 /*****************************************************************************/
110 uint32 ISR_RegHandler (
111     uint32 int_num,      // Interrupt number
112     TB_ISR isr_handler   // Interrupt service routine pointer.
113 );
114
115 /*****************************************************************************/
116 //  Description:    This function is called to register a new ISR and Hisr.
117 //  Dependency:     irq_isr_array
118 //  Author:         steve.zhan
119 //  Note:           If success, the function returns TB_SUCCESS;
120 //                  if isr_handler is NULL, returns TB_PTR_ERROR;
121 //                  if int_num is a invalid number, returns TB_INT_ERROR;
122 //                  if the isr_handler is installed before, returns
123 //                  TB_ISR_ASSIGNED.
124 /*****************************************************************************/
125 uint32 ISR_RegHandler_Ex (
126     uint32 logic_num,      // Interrupt number
127     TB_ISR isr_handler,   // Interrupt service routine pointer.
128     hisr_func_t *pHisrFunc,
129     CHIPDRV_HISR_PRI_E hisrPri,
130     void*              pHisrData
131 );
132
133 /*****************************************************************************/
134 //  Description:    This function is called to UnRegister an ISR.
135 //  Dependency:     irq_isr_array
136 //  Author:         Richard.Yang
137 //  Note:           If success, the function returns TB_SUCCESS;
138 //                  if int_num is a invalid number, returns TB_INT_ERROR;
139 //                  if the isr_handler is not installed before,
140 //                  returns TB_ISR_NULL.
141 /*****************************************************************************/
142 uint32 ISR_UnRegHandler (
143     uint32 int_num   // Interrupt number
144 );
145
146 /*****************************************************************************/
147 //  Description:    This function is called to do works defined by upper layer.
148 //  Dependency:     irq_isr_array
149 //  Author:         Richard.Yang
150 //  Note:           If OK, Returns TB_SUCCESS;
151 //                  if int_num is an invalid number, returns TB_INT_ERROR;
152 //                  if msg is NULL, returns TB_PTR_ERROR ;
153 //                  if no callback function registered, returns TB_NO_CALLBACK
154 /*****************************************************************************/
155 uint32 ISR_Callback (
156     uint32 int_num, // Interrupt number
157     TB_MSG *msg     // Message pointer
158 );
159
160 /*****************************************************************************/
161 //  Description:    This function is called to register a callback function
162 //                  called from lower layer.
163 //  Dependency:     irq_isr_array
164 //  Author:         Richard.Yang
165 //  Note:           If OK, returns TB_SUCCESS;
166 //                  if int_num is an invalid number, returns TB_INT_ERROR;
167 //                  if handler pointer is NULL, returns TB_PTR_ERROR;
168 //                  if callback function is already registered,
169 //                  returns TB_CALLBACK_ASSIGNED .
170 /*****************************************************************************/
171 uint32 ISR_RegCallback (
172     uint32      int_num,    // Interrupt number
173     TB_CALLBACK handler     // Callback handler
174 );
175
176 /*****************************************************************************/
177 //  Description:    This function is called to unregister a callback function
178 //                  called from lower layer.
179 //  Dependency:     irq_isr_array
180 //  Author:         Xueliang.Wang
181 //  Note:           Returns TB_SUCCESS if OK;
182 //                  returns TB_INT_ERROR if int_num is an invalid number;
183 //                  returns TB_NO_CALLBACK if no callback function registered.
184 /*****************************************************************************/
185 uint32 ISR_UnRegCallback (
186     uint32      int_num     // Interrupt number
187 );
188
189 /**---------------------------------------------------------------------------*
190  **                         Function Propertype                               *
191  **---------------------------------------------------------------------------*/
192
193
194
195 /**---------------------------------------------------------------------------*
196  **                         Compiler Flag                                     *
197  **---------------------------------------------------------------------------*/
198 #ifdef   __cplusplus
199 }
200 #endif // __cplusplus
201
202 #endif // End of _ISR_DRVAPI_H_
203