void Q7x27_kybd_late_resume(struct early_suspend *h)
{
    fih_printk(Q7x27_kybd_debug_mask, FIH_DEBUG_ZONE_G0,"Q7x27_kybd_late_resume()(%d)\n",rd->kybd_connected);
 //printk(KERN_INFO "Q7x27_kybd_late_resume()(%d)\n",rd->kybd_connected);
// printk(KERN_ERR "%s""#######################g_center_pin:%d \n", __func__,g_center_pin);
  if(SetupKeyFail)
 {
     SetupKeyFail=false;
     KeySetup();
 }
 if (device_may_wakeup(&rd->pdev->dev))
 {   

   if(b_VolUp_EnableWakeIrq)
   {
     //printk(KERN_INFO "disable VolUp   wakeup pin: %d\n", rd->volup_pin);
     fih_printk(Q7x27_kybd_debug_mask, FIH_DEBUG_ZONE_G0,"disable VolUp   wakeup pin: %d\n", rd->volup_pin);
	 disable_irq_wake(MSM_GPIO_TO_INT(rd->volup_pin));
     b_VolUp_EnableWakeIrq = false;     
   }

   if(b_VolDown_EnableWakeIrq)
   {
     //printk(KERN_INFO "disable VolDown   wakeup pin: %d\n", rd->voldn_pin);
     fih_printk(Q7x27_kybd_debug_mask, FIH_DEBUG_ZONE_G0,"disable VolDown   wakeup pin: %d\n", rd->voldn_pin);
	 disable_irq_wake(MSM_GPIO_TO_INT(rd->voldn_pin));
     b_VolDown_EnableWakeIrq = false;     
   }
   //+++ FIH, KarenLiao@20100304: F0X.B-9873: [Call control]Cannot end the call when long press hook key.
   if(b_HookKey_EnableWakeIrq == true)
   {
     printk(KERN_INFO "disable HookKey   wakeup pin: %d\n", rd->hook_sw_pin);
     fih_printk(Q7x27_kybd_debug_mask, FIH_DEBUG_ZONE_G0,"disable HookKey   wakeup pin: %d\n", rd->hook_sw_pin);
	 disable_irq_wake(MSM_GPIO_TO_INT(rd->hook_sw_pin));
     b_HookKey_EnableWakeIrq = false;
   }
   //--- FIH, KarenLiao@20100304: F0X.B-9873: [Call control]Cannot end the call when long press hook key.
 }
 
}
void Q7x27_kybd_early_suspend(struct early_suspend *h)
{
    fih_printk(Q7x27_kybd_debug_mask, FIH_DEBUG_ZONE_G0,"Q7x27_kybd_early_suspend()(%d)\n",rd->kybd_connected);
 //printk(KERN_INFO "Q7x27_kybd_early_suspend()(%d)\n",rd->kybd_connected);
 if(SetupKeyFail)
 {
     SetupKeyFail=false;
     KeySetup();
    
 }

    if(b_EnableIncomingCallWakeKey)
    {
      if(device_may_wakeup(&rd->pdev->dev)) 
      {
                
        //printk(KERN_INFO "enable VolUp   wakeup pin: %d\n", rd->volup_pin);
        fih_printk(Q7x27_kybd_debug_mask, FIH_DEBUG_ZONE_G0,"enable VolUp wakeup pin: %d\n", rd->volup_pin);      
        enable_irq_wake(MSM_GPIO_TO_INT(rd->volup_pin));
        b_VolUp_EnableWakeIrq = true;

        //printk(KERN_INFO "enable VolDown   wakeup pin: %d\n", rd->voldn_pin); 
        fih_printk(Q7x27_kybd_debug_mask, FIH_DEBUG_ZONE_G0,"enable VolDown wakeup pin: %d\n", rd->voldn_pin);      
        enable_irq_wake(MSM_GPIO_TO_INT(rd->voldn_pin));
        b_VolDown_EnableWakeIrq = true;
      }
    }

 //+++ FIH, KarenLiao@20100304: F0X.B-9873: [Call control]Cannot end the call when long press hook key.
 if((b_EnableIncomingCallWakeKey ==true) && (rd->bHookSWIRQEnabled == true) && device_may_wakeup(&rd->pdev->dev) )
 {
     printk(KERN_INFO "enable Hook Key   wakeup pin: %d\n", rd->hook_sw_pin);
     fih_printk(Q7x27_kybd_debug_mask, FIH_DEBUG_ZONE_G0,"enable Hook Key   wakeup pin: %d\n",rd->hook_sw_pin);
     enable_irq_wake(MSM_GPIO_TO_INT(rd->hook_sw_pin));
     b_HookKey_EnableWakeIrq = true;
 }
 //--- FIH, KarenLiao@20100304: F0X.B-9873: [Call control]Cannot end the call when long press hook key.
 
}
Beispiel #3
0
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nShowCmd )
{
	LPTSTR wndname = _T("PocketStella");
	WNDCLASS wc = { CS_HREDRAW | CS_VREDRAW, WindowProc, 0, 0, hInstance, NULL, NULL, 
		(HBRUSH)GetStockObject(BLACK_BRUSH), NULL, wndname};
	RegisterClass(&wc);
	hWnd = CreateWindow(wndname, wndname, WS_VISIBLE | WS_POPUP, 0, 0, GetSystemMetrics(SM_CXSCREEN),
						GetSystemMetrics(SM_CYSCREEN), NULL, NULL, hInstance, NULL);
	if (!hWnd) return 1;
	SetWindowPos(hWnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE);

	/* backlight */
	REG_bat = REG_ac = REG_disp = 2 * 60 * 60 * 1000; /* 2hrs should do it */
	backlight_xchg();
	SystemParametersInfo(SPI_GETBATTERYIDLETIMEOUT, 0, (void *) &bat_timeout, 0);
	SystemParametersInfo(SPI_SETBATTERYIDLETIMEOUT, 60 * 60 * 2, NULL, SPIF_SENDCHANGE);
	
	// pump the messages to get the window up
	MSG msg;
	while (PeekMessage(&msg, NULL, 0U, 0U, PM_REMOVE))
	{
		TranslateMessage(&msg);
		DispatchMessage(&msg);
	}

	LOGFONT f = {11, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS,
				 OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH, _T("")};
	HFONT hFnt = CreateFontIndirect(&f);
	HDC hDC = GetDC(hWnd);
	SelectObject(hDC, hFnt);
	RECT RWnd;
	GetClipBox(hDC, &RWnd);
	SetTextColor(hDC, 0xA0A0A0);
	SetBkColor(hDC, 0);
	DrawText(hDC, _T("PocketStella Initializing..."), -1, &RWnd, DT_CENTER | DT_VCENTER);
	ReleaseDC(hWnd, hDC);
	DeleteObject(hFnt);
	
	theOSystem = new OSystemWinCE(((string) getcwd()) + '\\');
	SettingsWinCE theSettings(theOSystem);
	theOSystem->settings().loadConfig();
	theOSystem->settings().validate();
	bool loaddefaultkeys = (theOSystem->settings().getString("keymap") == EmptyString);
	theOSystem->create();
	if (loaddefaultkeys)
	{
		// setup the default keybindings the first time we're run
		theOSystem->eventHandler().addKeyMapping(Event::JoystickZeroFire, kEmulationMode, SDLK_F1);
		theOSystem->eventHandler().addKeyMapping(Event::LauncherMode, kEmulationMode, SDLK_BACKSPACE);
		theOSystem->eventHandler().addKeyMapping(Event::ConsoleReset, kEmulationMode, SDLK_F6);
		theOSystem->eventHandler().addKeyMapping(Event::ConsoleSelect, kEmulationMode, SDLK_F5);

		theOSystem->eventHandler().addKeyMapping(Event::UIPgUp, kMenuMode, SDLK_LEFT);
		theOSystem->eventHandler().addKeyMapping(Event::UIPgDown, kMenuMode, SDLK_RIGHT);
		theOSystem->eventHandler().addKeyMapping(Event::UISelect, kMenuMode, SDLK_F1);
		theOSystem->eventHandler().addKeyMapping(Event::UICancel, kMenuMode, SDLK_BACKSPACE);
	}

	if ( !GXOpenDisplay(hWnd, GX_FULLSCREEN) || !GXOpenInput() )
	{
		CleanUp();
		return 1;
	}
	KeySetup();

	string romfile = ((string) getcwd()) + ((string) "\\") + theSettings.getString("GameFilename");
	if (!FilesystemNode::fileExists(romfile))
		theOSystem->createLauncher();
	else
		theOSystem->createConsole(romfile);

	theOSystem->mainLoop();

	CleanUp();

	return 0;
}
//---------------------------FIH_F0X_misty
static int Q7x27_kybd_probe(struct platform_device *pdev)
{
	struct Q7x27_kybd_platform_data *setup_data;
	int rc = -ENOMEM;

/* FIH, PeterKCTseng, @20090520 { */
/* The active type of input pin   */
#if ACTIVE_MODE_ENABLE // Peter, Debug
    g_HWID = FIH_READ_HWID_FROM_SMEM();
    g_ORIGHWID = FIH_READ_ORIG_HWID_FROM_SMEM();
#endif
/* } FIH, PeterKCTseng, @20090520 */

    //FIH_debug_log
    fih_printk(Q7x27_kybd_debug_mask, FIH_DEBUG_ZONE_G0,"Q7x27_kybd_probe\n");
    //printk(KERN_INFO "FIH: enter Q7x27_kybd_probe()\n");
	rd = kzalloc(sizeof(struct Q7x27_kybd_record), GFP_KERNEL);
	if (!rd) {
		//printk(KERN_ERR "i2ckybd_record memory allocation failed!!\n");
		fih_printk(Q7x27_kybd_debug_mask, FIH_DEBUG_ZONE_G0,"kybd_record memory allocation failed!!\n");
		return rc;
	}

	setup_data 		    = pdev->dev.platform_data;
	//+++++++++++++++++++++++++++FIH_F0X_misty
	//printk(KERN_ERR "++++++++++++++++++++++++add init_wakeup\n");
	device_init_wakeup(&pdev->dev, 1);
	//printk(KERN_ERR "---------------------add init_wakeup\n");
	//------------------------------FIH_F0X_misty
/* FIH, PeterKCTseng, @20090520 { */
/* The active type of input pin   */
#if ACTIVE_MODE_ENABLE // Peter, Debug
    
     if (g_HWID >= CMCS_RTP_PR1) {
		//printk(KERN_ERR "FIH: CMCS_RTP_PR1, g_HWID= %d \n", g_HWID);
		fih_printk(Q7x27_kybd_debug_mask, FIH_DEBUG_ZONE_G0,"FIH: CMCS_RTP_PR1, g_HWID= %d\n", g_HWID);
        rd->active.volup_pin_actype     = ACTIVE_HIGH;
        rd->active.voldn_pin_actype     = ACTIVE_HIGH;
        rd->active.hook_sw_pin_actype   = ACTIVE_LOW;

    }          
    else {
        // target board undefined 
		//printk(KERN_ERR "target borad can not be recognized!! \n");
		fih_printk(Q7x27_kybd_debug_mask, FIH_DEBUG_ZONE_G0,"target borad can not be recognized!!\n");

    }  
#endif
/* } FIH, PeterKCTseng, @20090520 */

#if VOLUME_KEY_ENABLE // Peter, Debug
	rd->volup_pin		= setup_data->volup_pin;
	rd->voldn_pin		= setup_data->voldn_pin;
#endif


#if SWITCH_KEY_ENABLE // Peter, Debug
	rd->hook_sw_pin     = setup_data->hook_sw_pin;

/* FIH, PeterKCTseng, @20090603 { */
	rd->bHookSWIRQEnabled = false; //FIH, KarenLiao, @20100520: FM6.B-706: Set initial value of HookSWIRQEnabled to false to fix calling enable_irq_wake() without headset.
/* } FIH, PeterKCTseng, @20090603 */
#endif


	//Initialize GPIO
	rc = Q7x27_kybd_config_gpio(rd);
	if (rc)
		goto failexit1;


#if VOLUME_KEY_ENABLE // Peter, Debug
	INIT_WORK(&rd->kybd_volkey1, Q7x27_kybd_volkey1);
    INIT_WORK(&rd->kybd_volkey2, Q7x27_kybd_volkey2);
#endif


#if SWITCH_KEY_ENABLE // Peter, Debug
	INIT_WORK(&rd->hook_switchkey, Q7x27_hook_switchkey);


//  msm_mic_en_proc(true);

#endif

    KeySetup();

    /* FIH, Debbie, 2010/01/05 { */
    /* modify for key definition of OTA update*/
    if(fih_read_kpd_from_smem())
    {
    	   EnableKeyInt = 1;
    }
    /* FIH, Debbie, 2010/01/05 } */
#if 0//misty +++
    printk(KERN_INFO "FIH: enter 7\n");    
	rc = Q7x27_kybd_irqsetup(rd);
    printk(KERN_INFO "FIH: enter 8\n");        
	if (rc)
		goto failexit2;

	rc = testfor_keybd();
    printk(KERN_INFO "FIH: enter 9\n");    
	if (rc)
		goto failexit2;
	
	rd->kybd_connected = 1;
#endif//misty ---
/* FIH, SimonSSChang, 2009/09/04 { */
/* [FXX_CR], change keypad suspend/resume function
to earlysuspend */
#ifdef CONFIG_FIH_FXX
#ifdef CONFIG_HAS_EARLYSUSPEND
    rd->Q7x27_kybd_early_suspend_desc.level = EARLY_SUSPEND_LEVEL_BLANK_SCREEN - 10;
	rd->Q7x27_kybd_early_suspend_desc.suspend = Q7x27_kybd_early_suspend;
	rd->Q7x27_kybd_early_suspend_desc.resume = Q7x27_kybd_late_resume;
    //printk(KERN_INFO "Keypad register_early_suspend()\n");
    fih_printk(Q7x27_kybd_debug_mask, FIH_DEBUG_ZONE_G0,"Keypad register_early_suspend()\n");
	register_early_suspend(&rd->Q7x27_kybd_early_suspend_desc);
    rd->pdev = pdev;
#endif
#endif
/* } FIH, SimonSSChang, 2009/09/04 */

    //FIH_debug_log
    //printk(KERN_INFO "FIH: out Q7x27_kybd_probe()\n");
    return 0;
#if 0//misty+++
 failexit2:
    //FIH_debug_log#if CAMERA_KEY_ENABLE // Peter, Debug

    printk(KERN_INFO "FIH: error out failexit2\n");
    
	free_irq(MSM_GPIO_TO_INT(rd->key_1_pin), rd);
	free_irq(MSM_GPIO_TO_INT(rd->key_2_pin), rd);

#if VOLUME_KEY_ENABLE // Peter, Debug
	free_irq(MSM_GPIO_TO_INT(rd->volup_pin), rd);
	free_irq(MSM_GPIO_TO_INT(rd->voldn_pin), rd);
#endif

#if CAMERA_KEY_ENABLE // Peter, Debug
	free_irq(MSM_GPIO_TO_INT(rd->cam_sw_t_pin), rd);
	free_irq(MSM_GPIO_TO_INT(rd->cam_sw_f_pin), rd);
#endif

#if SWITCH_KEY_ENABLE // Peter, Debug
	free_irq(MSM_GPIO_TO_INT(rd->hook_sw_pin), rd);
#endif

/* FIH, PeterKCTseng, @20090527 { */
/* add center key                 */
#if CENTER_KEY_ENABLE // Peter, Debug
	free_irq(MSM_GPIO_TO_INT(rd->center_pin), rd);
#endif
/* } FIH, PeterKCTseng, @20090527 */

#endif//misty----
 failexit1:
    //FIH_debug_log
    //printk(KERN_INFO "FIH: error out failexit1\n");
    fih_printk(Q7x27_kybd_debug_mask, FIH_DEBUG_ZONE_G0,"FIH: error out failexit1\n");
	Q7x27_kybd_release_gpio(rd);
	kfree(rd);

    //FIH_debug_log
    //printk(KERN_INFO "FIH: error out Q7x27_kybd_probe()\n");
    return 0;
    
	return rc;
}