?? psgdrv.c
字號:
///////////////////////////////////////////////////////////////////////////////
//
// ROCKWELL SEMICONDUCTOR SYSTEMS - WIRELESS COMMUNICATIONS DIVISION
//
///////////////////////////////////////////////////////////////////////////////
//
//
// psgdrv.c - ps\psgdrv.c
//
//
// DESCRIPTION
//
// This code is designed to be 'Almost' portable code.
// It is a Hardware Driver and the majority of code in this module is
// executed in an interrupt routine and directly manipulates hardware
// registers of the target system. Thus, it is not guaranteed portable.
// However, it is intented to control a sequence of operations on a
// half duplex UART talking to a standardised ISO/IEC 7816-3 Smart Card,
// more specifically to a GSM SIM, as specified in GSM rec 11.11.
// Therefore, MOST implementations will follow the same basic sequence.
//
// To support this potential portablitity, all manipulation of the
// hardware registers is hidden behind the SYNTAX of C functions calls.
// However any real implementation, in particular for GOLD will
// IMPLEMENT these calls as MACROS which directly manipulate the hardware
// registers. This is avoid to much overhead at interrupt time.
//
//
// REVISION HISTORY (ORIGINAL AUTHOR: Fred King)
//
// $Log: W:\UC\PH2SW\Rockwell\BASE\Ps\rock\ARCHIVES\PSGDRV.C_v $
//
// Rev 3.44 11 Jan 2001 09:42:44 wanggc1
// Project: UC SCRs ( GSM )
// SCR 1601 - ARM 2.11a compiler option is added for SIM shut down process
//
// Rev 3.43 19 Dec 2000 15:38:30 wanggc1
// Project: UC SCRs ( GSM )
// SCR 1589 - Software workaround to fix SIM shut down problem
//
// Rev 3.42 Dec 12 2000 19:29:06 omahond
// Project: UC SCRs ( GSM )
// SCR 1574 - Data Module Failing SIM Test case 27.11.1.3 Inter-character delay
//
// Rev 3.41 Dec 04 2000 17:32:32 maungmt
// Project: UC SCRs ( GSM )
// SCR 1501 - CX805 Migration
// Typecast SIM_RXBUF_REG and SIM_TXBUF_REG to
// (void *)
//
// Rev 3.40 09 Nov 2000 10:24:42 omahond
// Project: UC SCRs ( GSM )
// SCR 1525 - Port DMA interface SIM driver (PS) for new platform library
//
// Rev 3.39 Oct 20 2000 15:08:18 chararn
// Project: UC SCRs ( GSM )
// SCR 1507 - GPIO changes for CX8xx ASIC
//
// Rev 3.38 Oct 13 2000 11:36:44 maungmt
// Project: UC SCRs ( GSM )
// SCR 1499 - Preparation for CX805 Migration
// Change the SIM register names consistent with CX805
// register naming convention.
//
// Rev 3.37 27 Sep 2000 15:35:20 hisamok
// Project: UC SCRs ( GSM )
// SCR 1487 - SIM clock does not always stop in the correct state
//
// Rev 3.36 25 May 2000 12:07:40 ordd
// Project: UC SCRs ( GSM )
// SCR 1382 - Improved handling for intermittent SIM card electrical contact faults
//
// Rev 3.35 08 May 2000 17:51:08 ordd
// Project: UC SCRs ( GSM )
// SCR 1382 - Improved handling for intermittent SIM card electrical contact faults
//
// Rev 3.34 08 May 2000 17:37:56 ordd
// Project: UC SCRs ( GSM )
// SCR 1382 - Improved handling for intermittent SIM card electrical contact faults
//
// Rev 3.33 08 May 2000 17:00:10 ordd
// Project: UC SCRs ( GSM )
// SCR 1380 - Defect SIM Condition NVM Logging Enhancements - Deactivate SIM debug
//
// Rev 3.32 25 Apr 2000 18:17:58 hisamok
// Project: UC SCRs ( GSM )
// SCR 1366 - Defect SIM Condition NVM Logging Enhancements
//
// Rev 3.31 22 Mar 2000 17:36:42 hisamok
// Project: UC SCRs ( GSM )
// SCR 1300 - Increasing the Work Waiting Time for SIM DMA read transfers.
//
// Rev 3.30 22 Mar 2000 15:41:32 hisamok
// Project: UC SCRs ( GSM )
// SCR 1299 - Failure to complete ATR with new D2 prepaid SIM resulting in Defect SIM.
//
//
// Rev 3.29 16 Mar 2000 18:02:32 hisamok
// Project: UC SCRs ( GSM )
// SCR 1278 - Phase 1 5v SIM Takes About 3 Minutes to Be Initialized at Startup
//
//
// Rev 3.28 08 Mar 2000 17:54:34 ordd
// Project: UC SCRs ( GSM )
// SCR 1255 - "Broken SIM' monitor and data logger
//
//
// Rev 3.27 06 Mar 2000 17:10:30 omahond
// Project: UC SCRs ( GSM )
// SCR 1250 - Switching to High Speed clock for SMS P-P download as per GSM 11.11
//
//
// Rev 3.26 22 Feb 2000 23:45:56 omahond
// Project: UC SCRs ( GSM )
// SCR 1214 - Broken SIM Occurs on D1 and D2 SIMs in the Field [24d]
//
//
// Rev 3.25 22 Feb 2000 18:44:28 omahond
// Project: UC SCRs ( GSM )
// SCR 1214 - Broken SIM Occurs on D1 and D2 SIMs in the Field [24d]
//
//
// Rev 3.24 01 Feb 2000 15:56:52 omahond
// Project: UC SCRs ( GSM )
// SCR 1163 - Lockup Instead of BROKEN SIM Msg.
//
//
// Rev 3.23 27 Oct 1999 15:28:06 omahond
// Project: UC SCRs ( GSM )
// SCR 1016 - Removal of GSMcprintf from SIM interrupt handler PSWaitProcByte()
//
//
// Rev 3.22 14 Oct 1999 15:33:26 omahond
// Project: UC SCRs ( GSM )
// SCR 947 - I2C Power On Lock Up
//
//
// Rev 3.21 19 Aug 1999 12:44:08 ogormabj
// Project: UC SCRs ( GSM )
// SCR 840 - Warning Eradication
//
//
// Rev 3.20 03 Aug 1999 17:17:06 omahond
// Project: UC SCRs ( GSM )
// SCR 736 - Fix for SIM test case 27.11.1.5
//
//
// Rev 3.19 20 Jul 1999 12:25:36 hisamok
// Project: UC SCRs ( GSM )
// SCR 736 - Fix for SIM test case 27.11.1.5
//
//
// Rev 3.18 19 Jul 1999 11:27:36 omahond
// Project: UC SCRs ( GSM )
// SCR 736 - Fix for SIM test case 27.11.1.5
//
//
// Rev 3.17 15 Jul 1999 14:41:28 omahond
// Project: UC SCRs ( GSM )
// SCR 736 - Fix for SIM test case 27.11.1.5
//
//
// Rev 3.15 27 May 1999 17:38:44 omahond
// Project: UC SCRs ( GSM )
// SCR 579 - SGH2300 SIM electrical FTA failures
//
//
// Rev 3.14 27 Apr 1999 01:47:54 aiouaza
// Project: UC SCRs ( GSM )
// SCR 592 - Build Warning cleanup
//
//
// Rev 3.13 09 Apr 1999 17:56:40 hisamok
// Project: UC SCRs ( GSM )
// SCR 571 - Basic Class 1 and Class 2 SIM Application Toolkit Protocol Stack Support
//
//
// Rev 3.12 10 Mar 1999 15:22:18 youngfw
// Project: UC SCRs ( GSM )
// SCR 33 - Ph2 : Port UKapi from Ph1
// make receive data count available to SI task
//
// Rev 3.11 09 Dec 1998 12:33:18 SHAHEEDM
// Project: UC SCRs ( GSM )
// SCR 335 - Setting SIM clock high helps pass SMS tests: 34.2.3 and 34.2.5.3
// Modified sim clock speed when performing a record update, to use the high speed clock. This apparently helps get the data line turned around faster in hardware, such that we don't miss the NAK byte.
//
// Rev 3.10 30 Oct 1998 15:11:02 ORDD
// Project: UC SCRs ( GSM )
// SCR 311 - FTA fixes and Rapid Application Update for Week 45
//
//
// Rev 3.9 16 Oct 1998 12:31:44 LIG
// Project: UC SCRs ( GSM )
// SCR 299 - PH2 - TA failure: SIM power on/off sequence.
//
//
// Rev 3.8 08 Oct 1998 16:06:32 LIG
// Project: UC SCRs ( GSM )
// SCR 263 - PH2 - Speed up SIM card recognition
//
//
// Rev 3.7 24 Sep 1998 15:31:08 dronetbb
// Project: UC SCRs ( GSM )
// SCR 163 - SEC accessories detection support for Phase 2
// Changed GPIO device handle references to new global data
// in HWInit.
//
// Rev 3.6 23 Sep 1998 16:03:22 LIG
// Project: UC SCRs ( GSM )
// SCR 197 - Phase 1 and inverted SIMs are not working on Samsung platform
//
//
// Rev 3.5 15 Sep 1998 17:14:42 LIG
// Project: UC SCRs ( GSM )
// SCR 215 - PH2 - Fixes at TA house (CETECOM)
//
//
// Rev 3.4 01 Sep 1998 12:14:38 LIG
// Project: UC SCRs ( GSM )
// SCR 194 - PH2 - Combination fixes of SCR 36, 45, 192, and 193
//
//
// Rev 3.3 27 Aug 1998 17:00:56 LIG
// Project: UC SCRs ( GSM )
// SCR 45 - PH2 - SIM Signal Sequence Control (982501)
//
//
// Rev 3.2 24 Aug 1998 10:20:28 LIG
// Project: UC SCRs ( GSM )
// SCR 181 - PH2 - SIM polling timer change from 30 seconds to 29 seconds
//
//
// Rev 3.1 29 Jul 1998 17:05:10 LIG
// Project: UC SCRs ( GSM )
// SCR 122 - Merge phase1 SIM driver enhancements to phase 2
//
//
// Rev 3.0 19 Jun 1998 11:02:46 dangmk
// Initial CheckIn
//
// Rev 1.17 28 Mar 1998 17:45:04 ramos
// Removed #ifdef (M46, ARM)
//
// Rev 1.16 19 Mar 1998 16:51:22 nicholjs
// Added explicit typecasting of CHAR to UINT8
//
// Rev 1.15 11 Mar 1998 17:12:06 vahdatm
// Updated to handle "Inverse Mode" SIM
//
// Rev 1.14 23 Dec 1997 15:44:24 lig
// Added missing brackets
//
// Rev 1.13 07 Nov 1997 17:11:46 quanp
// 1) Move SIMDMAIH function to psintrpt.c.
// 2) Move SIM_DMA_CONFIG_STRUCT typedef to ...\ps\psgdrv.h
// 3) Delete unused variables.
//
// Rev 1.12 06 Nov 1997 13:28:08 quanp
// (1) Fixed error handling of bad SIM status for DMA implementation.
// (2) Deleted unused variables GPIOValue & GPIONumBit.
//
// Rev 1.11 05 Nov 1997 17:34:50 quanp
// Enable SIM DMA for receiving Wait Status bytes.
//
// Rev 1.10 31 Oct 1997 15:58:10 quanp
// Add code to implement DMA for M46 SIM.
//
// Rev 1.9 10 Oct 1997 16:27:52 Nicholson
// Modified to support M46.
//
// Rev 1.8 23 Jul 1997 15:39:58 quanp
// Modify to support inverted mode for new SIM for ARM platform
//
// Rev 1.7 21 Jul 1997 17:49:04 quanp
// Added HW_SIM code for ARM
//
// Rev 1.6 18 Jul 1997 16:47:52 quanp
// Delete include of htimers.h
//
// Rev 1.5 18 Jul 1997 15:41:46 quanp
// Use TimerInterruptEnabled function in t:\sw2\htimers.c instead of local TimerInterruptEN function
//
// Rev 1.4 10 Jul 1997 21:04:48 shaheen
// ARM/L41 Port and Merge. Refer to Ravi's Change Summary Document
// for Details
//
// Rev 1.3 04 Jun 1997 10:58:12 quanp
// Skip SIM service routine if Timer A is running
//
// Rev 1.2 15 May 1997 08:43:10 hsuj
// (1) Added static variables GPIOValue and GPIONumBit
//
// Rev 1.1 12 Feb 1997 08:43:28 HSUJ
// Optimay changed checking of RxByte in
// PSInitChar()
//
// Rev 1.0 30 Oct 1996 20:48:16 hsuj
// new Optimay physical SIM files
//
//
///////////////////////////////////////////////////////////////////////////////
//
// ROCKWELL CONFIDENTIAL AND PROPRIETARY
//
// This source is the sole property of Rockwell International. Reproduction
// or utilization of this source in whole or in part is forbidden without
// the written consent of Rockwell International.
//
// (c) Copyright Rockwell International, 1996. All Rights Reserved.
//
///////////////////////////////////////////////////////////////////////////////
/*---------------------------- Includes: ---------------------------------*/
#include "wcdtypes.h"
#include "..\system\sysprim.h"
#include "..\system\secret.h" /* Allowed by fred 19/4/95 */
#include "..\global\target.h"
#include "..\global\types.h"
#include "..\global\gsmerror.h"
#include "..\global\txif.h"
#include "..\ps\pssi.h"
#include "..\global\useif.h"
#include "..\ps\psgdrv.h"
#include "pstrace.h"
#include "sitrace.h"
#include "..\si\siresp.h"
/*
** 18-MAY-1998, HMO tried to adapt old RSS changes to run with Phase 2 SW
*/
#include "..\system\regaddr.h"
#include "..\system\interrup.h"
#include "HDMA.h"
#include "..\system\system.h"
#include "..\hw\rock\hwinit.h"
#include "uhapi.h"
#include "devgpio.h"
#include "dsfunctions.h"
#include "..\system\rock\devgpiosystem.h"
#include "..\system\rock\sysaccs.h"
#include "iPMIC.h"
#include "..\system\rock\syslib.h"
#include "..\system\generic\systimer.h"
#include "pubparam.h"
#include "hpmic.h"
/*---------------------------- Local Defines: ----------------------------*/
//UINT16 PSCapability;
#ifndef PS_CLOCK_START_DELAY
#define PS_CLOCK_START_DELAY 0
#endif
/*---------------------------- Local Typedefs: ---------------------------*/
typedef enum
{
PSSel,
PSSeek,
PSVer,
PSChg,
PSDis,
PSEna,
PSRun,
PSRBin,
PSRRec,
PSGRes,
PSWBin,
PSWRec,
PSUnbl,
PSSlp,
PSSta,
PSInv,
PSReH,
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -