comparison src/ui/mfw/ti1_key.c @ 77:a7e383456c01

mfw/ti1_key.c: white space fixes
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 25 Oct 2020 18:50:48 +0000
parents 67bfe9f274f6
children c632896652ba
comparison
equal deleted inserted replaced
76:137c6442eb63 77:a7e383456c01
15 TO DO : 15 TO DO :
16 +--------------------------------------------------------------------+ 16 +--------------------------------------------------------------------+
17 History: 17 History:
18 18
19 Sep 18, 2006 REF: OMAPS00094426 - x0039928 19 Sep 18, 2006 REF: OMAPS00094426 - x0039928
20 Description: Locosto - KPD Release event would NOT be generated if a key is pressed 20 Description: Locosto - KPD Release event would NOT be generated if a key is pressed
21 several times in a short period of time 21 several times in a short period of time
22 Solution : If the long press timer expires mmi checks the bsp kpd status and accordingly 22 Solution : If the long press timer expires mmi checks the bsp kpd status and accordingly
23 sets long press bit in the key map. 23 sets long press bit in the key map.
24 24
25 25
26 */ 26 */
27 27
28 #define ENTITY_MFW 28 #define ENTITY_MFW
29 29
30 #include "typedefs.h" 30 #include "typedefs.h"
81 static void kbdCb (drv_SignalID_Type *signal_params); 81 static void kbdCb (drv_SignalID_Type *signal_params);
82 82
83 UBYTE keypad_initialize (void); 83 UBYTE keypad_initialize (void);
84 84
85 void sendKeyInd( T_KPD_VIRTUAL_KEY_ID virtual_key_id, 85 void sendKeyInd( T_KPD_VIRTUAL_KEY_ID virtual_key_id,
86 T_KPD_KEY_STATE key_state, 86 T_KPD_KEY_STATE key_state,
87 T_KPD_PRESS_STATE press_state); 87 T_KPD_PRESS_STATE press_state);
88 88
89 static void (*sig) (char,char) = 0; /* kbd signaling function */ 89 static void (*sig) (char,char) = 0; /* kbd signaling function */
90 static char *keyMap = (char *) kbd_map; /* current keyboard mapping */ 90 static char *keyMap = (char *) kbd_map; /* current keyboard mapping */
91 91
92 T_KPD_SUBSCRIBER subscriber_p; /* keep the subscription indentification value */ 92 T_KPD_SUBSCRIBER subscriber_p; /* keep the subscription indentification value */
153 //new keypad driver 153 //new keypad driver
154 #ifdef NEPTUNE_BOARD 154 #ifdef NEPTUNE_BOARD
155 // Commented by Nitin for Neptune Platfrom. 05/04/2005 155 // Commented by Nitin for Neptune Platfrom. 05/04/2005
156 //keypad_initialize (); 156 //keypad_initialize ();
157 #else 157 #else
158 keypad_initialize (); 158 keypad_initialize ();
159 #endif 159 #endif
160 160
161 161
162 } 162 }
163 163
174 174
175 void keyExit (void) 175 void keyExit (void)
176 { 176 {
177 sig = 0; 177 sig = 0;
178 178
179 // by Nitin 05/04/2004 179 // by Nitin 05/04/2004
180 #ifndef NEPTUNE_BOARD 180 #ifndef NEPTUNE_BOARD
181 //unsubscribe the client from the keypad driver 181 //unsubscribe the client from the keypad driver
182 #ifndef _SIMULATION_ 182 #ifndef _SIMULATION_
183 kpd_unsubscribe (&subscriber_p); 183 kpd_unsubscribe (&subscriber_p);
184 #endif 184 #endif
185 // Added by Nitin 05/04/2004 185 // Added by Nitin 05/04/2004
186 #else /* NOT defined NEPTUNE_BOARD */ 186 #else /* NOT defined NEPTUNE_BOARD */
187 kpdMgr_unsubscribe(); // Sumit; commented for time being 187 kpdMgr_unsubscribe(); // Sumit; commented for time being
188 #endif 188 #endif
189 189
190 } 190 }
191 191
192 /* 192 /*
198 PURPOSE : returns the index to the key provided (or -1 if no match) 198 PURPOSE : returns the index to the key provided (or -1 if no match)
199 199
200 */ 200 */
201 char drvGetKeyIndex( char key) 201 char drvGetKeyIndex( char key)
202 { 202 {
203 int i; 203 int i;
204 204
205 #ifndef _SIMULATION_ 205 #ifndef _SIMULATION_
206 for (i = 0; i < 32; i++) 206 for (i = 0; i < 32; i++)
207 { 207 {
208 if (keyMap[i] == key) 208 if (keyMap[i] == key)
209 { 209 {
210 return (i); 210 return (i);
211 } 211 }
212 } 212 }
213 213
214 #else 214 #else
215 /* TEST only ES!! */ 215 /* TEST only ES!! */
246 if ((!powered_on)) 246 if ((!powered_on))
247 { 247 {
248 powered_on =TRUE; 248 powered_on =TRUE;
249 249
250 /* ADDED BY RAVI - 22-11-2005 - OMAPS00056702 FIX */ 250 /* ADDED BY RAVI - 22-11-2005 - OMAPS00056702 FIX */
251 #if (BOARD!=61) 251 #if (BOARD!=61)
252 /* JVJ #1705 MMI will be started here */ 252 /* JVJ #1705 MMI will be started here */
253 mmiInit(); 253 mmiInit();
254 return; 254 return;
255 #endif 255 #endif
256 /* END RAVI - 22-11-2005 */ 256 /* END RAVI - 22-11-2005 */
257 } 257 }
258 258
259 if (key != (char)0) 259 if (key != (char)0)
260 { 260 {
261 if ((key >= 48) && (key <=57)) 261 if ((key >= 48) && (key <=57))
262 { 262 {
263 key -= 47; 263 key -= 47;
264 } 264 }
265 else 265 else
266 { 266 {
267 switch(key) 267 switch(key)
268 { 268 {
269 case 35: 269 case 35:
270 key = (char)18; 270 key = (char)18;
271 break; 271 break;
272 272
273 case 42: 273 case 42:
274 key = (char)17; 274 key = (char)17;
275 break; 275 break;
276 276
277 case 45: 277 case 45:
278 key = (char)11; 278 key = (char)11;
279 break; 279 break;
280 280
281 case 67: 281 case 67:
282 key = (char)13; 282 key = (char)13;
283 break; 283 break;
284 284
285 case 69: 285 case 69:
286 key = (char)25; 286 key = (char)25;
287 break; 287 break;
288 288
289 case 86: 289 case 86:
290 key = (char)16; 290 key = (char)16;
291 break; 291 break;
292 292
293 case 94: 293 case 94:
294 key = (char)14; 294 key = (char)14;
295 break; 295 break;
296 296
297 case 97: 297 case 97:
298 key = (char)15; 298 key = (char)15;
299 break; 299 break;
300 300
301 case 98: 301 case 98:
302 key = (char)12; 302 key = (char)12;
303 break; 303 break;
304 304
305 default: 305 default:
306 key = (char)0; 306 key = (char)0;
307 break; 307 break;
308 } 308 }
309 } 309 }
310 310
311 kbd_putMakeAndKey( upDown, key); 311 kbd_putMakeAndKey( upDown, key);
312 } 312 }
313 313
314 if (!sig) return; /* no event handler */ 314 if (!sig) return; /* no event handler */
315 315
316 sig((char)(!upDown),0); 316 sig((char)(!upDown),0);
317 317
397 for (i = 0; i < NUM_KPD_KEYS; i++) 397 for (i = 0; i < NUM_KPD_KEYS; i++)
398 { 398 {
399 if (!strcmp(key,config_map[i])) 399 if (!strcmp(key,config_map[i]))
400 { 400 {
401 if (mode) 401 if (mode)
402 { 402 {
403 kbd_putMakeAndKey(0,i); /* assume key down event */ 403 kbd_putMakeAndKey(0,i); /* assume key down event */
404 sig(0,0); 404 sig(0,0);
405 } 405 }
406 else 406 else
407 { 407 {
408 kbd_putMakeAndKey(1,i); /* assume key up event */ 408 kbd_putMakeAndKey(1,i); /* assume key up event */
409 sig(0,0); 409 sig(0,0);
410 } 410 }
411 return; 411 return;
412 } 412 }
413 } 413 }
414 return; 414 return;
415 } 415 }
435 435
436 #endif 436 #endif
437 437
438 U16 signal_high; 438 U16 signal_high;
439 U16 signal_low; 439 U16 signal_low;
440 U8 key_code; 440 U8 key_code;
441 U8 key_state; 441 U8 key_state;
442 442
443 int nPresses; //Number of key presses still in the queue 443 int nPresses; //Number of key presses still in the queue
444 444
445 445
446 446
447 447
448 448
453 #else 453 #else
454 signal_high = (U16) (signal_params->UserData >> 16); 454 signal_high = (U16) (signal_params->UserData >> 16);
455 signal_low = (U16) (signal_params->UserData & 0xFFFF); 455 signal_low = (U16) (signal_params->UserData & 0xFFFF);
456 #endif 456 #endif
457 457
458 key_code = (U8) (signal_low & 0xFF); 458 key_code = (U8) (signal_low & 0xFF);
459 if (signal_high == 1) 459 if (signal_high == 1)
460 key_state = KEY_STAT_PRS; 460 key_state = KEY_STAT_PRS;
461 else 461 else
462 key_state = KEY_STAT_REL; 462 key_state = KEY_STAT_REL;
463 463
464 /*JVJ #1705 When the first POWER KEY event arrives, an event is sent to MMI */ 464 /*JVJ #1705 When the first POWER KEY event arrives, an event is sent to MMI */
465 /*to start it */ 465 /*to start it */
466 if ((!powered_on)&&(key_code==POWER_KEY)) 466 if ((!powered_on)&&(key_code==POWER_KEY))
467 { 467 {
468 sendKeyInd(key_code, key_state, 0); 468 sendKeyInd(key_code, key_state, 0);
469 return; 469 return;
470 } 470 }
471 471
472 472
473 //Add keypress to queue of key presses 473 //Add keypress to queue of key presses
474 nPresses = kbd_getNumElements(); 474 nPresses = kbd_getNumElements();
475 475
476 476
477 kbd_putMakeAndKey( (char)key_state, (char)key_code); 477 kbd_putMakeAndKey( (char)key_state, (char)key_code);
478 478
479 if ((!kbd_stillProcessingKeys()) && (nPresses == 0)) 479 if ((!kbd_stillProcessingKeys()) && (nPresses == 0))
480 { //Only this element present - create and send message. 480 { //Only this element present - create and send message.
481 sendKeyInd(key_code, key_state, 0); 481 sendKeyInd(key_code, key_state, 0);
482 482
483 } 483 }
484 484
485 } 485 }
486 486
487 /* 487 /*
488 +--------------------------------------------------------------------+ 488 +--------------------------------------------------------------------+
497 497
498 void keypad_cb (void* parameter) 498 void keypad_cb (void* parameter)
499 { 499 {
500 // NITIN 500 // NITIN
501 #ifndef NEPTUNE_BOARD 501 #ifndef NEPTUNE_BOARD
502 T_KPD_KEY_EVENT_MSG* event; 502 T_KPD_KEY_EVENT_MSG* event;
503 T_KPD_STATUS_MSG* status; 503 T_KPD_STATUS_MSG* status;
504 T_RV_CHECK* check; 504 T_RV_CHECK* check;
505 505
506 506
507 507
508 508
509 509
510 510
511 check = (T_RV_CHECK*)parameter; 511 check = (T_RV_CHECK*)parameter;
512 512
513 if (check->msg_id EQ KPD_STATUS_MSG) 513 if (check->msg_id EQ KPD_STATUS_MSG)
514 { 514 {
515 //status message is used 515 //status message is used
516 status = (T_KPD_STATUS_MSG*) parameter; 516 status = (T_KPD_STATUS_MSG*) parameter;
517 517
518 518
519 519
520 if (status->status_value EQ KPD_PROCESS_OK) 520 if (status->status_value EQ KPD_PROCESS_OK)
521 { 521 {
522 //ok 522 //ok
523 } 523 }
524 else 524 else
525 { 525 {
526 //failed ! 526 //failed !
527 return; 527 return;
528 } 528 }
529 } 529 }
530 else 530 else
531 { 531 {
532 int nPresses; //Number of key presses still in the queue 532 int nPresses; //Number of key presses still in the queue
533 //event message is used 533 //event message is used
534 event = (T_KPD_KEY_EVENT_MSG*) parameter; 534 event = (T_KPD_KEY_EVENT_MSG*) parameter;
535 535
536 536
537 //Add keypress to queue of key presses 537 //Add keypress to queue of key presses
538 nPresses = kbd_getNumElements(); 538 nPresses = kbd_getNumElements();
539 539
540 if (event->key_info.press_state EQ KPD_INSIGNIFICANT_VALUE) 540 if (event->key_info.press_state EQ KPD_INSIGNIFICANT_VALUE)
541 { 541 {
542 kbd_putMakeAndKey( (char)event->key_info.state, (char)event->key_info.virtual_key_id ); 542 kbd_putMakeAndKey( (char)event->key_info.state, (char)event->key_info.virtual_key_id );
543 } 543 }
544 else 544 else
545 { 545 {
546 546
547 //key_ind->key_stat (U8): 547 //key_ind->key_stat (U8):
548 // 00xx 0000 = KEY_PRESSED 548 // 00xx 0000 = KEY_PRESSED
549 // 00xx 0001 = KEY_RELEASED 549 // 00xx 0001 = KEY_RELEASED
550 // 0000 00xx = KPD_FIRST_PRESS 550 // 0000 00xx = KPD_FIRST_PRESS
551 // 0001 00xx = KPD_LONG_PRESS 551 // 0001 00xx = KPD_LONG_PRESS
552 // 0010 00xx = KPD_REPEAT_PRESS 552 // 0010 00xx = KPD_REPEAT_PRESS
553 // 553 //
554 // x = anystate 554 // x = anystate
555 // Sep 18, 2006 REF: OMAPS00094426 - x0039928 555 // Sep 18, 2006 REF: OMAPS00094426 - x0039928
556 // Fix : Store the virtual key info in the global variable kpd_key for later use 556 // Fix : Store the virtual key info in the global variable kpd_key for later use
557 #if (BOARD == 71) 557 #if (BOARD == 71)
558 kpd_key = (char)event->key_info.virtual_key_id; 558 kpd_key = (char)event->key_info.virtual_key_id;
559 #endif 559 #endif
560 kbd_putMakeAndKey( (char)(event->key_info.state | (event->key_info.press_state << 4)), 560 kbd_putMakeAndKey( (char)(event->key_info.state | (event->key_info.press_state << 4)),
561 (char)event->key_info.virtual_key_id ); 561 (char)event->key_info.virtual_key_id );
562 } 562 }
563 563
564 if ((!kbd_stillProcessingKeys()) && (nPresses == 0)) 564 if ((!kbd_stillProcessingKeys()) && (nPresses == 0))
565 565
566 { //Only this element present - create and send message. 566 { //Only this element present - create and send message.
567 567
568 568
569 569
570 sendKeyInd(event->key_info.virtual_key_id, event->key_info.state, event->key_info.press_state); 570 sendKeyInd(event->key_info.virtual_key_id, event->key_info.state, event->key_info.press_state);
571 571
572 } 572 }
573 573
574 } 574 }
575 #endif // NEPTUNE_BOARD 575 #endif // NEPTUNE_BOARD
576 return; 576 return;
577 577
578 } 578 }
579 579
580 580
581 /* 581 /*
625 notified_keys.notified_keys [14] = KPD_KEY_CONNECT; 625 notified_keys.notified_keys [14] = KPD_KEY_CONNECT;
626 notified_keys.notified_keys [15] = KPD_KEY_DISCONNECT; 626 notified_keys.notified_keys [15] = KPD_KEY_DISCONNECT;
627 notified_keys.notified_keys [16] = KPD_KEY_STAR; 627 notified_keys.notified_keys [16] = KPD_KEY_STAR;
628 notified_keys.notified_keys [17] = KPD_KEY_DIESE; 628 notified_keys.notified_keys [17] = KPD_KEY_DIESE;
629 629
630 if (KPD_NB_PHYSICAL_KEYS > 22) 630 if (KPD_NB_PHYSICAL_KEYS > 22)
631 { 631 {
632 notified_keys.notified_keys [18] = KPD_KEY_SOFT_LEFT; 632 notified_keys.notified_keys [18] = KPD_KEY_SOFT_LEFT;
633 notified_keys.notified_keys [19] = KPD_KEY_SOFT_RIGHT; 633 notified_keys.notified_keys [19] = KPD_KEY_SOFT_RIGHT;
634 notified_keys.notified_keys [20] = KPD_KEY_VOL_UP; 634 notified_keys.notified_keys [20] = KPD_KEY_VOL_UP;
635 notified_keys.notified_keys [21] = KPD_KEY_VOL_DOWN; 635 notified_keys.notified_keys [21] = KPD_KEY_VOL_DOWN;
636 notified_keys.notified_keys [22] = KPD_KEY_ENTER; 636 notified_keys.notified_keys [22] = KPD_KEY_ENTER;
637 //? #define KPD_KEY_RECORD (24) 637 //? #define KPD_KEY_RECORD (24)
638 } 638 }
639 639
640 #ifndef _SIMULATION_ 640 #ifndef _SIMULATION_
641 return_value = kpd_subscribe (&subscriber_p, mode, &notified_keys, return_path); 641 return_value = kpd_subscribe (&subscriber_p, mode, &notified_keys, return_path);
642 #else 642 #else
643 return_value = RV_OK; /* do some faking here, to get it compileable */ 643 return_value = RV_OK; /* do some faking here, to get it compileable */
688 +--------------------------------------------------------------------+ 688 +--------------------------------------------------------------------+
689 689
690 PURPOSE : Sends an MMI_KEYPAD_IND to the protocol stack 690 PURPOSE : Sends an MMI_KEYPAD_IND to the protocol stack
691 */ 691 */
692 void sendKeyInd( T_KPD_VIRTUAL_KEY_ID virtual_key_id, 692 void sendKeyInd( T_KPD_VIRTUAL_KEY_ID virtual_key_id,
693 T_KPD_KEY_STATE key_state, 693 T_KPD_KEY_STATE key_state,
694 T_KPD_PRESS_STATE press_state) 694 T_KPD_PRESS_STATE press_state)
695 { 695 {
696 #if defined (NEW_FRAME) 696 #if defined (NEW_FRAME)
697 EXTERN T_HANDLE hCommACI; 697 EXTERN T_HANDLE hCommACI;
698 698
699 699
700 700
701 701
702 // ULONG signal_raw; // RAVI 702 // ULONG signal_raw; // RAVI
703 #else 703 #else
704 EXTERN T_VSI_CHANDLE hCommACI; 704 EXTERN T_VSI_CHANDLE hCommACI;
705 #endif 705 #endif
706 706
707 PALLOC(key_ind,MMI_KEYPAD_IND); 707 PALLOC(key_ind,MMI_KEYPAD_IND);
708 708
709 key_ind->key_code = (U8)0; 709 key_ind->key_code = (U8)0;
710 710
711 key_ind->key_stat = 0; 711 key_ind->key_stat = 0;
712 712
713 #if defined (NEW_FRAME) 713 #if defined (NEW_FRAME)
714 PSENDX(ACI,key_ind); 714 PSENDX(ACI,key_ind);
715 #else 715 #else
716 #if defined (_TMS470) 716 #if defined (_TMS470)
717 vsi_c_send("",hCommACI,D2P(key_ind), 717 vsi_c_send("",hCommACI,D2P(key_ind),
718 sizeof(T_PRIM_HEADER)+sizeof(T_MMI_KEYPAD_IND)); 718 sizeof(T_PRIM_HEADER)+sizeof(T_MMI_KEYPAD_IND));
719 #else 719 #else
720 PSEND(ACI,key_ind); 720 PSEND(ACI,key_ind);
721 #endif 721 #endif
722 #endif 722 #endif
723 723
724 return; 724 return;
725 725
726 } 726 }
727 727
728 728
729 729
730 730
731 731
732 732
733 733