Matteo Martincigh | cdfb941 | 2019-11-08 11:23:06 +0000 | [diff] [blame] | 1 | // |
Jim Flynn | bbfe603 | 2020-07-20 16:57:44 +0100 | [diff] [blame] | 2 | // Copyright © 2019 Arm Ltd and Contributors. All rights reserved. |
Matteo Martincigh | cdfb941 | 2019-11-08 11:23:06 +0000 | [diff] [blame] | 3 | // SPDX-License-Identifier: MIT |
| 4 | // |
| 5 | |
| 6 | #pragma once |
| 7 | |
Jim Flynn | bbfe603 | 2020-07-20 16:57:44 +0100 | [diff] [blame] | 8 | #include <common/include/CommandHandlerFunctor.hpp> |
| 9 | #include <common/include/Packet.hpp> |
Matteo Martincigh | cdfb941 | 2019-11-08 11:23:06 +0000 | [diff] [blame] | 10 | |
| 11 | #include <vector> |
| 12 | |
| 13 | namespace armnn |
| 14 | { |
| 15 | |
| 16 | namespace gatordmock |
| 17 | { |
| 18 | |
| 19 | struct PacketVersion |
| 20 | { |
| 21 | uint16_t m_PacketFamily; |
| 22 | uint16_t m_PacketId; |
| 23 | uint32_t m_PacketVersion; |
| 24 | }; |
| 25 | |
Jim Flynn | bbfe603 | 2020-07-20 16:57:44 +0100 | [diff] [blame] | 26 | class StreamMetadataCommandHandler : public arm::pipe::CommandHandlerFunctor |
Matteo Martincigh | cdfb941 | 2019-11-08 11:23:06 +0000 | [diff] [blame] | 27 | { |
| 28 | |
| 29 | public: |
| 30 | /** |
| 31 | * @param familyId The family of the packets this handler will service |
| 32 | * @param packetId The id of packets this handler will process |
| 33 | * @param version The version of that id |
| 34 | * @param quietOperation Optional parameter to turn off printouts. This is useful for unit tests |
| 35 | */ |
| 36 | StreamMetadataCommandHandler(uint32_t familyId, |
| 37 | uint32_t packetId, |
| 38 | uint32_t version, |
| 39 | bool quietOperation = false) |
| 40 | : CommandHandlerFunctor(familyId, packetId, version) |
| 41 | , m_QuietOperation(quietOperation) |
| 42 | {} |
| 43 | |
Jim Flynn | bbfe603 | 2020-07-20 16:57:44 +0100 | [diff] [blame] | 44 | void operator()(const arm::pipe::Packet& packet) override; |
Matteo Martincigh | cdfb941 | 2019-11-08 11:23:06 +0000 | [diff] [blame] | 45 | |
| 46 | private: |
Jim Flynn | bbfe603 | 2020-07-20 16:57:44 +0100 | [diff] [blame] | 47 | void ParseData(const arm::pipe::Packet& packet); |
Matteo Martincigh | cdfb941 | 2019-11-08 11:23:06 +0000 | [diff] [blame] | 48 | |
| 49 | uint32_t m_PipeMagic; |
| 50 | uint32_t m_StreamMetadataVersion; |
| 51 | uint32_t m_MaxDataLen; |
| 52 | uint32_t m_Pid; |
| 53 | uint32_t m_OffsetInfo; |
| 54 | uint32_t m_OffsetHwVersion; |
| 55 | uint32_t m_OffsetSwVersion; |
| 56 | uint32_t m_OffsetProcessName; |
| 57 | uint32_t m_OffsetPacketVersionTable; |
| 58 | |
| 59 | std::string m_SoftwareInfo; |
| 60 | std::string m_HardwareVersion; |
| 61 | std::string m_SoftwareVersion; |
| 62 | std::string m_ProcessName; |
| 63 | |
| 64 | std::vector<PacketVersion> m_PacketVersionTable; |
| 65 | |
| 66 | bool m_QuietOperation; |
| 67 | }; |
| 68 | |
| 69 | } // namespace gatordmock |
| 70 | |
| 71 | } // namespace armnn |