//-----***-unsigned char Decrease((bool SysKind,unsigned char FileId)-***-----// //---功能描述:钱包文件扣减。 //---输入条件:SysKind=0--->EasmChip的操作,SysKind=1-->CpuCard的操作,FileId二进制文件标识符 //---输出项目:RetData=0x00操作成功;RetData=0xFF此操作失败。 unsigned char Decrease(bool SysKind,unsigned char FileId,unsigned int DecData) { unsigned char i,Ucflag = 0xFF; RamCler(CosBuf,16); CmdBuf[CLA] = 0x80; CmdBuf[INS] = 0x30; CmdBuf[P01] = 0x00; FileId <<= 3; FileId = FileId+0x04; CmdBuf[P02] = FileId; CmdBuf[P03] = 3; CmdBuf[5] = 0; CmdBuf[6] = (unsigned char)(DecData >> 8);//-------------------------------nameh=0x3F CmdBuf[7] = (unsigned char)DecData;//--------------------------------------namel = 0x01 RamCler(CosBuf,16); for(i = 0; i < 3; i ++) { CosCommand(SysKind,2,3); if( (SwBuf[0] == 0x94) && (SwBuf[1] == 0x01) ) { i=5; break; } else { if( SwBuf[0] == 0x61 ) { Ucflag = GetResponse(SysKind,SwBuf[1]); if(Ucflag == 0x00) { break; } } } } if(i < 3) { return 0x00; } else { return 0xff; } } MSP430操作CPU卡原程序-----本人作品禁止任何形式的转载
相关链接:http://blog.21ic.com/user1/405/archives/2009/54992.html |