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

📄 psgdrv.h

📁 SIM卡的驱动程序,有利于开发一些与SIM相通的一些工具,或者手机软件SIM驱动的开发
💻 H
字号:
///////////////////////////////////////////////////////////////////////////////
//
//   CONEXANT SYSTEMS, INC. - WIRELESS COMMUNICATIONS DIVISION
//
///////////////////////////////////////////////////////////////////////////////
//
//   DESCRIPTION:
//
//   REVISION HISTORY 
//
//  $Log:   W:\UC\Ph2Sw\Rockwell\base\Ps\generic\archives\PSGDRV.H_v  $ dmk_opt
//   
//      Rev 1.0   01 Sep 2000 15:58:44   dangmk
//    
//   
///////////////////////////////////////////////////////////////////////////////
//
//   CONEXANT CONFIDENTIAL AND PROPRIETARY
//
//   This source is the sole property of Conexant.  Reproduction or
//   utilization of this source in whole or in part is forbidden without
//   the written consent of Conexant.
//
//   (c) Copyright Conexant, 2000.  All Rights Reserved.
//
///////////////////////////////////////////////////////////////////////////////
  

/*---------------------------- Global Defines: ---------------------------*/

#define PSChangeIdletoTX()    CCPAR0 |= CCENA; \
                              CCPAR1 |= (CCI_OK_ENA|CCI_BAD_ENA); \
                              SIMChangePar()

#define PSChangeTXtoRX()      CCPAR0 &= ~CCTXMD; \
                              CCPAR0 |= CCRXMD; \
                              SIMChangePar()

/* -----------------------------------------------------------------------
  According to a Siemens Application note from 8.3.94 this is too slow to
  meet GSM recommendations.  I hope it is fast enough for pratical purposes
  The alternative goes:
  CCPAR0 &= ~(CCTXMD|CCENA);
  waitloop 60Secs
  CCPAR0 |= CCRXMD|CCENA;
  I can't see any other possibility than a wait loop for the necessary delay.
  -------------------------------------------------------------------------*/

#define PSChangeRXtoTX()      CCPAR0 &= ~CCRXMD; \
                              SIMChangePar()

#define PSChangeRXtoIdle()    CCPAR0 &= ~(CCENA|CCRXMD); \
                              CCPAR1 &= ~(CCI_OK_ENA|CCI_BAD_ENA); \
                              SIMChangePar()

#define PSChangeIdleToDeact() CCPAR0 &= ~(CCRST|CCSCON); \
                              CCPAR0 |= CCCLK; \
                              CCPAR0 &= ~CCVPP; \
                              SIMChangePar()

/* -----------------------------------------------------------------------
  According to ISO/IEC 3816-3 following Deactivation of VPP, I/0 should be
  set to 0, and then VCC deactivated.  AS Gold does not allow us to control
  VCC, it is better to leave the I/0 pin floating.
  -------------------------------------------------------------------------*/

#define PSChangeToNull() CCPAR2 = CCEDTX; \
                         CCPAR1 = CCIOF; \
                         CCPAR0 &= ~(CCENA|CCSCON|CCTXMD|CCRXMD|CCBDRT|CCRST); \
                         CCPAR0 |= CCCLK; \
                         CCPAR0 &= ~CCVPP; \
                         SIMChangePar()

/* According to ISO/IEC 3816-3 following Deactivation of VPP, I/0 should be
   set to 0, and then VCC deactivated.  AS Gold does not allow us to control
   VCC, it is better to leave the I/0 pin floating.  */

#define PSChangeDeactToRX() CCPAR1 |= (CCIOF|CCI_OK_ENA|CCI_BAD_ENA|CCI_IO_ENA|CCREPT); \
                            CCPAR0 |= (CCVPP|CCENA|CCRXMD); \
                            CCPAR0 &= ~CCCLK; \
                            SIMChangePar()

#define PSSetResetHigh() CCPAR0 |= (CCRST|CCRXMD|CCENA); \
                         CCPAR1 |= (CCI_OK_ENA|CCI_BAD_ENA); \
                         SIMChangePar()

#define PSSetInverse()   CCPAR0 |= CCSCON; \
                         CCPAR1 &= ~CCREPT; \
                         SIMChangePar()

#define PSSetDirect()    CCPAR0 &= ~CCSCON; \
                         CCPAR1 &= ~CCREPT; \
                         SIMChangePar()

#define PSEnableClock()  CCPAR0 &= ~CCCLK; \
                         SIMChangePar()

#define PSDisableClockLow() CCPAR0 |= CCCLK; \
                            SIMChangePar()

#define PSSend(x)        CCTBR = x; \
                         CCPAR0 |= CCTXMD; \
                         SIMWriteToSIM(); SIMChangePar()

#define PSGet()          CCRBR; CCRBR = 0

#define PSSIMPresent()   (CCINT &= CCSTAT)

#define PSGetStatus()    CCINT; CCINT &= CCSTAT


#define PSDisSIMInts()
#define PSEnaSIMInts()

/*--- CCPAR0 ---*/
#define CCENA            0x01
#define CCSCON           0x02
#define CCTXMD           0x04
#define CCRXMD           0x08
#define CCBDRT           0x10
#define CCVPP            0x20
#define CCRST            0x40
#define CCCLK            0x80

/*--- CCPAR1 ---*/
#define CCREPT           0x01
#define CCEDET           0x02
#define CCIOF            0x04

#define CCI_IO_ENA       0x20
#define CCI_BAD_ENA      0x40
#define CCI_OK_ENA       0x80

/*--- CCPAR2 ---*/
#define CCEDTX           0x01

/*--- CCINT ---*/
#define CCI_IO           0x01
#define CCI_BAD          0x02
#define CCI_OK           0x04
#define CCSTAT           0x08

#define PS_RESET_LO_TIMEOUT         50
#define PS_RESET_HI_TIMEOUT         50
#define PS_TRANSFER_ALLOWED_RETRIES  3
#define PS_RESET_ALLOWED_RETRIES     5
#define PS_WORK_WAIT_FACTOR         20

/*---------------------------- Global Typedefs: --------------------------*/


/*--------------------------- Global Variables: --------------------------*/

extern UINT8 CCPAR0;
extern UINT8 CCPAR1;
extern UINT8 CCPAR2;
extern UINT8 CCRBR;
extern UINT8 CCTBR;
extern UINT8 CCINT;

/*---------------------- Global Function Prototypes: ---------------------*/

extern void SimIH(void);

extern void SIMWriteToSIM(void);
extern void SIMChangePar(void);

/*------------------------------------------------------------------------*/

⌨️ 快捷键说明

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