//-----***-void CosCommand(bool SysKind,unsigned char IccCase, unsigned char Length)-***-----// //---功能描述:系统命令发送。 //---输入条件:SysKind=0--->EasmChip的操作,SysKind=1-->CpuCard的操作,IccCase命令类别,Length命令长度。 //---输出项目:无。 void CosCommand(bool SysKind,unsigned char IccCase, unsigned char Length) { unsigned char AckBbuf = 0, i; WDT(); _DINT(); AckBbuf=0x00; SwBuf[0] = 0x00; SwBuf[1] = 0x00; for(i = 0; i < 5; i++) { CosSend(SysKind,CmdBuf); } AckBbuf = CosReceive(SysKind); if(AckBbuf==CmdBuf[1]) { switch(IccCase) { case 1: SwBuf[0] = CosReceive(SysKind); SwBuf[1] = CosReceive(SysKind); _NOP(); break; case 2: for(i = 5; i < Length + 5; i++) { CosSend(SysKind,CmdBuf); } SwBuf[0] = CosReceive(SysKind); SwBuf[1] = CosReceive(SysKind); _NOP(); break; case 3: for(i = 0; i < Length + 2; i++) { CosBuf = CosReceive(SysKind); } i--; SwBuf[1]=CosBuf; i--; SwBuf[0]=CosBuf; _NOP(); break; case 4: for(i = 5; i < Length + 5; i++) { CosSend(SysKind,CmdBuf); } Length = CosBuf; for(i = 0; i < Length + 2; i++) { CosBuf = CosReceive(SysKind); } i--; SwBuf[1]=CosBuf; i--; SwBuf[0]=CosBuf; _NOP(); break; } } _EINT(); } MSP430操作CPU卡原程序-----本人作品禁止任何形式的转载
相关链接:http://blog.21ic.com/user1/405/archives/2009/54986.html |