comparison src/condat/com/src/driver/light.c @ 4:6e457872f745

src/condat: hybrid import from Magnetite
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 15 Jul 2018 08:01:56 +0000
parents
children 7409b22cac61
comparison
equal deleted inserted replaced
3:b4c81ea2d291 4:6e457872f745
1 /*
2 +-----------------------------------------------------------------------------
3 | Project : GSM-PS
4 | Modul : DRV_LT
5 +-----------------------------------------------------------------------------
6 | Copyright 2002 Texas Instruments Berlin, AG
7 | All rights reserved.
8 |
9 | This file is confidential and a trade secret of Texas
10 | Instruments Berlin, AG
11 | The receipt of or possession of this file does not convey
12 | any rights to reproduce or disclose its contents or to
13 | manufacture, use, or sell anything it may describe, in
14 | whole, or in part, without the specific written consent of
15 | Texas Instruments Berlin, AG.
16 +-----------------------------------------------------------------------------
17 | Purpose : This Module defines the G23 light emitting driver.
18 +-----------------------------------------------------------------------------
19
20
21 Apr 26, 2005 REF : CRR 30627 xpradipg
22 Bug : Replace the ABB APIs with Audio Service APIs
23 Fix : Remove the LT_ function calls
24 *******************************************************************************/
25 /*
26 June 03, 2005 REF: GSM-ENH-31636 xpradipg
27 Description: Change the board ID for Isample to 71 and add new defination
28 for the CALLISTO with baord ID 70
29 Solution: Add the definition of ALLISTO with board ID 70 and change the
30 board Id to 71 for Isample
31
32 CRR 28825: xpradipg - 11 Feb 2005
33 Description:Extension of GDI-for display of ISample and code cleanup
34 Solution: The code replication for D_Sample and E_sample are removed and a new
35 flag is added for the ISample currently the BOARD ID is set to 60 for ISample.
36
37 */
38 #ifndef DRV_LT_C
39 #define DRV_LT_C
40 #endif
41
42 /*==== INCLUDES ===================================================*/
43 #if defined (NEW_FRAME)
44
45 #include <string.h>
46 #include "typedefs.h"
47 #include "gdi.h"
48 #include "light.h"
49
50 #else
51
52 #include <string.h>
53 #include "stddefs.h"
54 #include "gdi.h"
55 #include "light.h"
56
57 #endif
58
59 #include "fc-target.cfg"
60
61 /*==== EXPORT =====================================================*/
62
63 /*==== VARIABLES ==================================================*/
64 UBYTE backlight_status = LIGHT_STATUS_OFF;
65 /*==== FUNCTIONS ==================================================*/
66 #if defined (_TMS470)
67 #ifndef FF_MMI_SERVICES_MIGRATION
68 EXTERN void LT_Disable (void);
69 EXTERN void LT_Enable (void);
70 EXTERN void LT_Level (UBYTE level);
71 #endif
72 #else
73
74 LOCAL void LT_Disable (void);
75 LOCAL void LT_Enable (void);
76 LOCAL void LT_Level (UBYTE level);
77
78 #endif
79
80 /*==== CONSTANTS ==================================================*/
81 /*
82 +--------------------------------------------------------------------+
83 | PROJECT : GSM-PS (6103) MODULE : DRV_LT |
84 | STATE : code ROUTINE : light_Init |
85 +--------------------------------------------------------------------+
86
87 PURPOSE : The function initializes the internal data of the driver.
88 The function returns DRV_INITIALIZED if the driver has
89 already been initialized and is ready to be used or is
90 already in use. In case of an initialization failure,
91 i.e. the driver cannot be used, the function returns
92 DRV_INITFAILURE.
93
94 */
95
96 GLOBAL UBYTE light_Init (void)
97 {
98 backlight_status = LIGHT_STATUS_OFF;
99
100 return DRV_OK;
101 }
102
103 /*
104 +--------------------------------------------------------------------+
105 | PROJECT : GSM-PS (6103) MODULE : DRV_LT |
106 | STATE : code ROUTINE : light_Exit |
107 +--------------------------------------------------------------------+
108
109 PURPOSE : The function is called when the driver functionality is
110 not longer needed. The function de-allocates the
111 resources.
112
113 */
114
115 GLOBAL void light_Exit (void)
116 {
117 backlight_status = LIGHT_STATUS_OFF;
118 }
119
120 /*
121 +--------------------------------------------------------------------+
122 | PROJECT : GSM-PS (6103) MODULE : DRV_LT |
123 | STATE : code ROUTINE : light_SetStatus |
124 +--------------------------------------------------------------------+
125
126 PURPOSE : This function is used to change the status of a specific
127 light emitting device supported by this driver. The device is
128 identified by the parameter in_DeviceID. Depending on
129 the capabilities of the device, the parameter in_NewStatus
130 has different meanings.
131
132 */
133
134 GLOBAL UBYTE light_SetStatus (UBYTE in_DeviceID,
135 UBYTE in_NewStatus)
136 {
137 if (in_DeviceID EQ LIGHT_DEVICE_BACKLIGHT)
138 {
139 backlight_status = in_NewStatus;
140
141 switch (in_NewStatus)
142 {
143 case LIGHT_STATUS_OFF:
144 light_setBacklightOff();
145 // Apr 26, 2005 REF : CRR 30627 xpradipg
146 #ifndef FF_MMI_SERVICES_MIGRATION
147 LT_Disable ();
148 #endif
149 break;
150 default:
151 light_setBacklightOn();
152 // Apr 26, 2005 REF : CRR 30627 xpradipg
153 #ifndef FF_MMI_SERVICES_MIGRATION
154 LT_Enable ();
155 LT_Level (255);
156 #endif
157 break;
158 }
159 return DRV_OK;
160 }
161 else
162 return DRV_INVALID_PARAMS;
163 }
164
165 /*
166 +--------------------------------------------------------------------+
167 | PROJECT : GSM-PS (6103) MODULE : DRV_LT |
168 | STATE : code ROUTINE : light_GetStatus |
169 +--------------------------------------------------------------------+
170
171 PURPOSE : This function retrieves the status of a specific light
172 emitting device supported by the driver. If the status
173 of a specified device could be retrieved, the function
174 returns DRV_OK. If the specified device is unknown, the
175 function returns DRV_INVALID_PARAMS.
176
177 */
178
179 GLOBAL UBYTE light_GetStatus (UBYTE in_DeviceID,
180 UBYTE * in_StatusPtr)
181
182 {
183 if (in_DeviceID EQ LIGHT_DEVICE_BACKLIGHT)
184 {
185 *in_StatusPtr = backlight_status;
186 return DRV_OK;
187 }
188 else
189 return DRV_INVALID_PARAMS;
190 }
191
192
193 #if defined (WIN32)
194
195 LOCAL void LT_Disable (void)
196 {
197 }
198
199 LOCAL void LT_Enable (void)
200 {
201 }
202
203 LOCAL void LT_Level (UBYTE level)
204 {
205 }
206
207
208 #endif
209
210 /*******************************************************************************
211
212 Code below added for D-sample backlight
213
214 *******************************************************************************/
215 //June 03, 2005 REF: GSM-ENH-31636 xpradipg
216 //CRR 28825: xpradipg - 11 Feb 2005
217 #if ((BOARD == 40) || (BOARD == 41) || (BOARD == 43) || (BOARD == 70) || (BOARD == 71))
218 #define DSAMPLE_COLOUR
219 #include "lls/lls_api.h"
220 #else
221 /* Procedure stiubs added instead of disabling calls to the procedures. */
222 /* So we will get duplicate procedures if the actual LLS procedures are present */
223 #define LLS_BACKLIGHT 0x02
224 int lls_switch_off(unsigned char equipment)
225 {
226 }
227
228 int lls_switch_on(unsigned char equipment)
229 {
230 }
231
232 #endif
233
234 enum {
235 BACKLIGHT_OFF,
236 BACKLIGHT_ON,
237 BACKLIGHT_IDLE1
238 };
239 UBYTE backLightState= BACKLIGHT_OFF;
240 /*******************************************************************************
241
242 $Function: setBacklightOn
243
244 $Description: switches backlight on. Called on powerup or on a key press.
245 Should also be called on incoming call, SMS etc ?
246
247 $Returns: none.
248
249 $Arguments: none.
250
251
252 *******************************************************************************/
253 void light_setBacklightOn( void )
254 {
255 if (backLightState == BACKLIGHT_OFF)
256 {
257 #ifdef CONFIG_TARGET_C139
258 AI_SetBit(1);
259 #endif
260 //#ifdef DSAMPLE_COLOUR
261 lls_switch_on(LLS_BACKLIGHT); //Switch backlight on
262 //#endif
263 }
264 backLightState = BACKLIGHT_ON;
265 }
266 /*******************************************************************************
267
268 $Function: setBacklightOff
269
270 $Description: switches backlight off.
271
272 $Returns: none.
273
274 $Arguments: none.
275
276 *******************************************************************************/
277 void light_setBacklightOff( void )
278 {
279 if ((backLightState == BACKLIGHT_ON) ||
280 (backLightState == BACKLIGHT_IDLE1))
281 {
282 backLightState = BACKLIGHT_OFF;
283 #ifdef CONFIG_TARGET_C139
284 AI_ResetBit(1);
285 #endif
286 //#ifdef DSAMPLE_COLOUR
287 lls_switch_off(LLS_BACKLIGHT); //Switch backlight on
288 //#endif
289 }
290 }
291 /*******************************************************************************
292
293 $Function: setBacklightIdle
294
295 $Description: switches backlight off (on second call). Called when the 1 minute timer expires.
296 If no key press since the last call, the backlight is switched off.
297
298 $Returns: none.
299
300 $Arguments: none.
301
302 *******************************************************************************/
303 void light_setBacklightIdle( void )
304 {
305 if (backLightState == BACKLIGHT_ON)
306 {
307 backLightState = BACKLIGHT_IDLE1;
308 }
309 else
310 {
311 light_setBacklightOff();
312 }
313 }
314