Exemplo n.º 1
0
// ------------------------------------------------------------------------------
void RFFEAnalyzer::FindInterruptSlots() {
  for (S8 i = 15; i >= 0; i -= 1) {
    U64 byte = GetBitStream(1);
    FillInFrame(RFFEAnalyzerResults::RffeIntSlotField, byte, i, 0, 1, 0); // Send int number as a note
    FindBusPark();
  }
}
Exemplo n.º 2
0
// ------------------------------------------------------------------------------
void RFFEAnalyzer::FindByteFrame(RFFEAnalyzerResults::RffeFrameType type) {
  U64 byte = GetBitStream(8);
  FillInFrame(type, byte, 0, 0, 8, 0);
  FindParity(RFFEUtil::CalcParity(byte), 1);
}
Exemplo n.º 3
0
// ------------------------------------------------------------------------------
U8 RFFEAnalyzer::FindCommandFrame() {
  U8 byte_count = 0;
  U8 flags = 0;
  U64 RffeID;
  U64 RffeCmd;

  // Get RFFE SA+Command (4 + 8 bits) and decode the fields
  // Why grab all 12 bits?  So we can calculate parity across the SA+Cmd field
  // after we are done parsing the Command
  RffeCmd = GetBitStream(12);

  // Now look at the RFFE command and decode the various options.
  mRffeCmdType = RFFEUtil::decodeRFFECmdFrame((U8)(RffeCmd & 0xFF));
  byte_count = RFFEUtil::byteCount((U8)RffeCmd);
  RffeID = (RffeCmd & 0xF00) >> 8;

  // Check for an invalid Master address, if this is a Master Command
  if ((mRffeCmdType == RFFEAnalyzerResults::RffeTypeMasterRead || mRffeCmdType == RFFEAnalyzerResults::RffeTypeMasterWrite ||
       mRffeCmdType == RFFEAnalyzerResults::RffeTypeMasterHandoff) &&
      (RffeID > 0x3)) {
    flags = RFFE_INVALID_MASTER_ID;
  }
  // Log the Master or Slave Address
  FillInFrame(RFFEAnalyzerResults::RffeSAField, RffeID, 0, 0, 4, flags);
  flags = 0;

  switch (mRffeCmdType) {
    case RFFEAnalyzerResults::RffeTypeReserved:
      // 8 Bit Reserved Cmd Type
      flags |= (DISPLAY_AS_ERROR_FLAG | DISPLAY_AS_WARNING_FLAG | RFFE_INVALID_CMD_ERROR_FLAG);
      FillInFrame(RFFEAnalyzerResults::RffeCommandField, mRffeCmdType, 0, 4, 12, flags);
      break;
    case RFFEAnalyzerResults::RffeTypeMasterRead:
    case RFFEAnalyzerResults::RffeTypeMasterWrite:
    case RFFEAnalyzerResults::RffeTypeMasterHandoff:
    case RFFEAnalyzerResults::RffeTypeInterrupt:
      // Interrupt/Master commands - 8 Bit RFFE Command
      FillInFrame(RFFEAnalyzerResults::RffeCommandField, mRffeCmdType, 0, 4, 12, flags);
      break;
    case RFFEAnalyzerResults::RffeTypeExtWrite:
    case RFFEAnalyzerResults::RffeTypeExtRead:
      // 4 Bit Command w/ 4 bit Byte Count
      FillInFrame(RFFEAnalyzerResults::RffeCommandField, mRffeCmdType, 0, 4, 8, flags);
      FillInFrame(RFFEAnalyzerResults::RffeExByteCountField, (RffeCmd & 0x0F), 0, 8, 12, flags);
      break;
    case RFFEAnalyzerResults::RffeTypeExtLongWrite:
    case RFFEAnalyzerResults::RffeTypeExtLongRead:
      // 5 Bit Command w/ 3 bit Byte Count
      FillInFrame(RFFEAnalyzerResults::RffeCommandField, mRffeCmdType, 0, 4, 9, flags);
      FillInFrame(RFFEAnalyzerResults::RffeExLongByteCountField, (RffeCmd & 0x07), 0, 9, 12, flags);
      break;
    case RFFEAnalyzerResults::RffeTypeNormalWrite:
    case RFFEAnalyzerResults::RffeTypeNormalRead:
      // 3 Bit Command w/ 5 bit Addr
      FillInFrame(RFFEAnalyzerResults::RffeCommandField, mRffeCmdType, 0, 4, 7, flags);
      FillInFrame(RFFEAnalyzerResults::RffeAddressField, (RffeCmd & 0x1F), 0, 7, 12, flags);
      break;
    case RFFEAnalyzerResults::RffeTypeWrite0:
      // 1 Bit Command w/ 7 bit Write Data
      FillInFrame(RFFEAnalyzerResults::RffeCommandField, mRffeCmdType, 0, 4, 5, flags);
      FillInFrame(RFFEAnalyzerResults::RffeShortDataField, (RffeCmd & 0x7F), 0, 5, 12, flags);
      break;
  }

  // Check Parity - Parity bit covers the full SA/Command field (12 bits)
  FindParity(RFFEUtil::CalcParity(RffeCmd), 0);

  return byte_count;
}
Exemplo n.º 4
0
// ------------------------------------------------------------------------------
U8 RFFEAnalyzer::FindISI() {
  U64 byte = GetBitStream(2);
  FillInFrame(RFFEAnalyzerResults::RffeISIField, byte, 0, 0, 2, 0);
  FindBusPark();
  return (byte & 0x2); // Return the ISI bit
}
Exemplo n.º 5
0
//解析数据码字内容
void ContentDecoder::ParseDataCodeWord()
{
	int i,j;

	m_nVersionGroup = m_nVersion >= 27 ? QR_VRESION_L : (m_nVersion >= 10 ? QR_VRESION_M : QR_VRESION_S);
	m_nIndex=0;

	//int ncComplete;//已读取字节数
	unsigned short wData;
	unsigned short wIndicator;
	//int i,j;
	for(i=0;i<m_ncDataCodeWord && m_nIndex != -1; i++)
	{
		wData=GetBitStream(4);
		if(wData==0)//0000b终止
		{
			//AfxMessageBox("终止符");
			break;
		}
		else if(wData==1)//0001b数字模式
		{
			wIndicator=GetBitStream(nIndicatorLenNumeral[m_nVersionGroup]);
			for(j=0;j<wIndicator;j+=3)
			{
				QString temp;
				if(j<wIndicator-2)
				{
					wData=GetBitStream(10);
					temp = QString::number(wData/100);
					m_strData+=temp;
					temp = QString::number((wData%100)/10);
					m_strData+=temp;
					temp = QString::number(wData%10);
					m_strData+=temp;
				}
				else if (j == wIndicator-2)
				{
					//剩余2个
					wData=GetBitStream(7);
					temp = QString::number(wData/10);
					m_strData+=temp;
					temp = QString::number(wData%10);
					m_strData+=temp;
				}
				else if (j == wIndicator-1)
				{
					//剩余1个
					wData=GetBitStream(4);
					temp = QString::number(wData);
					m_strData+=temp;
				}
			}

		}
		else if(wData==2)//0010b字母数字
		{
			wIndicator=GetBitStream(nIndicatorLenAlphabet[m_nVersionGroup]);
			for(j=0; j<wIndicator;j+=2)
			{
				if(j<wIndicator-1)
				{
					wData=GetBitStream(11);
					m_strData+=BinaryToAlphabet((unsigned char)(wData/45));
					m_strData+=BinaryToAlphabet((unsigned char)(wData%45));
				}
				else
				{
					//剩余1个
					wData=GetBitStream(6);
					m_strData+=BinaryToAlphabet((unsigned char)wData);
				}
			}
		}
		else if(wData==4)//0100b8位字节
		{
			wIndicator=GetBitStream(nIndicatorLen8Bit[m_nVersionGroup]);
			for(j=0;j<wIndicator;j++)
			{
				wData=GetBitStream(8);
				m_strData+=(char)wData;
			}
		}
		else if(wData==13)//1101b中国汉字
		{
			//GetBitStream(4);
			wIndicator=GetBitStream(nIndicatorLenHanzi[m_nVersionGroup]);
			for(j=0;j<wIndicator;j++)
			{
				wData=GetBitStream(13);

				//汉字字符转换
				unsigned char by1,by2;
				by1=(wData/0x60)<<8;
				if(by1<=0x09)
					by1+=0xA1;
				else//>=0x0A
					by1+=0xA6;
				by2=wData%0x60;
				by2+=0xA1;
				m_strData+=(char)by1;
				m_strData+=(char)by2;
			}
		}
		else//其他
		{
			QMessageBox::critical(NULL, "Error", "不支持的字符集");
			exit(0);
		}
	}
}