| 30 | } |
| 31 | |
| 32 | void StreamMetaDataProcessor::HandlePacket(const arm::pipe::Packet& packet) |
| 33 | { |
| 34 | if (packet.GetHeader() != m_MetaDataPacketHeader) |
| 35 | { |
| 36 | throw arm::pipe::ProfilingException("StreamMetaDataProcessor can only handle Stream Meta Data Packets"); |
| 37 | } |
| 38 | // determine the endianness of the protocol |
| 39 | TargetEndianness endianness; |
| 40 | if (ToUint32(packet.GetData(),TargetEndianness::BeWire) == arm::pipe::PIPE_MAGIC) |
| 41 | { |
| 42 | endianness = TargetEndianness::BeWire; |
| 43 | } |
| 44 | else if (ToUint32(packet.GetData(), TargetEndianness::LeWire) == arm::pipe::PIPE_MAGIC) |
| 45 | { |
| 46 | endianness = TargetEndianness::LeWire; |
| 47 | } |
| 48 | else |
| 49 | { |
| 50 | throw arm::pipe::ProfilingException("Protocol read error. Unable to read the PIPE_MAGIC value."); |
| 51 | } |
| 52 | m_FileOnlyProfilingConnection->SetEndianess(endianness); |
| 53 | // send back the acknowledgement |
| 54 | std::unique_ptr<unsigned char[]> uniqueNullPtr = nullptr; |
| 55 | arm::pipe::Packet returnPacket(0x10000, 0, uniqueNullPtr); |
| 56 | m_FileOnlyProfilingConnection->ReturnPacket(returnPacket); |
| 57 | } |
| 58 | |
| 59 | uint32_t StreamMetaDataProcessor::ToUint32(const unsigned char* data, TargetEndianness endianness) |
| 60 | { |
no test coverage detected