FreeCalypso > hg > fc-tourmaline
view src/gpf/frame/vsi_pro.c @ 78:c632896652ba
mfw/ti1_key.c: properly initialize notified_keys array
The code in this ti1_key.c layer needs to call kpd_subscribe() and
kpd_define_key_notification() functions in order to register with the
KPD driver. The original code passed KPD_NB_PHYSICAL_KEYS in
nb_notified_keys - this constant is defined to 24 in kpd_cfg.h on all
platforms of interest to us - but it only filled the first 23 slots
in the notified_keys array, resulting in stack garbage being passed
to KPD API functions. The fix consists of initializing the last
missed array slot to KPD_KEY_RECORD, the key ID for the right side
button on the D-Sample handset.
On our current hw targets this "Record" button exists as the EXTRA
button on our Luna keypad board and as the camera button on the
Pirelli DP-L10. There is no support whatsoever for this button
in current BMI+MFW, we have no plans of doing anything with Pirelli's
camera button even if we do get our UI fw running on that phone,
and the Mother's dream of building our own FreeCalypso handset with
the same button arrangement as D-Sample (including the right side
button) is currently very nebulous - but let us nonetheless handle
the full set of buttons on the KPD to MFW interface, and let upper
layers weed out unsupported buttons.
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 25 Oct 2020 23:41:01 +0000 |
parents | 4e78acac3d88 |
children |
line wrap: on
line source
/* +------------------------------------------------------------------------------ | File: vsi_pro.c +------------------------------------------------------------------------------ | Copyright 2002 Texas Instruments Berlin, AG | All rights reserved. | | This file is confidential and a trade secret of Texas | Instruments Berlin, AG | The receipt of or possession of this file does not convey | any rights to reproduce or disclose its contents or to | manufacture, use, or sell anything it may describe, in | whole, or in part, without the specific written consent of | Texas Instruments Berlin, AG. +----------------------------------------------------------------------------- | Purpose : This Module defines the virtual system interface part | about the processes +----------------------------------------------------------------------------- */ #ifndef __VSI_PRO_C__ #define __VSI_PRO_C__ #endif /*==== INCLUDES ===================================================*/ #include "string.h" #include "typedefs.h" #include "os.h" #include "vsi.h" #include "frm_defs.h" #include "frm_types.h" #include "frm_glob.h" #include "frame.h" #include "route.h" /*==== TYPES ======================================================*/ /*==== CONSTANTS ==================================================*/ /*==== EXTERNALS ==================================================*/ /* -------------- S H A R E D - BEGIN ---------------- */ #ifdef _TOOLS_ #pragma data_seg("FRAME_SHARED") #endif extern void pf_TaskEntry(T_HANDLE, ULONG); /*==== VARIABLES ==================================================*/ #ifdef _TOOLS_ #pragma data_seg() #endif /* -------------- S H A R E D - END ---------------- */ /*==== FUNCTIONS ==================================================*/ #ifndef RUN_INT_RAM /* +--------------------------------------------------------------------+ | PROJECT : GSM-Frame (8415) MODULE : VSI_PRO | | STATE : code ROUTINE : vsi_p_create | +--------------------------------------------------------------------+ PURPOSE : creates a process */ T_HANDLE vsi_p_create (T_HANDLE Caller, SHORT (*pei_create)(T_PEI_INFO const ** info), void (*TaskEntry)(T_HANDLE, ULONG), T_HANDLE MemPoolHandle ) { void (*EntryFunc)(T_HANDLE, ULONG); T_PEI_INFO const *Info; T_HANDLE TaskHandle; if ( pei_create ( &Info ) == PEI_OK ) { if ( TaskEntry == NULL ) EntryFunc = pf_TaskEntry; else EntryFunc = TaskEntry; if ( os_CreateTask (NO_TASK, (char*)Info->Name, EntryFunc, Info->StackSize, Info->Priority, &TaskHandle, MemPoolHandle) == OS_OK ) { pf_TaskTable[TaskHandle].Flags = Info->Flags; pf_TaskTable[TaskHandle].PeiTable = &Info->PeiTable; pf_TaskTable[TaskHandle].QueueEntries = Info->QueueEntries; pf_TaskTable[TaskHandle].NumOfTimers = Info->NumOfTimers; strncpy (pf_TaskTable[TaskHandle].Name, Info->Name, RESOURCE_NAMELEN); pf_TaskTable[TaskHandle].Name[RESOURCE_NAMELEN-1] = 0; pf_TaskTable[TaskHandle].TaskHandle = TaskHandle; pf_TaskTable[TaskHandle].MemPoolHandle = MemPoolHandle; return TaskHandle; } } return VSI_ERROR; } #endif #ifndef RUN_INT_RAM /* +--------------------------------------------------------------------+ | PROJECT : GSM-Frame (8415) MODULE : VSI_PRO | | STATE : code ROUTINE : vsi_p_exit | +--------------------------------------------------------------------+ PURPOSE : exits and deletes a process */ #undef VSI_CALLER #define VSI_CALLER Caller, #define VSI_CALLER_SINGLE Caller int vsi_p_exit (T_HANDLE Caller, T_HANDLE TaskHandle) { ULONG old_mask; T_PRIM_HEADER *prim; T_S_HEADER *s_hdr; ULONG size; char name[RESOURCE_NAMELEN]; size = S_ALLOC_SIZE(strlen(SYSPRIM_EXIT_TOKEN)); #ifdef MEMORY_SUPERVISION prim = (T_PRIM_HEADER*)vsi_c_new ( Caller, size, 0, __FILE__, __LINE__ ); #else prim = (T_PRIM_HEADER*)vsi_c_new ( Caller, size, 0 ); #endif prim->opc = SYS_MASK; prim->sh_offset = S_HDR_OFFSET(size - sizeof(T_S_HEADER)); prim->len = strlen(SYSPRIM_EXIT_TOKEN) + sizeof(T_PRIM_HEADER); s_hdr = (T_S_HEADER*)((ULONG*)prim + prim->sh_offset); s_hdr->snd[0] =(char)Caller; strcpy((char*)P2D(prim),SYSPRIM_EXIT_TOKEN); if (vsi_gettaskname(Caller,TaskHandle,name) < VSI_OK) { return VSI_ERROR; } /* switch off tracing for Caller */ vsi_gettracemask ( Caller, Caller, &old_mask); vsi_settracemask ( Caller, Caller, 0); PSEND(vsi_c_open(Caller,name),P2D(prim)); /* set tracing to old value for Caller */ vsi_settracemask ( Caller, Caller, old_mask); return VSI_OK; } #endif #ifndef RUN_INT_RAM /* +--------------------------------------------------------------------+ | PROJECT : GSM-Frame (8415) MODULE : VSI_PRO | | STATE : code ROUTINE : vsi_p_delete | +--------------------------------------------------------------------+ PURPOSE : deletes a process */ int vsi_p_delete (T_HANDLE Caller, T_HANDLE TaskHandle) { rt_RoutingModify ( TaskHandle, (char*)SYSPRIM_REDIRECT_TOKEN, (char*)SYSPRIM_CLEAR_TOKEN ); if ( os_DestroyQueue ( Caller, pf_TaskTable[TaskHandle].QueueHandle ) != OS_OK ) return VSI_ERROR; memset ( &pf_TaskTable[TaskHandle], 0, sizeof (T_FRM_TASK_TABLE_ENTRY) ); if ( os_DestroyTask ( Caller, TaskHandle ) != OS_OK ) return VSI_ERROR; return VSI_OK; } #endif #ifndef RUN_INT_RAM /* +--------------------------------------------------------------------+ | PROJECT : GSM-Frame (8415) MODULE : VSI_PRO | | STATE : code ROUTINE : vsi_p_start | +--------------------------------------------------------------------+ PURPOSE : starts a process */ int vsi_p_start (T_HANDLE Caller, T_HANDLE TaskHandle) { if ( os_StartTask ( Caller, TaskHandle, 0 ) == OS_OK ) return VSI_OK; else return VSI_ERROR; } #endif #ifndef RUN_INT_RAM /* +--------------------------------------------------------------------+ | PROJECT : GSM-Frame (8415) MODULE : VSI_PRO | | STATE : code ROUTINE : vsi_p_stop | +--------------------------------------------------------------------+ PURPOSE : stops a process */ int vsi_p_stop (T_HANDLE Caller, T_HANDLE TaskHandle) { if ( os_StopTask ( Caller, TaskHandle ) == OS_OK ) return VSI_OK; else return VSI_ERROR; } #endif #ifndef RUN_INT_RAM /* +--------------------------------------------------------------------+ | PROJECT : GSM-Frame (8415) MODULE : VSI_PRO | | STATE : code ROUTINE : vsi_p_name | +--------------------------------------------------------------------+ PURPOSE : reads the name of a task */ int vsi_p_name (T_HANDLE Caller, T_HANDLE Handle, char *Name) { if ( os_GetTaskName ( Caller, Handle, Name ) != OS_ERROR ) return VSI_OK; return VSI_ERROR; } #endif #ifndef RUN_INT_RAM /* +--------------------------------------------------------------------+ | PROJECT : GSM-Frame (8415) MODULE : VSI_PRO | | STATE : code ROUTINE : vsi_p_handle | +--------------------------------------------------------------------+ PURPOSE : reads the name of a task */ T_HANDLE vsi_p_handle (T_HANDLE Caller, char *Name) { OS_HANDLE Handle; if ( os_GetTaskHandle ( Caller, Name, &Handle ) != OS_ERROR ) return Handle; return VSI_ERROR; } #endif