资源简介
ME(手机)操作SIM卡的底层驱动,驱动接口有添加手机号码,删除手机号码等接口,封装好发送命令到SIM卡与从SIM卡接收数据的函数,对SIM卡的数据传输I/O口使用UART单线传输,做SIM卡驱动的可以下载参考!
代码片段和文件信息
/*
FILE_NAME: sim_dirver.c
TARGET: ARM
OWENER: Wen Donghan
COMPLETE TIME: 2009-01-18
*/
/*******************************************************************************************************/
//#include //Interfacese commmands
#include “sim_driver.h“ //Interfacese commmands
cyg_thread thread_data;
cyg_handle_t thread_handle;
cyg_thread thread_data_b;
cyg_handle_t thread_handle_b;
unsigned char stack[CYGNUM_HAL_STACK_SIZE_TYPICAL];
unsigned char stack_b[CYGNUM_HAL_STACK_SIZE_TYPICAL];
cyg_io_handle_t handle;
static unsigned char sim_atr_TS;
static unsigned char sim_rx_buf[ SIM_RX_BUFSIZE ]; // rx ring buffer
int sim_rx_head sim_rx_tail;
static unsigned char sim_rx_data;
static unsigned char sim_rx_status = SIM_STATUS_OK;
static const unsigned char sim_interface_char_len[] = {
0 1 1 2 1 2 2 3 1 2 2 3 2 3 3 4
};
static bool sim_vaild_flag = false;
static cyg_uint8 resp2[1000];
bool SIM_OpenDriver(void) ;
cyg_uint8 SIM_ByteReverse(cyg_uint8 b);
static bool sim_get_state(void);
static void sim_set_state(bool state);
int diag_null(const char* fmt...)
{
return 0;
}
static void OSK5912_waitusec( unsigned long int usec )
{
struct timespec timeSleep;
timeSleep.tv_sec = usec / 1000000;
timeSleep.tv_nsec= (usec % 1000000)*1000;
nanosleep( &timeSleep NULL );
}
void init_simcard(void)
{
unsigned long int na1;
static int flag = 0;
#ifndef WITONE
// if (flag == 0)
{
flag = 1;
//SIM CARD TEST
//配置加电控制和复位引脚为输出
*GPIO2_DIRECTION&=0x0fbdf;
*ULPD_SDW_CLK_DIV_CTRL_SEL&=0x0fffd;
na1=*GPIO2_DATAIN;
*GPIO2_DATAOUT=(na1 & 0x0fbdf);
//加电
na1=*GPIO2_DATAIN;
*GPIO2_DATAOUT=(na1|0x0020);
//配置BCLK
*ULPD_SDW_CLK_DIV_CTRL_SEL&=0x0fd;
OSK5912_waitusec( 200 );
*ULPD_SDW_CLK_DIV_CTRL_SEL&=0x03;
OSK5912_waitusec( 200 );
//clk-----3MHz
//*ULPD_SDW_CLK_DIV_CTRL_SEL|=0x48;
//clk-----
*ULPD_SDW_CLK_DIV_CTRL_SEL|=0x24;
OSK5912_waitusec( 200 );
*ULPD_SDW_CLK_DIV_CTRL_SEL&=0x0fe;
OSK5912_waitusec( 200 );
//使能BCLK
*ULPD_SDW_CLK_DIV_CTRL_SEL|=0x02;
OSK5912_waitusec( 200000 );
OSK5912_waitusec( 200000 );
//脱离复位
na1=*GPIO2_DATAIN;
*GPIO2_DATAOUT=(na1|0x0400);
OSK5912_waitusec( 200000 );
OSK5912_waitusec( 200000 );
OSK5912_waitusec( 200000 );
OSK5912_waitusec( 200000 );
OSK5912_waitusec( 200000 );
OSK5912_waitusec( 200000 );
OSK5912_waitusec( 200000 );
OSK5912_waitusec( 200000 );
OSK5912_waitusec( 200000 );
OSK5912_waitusec( 200000 );
OSK5912_waitusec( 200000 );
}
#else
// if (flag == 0)
{
flag = 1;
//SIM CARD TEST
//配置加电控制和复位引脚为输出
//*GPIO2_DIRECTION&=0x0fbdf;
*GPIO2_DIRECTION&=0x0f9ff;//gpio25 sim contrl gpio26 sim reset
*ULPD_SDW_CLK_DIV_CTRL_SEL&=0x0fffd;
na1=*GPIO2_DATAIN;
//*GPIO2_DATAOUT=(na1 & 0x0
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 116450 2018-10-17 17:02 sim driver 手机SIM驱动\sim_driver.c
文件 7862 2009-06-30 15:45 sim driver 手机SIM驱动\sim_driver.h
目录 0 2014-04-21 22:00 sim driver 手机SIM驱动
----------- --------- ---------- ----- ----
124312 3
相关资源
- eSIM卡/贴片式SIM卡规格/规范/数据手册
- 各种SD卡 SIM卡 TF卡封装
- Micro SIM卡座 6Pin 弹出式 altium版本封装
- MICRO SIM卡座封装 小卡
- 贴片式SIM卡规格书pdf以及Allegro16.5封装
- NANO SIM卡 6P 翻盖 AD 封装.zip
- PC/SC 读卡程序,GSM SIM卡读卡程序及代
- SD卡、TF卡、SIM卡、AD的PCB封装库
- ATR解析器,可以解析SIM卡的ATR数据包
- Micro SIM卡座与TF卡座PCB封装带3D
- SIM卡抽屉式 PCB封装库,3D模型、pdf含
- SIM卡PCB封装库,3D模型、pdf含机械尺寸
- 6+1自弹式SIM卡座封装,以及TF卡座封装
- SIM卡和TFPCB封装库AD
- 4G卡usim卡读写软件
评论
共有 条评论