blob: ceb77d1b51028c6619e516d97ddd2e9e8d1eacd8 [file] [log] [blame]
Matteo Martincighcdfb9412019-11-08 11:23:06 +00001//
Jim Flynnbbfe6032020-07-20 16:57:44 +01002// Copyright © 2019 Arm Ltd and Contributors. All rights reserved.
Matteo Martincighcdfb9412019-11-08 11:23:06 +00003// SPDX-License-Identifier: MIT
4//
5
6#pragma once
7
Jim Flynnbbfe6032020-07-20 16:57:44 +01008#include <common/include/CommandHandlerFunctor.hpp>
9#include <common/include/Packet.hpp>
Matteo Martincighcdfb9412019-11-08 11:23:06 +000010
11#include <vector>
12
13namespace armnn
14{
15
16namespace gatordmock
17{
18
19struct PacketVersion
20{
21 uint16_t m_PacketFamily;
22 uint16_t m_PacketId;
23 uint32_t m_PacketVersion;
24};
25
Jim Flynnbbfe6032020-07-20 16:57:44 +010026class StreamMetadataCommandHandler : public arm::pipe::CommandHandlerFunctor
Matteo Martincighcdfb9412019-11-08 11:23:06 +000027{
28
29public:
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 Flynnbbfe6032020-07-20 16:57:44 +010044 void operator()(const arm::pipe::Packet& packet) override;
Matteo Martincighcdfb9412019-11-08 11:23:06 +000045
46private:
Jim Flynnbbfe6032020-07-20 16:57:44 +010047 void ParseData(const arm::pipe::Packet& packet);
Matteo Martincighcdfb9412019-11-08 11:23:06 +000048
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