gpioInc.h
上传用户:lqx1163
上传日期:2014-08-13
资源大小:9183k
文件大小:15k
源码类别:

MTK

开发平台:

C/C++

  1. /*****************************************************************************
  2. *  Copyright Statement:
  3. *  --------------------
  4. *  This software is protected by Copyright and the information contained
  5. *  herein is confidential. The software may not be copied and the information
  6. *  contained herein may not be used or disclosed except with the written
  7. *  permission of MediaTek Inc. (C) 2005
  8. *
  9. *  BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
  10. *  THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
  11. *  RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
  12. *  AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
  13. *  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
  14. *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
  15. *  NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
  16. *  SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
  17. *  SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
  18. *  THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
  19. *  NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
  20. *  SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
  21. *
  22. *  BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
  23. *  LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
  24. *  AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
  25. *  OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
  26. *  MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. 
  27. *
  28. *  THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
  29. *  WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
  30. *  LAWS PRINCIPLES.  ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
  31. *  RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
  32. *  THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
  33. *
  34. *****************************************************************************/
  35. /*****************************************************************************
  36.  *
  37.  * Filename:
  38.  * ---------
  39.  * gpioInc.h
  40.  *
  41.  * Project:
  42.  * --------
  43.  *   MAUI
  44.  *
  45.  * Description:
  46.  * ------------
  47.  *   This file is intends for Header file for GPIO Utility Functions
  48.  *
  49.  * Author:
  50.  * -------
  51.  * -------
  52.  *
  53.  *============================================================================
  54.  *             HISTORY
  55.  * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
  56.  *------------------------------------------------------------------------------
  57.  * removed!
  58.  *
  59.  * removed!
  60.  * removed!
  61.  * removed!
  62.  *
  63.  * removed!
  64.  * removed!
  65.  * removed!
  66.  *
  67.  * removed!
  68.  * removed!
  69.  * removed!
  70.  *
  71.  * removed!
  72.  * removed!
  73.  * removed!
  74.  *
  75.  * removed!
  76.  * removed!
  77.  * removed!
  78.  *
  79.  * removed!
  80.  * removed!
  81.  * removed!
  82.  *
  83.  * removed!
  84.  * removed!
  85.  * removed!
  86.  *
  87.  * removed!
  88.  * removed!
  89.  * removed!
  90.  *
  91.  * removed!
  92.  * removed!
  93.  * removed!
  94.  *
  95.  * removed!
  96.  * removed!
  97.  * removed!
  98.  *
  99.  * removed!
  100.  * removed!
  101.  * removed!
  102.  *
  103.  * removed!
  104.  * removed!
  105.  * removed!
  106.  *
  107.  * removed!
  108.  * removed!
  109.  * removed!
  110.  *
  111.  *------------------------------------------------------------------------------
  112.  * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
  113.  *============================================================================
  114.  ****************************************************************************/
  115. #ifndef MMI_GPIO_H
  116. #define MMI_GPIO_H
  117. #ifdef MMI_ON_WIN32
  118. typedef unsigned char kal_uint8;
  119. typedef unsigned short int kal_uint16;
  120. typedef unsigned int kal_uint32;
  121. #endif /* MMI_ON_WIN32 */ 
  122. #include "kal_non_specific_general_types.h"
  123. #include "device.h"
  124. #include "mdi_datatype.h"
  125. #include "mdi_audio.h"
  126. #include "custom_led_patterns.h"
  127. #include "SettingProfile.h"
  128. /***************************************************************************** 
  129. * Define
  130. *****************************************************************************/
  131. #define MMIDEVMSK_VIBON     0x00000001
  132. #define MMIDEVMSK_VIBSMS        0x00000002
  133. #define MMIDEVMSK_RESERVED_2      0x00000004
  134. #define MMIDEVMSK_RESERVED_3       0x00000008
  135. #define MMIDEVMSK_RESERVED_4      0x00000010
  136. #define MMIDEVMSK_RESERVED_5      0x00000020
  137. #define MMIDEVMSK_RESERVED_6      0x00000040
  138. #define MMIDEVMSK_RESERVED_7      0x00000080
  139. #define MMIDEV_GET_FLAG(a)       ( (gDeviceState & a) == 0 ? MMI_FALSE : MMI_TRUE )
  140. #define MMIDEV_SET_FLAG(a)       ( gDeviceState |=  a )
  141. #define MMIDEV_RESET_FLAG(a)   ( gDeviceState &=  ~a )
  142. #define MMIDEV_QRY_OCCUPY()       ( (gDeviceState == 0) ? MMI_FALSE : MMI_TRUE )
  143. #define     PHNSET_GPIO_SLIDE_CLAM_SETTING_BACK_TO_IDLE 0X00
  144. #define     PHNSET_GPIO_SLIDE_CLAM_SETTING_REJECT_CALL   0X01
  145. #define     PHNSET_GPIO_SLIDE_CLAM_SETTING_KEYPAD_LOCK   0X02
  146. #define SetRingerVolume(volume) mdi_audio_set_volume(MDI_VOLUME_MEDIA,(U8)(volume))
  147. #define SetKeyPadVolume(volume) mdi_audio_set_volume(MDI_VOLUME_KEY,(U8)(volume))
  148. #define SetSpeechVolume(volume) mdi_audio_set_volume(MDI_VOLUME_SPH,(U8)(volume))
  149. #define MuteOnMicrophone() SetMuteReq(MDI_DEVICE_MICROPHONE,1)
  150. #define MuteOffMicrophone() SetMuteReq(MDI_DEVICE_MICROPHONE,0)
  151. #define MuteOnSpeaker() SetMuteReq(MDI_DEVICE_SPEAKER,1)
  152. #define MuteOffSpeaker() SetMuteReq(MDI_DEVICE_SPEAKER,0)
  153. #define LCDBackLightOn() SetGPIOLevelReq(GPIO_DEV_LED_MAINLCD,5);
  154.                    SetGPIOLevelReq(GPIO_DEV_LED_SUBLCD,5);
  155. #define LCDBackLightOff() SetGPIOLevelReq(GPIO_DEV_LED_MAINLCD,0);
  156.                     SetGPIOLevelReq(GPIO_DEV_LED_SUBLCD,0);
  157. #define KeyPadBackLightOn() SetGPIOLevelReq(GPIO_DEV_LED_KEY,5)
  158. #define KeyPadBackLightOff() SetGPIOLevelReq(GPIO_DEV_LED_KEY,0)
  159. #define SetBackLightStatusOff()        SetGPIOLevelReq((gpio_device_enum)GPIO_DEV_LED_STATUS_1,LED_LIGHT_LEVEL0);
  160.                               SetGPIOLevelReq((gpio_device_enum)GPIO_DEV_LED_STATUS_2,LED_LIGHT_LEVEL0);         
  161.                               SetGPIOLevelReq((gpio_device_enum)GPIO_DEV_LED_STATUS_3,LED_LIGHT_LEVEL0);
  162. #define SetBackLightStatusRedOn()      SetGPIOLevelReq((gpio_device_enum)GPIO_DEV_LED_STATUS_1,LED_LIGHT_LEVEL5)
  163. #define SetBackLightStatusGreenOn()    SetGPIOLevelReq((gpio_device_enum)GPIO_DEV_LED_STATUS_2,LED_LIGHT_LEVEL5)
  164. #define SetBackLightStatusBlueOn()     SetGPIOLevelReq((gpio_device_enum)GPIO_DEV_LED_STATUS_3,LED_LIGHT_LEVEL5)
  165. #define SetBackLightStatusRedOff()     SetGPIOLevelReq((gpio_device_enum)GPIO_DEV_LED_STATUS_1,LED_LIGHT_LEVEL0)
  166. #define SetBackLightStatusGreenOff()   SetGPIOLevelReq((gpio_device_enum)GPIO_DEV_LED_STATUS_2,LED_LIGHT_LEVEL0)
  167. #define SetBackLightStatusBlueOff()    SetGPIOLevelReq((gpio_device_enum)GPIO_DEV_LED_STATUS_3,LED_LIGHT_LEVEL0)
  168. #define StartLEDPatternPowerOn()          PlayPatternReq(LED_POWER_ON, 1)
  169. #define StopLEDPatternPowerOn()              PlayPatternReq(LED_POWER_ON, 0)
  170. #define StartLEDPatternPowerOff()            PlayPatternReq(LED_POWER_OFF, 1)
  171. #define StopLEDPatternPowerOff()          PlayPatternReq(LED_POWER_OFF, 0)
  172. #define StartLEDPatternBatteryWarning()         PlayPatternReq(LED_BATTERY_WARNING, 1)
  173. #define StopLEDPatternBatteryWarning()       PlayPatternReq(LED_BATTERY_WARNING, 0)
  174. #define StartLEDPatternBatteryLow()          PlayPatternReq(LED_BATTERY_LOW, 1)
  175. #define StopLEDPatternBatteryLow()           PlayPatternReq(LED_BATTERY_LOW, 0)
  176. #define StartLEDPatternConnect900()          PlayPatternReq(LED_Connect900, 1)
  177. #define StopLEDPatternConnect900()           PlayPatternReq(LED_Connect900, 0)
  178. #define StartLEDPatternConnect1800()         PlayPatternReq(LED_Connect1800, 1)
  179. #define StopLEDPatternConnect1800()          PlayPatternReq(LED_Connect1800, 0)
  180. #define StartLEDPatternConnect1900()         PlayPatternReq(LED_Connect1900, 1)
  181. #define StopLEDPatternConnect1900()          PlayPatternReq(LED_Connect1900, 0)
  182. #define StartLEDPatternRoaming()            PlayPatternReq(LED_Roaming, 1)
  183. #define StopLEDPatternRoaming()           PlayPatternReq(LED_Roaming, 0)
  184. #define StartLEDPatternLimitService()        PlayPatternReq(LED_LimitService, 1)
  185. #define StopLEDPatternLimitService()         PlayPatternReq(LED_LimitService, 0)
  186. #define StartLEDPatternNoService()            PlayPatternReq(LED_NoService, 1)
  187. #define StopLEDPatternNoService()            PlayPatternReq(LED_NoService, 0)
  188. #define StartLEDPatternBackGround()            PlayPatternReq(GetBackgroundPattern(), 1)
  189. #define StopLEDPatternBackGround()             SendPlayPatternReqToHW(GetBackgroundPattern(), 0)
  190. #define StartLEDPatternCharging()            PlayPatternReq(LED_OnCharging, 1)
  191. #define StopLEDPatternCharging()          PlayPatternReq(LED_OnCharging, 0)
  192. #define StartLEDPatternFullCharging()        PlayPatternReq(LED_FullCharging, 1)
  193. #define StopLEDPatternFullCharging()         PlayPatternReq(LED_FullCharging, 0)
  194. #define StartLEDPatternMessageIn()           PlayPatternReq(LED_MessageIn, 1)
  195. #define StopLEDPatternMessageIn()            PlayPatternReq(LED_MessageIn, 0)
  196. #define StartLEDPatternMessageRemind()       PlayPatternReq(LED_MessageRemind, 1)
  197. #define StopLEDPatternMessageRemind()        PlayPatternReq(LED_MessageRemind, 0)
  198. #define StartLEDPatternCaller1()          PlayPatternReq(LED_Caller1, 1)
  199. #define StopLEDPatternCaller1()              PlayPatternReq(LED_Caller1, 0)
  200. #define StartLEDPatternCaller2()          PlayPatternReq(LED_Caller2, 1)
  201. #define StopLEDPatternCaller2()              PlayPatternReq(LED_Caller2, 0)
  202. #define StartLEDPatternCaller3()          PlayPatternReq(LED_Caller3, 1)
  203. #define StopLEDPatternCaller3()              PlayPatternReq(LED_Caller3, 0)
  204. #define StartLEDPatternCaller4()          PlayPatternReq(LED_Caller4, 1)
  205. #define StopLEDPatternCaller4()              PlayPatternReq(LED_Caller4, 0)
  206. #define StartLEDPatternCaller5()          PlayPatternReq(LED_Caller5, 1)
  207. #define StopLEDPatternCaller5()              PlayPatternReq(LED_Caller5, 0)
  208. #define StartLEDPatternCaller6()          PlayPatternReq(LED_Caller6, 1)
  209. #define StopLEDPatternCaller6()              PlayPatternReq(LED_Caller6, 0)
  210. #define VibratorOn()                            
  211. {                                               
  212.    if( MMIDEV_QRY_OCCUPY() == MMI_FALSE )       
  213.    {                                            
  214.       PlayPatternReq(VIB_PATTERN_1,PLAY_REPEAT);
  215.    }                                            
  216.    MMIDEV_SET_FLAG(MMIDEVMSK_VIBON);            
  217. }
  218. #define VibratorOff()                         
  219. {                                             
  220.    MMIDEV_RESET_FLAG(MMIDEVMSK_VIBON);        
  221.    if( MMIDEV_QRY_OCCUPY() == MMI_FALSE )     
  222.    {                                          
  223.       PlayPatternReq(VIB_PATTERN_1,PLAY_STOP);
  224.    }                                          
  225. }
  226. #define PlayVibratorOnce()                    
  227. {                                             
  228.    if( MMIDEV_QRY_OCCUPY() == MMI_FALSE )     
  229.    {                                          
  230.       PlayPatternReq(VIB_PATTERN_1,PLAY_ONCE);
  231.    }                                          
  232. }
  233. #define PlaySmsVibratorOnce()                 
  234. {                                             
  235.    if( MMIDEV_QRY_OCCUPY() == MMI_FALSE )     
  236.    {                                          
  237.       PlayPatternReq(VIB_PATTERN_3,PLAY_ONCE);
  238.    }                                          
  239. }
  240. #define IsClamOpen()    gMMIClamState
  241. /***************************************************************************** 
  242. * Typedef 
  243. *****************************************************************************/
  244. typedef enum
  245. {
  246.     PHNSET_GPIO_COVER_CLOSE_BACK_TO_IDLE_TITLE,
  247.     PHNSET_GPIO_COVER_CLOSE_BACK_TO_IDLE_ON,
  248.     PHNSET_GPIO_COVER_CLOSE_BACK_TO_IDLE_OFF,
  249.     PHNSET_GPIO_COVER_CLOSE_REJECT_CALL_TITLE,
  250.     PHNSET_GPIO_COVER_CLOSE_REJECT_CALL_YES,
  251.     PHNSET_GPIO_COVER_CLOSE_REJECT_CALL_NO,
  252.     PHNSET_GPIO_COVER_CLOSE_KEYPAD_LOCK_TITLE,
  253.     PHNSET_GPIO_COVER_CLOSE_KEYPAD_LOCK_ON,
  254.     PHNSET_GPIO_COVER_CLOSE_KEYPAD_LOCK_OFF
  255. } phnset_gpio_slide_clam_behavior_enum;
  256. typedef enum
  257. {
  258.     GPIO_BACKLIGHT_PERMANENT = 0,
  259.     GPIO_BACKLIGHT_SHORT_TIME
  260. } gpio_backlight_time_enum;
  261. /***************************************************************************** 
  262.              
  263. * Extern Global 
  264. Variable                                                                    
  265. *****************************************************************************/
  266. extern U8 gMMIClamState;
  267. extern U8 isEarphonePlugged;
  268. extern U32 gDeviceState;
  269. /***************************************************************************** 
  270.              
  271. * Extern Global 
  272. Function                                                                    
  273. *****************************************************************************/
  274. /* gpio devices detection indication */
  275. extern void GpioDetectInd(void *info);
  276. /* sets the Mute on */
  277. extern void SetMuteReq(audio_type_enum audio, MMI_BOOL onoff);
  278. extern void SetGPIOLevelReq(gpio_device_enum device, U8 level);
  279. extern void PlayPatternReq(U8 pattern, U8 action);
  280. extern void PlayPatternCallerGroup(MMI_LEDLIGHT_STATUS_ENUM pattern);
  281. extern void StopPatternCallerGroup(MMI_LEDLIGHT_STATUS_ENUM pattern);
  282. extern void SetModeSpeechVolume(void);
  283. extern void SaveSpeechVolume(U8 level);
  284. extern U8 GetModeSpeechVolume(void);
  285. extern void EnableHandsFree(void);
  286. extern void DisbleHandsFree(void);
  287. extern void EarPhoneScrExitOut(void);
  288. extern void EarPhonePlugOutScrTimeout(void);
  289. extern void EarPhonePlugInScrTimeout(void);
  290. extern BOOL mmi_gpio_is_earphone_plug_in(void);
  291. extern void ShowEarphoneSubLCDPopup(void);
  292. extern void EarPhonePlugInScrExit(void);
  293. extern void GetRingToneRange(U8 *startId, U8 *totalId);
  294. extern void GetMidiRange(U8 *startId, U8 *totalId);
  295. extern void GetToneRange(U8 *startId, U8 *totalId);
  296. extern void GetMiscToneRange(U8 *startId, U8 *totalId);
  297. extern void SendPlayPatternReqToHW(U8 pattern, U8 action);
  298. extern kal_uint8 GpioCtrlReq(kal_uint8 action);
  299. extern void HalfModeBacklight(void);
  300. extern U8 GetBackgroundPattern(void);
  301. extern MMI_BOOL IsBacklightOn(void);
  302. extern void TurnOnBacklight(gpio_backlight_time_enum time_enum);
  303. extern void TurnOffBacklight(void);
  304. extern void CloseBacklight(void);
  305. extern void mmi_gpio_backlight_ctrl_req_hdlr(void *msg);
  306. extern void mmi_gpio_led_ctrl_req_hdlr(void *msg);
  307. extern void InitHWBacklightTest(void);
  308. extern void SetBacklightMode(void *info);
  309. extern void SetBacklightModeExe(U8 mode);
  310. extern void GpioCtrlReqHdlr(void *inMsg);
  311. extern void GpioPlayReqHdlr(void *inMsg);
  312. extern void KeyPadLCDBackLightStop(void);
  313. extern BOOL mmi_gpio_is_lcd_sleep(void);
  314. #endif /* MMI_GPIO_H */