Nikhil Raj | bc62605 | 2019-08-15 15:49:45 +0100 | [diff] [blame] | 1 | // |
| 2 | // Copyright © 2017 Arm Ltd. All rights reserved. |
| 3 | // SPDX-License-Identifier: MIT |
| 4 | // |
| 5 | #pragma once |
| 6 | |
| 7 | |
| 8 | #include <boost/log/trivial.hpp> |
| 9 | |
| 10 | #include <armnn/Exceptions.hpp> |
| 11 | |
| 12 | class Packet |
| 13 | { |
| 14 | public: |
| 15 | Packet(uint32_t header, uint32_t length, const char* data) |
| 16 | : m_Header(header), m_Length(length), m_Data(data) |
| 17 | { |
| 18 | m_PacketId = ((header >> 16) & 1023); |
| 19 | m_PacketFamily = (header >> 26); |
| 20 | |
| 21 | if (length == 0) |
| 22 | { |
| 23 | if (m_Data != nullptr) |
| 24 | { |
| 25 | throw armnn::Exception("Data should be null"); |
| 26 | } |
| 27 | } |
| 28 | }; |
| 29 | |
| 30 | uint32_t GetHeader() const; |
| 31 | uint32_t GetPacketFamily() const; |
| 32 | uint32_t GetPacketId() const; |
| 33 | uint32_t GetLength() const; |
| 34 | const char* GetData(); |
| 35 | |
| 36 | uint32_t GetPacketClass() const; |
| 37 | uint32_t GetPacketType() const; |
| 38 | |
| 39 | private: |
| 40 | uint32_t m_Header; |
| 41 | uint32_t m_PacketFamily; |
| 42 | uint32_t m_PacketId; |
| 43 | uint32_t m_Length; |
| 44 | const char* m_Data; |
| 45 | }; |