FreeCalypso > hg > fc-tourmaline
diff src/ui/mfw/ti1_key.c @ 213:0947a816580c
first stage of FreeCalypso handset switch-on logic rework
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Thu, 22 Apr 2021 21:23:16 +0000 |
parents | c632896652ba |
children |
line wrap: on
line diff
--- a/src/ui/mfw/ti1_key.c Thu Apr 22 20:41:41 2021 +0000 +++ b/src/ui/mfw/ti1_key.c Thu Apr 22 21:23:16 2021 +0000 @@ -44,35 +44,12 @@ #include "drv_key.h" #include "ti1_key.h" -#ifndef NEPTUNE_BOARD #include "kpd/kpd_api.h" -#else -#define PLATFORM_ARCH_ARM -#define PLATFORM_ENDIAN_LITTLE -#define PLATFORM tcs3100Evm -#include "bspSystem.h" -#include "bspKeypad_Gsp.h" -#endif - -/* BUG FIX - OMAPS00084167 */ -#ifdef FF_MMI_MULTIMEDIA -#include "typedefs.h" -#include "main_system.h" -/*#include "dev_Mbox.h" */ /* 04-07-2006 */ -#endif -/* END - OMAPS00084167 */ - -BOOL powered_on=FALSE; #define POWER_KEY 25 extern void mmiInit(void); -//TISH modified for MSIM -#ifdef WIN32 -#define _SIMULATION_ -#endif - /* * Marcus: Issue 811: 05:09/2002: * Moved kbd_map, simkbd_map and config_map to \g23m\Condat\COM\SRC\DRIVER\keypad.c @@ -91,24 +68,30 @@ T_KPD_SUBSCRIBER subscriber_p; /* keep the subscription indentification value */ -// Sep 18, 2006 REF: OMAPS00094426 - x0039928 -#if (BOARD == 71) -extern UBYTE kpd_key; -#endif - typedef struct { U32 msg_id; - void (*callback_func)(void *); - U16 src_addr_id; - U16 dest_addr_id; + void (*callback_func)(void *); + U16 src_addr_id; + U16 dest_addr_id; } T_RV_CHECK; +/* + * New FreeCalypso way of launching "full on" operation: Switch_ON() + * will call fchs_pwon_button_boot() when the switch-on cause is the + * PWON button (as opposed to charging or test reset), the latter + * function will post a different version of the MMI_KEYPAD_IND + * primitive to MMI task, drvKeyUpDown() will get called as a result + * of this special MMI_KEYPAD_IND, and the latter function calls + * mmiInit(). Here we define the special "key code" used in the + * MMI_KEYPAD_IND primitive to pass this event to the MMI task. + */ + +#define SPECIAL_KEYCODE_PWON 0x81 /* JVJ #1874 - new function to initialize the power key*/ - /* +--------------------------------------------------------------------+ | PROJECT : MMI-Framework (8417) MODULE : key_power_init | @@ -119,15 +102,12 @@ */ - - void key_power_init() { kbd_Init(kbdCb); } - /* +--------------------------------------------------------------------+ | PROJECT : MMI-Framework (8417) MODULE : ti1_key | @@ -149,16 +129,7 @@ */ keyMap = (char *) kbd_map; - -//new keypad driver -#ifdef NEPTUNE_BOARD -// Commented by Nitin for Neptune Platfrom. 05/04/2005 -//keypad_initialize (); -#else keypad_initialize (); -#endif - - } @@ -176,17 +147,8 @@ { sig = 0; - // by Nitin 05/04/2004 -#ifndef NEPTUNE_BOARD - //unsubscribe the client from the keypad driver -#ifndef _SIMULATION_ + //unsubscribe the client from the keypad driver kpd_unsubscribe (&subscriber_p); -#endif -// Added by Nitin 05/04/2004 -#else /* NOT defined NEPTUNE_BOARD */ - kpdMgr_unsubscribe(); // Sumit; commented for time being -#endif - } /* @@ -202,7 +164,6 @@ { int i; -#ifndef _SIMULATION_ for (i = 0; i < 32; i++) { if (keyMap[i] == key) @@ -211,20 +172,7 @@ } } -#else - /* TEST only ES!! */ - for (i = 0; i < NUM_KPD_KEYS; i++) - { - if (simkbd_map[i] == key) - { - return (i); - } - } -#endif - return (char)(0xFE); //No match./*a0393213 warnings removal - -1 changed to 0xFE*/ - - } @@ -241,24 +189,10 @@ void drvKeyUpDown (char upDown, char key) { TRACE_EVENT_P2("drvKeyUpDown : key = %d : state = %x", key, upDown); -/* JVJ #1705 The first KEY event can only be the Power Key*/ -/* This will start MMI */ - if ((!powered_on)) - { - powered_on =TRUE; - - /* ADDED BY RAVI - 22-11-2005 - OMAPS00056702 FIX */ -#if (BOARD!=61) - /* JVJ #1705 MMI will be started here */ - mmiInit(); - return; -#endif - /* END RAVI - 22-11-2005 */ - } if (key != (char)0) { - if ((key >= 48) && (key <=57)) + if ((key >= 48) && (key <= 57)) { key -= 47; } @@ -302,6 +236,11 @@ key = (char)12; break; + /* FreeCalypso new way */ + case SPECIAL_KEYCODE_PWON: + mmiInit(); + return; + default: key = (char)0; break; @@ -316,7 +255,6 @@ sig((char)(!upDown),0); return; - } @@ -429,11 +367,7 @@ static void kbdCb (drv_SignalID_Type *signal_params) { -#if defined (NEW_FRAME) -ULONG signal_raw; - -#endif - + ULONG signal_raw; U16 signal_high; U16 signal_low; U8 key_code; @@ -441,15 +375,9 @@ int nPresses; //Number of key presses still in the queue - -#if defined (NEW_FRAME) signal_raw = (ULONG)signal_params->UserData; signal_high = (U16) (signal_raw >> 16); signal_low = (U16) (signal_raw & 0xFFFF); -#else - signal_high = (U16) (signal_params->UserData >> 16); - signal_low = (U16) (signal_params->UserData & 0xFFFF); -#endif key_code = (U8) (signal_low & 0xFF); if (signal_high == 1) @@ -457,19 +385,9 @@ else key_state = KEY_STAT_REL; -/*JVJ #1705 When the first POWER KEY event arrives, an event is sent to MMI */ -/*to start it */ -if ((!powered_on)&&(key_code==POWER_KEY)) -{ - sendKeyInd(key_code, key_state, 0); - return; -} - - //Add keypress to queue of key presses nPresses = kbd_getNumElements(); - kbd_putMakeAndKey( (char)key_state, (char)key_code); if ((!kbd_stillProcessingKeys()) && (nPresses == 0)) @@ -477,13 +395,12 @@ sendKeyInd(key_code, key_state, 0); } - } /* +--------------------------------------------------------------------+ | PROJECT : MMI-Framework (8417) MODULE : ti1_key | -| STATE : code ROUTINE : keypad_cb | +| STATE : code ROUTINE : keypad_cb | +--------------------------------------------------------------------+ PURPOSE : This CB function is called by the driver when a key is pressed/released @@ -493,13 +410,10 @@ void keypad_cb (void* parameter) { -// NITIN -#ifndef NEPTUNE_BOARD T_KPD_KEY_EVENT_MSG* event; T_KPD_STATUS_MSG* status; T_RV_CHECK* check; - check = (T_RV_CHECK*)parameter; if (check->msg_id EQ KPD_STATUS_MSG) @@ -523,7 +437,6 @@ //event message is used event = (T_KPD_KEY_EVENT_MSG*) parameter; - //Add keypress to queue of key presses nPresses = kbd_getNumElements(); @@ -542,11 +455,6 @@ // 0010 00xx = KPD_REPEAT_PRESS // // x = anystate -// Sep 18, 2006 REF: OMAPS00094426 - x0039928 -// Fix : Store the virtual key info in the global variable kpd_key for later use -#if (BOARD == 71) - kpd_key = (char)event->key_info.virtual_key_id; -#endif kbd_putMakeAndKey( (char)(event->key_info.state | (event->key_info.press_state << 4)), (char)event->key_info.virtual_key_id ); } @@ -560,24 +468,20 @@ } } -#endif // NEPTUNE_BOARD return; - } /* +--------------------------------------------------------------------+ | PROJECT : MMI-Framework (8417) MODULE : ti1_key | -| STATE : code ROUTINE : keypad_initialize | +| STATE : code ROUTINE : keypad_initialize | +--------------------------------------------------------------------+ PURPOSE : initialize keyboard driver */ -// Commented by Nitin for Neptune Platfrom. 05/04/2005 -#ifndef NEPTUNE_BOARD UBYTE keypad_initialize (void) { T_KPD_MODE mode; @@ -624,11 +528,7 @@ notified_keys.notified_keys [23] = KPD_KEY_RECORD; #endif -#ifndef _SIMULATION_ return_value = kpd_subscribe (&subscriber_p, mode, ¬ified_keys, return_path); -#else - return_value = RV_OK; /* do some faking here, to get it compileable */ -#endif if (return_value EQ RV_INTERNAL_ERR || return_value EQ RV_INVALID_PARAMETER || @@ -650,12 +550,8 @@ //subscribe to KPD_LONG_KEY_PRESS_NOTIF once implemented. notif_level = KPD_FIRST_PRESS_NOTIF | KPD_RELEASE_NOTIF; -#ifndef _SIMULATION_ return_value = kpd_define_key_notification( subscriber_p, ¬ified_keys, notif_level, long_press_time, repeat_time ); -#else - return_value = RV_OK; -#endif if (return_value EQ RV_INVALID_PARAMETER || return_value EQ RV_MEMORY_ERR) @@ -664,8 +560,6 @@ } return 0; } -// Commented by Nitin for Neptune Platfrom. 05/04/2005 -#endif /* NEPTUNE_BOARD*/ /* @@ -680,31 +574,30 @@ T_KPD_KEY_STATE key_state, T_KPD_PRESS_STATE press_state) { -#if defined (NEW_FRAME) EXTERN T_HANDLE hCommACI; -// ULONG signal_raw; // RAVI -#else - EXTERN T_VSI_CHANDLE hCommACI; -#endif - PALLOC(key_ind,MMI_KEYPAD_IND); key_ind->key_code = (U8)0; key_ind->key_stat = 0; -#if defined (NEW_FRAME) PSENDX(ACI,key_ind); -#else -#if defined (_TMS470) - vsi_c_send("",hCommACI,D2P(key_ind), - sizeof(T_PRIM_HEADER)+sizeof(T_MMI_KEYPAD_IND)); -#else - PSEND(ACI,key_ind); -#endif -#endif return; +} +/* new FreeCalypso functions for switch-on causes */ + +void fchs_pwon_button_boot(void) +{ + EXTERN T_HANDLE hCommACI; + + PALLOC(key_ind,MMI_KEYPAD_IND); + + key_ind->key_code = SPECIAL_KEYCODE_PWON; + + key_ind->key_stat = 0; + + PSENDX(ACI,key_ind); }