changeset 79:e5e2af0ca91c

mfw_kbd.c: white space fixes
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 26 Oct 2020 01:57:56 +0000
parents c632896652ba
children 46bab586c09b
files src/ui/mfw/mfw_kbd.c
diffstat 1 files changed, 193 insertions(+), 200 deletions(-) [+]
line wrap: on
line diff
--- a/src/ui/mfw/mfw_kbd.c	Sun Oct 25 23:41:01 2020 +0000
+++ b/src/ui/mfw/mfw_kbd.c	Mon Oct 26 01:57:56 2020 +0000
@@ -16,18 +16,18 @@
 
    HISTORY :
 
-   Sep 14, 2007	REF: OMAPS00145862  Adrian Salido
-	Description:	FT - MMI: Wrong trace class 
-	Solution:		changed some event traces to function traces because the information content of 
-				this is low for non-MMI people and against TI coding convention.
-				
+   Sep 14, 2007 REF: OMAPS00145862  Adrian Salido
+    Description:    FT - MMI: Wrong trace class
+    Solution:       changed some event traces to function traces because the information content of
+                this is low for non-MMI people and against TI coding convention.
+
    Oct 13, 2006 REF: OMAPS00097121 - x0039928
    Description: Keyboard pressed in a loop. KBP_R after suspend-resume
    Solution : If the Auto press timer expires mmi checks the bsp kpd status and accordingly
    sets auto key in the key map.
-   
+
    Sep 18, 2006 REF: OMAPS00094426 - x0039928
-   Description: Locosto - KPD Release event would NOT be generated if a key is pressed 
+   Description: Locosto - KPD Release event would NOT be generated if a key is pressed
    several times in a short period of time
    Solution : If the long press timer expires mmi checks the bsp kpd status and accordingly
    sets long press bit in the key map.
@@ -101,15 +101,15 @@
 ** KeyPress Buffer Macros and Limits
 */
 //   Apr 03, 2005 REF: CRR 29988 - xpradipg
-//	Keyboard buffer reduced from 50 to 20
+//  Keyboard buffer reduced from 50 to 20
 #ifdef FF_MMI_REDUCED_KBD_BUFFER
 #define MAX_KPRESS_BFR 20
 #else
 #define MAX_KPRESS_BFR 50
 #endif
 typedef struct keyPressDetailsTag {
-	char make;
-	char key;
+    char make;
+    char key;
 } keyPressDetails;
 
 // Sep 18, 2006 REF: OMAPS00094426 - x0039928
@@ -121,8 +121,8 @@
 static SHORT mfw_kbd_kpress_buf_id;
 
 extern void sendKeyInd( T_KPD_VIRTUAL_KEY_ID virtual_key_id,
-						T_KPD_KEY_STATE key_state,
-						T_KPD_PRESS_STATE press_state);
+                        T_KPD_KEY_STATE key_state,
+                        T_KPD_PRESS_STATE press_state);
 extern char drvGetKeyIndex( char key);
 
 /*
@@ -158,14 +158,14 @@
     doAlways = 0;
 
     mfw_kbd_kpress_buf_id = mfw_cbuf_create(MAX_KPRESS_BFR,
-    										  sizeof(keyPressDetails),
-    										  FALSE,
-    										  0xFF,
-    										  TRUE,
-    										  keyPressBfr);
+                                              sizeof(keyPressDetails),
+                                              FALSE,
+                                              0xFF,
+                                              TRUE,
+                                              keyPressBfr);
 
-	if (mfw_kbd_kpress_buf_id < 0)
-		TRACE_EVENT_P1("ERROR : mfw_cbuf_create failed with error value %d", mfw_kbd_kpress_buf_id);
+    if (mfw_kbd_kpress_buf_id < 0)
+        TRACE_EVENT_P1("ERROR : mfw_cbuf_create failed with error value %d", mfw_kbd_kpress_buf_id);
 
     return MfwResOk;
 }
@@ -205,11 +205,11 @@
     MfwCb always = doAlways;
 
     doAlways = f;
-	if  (!f)
-	{
+    if  (!f)
+    {
         timStop(&timLongH);
         timStop(&timAutoH);
-	}
+    }
 
     return always;
 }
@@ -248,18 +248,18 @@
 {
     MfwHdr *hdr = (MfwHdr *) mfwAlloc(sizeof(MfwHdr));
     MfwKbd *kbd = (MfwKbd *) mfwAlloc(sizeof(MfwKbd));
-	MfwHdr *insert_status =0;
-	
+    MfwHdr *insert_status =0;
+
     if (!hdr || !kbd)
     {
-    	TRACE_ERROR("ERROR: kbdCreate() Mem Alloc Failed.");
-			
-	   	if(hdr)
-   			mfwFree((U8*)hdr,sizeof(MfwHdr));
-   		if(kbd)
-   			mfwFree((U8*)kbd,sizeof(MfwKbd));	
-	   	return 0;
-  	}
+        TRACE_ERROR("ERROR: kbdCreate() Mem Alloc Failed.");
+
+        if(hdr)
+            mfwFree((U8*)hdr,sizeof(MfwHdr));
+        if(kbd)
+            mfwFree((U8*)kbd,sizeof(MfwKbd));
+        return 0;
+    }
 
     kbd->map = e;
     kbd->key = 0;
@@ -269,14 +269,14 @@
     hdr->type = MfwTypKbd;
 
     insert_status = mfwInsert(w,hdr);
-    
+
     if(!insert_status)
-	{
-  		TRACE_ERROR("ERROR: kbdCreate() Failed to Install Handler. ");
-   		mfwFree((U8*)hdr,sizeof(MfwHdr));
-   		mfwFree((U8*)kbd ,sizeof(MfwKbd));
-		return 0;
-  	}
+    {
+        TRACE_ERROR("ERROR: kbdCreate() Failed to Install Handler. ");
+        mfwFree((U8*)hdr,sizeof(MfwHdr));
+        mfwFree((U8*)kbd ,sizeof(MfwKbd));
+        return 0;
+    }
     return insert_status;
 }
 
@@ -424,7 +424,7 @@
         while (h)
         {
             res = sigExec(h,map,key); /* Warning correction - x0020906 - 14-08-2006*/
-            if (res)   
+            if (res)
                 break;
             if (h == mfwRoot)
                 break;
@@ -454,8 +454,8 @@
 */
 
 #define MAX_CONSEC_KEYS 6   // Maximum number of keys which can be processed before
-						        // allowing the protocol stack processing time
-//xrashmic 22 Aug, 2004 MMI-SPR-32798					        
+                                // allowing the protocol stack processing time
+//xrashmic 22 Aug, 2004 MMI-SPR-32798
 #ifdef MMI_EM_ENABLED
 #ifndef NEPTUNE_BOARD
 /* This is not valid for Neptune Engineering Mode, hence*/
@@ -466,32 +466,32 @@
 
 void kbdSignal (char make, char key)
 {
-	U32 map;
-	UBYTE temp=0 ;
-	USHORT numElem;
+    U32 map;
+    UBYTE temp=0 ;
+    USHORT numElem;
 
-	int loopNo;
-	int keyNo;
+    int loopNo;
+    int keyNo;
 
 
-	if ((kbd_processKeyInput()== QUEUE_EVERY_KEY) ||
-	     (kbd_processKeyInput()== QUEUE_N_KEYS))		
-		temp = dspl_Enable(0);
+    if ((kbd_processKeyInput()== QUEUE_EVERY_KEY) ||
+         (kbd_processKeyInput()== QUEUE_N_KEYS))
+        temp = dspl_Enable(0);
 
-	mme_backlightEvent(BL_KEY_PRESS);
+    mme_backlightEvent(BL_KEY_PRESS);
 
-	loopNo = 0;
-	keyNo = 0;
+    loopNo = 0;
+    keyNo = 0;
 
-	while (kbd_getMakeAndKey(&make,&key) != -1)
-	{
+    while (kbd_getMakeAndKey(&make,&key) != -1)
+    {
 #ifdef MMI_EM_ENABLED
 #ifndef NEPTUNE_BOARD
 /* This is not valid for Neptune Engineering Mode, hence*/
 
               //xrashmic 22 Aug, 2004 MMI-SPR-32798
-              //If screen capture is enabled the key pressed is the screen capture key, 
-              //we write the LCD buffer into the FFS and and consume the key 
+              //If screen capture is enabled the key pressed is the screen capture key,
+              //we write the LCD buffer into the FFS and and consume the key
               //event here itself without sending it to BMI
               // Also the screen capture key will be disabled here
               if(key== screenCaptureKey && make==1)
@@ -505,99 +505,99 @@
 #endif /* ifndef NEPTUNE_BOARD*/
 #endif
 
-		still_processing_flag = 1;
-		TRACE_EVENT_P2("NDH : KbdSignal - key %d, state %02x", key, make);
+        still_processing_flag = 1;
+        TRACE_EVENT_P2("NDH : KbdSignal - key %d, state %02x", key, make);
+
+        if (key <= KCD_MAX) /*a0393213 compiler warnings removal - comparison of key with 0 removed*/
+        {
+            loopNo++;
+            keyNo++;
 
-		if (key <= KCD_MAX) /*a0393213 compiler warnings removal - comparison of key with 0 removed*/
-		{
-			loopNo++;
-			keyNo++;
-			
-			map = 1L << key;
+            map = 1L << key;
+
+            if (make)
+            {
+                map |= KEY_MAKE;
+                curMap = map;
+                curKey = key;
+                timStart(&timLongH);
+                timAuto.time = valAuto;
 
-			if (make)
-			{
-				map |= KEY_MAKE;
-				curMap = map;
-				curKey = key;
-				timStart(&timLongH);
-				timAuto.time = valAuto;
+                /*NM, p007a*/
+                if (valAuto)
+                    timStart(&timAutoH);
+                /*NM, p007a end*/
 
-				/*NM, p007a*/
-				if (valAuto)
-					timStart(&timAutoH);
-				/*NM, p007a end*/
+            }
+            else
+            {
+                map &= ~KEY_MAKE;
+                curMap = map; //ES!!
+                curKey = key; //ES!!
+                timStop(&timLongH);
 
-			}
-			else
-			{
-				map &= ~KEY_MAKE;
-				curMap = map; //ES!!
-				curKey = key; //ES!!
-				timStop(&timLongH);
-				
-				if (valAuto)
-					timStop(&timAutoH);
-			}
+                if (valAuto)
+                    timStop(&timAutoH);
+            }
+
+            //Select when we update the display
+            switch (kbd_processKeyInput())
+            {
+                case QUEUE_EVERY_KEY:
+                    sigDistribute(map,key);
+                    break;
 
-			//Select when we update the display
-			switch (kbd_processKeyInput())
-			{
-				case QUEUE_EVERY_KEY:
-					sigDistribute(map,key);
-					break;
-					
-				case PROCESS_EVERY_KEY:
-					temp = dspl_Enable(0);
-					sigDistribute(map,key);
-					dspl_Enable(temp);
-					break;
-					
-				case QUEUE_N_KEYS:
-					if ((loopNo %(NUM_QUEUE_KEYS*2))==0) 
-					{
-						kbd_setDisplayUpdateNeeded(1);
-						sigDistribute(map,key); 
-						dspl_Enable(temp); 
-						temp = dspl_Enable(0);
-						kbd_setDisplayUpdateNeeded(0);
-					}
-					else
-						sigDistribute(map,key);
-					break;
-			}
-		}
+                case PROCESS_EVERY_KEY:
+                    temp = dspl_Enable(0);
+                    sigDistribute(map,key);
+                    dspl_Enable(temp);
+                    break;
+
+                case QUEUE_N_KEYS:
+                    if ((loopNo %(NUM_QUEUE_KEYS*2))==0)
+                    {
+                        kbd_setDisplayUpdateNeeded(1);
+                        sigDistribute(map,key);
+                        dspl_Enable(temp);
+                        temp = dspl_Enable(0);
+                        kbd_setDisplayUpdateNeeded(0);
+                    }
+                    else
+                        sigDistribute(map,key);
+                    break;
+            }
+        }
 
-		if (keyNo == MAX_CONSEC_KEYS)
-		{
-			still_processing_flag = FALSE;
-			break;
-		}
+        if (keyNo == MAX_CONSEC_KEYS)
+        {
+            still_processing_flag = FALSE;
+            break;
+        }
 
-		still_processing_flag = FALSE;
-	}
+        still_processing_flag = FALSE;
+    }
 
-	numElem = mfw_cbuf_num_elements(mfw_kbd_kpress_buf_id);
+    numElem = mfw_cbuf_num_elements(mfw_kbd_kpress_buf_id);
+
+    /* x0083025 on Sep 14, 2007 for OMAPS00145862 (adrian) */
+    MMI_TRACE_EVENT_P2("NDH >>> Kbd :- There are %d elements in the buffer (id : %d)" ,
+                     numElem, mfw_kbd_kpress_buf_id);
 
-	/* x0083025 on Sep 14, 2007 for OMAPS00145862 (adrian) */
-	MMI_TRACE_EVENT_P2("NDH >>> Kbd :- There are %d elements in the buffer (id : %d)" ,
-					 numElem, mfw_kbd_kpress_buf_id);
-	
-	if ((keyNo == MAX_CONSEC_KEYS) && (numElem > 0))
-	{
-		sendKeyInd(0, 0, 0); // dummy values to trigger another keypress_ind
-		/*
-		** This delay is required to slow down the BMI when no trace is being output in order
-		** to permit the Protocol Stack & other tasks to function correctly
-		*/
-		vsi_t_sleep (VSI_CALLER  30); 
-	}
+    if ((keyNo == MAX_CONSEC_KEYS) && (numElem > 0))
+    {
+        sendKeyInd(0, 0, 0); // dummy values to trigger another keypress_ind
+        /*
+        ** This delay is required to slow down the BMI when no trace is being output in order
+        ** to permit the Protocol Stack & other tasks to function correctly
+        */
+        vsi_t_sleep (VSI_CALLER  30);
+    }
 
-	if ((kbd_processKeyInput()== QUEUE_EVERY_KEY) ||
-	     (kbd_processKeyInput()== QUEUE_N_KEYS))		
-		dspl_Enable(temp);
+    if ((kbd_processKeyInput()== QUEUE_EVERY_KEY) ||
+         (kbd_processKeyInput()== QUEUE_N_KEYS))
+        dspl_Enable(temp);
 
-	return;
+    return;
 }
 
 
@@ -613,14 +613,14 @@
 static int toLong (U32 t, void *h)
 {
 // Sep 18, 2006 REF: OMAPS00094426 - x0039928
-// Fix: On long key press timer expiry bsp kpd status is checked to see if the state is 
+// Fix: On long key press timer expiry bsp kpd status is checked to see if the state is
 // in in Kpd pressed state and sets the long key bit.
 #if(BOARD == 71)
    UBYTE state;
    kpd_retrieve_key_status(kpd_key, KPD_DEFAULT_MODE, &state);
    if(!state)
-#endif   	
-       curMap |= KEY_LONG;   
+#endif
+       curMap |= KEY_LONG;
     sigDistribute(curMap,curKey);
 
     return 0;
@@ -643,19 +643,19 @@
    UBYTE state;
    kpd_retrieve_key_status(kpd_key, KPD_DEFAULT_MODE, &state);
    if(!state)
-   { 
-#endif   
+   {
+#endif
       curMap |= KEY_AUTO;
       sigDistribute(curMap,curKey);
- 
-	timAuto.time = valRepeat;
+
+    timAuto.time = valRepeat;
     /* NM p007c*/
     if (valRepeat)
-   		timStart(&timAutoH);
-	/* NM p007c end*/
-#if(BOARD == 71)	  
+        timStart(&timAutoH);
+    /* NM p007c end*/
+#if(BOARD == 71)
    }
-#endif  
+#endif
     return 0;
 }
 
@@ -699,18 +699,18 @@
 
 int kbd_putMakeAndKey( char make, char key)
 {
-	keyPressDetails localKP;
-	SHORT retVal;
+    keyPressDetails localKP;
+    SHORT retVal;
 
-	localKP.make = make;
-	localKP.key = key;
+    localKP.make = make;
+    localKP.key = key;
 
-	retVal = mfw_cbuf_put(mfw_kbd_kpress_buf_id, &localKP);
+    retVal = mfw_cbuf_put(mfw_kbd_kpress_buf_id, &localKP);
 
-	if (retVal < 0)
-		TRACE_EVENT_P1("ERROR : mfw_cbuf_put failed with error value %d", retVal);
+    if (retVal < 0)
+        TRACE_EVENT_P1("ERROR : mfw_cbuf_put failed with error value %d", retVal);
 
-	return (retVal);
+    return (retVal);
 }
 
 /*
@@ -720,28 +720,28 @@
 +--------------------------------------------------------------------+
 
   PURPOSE : reads 'make' (key up/down) and key index into a queue
-		Return	+ve number - keys left in buffer
-				 0 - no keys left - last key press returned
-				-1 - no keys and none in buffer
+        Return  +ve number - keys left in buffer
+                 0 - no keys left - last key press returned
+                -1 - no keys and none in buffer
 */
 
 int kbd_getMakeAndKey( char* make, char* key)
 {
-	keyPressDetails localKP;
-	SHORT retVal;
+    keyPressDetails localKP;
+    SHORT retVal;
 
-	retVal = mfw_cbuf_get(mfw_kbd_kpress_buf_id, &localKP);
+    retVal = mfw_cbuf_get(mfw_kbd_kpress_buf_id, &localKP);
 
-	if (retVal < 0)
-	{
-		*key = 0x7F;
-		*make = 0;
-		return (-1);
-	}
+    if (retVal < 0)
+    {
+        *key = 0x7F;
+        *make = 0;
+        return (-1);
+    }
 
-	*make = !(localKP.make);
-	*key =   drvGetKeyIndex(localKP.key);
-	return (mfw_cbuf_num_elements(mfw_kbd_kpress_buf_id));
+    *make = !(localKP.make);
+    *key =   drvGetKeyIndex(localKP.key);
+    return (mfw_cbuf_num_elements(mfw_kbd_kpress_buf_id));
 }
 
 /*
@@ -755,20 +755,20 @@
 */
 int kbd_getNumElements(void)
 {
-	return ((int)mfw_cbuf_num_elements(mfw_kbd_kpress_buf_id));
+    return ((int)mfw_cbuf_num_elements(mfw_kbd_kpress_buf_id));
 }
 
 int kbd_stillProcessingKeys(void)
 {
-	return (still_processing_flag);
+    return (still_processing_flag);
 }
 
 int mfwKey_skipDisplay( void )
 {
-	if ((mfw_cbuf_num_elements(mfw_kbd_kpress_buf_id) > 2) && (still_processing_flag == 1))
-		return (TRUE);
-	else
-		return (FALSE);
+    if ((mfw_cbuf_num_elements(mfw_kbd_kpress_buf_id) > 2) && (still_processing_flag == 1))
+        return (TRUE);
+    else
+        return (FALSE);
 }
 
 /*
@@ -782,15 +782,15 @@
 */
 int displayUpdateNeeded; //used for output every 'n' key presses
 int kbd_displayUpdateNeeded(void)
-{	
-	if (kbd_processKeyInput()==PROCESS_EVERY_KEY)
-		return (TRUE);//Processing each key press - always update screen
-	else if (displayUpdateNeeded==0)
-		return (TRUE);//need to update the display (1 in 6 output) 
-	else if (mfw_cbuf_num_elements(mfw_kbd_kpress_buf_id) > 1) 
-		return (FALSE);//keys in queue - do not update
-	else
-		return (TRUE);//only 1 key up/down in queue - update display
+{
+    if (kbd_processKeyInput()==PROCESS_EVERY_KEY)
+        return (TRUE);//Processing each key press - always update screen
+    else if (displayUpdateNeeded==0)
+        return (TRUE);//need to update the display (1 in 6 output)
+    else if (mfw_cbuf_num_elements(mfw_kbd_kpress_buf_id) > 1)
+        return (FALSE);//keys in queue - do not update
+    else
+        return (TRUE);//only 1 key up/down in queue - update display
 }
 /*
 +--------------------------------------------------------------------+
@@ -803,28 +803,21 @@
 */
 void kbd_setDisplayUpdateNeeded(int set)
 {
-	displayUpdateNeeded = set;
+    displayUpdateNeeded = set;
 }
-	
+
 /*
 +--------------------------------------------------------------------+
 | PROJECT : MMI-Framework (8417)        MODULE  : MFW_KBD            |
 | STATE   : code                        ROUTINE : kbd_processEveryKeyInput    |
 +--------------------------------------------------------------------+
 
-  PURPOSE : indicates if the software should process each keypad input individually 
-  			(TRUE) or if it should process keypad inputs one at a time (FALSE) 
+  PURPOSE : indicates if the software should process each keypad input individually
+            (TRUE) or if it should process keypad inputs one at a time (FALSE)
 
 */
 int kbd_processKeyInput(void)
 {
-	return (QUEUE_EVERY_KEY);//We buffer multiple key inputs
+    return (QUEUE_EVERY_KEY);//We buffer multiple key inputs
 
 }
-
-
-
-
-
-
-