for (i=0; i { WriteRawRC(FIFODataReg, pInData); } WriteRawRC(CommandReg, Command);
if (Command == PCD_TRANSCEIVE) { SetBitMask(BitFramingReg,0x80); }
// i = 600;//根据时钟频率调整,操作M1卡最大等待时间25ms i = 2000; do { n = ReadRawRC(ComIrqReg); i--; } while ((i!=0) && !(n&0x01) && !(n&waitFor)); ClearBitMask(BitFramingReg,0x80);
if (i!=0) { if(!(ReadRawRC(ErrorReg)&0x1B)) { status = MI_OK; if (n & irqEn & 0x01) { status = MI_NOTAGERR; } if (Command == PCD_TRANSCEIVE) { n = ReadRawRC(FIFOLevelReg); lastBits = ReadRawRC(ControlReg) & 0x07; if (lastBits) { *pOutLenBit = (n-1)*8 + lastBits; } else { *pOutLenBit = n*8; } if (n == 0) { n = 1; } if (n > MAXRLEN) { n = MAXRLEN; } for (i=0; i { pOutData = ReadRawRC(FIFODataReg); } } } else { status = MI_ERR; }
}
SetBitMask(ControlReg,0x80); // stop timer now WriteRawRC(CommandReg,PCD_IDLE); return status; }