⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 smi_csf.c

📁 是一个手机功能的模拟程序
💻 C
字号:
/* 
+----------------------------------------------------------------------------- 
|  Project :  GSM-F&D (8411)
|  Modul   :  SMI_CSF
+----------------------------------------------------------------------------- 
|  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 Modul defines the custom specific functionalitys
|             for the Slim Man Machine Interface.
+----------------------------------------------------------------------------- 
*/ 

#ifndef SMI_CSF_C
#define SMI_CSF_C
#endif

#define ENTITY_SMI

/*==== INCLUDES ===================================================*/
#include <string.h>
#include "typedefs.h"
#include "vsi.h"
#include "custom.h"
#include "gsm.h"
#include "prim.h"
#include "tok.h"
#include "message.h"

#include "aci_cmh.h"
#include "ksd.h"
#include "aca.h"
#include "smi.h"

#include "gdi.h"
#include "kbd.h"
#include "pwr.h"
#include "rx.h"

#include "cus_smi.h"

/*==== CONSTANTS ==================================================*/

/*==== TYPES ======================================================*/

/*==== EXPORT =====================================================*/

/*==== VARIABLES ==================================================*/
/*
 * simulation of EEPROM values.
 */
static UBYTE volTable[NUM_OF_VTS] = {
                                      75,  /* audio in   */
                                      175, /* audio out  */
                                      100, /* key beep   */
                                      100, /* dtmf tone  */
                                      100, /* ringer     */
                                    };

static USHORT aktLanguage = LNG_ENGLISH;

/*==== FUNCTIONS ==================================================*/
/*
+--------------------------------------------------------------------+
| PROJECT : GSM-F&D (8411)              MODULE  : SMI_CSF            |
| STATE   : code                        ROUTINE : smi_init_timer     |
+--------------------------------------------------------------------+

  PURPOSE : Initialize the timer.
*/
GLOBAL void smi_init_timer (void)
{
  TRACE_FUNCTION ("smi_init_timer()");

#if !defined (NEW_FRAME)
  t_backlight_handle = vsi_t_open (VSI_CALLER TBACKLIGHT);
  t_shiftkey_handle  = vsi_t_open (VSI_CALLER TSHIFTKEY);
  t_universal_handle = vsi_t_open (VSI_CALLER TUNIVERSAL);
  t_slider_handle    = vsi_t_open (VSI_CALLER TSLIDER);

#if defined WIN32
  {
    char buf[40];
    sprintf (buf, "Timer = %4x %4x %4x %4x",
             t_backlight_handle,
             t_shiftkey_handle,
             t_universal_handle,
             t_slider_handle);
    TRACE_FUNCTION (buf);
  }
#endif
#endif /* NEW_FRAME */

}

/*
+--------------------------------------------------------------------+
| PROJECT : GSM-F&D (8411)             MODULE  : SMI_CSF             |
| STATE   : code                       ROUTINE : smi_exit_timer      |
+--------------------------------------------------------------------+

  PURPOSE : Closes all timer.
*/
GLOBAL void smi_exit_timer (void)
{
  TRACE_FUNCTION ("smi_exit_timer()");

#if !defined (NEW_FRAME)
  vsi_t_close (VSI_CALLER t_backlight_handle);
  t_backlight_handle = VSI_ERROR;
  vsi_t_close (VSI_CALLER t_shiftkey_handle);
  t_shiftkey_handle  = VSI_ERROR;
  vsi_t_close (VSI_CALLER t_universal_handle);
  t_universal_handle = VSI_ERROR;
  vsi_t_close (VSI_CALLER t_slider_handle);
  t_slider_handle    = VSI_ERROR;
#endif
}

/*
+--------------------------------------------------------------------+
| PROJECT : GSM-PS (6147)         MODULE  : SMI_CSF                  |
| STATE   : code                  ROUTINE : csf_getVolume            |
+--------------------------------------------------------------------+

  PURPOSE : This function reads the volume value of the given volType
            out of the EEPROM area of the mobile.
*/
GLOBAL UBYTE csf_getVolume (T_volType volType)
{
  if (volType < NUM_OF_VTS AND volType >= 0)
    return (volTable[volType]);
  return 0;
}

/*
+--------------------------------------------------------------------+
| PROJECT : GSM-PS (6147)         MODULE  : SMI_CSF                  |
| STATE   : code                  ROUTINE : csf_setVolume            |
+--------------------------------------------------------------------+

  PURPOSE : This function writes the volume value of the given volType
            into the EEPROM area of the mobile.
*/
GLOBAL void csf_setVolume (T_volType volType, UBYTE volume)
{
  if (volType < NUM_OF_VTS AND volType >= 0)
    volTable[volType] = volume;
}

/*
+--------------------------------------------------------------------+
| PROJECT : GSM-PS (6147)         MODULE  : SMI_CSF                  |
| STATE   : code                  ROUTINE : csf_getLanguage          |
+--------------------------------------------------------------------+

  PURPOSE : This function gets the language id from the EEPROM area of
            the mobile.
*/
GLOBAL USHORT csf_getLanguage (void)
{
  return aktLanguage;
}

/*
+--------------------------------------------------------------------+
| PROJECT : GSM-PS (6147)         MODULE  : SMI_CSF                  |
| STATE   : code                  ROUTINE : csf_setLanguage          |
+--------------------------------------------------------------------+

  PURPOSE : This funciton sets the language id in the EEPROM area of 
            the mobile.
*/
GLOBAL void csf_setLanguage (USHORT lng)
{
  aktLanguage = lng;
}

/*
+--------------------------------------------------------------------+
| PROJECT : GSM-PS (6147)         MODULE  : SMI_CSF                  |
| STATE   : code                  ROUTINE : csf_getPanelInfo         |
+--------------------------------------------------------------------+

  PURPOSE : This funciotn requests the Screensize of the LCD and the 
            type of used keyboard.
*/

GLOBAL void csf_getPanelInfo (USHORT *LCD_DX,
                              USHORT *LCD_DY,
                              USHORT *KeyboardType)
{
  *LCD_DX = 16;
  *LCD_DY = 4;
  *KeyboardType = 1;
}

/*
+--------------------------------------------------------------------+
| PROJECT : GSM-PS (6147)         MODULE  : SMI_CSF                  |
| STATE   : code                  ROUTINE : kbd_callback             |
+--------------------------------------------------------------------+

  PURPOSE : This function is the callback of the keyboard driver.
  */

GLOBAL void kbd_callback (drv_SignalID_Type * signal_params)
{
  USHORT signal_high;
  USHORT signal_low;
  PALLOC (key_ind, MMI_KEYPAD_IND);

#if defined (NEW_FRAME)
  signal_high = (USHORT)(*((char*)signal_params->UserData)); 
  signal_low  = (USHORT)(*((char*)signal_params->UserData)+sizeof(USHORT));
#else
  signal_high = (USHORT)(signal_params->UserData >> 16); 
  signal_low  = (USHORT)(signal_params->UserData & 0xFFFF);
#endif

  key_ind->key_code      = (UBYTE)(signal_low & 0xFF);
  if (signal_high EQ 1)
    key_ind->key_stat      = KEY_STAT_PRS;
  else
    key_ind->key_stat      = KEY_STAT_REL;
#if defined NEW_FRAME
  PSEND(hCommACI, 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 /* NEW_FRAME */
}


/*
+--------------------------------------------------------------------+
| PROJECT : GSM-PS (6147)         MODULE  : SMI_CSF                  |
| STATE   : code                  ROUTINE : pwr_callback             |
+--------------------------------------------------------------------+

  PURPOSE : This function is the callback of the battery driver.
  */

GLOBAL void pwr_callback (drv_SignalID_Type * signal_params)
{
  pwr_Status_Type * para;
  PALLOC (battery_ind, MMI_BATTERY_IND);
  
  para = (pwr_Status_Type *)signal_params->UserData;
  battery_ind->volt = para->BatteryLevel;
#if defined NEW_FRAME
  PSEND(hCommACI, battery_ind);
#else
#if defined (_TMS470)
  vsi_c_send 
  (
    "",
    hCommACI,
    D2P(battery_ind),
    sizeof (T_PRIM_HEADER) + sizeof (T_MMI_BATTERY_IND)
  );
#else
  PSEND(ACI, battery_ind);
#endif
#endif /* NEW_FRAME */
}

/*
+--------------------------------------------------------------------+
| PROJECT : GSM-PS (6147)         MODULE  : SMI_CSF                  |
| STATE   : code                  ROUTINE : rx_callback              |
+--------------------------------------------------------------------+

  PURPOSE : This function is the callback of the fieldstrength driver.
  */

GLOBAL void rx_callback (drv_SignalID_Type * signal_params)
{
  rx_Status_Type * para;
  PALLOC (rxlevel_ind, MMI_RXLEV_IND);
  
  para = (rx_Status_Type *)signal_params->UserData;
  rxlevel_ind->rxlev = para->actLevel;
#if defined NEW_FRAME
  PSEND(hCommACI, rxlevel_ind);
#else
#if defined (_TMS470)
  vsi_c_send 
  (
    "",
    hCommACI,
    D2P(rxlevel_ind),
    sizeof (T_PRIM_HEADER) + sizeof (T_MMI_RXLEV_IND)
  );
#else
  PSEND(ACI, rxlevel_ind);
#endif
#endif /* NEW_FRAME */
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -