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

📄 pcm.h

📁 是一个手机功能的模拟程序
💻 H
📖 第 1 页 / 共 4 页
字号:
/*
+--------------------------------------------------------------------+
| PROJECT: GSM-MFW (?)                  $Workfile:: pcm.h           $|
| $Author: root $Revision: 1.1.1.1 $|
| CREATED: 07.10.98                     $Modtime:: 15.12.99 10:59   $|
| STATE  : code                                                      |
+--------------------------------------------------------------------+

	PURPOSE :  Types definitions for the permanent memory configuration
*/

#ifndef DEF_PCM
#define DEF_PCM

#ifndef TARGET
  #include "ffs.cfg"
#endif

#if (TARGET == 1)
  #include "general.h"
#else
  typedef unsigned char  UBYTE;
  typedef unsigned short USHORT;
#endif

#define LEN_MSCAP    (NR_EF_MSCAP    * SIZE_EF_MSCAP)    + 2
#define LEN_IMEI     (NR_EF_IMEI     * SIZE_EF_IMEI)     + 2
#define LEN_IMSI     (NR_EF_IMSI     * SIZE_EF_IMSI)     + 2
#define LEN_SMS      (NR_EF_SMS      * SIZE_EF_SMS)      + 2
#define LEN_CLASS2   (NR_EF_CLASS2   * SIZE_EF_CLASS2)   + 2
#define LEN_CLASS3   (NR_EF_CLASS3   * SIZE_EF_CLASS3)   + 2
#define LEN_MSSUP    (NR_EF_MSSUP    * SIZE_EF_MSSUP)    + 2
#define LEN_CLNG     (NR_EF_CLNG     * SIZE_EF_CLNG)     + 2
#define LEN_MSSET    (NR_EF_MSSET    * SIZE_EF_MSSET)    + 2
#define LEN_LDN      (NR_EF_LDN      * SIZE_EF_LDN)      + 2
#define LEN_LRN      (NR_EF_LRN      * SIZE_EF_LRN)      + 2
#define LEN_LMN      (NR_EF_LMN      * SIZE_EF_LMN)      + 2
#define LEN_UPN      (NR_EF_UPN      * SIZE_EF_UPN)      + 2
#define LEN_MBN      (NR_EF_MBN      * SIZE_EF_MBN)      + 2
#define LEN_VMN      (NR_EF_VMN      * SIZE_EF_VMN)      + 2
#define LEN_CTIM     (NR_EF_CTIM     * SIZE_EF_CTIM)     + 2
#define LEN_CCNT     (NR_EF_CCNT     * SIZE_EF_CCNT)     + 2
#define LEN_ECC      (NR_EF_ECC      * SIZE_EF_ECC)      + 2
#define LEN_ORG      (NR_EF_ORG      * SIZE_EF_ORG)      + 2
#define LEN_CCP      (NR_EF_CCP      * SIZE_EF_CCP)      + 2
#define LEN_EXT1     (NR_EF_EXT1     * SIZE_EF_EXT1)     + 2
#define LEN_SIMLCK   (NR_EF_SIMLCK   * SIZE_EF_SIMLCK)   + 2
#define LEN_MAIN     (NR_EF_MAIN     * SIZE_EF_MAIN)     + 2
#define LEN_SFK      (NR_EF_SFK      * SIZE_EF_SFK)      + 2
#define LEN_FAULT    (NR_EF_FAULT    * SIZE_EF_FAULT)    + 2
#define LEN_DEBUG    (NR_EF_DEBUG    * SIZE_EF_DEBUG)    + 2
#define LEN_POWER    (NR_EF_POWER    * SIZE_EF_POWER)    + 2
#define LEN_KEYB     (NR_EF_KEYB     * SIZE_EF_KEYB)     + 2
#define LEN_RADIO    (NR_EF_RADIO    * SIZE_EF_RADIO)    + 2
#define LEN_CGMI     (NR_EF_CGMI     * SIZE_EF_CGMI)     + 2
#define LEN_INF0     (NR_EF_INF0     * SIZE_EF_INF0)     + 2
#define LEN_CGMM     (NR_EF_CGMM     * SIZE_EF_CGMM)     + 2
#define LEN_CGMR     (NR_EF_CGMR     * SIZE_EF_CGMR)     + 2
#define LEN_CGSN     (NR_EF_CGSN     * SIZE_EF_CGSN)     + 2
#define LEN_SMSPRFL  (NR_EF_SMSPRFL  * SIZE_EF_SMSPRFL)  + 2
#define LEN_PLMN     (NR_EF_PLMN     * SIZE_EF_PLMN)     + 2
#define LEN_BCCHINFO (NR_EF_BCCHINFO * SIZE_EF_BCCHINFO) + 2
#define LEN_ALS      (NR_EF_ALS      * SIZE_EF_ALS)      + 2
#define LEN_LOCGPRS  (NR_EF_LOCGPRS  * SIZE_EF_LOCGPRS)  + 2
#define LEN_KCGPRS   (NR_EF_KCGPRS   * SIZE_EF_KCGPRS)   + 2
#define LEN_IMSIGPRS (NR_EF_IMSIGPRS * SIZE_EF_IMSIGPRS) + 2

#define PCM_SIZE (LEN_MSCAP    + LEN_IMEI   + LEN_IMSI    + LEN_SMS    + \
                  LEN_CLASS2   + LEN_CLASS3 + LEN_MSSUP   + LEN_CLNG   + \
                  LEN_MSSET    + LEN_LDN    + LEN_LRN     + LEN_LMN    + \
                  LEN_UPN      + LEN_MBN    + LEN_VMN     + LEN_CTIM   + \
                  LEN_CCNT     + LEN_ECC    + LEN_ORG     + LEN_CCP    + \
                  LEN_EXT1     + LEN_SIMLCK + LEN_MAIN    + LEN_SFK    + \
                  LEN_FAULT    + LEN_DEBUG  + LEN_POWER   + LEN_KEYB   + \
                  LEN_RADIO    + LEN_CGMI   + LEN_INF0    + LEN_CGMM   + \
                  LEN_CGMR     + LEN_CGSN   + LEN_SMSPRFL + LEN_PLMN   + \
                  LEN_BCCHINFO + LEN_ALS    + LEN_LOCGPRS + LEN_KCGPRS + \
                  LEN_IMSIGPRS)
                  
/********************************************************************
 *
 * Parameters written in flash memory
 *
 ********************************************************************/

#define PCM_SERIAL_CONFIG (0)

/********************************************************************
 *
 * Access functions to bit fields
 *
 ********************************************************************/

#define EXTERN extern 

#ifndef __BF_FUNCCALL__
  #define FldGet(f,n) ((((ULONG)f)&((ULONG)n##m))>>n##s)
  #define FldSet(f,n,v) ((((ULONG)f)&(~((ULONG)n##m)))|(((ULONG)v)<<n##s))
#else
  ULONG FldGet (ULONG f, ULONG m, int s)
  { return ((f&m)>>s); }
  ULONG FldSet (ULONG f, ULONG m, int s, ULONG v)
  { return ((f&(~m))|((v<<s)&m)); }
#endif

/********************************************************************
 *
 * Field Identitifer
 *
 ********************************************************************/

#define EF_MSCAP_ID     "MSCAP"       /* Mobile Capabilities        */
#define EF_IMEI_ID      "IMEI"        /* Int. Mobile Equipment Id.  */
#define EF_IMSI_ID      "IMSI"        /* Int. Mobile Subscriber Id. */
#define EF_SMS_ID       "SMS"         /* Short Message Service      */
#define EF_CLASS2_ID    "CLASS2"      /* MS Classmark 2             */
#define EF_CLASS3_ID    "CLASS3"      /* MS Classmark 3             */
#define EF_MSSUP_ID     "MSSUP"       /* Mobile Setup               */
#define EF_CLNG_ID      "CLNG"        /* Current Language           */
#define EF_MSSET_ID     "MSSET"       /* MS Settings                */
#define EF_LDN_ID       "LDN"         /* Last MOC Numbers           */
#define EF_LRN_ID       "LRN"         /* Last MTC Numbers           */
#define EF_LMN_ID       "LMN"         /* Last MTC Missed Numbers    */
#define EF_UPN_ID       "UPN"         /* User Personal Numbers      */
#define EF_MBN_ID       "MBN"         /* Mailbox Numbers            */
#define EF_VMN_ID       "VMN"         /* Voice Mail Number          */
#define EF_CTIM_ID      "CTIM"        /* Call Timer                 */
#define EF_CCNT_ID      "CCNT"        /* Call Counter               */
#define EF_ECC_ID       "ECC"         /* Emergency Call Codes       */
#define EF_ORG_ID       "ORG"         /* Organizer and Alarm        */
#define EF_CCP_ID       "CCP"         /* Cap and Config Params      */
#define EF_EXT1_ID      "EXT1"        /* Extension 1                */
#define EF_SIMLCK_ID    "SIMLCK"      /* SIM Lock                   */
#define EF_SIMLCKEXT_ID "SIMLCKEXT"   /* Extended SIM Lock          */
#define EF_MAIN_ID      "MAIN"        /* Maintenance Information    */
#define EF_SFK_ID       "SFK"         /* Special Function Keys      */
#define EF_FAULT_ID     "FAULT"       /* Fault Conditions           */
#define EF_DEBUG_ID     "DEBUG"       /* Debug Information          */
#define EF_POWER_ID     "POWER"       /* Power Management           */
#define EF_KEYB_ID      "KEYB"        /* Keyboard Mapping           */
#define EF_RADIO_ID     "RADIO"       /* Radio Parameters           */
#define EF_CGMI_ID      "CGMI"        /* Manufacturer               */
#define EF_INF0_ID      "INF0"        /* Identification Information */
#define EF_CGMM_ID      "CGMM"        /* Model                      */
#define EF_CGMR_ID      "CGMR"        /* Revision                   */
#define EF_CGSN_ID      "CGSN"        /* Product Serial Number      */
#define EF_SMSPRFL_ID   "SMSPRFL"     /* SMS Profile                */
#define EF_PLMN_ID      "PLMN"        /* PLMN Identifier            */
#define EF_BCCHINFO_ID  "BCCHINF"     /* BCCH Information           */
#define EF_ALS_ID       "ALS"         /* Alternative Line Service   */
#define EF_LOCGPRS_ID   "LOCGPRS"     /* Location Info. (GPRS)      */
#define EF_KCGPRS_ID    "KCGPRS"      /* Ciphering Key (GPRS)       */
#define EF_IMSIGPRS_ID  "IMSIGPRS"    /* IMSI (GPRS)                */

/********************************************************************
 *
 * Return Values
 *
 ********************************************************************/

#define drv_Return_Type      UBYTE
#define PCM_OK               0
#define PCM_INITIALIZED      1
#define PCM_INVALID_FILE     2
#define PCM_INVALID_SIZE     3
#define PCM_INVALID_CKSM     4
#define PCM_INVALID_RECORD   5
#define PCM_NVRAM_ACCS_FAIL  6
#define PCM_ERASE_ERROR	     7
#define PCM_WRITE_ERROR	     8

/*
 * Field Info Structure
 */
typedef struct pcm_FileInfo_Type
{
  UBYTE  *FileLocation;
  USHORT FileSize;
  UBYTE  Version;
} pcm_FileInfo_Type;

typedef struct
{
    char   *identifier;
    USHORT start;
    USHORT length;
    USHORT records;
} T_PCM_DESCRIPTION;


/********************************************************************
 *
 * Field MOBILE CAPABILITIES - MSCAP
 *
 ********************************************************************/

typedef struct pcm_EFmscap_Type
{
    UBYTE chnMode;  /* channel modes     */
    UBYTE datCap1;  /* data capabilities */
    UBYTE datCap2;  /* data capabilities */
    UBYTE featLst1; /* feature list      */
    UBYTE featLst2; /* feature list      */
    UBYTE featLst3; /* feature list      */
} EF_MSCAP;
                            
#define SIZE_EF_MSCAP 6            
#define NR_EF_MSCAP   1            

/*
 * chnMode bits             
 *   _______________________________________________________
 *  |8     |7     |6     |5     |4     |3     |2     |1     |
 *  |------|------|------|------|------|------|------|------|
 *  |L1    |Tm    |afs   |ahs   |spV3  |efrV2 |hr    |spV1  |
 *   -------------------------------------------------------
 */
#define spchSupV1   0x00000001,0        /* speech support (vers. 1) */
#define spchSupV1m  0x00000001
#define spchSupV1s  0
#define hrSup       0x00000002,1        /* HR support               */
#define hrSupm      0x00000002
#define hrSups      1
#define HR_EFRSup   0x00000006,1        /* HR and EFR support       */
#define HR_EFRSupm  0x00000006
#define HR_EFRSups  1
#define EFRSupV2    0x00000004,2        /* enhanced FR support (v2) */
#define EFRSupV2m   0x00000004
#define EFRSupV2s   2
#define EFRSupV3    0x00000008,3        /* speech support (vers 3)  */
#define EFRSupV3m   0x00000008
#define EFRSupV3s   3
#define VocSup      0x0000000F,0        /* vocoder support          */
#define VocSupm     0x0000000F
#define VocSups     0
#define AHS         0x00000010,4        /* adaptive multirate half rate speech */
#define AHSm        0x00000010
#define AHSs        4
#define AFS         0x00000020,5        /* adaptive multirate full rate speech */
#define AFSm        0x00000020
#define AFSs        5
#define TestMobile  0x00000040,6        /* Test Mobile              */
#define TestMobilem 0x00000040
#define TestMobiles 6
#define L1Ver       0x00000080,7        /* Layer 1 Version          */
#define L1Verm      0x00000080
#define L1Vers      7
 
/* 
 * datCap1 bits
 *   _______________________________________________________
 *  |8     |7     |6     |5     |4     |3     |2     |1     |
 *  |------|------|------|------|------|------|------|------|
 *  |14.4  |tfax  |ntfax |tsyn  |syn   |asyn  |rlp   |ds    |
 *   -------------------------------------------------------
 */
#define datSup      0x00000001,0        /* Data support             */
#define datSupm     0x00000001
#define datSups     0
#define RLPSup      0x00000002,1        /* RLP data (NT Async)      */
#define RLPSupm     0x00000002
#define RLPSups     1
#define AsySup      0x00000004,2        /* T Async data support     */
#define AsySupm     0x00000004
#define AsySups     2
#define NTSynSup    0x00000008,3        /* NT Sync data support     */
#define NTSynSupm   0x00000008
#define NTSynSups   3
#define TSynSup     0x00000010,4        /* T Sync data support      */
#define TSynSupm    0x00000010
#define TSynSups    4
#define NTFaxSup    0x00000020,5        /* NT Fax support           */
#define NTFaxSupm   0x00000020
#define NTFaxSups   5
#define TFaxSup     0x00000040,6        /* T Fax support            */
#define TFaxSupm    0x00000040
#define TFaxSups    6
#define Dr14_4Sup   0x00000080,7        /* Data rate 14.4 support   */
#define Dr14_4Supm  0x00000080
#define Dr14_4Sups  7

/* 
 * datCap2 bits
 *   _______________________________________________________
 *  |8     |7     |6     |5     |4     |3     |2     |1     |
 *  |------|------|------|------|------|------|------|------|
 *  |DHR   |      |      |NAS   |TPD   |NTPD  |TP    |NTP   |
 *   -------------------------------------------------------
 */
#define NTPackSup   0x00000001,0        /* NT Packet Service        */
#define NTPackSupm  0x00000001
#define NTPackSups  0
#define TPackSup    0x00000002,1        /* T Packet Service         */
#define TPackSupm   0x00000002
#define TPackSups   1
#define NTPadSup    0x00000004,2        /* NT PAD Access Service    */
#define NTPadSupm   0x00000004
#define NTPadSups   2
#define TPadSup     0x00000008,3        /* T PAD Access Service     */
#define TPadSupm    0x00000008
#define TPadSups    3
#define NAltSrvSup  0x00000010,4        /* No Alternate Services    */
#define NAltSrvSupm 0x00000010
#define NAltSrvSups 4
#define DHRSup      0x00000080,7        /* Data Halfrate support    */
#define DHRSupm     0x00000080
#define DHRSups     7


/********************************************************************
 *
 * Field INTERNATIONAL MOBILE EQUIPMENT ID - IMEI
 *
 ********************************************************************/

typedef struct pcm_EFimei_Type
{
    UBYTE tac1;
    UBYTE tac2;
    UBYTE tac3;
    UBYTE fac;
    UBYTE snr1;
    UBYTE snr2;
    UBYTE snr3; 
    UBYTE svn;
} EF_IMEI;

#define SIZE_EF_IMEI 8
#define NR_EF_IMEI   1


/********************************************************************
 *
 * Field INTERNATIONAL MOBILE SUBSCRIBER ID - IMSI
 *
 ********************************************************************/

typedef struct pcm_EFimsi_Type
{
    UBYTE len;	   /* length IMSI */
    UBYTE IMSI[8]; /* IMSI        */
} EF_IMSI;

#define SIZE_EF_IMSI 9
#define NR_EF_IMSI   1


/********************************************************************
 *
 * Field SHORT MESSAGE SERVICE - SMS
 *
 ********************************************************************/

typedef struct pcm_EFsms_Type
{
    UBYTE stat;     /* status    */
    UBYTE rmd[175]; /* remainder */
} EF_SMS;  

#define SIZE_EF_SMS 176
#define NR_EF_SMS     1

/* 
 * stat bits
 *   _______________________________________________________
 *  |8     |7     |6     |5     |4     |3     |2     |1     |
 *  |------|------|------|------|------|------|------|------|
 *  |reserved                          |status              |
 *   -------------------------------------------------------
 */


/********************************************************************
 *
 * Field MOBILE STATION CLASSMARK 2 - CLASS2
 *
 ********************************************************************/

typedef struct pcm_EFclass2_Type
{
    UBYTE byte1; /* class2 byte 1 */
    UBYTE byte2; /* class2 byte 2 */
    UBYTE byte3; /* class2 byte 3 */
} EF_CLASS2; 
          
#define SIZE_EF_CLASS2 3
#define NR_EF_CLASS2   1

/* 
 * byte1 bits                        
 *   _______________________________________________________
 *  |8     |7     |6     |5     |4     |3     |2     |1     |
 *  |------|------|------|------|------|------|------|------|
 *  |-     |rev          |es    |a5/1  |rfpwr               |
 *   -------------------------------------------------------
 */
#define rfPwrCap    0x00000007,0        /* rf power capability          */
#define rfPwrCapm   0x00000007
#define rfPwrCaps   0
#define a51         0x00000008,3        /* rf power capability          */
#define a51m        0x00000008
#define a51s        3
#define esInd       0x00000010,4        /* ES indicator                 */

⌨️ 快捷键说明

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