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

📄 xllp_usim.h

📁 优龙pxa270平台试验程序
💻 H
字号:
/******************************************************************************
**
**  COPYRIGHT (C) 2001, 2002 Intel Corporation.
**
**  This software as well as the software described in it is furnished under
**  license and may only be used or copied in accordance with the terms of the
**  license. The information in this file is furnished for informational use
**  only, is subject to change without notice, and should not be construed as
**  a commitment by Intel Corporation. Intel Corporation assumes no
**  responsibility or liability for any errors or inaccuracies that may appear
**  in this document or any software that may be provided in association with
**  this document. 
**  Except as permitted by such license, no part of this document may be 
**  reproduced, stored in a retrieval system, or transmitted in any form or by
**  any means without the express written consent of Intel Corporation. 
**
**  FILENAME:       xllp_usim.h
**
**  PURPOSE: contains all USIM specific macros, typedefs, and prototypes.
**           Declares no storage.
**                  
**
******************************************************************************/

#ifndef __USIM_H__
#define __USIM_H__

#include "xllp_defs.h"
#include "xllp_gpio.h"
#include "xllp_clkmgr.h"


/**
  XLLP USIM ENUMS
**/

#define XLLP_USIM_DEVICE 0x33300000		// A made-up code that identifies USIM. This code can change


typedef enum 
{
	XLLP_USIM_OK = 0,
	XLLP_USIM_PARITY_ERROR =			XLLP_USIM_DEVICE | 1,
	XLLP_USIM_CHAR_NOT_RECEIVED_YET =		XLLP_USIM_DEVICE | 2,
	XLLP_USIM_ATR_FAILURE =			XLLP_USIM_DEVICE | 3,
	XLLP_USIM_ATR_NOT_CORRECT =		XLLP_USIM_DEVICE | 4

} XLLP_USIM_STATUS_T;


typedef enum 
{
	Disable = 0,
    Enable = 1
} XLLP_USIM_Mode_T;

typedef enum 
{
	XLLP_USIM_CardVoltage0_0 = 0,
	XLLP_USIM_CardVoltage3_0 = 1,
	XLLP_USIM_CardVoltage1_8 = 2
} Xllp_Usim_Card_Voltage_T;

typedef enum 
{
	XLLP_USIM_Clear_Receive_Fifo  = 1,
	XLLP_USIM_Clear_Transmit_Fifo = 2,
	XLLP_USIM_Clear_Fifos = 3
} Xllp_Usim_Clear_Fifo_T;

typedef enum 
{
	XLLP_USIM_Asynchronous  = 0,
	XLLP_USIM_Synchronous = 1
} Xllp_Usim_SyncMode_T;

typedef enum 
{
	XLLP_USIM_TriggerLevel_1_Error  = 0,
	XLLP_USIM_TriggerLevel_2_Errors = 1,
	XLLP_USIM_TriggerLevel_3_Errors = 2,
	XLLP_USIM_TriggerLevel_4_Errors = 3
} Xllp_Usim_TriggerLevel_T;

typedef enum 
{
	XLLP_USIM_ReceiverT0_TransmitterT0 = 0,	/* Byte transmission both directions */
	XLLP_USIM_ReceiverT0_TransmitterT1 = 1,	/* Byte transmission for Receiver, Block transmission for transmitter */
	XLLP_USIM_ReceiverT1_TransmitterT0 = 2, /* Block transmission for Receiver, Byte transmission for transmitter */
	XLLP_USIM_ReceiverT1_TransmitterT1 = 3  /* Block tranmission both directions */
} Xllp_Usim_Protocol_T;


typedef enum 
{
	XLLP_USIM_Odd_Parity = 0,
	XLLP_USIM_Even_Parity = 1
} Xllp_Usim_ParitySelect_T;

typedef enum 
{
	XLLP_USIM_DirectConvention = 0,
	XLLP_USIM_InverseConvention = 1
} Xllp_Usim_Convention_T;

// PTS structure: Protocol Type selection
typedef struct PtsS
{
	XLLP_INT8_T PTSS;							// Initial Chracter: always 0xFF
	XLLP_INT8_T PTSO;							// Format character
	XLLP_INT8_T PTS[4];							// Optional chracters
	XLLP_INT8_T OptionalCharactersLength;		// 0-3
	XLLP_INT8_T PCK;							// Check character
} PtsT;

// PTSO: PTS formatCharacter:
#define XLLP_USIM_PTS_ProtocolType	0x0F
#define XLLP_USIM_PTS_BitMap		0x70


// T=0 Command Header
// PTS structure: Protocol Type selection
typedef struct T0CommandHeaderS
{
	XLLP_INT8_T InstructionClass;		// Value NEVER equals to 0xFF since this is reserved for PTS
	XLLP_INT8_T InstructionCode;		// (e.g. read memory
	XLLP_INT8_T Parameter1;				// Instruction code qualifier (e.g. Memory address)
	XLLP_INT8_T Parameter2;				// Additional instruction code qualifier
	XLLP_INT8_T DataBlockLength;		// 0-255. 0 means 256 bytes!
} T0CommandHeaderST;


/* XLLP USIM Primitive Functions */
void XllpUsimActivateCard(void *, Xllp_Usim_Card_Voltage_T);
void XllpUsimResetCard(void *);
void XllpUsimDeactivateCard(void *);
void XllpUsimSetBaudRate(void *, XLLP_INT32_T, XLLP_INT32_T, XLLP_INT32_T);
void XllpUsimWaitUclkCycles(XLLP_INT32_T);
void XllpUsimSetBaudRate(void *XllpUsimBase, XLLP_INT32_T, XLLP_INT32_T, XLLP_INT32_T);
XLLP_USIM_STATUS_T XllpUsimReceiveCharacter(void *, XLLP_INT32_T*);
XLLP_USIM_STATUS_T XllpUsimReceiveCharacterWait(void *, XLLP_INT8_T* , XLLP_INT32_T);
void XllpUsimSendCharacter(void *, XLLP_UINT8_T);
void XllpUsimSetCardClock(void *, XLLP_UINT8_T);
void XllpUsimEnableInterrupts(void *, XLLP_UINT32_T);
void XllpUsimDisableInterrupts(void *, XLLP_UINT32_T);
void XllpUsimGetInterruptSources(void *, XLLP_UINT32_T );
void XllpUsimClearInterruptSources(void *, XLLP_UINT32_T);
void XllpUsimClearFIFO(void *, Xllp_Usim_Clear_Fifo_T);
void XllpUsimModifyParityErrorMaskInFIFO(void *, XLLP_USIM_Mode_T);
void XllpUsimHoldTransmission(void *);
void XllpUsimContinueTransmission(void *);
void XllpUsimGetNumberOfParityErrors(void *, XLLP_UINT32_T);
void XllpUsimGetTransmitFifoBytes(void *, XLLP_UINT32_T);
void XllpUsimGetReceiveFifoBytes(void *, XLLP_UINT32_T);
void XllpUsimGetLineStatus(void *, XLLP_UINT32_T);
void XllpUsimSetExtraGuardTime(void *, XLLP_UINT8_T );
void XllpUsimSetBlockGuardTime(void *, XLLP_UINT8_T );
void XllpUsimSetTimeOutMoments(void *, XLLP_UINT8_T );
void XllpUsimGetCharacterWaitingTime(void *, XLLP_UINT32_T);
void XllpUsimGetBlockWaitingTime(void *, XLLP_UINT32_T);
void XllpUsimInitializeInterface(void *, void *, void *, Xllp_Usim_Card_Voltage_T);
void XllpUsimGpioConfiguration(P_XLLP_GPIO_T pGPIO);

// The following function is OS depended and will need to be ported by each OS!
void XllpWaitforMilliSeconds(XLLP_INT32_T);

#endif //__USIM_H__

⌨️ 快捷键说明

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